Is there a logical structure to the cooldowns table? I've been looking at it for a while and it isn't making a ton of sense to me. The pointers shift every time a spell is cast. I'm completely external.
I can't seem to find a reliable way to parse the table, for tracking spells that are currently on cooldown. Anyone have any insight into this?
The posts I've seen seem to accept a spellid as input. I'm trying to iterate the linked list and return a list of spellid's for spells currently on cooldown.
[StructLayout(LayoutKind.Explicit)]public struct Cooldown
{
[FieldOffset(0x0)]
public IntPtr LastCooldown;
[FieldOffset(0x8)]
public IntPtr NextCooldown;
[FieldOffset(0x10)]
public int SpellID;
[FieldOffset(0x14)]
public int ItemID;
[FieldOffset(0x18)]
public uint TickTime;
[FieldOffset(0x1C)]
public uint RecoveryStart;
[FieldOffset(0x20)]
public uint RecoveryTime;
[FieldOffset(0x24)]
public uint CategoryID;
[FieldOffset(0x28)]
public uint CategoryStart;
[FieldOffset(0x2C)]
public uint CategoryTime;
[FieldOffset(0x38)]
public uint GlobalID;
[FieldOffset(0x3C)]
public uint GlobalTime;
[FieldOffset(0x40)]
public uint GlobalStart;
}
@Razzue
I appreciate it man, thanks! I managed to work together this method earlier, but I'll try implementing yours. The method I wrote feels terribly inefficient:
It's on a threaded loop in my bot (python), and appears to be working to build an array of spellID's in realtime. It just feels terribly inefficient, and is only reading the 0x8 pointer, so if the bot is started AFTER triggering a cooldown, it's possible to miss it until the pointers rotate again.
Also, in my code, spells for items weren't working because it looks like the offset for duration is different. (tested with shadowmeld and hearthstone). I appreciate you sharing.
It may seem inefficient, but you want to read an array of the structs instead of a cooldown class/object and updating individual fields.
1 * Length memory reads vs 7 * Length reads
patterns for binary (this is on retail btw, but should be same/similar on classic)
4C 89 4C 24 ? 44 89 44 24 ? 89 54 24 ? 48 89 4C 24 ? 55 56 57 41 54 41 55
If pattern doesn't work:
- String search "GetSpellCooldown"
- Xref string pointer and jump to .data ref
- Open sub BELOW where the string is now (sub will be Lua_GetSpellCooldown)
- Open sub that passes 3 value pointers, then open the base sub in that one
Now we "should" be at some of the inner workings of how the script operates
thanks for sharing Razzue!
can some1 help me how i can get gcd please
in wow addons i made it like this but i cant find spell with id 61304 in memorys cooldowns, in localplayer structure i found only info about cast(and it so slowly updating?)
Code:
local function GetGCD()
local start, duration, enabled, modRate = GetSpellCooldown(61304)
if ( start > 0 and duration > 0) then
local cdLeft = start + duration - GetTime()
--print(start .. " " .. duration .. " " .. cdLeft)
return cdLeft;
end
return 0;
end;
my problem is GlobalStart(at +0x40) == 133, not 1500 like from addon, i checked some spells(wotlk paladin) most of them got gcd 133 which is not real gcd,
[StructLayout(LayoutKind.Explicit)]public struct Cooldown
{
[FieldOffset(0x0)]
public IntPtr LastCooldown;
[FieldOffset(0x8)]
public IntPtr NextCooldown;
[FieldOffset(0x10)]
public int SpellID;
[FieldOffset(0x14)]
public int ItemID;
[FieldOffset(0x18)]
public uint TickTime;
[FieldOffset(0x1C)]
public uint RecoveryStart;
[FieldOffset(0x20)]
public uint RecoveryTime;
[FieldOffset(0x24)]
public uint CategoryID;
[FieldOffset(0x28)]
public uint CategoryStart;
[FieldOffset(0x2C)]
public uint CategoryTime;
[FieldOffset(0x38)]
public uint GlobalID;
[FieldOffset(0x3C)]
public uint GlobalTime;
[FieldOffset(0x40)]
public uint GlobalStart;
}
Seems to have worked alright for classic so far
Any idea how to make this work for all spell Cooldown on retail ?
For example with mage "Frost Nova" SpellID 122, the CooldownData disapear from the list even if still on CD.
For some spell the real cooldowns seems to be at (Client.BaseAddress + Offsets.Cooldowns.Base) + 0x40 (instead of + 0x10) but this list doesn't use the spellID.
What parameters does this function accept? The fact is that I found this function using your pattern (unfortunately, I could not find it using the string you gave, because in my case such a string is just a string, without references to it)
and when I try to disassemble it, I get an internal error in IDA, so I canât find out how many and what parameters the function takes, or what type of value it returns. I tried to use it with the spell_guid parameter, but the function returned 0, I've been doing this for 2 days now, but due to IDA errors I can't make any progress, and I also can't get information about cooldown using normal iteration, because it seems to me , the structures are disfigured, I also couldnât get information about the cooldown duration from there.
im working with wow version 9.2.7 45745
EDITED:
I recreated some function that iterating trough cooldowns, (i recreated only iterating ) and i can get info about spell, but i have only id, time when i casted it, and thats all(of useful info)
here is not info about spell recovery time btw, idk what to do
Last edited by imnothonorbuddy; 10-13-2023 at 05:35 PM.
Reason: found some info