[9243] Some spell rune code fixes

* Also replace check/take functions for runes by single 2 mode function
* Implement proper check for dead runes case
* Implement proper rune selection for Aura::HandleAuraConvertRune
This commit is contained in:
VladimirMangos 2010-01-23 20:04:19 +03:00
parent 546ee35953
commit bf9cccfd5b
4 changed files with 53 additions and 69 deletions

View file

@ -7679,22 +7679,27 @@ void Aura::HandleAuraConvertRune(bool apply, bool Real)
if(plr->getClass() != CLASS_DEATH_KNIGHT)
return;
// how to determine what rune need to be converted?
for(uint32 i = 0; i < MAX_RUNES; ++i)
RuneType runeFrom = RuneType(GetSpellProto()->EffectMiscValue[m_effIndex]);
RuneType runeTo = RuneType(GetSpellProto()->EffectMiscValueB[m_effIndex]);
if (apply)
{
if(apply)
for(uint32 i = 0; i < MAX_RUNES; ++i)
{
if(!plr->GetRuneCooldown(i))
if (plr->GetCurrentRune(i) == runeFrom && !plr->GetRuneCooldown(i))
{
plr->ConvertRune(i, RuneType(GetSpellProto()->EffectMiscValueB[m_effIndex]));
plr->ConvertRune(i, runeTo);
break;
}
}
else
}
else
{
for(uint32 i = 0; i < MAX_RUNES; ++i)
{
if(plr->GetCurrentRune(i) == RuneType(GetSpellProto()->EffectMiscValueB[m_effIndex]))
if(plr->GetCurrentRune(i) == runeTo && plr->GetBaseRune(i) == runeFrom)
{
plr->ConvertRune(i, plr->GetBaseRune(i));
plr->ConvertRune(i, runeFrom);
break;
}
}