From a0dbb769d99b39f24a3b0e02f1a6079a6c2c95f3 Mon Sep 17 00:00:00 2001 From: Nap Nap Date: Fri, 11 Jun 2021 15:37:15 +0200 Subject: [PATCH] add role filters --- BLT/BLT.toc | 3 +- BLT/Backend.lua | 6 + BLT/Config.lua | 20 +- BLT/Cooldowns.lua | 111 +- BLT/Core.lua | 26 +- BLT/embeds.xml | 2 + ...elog-LibGroupTalents-1.0-3.3 Release 3.txt | 13 + .../LibGroupTalents-1.0.lua | 1727 +++++++++++++++++ .../LibGroupTalents-1.0.toc | 17 + BLT/libs/LibGroupTalents-1.0/lib.xml | 3 + BLT/locale/enUS.lua | 4 + 11 files changed, 1889 insertions(+), 43 deletions(-) create mode 100644 BLT/libs/LibGroupTalents-1.0/Changelog-LibGroupTalents-1.0-3.3 Release 3.txt create mode 100644 BLT/libs/LibGroupTalents-1.0/LibGroupTalents-1.0.lua create mode 100644 BLT/libs/LibGroupTalents-1.0/LibGroupTalents-1.0.toc create mode 100644 BLT/libs/LibGroupTalents-1.0/lib.xml diff --git a/BLT/BLT.toc b/BLT/BLT.toc index abe94e7..ce55b19 100644 --- a/BLT/BLT.toc +++ b/BLT/BLT.toc @@ -2,11 +2,12 @@ ## Title: BLT ## Notes: Tracks specific cooldowns of players in a raid/party ## Version: 1.3.2 -## OptionalDeps: Ace3, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets, LibDualSpec-1.0 +## OptionalDeps: Ace3, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets, LibTalentQuery-1.0, LibGroupTalents-1.0, LibDualSpec-1.0 ## SavedVariables: BLT_DB #@no-lib-strip@ embeds.xml +libs\LibTalentQuery-1.0\lib.xml #@end-no-lib-strip@ locale\enUS.lua diff --git a/BLT/Backend.lua b/BLT/Backend.lua index 31d3452..daee434 100644 --- a/BLT/Backend.lua +++ b/BLT/Backend.lua @@ -1,6 +1,7 @@ local BLT = LibStub("AceAddon-3.0"):NewAddon("BLT", "AceConsole-3.0", "AceTimer-3.0", "AceEvent-3.0") local L = LibStub("AceLocale-3.0"):GetLocale("BLT") local TalentQuery = LibStub:GetLibrary("LibTalentQuery-1.0") +local LibGroupTalents = LibStub("LibGroupTalents-1.0") local select, pairs, ipairs, next = _G.select, _G.pairs, _G.ipairs, _G.next local tinsert, tremove, tconcat, twipe = table.insert, table.remove, table.concat, table.wipe @@ -32,6 +33,7 @@ BLT.playerLevel = {} BLT.playerEquipment = {} BLT.playerTalentPoints = {} BLT.playerTalentsSpecced = {} +BLT.playerRole = {} BLT.playerGlyphs = {} BLT.specificTalents = { ["DEATHKNIGHT"] = { @@ -241,6 +243,8 @@ function BLT:TalentQuery_Ready(e, name, r, unitId) self.playerLevel[name] = unitTargetLevel self.playerTalentPoints[name] = x .. "/" .. y .. "/" .. z self.playerTalentsSpecced[name] = {} + self.playerRole[name] = LibGroupTalents:GetUnitRole(name) + if next(playerTalents) ~= nil then self.playerTalentsSpecced[name] = playerTalents end @@ -326,6 +330,7 @@ function BLT:ClearLists() clearList(self.playerTalentPoints) clearList(self.playerTalentsSpecced) clearList(self.playerEquipment) + clearList(self.playerRole) clearList(inspectedUnits) self:Print(L["All data cleared!"]) end @@ -338,5 +343,6 @@ function BLT:RemoveUnitFromTables(unit) self.playerTalentPoints[unitName] = nil self.playerTalentsSpecced[unitName] = nil self.playerEquipment[unitName] = nil + self.playerRole[unitName] = nil removeFirst(inspectedUnits,unitName) end diff --git a/BLT/Config.lua b/BLT/Config.lua index 8669fa4..276990f 100644 --- a/BLT/Config.lua +++ b/BLT/Config.lua @@ -168,7 +168,25 @@ BLT.options = { end end, order = 9 - } + }, + healerOnlyCD = { + type = "toggle", + name = L["Show only healer cooldowns"], + desc = L["Display healing cooldowns only for healers"], + get = get, + set = set, + width = "full", + order = 10 + }, + tankOnlyCD = { + type = "toggle", + name = L["Show only tank cooldowns"], + desc = L["Display defensive cooldowns only for tanks"], + get = get, + set = set, + width = "full", + order = 11 + }, } }, show = { diff --git a/BLT/Cooldowns.lua b/BLT/Cooldowns.lua index b7e7afd..2acda35 100644 --- a/BLT/Cooldowns.lua +++ b/BLT/Cooldowns.lua @@ -39,7 +39,8 @@ BLT.spells = { lvlReq = 55, tar = false, glyph = "nil", - glyphCd = 0 + glyphCd = 0, + role = "nil" }, -- Anti-Magic Shell [GetSpellInfo(48707)] = { @@ -53,7 +54,8 @@ BLT.spells = { lvlReq = 68, tar = false, glyph = "nil", - glyphCd = 0 + glyphCd = 0, + role = "nil" }, -- Icebound Fortitude [GetSpellInfo(48792)] = { @@ -67,7 +69,8 @@ BLT.spells = { lvlReq = 62, tar = false, glyph = "nil", - glyphCd = 0 + glyphCd = 0, + role = "nil" }, -- Vampiric Blood [GetSpellInfo(55233)] = { @@ -81,7 +84,8 @@ BLT.spells = { lvlReq = 55, tar = false, glyph = "nil", - glyphCd = 0 + glyphCd = 0, + role = "tank" }, -- Hysteria [GetSpellInfo(49016)] = { @@ -95,7 +99,8 @@ BLT.spells = { lvlReq = 55, tar = true, glyph = "nil", - glyphCd = 0 + glyphCd = 0, + role = "nil" } }, ["DRUID"] = { @@ -111,7 +116,8 @@ BLT.spells = { lvlReq = 44, tar = false, glyph = "nil", - glyphCd = 0 + glyphCd = 0, + role = "tank" }, -- Innervate [GetSpellInfo(29166)] = { @@ -125,7 +131,8 @@ BLT.spells = { lvlReq = 40, tar = true, glyph = "nil", - glyphCd = 0 + glyphCd = 0, + role = "nil" }, -- Rebirth [GetSpellInfo(48477)] = { @@ -139,7 +146,8 @@ BLT.spells = { lvlReq = 20, tar = true, glyph = "nil", - glyphCd = 0 + glyphCd = 0, + role = "nil" }, -- Survival Instincts [GetSpellInfo(61336)] = { @@ -153,7 +161,8 @@ BLT.spells = { lvlReq = 20, tar = false, glyph = "nil", - glyphCd = 0 + glyphCd = 0, + role = "tank" }, -- Tranquility [GetSpellInfo(26983)] = { @@ -167,7 +176,8 @@ BLT.spells = { lvlReq = 30, tar = false, glyph = "nil", - glyphCd = 0 + glyphCd = 0, + role = "healer" } }, ["HUNTER"] = { @@ -183,7 +193,8 @@ BLT.spells = { lvlReq = 70, tar = true, glyph = "nil", - glyphCd = 0 + glyphCd = 0, + role = "nil" } }, ["MAGE"] = { @@ -199,7 +210,8 @@ BLT.spells = { lvlReq = 30, tar = false, glyph = "nil", - glyphCd = 0 + glyphCd = 0, + role = "nil" } }, ["PALADIN"] = { @@ -215,7 +227,8 @@ BLT.spells = { lvlReq = 40, tar = false, glyph = "nil", - glyphCd = 0 + glyphCd = 0, + role = "nil" }, -- Aura Mastery [GetSpellInfo(31821)] = { @@ -229,7 +242,8 @@ BLT.spells = { lvlReq = 20, tar = false, glyph = "nil", - glyphCd = 0 + glyphCd = 0, + role = "nil" }, -- Divine Protection [GetSpellInfo(498)] = { @@ -243,7 +257,8 @@ BLT.spells = { lvlReq = 6, tar = false, glyph = "nil", - glyphCd = 0 + glyphCd = 0, + role = "tank" }, -- Divine Sacrifice [GetSpellInfo(64205)] = { @@ -257,7 +272,8 @@ BLT.spells = { lvlReq = 20, tar = false, glyph = "nil", - glyphCd = 0 + glyphCd = 0, + role = "nil" }, -- Divine Shield [GetSpellInfo(642)] = { @@ -271,7 +287,8 @@ BLT.spells = { lvlReq = 34, tar = false, glyph = "nil", - glyphCd = 0 + glyphCd = 0, + role = "nil" }, -- Hand of Freedom [GetSpellInfo(1044)] = { @@ -285,7 +302,8 @@ BLT.spells = { lvlReq = 18, tar = true, glyph = "nil", - glyphCd = 0 + glyphCd = 0, + role = "nil" }, -- Hand of Protection [GetSpellInfo(10278)] = { @@ -299,7 +317,8 @@ BLT.spells = { lvlReq = 10, tar = true, glyph = "nil", - glyphCd = 0 + glyphCd = 0, + role = "nil" }, -- Hand of Sacrifice [GetSpellInfo(6940)] = { @@ -313,7 +332,8 @@ BLT.spells = { lvlReq = 46, tar = true, glyph = "nil", - glyphCd = 0 + glyphCd = 0, + role = "nil" }, -- Hand of Salvation [GetSpellInfo(1038)] = { @@ -327,7 +347,8 @@ BLT.spells = { lvlReq = 26, tar = true, glyph = "nil", - glyphCd = 0 + glyphCd = 0, + role = "nil" }, -- Lay on Hands [GetSpellInfo(48788)] = { @@ -341,7 +362,8 @@ BLT.spells = { lvlReq = 10, tar = true, glyph = GetGlyphName[48788], - glyphCd = 300 + glyphCd = 300, + role = "nil" } }, ["PRIEST"] = { @@ -357,7 +379,8 @@ BLT.spells = { lvlReq = 80, tar = false, glyph = "nil", - glyphCd = 0 + glyphCd = 0, + role = "healer" }, -- Fear Ward [GetSpellInfo(6346)] = { @@ -371,7 +394,8 @@ BLT.spells = { lvlReq = 20, tar = true, glyph = GetGlyphName[6346], - glyphCd = 60 + glyphCd = 60, + role = "nil" }, -- Dispersion [GetSpellInfo(47585)] = { @@ -385,7 +409,8 @@ BLT.spells = { lvlReq = 60, tar = true, glyph = GetGlyphName[47585], - glyphCd = 45 + glyphCd = 45, + role = "nil" }, -- Guardian Spirit [GetSpellInfo(47788)] = { @@ -399,7 +424,8 @@ BLT.spells = { lvlReq = 60, tar = true, glyph = GetGlyphName[47788], - glyphCd = 0 + glyphCd = 0, + role = "healer" }, -- Hymn of Hope [GetSpellInfo(64901)] = { @@ -413,7 +439,8 @@ BLT.spells = { lvlReq = 80, tar = false, glyph = "nil", - glyphCd = 0 + glyphCd = 0, + role = "nil" }, -- Pain Suppression [GetSpellInfo(33206)] = { @@ -427,7 +454,8 @@ BLT.spells = { lvlReq = 50, tar = true, glyph = "nil", - glyphCd = 0 + glyphCd = 0, + role = "healer" }, -- Power Infusion [GetSpellInfo(10060)] = { @@ -441,7 +469,8 @@ BLT.spells = { lvlReq = 40, tar = true, glyph = "nil", - glyphCd = 0 + glyphCd = 0, + role = "healer" } }, ["ROGUE"] = { @@ -457,7 +486,8 @@ BLT.spells = { lvlReq = 75, tar = true, glyph = GetGlyphName[57934], - glyphCd = 0 + glyphCd = 0, + role = "nil" } }, ["SHAMAN"] = { @@ -473,7 +503,8 @@ BLT.spells = { lvlReq = 70, tar = false, glyph = "nil", - glyphCd = 0 + glyphCd = 0, + role = "nil" }, -- Mana Tide Totem [GetSpellInfo(16190)] = { @@ -487,7 +518,8 @@ BLT.spells = { lvlReq = 40, tar = false, glyph = "nil", - glyphCd = 0 + glyphCd = 0, + role = "nil" }, -- Reincarnation [GetSpellInfo(20608)] = { @@ -501,7 +533,8 @@ BLT.spells = { lvlReq = 30, tar = false, glyph = "nil", - glyphCd = 0 + glyphCd = 0, + role = "nil" } }, ["WARLOCK"] = { @@ -517,7 +550,8 @@ BLT.spells = { lvlReq = 66, tar = false, glyph = "nil", - glyphCd = 0 + glyphCd = 0, + role = "nil" }, -- Soulstone Resurrection [GetSpellInfo(47883)] = { @@ -531,7 +565,8 @@ BLT.spells = { lvlReq = 18, tar = true, glyph = "nil", - glyphCd = 0 + glyphCd = 0, + role = "nil" } }, ["WARRIOR"] = { @@ -547,7 +582,8 @@ BLT.spells = { lvlReq = 20, tar = false, glyph = GetGlyphName[12975], - glyphCd = 60 + glyphCd = 60, + role = "tank" }, -- Shield Wall [GetSpellInfo(871)] = { @@ -561,7 +597,8 @@ BLT.spells = { lvlReq = 28, tar = false, glyph = GetGlyphName[871], - glyphCd = 120 + glyphCd = 120, + role = "tank" } } } diff --git a/BLT/Core.lua b/BLT/Core.lua index 6c5cda2..c7a2e07 100644 --- a/BLT/Core.lua +++ b/BLT/Core.lua @@ -102,6 +102,7 @@ local trackItemCooldowns = {} local trackLvlRequirement = {} local trackGlyphs = {} local trackGlyphCooldown = {} +local trackRole = {} local trackCooldownTargets = {} local trackCooldownAllUniqueSpellNames = {} local trackCooldownAllUniqueSpellEnabledStatuses = {} @@ -641,7 +642,7 @@ end function BLT:OnEnable() for k in pairs(self.spells) do for k2,v in pairs(self.spells[k]) do - self:AddTrackCooldownSpell(v.nr, k, v.spec, k2, v.id, v.cd, v.talent, v.talReq, v.altCd, v.lvlReq, v.tar, v.glyph, v.glyphCd) + self:AddTrackCooldownSpell(v.nr, k, v.spec, k2, v.id, v.cd, v.talent, v.talReq, v.altCd, v.lvlReq, v.tar, v.glyph, v.glyphCd, v.role) end end for k in pairs(self.items) do @@ -699,7 +700,7 @@ function BLT:ShowConfig() InterfaceOptionsFrame_OpenToCategory(self.optionsFrames.BLT) end -function BLT:AddTrackCooldownSpell(nr, class, spec, spellName, spellId, maxCd, talent, talReq, altCd, lvlReq, tar, glyph, glyphCd) +function BLT:AddTrackCooldownSpell(nr, class, spec, spellName, spellId, maxCd, talent, talReq, altCd, lvlReq, tar, glyph, glyphCd, role) tinsert(sortNr, nr) tinsert(trackCooldownClasses, class) tinsert(trackCooldownSpecs, spec) @@ -713,6 +714,7 @@ function BLT:AddTrackCooldownSpell(nr, class, spec, spellName, spellId, maxCd, t tinsert(trackCooldownTargets, tar) tinsert(trackGlyphs, glyph) tinsert(trackGlyphCooldown, glyphCd) + tinsert(trackRole, role) if not contains(trackCooldownAllUniqueSpellNames, spellName) then tinsert(trackCooldownAllUniqueSpellNames, spellName) @@ -1401,15 +1403,31 @@ function BLT:IsPlayerValidForSpellCooldown(player, index) if self.playerSpecs[player] and self.playerLevel[player] >= trackLvlRequirement[index] then if trackCooldownSpecs[index] == self.playerSpecs[player] or trackCooldownSpecs[index] == "Any" then if trackTalents[index] == "nil" or (trackTalents[index] ~= "nil" and talentRequired[index] == false) then - return true + return BLT:IsPlayerRoleValidForSpellCooldown(player, index) elseif self.playerTalentsSpecced[player] and contains(self.playerTalentsSpecced[player], trackTalents[index], true) then - return true + return BLT:IsPlayerRoleValidForSpellCooldown(player, index) end end end return false end +function BLT:IsPlayerRoleValidForSpellCooldown(player, index) + local thisPlayerRole = self.playerRole[player] + + if trackRole[index] == "nil" or not thisPlayerRole or thisPlayerRole == "nil" then return true end + if thisPlayerRole == trackRole[index] then return true end + if thisPlayerRole == "melee" or thisPlayerRole == "caster" then + if not db.healerOnlyCD and trackRole[index] == "healer" then + return true + end + if not db.tankOnlyCD and trackRole[index] == "tank" then + return true + end + end + return false +end + function BLT:IsPlayerValidForItemCooldown(player, index) if self.playerEquipment[player] and contains(self.playerEquipment[player], trackItems[index]) then return true diff --git a/BLT/embeds.xml b/BLT/embeds.xml index d5653df..287dd9d 100644 --- a/BLT/embeds.xml +++ b/BLT/embeds.xml @@ -13,6 +13,8 @@