Core/ObjectMgr: Refactor sCreatureStorage
This commit is contained in:
@@ -154,7 +154,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
|
||||
PetType pet_type = PetType(fields[18].GetUInt8());
|
||||
if (pet_type == HUNTER_PET)
|
||||
{
|
||||
CreatureInfo const* creatureInfo = ObjectMgr::GetCreatureTemplate(petentry);
|
||||
CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(petentry);
|
||||
if (!creatureInfo || !creatureInfo->isTameable(owner->CanTameExoticPets()))
|
||||
return false;
|
||||
}
|
||||
@@ -187,7 +187,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
|
||||
setFaction(owner->getFaction());
|
||||
SetUInt32Value(UNIT_CREATED_BY_SPELL, summon_spell_id);
|
||||
|
||||
CreatureInfo const *cinfo = GetCreatureInfo();
|
||||
CreatureTemplate const *cinfo = GetCreatureInfo();
|
||||
if (cinfo->type == CREATURE_TYPE_CRITTER)
|
||||
{
|
||||
map->Add(this->ToCreature());
|
||||
@@ -754,7 +754,7 @@ bool Pet::CreateBaseAtCreature(Creature* creature)
|
||||
return false;
|
||||
}
|
||||
|
||||
CreatureInfo const *cinfo = GetCreatureInfo();
|
||||
CreatureTemplate const *cinfo = GetCreatureInfo();
|
||||
if (!cinfo)
|
||||
{
|
||||
sLog->outError("CreateBaseAtCreature() failed, creatureInfo is missing!");
|
||||
@@ -771,7 +771,7 @@ bool Pet::CreateBaseAtCreature(Creature* creature)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Pet::CreateBaseAtCreatureInfo(CreatureInfo const* cinfo, Unit * owner)
|
||||
bool Pet::CreateBaseAtCreatureInfo(CreatureTemplate const* cinfo, Unit * owner)
|
||||
{
|
||||
if (!CreateBaseAtTamed(cinfo, owner->GetMap(), owner->GetPhaseMask()))
|
||||
return false;
|
||||
@@ -784,7 +784,7 @@ bool Pet::CreateBaseAtCreatureInfo(CreatureInfo const* cinfo, Unit * owner)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Pet::CreateBaseAtTamed(CreatureInfo const * cinfo, Map * map, uint32 phaseMask)
|
||||
bool Pet::CreateBaseAtTamed(CreatureTemplate const * cinfo, Map * map, uint32 phaseMask)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_PETS, "Pet::CreateBaseForTamed");
|
||||
uint32 guid=sObjectMgr->GenerateLowGuid(HIGHGUID_PET);
|
||||
@@ -813,7 +813,7 @@ bool Pet::CreateBaseAtTamed(CreatureInfo const * cinfo, Map * map, uint32 phaseM
|
||||
// TODO: Move stat mods code to pet passive auras
|
||||
bool Guardian::InitStatsForLevel(uint8 petlevel)
|
||||
{
|
||||
CreatureInfo const *cinfo = GetCreatureInfo();
|
||||
CreatureTemplate const *cinfo = GetCreatureInfo();
|
||||
ASSERT(cinfo);
|
||||
|
||||
SetLevel(petlevel);
|
||||
@@ -862,19 +862,9 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
|
||||
SetFloatValue(OBJECT_FIELD_SCALE_X, scale);
|
||||
}
|
||||
|
||||
//resistance
|
||||
int32 createResistance[MAX_SPELL_SCHOOL] = {0,0,0,0,0,0,0};
|
||||
if (cinfo && petType != HUNTER_PET)
|
||||
{
|
||||
createResistance[SPELL_SCHOOL_HOLY] = cinfo->resistance1;
|
||||
createResistance[SPELL_SCHOOL_FIRE] = cinfo->resistance2;
|
||||
createResistance[SPELL_SCHOOL_NATURE] = cinfo->resistance3;
|
||||
createResistance[SPELL_SCHOOL_FROST] = cinfo->resistance4;
|
||||
createResistance[SPELL_SCHOOL_SHADOW] = cinfo->resistance5;
|
||||
createResistance[SPELL_SCHOOL_ARCANE] = cinfo->resistance6;
|
||||
}
|
||||
// Resistance
|
||||
for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
|
||||
SetModifierValue(UnitMods(UNIT_MOD_RESISTANCE_START + i), BASE_VALUE, float(createResistance[i]));
|
||||
SetModifierValue(UnitMods(UNIT_MOD_RESISTANCE_START + i), BASE_VALUE, float(cinfo->resistance[i]));
|
||||
|
||||
//health, mana, armor and resistance
|
||||
PetLevelInfo const* pInfo = sObjectMgr->GetPetLevelInfo(creature_ID, petlevel);
|
||||
@@ -1056,7 +1046,7 @@ bool Pet::HaveInDiet(ItemTemplate const* item) const
|
||||
if (!item->FoodType)
|
||||
return false;
|
||||
|
||||
CreatureInfo const* cInfo = GetCreatureInfo();
|
||||
CreatureTemplate const* cInfo = GetCreatureInfo();
|
||||
if (!cInfo)
|
||||
return false;
|
||||
|
||||
@@ -1583,7 +1573,7 @@ bool Pet::resetTalents(bool no_cost)
|
||||
if (owner->ToPlayer()->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS))
|
||||
owner->ToPlayer()->RemoveAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS,true);
|
||||
|
||||
CreatureInfo const * ci = GetCreatureInfo();
|
||||
CreatureTemplate const * ci = GetCreatureInfo();
|
||||
if (!ci)
|
||||
return false;
|
||||
// Check pet talent type
|
||||
@@ -1888,7 +1878,7 @@ bool Pet::HasSpell(uint32 spell) const
|
||||
// Get all passive spells in our skill line
|
||||
void Pet::LearnPetPassives()
|
||||
{
|
||||
CreatureInfo const* cInfo = GetCreatureInfo();
|
||||
CreatureTemplate const* cInfo = GetCreatureInfo();
|
||||
if (!cInfo)
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user