mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-11 23:33:50 +00:00
feat(world): guilds in the world: create box, character component, guild commands
The world side of guilds (docs/Guilds.md): - TMP_GUILD_CREATE, which the client's guild create box sends to its world, goes to the chat server as GUILD_CREATE. - The character component reads the character's guild from the database when it loads (instead of the old unused "gn" and "gid" charxml attributes) and takes GUILD_GET_STATUS from the chat server; a change is serialized once (the client redraws the name billboard every time it reads a guild name). A name waiting for moderation isn't shown. - Slash commands (the client has none for guilds): /g and /guild (guild chat; the client's guild tab sends /g, which goes through the chat filter and mute like zone chat, then to the chat server as channel 10), /guildcreate (opens the create box with DisplayGuildCreateBox), /gkick, /grank <name> <officer|veteran|recruit>, /gleader and /gdisband confirm. - The Guild Master script (LOT 3001, L_GUILD_CREATE.lua: using it opens the create box). Live never placed it; GMs can spawn it. Check in game (two accounts, a client with a FeatureGating row "guilds", 1, 0, 0 in its cdclient.fdb): /guildcreate, make a guild (the name shows under yours, the guild button appears on the status bar); invite the second character from the guild window, accept, both lists show both; guild chat tab; /grank, /gkick, /gleader; leave from the window; log the second character out and in (guildmate logged off/in lines). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -669,6 +669,15 @@ namespace {
|
||||
Game::server->Send(bitStream, sysAddr, false); //send routed packet to player
|
||||
});
|
||||
|
||||
// A player's guild changed (docs/Guilds.md): it shows under their name
|
||||
handlers.On<ChatPackets::GuildStatus>(MessageType::Chat::GUILD_GET_STATUS, [](const ChatPackets::GuildStatus& status, const SystemAddress&) {
|
||||
auto* player = Game::entityManager->GetEntity(status.characterID);
|
||||
auto* characterComponent = player ? player->GetComponent<CharacterComponent>() : nullptr;
|
||||
if (!characterComponent) return;
|
||||
characterComponent->SetGuild(status.guildID, status.guildName.string);
|
||||
Game::entityManager->SerializeEntity(player);
|
||||
});
|
||||
|
||||
// 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);
|
||||
@@ -1425,6 +1434,19 @@ namespace {
|
||||
}
|
||||
};
|
||||
|
||||
// The guild create box (docs/Guilds.md): the chat server makes the guild
|
||||
struct TmpGuildCreatePacket final : public WorldPackets::TmpGuildCreate {
|
||||
void Handle() override {
|
||||
auto* user = UserManager::Instance()->GetUser(sysAddr);
|
||||
const auto* const lastChar = user ? user->GetLastUsedChar() : nullptr;
|
||||
if (!lastChar) return;
|
||||
ChatPackets::GuildCreate create;
|
||||
create.playerID = lastChar->GetObjectID();
|
||||
create.guildName = LUWString(guildName, ChatPackets::GuildCreate().guildName.size);
|
||||
ChatServerLink::Send(create);
|
||||
}
|
||||
};
|
||||
|
||||
struct StringCheckPacket final : public WorldPackets::StringCheck {
|
||||
void Handle() override {
|
||||
const auto receiver = GetNarrowReceiver();
|
||||
@@ -1707,6 +1729,7 @@ namespace {
|
||||
{ MessageType::World::ROUTE_PACKET, Create<RoutePacket> },
|
||||
{ MessageType::World::STRING_CHECK, Create<StringCheckPacket> },
|
||||
{ MessageType::World::GENERAL_CHAT_MESSAGE, Create<GeneralChatMessagePacket> },
|
||||
{ MessageType::World::TMP_GUILD_CREATE, Create<TmpGuildCreatePacket> },
|
||||
{ MessageType::World::HANDLE_FUNNESS, Create<HandleFunnessPacket> },
|
||||
{ MessageType::World::UI_HELP_TOP_5, Create<UIHelpTop5Packet> },
|
||||
{ MessageType::World::REQUEST_UGC_MANIFEST_INFO, Create<RequestUgcManifestInfoPacket> },
|
||||
|
||||
Reference in New Issue
Block a user