Files
DarkflameServer/dScripts/ai/FV/FvGuildCreate.cpp
Aaron Kimbrell 00b62edfa0 fix(guilds): the Guild Master speaks in local chat so its bubble shows
DisplayChatBubble from the server doesn't show: in live it was only raised by client scripts. For a local chat line
the client puts a chat bubble over the sender, plays its talk animation and adds the line under the sender's name
(the chat handler raises DisplayChatBubble on the sender object), so the Guild Master now sends that player a local
chat line as itself, as property model chat does. Check: use the Guild Master while in a guild: bubble over it, it
talks, the line shows under its name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 08:32:02 -05:00

30 lines
1.3 KiB
C++

#include "FvGuildCreate.h"
#include "CharacterComponent.h"
#include "ChatPackets.h"
#include "eChatChannel.h"
#include "Entity.h"
#include "PlayerMessages.h"
void FvGuildCreate::OnUse(Entity* self, Entity* user) {
// A player already in a guild is told so instead of getting the create box, by the Guild Master saying it in local
// chat to that player: for a local chat line the client puts a chat bubble over the sender, plays its "talk"
// animation and adds the line under the sender's name (PacketHandler_MSG_CHAT_GENERAL_CHAT_MESSAGE). The text is
// the client's own MSG_GUILD_ALREADY_IN_GUILD, which the client itself shows only once the box is submitted.
const auto* characterComponent = user->GetComponent<CharacterComponent>();
if (characterComponent && characterComponent->GetGuildID() != LWOOBJID_EMPTY) {
ChatPackets::Client::GeneralChatMessage chat;
chat.chatChannel = static_cast<uint8_t>(eChatChannel::LOCAL);
chat.senderName = LUWString("%[Objects_" + std::to_string(self->GetLOT()) + "_name]");
chat.senderID = self->GetObjectID();
chat.message = u"You are already in a guild!";
chat.Send(user->GetSystemAddress());
return;
}
GameMessages::DisplayGuildCreateBox box;
box.target = user->GetObjectID();
box.bShow = true;
box.Send(user->GetSystemAddress());
}