From 8352af3b20f2a6de27e304c9dda41e89fd235c41 Mon Sep 17 00:00:00 2001 From: trickerer Date: Tue, 30 Apr 2024 11:52:35 +0700 Subject: [PATCH] NPCBots: Fix class set equipment vendor items for extra bot classes (cherry picked from commit 68204c659c05779a592298df14baf03be76b3993) --- src/server/game/AI/NpcBots/botmgr.cpp | 35 ++++++++++++++++++++++++++- src/server/game/AI/NpcBots/botmgr.h | 1 + 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/server/game/AI/NpcBots/botmgr.cpp b/src/server/game/AI/NpcBots/botmgr.cpp index ab1c0ac707c41..7c0a9a862bef3 100644 --- a/src/server/game/AI/NpcBots/botmgr.cpp +++ b/src/server/game/AI/NpcBots/botmgr.cpp @@ -637,7 +637,7 @@ uint32 BotMgr::GetAllNpcBotsClassMask() const { uint32 classMask = 0; for (BotMap::const_iterator itr = _bots.begin(); itr != _bots.end(); ++itr) - classMask |= (1 << (itr->second->GetBotClass() - 1)); + classMask |= (1 << (BotMgr::GetBotEquipmentClass(itr->second->GetBotClass()) - 1)); return classMask; } @@ -1975,6 +1975,39 @@ uint8 BotMgr::GetBotPlayerRace(Creature const* bot) return GetBotPlayerRace(bot->GetBotAI()->GetBotClass(), bot->GetRace()); } +uint8 BotMgr::GetBotEquipmentClass(uint8 bot_class) +{ + if (bot_class >= BOT_CLASS_EX_START) + { + switch (bot_class) + { + case BOT_CLASS_BM: + return BOT_CLASS_WARRIOR; + case BOT_CLASS_SPHYNX: + return BOT_CLASS_PALADIN; + case BOT_CLASS_ARCHMAGE: + return BOT_CLASS_MAGE; + case BOT_CLASS_DREADLORD: + return BOT_CLASS_PALADIN; + case BOT_CLASS_SPELLBREAKER: + return BOT_CLASS_PALADIN; + case BOT_CLASS_DARK_RANGER: + return BOT_CLASS_HUNTER; + case BOT_CLASS_NECROMANCER: + return BOT_CLASS_PALADIN; + case BOT_CLASS_SEA_WITCH: + return BOT_CLASS_MAGE; + case BOT_CLASS_CRYPT_LORD: + return BOT_CLASS_WARRIOR; + default: + TC_LOG_ERROR("npcbots", "GetPlayerClass: unknown Ex bot class {}!", bot_class); + return BOT_CLASS_PALADIN; + } + } + + return BotMgr::GetBotPlayerClass(bot_class); +} + std::string BotMgr::GetTargetIconString(uint8 icon) const { std::ostringstream ss; diff --git a/src/server/game/AI/NpcBots/botmgr.h b/src/server/game/AI/NpcBots/botmgr.h index 3ad295b3975c9..7d9f0070665dc 100644 --- a/src/server/game/AI/NpcBots/botmgr.h +++ b/src/server/game/AI/NpcBots/botmgr.h @@ -224,6 +224,7 @@ class TC_GAME_API BotMgr static uint8 GetBotPlayerRace(uint8 bot_class, uint8 bot_race); static uint8 GetBotPlayerClass(Creature const* bot); static uint8 GetBotPlayerRace(Creature const* bot); + static uint8 GetBotEquipmentClass(uint8 bot_class); std::string GetTargetIconString(uint8 icon) const;