Module totem
Totem handling functions for BadRotations.
Totem functions are the profile API table `totem` (br.api.profile.totem); profiles use it by name.
This module provides a hierarchical API for totem checks: - totem.active(candidate) -> checks if any totem matching candidate is active - totem.fire.active() -> checks if any fire totem is active in slot 1 - totem.fire.searingTotem.active() -> checks if searing totem specifically is active
Slot indices: 1 = Fire, 2 = Earth, 3 = Water, 4 = Air.
Functions
| active (candidate) | Returns true if the specified totem is currently active in any slot. |
| anyLeftBehind ([yards=30]) | True when any of your totems is up but you're yards or more away from it (left behind; one that can't be located counts as near): time for Totemic Call. |
| destroy (slot) | Destroys your totem in a slot, as right-clicking its icon does, on clients where a player can (Wrath on; not Classic, TBC or Forever). |
| distance (slotOrCandidate) | Returns distance from player to the active totem in a slot. |
| exists (candidate) | Alias for active. |
| get (slot) | Returns raw slot info as reported by GetTotemInfo. |
| is (slot, candidates) | Returns true if the specified slot currently matches any provided totem. |
| remain (slot) | Returns remaining time for a slot (seconds), or 0. |
| br.api.build.totemElement (api, elementKey, slot) | Builds an element subtable (e.g., totem.fire) for br.api.build.totem. |
| totem. () | Check if any totem in this element slot is active. |
| totem. () | Alias for active. |
| totem. () | Destroy the totem in this slot (see totem.destroy). |
| totem. () | Get distance to the active totem in this slot (0 when there is none, or it can't be located). |
| totem. () | Get duration for the active totem in this slot. |
| totem. (candidates) | Check if the active totem matches any of the provided candidates. |
| totem. ([yards=30]) | True when this slot's totem is up but you're yards or more away from it (left behind; one that can't be located counts as near). |
| totem. () | Get the name of the active totem in this slot. |
| totem. () | Get remaining time for the active totem in this slot. |
| br.api.build.totemSpecific (slot, totemKey) | Builds a specific totem subtable (e.g., totem.fire.searing) for br.api.build.totemElement. |
| totem. () | Check if this specific totem is active. |
| totem. () | Alias for active. |
| totem. () | Get distance to this specific totem (0 when it isn't up, or it can't be located). |
| totem. () | Get duration for this specific totem. |
| totem. () | Get the name of this totem if active. |
| totem. () | Get remaining time for this specific totem. |
Functions
- active (candidate)
-
Returns true if the specified totem is currently active in any slot.
Candidate can be a spell key, spell ID, or localized name.
Parameters:
- candidate string or number
Returns:
-
boolean
- anyLeftBehind ([yards=30])
-
True when any of your totems is up but you're yards or more away from it (left behind; one that
can't be located counts as near): time for Totemic Call.
Parameters:
- yards number (default 30)
Returns:
-
boolean
- destroy (slot)
-
Destroys your totem in a slot, as right-clicking its icon does, on clients where a player can (Wrath
on; not Classic, TBC or Forever). True when it was asked; false otherwise, with no totem there, or
one asked under a second ago.
Parameters:
- slot number Totem slot (1-4), e.g. totem.fire.slot
Returns:
-
boolean
- distance (slotOrCandidate)
-
Returns distance from player to the active totem in a slot.
Returns 0 if no totem is active or the object can't be located (check active() first).
Parameters:
- slotOrCandidate number or string Totem slot (1-4) or totem spell key/id/name
Returns:
-
number
- exists (candidate)
-
Alias for active.
Parameters:
- candidate string or number
Returns:
-
boolean
- get (slot)
-
Returns raw slot info as reported by GetTotemInfo.
Parameters:
- slot number Totem slot (1-4)
Returns:
- boolean haveTotem
- string or nil name
- number startTime
- number duration
- number or nil icon
- is (slot, candidates)
-
Returns true if the specified slot currently matches any provided totem.
Candidates can be spell IDs (number), spell keys from br.runner.spells (string), or literal localized names (string).
Parameters:
- slot number Totem slot (1-4)
- candidates ...
Returns:
-
boolean
- remain (slot)
-
Returns remaining time for a slot (seconds), or 0.
Parameters:
- slot number Totem slot (1-4)
Returns:
-
number
- br.api.build.totemElement (api, elementKey, slot)
-
Builds an element subtable (e.g., totem.fire) for br.api.build.totem.
Parameters:
- api
- elementKey
- slot
- totem. ()
-
Check if any totem in this element slot is active.
Returns:
-
boolean
- totem. ()
-
Alias for active.
Returns:
-
boolean
- totem. ()
-
Destroy the totem in this slot (see totem.destroy).
Returns:
-
boolean
- totem. ()
-
Get distance to the active totem in this slot (0 when there is none, or it can't be located).
Returns:
-
number
- totem. ()
-
Get duration for the active totem in this slot.
Returns:
-
number
- totem. (candidates)
-
Check if the active totem matches any of the provided candidates.
Parameters:
- candidates ...
Returns:
-
boolean
- totem. ([yards=30])
-
True when this slot's totem is up but you're yards or more away from it (left behind; one that
can't be located counts as near).
Parameters:
- yards number (default 30)
Returns:
-
boolean
- totem. ()
-
Get the name of the active totem in this slot.
Returns:
-
string or nil
- totem. ()
-
Get remaining time for the active totem in this slot.
Returns:
-
number
- br.api.build.totemSpecific (slot, totemKey)
-
Builds a specific totem subtable (e.g., totem.fire.searing) for br.api.build.totemElement.
Parameters:
- slot
- totemKey
- totem. ()
-
Check if this specific totem is active.
Returns:
-
boolean
- totem. ()
-
Alias for active.
Returns:
-
boolean
- totem. ()
-
Get distance to this specific totem (0 when it isn't up, or it can't be located).
Returns:
-
number
- totem. ()
-
Get duration for this specific totem.
Returns:
-
number
- totem. ()
-
Get the name of this totem if active.
Returns:
-
string or nil
- totem. ()
-
Get remaining time for this specific totem.
Returns:
-
number