From 8dff68f6abd19ad9d7695ff90d83d4efe25faac1 Mon Sep 17 00:00:00 2001 From: Emagi Date: Sat, 1 Feb 2025 07:23:32 -0500 Subject: [PATCH] When subsystems are reloading don't allow NPCs or Bots to try to access the spell list --- source/WorldServer/Bots/Bot.cpp | 33 +++++++++++++++++++++++++++++++++ source/WorldServer/NPC.cpp | 9 +++++++++ 2 files changed, 42 insertions(+) diff --git a/source/WorldServer/Bots/Bot.cpp b/source/WorldServer/Bots/Bot.cpp index 5035052..ad311de 100644 --- a/source/WorldServer/Bots/Bot.cpp +++ b/source/WorldServer/Bots/Bot.cpp @@ -283,6 +283,9 @@ bool Bot::IsSpellReady(Spell* spell) { } Spell* Bot::GetDDSpell() { + if(world.IsReloadingSubsystems()) + return nullptr; + if (dd_spells.size() == 0) return 0; @@ -299,6 +302,9 @@ Spell* Bot::GetDDSpell() { } Spell* Bot::GetHealSpell() { + if(world.IsReloadingSubsystems()) + return nullptr; + if (heal_spells.size() == 0) return 0; @@ -350,6 +356,9 @@ Spell* Bot::GetHealSpell() { } Spell* Bot::GetTauntSpell() { + if(world.IsReloadingSubsystems()) + return nullptr; + if (taunt_spells.size() == 0) return 0; @@ -370,6 +379,9 @@ Spell* Bot::GetTauntSpell() { } Spell* Bot::GetDetauntSpell() { + if(world.IsReloadingSubsystems()) + return nullptr; + if (detaunt_spells.size() == 0) return 0; @@ -393,6 +405,9 @@ Spell* Bot::GetDetauntSpell() { } Spell* Bot::GetHoTWardSpell() { + if(world.IsReloadingSubsystems()) + return nullptr; + if (hot_ward_spells.size() == 0) return 0; @@ -443,6 +458,9 @@ Spell* Bot::GetHoTWardSpell() { return 0; } Spell* Bot::GetDebuffSpell() { + if(world.IsReloadingSubsystems()) + return nullptr; + if (debuff_spells.size() == 0) return 0; @@ -463,10 +481,16 @@ Spell* Bot::GetDebuffSpell() { } Spell* Bot::GetCombatBuffSpell() { + if(world.IsReloadingSubsystems()) + return nullptr; + return 0; } Spell* Bot::GetDoTSpell() { + if(world.IsReloadingSubsystems()) + return nullptr; + if (dot_spells.size() == 0) return 0; @@ -487,6 +511,9 @@ Spell* Bot::GetDoTSpell() { } Spell* Bot::GetBuffSpell() { + if(world.IsReloadingSubsystems()) + return nullptr; + if (buff_spells.size() == 0) return 0; @@ -522,6 +549,9 @@ Spell* Bot::GetBuffSpell() { } Spell* Bot::GetRezSpell() { + if(world.IsReloadingSubsystems()) + return nullptr; + if (rez_spells.size() == 0) return 0; @@ -566,6 +596,9 @@ Spell* Bot::GetRezSpell() { } Spell* Bot::GetCureSpell() { + if(world.IsReloadingSubsystems()) + return nullptr; + return 0; } diff --git a/source/WorldServer/NPC.cpp b/source/WorldServer/NPC.cpp index ad217c5..e13d0ea 100644 --- a/source/WorldServer/NPC.cpp +++ b/source/WorldServer/NPC.cpp @@ -835,6 +835,9 @@ int32 NPC::GetEquipmentListID(){ } Spell* NPC::GetNextSpell(Spawn* target, float distance){ + if(world.IsReloadingSubsystems()) + return nullptr; + if(!cast_on_aggro_completed) { Spell* ret = nullptr; Spell* tmpSpell = nullptr; @@ -887,6 +890,9 @@ Spell* NPC::GetNextSpell(Spawn* target, float distance){ } Spell* NPC::GetNextSpell(float distance, int8 type){ + if(world.IsReloadingSubsystems()) + return nullptr; + Spell* ret = 0; if(spells){ if(distance < 0) @@ -920,6 +926,9 @@ Spell* NPC::GetNextSpell(float distance, int8 type){ } Spell* NPC::GetNextBuffSpell(Spawn* target) { + if(world.IsReloadingSubsystems()) + return nullptr; + if(!target) { target = (Spawn*)this; }