Thread Tools Display Modes
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.
 
07-14-16, 07:43 AM   #2
Stanzilla
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 34
The API works for 1-5, but yes you can put up to 10 Totems down at a time so this is clearly a problem.
 
07-15-16, 07:51 AM   #3
kokomala
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 29
Originally Posted by Stanzilla View Post
The API works for 1-5, but yes you can put up to 10 Totems down at a time so this is clearly a problem.
They fixed the API around 2-3 weeks ago. There's also a cap to the number of active totems you can have out. Not entirely sure when the cap was implemented, but the same patch I noticed the API was fixed was when I noticed the cap.

Shaman can have a maximum of 5 totems active at once. Any new totem that is cast whilst 5 are active will destroy and replace the totem with the shortest duration remaining.
 
 

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