lua 中是否有检查饰品是否处于冷却时间以及是否使用它的能力

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

Lua 中是否有能力使用饰品之类的物品并检查它是否处于冷却时间。

您可以使用 WoW API 功能 GetItemCooldown(itemID)。要获取项目 ID,您将使用 GetInventoryItemID("unit", InventorySlotId) 函数:

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