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.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user