aboutsummaryrefslogtreecommitdiff
path: root/src/game/Object.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-02-24 20:52:55 -0600
committermegamage <none@none>2009-02-24 20:52:55 -0600
commit0f9afd76a1308635d0dfbcffe054bf0224324251 (patch)
treef9eeae817481208a02ed8ec05f07f0eeff6710cb /src/game/Object.cpp
parentfe5fa582752175e3e44f28416ed5e534fb11c2fb (diff)
*Clean up of summoning pet spells.
--HG-- branch : trunk
Diffstat (limited to 'src/game/Object.cpp')
-rw-r--r--src/game/Object.cpp61
1 files changed, 58 insertions, 3 deletions
diff --git a/src/game/Object.cpp b/src/game/Object.cpp
index a6a4866917e..0c8d12d132a 100644
--- a/src/game/Object.cpp
+++ b/src/game/Object.cpp
@@ -1597,8 +1597,29 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
if(petType == SUMMON_PET && pet->LoadPetFromDB(this, entry))
{
+ // Remove Demonic Sacrifice auras (known pet)
+ Unit::AuraList const& auraClassScripts = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
+ for(Unit::AuraList::const_iterator itr = auraClassScripts.begin();itr!=auraClassScripts.end();)
+ {
+ if((*itr)->GetModifier()->m_miscvalue==2228)
+ {
+ RemoveAurasDueToSpell((*itr)->GetId());
+ itr = auraClassScripts.begin();
+ }
+ else
+ ++itr;
+ }
+
if(duration > 0)
pet->SetDuration(duration);
+
+ return NULL;
+ }
+
+ // petentry==0 for hunter "call pet" (current pet summoned if any)
+ if(!entry)
+ {
+ delete pet;
return NULL;
}
@@ -1620,27 +1641,61 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
return NULL;
}
- if(duration > 0)
- pet->SetDuration(duration);
-
pet->SetOwnerGUID(GetGUID());
pet->SetCreatorGUID(GetGUID());
pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, getFaction());
+ // this enables pet details window (Shift+P)
pet->GetCharmInfo()->SetPetNumber(pet_number, false);
pet->AIM_Initialize();
map->Add((Creature*)pet);
+ pet->setPowerType(POWER_MANA);
+ pet->SetUInt32Value(UNIT_NPC_FLAGS , 0);
+ pet->SetUInt32Value(UNIT_FIELD_BYTES_1,0);
+ pet->InitStatsForLevel(getLevel());
+
switch(petType)
{
case GUARDIAN_PET:
case POSSESSED_PET:
+ pet->SetUInt32Value(UNIT_FIELD_FLAGS,0);
AddGuardian(pet);
break;
+ case SUMMON_PET:
+ pet->SetUInt32Value(UNIT_FIELD_BYTES_0, 2048);
+ pet->SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0);
+ pet->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, 1000);
+ pet->SetHealth(pet->GetMaxHealth());
+ pet->SetPower(POWER_MANA, pet->GetMaxPower(POWER_MANA));
+ pet->InitPetCreateSpells();
+ pet->SavePetToDB(PET_SAVE_AS_CURRENT);
+ SetPet(pet);
+ PetSpellInitialize();
+ break;
+ }
+
+ if(petType == SUMMON_PET)
+ {
+ // Remove Demonic Sacrifice auras (known pet)
+ Unit::AuraList const& auraClassScripts = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
+ for(Unit::AuraList::const_iterator itr = auraClassScripts.begin();itr!=auraClassScripts.end();)
+ {
+ if((*itr)->GetModifier()->m_miscvalue==2228)
+ {
+ RemoveAurasDueToSpell((*itr)->GetId());
+ itr = auraClassScripts.begin();
+ }
+ else
+ ++itr;
+ }
}
+ if(duration > 0)
+ pet->SetDuration(duration);
+
return pet;
}