diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bindings/scripts/scripts/zone/magisters_terrace/boss_vexallus.cpp | 1 | ||||
-rw-r--r-- | src/game/Object.cpp | 1 | ||||
-rw-r--r-- | src/game/Pet.cpp | 4 | ||||
-rw-r--r-- | src/game/TemporarySummon.cpp | 1 | ||||
-rw-r--r-- | src/game/Unit.cpp | 25 |
5 files changed, 20 insertions, 12 deletions
diff --git a/src/bindings/scripts/scripts/zone/magisters_terrace/boss_vexallus.cpp b/src/bindings/scripts/scripts/zone/magisters_terrace/boss_vexallus.cpp index 57ccde94bf0..8c47e354081 100644 --- a/src/bindings/scripts/scripts/zone/magisters_terrace/boss_vexallus.cpp +++ b/src/bindings/scripts/scripts/zone/magisters_terrace/boss_vexallus.cpp @@ -111,7 +111,6 @@ struct TRINITY_DLL_DECL boss_vexallusAI : public ScriptedAI summoned->GetMotionMaster()->MoveFollow(temp,0,0); //spells are SUMMON_TYPE_GUARDIAN, so using setOwner should be ok - summoned->SetOwnerGUID(m_creature->GetGUID()); summoned->CastSpell(summoned,SPELL_ENERGY_BOLT,false,0,0,m_creature->GetGUID()); } diff --git a/src/game/Object.cpp b/src/game/Object.cpp index eeedcc05188..638c1390e14 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1815,7 +1815,6 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy return NULL; } - pet->SetOwnerGUID(GetGUID()); pet->SetCreatorGUID(GetGUID()); pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, getFaction()); diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index 3048d42d344..031f9d90f8e 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -179,7 +179,8 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool else m_charmInfo->SetPetNumber(pet_number, false); - SetOwnerGUID(owner->GetGUID()); + owner->SetPet(this, true); + SetDisplayId(fields[3].GetUInt32()); SetNativeDisplayId(fields[3].GetUInt32()); uint32 petlevel = fields[4].GetUInt32(); @@ -313,7 +314,6 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool _LoadSpells(); _LoadSpellCooldowns(); - owner->SetPet(this, true); // in DB stored only full controlled creature sLog.outDebug("New Pet has guid %u", GetGUIDLow()); if(owner->GetTypeId() == TYPEID_PLAYER) diff --git a/src/game/TemporarySummon.cpp b/src/game/TemporarySummon.cpp index 76c7ecfb8c1..f837cfbae8b 100644 --- a/src/game/TemporarySummon.cpp +++ b/src/game/TemporarySummon.cpp @@ -243,7 +243,6 @@ void Guardian::InitSummon(uint32 duration) SetReactState(REACT_AGGRESSIVE); - SetOwnerGUID(m_owner->GetGUID()); SetCreatorGUID(m_owner->GetGUID()); setFaction(m_owner->getFaction()); m_owner->SetPet(this, true); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index e7b31aa5546..a92ae91ce29 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -8319,6 +8319,11 @@ void Unit::SetPet(Creature* pet, bool apply) { if(apply) { + if(!pet->AddUInt64Value(UNIT_FIELD_SUMMONEDBY, GetGuid()) + { + sLog.outCrash("Pet %u is summoned by %u but it already has a owner", pet->GetEntry(), GetEntry()); + return; + } AddUInt64Value(UNIT_FIELD_SUMMON, pet->GetGUID()); m_Controlled.insert(pet); @@ -8329,16 +8334,23 @@ void Unit::SetPet(Creature* pet, bool apply) } else { - SetUInt64Value(UNIT_FIELD_SUMMON, 0); + if(!pet->RemoveUInt64Value(UNIT_FIELD_SUMMONEDBY, GetGuid()) + { + sLog.outCrash("Pet %u is unsummoned by %u but it has another owner", pet->GetEntry(), GetEntry()); + return; + } m_Controlled.erase(pet); - //Check if there is other pet (guardian actually) - for(ControlList::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr) + if(RemoveUInt64Value(UNIT_FIELD_SUMMON, pet->GetGUID())) { - if((*itr)->GetOwnerGUID() == GetGUID()) + //Check if there is other pet (guardian actually) + for(ControlList::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr) { - AddUInt64Value(UNIT_FIELD_SUMMON, (*itr)->GetGUID()); - break; + if((*itr)->GetOwnerGUID() == GetGUID()) + { + AddUInt64Value(UNIT_FIELD_SUMMON, (*itr)->GetGUID()); + break; + } } } } @@ -12479,7 +12491,6 @@ Pet* Unit::CreateTamedPetFrom(Creature* creatureTarget,uint32 spell_id) return NULL; } - pet->SetOwnerGUID(GetGUID()); pet->SetCreatorGUID(GetGUID()); pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, getFaction()); pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, spell_id); |