[7248] Check battlemaster_entry data at loading. Code cleanups.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
zhenya 2009-02-08 02:07:06 +03:00 committed by VladimirMangos
parent 6b381f2d0e
commit c5f20ff9a9
9 changed files with 55 additions and 48 deletions

View file

@ -43,6 +43,7 @@
#include "SpellAuras.h"
#include "Util.h"
#include "WaypointManager.h"
#include "BattleGround.h"
INSTANTIATE_SINGLETON_1(ObjectMgr);
@ -6578,6 +6579,11 @@ void ObjectMgr::LoadBattleMastersEntry()
uint32 entry = fields[0].GetUInt32();
uint32 bgTypeId = fields[1].GetUInt32();
if (bgTypeId >= MAX_BATTLEGROUND_TYPE_ID)
{
sLog.outErrorDb("Table `battlemaster_entry` contain entry %u for not existed battleground type %u, ignored.",entry,bgTypeId);
continue;
}
mBattleMastersMap[entry] = bgTypeId;
@ -7274,16 +7280,16 @@ void ObjectMgr::LoadTrainerSpell()
TrainerSpell* pTrainerSpell = new TrainerSpell();
pTrainerSpell->spell = spell;
pTrainerSpell->spellcost = fields[2].GetUInt32();
pTrainerSpell->reqskill = fields[3].GetUInt32();
pTrainerSpell->reqskillvalue = fields[4].GetUInt32();
pTrainerSpell->reqlevel = fields[5].GetUInt32();
pTrainerSpell->spellCost = fields[2].GetUInt32();
pTrainerSpell->reqSkill = fields[3].GetUInt32();
pTrainerSpell->reqSkillValue = fields[4].GetUInt32();
pTrainerSpell->reqLevel = fields[5].GetUInt32();
if(!pTrainerSpell->reqlevel)
pTrainerSpell->reqlevel = spellinfo->spellLevel;
if(!pTrainerSpell->reqLevel)
pTrainerSpell->reqLevel = spellinfo->spellLevel;
// calculate learned spell for profession case when stored cast-spell
pTrainerSpell->learned_spell = spell;
pTrainerSpell->learnedSpell = spell;
for(int i = 0; i <3; ++i)
{
if(spellinfo->Effect[i]!=SPELL_EFFECT_LEARN_SPELL)
@ -7291,7 +7297,7 @@ void ObjectMgr::LoadTrainerSpell()
if(SpellMgr::IsProfessionOrRidingSpell(spellinfo->EffectTriggerSpell[i]))
{
pTrainerSpell->learned_spell = spellinfo->EffectTriggerSpell[i];
pTrainerSpell->learnedSpell = spellinfo->EffectTriggerSpell[i];
break;
}
}