[10546] Fixed EffectActivateRune activate only expected runes amount of some rune type.

This commit is contained in:
VladimirMangos 2010-09-26 22:03:37 +04:00
parent 276afc3cfb
commit b236e83e70
5 changed files with 23 additions and 13 deletions

View file

@ -20984,11 +20984,23 @@ void Player::ConvertRune(uint8 index, RuneType newType)
GetSession()->SendPacket(&data);
}
void Player::ResyncRunes(uint8 count)
void Player::ActivateRunes(RuneType type, uint32 count)
{
WorldPacket data(SMSG_RESYNC_RUNES, 4 + count * 2);
data << uint32(count);
for(uint32 i = 0; i < count; ++i)
for(uint32 j = 0; count > 0 && j < MAX_RUNES; ++j)
{
if (GetRuneCooldown(j) && GetCurrentRune(j) == type)
{
SetRuneCooldown(j, 0);
--count;
}
}
}
void Player::ResyncRunes()
{
WorldPacket data(SMSG_RESYNC_RUNES, 4 + MAX_RUNES * 2);
data << uint32(MAX_RUNES);
for(uint32 i = 0; i < MAX_RUNES; ++i)
{
data << uint8(GetCurrentRune(i)); // rune type
data << uint8(255 - ((GetRuneCooldown(i) / REGEN_TIME_FULL) * 51)); // passed cooldown time (0-255)

View file

@ -2380,7 +2380,8 @@ class MANGOS_DLL_SPEC Player : public Unit
void SetCurrentRune(uint8 index, RuneType currentRune) { m_runes->runes[index].CurrentRune = currentRune; }
void SetRuneCooldown(uint8 index, uint16 cooldown) { m_runes->runes[index].Cooldown = cooldown; m_runes->SetRuneState(index, (cooldown == 0) ? true : false); }
void ConvertRune(uint8 index, RuneType newType);
void ResyncRunes(uint8 count);
void ActivateRunes(RuneType type, uint32 count);
void ResyncRunes();
void AddRunePower(uint8 index);
void InitRunes();

View file

@ -334,6 +334,7 @@ class Spell
void EffectKillCredit(SpellEffectIndex eff_idx);
void EffectQuestFail(SpellEffectIndex eff_idx);
void EffectActivateRune(SpellEffectIndex eff_idx);
void EffectTeachTaxiNode(SpellEffectIndex eff_idx);
void EffectTitanGrip(SpellEffectIndex eff_idx);
void EffectEnchantItemPrismatic(SpellEffectIndex eff_idx);

View file

@ -7912,13 +7912,9 @@ void Spell::EffectActivateRune(SpellEffectIndex eff_idx)
if(plr->getClass() != CLASS_DEATH_KNIGHT)
return;
for(uint32 j = 0; j < MAX_RUNES; ++j)
{
if(plr->GetRuneCooldown(j) && plr->GetCurrentRune(j) == RuneType(m_spellInfo->EffectMiscValue[eff_idx]))
{
plr->SetRuneCooldown(j, 0);
}
}
int32 count = damage; // max amount of reset runes
plr->ActivateRunes(RuneType(m_spellInfo->EffectMiscValue[eff_idx]), count);
plr->ResyncRunes();
}
void Spell::EffectTitanGrip(SpellEffectIndex eff_idx)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10545"
#define REVISION_NR "10546"
#endif // __REVISION_NR_H__