mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Fix corrupt item cache crashes, bot whispers, trade crashes
This commit is contained in:
@@ -13,6 +13,8 @@
|
||||
#include <cctype>
|
||||
#include <locale>
|
||||
#include <sstream>
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
|
||||
void split(std::vector<std::string>& dest, std::string const str, char const* delim)
|
||||
{
|
||||
|
||||
@@ -1259,7 +1259,7 @@ bool PlayerbotAI::TellMasterNoFacing(std::string const text, PlayerbotSecurityLe
|
||||
type = currentChat.first;
|
||||
|
||||
WorldPacket data;
|
||||
ChatHandler::BuildChatPacket(data, type == CHAT_MSG_ADDON ? CHAT_MSG_PARTY : type, type == CHAT_MSG_ADDON ? LANG_ADDON : LANG_UNIVERSAL, nullptr, bot, text.c_str());
|
||||
ChatHandler::BuildChatPacket(data, type == CHAT_MSG_ADDON ? CHAT_MSG_PARTY : type, type == CHAT_MSG_ADDON ? LANG_ADDON : LANG_UNIVERSAL, bot, nullptr, text.c_str());
|
||||
master->SendDirectMessage(&data);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include "Common.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "TalentSpec.h"
|
||||
#include "Talentspec.h"
|
||||
|
||||
#include <mutex>
|
||||
|
||||
|
||||
@@ -2350,7 +2350,9 @@ void PlayerbotFactory::InitInventoryTrade()
|
||||
break;
|
||||
case ITEM_QUALITY_UNCOMMON:
|
||||
stacks = 1;
|
||||
count = urand(1, proto->GetMaxStackSize() / 2);
|
||||
int maxStackSize = proto->GetMaxStackSize()/2;
|
||||
uint32 max = std::max(1, maxStackSize);
|
||||
count = urand(1, max);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "Playerbots.h"
|
||||
#include "PlayerbotDbStore.h"
|
||||
#include "PlayerbotFactory.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
PlayerbotHolder::PlayerbotHolder() : PlayerbotAIBase(false)
|
||||
{
|
||||
|
||||
@@ -2108,7 +2108,7 @@ void RandomItemMgr::BuildEquipCache()
|
||||
stmt->SetData(1, level);
|
||||
stmt->SetData(2, slot);
|
||||
stmt->SetData(3, quality);
|
||||
stmt->SetData(4, quality);
|
||||
stmt->SetData(4, proto->ItemId);
|
||||
PlayerbotsDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
class Player;
|
||||
class WorldSession;
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
#include "Trigger.h"
|
||||
#include "Value.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
class PlayerbotAI;
|
||||
|
||||
class AiObjectContext : public PlayerbotAIAware
|
||||
|
||||
@@ -97,7 +97,7 @@ void CustomStrategy::LoadActionLines(uint32 owner)
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
std::string const action = fields[0].Get<std::string>();
|
||||
std::string const action = fields[1].Get<std::string>();
|
||||
actionLines.push_back(action);
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
#include "AddLootAction.h"
|
||||
#include "AttackAction.h"
|
||||
#include "AutoLearnSpellAction.h"
|
||||
#include "BattlegroundTactics.h"
|
||||
#include "BattlegroundJoinAction.h"
|
||||
#include "BattleGroundTactics.h"
|
||||
#include "BattleGroundJoinAction.h"
|
||||
#include "BuyAction.h"
|
||||
#include "CastCustomSpellAction.h"
|
||||
#include "ChangeStrategyAction.h"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it and/or modify it under version 2 of the License, or (at your option), any later version.
|
||||
*/
|
||||
|
||||
#include "BattlegroundJoinAction.h"
|
||||
#include "BattleGroundJoinAction.h"
|
||||
#include "ArenaTeam.h"
|
||||
#include "ArenaTeamMgr.h"
|
||||
#include "BattlegroundMgr.h"
|
||||
@@ -939,7 +939,7 @@ bool BGStatusAction::Execute(Event event)
|
||||
{
|
||||
if (ginfo.IsInvitedToBGInstanceGUID && !bot->InBattleground())
|
||||
{
|
||||
Battleground* bg = sBattlegroundMgr->GetBattleground(ginfo.IsInvitedToBGInstanceGUID);
|
||||
Battleground* bg = sBattlegroundMgr->GetBattleground(ginfo.IsInvitedToBGInstanceGUID, _bgTypeId);
|
||||
if (bg)
|
||||
{
|
||||
if (isArena)
|
||||
@@ -1038,7 +1038,7 @@ bool BGStatusAction::Execute(Event event)
|
||||
|
||||
if (ginfo.IsInvitedToBGInstanceGUID)
|
||||
{
|
||||
Battleground* bg = sBattlegroundMgr->GetBattleground(ginfo.IsInvitedToBGInstanceGUID);
|
||||
Battleground* bg = sBattlegroundMgr->GetBattleground(ginfo.IsInvitedToBGInstanceGUID, _bgTypeId);
|
||||
if (!bg)
|
||||
{
|
||||
LOG_ERROR("playerbots", "Bot {} {}:{} <{}>: Missing QueueInfo for {} {}",
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it and/or modify it under version 2 of the License, or (at your option), any later version.
|
||||
*/
|
||||
|
||||
#include "BattlegroundTactics.h"
|
||||
#include "BattleGroundTactics.h"
|
||||
#include "ArenaTeam.h"
|
||||
#include "ArenaTeamMgr.h"
|
||||
#include "BattlegroundMgr.h"
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
#include "ReviveFromCorpseAction.h"
|
||||
#include "RewardAction.h"
|
||||
#include "RtiAction.h"
|
||||
#include "RTSCAction.h"
|
||||
#include "RtscAction.h"
|
||||
#include "SaveManaAction.h"
|
||||
#include "SellAction.h"
|
||||
#include "SetCraftAction.h"
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "AcceptResurrectAction.h"
|
||||
#include "AreaTriggerAction.h"
|
||||
#include "ArenaTeamActions.h"
|
||||
#include "BattlegroundTactics.h"
|
||||
#include "BattleGroundTactics.h"
|
||||
#include "CheckMountStateAction.h"
|
||||
#include "GuildAcceptAction.h"
|
||||
#include "GuildCreateActions.h"
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "LootValues.h"
|
||||
#include "PvpValues.h"
|
||||
#include "QuestValues.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
class PlayerbotAI;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user