From 4f7af02164d5a1e82ae2d8b115882771e60f16c8 Mon Sep 17 00:00:00 2001 From: Corey Russ Date: Wed, 9 Jan 2019 21:55:37 -0800 Subject: [PATCH] Update for oUF 9.0.1 This update is retroactive with oUF 8.0.2 Added support for enabling/disabling arena buffs/debuffs --- oUF_Farva/Farva.lua | 99 ++++++++++++++++------------- oUF_Farva/Farva_Config.lua | 2 + oUF_Farva/Farva_Tags.lua | 2 +- oUF_Farva/module/oUF_Experience.lua | 12 ++-- oUF_Farva/module/oUF_ThreatBar.lua | 8 +-- 5 files changed, 69 insertions(+), 54 deletions(-) diff --git a/oUF_Farva/Farva.lua b/oUF_Farva/Farva.lua index 0d61bcb..cc17773 100644 --- a/oUF_Farva/Farva.lua +++ b/oUF_Farva/Farva.lua @@ -1026,20 +1026,37 @@ end, self:Tag(htext, '[player:hp]') self.Power.value:SetPoint("TOPRIGHT", htext, "BOTTOMRIGHT", 0, -2) - local Auras = CreateFrame("Frame", nil, self) - Auras:SetHeight(cfg.heightPA) - Auras:SetPoint("TOPRIGHT", self, "TOPLEFT", 300, 30) - Auras.initialAnchor = "TOPLEFT" - Auras.size = cfg.BuffSize - Auras:SetWidth(Auras.size * 13) - Auras.gap = false - Auras.numBuffs = 8 - Auras.numDebuffs = 4 - Auras.spacing = 2 - Auras["growth-x"] = "RIGHT" - - Auras.PostCreateIcon = PostCreateIcon - self.Auras = Auras + if cfg.showArenaBuffs then + createBuffs(self) + self.Buffs:SetPoint("BOTTOMLEFT", self.Health, "TOPLEFT", 0, 4) + self.Buffs.initialAnchor = "BOTTOMLEFT" + self.Buffs["growth-x"] = "RIGHT" + self.Buffs["growth-y"] = "UP" + self.Buffs.num = 7 + self.Buffs.size = cfg.BuffSize + self.Buffs.spacing = 5 + self.Buffs:SetSize(cfg.widthPA, self.Buffs.size) + + if cfg.onlyShowPlayerBuffsFocus then + self.Buffs.onlyShowPlayer = true + end + end + + if cfg.showArenaDebuffs then + createDebuffs(self) + self.Debuffs:SetPoint("LEFT", self.Health, "LEFT", (cfg.DebuffSize*-1)-4, -3) + self.Debuffs.initialAnchor = "LEFT" + self.Debuffs["growth-x"] = "LEFT" + self.Debuffs["growth-y"] = "UP" + self.Debuffs.num = 6 + self.Debuffs.size = cfg.DebuffSize + self.Debuffs.spacing = 4 + self.Debuffs:SetSize(self.Debuffs.size*self.Debuffs.num+(self.Debuffs.spacing*self.Debuffs.num), self.Debuffs.size) + + if cfg.onlyShowPlayerDebuffsFocus then + self.Debuffs.onlyShowPlayer = true + end + end -- plugins SpellRange(self) @@ -1235,27 +1252,6 @@ local spawnHelper = function(self, unit, ...) end end -if cfg.ArenaFrames then -oUF:RegisterStyle('oUF_Farva_Arena', UnitSpecific.arenaframes) -oUF:SetActiveStyle('oUF_Farva_Arena') -local arena = {} -local arenatarget = {} - for i = 1, 5 do - arena[i] = oUF:Spawn("arena"..i, "oUF_Arena"..i) - if i == 1 then - arena[i]:SetPoint('LEFT', UIParent, 'LEFT', 250, -200) - else - arena[i]:SetPoint("BOTTOMRIGHT", arena[i-1], "TOPRIGHT", 0, 50) - end - end - -oUF:RegisterStyle("oUF_Farva_ArenaTarget", UnitSpecific.arenatargets) -oUF:SetActiveStyle("oUF_Farva_ArenaTarget") - for i = 1, 5 do - arenatarget[i] = oUF:Spawn("arena"..i.."target", "oUF_Arena"..i.."target"):SetPoint("TOPLEFT",arena[i], "TOPRIGHT", 8, 0) - end -end - oUF:Factory(function(self) local player = spawnHelper(self, 'player', "BOTTOM", -338, 233) spawnHelper(self, 'pet', "RIGHT", player, "LEFT", -10, 0) @@ -1264,9 +1260,33 @@ oUF:Factory(function(self) local focus = spawnHelper(self, 'focus', "CENTER", 360, -164) spawnHelper(self, 'focustarget', "CENTER", 436, -209) + local arena = {} + local arenatarget = {} + local spec = GetSpecialization() local class = UnitClass("Player") + if cfg.ArenaFrames then + self:RegisterStyle('oUF_Farva_Arena', UnitSpecific.arenaframes) + self:SetActiveStyle('oUF_Farva_Arena') + + for i = 1, 5 do + arena[i] = self:Spawn("arena"..i, "oUF_Arena"..i) + arena[i]:SetAttribute('oUF-enableArenaPrep', false) + + if i == 1 then + arena[i]:SetPoint('LEFT', UIParent, 'LEFT', 250, -200) + else + arena[i]:SetPoint("BOTTOMRIGHT", arena[i-1], "TOPRIGHT", 0, 50) + end + end + self:RegisterStyle("oUF_Farva_ArenaTarget", UnitSpecific.arenatargets) + self:SetActiveStyle("oUF_Farva_ArenaTarget") + for i = 1, 5 do + arenatarget[i] = self:Spawn("arena"..i.."target", "oUF_Arena"..i.."target"):SetPoint("TOPLEFT",arena[i], "TOPRIGHT", 8, 0) + end + end + if cfg.PartyFrames then local EventFrame = CreateFrame("Frame") EventFrame:RegisterEvent("PLAYER_TALENT_UPDATE") @@ -1352,6 +1372,7 @@ oUF:Factory(function(self) arenaprepupdate:RegisterEvent('ARENA_OPPONENT_UPDATE') arenaprepupdate:RegisterEvent('ARENA_PREP_OPPONENT_SPECIALIZATIONS') arenaprepupdate:SetScript('OnEvent', function(self, event) + if event == 'PLAYER_LOGIN' then for i = 1, 5 do arenaprep[i]:SetAllPoints(_G['oUF_Arena'..i]) @@ -1365,22 +1386,14 @@ oUF:Factory(function(self) if numOpps > 0 then for i = 1, 5 do local f = arenaprep[i] - if i <= numOpps then local s = GetArenaOpponentSpec(i) local _, spec, class = nil, 'UNKNOWN', 'UNKNOWN' - if s and s > 0 then _, spec, _, _, _, class = GetSpecializationInfoByID(s) end - if class and spec then - local color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class] - if cfg.class_colorbars and color then - f.Health:SetStatusBarColor(color.r, color.g, color.b) - else f.Health:SetStatusBarColor(40/255, 40/255, 40/255) - end f.Spec:SetText(spec..' - '..LOCALIZED_CLASS_NAMES_MALE[class]) f:Show() end diff --git a/oUF_Farva/Farva_Config.lua b/oUF_Farva/Farva_Config.lua index 3078e3f..137661e 100644 --- a/oUF_Farva/Farva_Config.lua +++ b/oUF_Farva/Farva_Config.lua @@ -135,6 +135,8 @@ cfg.texture = mediaFolder.."texture.tga" ----------- cfg.ArenaFrames = true -- enable/disable arena frames + cfg.showArenaBuffs = true -- enable/disable arena buffs + cfg.showArenaDebuffs = true -- enable/disable arena debuffs --------------- -- main tank -- diff --git a/oUF_Farva/Farva_Tags.lua b/oUF_Farva/Farva_Tags.lua index 4fef7de..d68d7d8 100644 --- a/oUF_Farva/Farva_Tags.lua +++ b/oUF_Farva/Farva_Tags.lua @@ -103,7 +103,7 @@ oUF.Tags.Events['tankdc'] = 'UNIT_CONNECTION' oUF.Tags.Methods['color'] = function(u, r) local reaction = UnitReaction(u, 'player') - if (UnitIsPlayer(u)) and not cfg.class_colorbars then + if (UnitIsPlayer(u)) then local _, class = UnitClass(u) return hex(oUF.colors.class[class]) elseif reaction and not (UnitIsPlayer(u)) then diff --git a/oUF_Farva/module/oUF_Experience.lua b/oUF_Farva/module/oUF_Experience.lua index 77b4952..4925ba5 100644 --- a/oUF_Farva/module/oUF_Experience.lua +++ b/oUF_Farva/module/oUF_Experience.lua @@ -149,13 +149,13 @@ end local function ElementEnable(self) local element = self.Experience - self:RegisterEvent('PLAYER_XP_UPDATE', Path) - self:RegisterEvent('HONOR_XP_UPDATE', Path) - self:RegisterEvent('ZONE_CHANGED', Path) - self:RegisterEvent('ZONE_CHANGED_NEW_AREA', Path) + self:RegisterEvent('PLAYER_XP_UPDATE', Path, true) + self:RegisterEvent('HONOR_XP_UPDATE', Path, true) + self:RegisterEvent('ZONE_CHANGED', Path, true) + self:RegisterEvent('ZONE_CHANGED_NEW_AREA', Path, true) if(element.Rested) then - self:RegisterEvent('UPDATE_EXHAUSTION', Path) + self:RegisterEvent('UPDATE_EXHAUSTION', Path, true) end element:Show() @@ -222,7 +222,7 @@ local function Enable(self, unit) element.restedAlpha = element.restedAlpha or 0.15 self:RegisterEvent('PLAYER_LEVEL_UP', VisibilityPath, true) - self:RegisterEvent('HONOR_LEVEL_UPDATE', VisibilityPath) + self:RegisterEvent('HONOR_LEVEL_UPDATE', VisibilityPath, true) self:RegisterEvent('DISABLE_XP_GAIN', VisibilityPath, true) self:RegisterEvent('ENABLE_XP_GAIN', VisibilityPath, true) diff --git a/oUF_Farva/module/oUF_ThreatBar.lua b/oUF_Farva/module/oUF_ThreatBar.lua index b757089..cdc9ebf 100644 --- a/oUF_Farva/module/oUF_ThreatBar.lua +++ b/oUF_Farva/module/oUF_ThreatBar.lua @@ -65,10 +65,10 @@ local function enable(self) bar:Hide() bar:SetMinMaxValues(0, bar.maxThreatVal or 100) - self:RegisterEvent("PLAYER_ENTERING_WORLD", OnEvent) - self:RegisterEvent("PLAYER_REGEN_ENABLED", OnEvent) - self:RegisterEvent("PLAYER_REGEN_DISABLED", OnEvent) - self:RegisterEvent("ZONE_CHANGED_NEW_AREA", OnEvent) + self:RegisterEvent("PLAYER_ENTERING_WORLD", OnEvent, true) + self:RegisterEvent("PLAYER_REGEN_ENABLED", OnEvent, true) + self:RegisterEvent("PLAYER_REGEN_DISABLED", OnEvent, true) + self:RegisterEvent("ZONE_CHANGED_NEW_AREA", OnEvent, true) bar:SetScript("OnUpdate", update)