diff --git a/AuraIndicators.lua b/AuraIndicators.lua index 855ba15..f489056 100644 --- a/AuraIndicators.lua +++ b/AuraIndicators.lua @@ -1,12 +1,11 @@ -- Enhanced Raid Frames is a World of Warcraft® user interface addon. --- Copyright (c) 2017-2021 Britt W. Yazel +-- Copyright (c) 2017-2023 Britt W. Yazel -- This code is licensed under the MIT license (see LICENSE for details) local _, addonTable = ... local EnhancedRaidFrames = addonTable.EnhancedRaidFrames local media = LibStub:GetLibrary("LibSharedMedia-3.0") -local unitAuras = {} -- Matrix to keep a list of all auras on all units EnhancedRaidFrames.iconCache = {} EnhancedRaidFrames.iconCache["poison"] = 132104 @@ -54,7 +53,7 @@ function EnhancedRaidFrames:CreateIndicators(frame) indicatorFrame.position = i --hook OnEnter and OnLeave for showing and hiding ability tooltips - indicatorFrame:SetScript("OnEnter", function() self:Tooltip_OnEnter(indicatorFrame) end) + indicatorFrame:SetScript("OnEnter", function() self:Tooltip_OnEnter(indicatorFrame, frame) end) indicatorFrame:SetScript("OnLeave", function() GameTooltip:Hide() end) --disable the mouse click on our frames to allow those clicks to get passed straight through to the raid frame behind (switch target, right click, etc) @@ -87,8 +86,8 @@ function EnhancedRaidFrames:SetIndicatorAppearance(frame) --set indicator frame position local PAD = 1 - local iconVerticalOffset = floor(self.db.profile[i].indicatorVerticalOffset * frame:GetHeight()) --round down - local iconHorizontalOffset = floor(self.db.profile[i].indicatorHorizontalOffset * frame:GetWidth()) --round down + local iconVerticalOffset = floor((self.db.profile[i].indicatorVerticalOffset * frame:GetHeight()) + 0.5) --add 0.5 to better approximate a "round" function + local iconHorizontalOffset = floor((self.db.profile[i].indicatorHorizontalOffset * frame:GetWidth()) + 0.5) --add 0.5 to better approximate a "round" function --we probably don't want to overlap the power bar (rage, mana, energy, etc) so we need a compensation factor local powerBarVertOffset @@ -140,13 +139,13 @@ function EnhancedRaidFrames:SetIndicatorAppearance(frame) end end - ------------------------------------------------ --------------- Process Indicators ------------- ------------------------------------------------ +--- Kickstart the indicator processing for all indicators on a given frame function EnhancedRaidFrames:UpdateIndicators(frame, setAppearance) - --check to see if the bar is even targeting a unit, bail if it isn't + --Check to see if the bar is even targeting a unit, bail if it isn't --also, tanks have two bars below their frame that have a frame.unit that ends in "target" and "targettarget". --Normal raid members have frame.unit that says "Raid1", "Raid5", etc. --We don't want to put icons over these tiny little target and target of target bars @@ -155,7 +154,6 @@ function EnhancedRaidFrames:UpdateIndicators(frame, setAppearance) or string.find(frame.unit, "target") or string.find(frame.unit, "nameplate") or string.find(frame.unit, "pet") - --10.0 introduced the CompactPartyFrame, we can't assume it exists in classic or (not CompactRaidFrameContainer:IsShown() and CompactPartyFrame and not CompactPartyFrame:IsShown()) then return end @@ -171,11 +169,10 @@ function EnhancedRaidFrames:UpdateIndicators(frame, setAppearance) self:SetIndicatorAppearance(frame) end - if not self.isWoWClassicEra and not self.isWoWClassic then - --Force a full update on a steady cadence to increase responsiveness - self:UpdateUnitAuras(nil, frame.unit, {isFullUpdate = true}) - else - --Update unit auras, for retail we have a new way of doing it using the UNIT_AURA API + -- Force a refresh of our unitAuras table (Classic and Classic Era Only) + -- In retail we have a new way of doing it using the UNIT_AURA event and C_UnitAuras API + -- This is an inefficient way of triggering a refresh, but it works + if self.isWoWClassicEra or self.isWoWClassic then self:UpdateUnitAuras_Legacy(frame.unit) end @@ -189,15 +186,15 @@ function EnhancedRaidFrames:UpdateIndicators(frame, setAppearance) end end --- process a single indicator and apply visuals +--- Process a single indicator location and apply any necessary visual effects for this moment in time function EnhancedRaidFrames:ProcessIndicator(indicatorFrame, unit) local i = indicatorFrame.position - local foundAura, icon, count, duration, expirationTime, debuffType, castBy, auraType, auraInstanceID, auraIndex, _ + local auraInstanceID, icon, count, duration, expirationTime, debuffType, castBy, auraType, auraIndex, _ --reset auraInstanceID/auraIndex and auraType for tooltip indicatorFrame.auraInstanceID = nil - indicatorFrame.auraIndex = nil + indicatorFrame.auraIndex = nil --legacy indicatorFrame.auraType = nil -- if we only are to show the indicator on me, then don't bother if I'm not the unit @@ -213,13 +210,13 @@ function EnhancedRaidFrames:ProcessIndicator(indicatorFrame, unit) -------------------------------------------------------- for _, auraIdentifier in pairs(self.auraStrings[i]) do - --if there's no auraName (i.e. the user never specified anything to go in this spot), stop here there's no need to keep going + --if there's no auraIdentifier (i.e. the user never specified anything to go in this spot), stop here there's no need to keep going if not auraIdentifier then break end -- query the available information for a given indicator and aura - foundAura, icon, count, duration, expirationTime, debuffType, castBy, auraType, auraInstanceID, auraIndex = self:QueryAuraInfo(auraIdentifier, unit) + auraInstanceID, icon, count, duration, expirationTime, debuffType, castBy, auraType, auraIndex = self:QueryUnitAuraInfo(unit, auraIdentifier) -- add spell icon info to cache in case we need it later on if icon and not self.iconCache[auraIdentifier] then @@ -229,7 +226,7 @@ function EnhancedRaidFrames:ProcessIndicator(indicatorFrame, unit) -- when tracking multiple things, this determines "where" we stop in the list -- if we find the aura, we can stop querying down the list -- we want to stop only when castBy == "player" if we are tracking "mine only" - if foundAura and (not self.db.profile[i].mineOnly or (self.db.profile[i].mineOnly and castBy == "player")) then + if (auraInstanceID or auraIndex) and (not self.db.profile[i].mineOnly or (self.db.profile[i].mineOnly and castBy == "player")) then break end end @@ -239,15 +236,15 @@ function EnhancedRaidFrames:ProcessIndicator(indicatorFrame, unit) ------------------------------------------------------ -- if we find the spell and we don't only want to show when it is missing - if foundAura and UnitIsConnected(unit) and not self.db.profile[i].missingOnly and + if (auraInstanceID or auraIndex) and UnitIsConnected(unit) and not self.db.profile[i].missingOnly and (not self.db.profile[i].mineOnly or (self.db.profile[i].mineOnly and castBy == "player")) then -- calculate remainingTime and round down, this is how the game seems to do it - local remainingTime = floor(expirationTime - GetTime()) + local remainingTime = floor((expirationTime - GetTime()) + 0.5) --add 0.5 to better simulate a proper "round" function -- set auraInstanceID/auraIndex and auraType for tooltip indicatorFrame.auraInstanceID = auraInstanceID - indicatorFrame.auraIndex = auraIndex + indicatorFrame.auraIndex = auraIndex --legacy indicatorFrame.auraType = auraType --------------------------------- @@ -368,7 +365,7 @@ function EnhancedRaidFrames:ProcessIndicator(indicatorFrame, unit) indicatorFrame:Show() --show the frame - elseif not foundAura and self.db.profile[i].missingOnly then --deal with "show only if missing" + elseif not (auraInstanceID or auraIndex) and self.db.profile[i].missingOnly then --deal with "show only if missing" local auraName = self.auraStrings[i][1] --show the icon for the first auraString position --check our iconCache for the auraName. Note the icon cache is pre-populated with generic "poison", "curse", "disease", and "magic" debuff icons @@ -406,18 +403,17 @@ function EnhancedRaidFrames:ProcessIndicator(indicatorFrame, unit) end --process the text and icon for an indicator and return these values ---this function returns foundAura, icon, count, duration, expirationTime, debuffType, castBy, auraType, auraInstanceID, auraIndex -function EnhancedRaidFrames:QueryAuraInfo(auraIdentifier, unit) - if not unitAuras[unit] then - return false +--this function returns auraInstanceID, icon, count, duration, expirationTime, debuffType, castBy, auraType, auraIndex +function EnhancedRaidFrames:QueryUnitAuraInfo(unit, auraIdentifier) + if not self.unitAuras[unit] then + return end -- Check if the aura exist on the unit - for _,auraInstance in pairs(unitAuras[unit]) do --loop through list of auras - if (tonumber(auraIdentifier) and auraInstance.spellID == tonumber(auraIdentifier)) or - auraInstance.auraName == auraIdentifier or (auraInstance.auraType == "debuff" and auraInstance.debuffType == auraIdentifier) then - return true, auraInstance.icon, auraInstance.count, auraInstance.duration, auraInstance.expirationTime, - auraInstance.debuffType, auraInstance.castBy, auraInstance.auraType, auraInstance.auraInstanceID, auraInstance.auraIndex + for _,aura in pairs(self.unitAuras[unit]) do --loop through list of auras + if (tonumber(auraIdentifier) and aura.spellID == tonumber(auraIdentifier)) or + aura.auraName == auraIdentifier or (aura.auraType == "debuff" and aura.debuffType == auraIdentifier) then + return aura.auraInstanceID, aura.icon, aura.count, aura.duration, aura.expirationTime, aura.debuffType, aura.castBy, aura.auraType, aura.auraIndex end end @@ -426,7 +422,8 @@ function EnhancedRaidFrames:QueryAuraInfo(auraIdentifier, unit) if UnitIsPVP(unit) then local factionGroup = UnitFactionGroup(unit) if factionGroup then - return true, "Interface\\GroupFrame\\UI-Group-PVP-"..factionGroup, 0, 0, 0, "", "player" + --return auraInstanceID as 0 for special cases + return 0, "Interface\\GroupFrame\\UI-Group-PVP-"..factionGroup, 0, 0, 0, "", "player" end end end @@ -434,205 +431,50 @@ function EnhancedRaidFrames:QueryAuraInfo(auraIdentifier, unit) -- Check if we want to show combat flag if auraIdentifier:upper() == "COMBAT" then if UnitAffectingCombat(unit) then - return true, "Interface\\Icons\\Ability_Dualwield", 0, 0, 0, "", "player" + --return auraInstanceID as 0 for special cases + return 0, "Interface\\Icons\\Ability_Dualwield", 0, 0, 0, "", "player" end end -- Check if we want to show ToT flag if auraIdentifier:upper() == "TOT" then if UnitIsUnit(unit, "targettarget") then - return true, "Interface\\Icons\\Ability_Hunter_SniperShot", 0, 0, 0, "", "player" - end - end - - return false -end - - ------------------------------------------------- ----------- Update Auras for all units ---------- ------------------------------------------------- - -function EnhancedRaidFrames:UpdateUnitAuras(_, unit, payload) - -- Only process player, raid, and party units - if not string.find(unit, "player") and not string.find(unit, "raid") and not string.find(unit, "party") then - return - end - - -- Create the main table for the unit - if not unitAuras[unit] then - unitAuras[unit] = {} - end - - local function addToAuraTable(thisUnit, thisAuraData) - if not thisAuraData then - return - end - - local aura = {} - aura.auraInstanceID = thisAuraData.auraInstanceID - if thisAuraData.isHelpful then - aura.auraType = "buff" - elseif thisAuraData.isHarmful then - aura.auraType = "debuff" - end - aura.auraName = thisAuraData.name:lower() - aura.icon = thisAuraData.icon - aura.count = thisAuraData.applications - aura.duration = thisAuraData.duration - aura.expirationTime = thisAuraData.expirationTime - aura.castBy = thisAuraData.sourceUnit - aura.spellID = thisAuraData.spellId - - if unitAuras[thisUnit][aura.auraInstanceID] then - unitAuras[thisUnit][aura.auraInstanceID] = nil - end - unitAuras[thisUnit][aura.auraInstanceID] = aura - end - - if payload.isFullUpdate then - AuraUtil.ForEachAura(unit, "HELPFUL", nil, function(auraData) - addToAuraTable(unit, auraData) - end, true); - AuraUtil.ForEachAura(unit, "HARMFUL", nil, function(auraData) - addToAuraTable(unit, auraData) - end, true); - return - end - - if payload.addedAuras then - for _, auraData in pairs(payload.addedAuras) do - addToAuraTable(unit, auraData) - end - end - - if payload.updatedAuraInstanceIDs then - for _, ID in pairs(payload.updatedAuraInstanceIDs) do - if unitAuras[unit][ID] then - local auraData = C_UnitAuras.GetAuraDataByAuraInstanceID(unit, ID) - addToAuraTable(unit, auraData) - end - end - end - - if payload.removedAuraInstanceIDs then - for _, ID in pairs(payload.removedAuraInstanceIDs) do - if unitAuras[unit][ID] then - unitAuras[unit][ID] = nil - end + --return auraInstanceID as 0 for special cases + return 0, "Interface\\Icons\\Ability_Hunter_SniperShot", 0, 0, 0, "", "player" end end end - -function EnhancedRaidFrames:UpdateUnitAuras_Legacy(unit) - -- Create or clear out the tables for the unit - unitAuras[unit] = {} - - -- Get all unit buffs - local i = 1 - while (true) do - local auraName, icon, count, duration, expirationTime, castBy, spellID - - if UnitAura then - auraName, icon, count, _, duration, expirationTime, castBy, _, _, spellID = UnitAura(unit, i, "HELPFUL") - else - auraName, icon, count, _, duration, expirationTime, castBy, _, _, spellID = self.UnitAuraWrapper(unit, i, "HELPFUL") --for wow classic. This is the LibClassicDurations wrapper - end - - if not spellID then --break the loop once we have no more buffs - break - end - - --it's important to use the 4th argument in string.find to turn of pattern matching, otherwise things with parentheses in them will fail to be found - if auraName and self.allAuras:find(" "..auraName:lower().." ", nil, true) or self.allAuras:find(" "..spellID.." ", nil, true) then -- Only add the spell if we're watching for it - local auraTable = {} - auraTable.auraType = "buff" - auraTable.auraIndex = i - auraTable.auraName = auraName:lower() - auraTable.icon = icon - auraTable.count = count - auraTable.duration = duration - auraTable.expirationTime = expirationTime - auraTable.castBy = castBy - auraTable.spellID = spellID - - table.insert(unitAuras[unit], auraTable) - end - i = i + 1 - end - - -- Get all unit debuffs - i = 1 - while (true) do - local auraName, icon, count, duration, expirationTime, castBy, spellID, debuffType - - if UnitAura then - auraName, icon, count, debuffType, duration, expirationTime, castBy, _, _, spellID = UnitAura(unit, i, "HARMFUL") - else - auraName, icon, count, debuffType, duration, expirationTime, castBy, _, _, spellID = self.UnitAuraWrapper(unit, i, "HARMFUL") --for wow classic. This is the LibClassicDurations wrapper - end - - if not spellID then --break the loop once we have no more buffs - break - end - - --it's important to use the 4th argument in string.find to turn off pattern matching, otherwise things with parentheses in them will fail to be found - if auraName and self.allAuras:find(" "..auraName:lower().." ", nil, true) or self.allAuras:find(" "..spellID.." ", nil, true) or (debuffType and self.allAuras:find(" "..debuffType:lower().." ", nil, true)) then -- Only add the spell if we're watching for it - local auraTable = {} - auraTable.auraType = "debuff" - auraTable.auraIndex = i - auraTable.auraName = auraName:lower() - auraTable.icon = icon - auraTable.count = count - if debuffType then - auraTable.debuffType = debuffType:lower() - end - auraTable.duration = duration - auraTable.expirationTime = expirationTime - auraTable.castBy = castBy - auraTable.spellID = spellID - - table.insert(unitAuras[unit], auraTable) - end - i = i + 1 - end -end - ------------------------------------------------ ----------------- Tooltip Code ----------------- ------------------------------------------------ -function EnhancedRaidFrames:Tooltip_OnEnter(indicatorFrame) +function EnhancedRaidFrames:Tooltip_OnEnter(indicatorFrame, parentFrame) local i = indicatorFrame.position if not self.db.profile[i].showTooltip then --don't show tooltips unless we have the option set for this position return end - local frame = indicatorFrame:GetParent() --this is the parent raid frame that holds all the indicatorFrames - -- Set the tooltip - if (indicatorFrame.auraInstanceID or indicatorFrame.auraIndex) and indicatorFrame.Icon:GetTexture() then -- -1 is the pvp icon, no tooltip for that + if (indicatorFrame.auraInstanceID or indicatorFrame.auraIndex) and indicatorFrame.auraInstanceID ~= 0 and indicatorFrame.Icon:GetTexture() then -- -1 is the pvp icon, no tooltip for that -- Set the buff/debuff as tooltip and anchor to the cursor GameTooltip:SetOwner(UIParent, self.db.profile[i].tooltipLocation) if indicatorFrame.auraType == "buff" then if indicatorFrame.auraInstanceID then - GameTooltip:SetUnitBuffByAuraInstanceID(frame.unit, indicatorFrame.auraInstanceID) + GameTooltip:SetUnitBuffByAuraInstanceID(parentFrame.unit, indicatorFrame.auraInstanceID) elseif indicatorFrame.auraIndex then --the legacy way of doing things - GameTooltip:SetUnitAura(frame.unit, indicatorFrame.auraIndex, "HELPFUL") + GameTooltip:SetUnitAura(parentFrame.unit, indicatorFrame.auraIndex, "HELPFUL") end elseif indicatorFrame.auraType == "debuff" then if indicatorFrame.auraInstanceID then - GameTooltip:SetUnitDebuffByAuraInstanceID(frame.unit, indicatorFrame.auraInstanceID) + GameTooltip:SetUnitDebuffByAuraInstanceID(parentFrame.unit, indicatorFrame.auraInstanceID) elseif indicatorFrame.auraIndex then --the legacy way of doing things - GameTooltip:SetUnitAura(frame.unit, indicatorFrame.auraIndex, "HARMFUL") + GameTooltip:SetUnitAura(parentFrame.unit, indicatorFrame.auraIndex, "HARMFUL") end end else --causes the tooltip to reset to the "default" tooltip which is usually information about the character - if frame then - UnitFrame_UpdateTooltip(frame) - end + UnitFrame_UpdateTooltip(parentFrame) end GameTooltip:Show() diff --git a/CollectUnitAuras.lua b/CollectUnitAuras.lua new file mode 100644 index 0000000..10343aa --- /dev/null +++ b/CollectUnitAuras.lua @@ -0,0 +1,180 @@ +-- Enhanced Raid Frames is a World of Warcraft® user interface addon. +-- Copyright (c) 2017-2023 Britt W. Yazel +-- This code is licensed under the MIT license (see LICENSE for details) + +local _, addonTable = ... --make use of the default addon namespace +local EnhancedRaidFrames = addonTable.EnhancedRaidFrames + +------------------------------------------------------------------------- +------------------------------------------------------------------------- + +EnhancedRaidFrames.unitAuras = {} -- Matrix to keep a list of all auras on all units +local unitAuras = EnhancedRaidFrames.unitAuras --local handle for the above table + +------------------------------------------------ +---------- Update Auras for all units ---------- +------------------------------------------------ + +--- This functions is bound to the UNIT_AURA event and is used to track auras on all raid frame units +--- It uses the C_UnitAuras API that was added in 10.0 +--- Unit aura information is stored in the unitAuras table +function EnhancedRaidFrames:UpdateUnitAuras(_, unit, payload) + -- Only process player, raid, and party units + if not string.find(unit, "player") and not string.find(unit, "raid") and not string.find(unit, "party") then + return + end + + -- Create the main table for the unit + if not unitAuras[unit] then + unitAuras[unit] = {} + end + + -- If we get a full update signal, wipe the table and rescan all auras for the unit + if payload.isFullUpdate then + -- Clear out the table + table.wipe(unitAuras[unit]) + -- These helper functions will iterate over all buffs and debuffs on the unit + -- and call the addToAuraTable() function for each one + AuraUtil.ForEachAura(unit, "HELPFUL", nil, function(auraData) + EnhancedRaidFrames.addToAuraTable(unit, auraData) + end, true); + AuraUtil.ForEachAura(unit, "HARMFUL", nil, function(auraData) + EnhancedRaidFrames.addToAuraTable(unit, auraData) + end, true); + return + end + + -- If new auras are added, update the table with their payload information + if payload.addedAuras then + for _, auraData in pairs(payload.addedAuras) do + EnhancedRaidFrames.addToAuraTable(unit, auraData) + end + end + + -- If an aura has been updated, query the updated information and add it to the table + if payload.updatedAuraInstanceIDs then + for _, auraInstanceID in pairs(payload.updatedAuraInstanceIDs) do + if unitAuras[unit][auraInstanceID] then + local auraData = C_UnitAuras.GetAuraDataByAuraInstanceID(unit, auraInstanceID) + EnhancedRaidFrames.addToAuraTable(unit, auraData) + end + end + end + + -- If an aura has been removed, remove it from the table + if payload.removedAuraInstanceIDs then + for _, auraInstanceID in pairs(payload.removedAuraInstanceIDs) do + if unitAuras[unit][auraInstanceID] then + unitAuras[unit][auraInstanceID] = nil + end + end + end +end + +--- Prior to WoW 10.0, this function was used to track auras on all raid frame units +--- Unit auras are now tracked using the UNIT_AURA event and APIs in Retail +--- Unit aura information is stored in the unitAuras table +function EnhancedRaidFrames:UpdateUnitAuras_Legacy(unit) + -- Create or clear out the tables for the unit + unitAuras[unit] = {} + + -- Get all unit buffs + local i = 1 + while (true) do + local auraName, icon, count, duration, expirationTime, castBy, spellID + + if UnitAura then + auraName, icon, count, _, duration, expirationTime, castBy, _, _, spellID = UnitAura(unit, i, "HELPFUL") + else + auraName, icon, count, _, duration, expirationTime, castBy, _, _, spellID = self.UnitAuraWrapper(unit, i, "HELPFUL") --for wow classic. This is the LibClassicDurations wrapper + end + + if not spellID then --break the loop once we have no more buffs + break + end + + --it's important to use the 4th argument in string.find to turn of pattern matching, otherwise things with parentheses in them will fail to be found + if auraName and self.allAuras:find(" "..auraName:lower().." ", nil, true) or self.allAuras:find(" "..spellID.." ", nil, true) then -- Only add the spell if we're watching for it + local auraTable = {} + auraTable.auraType = "buff" + auraTable.auraIndex = i + auraTable.auraName = auraName:lower() + auraTable.icon = icon + auraTable.count = count + auraTable.duration = duration + auraTable.expirationTime = expirationTime + auraTable.castBy = castBy + auraTable.spellID = spellID + + table.insert(unitAuras[unit], auraTable) + end + i = i + 1 + end + + -- Get all unit debuffs + i = 1 + while (true) do + local auraName, icon, count, duration, expirationTime, castBy, spellID, debuffType + + if UnitAura then + auraName, icon, count, debuffType, duration, expirationTime, castBy, _, _, spellID = UnitAura(unit, i, "HARMFUL") + else + auraName, icon, count, debuffType, duration, expirationTime, castBy, _, _, spellID = self.UnitAuraWrapper(unit, i, "HARMFUL") --for wow classic. This is the LibClassicDurations wrapper + end + + if not spellID then --break the loop once we have no more buffs + break + end + + --it's important to use the 4th argument in string.find to turn off pattern matching, otherwise things with parentheses in them will fail to be found + if auraName and self.allAuras:find(" "..auraName:lower().." ", nil, true) or self.allAuras:find(" "..spellID.." ", nil, true) or (debuffType and self.allAuras:find(" "..debuffType:lower().." ", nil, true)) then -- Only add the spell if we're watching for it + local auraTable = {} + auraTable.auraType = "debuff" + auraTable.auraIndex = i + auraTable.auraName = auraName:lower() + auraTable.icon = icon + auraTable.count = count + if debuffType then + auraTable.debuffType = debuffType:lower() + end + auraTable.duration = duration + auraTable.expirationTime = expirationTime + auraTable.castBy = castBy + auraTable.spellID = spellID + + table.insert(unitAuras[unit], auraTable) + end + i = i + 1 + end +end + +--function to add or update an aura to the unitAuras table +function EnhancedRaidFrames.addToAuraTable(thisUnit, thisAuraData) + if not thisAuraData then + return + end + + local aura = {} + aura.auraInstanceID = thisAuraData.auraInstanceID + if thisAuraData.isHelpful then + aura.auraType = "buff" + elseif thisAuraData.isHarmful then + aura.auraType = "debuff" + end + aura.auraName = thisAuraData.name:lower() + aura.icon = thisAuraData.icon + aura.count = thisAuraData.applications + aura.duration = thisAuraData.duration + aura.expirationTime = thisAuraData.expirationTime + aura.castBy = thisAuraData.sourceUnit + aura.spellID = thisAuraData.spellId + + -- Update the aura elements if it already exists + if unitAuras[thisUnit][aura.auraInstanceID] then + for k,v in pairs(aura) do + unitAuras[thisUnit][aura.auraInstanceID][k] = v + end + else + unitAuras[thisUnit][aura.auraInstanceID] = aura + end +end \ No newline at end of file diff --git a/DatabaseDefaults.lua b/DatabaseDefaults.lua index dd0da9c..9196c73 100644 --- a/DatabaseDefaults.lua +++ b/DatabaseDefaults.lua @@ -1,5 +1,5 @@ -- Enhanced Raid Frames is a World of Warcraft® user interface addon. --- Copyright (c) 2017-2021 Britt W. Yazel +-- Copyright (c) 2017-2023 Britt W. Yazel -- This code is licensed under the MIT license (see LICENSE for details) local _, addonTable = ... --make use of the default addon namespace @@ -83,7 +83,6 @@ function EnhancedRaidFrames:CreateDefaults() showCountdownSwipe = true, indicatorGlow = false, glowRemainingSecs = 3, - } end diff --git a/EnhancedRaidFrames.lua b/EnhancedRaidFrames.lua index c8bdf6b..c4fe742 100644 --- a/EnhancedRaidFrames.lua +++ b/EnhancedRaidFrames.lua @@ -1,5 +1,5 @@ -- Enhanced Raid Frames is a World of Warcraft® user interface addon. --- Copyright (c) 2017-2021 Britt W. Yazel +-- Copyright (c) 2017-2023 Britt W. Yazel -- This code is licensed under the MIT license (see LICENSE for details) local addonName, addonTable = ... --make use of the default addon namespace @@ -22,7 +22,6 @@ end EnhancedRaidFrames.DATABASE_VERSION = 2 - --Declare Color Globals EnhancedRaidFrames.NORMAL_COLOR = NORMAL_FONT_COLOR or CreateColor(1.0, 0.82, 0.0) --the default game text color, dull yellow color EnhancedRaidFrames.WHITE_COLOR = WHITE_FONT_COLOR or CreateColor(1.0, 1.0, 1.0) --default game white color for text @@ -66,6 +65,7 @@ function EnhancedRaidFrames:OnEnable() -- Hook raid icon updates self:RegisterBucketEvent({"RAID_TARGET_UPDATE", "RAID_ROSTER_UPDATE"}, 1, "UpdateAllFrames") + -- Use new UNIT_AURA event in retail that was added in 10.0 for huge performance gains if not self.isWoWClassicEra and not self.isWoWClassic then self:RegisterEvent("UNIT_AURA", "UpdateUnitAuras") end @@ -77,12 +77,7 @@ function EnhancedRaidFrames:OnEnable() self:UpdateNotifier() self:RegisterChatCommand("erf",function() - if Settings then --10.0 introduced a new Settings API - Settings.OpenToCategory("Enhanced Raid Frames") - else - InterfaceOptionsFrame_OpenToCategory("Enhanced Raid Frames") - InterfaceOptionsFrame_OpenToCategory("Enhanced Raid Frames") - end + Settings.OpenToCategory("Enhanced Raid Frames") end) end @@ -148,7 +143,6 @@ end ---@param setAppearance boolean function EnhancedRaidFrames:UpdateAllFrames(setAppearance) --don't do any work if the raid frames aren't shown - --10.0 introduced the CompactPartyFrame, we can't assume it exists in Classic if not CompactRaidFrameContainer:IsShown() and CompactPartyFrame and not CompactPartyFrame:IsShown() then return end diff --git a/EnhancedRaidFrames.toc b/EnhancedRaidFrames.toc index fb0e350..d7ac2ca 100644 --- a/EnhancedRaidFrames.toc +++ b/EnhancedRaidFrames.toc @@ -21,6 +21,7 @@ Localizations\Localizations.xml EnhancedRaidFrames.lua DatabaseDefaults.lua UtilitiesAndOverrides.lua +CollectUnitAuras.lua AuraIndicators.lua RaidIcons.lua diff --git a/GUI/GeneralConfigPanel.lua b/GUI/GeneralConfigPanel.lua index fd5b990..1b1a6fd 100644 --- a/GUI/GeneralConfigPanel.lua +++ b/GUI/GeneralConfigPanel.lua @@ -1,5 +1,5 @@ -- Enhanced Raid Frames is a World of Warcraft® user interface addon. --- Copyright (c) 2017-2021 Britt W. Yazel +-- Copyright (c) 2017-2023 Britt W. Yazel -- This code is licensed under the MIT license (see LICENSE for details) local _, addonTable = ... diff --git a/GUI/IconConfigPanel.lua b/GUI/IconConfigPanel.lua index b0109e2..de177e0 100644 --- a/GUI/IconConfigPanel.lua +++ b/GUI/IconConfigPanel.lua @@ -1,5 +1,5 @@ -- Enhanced Raid Frames is a World of Warcraft® user interface addon. --- Copyright (c) 2017-2021 Britt W. Yazel +-- Copyright (c) 2017-2023 Britt W. Yazel -- This code is licensed under the MIT license (see LICENSE for details) local _, addonTable = ... diff --git a/GUI/IndicatorConfigPanel.lua b/GUI/IndicatorConfigPanel.lua index 2654d88..a2b7335 100644 --- a/GUI/IndicatorConfigPanel.lua +++ b/GUI/IndicatorConfigPanel.lua @@ -1,5 +1,5 @@ -- Enhanced Raid Frames is a World of Warcraft® user interface addon. --- Copyright (c) 2017-2021 Britt W. Yazel +-- Copyright (c) 2017-2023 Britt W. Yazel -- This code is licensed under the MIT license (see LICENSE for details) local _, addonTable = ... @@ -11,7 +11,6 @@ local POSITIONS = { [1] = L["Top left"], [2] = L["Top Center"], [3] = L["Top Rig [4] = L["Middle Left"], [5] = L["Middle Center"], [6] = L["Middle Right"], [7] = L["Bottom Left"], [8] = L["Bottom Center"], [9] = L["Bottom Right"]} - ------------------------------------------------------------------------- ------------------------------------------------------------------------- diff --git a/GUI/ProfileImportExport.lua b/GUI/ProfileImportExport.lua index ddf520d..4510fa4 100644 --- a/GUI/ProfileImportExport.lua +++ b/GUI/ProfileImportExport.lua @@ -1,5 +1,5 @@ -- Enhanced Raid Frames is a World of Warcraft® user interface addon. --- Copyright (c) 2017-2021 Britt W. Yazel +-- Copyright (c) 2017-2023 Britt W. Yazel -- This code is licensed under the MIT license (see LICENSE for details) local _, addonTable = ... @@ -7,7 +7,6 @@ local EnhancedRaidFrames = addonTable.EnhancedRaidFrames local L = LibStub("AceLocale-3.0"):GetLocale("EnhancedRaidFrames") - ------------------------------------------------------------------------- ------------------------------------------------------------------------- diff --git a/LICENSE b/LICENSE index 4c69624..640703e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License -Copyright (c) 2017-2021 Britt W. Yazel +Copyright (c) 2017-2023 Britt W. Yazel Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Libs/embeds.xml b/Libs/embeds.xml index ab42051..0a0db5c 100644 --- a/Libs/embeds.xml +++ b/Libs/embeds.xml @@ -1,10 +1,9 @@ -