[7794] Add DK pet type support for proper show it in client Pet tab. Author: Astellar
--HG-- branch : trunk
This commit is contained in:
+24
-6
@@ -190,10 +190,7 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getPetType() == HUNTER_PET || (getPetType() == SUMMON_PET && cinfo->type == CREATURE_TYPE_DEMON && owner->getClass() == CLASS_WARLOCK))
|
m_charmInfo->SetPetNumber(pet_number, IsPermanentPetFor(owner));
|
||||||
m_charmInfo->SetPetNumber(pet_number, true);
|
|
||||||
else
|
|
||||||
m_charmInfo->SetPetNumber(pet_number, false);
|
|
||||||
|
|
||||||
// set current pet as current
|
// set current pet as current
|
||||||
// 0=current
|
// 0=current
|
||||||
@@ -1685,6 +1682,27 @@ void Pet::ToggleAutocast(uint32 spellid, bool apply)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Pet::IsPermanentPetFor(Player* owner)
|
||||||
|
{
|
||||||
|
switch(getPetType())
|
||||||
|
{
|
||||||
|
case SUMMON_PET:
|
||||||
|
switch(owner->getClass())
|
||||||
|
{
|
||||||
|
case CLASS_WARLOCK:
|
||||||
|
return GetCreatureInfo()->type == CREATURE_TYPE_DEMON;
|
||||||
|
case CLASS_DEATH_KNIGHT:
|
||||||
|
return GetCreatureInfo()->type == CREATURE_TYPE_UNDEAD;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
case HUNTER_PET:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool Pet::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 pet_number)
|
bool Pet::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 pet_number)
|
||||||
{
|
{
|
||||||
SetMapId(map->GetId());
|
SetMapId(map->GetId());
|
||||||
@@ -1735,10 +1753,10 @@ void Pet::LearnPetPassives()
|
|||||||
void Pet::CastPetAuras(bool current)
|
void Pet::CastPetAuras(bool current)
|
||||||
{
|
{
|
||||||
Unit* owner = GetOwner();
|
Unit* owner = GetOwner();
|
||||||
if(!owner)
|
if(!owner || owner->GetTypeId()!=TYPEID_PLAYER)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(getPetType() != HUNTER_PET && (getPetType() != SUMMON_PET || owner->getClass() != CLASS_WARLOCK))
|
if(!IsPermanentPetFor((Player*)owner))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for(PetAuraSet::const_iterator itr = owner->m_petAuras.begin(); itr != owner->m_petAuras.end();)
|
for(PetAuraSet::const_iterator itr = owner->m_petAuras.begin(); itr != owner->m_petAuras.end();)
|
||||||
|
|||||||
@@ -126,6 +126,8 @@ typedef std::vector<uint32> AutoSpellList;
|
|||||||
#define PET_FOLLOW_DIST 1
|
#define PET_FOLLOW_DIST 1
|
||||||
#define PET_FOLLOW_ANGLE (M_PI/2)
|
#define PET_FOLLOW_ANGLE (M_PI/2)
|
||||||
|
|
||||||
|
class Player;
|
||||||
|
|
||||||
class Pet : public Guardian
|
class Pet : public Guardian
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -140,6 +142,8 @@ class Pet : public Guardian
|
|||||||
bool isControlled() const { return getPetType()==SUMMON_PET || getPetType()==HUNTER_PET; }
|
bool isControlled() const { return getPetType()==SUMMON_PET || getPetType()==HUNTER_PET; }
|
||||||
bool isTemporarySummoned() const { return m_duration > 0; }
|
bool isTemporarySummoned() const { return m_duration > 0; }
|
||||||
|
|
||||||
|
bool IsPermanentPetFor(Player* owner); // pet have tab in character windows and set UNIT_FIELD_PETNUMBER
|
||||||
|
|
||||||
bool Create (uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 pet_number);
|
bool Create (uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 pet_number);
|
||||||
bool CreateBaseAtCreature(Creature* creature);
|
bool CreateBaseAtCreature(Creature* creature);
|
||||||
bool LoadPetFromDB( Player* owner,uint32 petentry = 0,uint32 petnumber = 0, bool current = false );
|
bool LoadPetFromDB( Player* owner,uint32 petentry = 0,uint32 petnumber = 0, bool current = false );
|
||||||
|
|||||||
+2
-2
@@ -1505,7 +1505,7 @@ void Player::BuildEnumData( QueryResult * result, WorldPacket * p_data )
|
|||||||
uint32 petFamily = 0;
|
uint32 petFamily = 0;
|
||||||
|
|
||||||
// show pet at selection character in character list only for non-ghost character
|
// show pet at selection character in character list only for non-ghost character
|
||||||
if(result && isAlive() && (pClass == CLASS_WARLOCK || pClass == CLASS_HUNTER))
|
if (result && isAlive() && (pClass == CLASS_WARLOCK || pClass == CLASS_HUNTER || pClass == CLASS_DEATH_KNIGHT))
|
||||||
{
|
{
|
||||||
uint32 entry = fields[10].GetUInt32();
|
uint32 entry = fields[10].GetUInt32();
|
||||||
CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(entry);
|
CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(entry);
|
||||||
@@ -16712,7 +16712,7 @@ void Player::PetSpellInitialize()
|
|||||||
uint8 addlist = 0;
|
uint8 addlist = 0;
|
||||||
data << uint8(addlist); // placeholder
|
data << uint8(addlist); // placeholder
|
||||||
|
|
||||||
if(pet->isControlled() && ((pet->getPetType() == HUNTER_PET) || ((pet->GetCreatureInfo()->type == CREATURE_TYPE_DEMON) && (getClass() == CLASS_WARLOCK))))
|
if (pet->IsPermanentPetFor(this))
|
||||||
{
|
{
|
||||||
// spells loop
|
// spells loop
|
||||||
for (PetSpellMap::iterator itr = pet->m_spells.begin(); itr != pet->m_spells.end(); ++itr)
|
for (PetSpellMap::iterator itr = pet->m_spells.begin(); itr != pet->m_spells.end(); ++itr)
|
||||||
|
|||||||
Reference in New Issue
Block a user