Module DRList-1.0
DRList-1.0
Functions
Lib:GetSpells () | Get table of all spells that DRs. |
Lib:GetCategories () | Get table of all DR categories. |
Lib:GetPvECategories () | Get table of all categories that DRs in PvE. |
Lib:GetResetTime ([category="default"]) | Get the default DR reset time value or a category specific reset time. |
Lib:GetCategoryBySpellID (spellID) | Get DR category by spellID. |
Lib:GetCategoryLocalization (category) | Get localized category name. |
Lib:IsPvECategory (category) | Check if a category has DR against mobs. |
Lib:GetNextDR (diminished[, category="default"]) | Get a specific diminished duration value. |
Lib:NextDR (duration[, category="default"]) | Get the next successive diminished duration value. |
Lib:IterateSpellsByCategory (category) | Iterate through the spells of a given category. |
Tables
categoryNames.retail | |
categoryNames.classic | |
categoryNames.tbc | |
categoryNames.wotlk | |
categoryNames.cata |
Functions
- Lib:GetSpells ()
-
Get table of all spells that DRs.
Key is the spellID, and value is the unlocalized DR category string.
Value is instead a table of strings for spells that have shared DRs.
Tables are read-only. Copy them if you need to modify data.
Returns:
-
table
{number=string|table}
See also:
- Lib:GetCategories ()
-
Get table of all DR categories.
Key is unlocalized name used for API functions, value is localized name used for UI.
Tables are read-only. Copy them if you need to modify data.
Note: You might want to ignore the 'taunt' category if your addon only track player DRs.
Returns:
-
table
{string=string}
- Lib:GetPvECategories ()
-
Get table of all categories that DRs in PvE.
Key is unlocalized name used for API functions, value is localized name used for UI.
Tables are read-only. Copy them if you need to modify data.
Note that for retail some special mobs have DR on all categories, you need to check for this yourself;
see UnitClassification() and UnitIsQuestBoss(). Player pets have DR on all categories.
Returns:
-
table
{string=string}
- Lib:GetResetTime ([category="default"])
-
Get the default DR reset time value or a category specific reset time.
Passing in the category is now recommended as reset times may differ between categories.
Parameters:
- category string Unlocalized category name, or "npc" for PvE timer. (default "default")
Returns:
-
number
Reset time in seconds
Usage:
local expirationTime = GetTime() + DRList:GetResetTime("stun") -- Compare against GetTime() later on
C_Timer.After(DRList:GetResetTime("stun"), function() print("DR finished") end)
- Lib:GetCategoryBySpellID (spellID)
-
Get DR category by spellID.
This is the main checker for if a spell/debuff has a DR. See wiki for example usage.
Parameters:
- spellID number Debuff spellId
Returns:
- optional string The unlocalized category name.
- optional {string,...} Read-only array with multiple categories if spellID has any shared DR categories. (Note: array includes main category too)
- Lib:GetCategoryLocalization (category)
-
Get localized category name.
Parameters:
- category string Unlocalized category name
Returns:
-
string or nil
The localized category name
- Lib:IsPvECategory (category)
-
Check if a category has DR against mobs.
Note that for retail some special mobs have DR on all categories, you need to check for this yourself;
see UnitClassification() and UnitIsQuestBoss(). Player pets have DR on all categories.
Parameters:
- category string Unlocalized category name
Returns:
-
bool
- Lib:GetNextDR (diminished[, category="default"])
-
Get a specific diminished duration value.
Passing in the category is now recommended as diminished durations may differ between categories.
Any unknown categories (unless omitted/nil) will always return 0 as value here unlike NextDR().
Parameters:
- diminished number How many times the DR has been applied so far
- category string Unlocalized category name (default "default")
Returns:
-
number
Diminished duration value or 0 for invalid arguments
Usage:
local duration = DRList:GetNextDR(1, "stun") -- 0.50 (half aura duration)
local duration = DRList:GetNextDR(2, "stun") -- 0.25 (quarter aura duration)
local duration = DRList:GetNextDR(3, "stun") -- 0.00 (zero aura duration / immune)
local duration = DRList:GetNextDR(1, "knockback") -- 0.00 (immediately immune)
- Lib:NextDR (duration[, category="default"])
-
Get the next successive diminished duration value.
Same as the DRData-1.0 version. Passing in the category is now recommended as diminished durations may differ between categories.
Parameters:
- duration number The current diminished duration value. Throws error if not a number.
- category string Unlocalized category name (default "default")
Returns:
-
number
Diminished duration value
Usage:
local duration = DRList:NextDR(0.50) -- returns 0.25 (quarter aura duration)
local duration = 1.0 -- initial full aura duration duration = DRList:NextDR(duration, "stun") -- 0.50 (half aura duration) duration = DRList:NextDR(duration, "stun") -- 0.25 (quarter aura duration) duration = DRList:NextDR(duration, "stun") -- 0.00 (zero aura duration / immune)
- Lib:IterateSpellsByCategory (category)
-
Iterate through the spells of a given category.
Pass nil to iterate through all spells instead.
Note: In classic this also iterates through every single spell rank. Check the spell names if you dont want duplicates.
Parameters:
- category string or nil Unlocalized category name
Returns:
-
Iterator function
Usage:
for spellID, category in DRList:IterateSpellsByCategory("root") do print(spellID) end
Tables
- categoryNames.retail
-
Fields:
- [disorient]
- [incapacitate]
- [silence]
- [stun]
- [root]
- [disarm]
- [taunt]
- [knockback]
- categoryNames.classic
-
Fields:
- [incapacitate]
- [stun]
- [root]
- [random_stun]
- [random_root]
- [fear]
- [mind_control]
- [frost_shock]
- [kidney_shot]
- categoryNames.tbc
-
Fields:
- [disorient]
- [incapacitate]
- [stun]
- [random_stun]
- [random_root]
- [root]
- [disarm]
- [fear]
- [scatter]
- [mind_control]
- [kidney_shot]
- [death_coil]
- [unstable_affliction]
- [chastise]
- [counterattack]
- categoryNames.wotlk
-
Fields:
- [incapacitate]
- [stun]
- [random_stun]
- [random_root]
- [root]
- [disarm]
- [fear]
- [scatter]
- [silence]
- [horror]
- [mind_control]
- [cyclone]
- [charge]
- [opener_stun]
- [counterattack]
- [taunt]
- categoryNames.cata
-
Fields:
- [incapacitate]
- [stun]
- [random_stun]
- [random_root]
- [root]
- [disarm]
- [fear]
- [scatter]
- [silence]
- [horror]
- [mind_control]
- [cyclone]
- [counterattack]
- [bind_elemental]
- [deep_freeze_rof]
- [taunt]