WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Legion Beta archived threads (https://www.wowinterface.com/forums/forumdisplay.php?f=177)
-   -   API - GetTotemInfo(slot) and MAX_TOTEMS (https://www.wowinterface.com/forums/showthread.php?t=53711)

kokomala 06-12-16 01:51 AM

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.

Stanzilla 07-14-16 07:43 AM

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.

kokomala 07-15-16 07:51 AM

Quote:

Originally Posted by Stanzilla (Post 316396)
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.


All times are GMT -6. The time now is 07:44 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI