[10075] Attempt use more expected by result buffs downranking algo.

* In small rate more fast
* Not affect non-buff ranked spells like 10909
This commit is contained in:
VladimirMangos 2010-06-18 04:03:08 +04:00
parent 07a931e141
commit 81851074ad
6 changed files with 45 additions and 31 deletions

View file

@ -376,12 +376,10 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
}
// auto-selection buff level base at target level (in spellInfo)
if (targets.getUnitTarget())
if (Unit* target = targets.getUnitTarget())
{
SpellEntry const *actualSpellInfo = sSpellMgr.SelectAuraRankForPlayerLevel(spellInfo,targets.getUnitTarget()->getLevel());
// if rank not found then function return NULL but in explicit cast case original spell can be casted and later failed with appropriate error message
if(actualSpellInfo)
if (SpellEntry const *actualSpellInfo = sSpellMgr.SelectAuraRankForLevel(spellInfo, target->getLevel()))
spellInfo = actualSpellInfo;
}