mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-27 04:12:40 +01:00
*Add error checks at spell_required table loading
*Allow spell_required table to store more than 1 spell learn requirement for a spell *spell_required table data is removed from world.sql and since this commit the data for it should be maintained by db project you're using. --HG-- branch : trunk
This commit is contained in:
@@ -3221,9 +3221,32 @@ void SpellMgr::LoadSpellRequired()
|
||||
|
||||
uint32 spell_id = fields[0].GetUInt32();
|
||||
uint32 spell_req = fields[1].GetUInt32();
|
||||
// check if chain is made with valid first spell
|
||||
SpellEntry const * spell = sSpellStore.LookupEntry(spell_id);
|
||||
if (!spell)
|
||||
{
|
||||
sLog.outErrorDb("spell_id %u in `spell_required` table is not found in dbcs, skipped", spell_id);
|
||||
continue;
|
||||
}
|
||||
SpellEntry const * req_spell = sSpellStore.LookupEntry(spell_req);
|
||||
if (!req_spell)
|
||||
{
|
||||
sLog.outErrorDb("req_spell %u in `spell_required` table is not found in dbcs, skipped", spell_req);
|
||||
continue;
|
||||
}
|
||||
if (GetFirstSpellInChain(spell_id) == GetFirstSpellInChain(spell_req))
|
||||
{
|
||||
sLog.outErrorDb("req_spell %u and spell_id %u in `spell_required` table are ranks of the same spell, entry not needed, skipped", spell_req, spell_id);
|
||||
continue;
|
||||
}
|
||||
if (IsSpellRequiringSpell(spell_id, spell_req))
|
||||
{
|
||||
sLog.outErrorDb("duplicated entry of req_spell %u and spell_id %u in `spell_required`, skipped", spell_req, spell_id);
|
||||
continue;
|
||||
}
|
||||
|
||||
mSpellReq.insert (std::pair<uint32, uint32>(spell_id, spell_req));
|
||||
mSpellsReqSpell.insert (std::pair<uint32, uint32>(spell_req, spell_id));
|
||||
mSpellReq[spell_id] = spell_req;
|
||||
++rows;
|
||||
} while (result->NextRow());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user