Thread Tools Display Modes
Prev Previous Post   Next Post Next
06-12-16, 01:51 AM   #1
kokomala
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 29
API - GetTotemInfo(slot) and MAX_TOTEMS

GetTotemInfo(slot) will return a lua error for any value that isn't 1-4 (assert function or similar). By extension GetTotemTimeLeft(slot) will return the same error. This also means that the UI will not display more than 4 active totems at any single time.

Whilst this is a non-issue for the vast majority, restoration still has enough totems to run into this problem should they decide to drop all 6 totems *whilst* using an addon that calls this function. And this doesn't even take into consideration pvp totems, which may also cause elemental shaman to run into this same issue.

The base UI is simply coded to MAX_TOTEMS, and thus ignores any value in excess.

Typical lua code for any addon using this function and totem update events.
Code:
function addon:PLAYER_TOTEM_UPDATE(event, ...)
   local slot = ...
   local _, name,_, duration, icon = GetTotemInfo(slot)
   local _,_,_,_,_,_, spellid = GetSpellInfo(name)

   -- do stuff

end
PLAYER_TOTEM_UPDATE sends slot information greater than 4, so using that event for GetTotemInfo(slot) is the prime cause of this error occurring.
 
 

WoWInterface » Site Forums » Archived Beta Forums » Legion Beta archived threads » API - GetTotemInfo(slot) and MAX_TOTEMS

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off