*Use spell_ranks table in spell scripts to not duplicate data.

--HG--
branch : trunk
This commit is contained in:
QAston
2010-08-01 03:23:14 +02:00
parent 4f3093f5e5
commit d5e33bf4ba
5 changed files with 27 additions and 158 deletions
+5 -2
View File
@@ -1110,13 +1110,16 @@ class SpellMgr
return spell_id;
}
uint32 GetSpellWithRank(uint32 spell_id, uint32 rank) const
// not strict check returns provided spell if rank not avalible
uint32 GetSpellWithRank(uint32 spell_id, uint32 rank, bool strict = false) const
{
if (SpellChainNode const* node = GetSpellChainNode(spell_id))
{
if (rank != node->rank)
return GetSpellWithRank(node->rank < rank ? node->next : node->prev, rank);
return GetSpellWithRank(node->rank < rank ? node->next : node->prev, rank, strict);
}
else if (strict && rank > 1)
return 0;
return spell_id;
}