Core/ObjectMgr: Refactor sCreatureStorage
This commit is contained in:
@@ -3351,7 +3351,7 @@ void AuraEffect::HandleAuraTransform(AuraApplication const * aurApp, uint8 mode,
|
||||
}
|
||||
else
|
||||
{
|
||||
CreatureInfo const * ci = ObjectMgr::GetCreatureTemplate(GetMiscValue());
|
||||
CreatureTemplate const * ci = sObjectMgr->GetCreatureTemplate(GetMiscValue());
|
||||
if (!ci)
|
||||
{
|
||||
target->SetDisplayId(16358); // pig pink ^_^
|
||||
@@ -3410,7 +3410,7 @@ void AuraEffect::HandleAuraTransform(AuraApplication const * aurApp, uint8 mode,
|
||||
if (!target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).empty())
|
||||
{
|
||||
uint32 cr_id = target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).front()->GetMiscValue();
|
||||
if (CreatureInfo const* ci = ObjectMgr::GetCreatureTemplate(cr_id))
|
||||
if (CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(cr_id))
|
||||
{
|
||||
uint32 team = 0;
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
@@ -3866,7 +3866,7 @@ void AuraEffect::HandleAuraMounted(AuraApplication const * aurApp, uint8 mode, b
|
||||
creatureEntry = 15665;
|
||||
}
|
||||
|
||||
CreatureInfo const* ci = ObjectMgr::GetCreatureTemplate(creatureEntry);
|
||||
CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(creatureEntry);
|
||||
if (!ci)
|
||||
{
|
||||
sLog->outErrorDb("AuraMounted: `creature_template`='%u' not found in database (only need its modelid)",GetMiscValue());
|
||||
@@ -6147,7 +6147,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
|
||||
else
|
||||
creatureEntry = target->GetAuraEffectsByType(SPELL_AURA_MOUNTED).front()->GetMiscValue();
|
||||
|
||||
if (CreatureInfo const* creatureInfo = ObjectMgr::GetCreatureTemplate(creatureEntry))
|
||||
if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry))
|
||||
{
|
||||
uint32 team = 0;
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
@@ -6389,7 +6389,7 @@ void AuraEffect::HandleAuraEmpathy(AuraApplication const * aurApp, uint8 mode, b
|
||||
return;
|
||||
}
|
||||
|
||||
CreatureInfo const * ci = ObjectMgr::GetCreatureTemplate(target->GetEntry());
|
||||
CreatureTemplate const * ci = sObjectMgr->GetCreatureTemplate(target->GetEntry());
|
||||
if (ci && ci->type == CREATURE_TYPE_BEAST)
|
||||
target->ApplyModUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_SPECIALINFO, apply);
|
||||
}
|
||||
|
||||
@@ -2195,7 +2195,7 @@ void SpellMgr::LoadPetLevelupSpellMap()
|
||||
sLog->outString();
|
||||
}
|
||||
|
||||
bool LoadPetDefaultSpells_helper(CreatureInfo const* cInfo, PetDefaultSpellsEntry& petDefSpells)
|
||||
bool LoadPetDefaultSpells_helper(CreatureTemplate const* cInfo, PetDefaultSpellsEntry& petDefSpells)
|
||||
{
|
||||
// skip empty list;
|
||||
bool have_spell = false;
|
||||
@@ -2252,27 +2252,24 @@ void SpellMgr::LoadPetDefaultSpells()
|
||||
uint32 countCreature = 0;
|
||||
uint32 countData = 0;
|
||||
|
||||
for (uint32 i = 0; i < sCreatureStorage.MaxEntry; ++i)
|
||||
CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates();
|
||||
for (CreatureTemplateContainer::const_iterator itr = ctc->begin(); itr != ctc->end(); ++itr)
|
||||
{
|
||||
|
||||
CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i);
|
||||
if (!cInfo)
|
||||
continue;
|
||||
|
||||
if (!cInfo->PetSpellDataId)
|
||||
if (!itr->second.PetSpellDataId)
|
||||
continue;
|
||||
|
||||
// for creature with PetSpellDataId get default pet spells from dbc
|
||||
CreatureSpellDataEntry const* spellDataEntry = sCreatureSpellDataStore.LookupEntry(cInfo->PetSpellDataId);
|
||||
CreatureSpellDataEntry const* spellDataEntry = sCreatureSpellDataStore.LookupEntry(itr->second.PetSpellDataId);
|
||||
if (!spellDataEntry)
|
||||
continue;
|
||||
|
||||
int32 petSpellsId = -int32(cInfo->PetSpellDataId);
|
||||
int32 petSpellsId = -int32(itr->second.PetSpellDataId);
|
||||
PetDefaultSpellsEntry petDefSpells;
|
||||
for (uint8 j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j)
|
||||
petDefSpells.spellid[j] = spellDataEntry->spellId[j];
|
||||
|
||||
if (LoadPetDefaultSpells_helper(cInfo, petDefSpells))
|
||||
if (LoadPetDefaultSpells_helper(&itr->second, petDefSpells))
|
||||
{
|
||||
mPetDefaultSpellsMap[petSpellsId] = petDefSpells;
|
||||
++countData;
|
||||
@@ -2298,7 +2295,7 @@ void SpellMgr::LoadPetDefaultSpells()
|
||||
if (spellEntry->Effect[k] == SPELL_EFFECT_SUMMON || spellEntry->Effect[k] == SPELL_EFFECT_SUMMON_PET)
|
||||
{
|
||||
uint32 creature_id = spellEntry->EffectMiscValue[k];
|
||||
CreatureInfo const *cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(creature_id);
|
||||
CreatureTemplate const *cInfo = sObjectMgr->GetCreatureTemplate(creature_id);
|
||||
if (!cInfo)
|
||||
continue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user