mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-04 03:43:43 +00:00
feat(world): activity lobbies join, ready and leave through the chat server
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -69,6 +69,8 @@
|
||||
#include "Entity.h"
|
||||
#include "Character.h"
|
||||
#include "ChatPackets.h"
|
||||
#include "ScriptedActivityComponent.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
#include "WorldRoutePacket.h"
|
||||
#include "ChatServerLink.h"
|
||||
#include "PacketDispatcher.h"
|
||||
@@ -768,6 +770,17 @@ namespace {
|
||||
Game::entityManager->SerializeEntity(player);
|
||||
});
|
||||
|
||||
// An activity lobby's match has its instance (docs/Matchmaking.md): send our players in it there
|
||||
handlers.On<ChatPackets::MatchTransfer>(MessageType::Chat::MATCH_TRANSFER, [](const ChatPackets::MatchTransfer& transfer, const SystemAddress&) {
|
||||
for (auto* entity : Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::SCRIPTED_ACTIVITY)) {
|
||||
auto* activity = entity->GetComponent<ScriptedActivityComponent>();
|
||||
if (!activity || activity->GetActivityID() != transfer.activityID || !activity->HasLobby()) continue;
|
||||
activity->StartMatch(transfer);
|
||||
return;
|
||||
}
|
||||
LOG("Matchmaking: no activity %i in this world for a match of %zu player(s)", transfer.activityID, transfer.players.size());
|
||||
});
|
||||
|
||||
// New mail for a player the chat server says is in this world
|
||||
handlers.On<ChatPackets::MailNotify>(MessageType::Chat::MAIL, [](const ChatPackets::MailNotify& notify, const SystemAddress&) {
|
||||
Mail::NotifyNewMailHere(notify.receiverID);
|
||||
|
||||
Reference in New Issue
Block a user