Clamsoda |
06-28-13 03:54 PM |
Lua Code:
-- Hearthstone local itemID = 6948 for i = 0, NUM_BAG_SLOTS do for z = 1, GetContainerNumSlots(i) do if GetContainerItemID(i, z) == itemID then local _, duration = GetContainerItemCooldown(i, z) if duration == 0 then print ("Item is ready!") else print ("Cooldown is "..duration) end break end end end
The code iterates over every container slot in every bag until it finds a match to the defined item ID. Once matched, the cooldown for the item is polled. If the cooldown returns 0, the item is off of cooldown; else the cooldown value is printed.
You'll need to adapt it to your needs; and I doubt the duration will return in a favorable format, likely seconds. You'll need to format it to hh:mm:ss etc.
Edit: I am not sure how to break out of nested loops in Lua, the code may be able to be optimized a bit if someone sheds some light on that aspect.
|