mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[7832] Better check at petcreateinfo_spell loading for errors and redundend data.
This commit is contained in:
parent
e134b5383b
commit
b722e75d90
3 changed files with 38 additions and 4 deletions
|
|
@ -3589,20 +3589,53 @@ void ObjectMgr::LoadPetCreateSpells()
|
||||||
|
|
||||||
uint32 creature_id = fields[0].GetUInt32();
|
uint32 creature_id = fields[0].GetUInt32();
|
||||||
|
|
||||||
if(!creature_id || !sCreatureStorage.LookupEntry<CreatureInfo>(creature_id))
|
if(!creature_id)
|
||||||
|
{
|
||||||
|
sLog.outErrorDb("Creature id %u listed in `petcreateinfo_spell` not exist.",creature_id);
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(creature_id);
|
||||||
|
if(!cInfo)
|
||||||
|
{
|
||||||
|
sLog.outErrorDb("Creature id %u listed in `petcreateinfo_spell` not exist.",creature_id);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
PetCreateSpellEntry PetCreateSpell;
|
PetCreateSpellEntry PetCreateSpell;
|
||||||
|
|
||||||
|
bool have_spell = false;
|
||||||
|
bool have_spell_db = false;
|
||||||
for(int i = 0; i < 4; i++)
|
for(int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
PetCreateSpell.spellid[i] = fields[i + 1].GetUInt32();
|
PetCreateSpell.spellid[i] = fields[i + 1].GetUInt32();
|
||||||
|
|
||||||
if(PetCreateSpell.spellid[i] && !sSpellStore.LookupEntry(PetCreateSpell.spellid[i]))
|
if(!PetCreateSpell.spellid[i])
|
||||||
|
continue;
|
||||||
|
|
||||||
|
have_spell_db = true;
|
||||||
|
|
||||||
|
SpellEntry const* i_spell = sSpellStore.LookupEntry(PetCreateSpell.spellid[i]);
|
||||||
|
if(!i_spell)
|
||||||
|
{
|
||||||
sLog.outErrorDb("Spell %u listed in `petcreateinfo_spell` does not exist",PetCreateSpell.spellid[i]);
|
sLog.outErrorDb("Spell %u listed in `petcreateinfo_spell` does not exist",PetCreateSpell.spellid[i]);
|
||||||
|
PetCreateSpell.spellid[i] = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
have_spell = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
mPetCreateSpell[creature_id] = PetCreateSpell;
|
if(!have_spell_db)
|
||||||
|
{
|
||||||
|
sLog.outErrorDb("Creature %u listed in `petcreateinfo_spell` have only 0 spell data, why it listed?",creature_id);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!have_spell)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
mPetCreateSpell[creature_id] = PetCreateSpell;
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
while (result->NextRow());
|
while (result->NextRow());
|
||||||
|
|
|
||||||
|
|
@ -2305,6 +2305,7 @@ void Player::GiveLevel(uint32 level)
|
||||||
// update level to hunter/summon pet
|
// update level to hunter/summon pet
|
||||||
if (Pet* pet = GetPet())
|
if (Pet* pet = GetPet())
|
||||||
pet->SynchronizeLevelWithOwner();
|
pet->SynchronizeLevelWithOwner();
|
||||||
|
|
||||||
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_LEVEL);
|
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_LEVEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "7831"
|
#define REVISION_NR "7832"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue