Skip to content

Commit

Permalink
Fixed bugs around chat filter/settings
Browse files Browse the repository at this point in the history
  • Loading branch information
3vcloud committed Dec 2, 2024
1 parent 4f7a87f commit f456233
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion GWToolboxdll/Modules/ChatFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ void ChatFilter::Initialize()
GW::UI::UIMessage::kPlayerChatMessage
};
for (auto message_id : message_ids) {
GW::UI::RegisterUIMessageCallback(&BlockIfApplicable_Entry, message_id, OnUIMessage, -0x8000);
GW::UI::RegisterUIMessageCallback(&BlockIfApplicable_Entry, message_id, OnUIMessage, -0x8001);
}
}

Expand Down
10 changes: 6 additions & 4 deletions GWToolboxdll/Modules/ChatSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ namespace {
}


std::wstring rewritten_message;

// Allow clickable name when a player pings "I'm following X" or "I'm targeting X"
void OnLocalChatMessage(GW::HookStatus* status, GW::UI::UIMessage, void* wParam, void*)
{
Expand All @@ -121,8 +119,7 @@ namespace {
return;
if (*packet->message != 0x778 && *packet->message != 0x781)
return; // Not "I'm Following X" or "I'm Targeting X" message.

rewritten_message = packet->message;
std::wstring rewritten_message = packet->message;
size_t start_idx = rewritten_message.find(L"\xba9\x107");
if (start_idx == std::wstring::npos) {
return; // Not a player name.
Expand All @@ -146,6 +143,9 @@ namespace {
rewritten_message.insert(start_idx, L"<a=1>");
rewritten_message.insert(end_idx + 5, L"</a>");

status->blocked = true;
GW::Chat::WriteChatEnc(packet->channel, rewritten_message.c_str(), sender->name_enc);

packet->message = rewritten_message.data();
}

Expand Down Expand Up @@ -298,6 +298,8 @@ namespace {
} break;
case GW::UI::UIMessage::kPlayerChatMessage: {
OnLocalChatMessage(status, message_id, wParam, lParam);
if (status->blocked)
return;
// Hide player chat message speech bubbles by redirecting from 0x10000081 to 0x1000007E
if (hide_player_speech_bubbles)
return;
Expand Down

0 comments on commit f456233

Please sign in to comment.