Cmangos commits applied

Cmangos commits applied
This commit is contained in:
Charles A Edwards 2016-09-14 13:21:23 +01:00 committed by Antz
parent df3ab5df8e
commit 068c67b932
12 changed files with 261 additions and 138 deletions

View file

@ -190,7 +190,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
return true;
}
m_charmInfo->SetPetNumber(pet_number, IsPermanentPetFor(owner));
m_charmInfo->SetPetNumber(pet_number, isControlled());
SetOwnerGuid(owner->GetObjectGuid());
SetDisplayId(fields[3].GetUInt32());
@ -722,6 +722,8 @@ void Pet::GivePetXP(uint32 xp)
if (level >= maxlevel)
return;
xp *= sWorld.getConfig(CONFIG_FLOAT_RATE_PET_XP_KILL);
uint32 nextLvlXP = GetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP);
uint32 curXP = GetUInt32Value(UNIT_FIELD_PETEXPERIENCE);
uint32 newXP = curXP + xp;
@ -1914,29 +1916,6 @@ void Pet::ToggleAutocast(uint32 spellid, bool apply)
}
}
bool Pet::IsPermanentPetFor(Player* owner)
{
switch (getPetType())
{
case SUMMON_PET:
switch (owner->getClass())
{
// oddly enough, Mage's Water Elemental is still treated as temporary pet with Glyph of Eternal Water
// i.e. does not unsummon at mounting, gets dismissed at teleport etc.
case CLASS_WARLOCK:
return GetCreatureInfo()->CreatureType == CREATURE_TYPE_DEMON;
case CLASS_DEATH_KNIGHT:
return GetCreatureInfo()->CreatureType == CREATURE_TYPE_UNDEAD;
default:
return false;
}
case HUNTER_PET:
return true;
default:
return false;
}
}
bool Pet::Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo const* cinfo, uint32 pet_number)
{
SetMap(cPos.GetMap());
@ -1989,10 +1968,11 @@ void Pet::LearnPetPassives()
void Pet::CastPetAuras(bool current)
{
Unit* owner = GetOwner();
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
if (!isControlled())
return;
Unit* owner = GetOwner();
for (PetAuraSet::const_iterator itr = owner->m_petAuras.begin(); itr != owner->m_petAuras.end();)
{
PetAura const* pa = *itr;