[Bots] Fix crash related to GetTempSpellType() (#4649)

_tempSpellType was not getting defined during bot spawn process which could lead to a potential crash in RaidGroupSay.

Auto archery toggle was what triggered the crash as it announces their status on spawn.

Also moved this toggle for Rangers further down the proccess line.
This commit is contained in:
nytmyr
2025-02-06 03:14:25 -06:00
committed by GitHub
parent 5cebc42f89
commit 0dde51f518
2 changed files with 7 additions and 5 deletions
+6 -4
View File
@@ -106,6 +106,7 @@ Bot::Bot(NPCType *npcTypeData, Client* botOwner) : NPC(npcTypeData, nullptr, glm
LoadDefaultBotSettings();
SetCastedSpellType(UINT16_MAX);
SetTempSpellType(UINT16_MAX);
SetCommandedSpell(false);
SetPullingSpell(false);
@@ -189,6 +190,7 @@ Bot::Bot(
SetSpawnStatus(false);
SetBotCharmer(false);
SetCastedSpellType(UINT16_MAX);
SetTempSpellType(UINT16_MAX);
SetCommandedSpell(false);
SetPullingSpell(false);
@@ -3669,10 +3671,6 @@ bool Bot::Spawn(Client* botCharacterOwner) {
}
}
if (IsBotRanged()) {
ChangeBotRangedWeapons(true);
}
if (auto raid = entity_list.GetRaidByBotName(GetName())) {
// Safety Check to confirm we have a valid raid
auto owner = GetBotOwner();
@@ -3706,6 +3704,10 @@ bool Bot::Spawn(Client* botCharacterOwner) {
CheckBotSpells(); //This runs through a serious of checks and outputs any spells that are set to the wrong spell type in the database
}
if (IsBotRanged()) {
ChangeBotRangedWeapons(true);
}
return true;
}
+1 -1
View File
@@ -1218,7 +1218,7 @@ private:
std::vector<Mob*> _group_spell_target_list;
Raid* _storedRaid;
bool _verifiedRaid;
uint16 _tempSpellType;
uint16 _tempSpellType; // this is used to check the spell type being cast against ^spellannouncecasts status
// Private "base stats" Members
int32 _baseMR;