Skip to content

BossPrototype

funkydude edited this page Oct 27, 2024 · 111 revisions

Boss Prototype

The API of a module created from BigWigs:NewBoss.

BigWigs:NewBoss (moduleName, instanceId[, journalId])

Parameters:

  • moduleName: [string] a unique module name, usually the boss name
  • instanceId: [number] the instance id for the zone the boss is located in. Negative ids are used to represent map ids using the map API (usually for world bosses)
  • journalId: [number] the journal id for the boss, used to translate the boss name (optional)

Returns:

  • boss module
  • common locale table which holds common locale strings

Usage:

local mod, CL = BigWigs:NewBoss("Argus the Unmaker", 1712, 2031)
Core module functionality
RegisterEnableMob (...) Register the module to enable on mob id.
IsEnableMob (mobId) Check if a specific mob id would enable this module.
GetOption (key) Check if a module option is enabled.
IsEnabled () Module enabled check.
IsEngaged () Module engaged check.
GetStage () Check what stage of the encounter the module is set to.
SetStage (stage) Set a module to a specific stage of the encounter
GetMenuIcon (menuIcon) Fetch the path to a specific menu icon
Debug (...) Create a log entry in the Transcriptor addon if it is running
Error (message) Show an error after the encounter has ended
Enable triggers
SetEncounterID (encounterId) Set the encounter id for this module.
GetEncounterID () Get the encounter id used for this module.
SetJournalID (journalId) Set the journal id used for this module.
GetJournalID () Get the journal id used for this module.
SetRespawnTime (seconds) Set the time in seconds before the boss respawns after a wipe.
GetRespawnTime () Get the time in seconds before the boss respawns after a wipe.
worldBoss The NPC/mob id of the world boss.
otherMenu The map id the boss should be listed under in the configuration menu, generally used for world bosses.
SetAllowWin (bool) Allow a module to activate the "win" functionality of BigWigs.
GetAllowWin () Check if a module has a "win" condition.
Localization
GetLocale () Get the current localization strings.
AddMarkerOption (state, markType, icon, id, ...) Create a custom marking option
AddAutoTalkOption (state[, talkType[, name]]) Create a custom auto talk option
Combat log functions
Emote (func, ...) [DEPRECATED] Register a callback for CHAT_MSG_RAID_BOSS_EMOTE that matches text.
BossYell (func, ...) [DEPRECATED] Register a callback for CHAT_MSG_MONSTER_YELL that matches text.
Log (event, func, ...) Register a callback for COMBAT_LOG_EVENT.
RemoveLog (event, ...) Remove a callback for COMBAT_LOG_EVENT.
Death (func, ...) Register a callback for UNIT_DIED.
RegisterEngageMob (func, ...) Register a callback for a unit nameplate entering combat.
IsMobEngaged (guid) Checks if a mob is engaged.
Unit-specific event update management
RegisterUnitEvent (event, func, ...) Register a callback for a UNIT_* event for the specified units.
UnregisterUnitEvent (event, ...) Unregister a callback for unit bound events.
Widget-specific event update management
GetWidgetInfo (widgetType, id) Get a widget info table by widget type
RegisterWidgetEvent (id, func[, allUpdates]) Register a callback for a widget event for the specified widget id.
UnregisterWidgetEvent (id) Unregister a callback for widget events.
Engage/wipe checking and unit scanning
UnitTokenFromGUID (guid[, isFriendly]) Fetches a unit id by scanning available targets.
GetUnitIdByGUID (id) Fetches a unit id by scanning available targets.
GetBossId (id) Fetches a unit id by scanning boss units 1 to 5 only.
GetUnitTarget (func, tankCheckExpiry, guid) Register a callback to get the first non-tank target of a mob.
CheckForEngage () Start a repeating timer checking if your group is in combat with a boss.
CheckForWipe () Start a repeating timer checking if your group has left combat with a boss.
GetNextBossTarget (func, guid[, timeToWait]) Register a callback to get the next target a boss swaps to (boss1 - boss5).
RegisterTargetEvents (func) Register a set of events commonly used for raid marking functionality and pass the unit to a designated function.
UnregisterTargetEvents () Unregister the events registered by `RegisterTargetEvents`.
Misc utility functions
DeleteFromTable (table, item) Delete a specific item from a table.
TableToString (table, entries) Concatenate all the entries from a table into a string separated with commas.
GetMaxPlayers () Get the max player count of the current instance.
Difficulty () Get the current instance difficulty.
LFR () Check if in a Looking for Raid instance.
Story () Check if in a Follower, Quest, or Story instance.
Normal () Check if in a Normal difficulty instance.
Easy () Check if in a Looking for Raid or Normal difficulty instance.
Heroic () Check if in a Heroic difficulty instance.
Mythic () Check if in a Mythic or Mythic+ difficulty instance.
MythicPlus () Check if in a Mythic+ difficulty instance.
Retail () Check if on a retail server.
Classic () Check if on a classic server.
Vanilla () Check if on a vanilla server.
GetSeason () Get the current season.
MobId (guid) Get the mob/npc id from a GUID.
SpellName (spellIdOrSectionId) Get a localized spell name from an id.
SpellTexture (spellIdOrSectionId) Get a spell texture from an id.
BossName (journalEncounterId) Get a localized boss name from a journal-based encounter id.
Me (guid) Check if a GUID is you.
Ambiguate (name, context) Returns a version of a character-realm string suitable for use in a given context.
UnitIsDeadOrGhost (unit) Returns true if the unit is dead or in ghost form.
UnitName (unit) Get the full name of a unit.
UnitSex (unit) Get the sex of a unit.
UnitGUID (unit) Get the Globally Unique Identifier of a unit.
UnitWithinRange (unit, range) Check whether a hostile unit is within a specific range, check is performed based on specific item ranges.
UnitIsInteractable (unit) Check if a unit is interactable
GetHealth (unit) Get the health percentage of a unit.
GetPlayerAura (spellId) Get the aura info of the player using a spell ID.
UnitBuff (unit, spell) Get the buff info of a unit.
UnitDebuff (unit, spell) Get the debuff info of a unit.
Solo () Check if you're the only person inside an instance, despite being in a group or not.
RegisterWhisperEmoteComms (func) Register a wrapper around the CHAT_MSG_ADDON event that listens to Transcriptor comms sent by the core on every RAID_BOSS_WHISPER.
Gossip API
GetGossipOptions () Request the gossip options of the selected NPC
GetGossipID (id) Request the gossip options of a specific gossip ID
SelectGossipID (id[, skipConfirmDialogBox]) Select a specific NPC gossip entry by ID
Group checking
IterateGroup ([noInstanceFilter]) Iterate over your group.
Role checking
UpdateRolePositions () Ask LibSpecialization to update the role positions of everyone in your group.
Melee ([playerName="playerName"]) Check if your talent tree role is MELEE.
Ranged ([playerName="playerName"]) Check if your talent tree role is RANGED.
Tank ([unit="player"]) Check if your talent tree role is TANK.
Tanking (targetUnit[, sourceUnit="player"]) Check if you are tanking a specific NPC unit.
TopThreat (targetUnit[, sourceUnit="player"]) Check if you have the highest threat on a specific NPC unit.
ThreatTarget (sourceUnit[, targetUnit]) Check if a player is the current threat target of a specific NPC, or any available NPC.
Healer ([unit="player"]) Check if your talent tree role is HEALER.
Damager ([unit="player"]) Check if your talent tree role is DAMAGER.
Dispeller (dispelType[, isOffensive[, key]]) Check if you can dispel.
Interrupter ([guid]) Check if you can interrupt.
Hostile (flags) Check if the unit is hostile.
Friendly (flags) Check if the unit is friendly.
Player (flags) Check if the unit is a player.
Option flag check
CheckOption (key, flag) Check if an option has a flag set.
AltPower
OpenAltPower (key, title[, sorting[, sync]]) Open the "Alternate Power" display.
CloseAltPower ([key]) Close the "Alternate Power" display.
InfoBox
SetInfo (key, line, text[, r[, g[, b]]]) Update a specific line on the "Info Box" display.
SetInfoByTable (key, tbl[, tableEntries[, lineStart[, reverseOrder]]]) Set the "Info Box" display to show a list of players and their assigned values in ascending order.
SetInfoBarsByTable (key, tbl, reverseOrder) Set the "Info Box" display to show a list of players and their assigned values in ascending order with bars counting down a specified duration.
SetInfoTitle (key, title) Update the title of an already open "Info Box".
SetInfoBar (key, line, percentage[, r[, g[, b[, a]]]]) Show a background bar in an already open "Info Box".
OpenInfo (key, title[, lines]) Open the "Info Box" display.
CloseInfo (key) Close the "Info Box" display.
Proximity
OpenProximity (key, range[, player[, isReverse]]) Open the proximity display.
CloseProximity ([key]) Close the proximity display.
Messages
CancelDelayedMessage (text) Cancel a delayed message.
DelayedMessage (key, delay, color[, text[, icon[, sound]]]) Schedule a delayed message.
MessageOld (key, color[, sound[, text[, icon]]]) Display a colored message.
PersonalMessage (key[, localeString[, text[, icon]]]) Display a personal message in blue.
NewTargetList () Get a table that colors player names based on class.
ColorName (player[, overwrite]) Color a player name based on class.
StackMessageOld (key, player, stack, color[, sound[, text[, icon]]]) Display a buff/debuff stack warning message.
StackMessage (key, color, player, stack, noEmphUntil[, text[, icon]]) Display a buff/debuff stack warning message.
TargetMessageOld (key, player, color[, sound[, text[, icon[, alwaysPlaySound]]]]) Display a target message.
TargetsMessageOld (key, color, playerTable, playerCount[, text[, icon[, customTime[, markers]]]]) Display a target message of multiple players using a table.
TargetsMessage (key, color, playerTable, playerCount[, text[, icon[, customTime]]]) Display a target message of multiple players using a table.
TargetMessage (key, color, player[, text[, icon]]) Display a target message of a single player.
Bars
Bar (key, length[, text[, icon]]) Display a bar.
CDBar (key, length[, text[, icon]]) Display a cooldown bar.
TargetBar (key, length, player[, text[, icon]]) Display a target bar.
CastBar (key, length[, text[, icon]]) Display a cast bar.
StopBar (text[, player]) Stop a bar.
StopCastBar (text) Stop a cast bar.
PauseBar (key[, text]) Pause a bar.
ResumeBar (key[, text]) Resume a paused bar.
BarTimeLeft (text) Get the time left for a running bar.
Nameplates
Nameplate (key, length, guid[, customIconOrText]) Start showing a nameplate icon.
StopNameplate (key, guid[, text]) Stop showing a nameplate icon.
ClearNameplate (guid) Clear everything on a nameplate.
ShowPlates () [DEPRECATED] Toggle showing hostile nameplates to the enabled state.
HidePlates () [DEPRECATED] Toggle showing hostile nameplates to the disabled state.
AddPlateIcon (spellId, guid[, duration[, desaturate]]) [DEPRECATED] Add icon to hostile nameplate.
RemovePlateIcon (spellId, guid) [DEPRECATED] Remove icon from hostile nameplate.
Icons
PrimaryIcon (key[, player]) Set the primary (skull by default) raid target icon.
SecondaryIcon (key[, player]) Set the secondary (cross by default) raid target icon.
CustomIcon (key, unit[, icon]) Directly set any raid target icon on a unit based on a custom option key.
GetIcon (unitOrFlags) Get the raid target icon currently set on a unit based on a unit token (string) or combat log flags (number).
GetIconTexture (position) Get the raid target icon texture from a number ranging from 1-8
Chat
Say (key, msg[, directPrint[, englishText]]) Send a message in SAY.
Yell (key, msg[, directPrint[, englishText]]) Send a message in YELL.
CancelSayCountdown (key) Cancel a countdown using say messages.
CancelYellCountdown (key) Cancel a countdown using yell messages.
SayCountdown (key, seconds[, textOrIcon[, startAt[, englishText]]]) Start a countdown using say messages.
YellCountdown (key, seconds[, textOrIcon[, startAt[, englishText]]]) Start a countdown using yell messages.
Misc
SimpleTimer (func, delay) Trigger a function after a specific delay
Flash (key[, icon]) Flash the screen edges.
PlaySound (key, sound[, voice[, player]]) Play a sound.
PlayVictorySound () Request to play the victory sound.
PlaySoundFile (sound[, channel]) Play a sound file.
Sync (msg[, extra]) Send an addon sync to other players.
AbbreviateNumber (amount) Return a string as a formatted abbreviated number.
Berserk (seconds[, noMessages[, customBoss[, customBerserk[, customFinalMessage[, customBarText]]]]]) Start a "berserk" bar, and optionally also show an engage message, and multiple reminder messages.
StopBerserk (barText[, customBoss[, customFinalMessage]]) Stop a "berserk" bar, and any related messages.

Core module functionality

RegisterEnableMob (...)

Register the module to enable on mob id.

Parameters:

  • ...: [number] Any number of mob ids

IsEnableMob (mobId)

Check if a specific mob id would enable this module.

Parameters:

  • mobId: [number] A singular specific mob id

Returns:

  • true or nil

GetOption (key)

Check if a module option is enabled. This is a wrapper around the self.db.profile[key] table.

Parameters:

  • key

Returns:

  • boolean or number, depending on option type

IsEnabled ()

Module enabled check. A module is either enabled or disabled.

Returns:

  • true or nil

IsEngaged ()

Module engaged check. A module is either engaged in combat or not.

Returns:

  • true or nil

GetStage ()

Check what stage of the encounter the module is set to.

Returns:

  • number

SetStage (stage)

Set a module to a specific stage of the encounter

Parameters:

  • stage: [number] the stage to set the module to

GetMenuIcon (menuIcon)

Fetch the path to a specific menu icon

Parameters:

  • menuIcon: [string] the specific menu icon to fetch the path for

Returns:

  • string

Debug (...)

Create a log entry in the Transcriptor addon if it is running

Parameters:

  • ...: any number of values to concatenate into the log entry

Error (message)

Show an error after the encounter has ended

Parameters:

  • message: [string] the message to show to the user

Enable triggers

SetEncounterID (encounterId)

Set the encounter id for this module. (As used by events ENCOUNTER_START, ENCOUNTER_END & BOSS_KILL) If this is set, no engage or wipe checking is required. The module will use this id and all engage/wipe checking will be handled automatically.

Parameters:

  • encounterId: [number] The encounter id

GetEncounterID ()

Get the encounter id used for this module. (As used by events ENCOUNTER_START, ENCOUNTER_END & BOSS_KILL)

Returns:

  • number

SetJournalID (journalId)

Set the journal id used for this module. (As used by the dungeon journal) Usually not set directly, but via the :NewBoss API

Parameters:

  • journalId: [number] The journal id

GetJournalID ()

Get the journal id used for this module. (As used by the dungeon journal)

Returns:

  • number

SetRespawnTime (seconds)

Set the time in seconds before the boss respawns after a wipe. Used by the Respawn plugin to show a bar for the respawn time.

Parameters:

  • seconds: [number] The respawn time

GetRespawnTime ()

Get the time in seconds before the boss respawns after a wipe.

Returns:

  • number

worldBoss

The NPC/mob id of the world boss. Used to specify that a module is for a world boss, not an instance boss.


otherMenu

The map id the boss should be listed under in the configuration menu, generally used for world bosses.


SetAllowWin (bool)

Allow a module to activate the "win" functionality of BigWigs. When a boss is defeated, this boolean will allow a module to "win" even if it doesn't have a valid journal ID.

Parameters:

  • bool

GetAllowWin ()

Check if a module has a "win" condition.

Returns:

  • boolean

Localization

GetLocale ()

Get the current localization strings.

Returns:

  • keyed table of localized strings

AddMarkerOption (state, markType, icon, id, ...)

Create a custom marking option

Parameters:

  • state: [bool] Boolean value to represent default state
  • markType: [string] The type of string to return (player, npc, npc_aura)
  • icon: [number] An icon id to be used for the option texture
  • id: The spell id or journal id to be translated into a name, or a string to represent an entry in the boss module locale table. "test" would look up L.test
  • ...: [number] a series of raid icons being used by the marker function e.g. (1, 2, 3)

Returns:

  • an option string to be used in conjuction with :GetOption

AddAutoTalkOption (state[, talkType[, name]])

Create a custom auto talk option

Parameters:

  • state: [bool] Boolean value to represent default state
  • talkType: [string] The type of description to use ("boss" or nil for generic) (optional)
  • name: [string] A unique name the option should have if you want to create multiple options in one module (optional)

Returns:

  • an option string to be used in conjuction with :GetOption

Combat log functions

Emote (func, ...)

[DEPRECATED] Register a callback for CHAT_MSG_RAID_BOSS_EMOTE that matches text.

Parameters:

  • func: callback function, passed (module, message, sender, language, channel, target, [standard CHAT_MSG args]...)
  • ...: any number of strings to match

BossYell (func, ...)

[DEPRECATED] Register a callback for CHAT_MSG_MONSTER_YELL that matches text.

Parameters:

  • func: callback function, passed (module, message, sender, language, channel, target, [standard CHAT_MSG args]...)
  • ...: any number of strings to match

Log (event, func, ...)

Register a callback for COMBAT_LOG_EVENT.

Parameters:

  • event: [string] COMBAT_LOG_EVENT to fire for e.g. SPELL_CAST_START
  • func: callback function, passed a keyed table (sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags, spellId, spellName, extraSpellId, extraSpellName, amount)
  • ...: [number] any number of spell ids

RemoveLog (event, ...)

Remove a callback for COMBAT_LOG_EVENT.

Parameters:

  • event: [string] COMBAT_LOG_EVENT to register for
  • ...: [number] any number of spell ids

Death (func, ...)

Register a callback for UNIT_DIED.

Parameters:

  • func: callback function, passed a keyed table (mobId, destGUID, destName, destFlags, destRaidFlags)
  • ...: [number] any number of mob ids

RegisterEngageMob (func, ...)

Register a callback for a unit nameplate entering combat.

Parameters:

  • func: callback function, passed (guid, mobId)
  • ...: [number] any number of mob ids

IsMobEngaged (guid)

Checks if a mob is engaged.

Parameters:

  • guid: a mob to check

Returns:

  • boolean

Unit-specific event update management

RegisterUnitEvent (event, func, ...)

Register a callback for a UNIT_* event for the specified units.

Parameters:

  • event: [string] the event to register for
  • func: callback function, passed (unit, eventargs...)
  • ...: [string] Any number of unit tokens

UnregisterUnitEvent (event, ...)

Unregister a callback for unit bound events.

Parameters:

  • event: [string] the event register for
  • ...: [string] Any number of unit tokens

Widget-specific event update management

GetWidgetInfo (widgetType, id)

Get a widget info table by widget type

Parameters:

  • widgetType: [string] Choices are "bar", "text" or "delve"
  • id: [number] The id of the widget

Returns:

  • table The widget info table

RegisterWidgetEvent (id, func[, allUpdates])

Register a callback for a widget event for the specified widget id.

Parameters:

  • id: [number] the id of the widget to listen to
  • func: callback function, passed (widgetId, widgetValue, widgetInfoTable)
  • allUpdates: [bool] If widget update events should always trigger the callback - even if the widget is hidden. (optional)

UnregisterWidgetEvent (id)

Unregister a callback for widget events.

Parameters:

  • id: [number] the widget id to stop listening to

Engage/wipe checking and unit scanning

UnitTokenFromGUID (guid[, isFriendly])

Fetches a unit id by scanning available targets.

Parameters:

  • guid: [string] The GUID of the unit to find
  • isFriendly: [bool] Check only friendly units (optional)

Returns:

  • unit id if found, nil otherwise

GetUnitIdByGUID (id)

Fetches a unit id by scanning available targets. Scans through available targets such as bosses, nameplates and player targets in an attempt to find a valid unit id to return.

Parameters:

  • id: GUID or mob/npc id

Returns:

  • unit id if found, nil otherwise

GetBossId (id)

Fetches a unit id by scanning boss units 1 to 5 only.

Parameters:

  • id: Either the GUID or the mob/npc id of the boss unit to find

Returns:

  • unit id if found, nil otherwise

  • guid if found, nil otherwise


GetUnitTarget (func, tankCheckExpiry, guid)

Register a callback to get the first non-tank target of a mob. Looks for the unit as defined by the GUID and then returns the target of that unit. If the target is a tank, it will keep looking until the designated time has elapsed.

Parameters:

  • func: callback function, passed (module, playerName, playerGUID, elapsed)
  • tankCheckExpiry: [number] seconds to wait, if a tank is still the target after this time, it will return the tank as the target (max 0.8)
  • guid: [string] GUID of the mob to get the target of

CheckForEngage ()

Start a repeating timer checking if your group is in combat with a boss.


CheckForWipe ()

Start a repeating timer checking if your group has left combat with a boss.


GetNextBossTarget (func, guid[, timeToWait])

Register a callback to get the next target a boss swaps to (boss1 - boss5). Looks for the boss as defined by the GUID and then returns the next target selected by that boss. Unlike the :GetBossTarget functionality, :GetNextBossTarget doesn't care what the target is, it will just fire the callback with whatever unit the boss targets next

Parameters:

  • func: callback function, passed (module, playerName, playerGUID)
  • guid: [string] GUID of the mob to get the target of
  • timeToWait: [number] seconds to wait for the boss to change target until giving up, if nil the default time of 0.3s is used (optional)

RegisterTargetEvents (func)

Register a set of events commonly used for raid marking functionality and pass the unit to a designated function. UPDATE_MOUSEOVER_UNIT, UNIT_TARGET, NAME_PLATE_UNIT_ADDED

Parameters:

  • func: callback function, passed (event, unit)

UnregisterTargetEvents ()

Unregister the events registered by RegisterTargetEvents.


Misc utility functions

DeleteFromTable (table, item)

Delete a specific item from a table.

Parameters:

  • table: [table] The table to remove the item from
  • item: The item to remove from the table

TableToString (table, entries)

Concatenate all the entries from a table into a string separated with commas.

Parameters:

  • table: [table] The table to concatenate
  • entries: [number] The amount of entries in the table to concatenate

Returns:

  • string

GetMaxPlayers ()

Get the max player count of the current instance.

Returns:

  • number

Difficulty ()

Get the current instance difficulty.

Returns:

  • difficulty id

LFR ()

Check if in a Looking for Raid instance.

Returns:

  • boolean

Story ()

Check if in a Follower, Quest, or Story instance.

Returns:

  • boolean

Normal ()

Check if in a Normal difficulty instance.

Returns:

  • boolean

Easy ()

Check if in a Looking for Raid or Normal difficulty instance.

Returns:

  • boolean

Heroic ()

Check if in a Heroic difficulty instance.

Returns:

  • boolean

Mythic ()

Check if in a Mythic or Mythic+ difficulty instance.

Returns:

  • boolean

MythicPlus ()

Check if in a Mythic+ difficulty instance.

Returns:

  • boolean

Retail ()

Check if on a retail server.

Returns:

  • boolean

Classic ()

Check if on a classic server.

Returns:

  • boolean

Vanilla ()

Check if on a vanilla server.

Returns:

  • boolean

GetSeason ()

Get the current season.

Returns:

  • number

MobId (guid)

Get the mob/npc id from a GUID.

Parameters:

  • guid: [string] GUID of a mob/npc

Returns:

  • mob/npc id

SpellName (spellIdOrSectionId)

Get a localized spell name from an id. Positive ids for spells (C_Spell.GetSpellName) and negative ids for journal-based section entries (C_EncounterJournal.GetSectionInfo).

Parameters:

  • spellIdOrSectionId: [number] The spell id or the journal-based section id (as a negative number)

Returns:

  • spell name

SpellTexture (spellIdOrSectionId)

Get a spell texture from an id. Positive ids for spells (C_Spell.GetSpellTexture) and negative ids for journal-based section entries (C_EncounterJournal.GetSectionInfo).

Parameters:

  • spellIdOrSectionId: [number] The spell id or the journal-based section id (as a negative number)

Returns:

  • spell texture

BossName (journalEncounterId)

Get a localized boss name from a journal-based encounter id. (EJ_GetEncounterInfo)

Parameters:

  • journalEncounterId: [number] The journal-based encounter id

Returns:

  • localized boss name

Me (guid)

Check if a GUID is you.

Parameters:

  • guid: [string] player GUID

Returns:

  • boolean

Ambiguate (name, context)

Returns a version of a character-realm string suitable for use in a given context.

Parameters:

  • name: [string] character-realm for a character
  • context: [string] the context the name will be used in, one of: "all", "guild", "mail", "none", or "short"

Returns:

  • newName the character name with the server appended if appropriate

UnitIsDeadOrGhost (unit)

Returns true if the unit is dead or in ghost form.

Parameters:

  • unit: [string] unit token or name

Returns:

  • boolean

UnitName (unit)

Get the full name of a unit.

Parameters:

  • unit: [string] unit token or name

Returns:

  • name name with the server appended if appropriate

UnitSex (unit)

Get the sex of a unit.

Parameters:

  • unit: [string] unit token or name

Returns:

  • sex the sex of the unit

UnitGUID (unit)

Get the Globally Unique Identifier of a unit.

Parameters:

  • unit: [string] unit token or name

Returns:

  • guid guid of the unit

UnitWithinRange (unit, range)

Check whether a hostile unit is within a specific range, check is performed based on specific item ranges. Available Ranges: 10, 20, 30, 35, (TBC+: 40, 45, 60), (WotlK+: 100)

Parameters:

  • unit: [string] unit token or name
  • range: [number] the range to check

Returns:

  • boolean

UnitIsInteractable (unit)

Check if a unit is interactable

Parameters:

  • unit: [string] unit token or name

Returns:

  • boolean

GetHealth (unit)

Get the health percentage of a unit.

Parameters:

  • unit: [string] unit token or name

Returns:

  • hp health of the unit as a percentage between 0 and 100

GetPlayerAura (spellId)

Get the aura info of the player using a spell ID.

Parameters:

  • spellId: [number] the spell ID of the aura

Returns:

  • table the table full of aura info, or nil if not found

UnitBuff (unit, spell)

Get the buff info of a unit.

Parameters:

  • unit: [string] unit token or name
  • spell: [number] the spell ID of the buff to scan for

Returns:

  • args

UnitDebuff (unit, spell)

Get the debuff info of a unit.

Parameters:

  • unit: [string] unit token or name
  • spell: [number] the spell ID of the debuff to scan for

Returns:

  • args

Solo ()

Check if you're the only person inside an instance, despite being in a group or not.

Returns:

  • boolean

RegisterWhisperEmoteComms (func)

Register a wrapper around the CHAT_MSG_ADDON event that listens to Transcriptor comms sent by the core on every RAID_BOSS_WHISPER.

Parameters:

  • func: callback function, passed (msg, player)

Gossip API

GetGossipOptions ()

Request the gossip options of the selected NPC

Returns:

  • table A table result of all text strings in the form of { result1, result2, result3 }

GetGossipID (id)

Request the gossip options of a specific gossip ID

Parameters:

  • id

Returns:

  • table A table result for the specific gossip ID, or nil if not found

SelectGossipID (id[, skipConfirmDialogBox])

Select a specific NPC gossip entry by ID

Parameters:

  • id: [number] The ID of the specific gossip option to be selected
  • skipConfirmDialogBox: [bool] If the pop up confirmation dialog box should be skipped (optional)

Group checking

IterateGroup ([noInstanceFilter])

Iterate over your group. Automatically uses "party" or "raid" tokens depending on your group type.

Parameters:

  • noInstanceFilter: [bool] If true then all group units are returned even if they are not in your instance (optional)

Returns:

  • iterator

Role checking

UpdateRolePositions ()

Ask LibSpecialization to update the role positions of everyone in your group.


Melee ([playerName="playerName"])

Check if your talent tree role is MELEE.

Parameters:

  • playerName: [string] check if another player is MELEE. (default: "playerName")

Returns:

  • boolean

Ranged ([playerName="playerName"])

Check if your talent tree role is RANGED.

Parameters:

  • playerName: [string] check if another player is RANGED. (default: "playerName")

Returns:

  • boolean

Tank ([unit="player"])

Check if your talent tree role is TANK.

Parameters:

  • unit: [string] check if the chosen role of another unit is set to TANK, or if that unit is listed in the MAINTANK frames. (default: "player")

Returns:

  • boolean

Tanking (targetUnit[, sourceUnit="player"])

Check if you are tanking a specific NPC unit.

Parameters:

  • targetUnit: [string] the unit token of the NPC you wish to check
  • sourceUnit: [string] If a player unit is specified, this unit will be checked to see if they are tanking, otherwise use nil to check yourself (default: "player")

Returns:

  • boolean

TopThreat (targetUnit[, sourceUnit="player"])

Check if you have the highest threat on a specific NPC unit.

Parameters:

  • targetUnit: [string] the unit token of the NPC you wish to check
  • sourceUnit: [string] the specific unit you want to check the threat level of, otherwise use nil to check yourself (default: "player")

Returns:

  • boolean

ThreatTarget (sourceUnit[, targetUnit])

Check if a player is the current threat target of a specific NPC, or any available NPC.

Parameters:

  • sourceUnit: [string] the unit token of the player you want the threat target status of
  • targetUnit: [string] the unit token of the specific NPC you want to check against, otherwise use nil to check all available NPCs (optional)

Returns:

  • boolean

Healer ([unit="player"])

Check if your talent tree role is HEALER.

Parameters:

  • unit: [string] check if the chosen role of another unit is set to HEALER. (default: "player")

Returns:

  • boolean

Damager ([unit="player"])

Check if your talent tree role is DAMAGER.

Parameters:

  • unit: [string] check if the chosen role of another unit is set to DAMAGER. (default: "player")

Returns:

  • boolean

Dispeller (dispelType[, isOffensive[, key]])

Check if you can dispel.

Parameters:

  • dispelType: [string] dispel type (magic, disease, poison, curse, movement)
  • isOffensive: [bool] true if dispelling a buff from an enemy (magic), nil if dispelling a friendly (optional)
  • key: module option key to check (optional)

Returns:

  • boolean

Interrupter ([guid])

Check if you can interrupt.

Parameters:

  • guid: [string] if not nil, will only return true if the GUID matches your target or focus. (optional)

Returns:

  • boolean, if the unit can interrupt

  • boolean, if the interrupt is off cooldown and ready to use


Hostile (flags)

Check if the unit is hostile.

Parameters:

  • flags: [string] unit bit flags

Returns:

  • boolean if the unit is hostile

Friendly (flags)

Check if the unit is friendly.

Parameters:

  • flags: [string] unit bit flags

Returns:

  • boolean if the unit is friendly

Player (flags)

Check if the unit is a player.

Parameters:

  • flags: [string] unit bit flags

Returns:

  • boolean if the unit is a player

Option flag check

CheckOption (key, flag)

Check if an option has a flag set.

Parameters:

  • key: the option key
  • flag: [string] the option flag

Returns:

  • boolean

AltPower

OpenAltPower (key, title[, sorting[, sync]])

Open the "Alternate Power" display.

Parameters:

  • key: the option key to check
  • title: the title of the window, either a spell id or string
  • sorting: [string] "ZA" for descending sort, "AZ" or nil for ascending sort (optional)
  • sync: [bool] if true, queries values from other players (for use if phasing prevents reliable updates) (optional)

CloseAltPower ([key])

Close the "Alternate Power" display.

Parameters:

  • key: the option key to check ("altpower" if nil) (optional)

InfoBox

SetInfo (key, line, text[, r[, g[, b]]])

Update a specific line on the "Info Box" display.

Parameters:

  • key: the option key to check
  • line: [number] the line to update
  • text: [string] the new text to show
  • r: [number] red part of rgb, 0-1 (optional)
  • g: [number] green part of rgb, 0-1 (optional)
  • b: [number] blue part of rgb, 0-1 (optional)

SetInfoByTable (key, tbl[, tableEntries[, lineStart[, reverseOrder]]])

Set the "Info Box" display to show a list of players and their assigned values in ascending order.

Parameters:

  • key: the option key to check
  • tbl: [table] a table in the format of {player = number}
  • tableEntries: [number] how many table entries should be displayed (optional)
  • lineStart: [number] what specific line to start displaying names at (optional)
  • reverseOrder: [bool] Set as true to sort in reverse (0 before 1) (optional)

SetInfoBarsByTable (key, tbl, reverseOrder)

Set the "Info Box" display to show a list of players and their assigned values in ascending order with bars counting down a specified duration.

Parameters:

  • key: the option key to check
  • tbl: [table] a table in the format of {player = {amount, barDuration, startAt}}
  • reverseOrder: [bool] Set as true to sort in reverse (0 before 1, then by lowest time to expire)

SetInfoTitle (key, title)

Update the title of an already open "Info Box".

Parameters:

  • key: the option key to check
  • title: [string] the title of the window

SetInfoBar (key, line, percentage[, r[, g[, b[, a]]]])

Show a background bar in an already open "Info Box".

Parameters:

  • key: the option key to check
  • line: [number] the line to update, 1-10
  • percentage: [number] width of the bar between 0 and 1
  • r: [number] red part of rgb, 0-1 (optional)
  • g: [number] green part of rgb, 0-1 (optional)
  • b: [number] blue part of rgb, 0-1 (optional)
  • a: [number] alpha, 0-1 (optional)

OpenInfo (key, title[, lines])

Open the "Info Box" display.

Parameters:

  • key: the option key to check
  • title: [string] the title of the window
  • lines: [number] the number of lines to show (optional)

CloseInfo (key)

Close the "Info Box" display.

Parameters:

  • key: the option key to check

Proximity

OpenProximity (key, range[, player[, isReverse]])

Open the proximity display.

Parameters:

  • key: the option key to check
  • range: [number] the distance to check
  • player: the player name for a target proximity or a table containing multiple players (optional)
  • isReverse: [bool] if true, reverse the logic to warn if not within range (optional)

CloseProximity ([key])

Close the proximity display.

Parameters:

  • key: the option key to check ("proximity" if nil) (optional)

Messages

CancelDelayedMessage (text)

Cancel a delayed message.

Parameters:

  • text: [string] the text of the message to cancel

DelayedMessage (key, delay, color[, text[, icon[, sound]]])

Schedule a delayed message. The messages are keyed by their text, so scheduling the same message will overwrite the previous message's delay.

Parameters:

  • key: the option key
  • delay: [number] the delay in seconds
  • color: [string] the message color category
  • text: the message text (if nil, key is used) (optional)
  • icon: the message icon (spell id or texture name) (optional)
  • sound: [string] the message sound (optional)

MessageOld (key, color[, sound[, text[, icon]]])

Display a colored message. [DEPRECATED]

Parameters:

  • key: the option key
  • color: [string] the message color category
  • sound: [string] the message sound (optional)
  • text: the message text (if nil, key is used) (optional)
  • icon: the message icon (spell id or texture name) (optional)

PersonalMessage (key[, localeString[, text[, icon]]])

Display a personal message in blue.

Parameters:

  • key: the option key
  • localeString: if nil then the "%s on YOU" string will be used, if false then the text field will be printed directly, otherwise the common locale will be referenced via CL[localeString] (optional)
  • text: the message text (if nil, key is used) (optional)
  • icon: the message icon (spell id or texture name) (optional)

NewTargetList ()

Get a table that colors player names based on class. [DEPRECATED]

Returns:

  • an empty table

ColorName (player[, overwrite])

Color a player name based on class.

Parameters:

  • player: The player name, or a table containing a list of names
  • overwrite: [bool] Ignore whatever the "class color message" feature is set to (optional)

Returns:

  • colored player name, or table containing colored names

StackMessageOld (key, player, stack, color[, sound[, text[, icon]]])

Display a buff/debuff stack warning message. [DEPRECATED]

Parameters:

  • key: the option key
  • player: [string] the player to display
  • stack: [number] the stack count
  • color: [string] the message color category
  • sound: [string] the message sound (optional)
  • text: the message text (if nil, key is used) (optional)
  • icon: the message icon (spell id or texture name) (optional)

StackMessage (key, color, player, stack, noEmphUntil[, text[, icon]])

Display a buff/debuff stack warning message.

Parameters:

  • key: the option key
  • color: [string] the message color category
  • player: [string] the player to display
  • stack: [number] the stack count
  • noEmphUntil: [number] prevent the emphasize function taking effect until this amount of stacks has been reached
  • text: the message text (if nil, key is used) (optional)
  • icon: the message icon (spell id or texture name) (optional)

TargetMessageOld (key, player, color[, sound[, text[, icon[, alwaysPlaySound]]]])

Display a target message. [DEPRECATED]

Parameters:

  • key: the option key
  • player: [string] the player to display
  • color: [string] the message color category
  • sound: [string] the message sound (optional)
  • text: the message text (if nil, key is used) (optional)
  • icon: the message icon (spell id or texture name) (optional)
  • alwaysPlaySound: [bool] if true, play the sound even if player is not you (optional)

TargetsMessageOld (key, color, playerTable, playerCount[, text[, icon[, customTime[, markers]]]])

Display a target message of multiple players using a table. [DEPRECATED]

Parameters:

  • key: the option key
  • color: [string] the message color category
  • playerTable: a table containing the list of players
  • playerCount: [number] the max amount of players you expect to be included, message will instantly print when this max is reached
  • text: the message text (if nil, key is used) (optional)
  • icon: the message icon (spell id or texture name, key is used if nil) (optional)
  • customTime: [number] how long to wait to reach the max players in the table. If the max is not reached, it will print after this value (0.3s is used if nil) (optional)
  • markers: a table containing the markers that should be attached next to the player names e.g. {1, 2, 3} (optional)

TargetsMessage (key, color, playerTable, playerCount[, text[, icon[, customTime]]])

Display a target message of multiple players using a table.

Parameters:

  • key: the option key
  • color: [string] the message color category
  • playerTable: a table containing the list of players
  • playerCount: [number] the max amount of players you expect to be included, message will instantly print when this max is reached
  • text: the message text (if nil, key is used) (optional)
  • icon: the message icon (spell id or texture name, key is used if nil) (optional)
  • customTime: [number] how long to wait to reach the max players in the table. If the max is not reached, it will print after this value (0.3s is used if nil) (optional)

TargetMessage (key, color, player[, text[, icon]])

Display a target message of a single player.

Parameters:

  • key: the option key
  • color: [string] the message color category
  • player: [string] the player name
  • text: the message text (if nil, key is used) (optional)
  • icon: the message icon (spell id or texture name, key is used if nil) (optional)

Bars

Bar (key, length[, text[, icon]])

Display a bar.

Parameters:

  • key: the option key
  • length: the bar duration in seconds, or a table containing {remaining duration, max duration}
  • text: the bar text (if nil, key is used) (optional)
  • icon: the bar icon (spell id or texture name) (optional)

CDBar (key, length[, text[, icon]])

Display a cooldown bar. Indicates an unreliable duration by prefixing the time with "~"

Parameters:

  • key: the option key
  • length: the bar duration in seconds, or a table containing {current duration, max duration}
  • text: the bar text (if nil, key is used) (optional)
  • icon: the bar icon (spell id or texture name) (optional)

TargetBar (key, length, player[, text[, icon]])

Display a target bar.

Parameters:

  • key: the option key
  • length: the bar duration in seconds, or a table containing {current duration, max duration}
  • player: [string] the player name to show on the bar
  • text: the bar text (if nil, key is used) (optional)
  • icon: the bar icon (spell id or texture name) (optional)

CastBar (key, length[, text[, icon]])

Display a cast bar.

Parameters:

  • key: the option key
  • length: the bar duration in seconds, or a table containing {current duration, max duration}
  • text: the bar text (if nil, key is used) (optional)
  • icon: the bar icon (spell id or texture name) (optional)

StopBar (text[, player])

Stop a bar.

Parameters:

  • text: the bar text, or a spellId which is converted into the spell name and used
  • player: [string] the player name if stopping a target bar (optional)

StopCastBar (text)

Stop a cast bar.

Parameters:

  • text: the bar text, or a spellId which is converted into the spell name and used

PauseBar (key[, text])

Pause a bar.

Parameters:

  • key: the option key
  • text: the bar text (optional)

ResumeBar (key[, text])

Resume a paused bar.

Parameters:

  • key: the option key
  • text: the bar text (optional)

BarTimeLeft (text)

Get the time left for a running bar.

Parameters:

  • text: the bar text

Returns:

  • the remaining duration in seconds or 0

Nameplates

Nameplate (key, length, guid[, customIconOrText])

Start showing a nameplate icon.

Parameters:

  • key: the option key
  • length: [number] the duration in seconds
  • guid: [string] Anchor to a unit's nameplate by GUID
  • customIconOrText: a custom icon (File ID as a number) or text to show text instead (optional)

StopNameplate (key, guid[, text])

Stop showing a nameplate icon.

Parameters:

  • key: the option key
  • guid: [string] nameplate unit's guid
  • text: [string] the specific text to clear, if clearing text instead of an icon (optional)

ClearNameplate (guid)

Clear everything on a nameplate.

Parameters:

  • guid: [string] nameplate unit's guid

ShowPlates ()

[DEPRECATED] Toggle showing hostile nameplates to the enabled state.


HidePlates ()

[DEPRECATED] Toggle showing hostile nameplates to the disabled state.


AddPlateIcon (spellId, guid[, duration[, desaturate]])

[DEPRECATED] Add icon to hostile nameplate.

Parameters:

  • spellId: [number] the associated spell id
  • guid: [string] the hostile unit guid
  • duration: [number] the duration of the aura (optional)
  • desaturate: [bool] true if the texture should be desaturated (optional)

RemovePlateIcon (spellId, guid)

[DEPRECATED] Remove icon from hostile nameplate.

Parameters:

  • spellId: [number] the associated spell id, passing nil removes all icons
  • guid: [string] the hostile unit guid

Icons

PrimaryIcon (key[, player])

Set the primary (skull by default) raid target icon. No icon will be set if the player already has one on them.

Parameters:

  • key: the option key
  • player: [string] the player to mark (if nil, the icon is removed) (optional)

SecondaryIcon (key[, player])

Set the secondary (cross by default) raid target icon. No icon will be set if the player already has one on them.

Parameters:

  • key: the option key
  • player: [string] the player to mark (if nil, the icon is removed) (optional)

CustomIcon (key, unit[, icon])

Directly set any raid target icon on a unit based on a custom option key.

Parameters:

  • key: the option key
  • unit: [string] the unit (player/npc) to mark
  • icon: [number] the icon to mark the player with, numbering from 1-8 (if nil, the icon is removed) (optional)

GetIcon (unitOrFlags)

Get the raid target icon currently set on a unit based on a unit token (string) or combat log flags (number).

Parameters:

  • unitOrFlags: unit token or combat log flags

Returns:

  • number The number based on the icon ranging from 1-8 (nil if no icon is set)

GetIconTexture (position)

Get the raid target icon texture from a number ranging from 1-8

Parameters:

  • position: [number] The number from 1-8

Returns:

  • string A texture you can embed into a string

Chat

Say (key, msg[, directPrint[, englishText]])

Send a message in SAY. Generally used for abilities where you need to spread out or run away.

Parameters:

  • key: the option key
  • msg: the message to say (if nil, key is used)
  • directPrint: [bool] if true, skip formatting the message and print the string directly to chat. (optional)
  • englishText: [string] The text string to replace the message with if the user has enabled the option to only print messages in English (optional)

Yell (key, msg[, directPrint[, englishText]])

Send a message in YELL. Generally used for abilities where you need to group up.

Parameters:

  • key: the option key
  • msg: the message to yell (if nil, key is used)
  • directPrint: [bool] if true, skip formatting the message and print the string directly to chat. (optional)
  • englishText: [string] The text string to replace the message with if the user has enabled the option to only print messages in English (optional)

CancelSayCountdown (key)

Cancel a countdown using say messages.

Parameters:

  • key: the option key

CancelYellCountdown (key)

Cancel a countdown using yell messages.

Parameters:

  • key: the option key

SayCountdown (key, seconds[, textOrIcon[, startAt[, englishText]]])

Start a countdown using say messages. Generally used for abilities where you need to spread out or run away.

Parameters:

  • key: the option key
  • seconds: [number] the amount of time in seconds until the countdown expires
  • textOrIcon: Attach additional text to the countdown if passed a text string, attach a raid icon if passed a number [1-8] (optional)
  • startAt: [number] When to start sending messages in say, default value is at 3 seconds remaining (optional)
  • englishText: [string] The text string to replace the message with if the user has enabled the option to only print messages in English (optional)

YellCountdown (key, seconds[, textOrIcon[, startAt[, englishText]]])

Start a countdown using yell messages. Generally used for abilities where you need to group up.

Parameters:

  • key: the option key
  • seconds: [number] the amount of time in seconds until the countdown expires
  • textOrIcon: Attach additional text to the countdown if passed a text string, attach a raid icon if passed a number [1-8] (optional)
  • startAt: [number] When to start sending messages in yell, default value is at 3 seconds remaining (optional)
  • englishText: [string] The text string to replace the message with if the user has enabled the option to only print messages in English (optional)

Misc

SimpleTimer (func, delay)

Trigger a function after a specific delay

Parameters:

  • func: callback function to trigger after the delay
  • delay: [number] how long to wait until triggering the function

Flash (key[, icon])

Flash the screen edges.

Parameters:

  • key: the option key
  • icon: the icon to pulse if PULSE is set (if nil, key is used) (optional)

PlaySound (key, sound[, voice[, player]])

Play a sound.

Parameters:

  • key: the option key
  • sound: [string] the sound to play
  • voice: [string] command to play when using a voice pack (optional)
  • player: either a string or a table of players to prevent playing a sound if ME_ONLY is enabled (optional)

PlayVictorySound ()

Request to play the victory sound.


PlaySoundFile (sound[, channel])

Play a sound file.

Parameters:

  • sound: Either a FileID (number), or the path to a sound file (string)
  • channel: [string] the channel the sound should play on, defaults to "Master" (optional)

Sync (msg[, extra])

Send an addon sync to other players.

Parameters:

  • msg: the sync message/prefix
  • extra: other optional value you want to send (optional)

Usage:

self:Sync("abilityPrefix", data)
self:Sync("ability")

AbbreviateNumber (amount)

Return a string as a formatted abbreviated number.

Parameters:

  • amount: [number] the number you wish to abbreviate

Returns:

  • string the formatted string e.g. 10M or 10K

Berserk (seconds[, noMessages[, customBoss[, customBerserk[, customFinalMessage[, customBarText]]]]])

Start a "berserk" bar, and optionally also show an engage message, and multiple reminder messages.

Parameters:

  • seconds: [number] the time before the boss enrages/berserks
  • noMessages: if any value, don't display an engage message. If set to 0, don't display any messages (optional)
  • customBoss: [string] set a custom boss name (optional)
  • customBerserk: [string] set a custom berserk name (and icon if a spell id), defaults to "Berserk" (optional)
  • customFinalMessage: [string] set a custom message to display when the berserk timer finishes (optional)
  • customBarText: [string] set a custom text to display on the Berserk bar (optional)

StopBerserk (barText[, customBoss[, customFinalMessage]])

Stop a "berserk" bar, and any related messages.

Parameters:

  • barText: [string] The text the bar is using
  • customBoss: [string] the text that was set as a custom boss name (optional)
  • customFinalMessage: [string] the text that was set for the final message (optional)

Clone this wiki locally