Core/Player: Fixed cooldowns of DK Runes.

This commit is contained in:
hondacrx
2018-06-09 12:02:06 -04:00
parent 2c3479c6e2
commit 2d2a9eac16
2 changed files with 8 additions and 8 deletions
+4 -4
View File
@@ -337,17 +337,17 @@ namespace Game.Entities
{ {
public void SetRuneState(byte index, bool set = true) public void SetRuneState(byte index, bool set = true)
{ {
var id = CooldownOrder.LookupByIndex(index); bool foundRune = CooldownOrder.Contains(index);
if (set) if (set)
{ {
RuneState |= (byte)(1 << index); // usable RuneState |= (byte)(1 << index); // usable
if (id != 0) if (foundRune)
CooldownOrder.RemoveAt(index); CooldownOrder.Remove(index);
} }
else else
{ {
RuneState &= (byte)~(1 << index); // on cooldown RuneState &= (byte)~(1 << index); // on cooldown
if (id == 0) if (!foundRune)
CooldownOrder.Add(index); CooldownOrder.Add(index);
} }
} }
+4 -4
View File
@@ -17,12 +17,13 @@
using Framework.Constants; using Framework.Constants;
using Framework.Dynamic; using Framework.Dynamic;
using Game.BattlePets;
using Game.DataStorage; using Game.DataStorage;
using Game.Network.Packets; using Game.Network.Packets;
using Game.Spells; using Game.Spells;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Game.BattlePets; using System.Linq;
namespace Game.Entities namespace Game.Entities
{ {
@@ -1818,7 +1819,6 @@ namespace Game.Entities
m_spells.Remove(spellId); m_spells.Remove(spellId);
} }
public void UpdateZoneDependentAuras(uint newZone) public void UpdateZoneDependentAuras(uint newZone)
{ {
// Some spells applied at enter into zone (with subzones), aura removed in UpdateAreaDependentAuras that called always at zone.area update // Some spells applied at enter into zone (with subzones), aura removed in UpdateAreaDependentAuras that called always at zone.area update
@@ -2865,9 +2865,9 @@ namespace Game.Entities
{ {
m_runes.Cooldown[index] = cooldown; m_runes.Cooldown[index] = cooldown;
m_runes.SetRuneState(index, (cooldown == 0) ? true : false); m_runes.SetRuneState(index, (cooldown == 0) ? true : false);
uint activeRunes = m_runes.Cooldown[Math.Min(GetMaxPower(PowerType.Runes), (int)PowerType.Max)]; int activeRunes = m_runes.Cooldown.Count(p => p == 0);
if (activeRunes != GetPower(PowerType.Runes)) if (activeRunes != GetPower(PowerType.Runes))
SetPower(PowerType.Runes, (int)activeRunes); SetPower(PowerType.Runes, activeRunes);
} }
public byte GetRunesState() public byte GetRunesState()