API/Boss Module
Base functions
mod:OnRegister()
This gets called when the boss module is registered with RW. It is in this function you register all alert objects, triggers and locale
Usage
function mod:OnRegister() L = mod:RegisterLocale(self:GetName(), "enUS", true) if L then L.name = "[Boss name]" end L = mod:GetLocale() self.L = L mod:SetTrigger([Mob ID or Yell-text) mod:SetWin() tRandomTimer = self:Timer(10, "A random timer" [, "Interface\\ICONS\\SomeIcon", optionText, default, color, endMessage]) end
mod:OnEngage(trigger)
Is called when this boss module is triggered. This is where you would init locals and such that is needed for the boss during fight. You can also start things like Berserk timer here. This is also where you set upp all the trackers to track spells and emotes
Parameters
- trigger
- Indicates what triggered this module to engage, if triggered by entering combat this will be the mob ID of the mod that triggered it, if triggered by a boss emote or yell this will be the text that triggered.
Usage
function mod:OnEngage(trigger) self:Track("Dominate", 71289) tBerserk:Start() self:SendMessage("RW_AddHealthFrame", ManaBarrierUpdate, L.mana_barrier) end
mod:OnEnd(wipe, trigger)
Called when the encounter ended, wipe or victory is indicated by wipe.
Parameters
- wipe
- true if it is a wipe, false if it was a victory
- trigger
- If the trigger was an emote or yell this will be the text, if it was triggered by the killing of mobs then it will contain "Mobs". If combat ended with just getting out of combat this will be null
mod:SetDelay(delay)
This will set a delay before the mod "gets out of combat" after initially engaged. This is useful for encounters where combat start with some kind of yell or so and the player don't actually get in combat until later, if it would not be set then the mod would end in 3s after engaged.
Parameters
- delay
- Time in seconds to delay the scanning for the end of the encounter
mod:SetTrigger(...)
Sets triggers that are used to track when an encounter starts. This can be either mob IDs or text string, strings are tracked via emotes and yells
mod:SetWin([...])
Sets the triggers that are used to determine when an encounter ends. This can be either mob IDs or text string, undefined result if mixed mob IDs and strings are sent in. Preferably only pass either mob ID(s) or one text string. If several mob IDs are passed then all of these mobs have to die before the end of the encounter is triggered.
Constants
mod.pName
Contains the player character name
mod.pClass
Contains non-localized english class name in upper case
Party functions
mod:GetPartyType()
- returns
- Current party type: "raid", "party" or "none"
mod:IsHeroic()
- returns
- true if heroic, else false
Target functions
These functions should be self explaining except for UIDFromRandom(), this takes either a gUID or uID.
mod:CUIDFromGUID(gUID)
mod:CUIDFromUID(uID)
mod:UIDFromCID(cID)
mod:UIDFromGUID(gUID)
mod:UIDFromName(name)
mod:UIDFromRandom(target)
Mob info functions
mod:GetBossTarget([cID])
Parameters
- cID
- optional, If passed it will get the target for the specified cID, else the it will return the target for the first mob set in mod:SetTrigger()
mod:GetBossHealth([cID])
Parameters
- cID
- optional, If passed it will return the current health of the specified cID, else it will return the current health of the first mob set in mod:SetTrigger()
Tracking functions
mod:Track(func, spellID [, ...])
This registers a function to be called when any of the spellIDs supplied is present in a combatllog event. When this function is called 2 parameters will be passed. First the event that triggered it. Second is a argumets table containing all the data from the combatlog event.
(sName, dName, sGUID, dGUID, spellID and so on. See CombatScanner.lua for the complete list of arguments.
Parameters
- func
- The function that should be called, it can either be a string or a function. If it is a string then it will call the function on your mod object.
e. g: func is "MadSpell" then it will call mod:MadSpell(event, args)
If it is a function then it will be calleded like: func(mod, event, args) - spellID
- This is the spell ID(s) that should be tracked for this tracker
Usage
mod:Track("MadSpell", 5356, 5357) function mod:MadSpell(event, args) -- Do something fancy when this spell is used by someone end
mod:YellTrack(func, msg [, ...})
This registers a function to be called when a mob does a yell or any kind of emote. When this function is called 3 parameters are passed. First the event (CHAT_MSG_MONSTER_YELL, CHAT_MSG_RAID_BOSS_EMOTE and so on), second is the actual message string that triggered it and third is the name of the mob that triggered it
Parameters
- func
- The function that should be called, it can either be a string or a function. If it is a string then it will call the function on your mod object.
e. g: func is "MadYell" then it will call mod:MadYell(event, msg, name)
If it is a function then it will be calleded like: func(mod, event, msg, name). - msg
- This is the message(s) that this tracker should track.
Usage
mod:TrackYell("MadYell", "Some random text", "more random text") function mod:MadSpell(event, msg, name) -- Do something when this message is triggered end
mod:DeathTrack(func, mobID [, ...])
Registers a function to be called when give mob(s) dies.
Parameters
- func
- The function that should be called, it can either be a string or a function. If it is a string then it will call the function on your mod object.
- mobID
- the mobID of the mobs death to be tracked.
Usage
mod:DeathTrack("SomeMobDies", 5366) function mod:SomeMobDied(mobID) -- Poor mob with mob ID mobID has died end
Scheduling
mod:Schedule(id, time, func [, ...])
This will schedule a func to run after the time specified, the function will be called with the optional parameters
Parameters
- id
- This id it used to track the schedule, it needs to be unique or it will overwrite other scheduled function
- time
- Sets how long to delay before calling the function
- func
- The function to be called, can either be a string or a function. If func is a string then it will be called on the boss module object (see Usage), else it will be called directly
- ...
- Optional parameters to supply to the function when its called
Usage
function mod:SomeFunc(arg1, arg2) end local function SomeOtherFunc(arg) end mod:Schedule("randomID", 10, "SomeFunc", "data1", "data2") -- This will call mod:SomeFunc() after 10s and the 2 strings "data1" and "data2" will be passed mod:Schedule("randomID2", 5, SomeOtherFunc, "someData") -- This will call SomeOtherFinc after 5s and pass "someData" as argument
mod:ScheduleRepeating(id, time, func [, now, ...])
This will schedule a repeating timer that gets repeatedly in an interval set by the time argument. See mod:Schedule
Parameters
- now
- Optional, makes the function get called right away and then start repeating, else it will not be called untill the timer expires the first time.
Usage
See mod:Schedule()
mod:Unschedule(id)
Unschedule a timer
Parameters
- id
- The id of the timer that should be unscheduled
mod:UnscheduleAll()
Unschedules all timers on this boss module
Options
The following functions can be used to add options for the encounter in the configuration UI manually. Note that creating alert objects will automatically add options for them. Use these only when you want to do something manually.
mod:AddCategory(...)
Adds categories in the order supplied. Mainly used only to set a specific order when you don't want to init alert objects in a specific order.
mod:AddSpellIOption(category, spellID [, ...])
This will add an option that have an icon with the icon of the spell(s). When hovered over the tooltip for the spell will show. When clicked a details window will pop up where you can set specific alert options for this spell.
Parameters
- category
- The category header. All options with the same category header will be grouped together.
- spellID, ...
- The spell(s) to add the option for
Comments