From ef653289c9752c0b4e72e1b3104df717a6330b4b Mon Sep 17 00:00:00 2001 From: httpsx Date: Tue, 25 Apr 2023 06:20:39 +0500 Subject: [PATCH 1/4] auraInstanceID update usePackedAura for Unit Auras. --- BlizzardCode.lua | 400 ++++++++++++++++++++++++----------------------- 1 file changed, 202 insertions(+), 198 deletions(-) diff --git a/BlizzardCode.lua b/BlizzardCode.lua index f9ed616..9754e29 100755 --- a/BlizzardCode.lua +++ b/BlizzardCode.lua @@ -22,30 +22,18 @@ local UnitHealth = UnitHealth local UnitHealthMax = UnitHealthMax -function KHMRaidFrames:CompactUnitFrame_UtilSetDebuff(debuffFrame, unit, index, filter, isBossAura, isBossBuff, ...) +function KHMRaidFrames:CompactUnitFrame_UtilSetDebuff(debuffFrame, unit, index, filter, isBossAura, isBossBuff, aura) debuffFrame.debuffFramesGlowing = nil - + -- make sure you are using the correct index here! --isBossAura says make this look large. --isBossBuff looks in HELPFULL auras otherwise it looks in HARMFULL ones - local name, icon, count, debuffType, duration, expirationTime, unitCaster, canStealOrPurge, _, spellId = ... - if name == nil then - -- for backwards compatibility - this functionality will be removed in a future update - if unit then - if (isBossBuff) then - name, icon, count, debuffType, duration, expirationTime, unitCaster, canStealOrPurge, _, spellId = UnitBuff(unit, index, filter) - else - name, icon, count, debuffType, duration, expirationTime, unitCaster, canStealOrPurge, _, spellId = UnitDebuff(unit, index, filter) - end - else - return - end - end + debuffFrame.filter = filter - debuffFrame.icon:SetTexture(icon) - if ( count > 1 ) then - local countText = count - if ( count >= 100 ) then + debuffFrame.icon:SetTexture(aura.icon) + if ( aura.applications > 1 ) then + local countText = aura.applications + if ( aura.applications >= 100 ) then countText = BUFF_STACKS_OVERFLOW end debuffFrame.count:Show() @@ -54,48 +42,48 @@ function KHMRaidFrames:CompactUnitFrame_UtilSetDebuff(debuffFrame, unit, index, debuffFrame.count:Hide() end debuffFrame:SetID(index) - local enabled = expirationTime and expirationTime ~= 0 + local enabled = aura.expirationTime and aura.expirationTime ~= 0 if enabled then - local startTime = expirationTime - duration - CooldownFrame_Set(debuffFrame.cooldown, startTime, duration, true) + local startTime = aura.expirationTime - aura.duration + CooldownFrame_Set(debuffFrame.cooldown, startTime, aura.duration, true) else CooldownFrame_Clear(debuffFrame.cooldown) end - - local color = DebuffTypeColor[debuffType] or DebuffTypeColor["none"] + + local color = DebuffTypeColor[aura.dispelName] or DebuffTypeColor["none"] debuffFrame.border:SetVertexColor(color.r, color.g, color.b) - + debuffFrame.isBossBuff = isBossBuff debuffFrame.isBossAura = isBossAura - + local size - + if IsInRaid() then size = self.db.profile.raid.debuffFrames else size = self.db.profile.party.debuffFrames end - + if isBossAura then size = size.bigDebuffSize else size = size.size end - + local parent = debuffFrame:GetParent() - + size = size * self.componentScale(IsInRaid() and "raid" or "party") - + debuffFrame:SetSize(size, size) - + debuffFrame:Show() - - name = name and name:lower() - debuffType = debuffType and debuffType:lower() or "physical" - spellId = tostring(spellId) - + + name = aura.name and aura.name:lower() + debuffType = aura.dispelName and aura.dispelName:lower() or "physical" + spellId = tostring(aura.spellId) + local db = self.db.profile.glows - + if db.auraGlow.debuffFrames.enabled then if self:TrackAuras(name, debuffType, spellId, db.auraGlow.debuffFrames.tracking) then local color = db.auraGlow.debuffFrames.useDefaultsColors and db.auraGlow.defaultColors[debuffType] @@ -103,28 +91,27 @@ function KHMRaidFrames:CompactUnitFrame_UtilSetDebuff(debuffFrame, unit, index, debuffFrame.debuffFramesGlowing = debuffType end end - + if not debuffFrame.debuffFramesGlowing then self.StopGlow(debuffFrame, db.auraGlow.debuffFrames, "debuffFrames", "auraGlow") end - + parent.debuffFramesGlowing[debuffType] = {name, debuffType, spellId} parent.debuffFramesGlowing[name] = {name, debuffType, spellId} parent.debuffFramesGlowing[spellId] = {name, debuffType, spellId} - + if self.Masque then debuffFrame.border:Hide() end end -function KHMRaidFrames:CompactUnitFrame_UtilSetBuff(buffFrame, index, ...) +function KHMRaidFrames:CompactUnitFrame_UtilSetBuff(buffFrame, index, aura) buffFrame.buffFramesGlowing = nil - - local name, icon, count, debuffType, duration, expirationTime, unitCaster, canStealOrPurge, _, spellId, canApplyAura = ... - buffFrame.icon:SetTexture(icon) - if ( count > 1 ) then - local countText = count - if ( count >= 100 ) then + + buffFrame.icon:SetTexture(aura.icon) + if ( aura.applications > 1 ) then + local countText = aura.applications; + if ( aura.applications >= 100 ) then countText = BUFF_STACKS_OVERFLOW end buffFrame.count:Show() @@ -133,21 +120,34 @@ function KHMRaidFrames:CompactUnitFrame_UtilSetBuff(buffFrame, index, ...) buffFrame.count:Hide() end buffFrame:SetID(index) - local enabled = expirationTime and expirationTime ~= 0 + buffFrame.auraInstanceID = aura.auraInstanceID; + local enabled = aura.expirationTime and aura.expirationTime ~= 0 if enabled then - local startTime = expirationTime - duration - CooldownFrame_Set(buffFrame.cooldown, startTime, duration, true) + local startTime = aura.expirationTime - aura.duration + CooldownFrame_Set(buffFrame.cooldown, startTime, aura.duration, true) else CooldownFrame_Clear(buffFrame.cooldown) end + + local size; + if IsInRaid() then + size = self.db.profile.raid.buffFrames.size + else + size = self.db.profile.party.buffFrames.size + end + + size = size * self.componentScale(IsInRaid() and "raid" or "party") + + buffFrame:SetSize(size, size) + buffFrame:Show() - - name = name and name:lower() - debuffType = debuffType and debuffType:lower() or "physical" - spellId = tostring(spellId) - + + name = aura.name and aura.name:lower() + debuffType = aura.dispelName and aura.dispelName:lower() or "physical" + spellId = tostring(aura.spellId) + local db = self.db.profile.glows - + if db.auraGlow.buffFrames.enabled then if self:TrackAuras(name, debuffType, spellId, db.auraGlow.buffFrames.tracking) then local color = db.auraGlow.buffFrames.useDefaultsColors and db.auraGlow.defaultColors[debuffType] @@ -155,58 +155,56 @@ function KHMRaidFrames:CompactUnitFrame_UtilSetBuff(buffFrame, index, ...) buffFrame.buffFramesGlowing = debuffType end end - + if not buffFrame.buffFramesGlowing then self.StopGlow(buffFrame, db.auraGlow.buffFrames, "buffFrames", "auraGlow") end - + local parent = buffFrame:GetParent() - + parent.buffFramesGlowing[debuffType] = {name, debuffType, spellId} parent.buffFramesGlowing[name] = {name, debuffType, spellId} parent.buffFramesGlowing[spellId] = {name, debuffType, spellId} end -local function CompactUnitFrame_Util_IsBossAura(...) - return select(12, ...) +local function CompactUnitFrame_Util_IsBossAura(aura) + return aura.isBossAura end -function KHMRaidFrames:CompactUnitFrame_Util_ShouldDisplayDebuff(...) - local name, icon, count, debuffType, duration, expirationTime, unitCaster, canStealOrPurge, _, spellId, canApplyAura, isBossAura = ... - - if not self:FilterAuras(name, debuffType, spellId, "debuffFrames") then +function KHMRaidFrames:CompactUnitFrame_Util_ShouldDisplayDebuff(aura) + + if not self:FilterAuras(aura.name, aura.dispelName, aura.spellId, "debuffFrames") then return false end - - if self:AdditionalAura(name, debuffType, spellId, unitCaster) then + + if self:AdditionalAura(aura.name, aura.dispelName, aura.spellId, aura.unitCaster) then return true end - - local hasCustom, alwaysShowMine, showForMySpec = SpellGetVisibilityInfo(spellId, UnitAffectingCombat("player") and "RAID_INCOMBAT" or "RAID_OUTOFCOMBAT") + + local hasCustom, alwaysShowMine, showForMySpec = SpellGetVisibilityInfo(aura.spellId, UnitAffectingCombat("player") and "RAID_INCOMBAT" or "RAID_OUTOFCOMBAT") if ( hasCustom ) then - return showForMySpec or (alwaysShowMine and (unitCaster == "player" or unitCaster == "pet" or unitCaster == "vehicle") ) --Would only be "mine" in the case of something like forbearance. + return showForMySpec or (alwaysShowMine and (aura.sourceUnit == "player" or aura.sourceUnit == "pet" or aura.sourceUnit == "vehicle") ) --Would only be "mine" in the case of something like forbearance. else return true end end -function KHMRaidFrames:CompactUnitFrame_UtilShouldDisplayBuff(...) - local name, icon, count, debuffType, duration, expirationTime, unitCaster, canStealOrPurge, _, spellId, canApplyAura = ... - - if not self:FilterAuras(name, debuffType, spellId, "buffFrames") then +function KHMRaidFrames:CompactUnitFrame_UtilShouldDisplayBuff(aura) + + if not self:FilterAuras(aura.name, aura.dispelName, aura.spellId, "buffFrames") then return false end - - if self:AdditionalAura(name, debuffType, spellId, unitCaster) then + + if self:AdditionalAura(aura.name, aura.dispelName, aura.spellId, aura.sourceUnit) then return true end - - local hasCustom, alwaysShowMine, showForMySpec = SpellGetVisibilityInfo(spellId, UnitAffectingCombat("player") and "RAID_INCOMBAT" or "RAID_OUTOFCOMBAT") - + + local hasCustom, alwaysShowMine, showForMySpec = SpellGetVisibilityInfo(aura.spellId, UnitAffectingCombat("player") and "RAID_INCOMBAT" or "RAID_OUTOFCOMBAT") + if ( hasCustom ) then - return showForMySpec or (alwaysShowMine and (unitCaster == "player" or unitCaster == "pet" or unitCaster == "vehicle")) + return showForMySpec or (alwaysShowMine and (aura.sourceUnit == "player" or aura.sourceUnit == "pet" or aura.sourceUnit == "vehicle")) else - return (unitCaster == "player" or unitCaster == "pet" or unitCaster == "vehicle") and canApplyAura and not SpellIsSelfBuff(spellId) + return (aura.sourceUnit == "player" or aura.sourceUnit == "pet" or aura.sourceUnit == "vehicle") and aura.canApplyAura and not SpellIsSelfBuff(aura.spellId) end end @@ -231,18 +229,18 @@ end function KHMRaidFrames:SetDebuffsHelper(debuffFrames, frameNum, maxDebuffs, filter, isBossAura, isBossBuff, auras) if auras then for i = 1,#auras do - local aura = auras[i] + local index = auras[i][1] + local aura = auras[i][2] if frameNum > maxDebuffs then break end local debuffFrame = debuffFrames[frameNum] - local index, name, icon, count, debuffType, duration, expirationTime, unitCaster, canStealOrPurge, nameplateShowPersonal, spellId = aura[1], aura[2], aura[3], aura[4], aura[5], aura[6], aura[7], aura[8], aura[9], aura[10], aura[11] - - if self:FilterAuras(name, debuffType, spellId, "debuffFrames") then + + if self:FilterAuras(aura.name, aura.dispelName, aura.spellId, "debuffFrames") then local unit = nil - self:CompactUnitFrame_UtilSetDebuff(debuffFrame, unit, index, "HARMFUL", isBossAura, isBossBuff, name, icon, count, debuffType, duration, expirationTime, unitCaster, canStealOrPurge, nameplateShowPersonal, spellId) + self:CompactUnitFrame_UtilSetDebuff(debuffFrame, unit, index, "HARMFUL", isBossAura, isBossBuff, aura) frameNum = frameNum + 1 - + if not self.db.profile[IsInRaid() and "raid" or "party"].debuffFrames.smartAnchoring then if isBossAura then --Boss auras are about twice as big as normal debuffs, so we may need to display fewer buffs @@ -264,96 +262,100 @@ local dispellableDebuffTypes = { Magic = true, Curse = true, Disease = true, Poi function KHMRaidFrames:CompactUnitFrame_UpdateAuras(frame) if self.SkipFrame(frame) then return end - + frame.buffFramesGlowing = {} frame.debuffFramesGlowing = {} - + local db = self:GroupTypeDB() - + local maxBuffs = min(db.buffFrames.num, #frame.buffFrames) or 3 local maxDebuffs = min(db.debuffFrames.num, #frame.debuffFrames) or 3 local maxDispelDebuffs = min(db.dispelDebuffFrames.num, #frame.dispelDebuffFrames) or 3 - + local doneWithBuffs = not frame.buffFrames or not frame.optionTable.displayBuffs or maxBuffs == 0 local doneWithDebuffs = not frame.debuffFrames or not frame.optionTable.displayDebuffs or maxDebuffs == 0 local doneWithDispelDebuffs = not frame.dispelDebuffFrames or not frame.optionTable.displayDispelDebuffs or maxDispelDebuffs == 0 - + local numUsedBuffs = 0 local numUsedDebuffs = 0 local numUsedDispelDebuffs = 0 - + local displayOnlyDispellableDebuffs = frame.optionTable.displayOnlyDispellableDebuffs - + -- The following is the priority order for debuffs local bossDebuffs, bossBuffs, priorityDebuffs, nonBossDebuffs local index = 1 local batchCount = maxDebuffs - + if not doneWithDebuffs then AuraUtil.ForEachAura(frame.displayedUnit, "HARMFUL", batchCount, function(...) - if db.debuffFrames.showBigDebuffs and CompactUnitFrame_Util_IsBossAura(...) then - if not bossDebuffs then - bossDebuffs = {} - end - tinsert(bossDebuffs, {index, ...}) - numUsedDebuffs = numUsedDebuffs + 1 - if numUsedDebuffs == maxDebuffs then - doneWithDebuffs = true - return true - end - elseif db.frames.showBigDebuffs and CompactUnitFrame_Util_IsPriorityDebuff(...) then - if not priorityDebuffs then - priorityDebuffs = {} - end - tinsert(priorityDebuffs, {index, ...}) - elseif not displayOnlyDispellableDebuffs and self:CompactUnitFrame_Util_ShouldDisplayDebuff(...) then - if not nonBossDebuffs then - nonBossDebuffs = {} - end - tinsert(nonBossDebuffs, {index, ...}) - end - - index = index + 1 - return false - end) - end - - if not doneWithBuffs or not doneWithDebuffs then - index = 1 - batchCount = math.max(maxBuffs, maxDebuffs) - AuraUtil.ForEachAura(frame.displayedUnit, "HELPFUL", batchCount, function(...) - if db.debuffFrames.showBigDebuffs and CompactUnitFrame_Util_IsBossAura(...) then - -- Boss Auras are considered Debuffs for our purposes. - if not doneWithDebuffs then - if not bossBuffs then - bossBuffs = {} + local aura = ... + + if db.debuffFrames.showBigDebuffs and CompactUnitFrame_Util_IsBossAura(aura) then + if not bossDebuffs then + bossDebuffs = {} end - tinsert(bossBuffs, {index, ...}) + tinsert(bossDebuffs, {index, aura}) numUsedDebuffs = numUsedDebuffs + 1 if numUsedDebuffs == maxDebuffs then doneWithDebuffs = true + return true + end + elseif db.frames.showBigDebuffs and CompactUnitFrame_Util_IsPriorityDebuff(aura.spellId) then + if not priorityDebuffs then + priorityDebuffs = {} + end + tinsert(priorityDebuffs, {index, aura}) + elseif not displayOnlyDispellableDebuffs and self:CompactUnitFrame_Util_ShouldDisplayDebuff(aura) then + if not nonBossDebuffs then + nonBossDebuffs = {} end + tinsert(nonBossDebuffs, {index, aura}) end - elseif self:CompactUnitFrame_UtilShouldDisplayBuff(...) then - if not doneWithBuffs then - numUsedBuffs = numUsedBuffs + 1 - local buffFrame = frame.buffFrames[numUsedBuffs] - self:CompactUnitFrame_UtilSetBuff(buffFrame, index, ...) - if numUsedBuffs == maxBuffs then - doneWithBuffs = true + + index = index + 1 + return false + end, true) + end + + if not doneWithBuffs or not doneWithDebuffs then + index = 1 + batchCount = math.max(maxBuffs, maxDebuffs) + AuraUtil.ForEachAura(frame.displayedUnit, AuraUtil.CreateFilterString(AuraUtil.AuraFilters.Helpful), batchCount, function(...) + local aura = ... + + if db.debuffFrames.showBigDebuffs and CompactUnitFrame_Util_IsBossAura(aura) then + -- Boss Auras are considered Debuffs for our purposes. + if not doneWithDebuffs then + if not bossBuffs then + bossBuffs = {} + end + tinsert(bossBuffs, {index, aura}) + numUsedDebuffs = numUsedDebuffs + 1 + if numUsedDebuffs == maxDebuffs then + doneWithDebuffs = true + end + end + elseif self:CompactUnitFrame_UtilShouldDisplayBuff(aura) then + if not doneWithBuffs then + numUsedBuffs = numUsedBuffs + 1 + local buffFrame = frame.buffFrames[numUsedBuffs] + self:CompactUnitFrame_UtilSetBuff(buffFrame, index, aura) + if numUsedBuffs == maxBuffs then + doneWithBuffs = true + end end end - end - index = index + 1 - return doneWithBuffs and doneWithDebuffs - end) + index = index + 1 + return doneWithBuffs and doneWithDebuffs + end, true) end - + numUsedDebuffs = math.min(maxDebuffs, numUsedDebuffs + NumElements(priorityDebuffs)) if numUsedDebuffs == maxDebuffs then doneWithDebuffs = true end - + if not doneWithDispelDebuffs then --Clear what we currently have for dispellable debuffs for debuffType, display in pairs(dispellableDebuffTypes) do @@ -362,43 +364,45 @@ function KHMRaidFrames:CompactUnitFrame_UpdateAuras(frame) end end end - + if not doneWithDispelDebuffs or not doneWithDebuffs then batchCount = math.max(maxDebuffs, maxDispelDebuffs) index = 1 AuraUtil.ForEachAura(frame.displayedUnit, "HARMFUL|RAID", batchCount, function(...) - if not doneWithDebuffs and displayOnlyDispellableDebuffs then - if self:CompactUnitFrame_Util_ShouldDisplayDebuff(...) and not CompactUnitFrame_Util_IsBossAura(...) and not CompactUnitFrame_Util_IsPriorityDebuff(...) then - if not nonBossDebuffs then - nonBossDebuffs = {} - end - tinsert(nonBossDebuffs, {index, ...}) - numUsedDebuffs = numUsedDebuffs + 1 - if numUsedDebuffs == maxDebuffs then - doneWithDebuffs = true + local aura = ... + + if not doneWithDebuffs and displayOnlyDispellableDebuffs then + if self:CompactUnitFrame_Util_ShouldDisplayDebuff(aura) and not CompactUnitFrame_Util_IsBossAura(aura) and not CompactUnitFrame_Util_IsPriorityDebuff(aura.spellId) then + if not nonBossDebuffs then + nonBossDebuffs = {} + end + tinsert(nonBossDebuffs, {index, aura}) + numUsedDebuffs = numUsedDebuffs + 1 + if numUsedDebuffs == maxDebuffs then + doneWithDebuffs = true + end end end - end - if not doneWithDispelDebuffs then - local debuffType = select(4, ...) - if ( dispellableDebuffTypes[debuffType] and not frame["hasDispel"..debuffType] ) then - frame["hasDispel"..debuffType] = true - numUsedDispelDebuffs = numUsedDispelDebuffs + 1 - local dispellDebuffFrame = frame.dispelDebuffFrames[numUsedDispelDebuffs] - CompactUnitFrame_UtilSetDispelDebuff(dispellDebuffFrame, {dispelName=debuffType, auraInstanceID=index}) - if numUsedDispelDebuffs == maxDispelDebuffs then - doneWithDispelDebuffs = true + if not doneWithDispelDebuffs then + local debuffType = aura.dispelName + if (dispellableDebuffTypes[debuffType] and not frame["hasDispel"..debuffType] ) then + frame["hasDispel"..debuffType] = true + numUsedDispelDebuffs = numUsedDispelDebuffs + 1 + local dispellDebuffFrame = frame.dispelDebuffFrames[numUsedDispelDebuffs] + CompactUnitFrame_UtilSetDispelDebuff(dispellDebuffFrame, {dispelName=debuffType, auraInstanceID=aura.auraInstanceID}) + if numUsedDispelDebuffs == maxDispelDebuffs then + doneWithDispelDebuffs = true + end end end - end - index = index + 1 - return (doneWithDebuffs or not displayOnlyDispellableDebuffs) and doneWithDispelDebuffs - end) + index = index + 1 + return (doneWithDebuffs or not displayOnlyDispellableDebuffs) and doneWithDispelDebuffs + end, true) end - + local frameNum = 1 local maxDebuffs = maxDebuffs - + do local isBossAura = true local isBossBuff = false @@ -420,18 +424,18 @@ function KHMRaidFrames:CompactUnitFrame_UpdateAuras(frame) frameNum, maxDebuffs = self:SetDebuffsHelper(frame.debuffFrames, frameNum, maxDebuffs, "HARMFUL|RAID", isBossAura, isBossBuff, nonBossDebuffs) end numUsedDebuffs = frameNum - 1 - + self:CompactUnitFrame_HideAllBuffs(frame, numUsedBuffs + 1, self.db.profile.glows.auraGlow) self:CompactUnitFrame_HideAllDebuffs(frame, numUsedDebuffs + 1, self.db.profile.glows.auraGlow) CompactUnitFrame_HideAllDispelDebuffs(frame, numUsedDispelDebuffs + 1) - + local groupType = IsInRaid() and "raid" or "party" - + if self.db.profile[groupType].debuffFrames.showBigDebuffs then if self.db.profile[groupType].debuffFrames.smartAnchoring then self:SmartAnchoring(frame, IsInRaid() and "raid" or "party") end - + if self.db.profile.Masque then for _, _frame in pairs(frame.debuffFrames) do if _frame:IsShown() then @@ -440,13 +444,13 @@ function KHMRaidFrames:CompactUnitFrame_UpdateAuras(frame) end end end - + local db = self.db.profile.glows.frameGlow - + if db.buffFrames.enabled then for aura, auras in pairs(frame.buffFramesGlowing) do local name, debuffType, spellId = auras[1], auras[2], auras[3] - + if self:TrackAuras(name, debuffType, spellId, self.db.profile.glows.frameGlow.buffFrames.tracking) then local color = db.buffFrames.useDefaultsColors and db.defaultColors[debuffType] self.StartGlow(frame, db.buffFrames, color, "buffFrames", "frameGlow") @@ -455,11 +459,11 @@ function KHMRaidFrames:CompactUnitFrame_UpdateAuras(frame) end end end - + if db.debuffFrames.enabled then for aura, auras in pairs(frame.debuffFramesGlowing) do local name, debuffType, spellId = auras[1], auras[2], auras[3] - + if self:TrackAuras(name, debuffType, spellId, self.db.profile.glows.frameGlow.debuffFrames.tracking) then local color = db.debuffFrames.useDefaultsColors and db.defaultColors[debuffType] self.StartGlow(frame, db.debuffFrames, color, "debuffFrames", "frameGlow") @@ -468,7 +472,7 @@ function KHMRaidFrames:CompactUnitFrame_UpdateAuras(frame) end end end - + self.StopGlow(frame, db.debuffFrames, "debuffFrames", "frameGlow") self.StopGlow(frame, db.buffFrames, "buffFrames", "frameGlow") end @@ -481,27 +485,27 @@ function KHMRaidFrames.CompactUnitFrame_UpdateRoleIcon(frame) if not frame.roleIcon or not frame.unit then return end - + frame.roleIcon:ClearAllPoints() frame.roleIcon:SetPoint("TOPLEFT", 3, -2) frame.roleIcon:SetSize(12, 12) - + if IsInGroup() then frame.roleIcon:Show() end - + KHMRaidFrames.CompactUnitFrame_UpdateRoleIconTexture(frame) end function KHMRaidFrames.CompactUnitFrame_UpdateRoleIconTexture(frame) CompactUnitFrame_UpdateRoleIcon(frame) - + frame.roleIcon:SetVertexColor(1, 1, 1, 1) end function KHMRaidFrames.RevertRoleIcon() for frame in KHMRaidFrames.IterateCompactFrames() do - + if frame.unit then KHMRaidFrames.CompactUnitFrame_UpdateRoleIcon(frame) end @@ -520,18 +524,18 @@ function KHMRaidFrames.CompactUnitFrame_UpdateReadyCheck(frame) if not frame.readyCheckIcon or frame.readyCheckDecay and GetReadyCheckTimeLeft() <= 0 or not frame.unit then return end - + local readyCheckSize = 15 * KHMRaidFrames.componentScale(IsInRaid() and "raid" or "party") frame.readyCheckIcon:ClearAllPoints(); frame.readyCheckIcon:SetPoint("BOTTOM", frame, "BOTTOM", 0, frame:GetHeight() / 3 - 4) frame.readyCheckIcon:SetSize(readyCheckSize, readyCheckSize) - + KHMRaidFrames.CompactUnitFrame_UpdateReadyCheckTexture(frame) end function KHMRaidFrames.CompactUnitFrame_UpdateReadyCheckTexture(frame) CompactUnitFrame_UpdateReadyCheck(frame) - + frame.readyCheckIcon:SetVertexColor(1, 1, 1, 1) end @@ -553,18 +557,18 @@ end function KHMRaidFrames.CompactUnitFrame_UpdateCenterStatusIcon(frame) if not frame.unit or not frame.centerStatusIcon then return end - + local size = 11 * KHMRaidFrames.componentScale(IsInRaid() and "raid" or "party") * 2 frame.centerStatusIcon:ClearAllPoints() frame.centerStatusIcon:SetPoint("CENTER", frame, "BOTTOM", 0, frame:GetHeight() / 3 + 2) frame.centerStatusIcon:SetSize(size, size) - + KHMRaidFrames.CompactUnitFrame_UpdateCenterStatusIconTexture(frame) end function KHMRaidFrames.CompactUnitFrame_UpdateCenterStatusIconTexture(frame) CompactUnitFrame_UpdateCenterStatusIcon(frame) - + frame.centerStatusIcon.texture:SetVertexColor(1, 1, 1, 1) end @@ -596,19 +600,19 @@ end function KHMRaidFrames.CompactUnitFrame_UpdateName(frame) frame.name:SetFont(SharedMedia:Fetch("font", KHMRaidFrames.font), 11) - + frame.name:ClearAllPoints() - + if KHMRaidFrames.db.profile[IsInRaid() and "raid" or "party"].nameAndIcons.roleIcon.enabled then frame.name:SetPoint("TOPLEFT", frame, "TOPLEFT", 0, -1) else frame.name:SetPoint("TOPLEFT", frame.roleIcon, "TOPRIGHT", 0, -1) end - + frame.name:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -3, -3) frame.name:SetJustifyH("LEFT") frame.name:SetVertexColor(1.0, 1.0, 1.0) - + CompactUnitFrame_UpdateName(frame) end @@ -632,7 +636,7 @@ end function KHMRaidFrames.ReverseHealthBarColors() local br, bg, bb = unpack(KHMRaidFrames:Defaults().profile.party.frames.backGroundColor) - + for frame in KHMRaidFrames.IterateCompactFrames() do if frame.healthBar.r ~= nil then frame.healthBar:SetStatusBarColor(frame.healthBar.r, frame.healthBar.g, frame.healthBar.b) From a81510cb4fc6e8571a5f3f1130a16c6c629fa273 Mon Sep 17 00:00:00 2001 From: httpsx Date: Tue, 25 Apr 2023 07:01:45 +0500 Subject: [PATCH 2/4] auraInstanceID update set auraInstanceID for debuffs. --- BlizzardCode.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/BlizzardCode.lua b/BlizzardCode.lua index 9754e29..02dfd31 100755 --- a/BlizzardCode.lua +++ b/BlizzardCode.lua @@ -42,6 +42,7 @@ function KHMRaidFrames:CompactUnitFrame_UtilSetDebuff(debuffFrame, unit, index, debuffFrame.count:Hide() end debuffFrame:SetID(index) + debuffFrame.auraInstanceID = aura.auraInstanceID; local enabled = aura.expirationTime and aura.expirationTime ~= 0 if enabled then local startTime = aura.expirationTime - aura.duration From b97e229a4ad82bfb0098977b50df2001377c72b7 Mon Sep 17 00:00:00 2001 From: httpsx Date: Tue, 25 Apr 2023 07:21:13 +0500 Subject: [PATCH 3/4] toc update --- KHMRaidFrames.toc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KHMRaidFrames.toc b/KHMRaidFrames.toc index 01923d7..cbda25c 100755 --- a/KHMRaidFrames.toc +++ b/KHMRaidFrames.toc @@ -1,7 +1,7 @@ -## Interface: 100002 +## Interface: 100007 ## Title: KHM Raid Frames ## Notes: Extended Standart Raid\Party Frames -## Version: 1.3.4 +## Version: 1.3.5 ## Author: kvirtx ## SavedVariables: KHMRaidFramesDB ## SavedVariablesPerCharacter: KHMRaidFrames_SyncProfiles From 6a1eaed88ee2a0039103feeaa85b7c6f82bb3799 Mon Sep 17 00:00:00 2001 From: httpsx Date: Wed, 3 May 2023 04:43:07 +0500 Subject: [PATCH 4/4] Fix cache frame colors frame.healthBar always {0,1,0} You can get current color with frame:GetStatusBarColor() --- KHMRaidFrames.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/KHMRaidFrames.lua b/KHMRaidFrames.lua index 0fb673c..8d2f7a2 100755 --- a/KHMRaidFrames.lua +++ b/KHMRaidFrames.lua @@ -204,9 +204,10 @@ function KHMRaidFrames:CompactUnitFrame_UpdateHealthColorInternal(frame, groupTy end local cache = self.coloredFrames[name] + local fR, fG, fB, fA = frame.healthBar:GetStatusBarColor() if not self.useClassColors then - if frame.healthBar.r ~= cache.health.r or frame.healthBar.g ~= cache.health.g or frame.healthBar.b ~= cache.health.b then + if fR ~= cache.health.r or fG ~= cache.health.g or fB ~= cache.health.b then if frame.unit and not UnitIsConnected(frame.unit) then r, g, b = 0.5, 0.5, 0.5 elseif CompactUnitFrame_IsTapDenied(frame) then @@ -215,15 +216,14 @@ function KHMRaidFrames:CompactUnitFrame_UpdateHealthColorInternal(frame, groupTy r, g, b = db.color[1], db.color[2], db.color[3] end - frame.healthBar:SetStatusBarColor(r, g, b) - - self.coloredFrames[name].health = { - r=frame.healthBar.r, - g=frame.healthBar.g, - b=frame.healthBar.b, + frame.healthBar:SetStatusBarColor(r, g, b) + self.coloredFrames[name].health = { + r=r, + g=g, + b=b, } end - end + end end --