From dc490d7e2bd26f40f722c48d4b75c9e57d2ae653 Mon Sep 17 00:00:00 2001 From: Karrz1 <127596890+Karrz1@users.noreply.github.com> Date: Mon, 16 Nov 2026 20:09:48 +0000 Subject: [PATCH] Bots: one click on Trade accepts a trade with a bot (SIN's fix) SIN's Bot Trading fix for 0.1.36, as he wrote it. The add-on puts its own button over the stock Trade button; when a bot is the trader it asks the server for a view of the trade, and a click sends that view back, so the server accepts only the trade the player saw. Solo players send the request as a hidden whisper to themselves; grouped players use the add-on channel. Code by SIN (1amcoff1n). Applied unchanged; only the add-on version is set to 0.6.22. --- src/server/game/Handlers/ChatHandler.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/server/game/Handlers/ChatHandler.cpp b/src/server/game/Handlers/ChatHandler.cpp index dca368cd37..964776a146 100644 --- a/src/server/game/Handlers/ChatHandler.cpp +++ b/src/server/game/Handlers/ChatHandler.cpp @@ -347,6 +347,21 @@ ChatMessageResult WorldSession::HandleChatMessage(ChatMsg type, Language lang, s (HasPermission(rbac::RBAC_PERM_CAN_FILTER_WHISPERS) && !sender->isAcceptWhispers() && !sender->IsInWhisperWhiteList(receiver->GetGUID()))) sender->AddWhisperWhiteList(receiver->GetGUID()); + // The solo trade addon uses a self-whisper as its request transport. + // Dispatch it privately before Whisper() can emit a GM conversation invite. + if (receiver == sender && msg.starts_with("FBTrade ") && msg.size() < 140) + { + size_t split = msg.find(' ', 8); + if (split > 8 && split <= 16 && msg.find_first_not_of("0123456789abcdef", 8) == split) + { + std::string_view payload = std::string_view(msg).substr(split + 1); + if (payload == "view" || (!payload.empty() && payload.find_first_not_of("0123456789:") == std::string_view::npos)) + { + sScriptMgr->OnPlayerChatSent(sender, type, lang, msg, receiver); + break; + } + } + } GetPlayer()->Whisper(msg, lang, receiver); sScriptMgr->OnPlayerChatSent(GetPlayer(), type, lang, msg, receiver); break;