RSS

Понедельник, 06.05.2024, 12:49
Главная » WoW API » API Функции » Действия »

GetActionCooldown

[ править ]
Returns cooldown information about an action.
[клоны]
Returns cooldown information about an action.

Signature:
Code
start, duration, enable = GetActionCooldown(slot)

Arguments:
  • slot - An action bar slot (number, actionID)

Returns:
  • start - The value of GetTime() at the moment the cooldown began, or 0 if the action is ready (number)
  • duration - The length of the cooldown, or 0 if the action is ready (number)
  • enable - 1 if a Cooldown UI element should be used to display the cooldown, otherwise 0. (Does not always correlate with whether the action is ready.) (number)

Examples:
-- Show all actions currently on cooldown
for i=1,120 do
local start,duration,enable = GetActionCooldown(i)
if start > 0 and enable == 1 then
local actiontype,id,subtype = GetActionInfo(i)
local name

if actiontype == "spell" then
name = GetSpellName(id, "spell")
elseif actiontype == "item" then
name = GetItemInfo(id)
elseif actiontype == "companion" then
name = select(2, GetCompanionInfo(subtype, id))
end

local timeLeft = math.floor((start + duration) - GetTime())
local output = string.format("Cooldown on %s %s (%s seconds left)", actiontype, name, timeLeft)
ChatFrame1:AddMessage(output)

end
end

Также смотрите: Действия , Action functions
Ссылки: http://wowprogramming.com/docs/api/GetActionCooldown