» API Documentation
- 1 The Boss Mod Constructor
- 2 Attributes
- 3 Boss Mod Methods
- 3.1 AddOption
- 3.2 RegisterCombat
- 3.3 RegisterEvents
- 3.4 AddMsg
- 3.5 Announce
- 3.6 AddSpecialWarning
- 3.7 SendHiddenWhisper
- 3.8 Schedule
- 3.9 ScheduleEvent
- 3.10 ScheduleAnnounce
- 3.11 ScheduleMethod
- 3.12 UnSchedule
- 3.13 SetIcon
- 3.14 RemoveIcon
- 3.15 StartStatusBarTimer
- 3.16 UpdateStatusBarTimer
- 3.17 GetStatusBarTimerTimeLeft
- 3.18 EndStatusBarTimer
- 3.19 SendSync
The Boss Mod Constructor
Creates a new boss mod object.
Arguments
- (ID, name, description, zone, guiTab, guiSort)
- ID
- String, needs to be unique and must not contain space characters.
- name
- String, the boss mod's name to use in the GUI.
- description
- String, the boss mod's description to show in the GUI.
- zone
- String, the zone in which the boss mod will receive events. Use DBM_OTHER if you want to enable your boss mod in all zones.
- guiTab
- String, identifier for the GUI Tab.
- guiSort
- Number, used to sort the boss mods in the GUI.
Returns
- BossMod
- A pointer to the created boss mod
Tip
You can always use DBM:GetMod("ID") to get a pointer to the boss mod with the identifier "ID".
Example
Creates a new boss mod for the Twin Emperors in Ahn'Qiraj.
Attributes
Version
- Version
- String or number, will be used for the smart announce management, the player with the latest version of a boss mod will be the announcer if more players in your raid have announce enabled.
Author
- Author
- String, shown in the GUI.
Abbreviation
BossMod.Abbreviation2 = "slash command 2";
- Slash command i
- Strings, abbreviations used for short slash commands, default slash command is the mod's name without spaces.
Slash Command Help
- Help text
- Table, contains strings which will be displayed after the default slash command text for the mod.
Update Interval
- UpdateInterval
- Number, time between BossMod:OnUpdate() calls.
Sync Version
- Version
- Number, minimum DBM (_not_ the boss mod's version!) version to accept sync commands from for this boss mod. Use it if older versions have bad timers.
Extra GUI Tab
- GUITab
- String, the ID of another GUI tab in which your mod will be displayed. Useful for mods which should be available for both BC and WoW classic.
Boss Mod Methods
AddOption
Adds an option for the boss mod, the value will be saved in the API's saved variables file.
Arguments
- (name, defaultValue, guiText, function)
- name
- String, the options table index to access it by using BossMod.Options[name].
- defaultValue
- Boolean, the default value for the option.
- guiText
- String, the text to use in the dropdown menu. There will be no dropdown menu entry if guiText is nil.
- function
- Function, the function to execute when the button is clicked. Default = DBM:GetMod(ID).Options[name] = not DBM:GetMod(ID).Options[name].
- dropdownAttributes
- Table, additional attributes for the dropdown button. Example: You can set this to {tooltipTitle = "Tooltip", tooltipText = "Hello, I'm a tooltip :)"} if you want a tooltip for your option.
Example
Adds a dropdown menu button to toggle the bug explode warning.
RegisterCombat
Registers the boss mod for the combat detection system. Executing this method once is required to use the BossMod:OnCombatStart(delay); and BossMod:OnCombatEnd(); methods and the BossMod.InCombat attribute. It's also required for other combat related features like auto responding to whispers during combat, etc.
Arguments
- (startMethod, delay or trigger, bossName, displayName, killName, minCombatTime)
- startMethod
- String, can be "YELL", "EMOTE" or "COMBAT"
- delay or trigger
- Number for startMethod = "COMBAT", used as delay in seconds to check if the boss is in combat. Default = 5.
- String or table for startMethod = "YELL" or "EMOTE", contains the exact text of the yell or emote that is used to detect the pull. Use a table like this {"yell 1", "yell 2"} for bosses that have more than one yell/emote.
- bossName
- String, the name of the boss. The boss mod's name is used as default value.
- displayName
- String, the name to show in the "Boss pulled!" and "Boss down!" messages.
- killName
- String or table, the boss to kill to trigger the combat end event. Use a table like this {"boss1", "boss2"} for encounters with more than one boss (e.g. Four Horsemen).
- minCombatTime
- Number, minimum time before checking for combat end, use it for bosses where you are out of combat for more than 10 seconds after the combat initiating event. (e.g. Kel'Thuzad).
Examples
Registers the Four Horsemen boss mod's :OnCombatStart() and :OnCombatEnd() functions.
Registers the Maexxna boss mod's OnCombatStart() and OnCombatEnd() functions. We don't need to give the name because the boss mod's name (which is also Maexxna) will be used as default and a delay of 5 seconds is fine for this encounter.
Registers Kel'Thuzad's yell, names aren't needed but a minimum combat time is needed because you are out of combat in the first ~30 seconds.
RegisterEvents
Registers one or more events which will be received by the BossMod:OnEvent(event, arg1) method. You can also register COMBAT_LOG_EVENT_UNFILTERED subevents. See combat log events for details.
Arguments
- (events)
- events
- String, one or more events to register.
AddMsg
Prints a message to the default chat frame.
Arguments
- (msg, prefix)
- msg
- String, the message.
- prefix
- String, the prefix. Default = the boss mod's name.
Announce
Broadcasts a message to the raid, using Blizzard's raid warning chat.
Arguments
- (msg, color, local)
- msg
- String, the message.
- color
- Number (1-4), color. (color 1, color 2, color 3, color 4)
- local
- Boolean, message will only be shown local if true. Default = false.
Tip
Use ">" and "<" to mark player names to color them! E.g.: ("Evil Debuff on >%s<"):format(target)
AddSpecialWarning
Adds a huge blue message in the middle of the screen and fires special events to get the user's attention.
Arguments
- (msg, flash, shake)
- msg
- String, the message.
- flash
- Boolean, show flash effect if enabled. Default = true.
- shake
- Boolean, show shake effect if enabled. Default = true.
SendHiddenWhisper
Sends a hidden whisper message.
Arguments
- (msg, player)
- msg
- String, the message.
- player
- String, the player who receives the whisper message.
Schedule
Schedules a function to be called after a given time.
Arguments
- (time, function, ...)
- timer
- Number, used as timer.
- function
- String or function, the function to call.
- ...
- Anything, will be passed as arguments to function.
ScheduleEvent
Schedules the boss mod's OnEvent() method to be called after a given time with the given arguments.
Arguments
- (time, ...)
- timer
- Number, used as timer.
- ...
- Anything, will be passed as arguments to :OnEvent().
ScheduleAnnounce
Schedules an announce.
Arguments
- (time, msg, color)
- timer
- Number, used as timer.
- msg
- String, see :Announce()
- color
- Number, see :Announce()
- local
- Boolean, see :Announce()
ScheduleMethod
Schedules an announce.
Arguments
- (time, method, ...)
- timer
- Number, used as timer.
- method
- String, the method to call. (--> method = "Announce" would have the same effect as calling :ScheduleAnnounce())
- ...
- Anything, will be passed as arguments to :method().
UnSchedule
Unschedules a scheduled function, can unschedule more than one scheduled task with one call.
Arguments
- (function, ...)
- function
- String or function, the function to unschedule.
- ...
- Anything, arguments of the scheduled function. (optional, see example!)
Tip
You can use :UnScheduleEvent(), :UnScheduleAnnounce() and :UnScheduleMethod() to unschedule scheduled announces, all of these methods receive the same arguments (except the timer) as the :ScheduleX() methods.
Example
self:ScheduleMethod(10, "Foo", 1, 2, 3)
self:ScheduleMethod(10, "Foo", 1, 2, 3)
self:ScheduleMethod(10, "Foo", 1, "a", 3)
self:UnScheduleMethod("Foo") -- will unschedule all 3 tasks
self:UnScheduleMethod("Foo", 1) -- will unschedule all 3 tasks
self:UnScheduleMethod("Foo", 1, 2) -- will unschedule the first 2 tasks
self:UnSchedule(self.Foo, self, 1, "a") -- will unschedule the 3rd task
SetIcon
Sets an icon that will be removed after a specific time.
Arguments
- (target, [time, icon])
- target
- String, name of a raid member.
- time
- Number, the icon will be removed after time seconds if set.
- icon
- Number, icon ID. (default = 8 (Skull))
RemoveIcon
Removes an icon from a raid member.
Arguments
- (target, [time, icon])
- target
- String, name of a raid member.
StartStatusBarTimer
Starts a status bar timer, the name is used as an ID for synchronization. See localizing bars for localization information.
Arguments
- (timer, name, icon, noBroadcast, repetitions, colorR, colorG, colorB, colorA)
- timer
- Number, the timer.
- name
- String, the text of the bar and the synchronization ID.
- icon
- String, path to a texture.
- noBroadcast
- Boolean, set this to true if you don't want to sync this timer with other clients.
- repetitions
- Number, the timer will be repeated <x> times.
- colorR
- Number (0-1), use this to overwrite the user's custom color.
- colorG
- Number (0-1), use this to overwrite the user's custom color.
- colorB
- Number (0-1), use this to overwrite the user's custom color.
- colorA
- Number (0-1), use this to overwrite the user's custom bar transparency.
Localizing Bars
You may never use a localized name to start a status bar timer, because the default name is also used as an ID. You can use the status bar localization table DBM_SBT to localize your bars. Just use the bar's default name/ID as index and the localized name as value:
Now start a status bar timer with the name/id "my status bar", it will be displayed as "my localized status bar". You can also localize bars with dynamic names:
DBM_SBT["bossModID"] = {
[1] = {
[1] = "(%w+) (%d+)",
[2] = "%2 %1",
},
}Timer that have names like "text 1000" will now be shown as "1000 text". The two fields in the table will be passed to string.gsub.
UpdateStatusBarTimer
Updates a status bar timer, this function can change its name, time and elapsed time. All arguments are optional, so if you can set them to nil, if you don't want to change them.
Arguments
- (name, elapsed, timer, newName, noBroadcast)
- name
- String, the name of the timer to update.
- elapsed
- Number, the new elapsed time since timer start.
- timer
- Number, the new timer after which the status bar timer expires.
- newName
- String, the new name of the timer.
- newIcon
- String, the new icon.
- noBroadcast
- Boolean, set this to true if you don't want to sync this update event with your raid group.
GetStatusBarTimerTimeLeft
Returns the time left and the elapsed time of a status bar timer.
Arguments
- (name)
- name
- String, the name of the timer.
Returns
- timeLeft
- Number, the time left.
- timeElapsed
- Number, the elapsed time since the timer was started.
EndStatusBarTimer
Ends a status bar timer.
Arguments
- (name, noBroadcast)
- name
- String, the name of the timer.
- noBroadcast
- Boolean, set this to true if you don't want to sync this with your raid group.
SendSync
Sends a sync message. Incoming sync messages will call the boss mod's :OnSync() method.
Arguments
- (msg)
- msg
- String, the message to send.