Skip to content

Commit e99f54a

Browse files
committed
Fixes #137, reimplement "dispel" wildcard without using isRaid flag
Instead of using the auradata.isRaid flag to know if an aura is dispellable by a player or not, we can use LibDispel to query the player's dispel types.
1 parent 8b32969 commit e99f54a

File tree

3 files changed

+26
-44
lines changed

3 files changed

+26
-44
lines changed

Globals.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ EnhancedRaidFrames.POSITIONS[9] = L["Bottom-Right"]
4444

4545
-- Declare Global iconCache table with pre-populated values
4646
EnhancedRaidFrames.iconCache = {}
47-
EnhancedRaidFrames.iconCache["poison"] = 132104
48-
EnhancedRaidFrames.iconCache["disease"] = 132099
49-
EnhancedRaidFrames.iconCache["curse"] = 132095
50-
EnhancedRaidFrames.iconCache["magic"] = 135894
51-
EnhancedRaidFrames.iconCache["bleed"] = 136168
47+
EnhancedRaidFrames.iconCache["Poison"] = 132104
48+
EnhancedRaidFrames.iconCache["Disease"] = 132099
49+
EnhancedRaidFrames.iconCache["Curse"] = 132095
50+
EnhancedRaidFrames.iconCache["Magic"] = 135894
51+
EnhancedRaidFrames.iconCache["Bleed"] = 136168

Modules/AuraIndicators.lua

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ local EnhancedRaidFrames = _G.EnhancedRaidFrames
88

99
-- Import libraries
1010
local LibSharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0")
11+
local LibDispel = LibStub("LibDispel-1.0")
1112

1213
-------------------------------------------------------------------------
1314
-------------------------------------------------------------------------
@@ -271,10 +272,10 @@ function EnhancedRaidFrames:FindActiveAndTrackedAura(indicatorFrame)
271272
if aura.name == auraIdentifier
272273
-- Check if the aura is a spellId and the spellId matches our auraString
273274
or (tonumber(auraIdentifier) and aura.spellId == tonumber(auraIdentifier))
274-
-- Check if the aura is a debuff, if it matches the "RAID" filter, and the auraString matches the "dispel" wildcard
275-
or (aura.isHarmful and aura.isRaid and "dispel" == auraIdentifier)
275+
-- Check if the aura is a debuff, if the auraString matches the "dispel" wildcard, and if the player can dispel this type
276+
or (aura.isHarmful and "dispel" == auraIdentifier and LibDispel:GetMyDispelTypes()[aura.dispelName])
276277
-- Check if the aura is a debuff and if the auraString matches one of the debuff type wildcards
277-
or (aura.isHarmful and aura.dispelName == auraIdentifier) then
278+
or (aura.isHarmful and aura.dispelName:lower() == auraIdentifier) then
278279

279280
-- Check if we should only show our own auras
280281
if not self.db.profile["indicator-" .. i].mineOnly
@@ -501,19 +502,19 @@ function EnhancedRaidFrames:UpdateIndicatorColor(indicatorFrame, remainingTime)
501502

502503
-- Set the color by debuff type
503504
if self.db.profile["indicator-" .. i].colorIndicatorByDebuff and thisAura.isHarmful and thisAura.dispelName then
504-
if thisAura.dispelName == "poison" then
505+
if thisAura.dispelName == "Poison" then
505506
indicatorFrame.Icon:SetColorTexture(self.GREEN_COLOR:GetRGB())
506507
return
507-
elseif thisAura.dispelName == "curse" then
508+
elseif thisAura.dispelName == "Curse" then
508509
indicatorFrame.Icon:SetColorTexture(self.PURPLE_COLOR:GetRGB())
509510
return
510-
elseif thisAura.dispelName == "disease" then
511+
elseif thisAura.dispelName == "Disease" then
511512
indicatorFrame.Icon:SetColorTexture(self.BROWN_COLOR:GetRGB())
512513
return
513-
elseif thisAura.dispelName == "magic" then
514+
elseif thisAura.dispelName == "Magic" then
514515
indicatorFrame.Icon:SetColorTexture(self.BLUE_COLOR:GetRGB())
515516
return
516-
elseif thisAura.dispelName == "bleed" then
517+
elseif thisAura.dispelName == "Bleed" then
517518
indicatorFrame.Icon:SetColorTexture(self.PINK_COLOR:GetRGB())
518519
return
519520
end
@@ -548,19 +549,19 @@ function EnhancedRaidFrames:UpdateCountdownTextColor(indicatorFrame, remainingTi
548549

549550
-- Set the color by debuff type
550551
if self.db.profile["indicator-" .. i].colorTextByDebuff and thisAura.isHarmful and thisAura.dispelName then
551-
if thisAura.dispelName == "poison" then
552+
if thisAura.dispelName == "Poison" then
552553
indicatorFrame.Countdown:SetTextColor(self.GREEN_COLOR:GetRGB())
553554
return
554-
elseif thisAura.dispelName == "curse" then
555+
elseif thisAura.dispelName == "Curse" then
555556
indicatorFrame.Countdown:SetTextColor(self.PURPLE_COLOR:GetRGB())
556557
return
557-
elseif thisAura.dispelName == "disease" then
558+
elseif thisAura.dispelName == "Disease" then
558559
indicatorFrame.Countdown:SetTextColor(self.BROWN_COLOR:GetRGB())
559560
return
560-
elseif thisAura.dispelName == "magic" then
561+
elseif thisAura.dispelName == "Magic" then
561562
indicatorFrame.Countdown:SetTextColor(self.BLUE_COLOR:GetRGB())
562563
return
563-
elseif thisAura.dispelName == "bleed" then
564+
elseif thisAura.dispelName == "Bleed" then
564565
indicatorFrame.Countdown:SetTextColor(self.PINK_COLOR:GetRGB())
565566
return
566567
end
@@ -618,12 +619,8 @@ function EnhancedRaidFrames:Tooltip_OnEnter(indicatorFrame, parentFrame)
618619
GameTooltip:SetUnitDebuffByAuraInstanceID(parentFrame.unit, thisAura.auraInstanceID)
619620
elseif thisAura.auraIndex then
620621
-- The legacy way to set the tooltip for an aura
621-
if thisAura.isRaid then
622-
-- This is a raid debuff (aka dispellable), it uses a different UnitAura filter
623-
GameTooltip:SetUnitAura(parentFrame.unit, thisAura.auraIndex, "RAID|HARMFUL")
624-
else
625-
GameTooltip:SetUnitAura(parentFrame.unit, thisAura.auraIndex, "HARMFUL")
626-
end
622+
GameTooltip:SetUnitAura(parentFrame.unit, thisAura.auraIndex, "HARMFUL")
623+
627624
end
628625
end
629626
else

Modules/AuraListeners.lua

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -165,16 +165,9 @@ end
165165
function EnhancedRaidFrames:addToAuraTable(parentFrame, auraData)
166166
-- Inject bleed debuff types into our auraData, courtesy of LibDispel
167167
if not self.isWoWClassicEra and not self.isWoWClassic then
168-
-- Get our list of bleeds from LibDispel
169-
local bleedList = LibDispel:GetBleedList()
170-
171168
-- Check if the aura is harmful and if it's a known bleed (as defined by LibDispel)
172-
if auraData.isHarmful and bleedList[auraData.spellId] then
173-
auraData.dispelName = "bleed"
174-
-- Set our raid debuff flag to true if the aura is a bleed and we can dispel bleeds
175-
if LibDispel:IsDispellableByMe("Bleed") then
176-
auraData.isRaid = true
177-
end
169+
if auraData.isHarmful and LibDispel:GetBleedList()[auraData.spellId] then
170+
auraData.dispelName = "Bleed"
178171
end
179172
end
180173

@@ -183,19 +176,14 @@ function EnhancedRaidFrames:addToAuraTable(parentFrame, auraData)
183176
-- otherwise strings with parentheses in them will fail to be found
184177
if self.allAuras:find(" " .. auraData.name:lower() .. " ", 1, true)
185178
or self.allAuras:find(auraData.spellId, 1, true)
186-
-- Check if the aura is a debuff, if it matches the "RAID" filter, and if we're tracking the wildcard for "dispel"
187-
or (auraData.isHarmful and auraData.isRaid and self.allAuras:find("dispel", 1, true))
179+
-- Check if the aura is a debuff, if aura string contains the "dispel" wildcard, and if the player can dispel this type
180+
or (auraData.isHarmful and self.allAuras:find("dispel", 1, true) and auraData.dispelName and LibDispel:GetMyDispelTypes()[auraData.dispelName])
188181
-- Check if the aura is a debuff, and if it has a dispelName see if we're tracking the wildcard for it
189182
or (auraData.isHarmful and auraData.dispelName and auraData.dispelName ~= "" and self.allAuras:find(auraData.dispelName:lower(), 1, true)) then
190183

191184
-- Lowercase the aura name for consistency
192185
auraData.name = auraData.name:lower()
193186

194-
-- Check to see if we have a dispel name, and lowercase it if we do
195-
if auraData.dispelName then
196-
auraData.dispelName = auraData.dispelName:lower()
197-
end
198-
199187
if auraData.auraInstanceID then
200188
-- For 10.0 and newer
201189
-- Add our auraData to the ERF_unitAuras table using the auraInstanceID as the key
@@ -238,7 +226,7 @@ function EnhancedRaidFrames:UpdateUnitAuras_Classic(parentFrame, forceRefresh)
238226
parentFrame.ERF_unitAuras = {}
239227

240228
-- Iterate through all buffs and debuffs on the unit
241-
for _, filter in pairs({ "HELPFUL", "HARMFUL", "RAID|HARMFUL" }) do
229+
for _, filter in pairs({ "HELPFUL", "HARMFUL" }) do
242230
-- Counter to keep track of our aura index
243231
local auraIndex = 1
244232

@@ -264,9 +252,6 @@ function EnhancedRaidFrames:UpdateUnitAuras_Classic(parentFrame, forceRefresh)
264252
auraData.isHelpful = true
265253
elseif filter == "HARMFUL" then
266254
auraData.isHarmful = true
267-
elseif filter == "RAID|HARMFUL" then
268-
auraData.isHarmful = true
269-
auraData.isRaid = true
270255
end
271256

272257
-- Add our auraIndex into the table

0 commit comments

Comments
 (0)