From 20951d116e80e4712cc9272e793415ef0cdc8cc4 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Thu, 23 Oct 2008 06:28:28 +0400 Subject: [PATCH] Fixed: crash at expire single target loaded aura. Prevent loading and saving single target auras for pet in same way as already implemented for player. --- src/game/Pet.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index caa129746..9f9f12d6d 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -1363,6 +1363,10 @@ void Pet::_LoadAuras(uint32 timediff) else remaincharges = -1; + /// do not load single target auras (unless they were cast by the player) + if (caster_guid != GetGUID() && IsSingleTargetSpell(spellproto)) + continue; + Aura* aura = CreateAura(spellproto, effindex, NULL, this, NULL); if(!damage) @@ -1392,10 +1396,19 @@ void Pet::_SaveAuras() spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_PET ) break; - if (i == 3 && !itr->second->IsPassive()) - CharacterDatabase.PExecute("INSERT INTO pet_aura (guid,caster_guid,spell,effect_index,amount,maxduration,remaintime,remaincharges) " - "VALUES ('%u', '" I64FMTD "', '%u', '%u', '%d', '%d', '%d', '%d')", - m_charmInfo->GetPetNumber(), itr->second->GetCasterGUID(),(uint32)(*itr).second->GetId(), (uint32)(*itr).second->GetEffIndex(),(*itr).second->GetModifier()->m_amount,int((*itr).second->GetAuraMaxDuration()),int((*itr).second->GetAuraDuration()),int((*itr).second->m_procCharges)); + if (i != 3) + continue; + + if(itr->second->IsPassive()) + continue; + + /// do not save single target auras (unless they were cast by the player) + if (itr->second->GetCasterGUID() != GetGUID() && IsSingleTargetSpell(spellInfo)) + continue; + + CharacterDatabase.PExecute("INSERT INTO pet_aura (guid,caster_guid,spell,effect_index,amount,maxduration,remaintime,remaincharges) " + "VALUES ('%u', '" I64FMTD "', '%u', '%u', '%d', '%d', '%d', '%d')", + m_charmInfo->GetPetNumber(), itr->second->GetCasterGUID(),(uint32)(*itr).second->GetId(), (uint32)(*itr).second->GetEffIndex(),(*itr).second->GetModifier()->m_amount,int((*itr).second->GetAuraMaxDuration()),int((*itr).second->GetAuraDuration()),int((*itr).second->m_procCharges)); } }