Search code examples
luaworld-of-warcraft

Is there an ability in lua to check if a trinket is on cooldown and if not use it


Is there an ability in Lua to use an item like a trinket and check if it is on cooldown.


Solution

  • You can use the WoW API function GetItemCooldown(itemID). To obtain the item ID you'd use the GetInventoryItemID("unit", InventorySlotId) function:

    local itemID = GetInventoryItemID("player", 13) -- 13 for trinket1, 14 for trinket2
    local start, duration, enable = GetItemCooldown(itemID)
    if enable == 1 and duration == 0 then
      -- You can use the item
    end