[11410] Move class and some other field set to Pet::InitStatsForLevel

This let use it also at pet first summon case as expected.
This commit is contained in:
VladimirMangos 2011-05-01 03:04:20 +04:00
parent 8f634dc90a
commit 6bdd55bd14
2 changed files with 18 additions and 12 deletions

View file

@ -195,20 +195,9 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
{
case SUMMON_PET:
petlevel=owner->getLevel();
SetByteValue(UNIT_FIELD_BYTES_0, 1, CLASS_MAGE);
SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
// this enables popup window (pet dismiss, cancel)
break;
case HUNTER_PET:
SetByteValue(UNIT_FIELD_BYTES_0, 1, CLASS_WARRIOR);
SetByteValue(UNIT_FIELD_BYTES_0, 2, GENDER_NONE);
SetByteValue(UNIT_FIELD_BYTES_0, 3, POWER_FOCUS);
SetSheath(SHEATH_STATE_MELEE);
SetByteFlag(UNIT_FIELD_BYTES_2, 2, fields[9].GetBool() ? UNIT_CAN_BE_ABANDONED : UNIT_CAN_BE_RENAMED | UNIT_CAN_BE_ABANDONED);
SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
// this enables popup window (pet abandon, cancel)
SetMaxPower(POWER_HAPPINESS, GetCreatePowers(POWER_HAPPINESS));
SetPower(POWER_HAPPINESS, fields[12].GetUInt32());
setPowerType(POWER_FOCUS);
@ -914,6 +903,23 @@ bool Pet::InitStatsForLevel(uint32 petlevel, Unit* owner)
uint32 creature_ID = (getPetType() == HUNTER_PET) ? 1 : cinfo->Entry;
switch (getPetType())
{
case SUMMON_PET:
SetByteValue(UNIT_FIELD_BYTES_0, 1, CLASS_MAGE);
SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
// this enables popup window (pet dismiss, cancel)
break;
case HUNTER_PET:
SetSheath(SHEATH_STATE_MELEE);
SetByteValue(UNIT_FIELD_BYTES_0, 1, CLASS_WARRIOR);
SetByteValue(UNIT_FIELD_BYTES_0, 2, GENDER_NONE);
SetSheath(SHEATH_STATE_MELEE);
SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
// this enables popup window (pet abandon, cancel)
break;
}
SetLevel(petlevel);
SetMeleeDamageSchool(SpellSchools(cinfo->dmgschool));

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11409"
#define REVISION_NR "11410"
#endif // __REVISION_NR_H__