Just because i have a good mood today.
For current patch 4.3.3.15354
Code:
public enum Offsets
{
Timestamp = 0x9BEE94,
SpellCooldownOffset = 0xACB92C,
}
For upcoming patch 4.3.4.15595
Code:
public enum Offsets
{
Timestamp = 0x9C0C7C,
SpellCooldownOffset = 0xACD71C,
}
This code will return cooldown in ms for given spellid.
Code:
public static int GetSpellCooldownLeftById(int spellId)
{
var dictionary = new Dictionary<int, int>();
for (var i = Memory.BlackMagic.ReadUInt(Memory.WowBaseAddress + (uint)Offsets.SpellCooldownOffset); (i != 0) && ((i & 1) == 0); i = Memory.BlackMagic.ReadUInt(i + 4))
{
if (Memory.BlackMagic.ReadInt(i + 0x8) != spellId) continue;
var key = Memory.BlackMagic.ReadInt(i + 0x10);
var num4 = Memory.BlackMagic.ReadInt(i + 0x14);
var num5 = Memory.BlackMagic.ReadInt(i + 0x20);
var value = Math.Max(num4, num5);
if ((value > 0) && !dictionary.ContainsKey(key))
{
dictionary.Add(key, value);
}
else if (dictionary.ContainsKey(key) && (dictionary[key] < value))
{
dictionary[key] = value;
}
}
if (dictionary.Count == 0)
{
return 0;
}
var num7 = 0;
var num8 = 0;
var timestamp = Memory.BlackMagic.ReadInt(Memory.WowBaseAddress + (uint)Offsets.Timestamp);
foreach (var pair in dictionary.Where(pair => pair.Key > num7))
{
num7 = pair.Key;
num8 = Math.Max(pair.Value - (timestamp - num7), 0);
}
return num8;
}