Hi all,
At the moment I am using following code to check is spell ready to be cast:
Code:
struct _spellInfo
{
uint spellId; // 8
uint _d12; // 12
uint startTime; // 16
uint cooldown1; // 20
uint _d24; // 24
uint _d28; // 28
uint cooldown2; // 32
uint _d36; // 36
uint _d40; // 40
uint GlobalTime; // 44
};
bool Manager::IsSpellReady(int spellidToCheck)
{
_spellInfo inf;
__int64 frequency;
__int64 perfCount;
QueryPerformanceFrequency((LARGE_INTEGER*)&frequency);
QueryPerformanceCounter((LARGE_INTEGER*)&perfCount);
//Get first list object
uint currentListObject = m_pMemMan->Read<uint>(m_pMemMan->dwBaseAddress + WOW_SPELL_CoolDown + 0x8);
while ((currentListObject != 0) && ((currentListObject & 1) == 0))
{
m_pMemMan->Read((BYTE*)(currentListObject + 0x8), (BYTE*)&inf, sizeof(_spellInfo));
if (inf.spellId == spellidToCheck)
{
if (inf.GlobalTime > 100000)
inf.GlobalTime = 0;
uint GlobalCooldown = inf.cooldown1 + inf.cooldown2;
uint cooldownLength = max(GlobalCooldown, inf.GlobalTime);
//Current time in ms
uint currentTime = uint((perfCount * 1000) / frequency);
if ((inf.startTime + cooldownLength) > currentTime)
return true;
return false;
}
currentListObject = m_pMemMan->Read<uint>((BYTE*)(currentListObject + 4));
}
return true;
}
but having problem as it does not work reliably.
Maybe some one can see what is a problem with this approach ?
Also, as I am working out of process is there any other way to reliably check is spell ready to be cast or not, or better yet, can I somehow check what was it that I cast last ?
Thanks,
Kajko