WoW:API GetTotemInfo: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
mNo edit summary
m (Move page script moved page API GetTotemInfo to API GetTotemInfo without leaving a redirect)
 
(One intermediate revision by one other user not shown)
Line 22: Line 22:
:;haveTotem: returns true if you have the totem reagent in your bag ({{Loot|Common|Earth Totem}}, {{Loot|Common|Fire Totem}}, {{Loot|Common|Water Totem}}, {{Loot|Common|Air Totem}}).
:;haveTotem: returns true if you have the totem reagent in your bag ({{Loot|Common|Earth Totem}}, {{Loot|Common|Fire Totem}}, {{Loot|Common|Water Totem}}, {{Loot|Common|Air Totem}}).


:;totemName: returns the name of the currently active totem.
:;totemName: returns the name of the currently active totem.  If there is no active totem for this slot, this value will apparently be an empty string ("") instead of nil.


:;startTime: returns the GetTime() value of when the totem started.
:;startTime: returns the GetTime() value of when the totem started.

Latest revision as of 04:46, 15 August 2023

WoW API < GetTotemInfo


Returns information about totems

haveTotem, totemName, startTime, duration = GetTotemInfo(1 through 4)


Parameters[edit]

Arguments[edit]

(integer)
integer
integer - index of the totem (Fire = 1 Earth = 2 Water = 3 Air = 4)

Returns[edit]

haveTotem
returns true if you have the totem reagent in your bag (Template:Loot, Template:Loot, Template:Loot, Template:Loot).
totemName
returns the name of the currently active totem. If there is no active totem for this slot, this value will apparently be an empty string ("") instead of nil.
startTime
returns the GetTime() value of when the totem started.
duration
returns the duraiton (in seconds) of the currently active totem.



Example

Displays the duration of all active totems

for index=1,4 do
  local arg1, totemName, startTime, duration = GetTotemInfo(index)
  local est_dur = round(startTime+duration-GetTime() )
  DEFAULT_CHAT_FRAME:AddMessage(totemName .. "  " .. est_dur)  
end

Details[edit]

GetTotemTimeLeft(slot): global function returns active time remaining (in seconds) for a totem in a given slot.