I want to determine if I can use potions (in this case rage), using the following function:
Code: Select all
inventory:update();
local item1 = inventory:findItem(itemNameOrId)
local item2 = inventory:findItem(itemNameOrId)
local cd1, success = item1:getRemainingCooldown()
local cd2, success = item2:getRemainingCooldown()
if item1 and cd1 == 0 then
item1:use()
elseif item2 and cd2 == 0 then
item2:use()
end
Reviewing the function Classes -> Item -> CItem:getRemainingCooldown() I see the following and if I understand correctly, the function always returns cooldown = 0
Code: Select all
function CItem:getRemainingCooldown()
local skillItemId = memoryReadInt( getProc(), self.BaseItemAddress + addresses.item.real_id );
if ( skillItemId ~= nil and skillItemId ~= 0 ) then
local skillItemAddress = GetItemAddress( skillItemId );
if ( skillItemAddress ~= nil and skillItemAddress ~= 0 ) then
local val = memoryReadRepeat("int", getProc(), skillItemAddress + 0xE0)
local plusoffset
if val == 1 then plusoffset = 0 elseif val == 3 then plusoffset = 0x80C else return 0, false end
if memoryReadRepeat("int", getProc(), skillItemAddress + 0xE0) ~= 0 then
--local offset = memoryReadRepeat("int", getProc(), skillItemAddress + addresses.skillRemainingCooldown_offset)
--return (memoryReadRepeat("int", getProc(), addresses.staticCooldownsBase + plusoffset + (offset+1)*4) or 0)/10, true
local index = memoryReadRepeat("int", getProc(), skillItemAddress + addresses.skill.remaining_cooldown) or 0
local addr = getBaseAddress(addresses.cooldowns.base + addresses.cooldowns.array_start + plusoffset) + (index*4);
local tmp = (memoryReadInt(getProc(), addr) or 0) / 10;
end
end
end
return 0, false
end
Thanks a lot for your support