From ac4ffefa09c464e64e80686ef67d72877dcabc68 Mon Sep 17 00:00:00 2001 From: Chris Miles Date: Tue, 11 Feb 2025 23:25:29 -0600 Subject: [PATCH] [Crash] Fix raid/group crash regression (#4671) --- zone/spells.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/zone/spells.cpp b/zone/spells.cpp index f604d7b3b..cb51fabe1 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -2686,7 +2686,11 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, in } } } else if (spell_target->IsRaidGrouped() && spell_target->IsOfClientBot()) { - Raid *target_raid = (IsClient() ? entity_list.GetRaidByClient(spell_target->CastToClient()) : entity_list.GetRaidByBot(spell_target->CastToBot())); + Raid *target_raid = entity_list.GetRaidByClient(spell_target->CastToClient()); + if (IsBot()) { + target_raid = entity_list.GetRaidByBot(spell_target->CastToBot()); + } + uint32 gid = 0xFFFFFFFF; if (target_raid) { gid = target_raid->GetGroup(spell_target->GetName()); @@ -3809,10 +3813,10 @@ int Mob::CanBuffStack(uint16 spellid, uint8 caster_level, bool iFailIfOverwrite) } if ( - IsBot() && - GetClass() == Class::Bard && - curbuf.spellid == spellid && - curbuf.ticsremaining == 0 && + IsBot() && + GetClass() == Class::Bard && + curbuf.spellid == spellid && + curbuf.ticsremaining == 0 && curbuf.casterid == GetID() ) { LogAI("Bard check for song, spell [{}] has [{}] ticks remaining.", spellid, curbuf.ticsremaining); @@ -4038,17 +4042,17 @@ bool Mob::SpellOnTarget( return false; } - bool client_blocked_buffs = + bool client_blocked_buffs = RuleB(Spells, EnableBlockedBuffs) && ( spelltar->IsClient() || (spelltar->IsPet() && spelltar->IsPetOwnerClient()) ); - bool bot_blocked_buffs = - RuleB(Bots, AllowBotBlockedBuffs) && + bool bot_blocked_buffs = + RuleB(Bots, AllowBotBlockedBuffs) && ( - spelltar->IsBot() || + spelltar->IsBot() || (spelltar->IsPet() && spelltar->IsPetOwnerBot()) );