*fixed crashpoint in spell difficulty handler
*added more checks at loading *better searcher --HG-- branch : trunk
This commit is contained in:
+11
-5
@@ -404,16 +404,22 @@ void LoadDBCStores(const std::string& dataPath)
|
||||
SpellDifficultyEntry const *spellDiff = sSpellDifficultyStore.LookupEntry(i);
|
||||
if (!spellDiff)
|
||||
continue;
|
||||
|
||||
SpellDifficultyEntry newEntry;
|
||||
for (int x = 0; x < MAX_DIFFICULTY; ++x)
|
||||
{
|
||||
if (spellDiff->SpellID[x] <= 0 || !sSpellStore.LookupEntry(spellDiff->SpellID[x]))
|
||||
{
|
||||
if(spellDiff->SpellID[x] > 0)//don't drop error if spell is <= 0, not all modes have spells and there are unknown negative values
|
||||
sLog.outDebug("spelldifficulty_dbc: spell %i at field id:%u at spellid%i does not exist in SpellStore (spell.dbc), skipped loading", spellDiff->SpellID[x], spellDiff->ID, x);
|
||||
if (spellDiff->SpellID[x] > 0)//don't show error if spell is <= 0, not all modes have spells and there are unknown negative values
|
||||
sLog.outErrorDb("spelldifficulty_dbc: spell %i at field id:%u at spellid%i does not exist in SpellStore (spell.dbc), loaded as 0", spellDiff->SpellID[x], spellDiff->ID, x);
|
||||
newEntry.SpellID[x] = 0;//spell was <= 0 or invalid, set to 0
|
||||
} else newEntry.SpellID[x] = spellDiff->SpellID[x];
|
||||
}
|
||||
if (newEntry.SpellID[0] <= 0 || newEntry.SpellID[1] <= 0)//id0-1 must be always set!
|
||||
continue;
|
||||
}
|
||||
spellmgr.SetSpellDifficultyId(uint32(spellDiff->SpellID[x]), spellDiff->ID);
|
||||
}
|
||||
|
||||
for (int x = 0; x < MAX_DIFFICULTY; ++x)
|
||||
spellmgr.SetSpellDifficultyId(uint32(newEntry.SpellID[x]), spellDiff->ID);
|
||||
}
|
||||
|
||||
// create talent spells set
|
||||
|
||||
+6
-2
@@ -1055,7 +1055,7 @@ class SpellMgr
|
||||
SpellEntry const* newSpell = sSpellStore.LookupEntry(SpellDiff->SpellID[mode]);
|
||||
if (!newSpell)
|
||||
{
|
||||
sLog.outDebug("GetSpellForDifficultyFromSpell: spell %u not found in spell, this should never happen.", newSpell->Id);//alerady checked at startup
|
||||
sLog.outDebug("GetSpellForDifficultyFromSpell: spell %u not found in SpellStore. Check spelldifficulty_dbc!", SpellDiff->SpellID[mode]);
|
||||
return spell;
|
||||
}
|
||||
sLog.outDebug("GetSpellForDifficultyFromSpell: spellid for spell %u in mode %u is %u ", spell->Id, mode, newSpell->Id);
|
||||
@@ -1320,7 +1320,11 @@ class SpellMgr
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
uint32 GetSpellDifficultyId(uint32 spellId) { return mSpellDifficultySearcherMap[spellId] ? mSpellDifficultySearcherMap[spellId] : 0; }
|
||||
uint32 GetSpellDifficultyId(uint32 spellId)
|
||||
{
|
||||
SpellDifficultySearcherMap::const_iterator i = mSpellDifficultySearcherMap.find(spellId);
|
||||
return i == mSpellDifficultySearcherMap.end() ? 0 : (*i).second;
|
||||
}
|
||||
void SetSpellDifficultyId(uint32 spellId, uint32 id) { mSpellDifficultySearcherMap[spellId] = id; }
|
||||
|
||||
const SpellsRequiringSpellMap GetSpellsRequiringSpell()
|
||||
|
||||
Reference in New Issue
Block a user