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>
This commit is contained in:
Aaron Kimbrell
2026-09-29 08:32:02 -05:00
parent 553c024bee
commit 00b62edfa0

View File

@@ -2,22 +2,23 @@
#include "CharacterComponent.h"
#include "ChatPackets.h"
#include "EffectsMessages.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: the Guild Master says it in a chat
// bubble over its head and in system chat. The client itself says the same (MSG_GUILD_ALREADY_IN_GUILD, system chat)
// only once the box is submitted (LWOGuildComponent::SendTMPGuildCreate).
// 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) {
constexpr auto text = u"You are already in a guild!";
GameMessages::DisplayChatBubble bubble;
bubble.target = self->GetObjectID();
bubble.wsText = text;
bubble.Send(user->GetSystemAddress());
ChatPackets::SendSystemMessage(user->GetSystemAddress(), text);
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;
}