diff --git a/LunaUnitFrames.lua b/LunaUnitFrames.lua index 317c57a0..724bfa81 100644 --- a/LunaUnitFrames.lua +++ b/LunaUnitFrames.lua @@ -2,11 +2,7 @@ LunaUF = AceLibrary("AceAddon-2.0"):new("AceEvent-2.0", "AceConsole-2.0", "AceDB LunaUF:RegisterDB("LunaDB") -- Assets ---------------------------------------------------------------------------------- -<<<<<<< HEAD LunaUF.Version = 2009 -======= -LunaUF.Version = 2008 ->>>>>>> origin/master LunaUF.BS = AceLibrary("Babble-Spell-2.2") LunaUF.Banzai = AceLibrary("Banzai-1.0") LunaUF.HealComm = AceLibrary("HealComm-1.0") diff --git a/locales/enUS.lua b/locales/enUS.lua index 6d882d40..08d8a22a 100644 --- a/locales/enUS.lua +++ b/locales/enUS.lua @@ -163,6 +163,7 @@ local function enUS() return { ["Tags"] = "Tags", ["healthBar"] = "Health Bar", ["powerBar"] = "Power Bar", +["Hide when not Mana"] = "Hide when not Mana", ["castBar"] = "Cast Bar", ["Barorder"] = "Barorder", ["Growth"] = "Growth", @@ -257,6 +258,7 @@ local function enUS() return { ["XP Bar"] = "XP Bar", ["Frame background"] = "Frame background", ["Color"] = "Color", +["Enable Border Color"] = "Enable Border Color", ["Enable Timer Text"] = "Enable Timer Text", ["Small font size"] = "Small font size", ["Big font size"] = "Big font size", diff --git a/modules/Options.lua b/modules/Options.lua index 70c5d4cb..3eadc036 100644 --- a/modules/Options.lua +++ b/modules/Options.lua @@ -472,7 +472,7 @@ local function CreateBarOrderWidget(parent, config) local frame = this:GetParent() if not frame.selectedID then return end local config = frame.config - if frame.selectedID < frame.numhBars then + if frame.selectedID <= frame.numhBars then return else if frame.selectedID == frame.numhBars+1 then @@ -648,6 +648,7 @@ function LunaUF:LoadOptions() LunaOptionsFrame.pages[i].invertHealth:SetChecked(LunaUF.db.profile.units[unit].healthBar.invert) LunaOptionsFrame.pages[i].vertHealth:SetChecked(LunaUF.db.profile.units[unit].healthBar.vertical) LunaOptionsFrame.pages[i].enablePower:SetChecked(LunaUF.db.profile.units[unit].powerBar.enabled) + LunaOptionsFrame.pages[i].hidePower:SetChecked(LunaUF.db.profile.units[unit].powerBar.hide) LunaOptionsFrame.pages[i].powersizeslider:SetValue(LunaUF.db.profile.units[unit].powerBar.size) LunaOptionsFrame.pages[i].invertPower:SetChecked(LunaUF.db.profile.units[unit].powerBar.invert) LunaOptionsFrame.pages[i].vertPower:SetChecked(LunaUF.db.profile.units[unit].powerBar.vertical) @@ -657,6 +658,7 @@ function LunaUF:LoadOptions() LunaOptionsFrame.pages[i].enableheal:SetChecked(LunaUF.db.profile.units[unit].incheal.enabled) LunaOptionsFrame.pages[i].healsizeslider:SetValue(LunaUF.db.profile.units[unit].incheal.cap*100) LunaOptionsFrame.pages[i].enableauras:SetChecked(LunaUF.db.profile.units[unit].auras.enabled) + LunaOptionsFrame.pages[i].enablebordercolor:SetChecked(LunaUF.db.profile.units[unit].auras.bordercolor) SetDropDownValue(LunaOptionsFrame.pages[i].auraposition,LunaUF.db.profile.units[unit].auras.position) LunaOptionsFrame.pages[i].aurasizeslider:SetValue(17-LunaUF.db.profile.units[unit].auras.AurasPerRow) if (unit == "player") then @@ -1852,7 +1854,22 @@ function LunaUF:CreateOptionsMenu() end end end) - getglobal("Enable"..LunaUF.unitList[i-1].."Power".."Text"):SetText(L["Enable"]) + getglobal("Enable"..LunaUF.unitList[i-1].."PowerText"):SetText(L["Enable"]) + + LunaOptionsFrame.pages[i].hidePower = CreateFrame("CheckButton", "Hide"..LunaUF.unitList[i-1].."Power", LunaOptionsFrame.pages[i], "UICheckButtonTemplate") + LunaOptionsFrame.pages[i].hidePower:SetPoint("TOPLEFT", LunaOptionsFrame.pages[i].powerheader, "BOTTOMLEFT", 80, -10) + LunaOptionsFrame.pages[i].hidePower:SetHeight(30) + LunaOptionsFrame.pages[i].hidePower:SetWidth(30) + LunaOptionsFrame.pages[i].hidePower:SetScript("OnClick", function() + local unit = this:GetParent().id + LunaUF.db.profile.units[unit].powerBar.hide = not LunaUF.db.profile.units[unit].powerBar.hide + for _,frame in pairs(LunaUF.Units.frameList) do + if frame.unitGroup == unit then + LunaUF.Units:SetupFrameModules(frame) + end + end + end) + getglobal("Hide"..LunaUF.unitList[i-1].."PowerText"):SetText(L["Hide when not Mana"]) LunaOptionsFrame.pages[i].powersizeslider = CreateFrame("Slider", "PowerSizeSlider"..LunaUF.unitList[i-1], LunaOptionsFrame.pages[i], "OptionsSliderTemplate") LunaOptionsFrame.pages[i].powersizeslider:SetMinMaxValues(1,10) @@ -2060,9 +2077,24 @@ function LunaUF:CreateOptionsMenu() LunaOptionsFrame.pages[i].aurasizeslider:SetPoint("TOPLEFT", LunaOptionsFrame.pages[i].auraheader, "BOTTOMLEFT", 280, -10) LunaOptionsFrame.pages[i].aurasizeslider:SetWidth(190) + LunaOptionsFrame.pages[i].enablebordercolor = CreateFrame("CheckButton", "Enable"..LunaUF.unitList[i-1].."BorderColor", LunaOptionsFrame.pages[i], "UICheckButtonTemplate") + LunaOptionsFrame.pages[i].enablebordercolor:SetPoint("TOPLEFT", LunaOptionsFrame.pages[i].auraheader, "BOTTOMLEFT", 0, -50) + LunaOptionsFrame.pages[i].enablebordercolor:SetHeight(30) + LunaOptionsFrame.pages[i].enablebordercolor:SetWidth(30) + LunaOptionsFrame.pages[i].enablebordercolor:SetScript("OnClick", function() + local unit = this:GetParent().id + LunaUF.db.profile.units[unit].auras.bordercolor = not LunaUF.db.profile.units[unit].auras.bordercolor + for _,frame in pairs(LunaUF.Units.frameList) do + if frame.unitGroup == unit then + LunaUF.Units.FullUpdate(frame) + end + end + end) + getglobal("Enable"..LunaUF.unitList[i-1].."BorderColorText"):SetText(L["Enable Border Color"]) + if (LunaUF.unitList[i-1] == "player") then LunaOptionsFrame.pages[i].enableaurastimertext = CreateFrame("CheckButton", "Enable"..LunaUF.unitList[i-1].."AurasTimerText", LunaOptionsFrame.pages[i], "UICheckButtonTemplate") - LunaOptionsFrame.pages[i].enableaurastimertext:SetPoint("TOPLEFT", LunaOptionsFrame.pages[i].enableauras, "BOTTOMLEFT", 0, -10) + LunaOptionsFrame.pages[i].enableaurastimertext:SetPoint("TOPLEFT", LunaOptionsFrame.pages[i].enablebordercolor, "BOTTOMLEFT", 0, -10) LunaOptionsFrame.pages[i].enableaurastimertext:SetHeight(30) LunaOptionsFrame.pages[i].enableaurastimertext:SetWidth(30) LunaOptionsFrame.pages[i].enableaurastimertext:SetScript("OnClick", function() @@ -2125,7 +2157,7 @@ function LunaUF:CreateOptionsMenu() end LunaOptionsFrame.pages[i].tagheader = LunaOptionsFrame.pages[i]:CreateFontString(nil, "OVERLAY", "GameFontHighlight") - LunaOptionsFrame.pages[i].tagheader:SetPoint("TOPLEFT", LunaOptionsFrame.pages[i].enableaurastimertext or LunaOptionsFrame.pages[i].auraheader, "BOTTOMLEFT", 0, -60) + LunaOptionsFrame.pages[i].tagheader:SetPoint("TOPLEFT", LunaOptionsFrame.pages[i].enableaurastimertext or LunaOptionsFrame.pages[i].auraheader, "BOTTOMLEFT", 0, LunaOptionsFrame.pages[i].enableaurastimertext and -60 or -90) LunaOptionsFrame.pages[i].tagheader:SetHeight(24) LunaOptionsFrame.pages[i].tagheader:SetJustifyH("LEFT") LunaOptionsFrame.pages[i].tagheader:SetTextColor(1,1,0) diff --git a/modules/auras.lua b/modules/auras.lua index 3427ee76..4717a07c 100644 --- a/modules/auras.lua +++ b/modules/auras.lua @@ -52,7 +52,7 @@ local function BuffFrameUpdate(frame, buildOnly) local rows = math.ceil(numBuffs/config.AurasPerRow) local height = rows*auraframe.buffbuttons[1]:GetHeight()+rows auraframe:SetHeight(height == 0 and 1 or height) - local texture, stacks + local texture, stacks, dtype local currentEventTime = GetTime() for i,button in ipairs(auraframe.buffbuttons) do local buffIndex, untilCancelled @@ -112,13 +112,19 @@ local function BuffFrameUpdate(frame, buildOnly) if isPlayer then texture = GetPlayerBuffTexture(buffIndex); stacks = GetPlayerBuffApplications(buffIndex); + dtype = GetPlayerBuffDispelType(buffIndex) else - texture,stacks = UnitDebuff(unit,i) + texture,stacks,dtype = UnitDebuff(unit,i) end if texture then button.icon:SetTexture(texture) button.stack:SetText(stacks == 1 and "" or stacks) button.filter = "HARMFUL" + if dtype and config.bordercolor then + button.border:SetVertexColor(unpack(LunaUF.db.profile.magicColors[dtype])) + else + button.border:SetVertexColor(1,1,1) + end if isPlayer then button.auraID = buffIndex if not buildOnly then @@ -202,20 +208,17 @@ local function OnUpdate() timeString = timeL end end + button.timeFontstring:SetText(timeString) if centered then - button.timeFontstrings["CENTER"]:SetText(timeString) - button.timeFontstrings["TOP"]:SetText("") + button.timeFontstring:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextbigsize, "OUTLINE") else - button.timeFontstrings["CENTER"]:SetText("") - button.timeFontstrings["TOP"]:SetText(timeString) + button.timeFontstring:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextsmallsize, "OUTLINE") end else - button.timeFontstrings["CENTER"]:SetText("") - button.timeFontstrings["TOP"]:SetText("") + button.timeFontstring:SetText("") end else - button.timeFontstrings["CENTER"]:SetText("") - button.timeFontstrings["TOP"]:SetText("") + button.timeFontstring:SetText("") end end for i,button in ipairs(this.debuffbuttons) do @@ -242,20 +245,17 @@ local function OnUpdate() timeString = timeL end end + button.timeFontstring:SetText(timeString) if centered then - button.timeFontstrings["CENTER"]:SetText(timeString) - button.timeFontstrings["TOP"]:SetText("") + button.timeFontstring:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextbigsize, "OUTLINE") else - button.timeFontstrings["CENTER"]:SetText("") - button.timeFontstrings["TOP"]:SetText(timeString) + button.timeFontstring:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextsmallsize, "OUTLINE") end else - button.timeFontstrings["CENTER"]:SetText("") - button.timeFontstrings["TOP"]:SetText("") + button.timeFontstring:SetText("") end else - button.timeFontstrings["CENTER"]:SetText("") - button.timeFontstrings["TOP"]:SetText("") + button.timeFontstring:SetText("") end end if changed or FrameUpdateNeeded then @@ -293,13 +293,9 @@ function Auras:OnEnable(frame) button.textFrame = CreateFrame("Frame", nil, button) button.textFrame:SetAllPoints(button) button.textFrame:SetFrameLevel(button.cooldown:GetFrameLevel() + 1); - button.timeFontstrings = {} - button.timeFontstrings["TOP"] = button.textFrame:CreateFontString(nil, "OVERLAY"); - button.timeFontstrings["TOP"]:SetJustifyH("CENTER") - button.timeFontstrings["TOP"]:SetPoint("TOP", button.textFrame, "TOP",0,0) - button.timeFontstrings["CENTER"] = button.textFrame:CreateFontString(nil, "OVERLAY"); - button.timeFontstrings["CENTER"]:SetJustifyH("CENTER") - button.timeFontstrings["CENTER"]:SetPoint("CENTER", button.textFrame, "CENTER",0,0) + button.timeFontstring = button.textFrame:CreateFontString(nil, "OVERLAY"); + button.timeFontstring:SetJustifyH("CENTER") + button.timeFontstring:SetPoint("CENTER", button.textFrame, "CENTER",0,0) end button.stack = button:CreateFontString(nil, "OVERLAY") @@ -336,13 +332,9 @@ function Auras:OnEnable(frame) button.textFrame = CreateFrame("Frame", nil, button) button.textFrame:SetAllPoints(button) button.textFrame:SetFrameLevel(button.cooldown:GetFrameLevel() + 1); - button.timeFontstrings = {} - button.timeFontstrings["TOP"] = button.textFrame:CreateFontString(nil, "OVERLAY"); - button.timeFontstrings["TOP"]:SetJustifyH("CENTER") - button.timeFontstrings["TOP"]:SetPoint("TOP", button.textFrame, "TOP",0,0) - button.timeFontstrings["CENTER"] = button.textFrame:CreateFontString(nil, "OVERLAY"); - button.timeFontstrings["CENTER"]:SetJustifyH("CENTER") - button.timeFontstrings["CENTER"]:SetPoint("CENTER", button.textFrame, "CENTER",0,0) + button.timeFontstring = button.textFrame:CreateFontString(nil, "OVERLAY"); + button.timeFontstring:SetJustifyH("CENTER") + button.timeFontstring:SetPoint("CENTER", button.textFrame, "CENTER",0,0) end button.stack = button:CreateFontString(nil, "OVERLAY") @@ -430,9 +422,8 @@ function Auras:FullUpdate(frame) button.cooldown:SetPoint("TOPLEFT", button, "TOPLEFT", 0, 0) button.cooldown:SetScale((button:GetWidth() + 0.7)/36) end - if button.timeFontstrings then - button.timeFontstrings["TOP"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextsmallsize, "OUTLINE") - button.timeFontstrings["CENTER"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextbigsize, "OUTLINE") + if button.timeFontstring then + button.timeFontstring:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextsmallsize, "OUTLINE") end end for i,button in ipairs(frame.auras.debuffbuttons) do @@ -447,9 +438,8 @@ function Auras:FullUpdate(frame) button.cooldown:SetPoint("TOPLEFT", button, "TOPLEFT", 0, 0) button.cooldown:SetScale((button:GetWidth() + 0.7)/36) end - if button.timeFontstrings then - button.timeFontstrings["TOP"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextsmallsize, "OUTLINE") - button.timeFontstrings["CENTER"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextbigsize, "OUTLINE") + if button.timeFontstring then + button.timeFontstring:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextsmallsize, "OUTLINE") end end elseif config.position == "LEFT" then @@ -466,9 +456,8 @@ function Auras:FullUpdate(frame) button.cooldown:SetPoint("TOPLEFT", button, "TOPLEFT", 0, 0) button.cooldown:SetScale((button:GetWidth() + 0.7)/36) end - if button.timeFontstrings then - button.timeFontstrings["TOP"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextsmallsize, "OUTLINE") - button.timeFontstrings["CENTER"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextbigsize, "OUTLINE") + if button.timeFontstring then + button.timeFontstring:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextsmallsize, "OUTLINE") end end for i,button in ipairs(frame.auras.debuffbuttons) do @@ -483,9 +472,8 @@ function Auras:FullUpdate(frame) button.cooldown:SetPoint("TOPLEFT", button, "TOPLEFT", 0, 0) button.cooldown:SetScale((button:GetWidth() + 0.7)/36) end - if button.timeFontstrings then - button.timeFontstrings["TOP"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextsmallsize, "OUTLINE") - button.timeFontstrings["CENTER"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextbigsize, "OUTLINE") + if button.timeFontstring then + button.timeFontstring:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextsmallsize, "OUTLINE") end end else @@ -506,9 +494,8 @@ function Auras:FullUpdate(frame) button.cooldown:SetPoint("TOPLEFT", button, "TOPLEFT", 0, 0) button.cooldown:SetScale((button:GetWidth() + 0.7)/36) end - if button.timeFontstrings then - button.timeFontstrings["TOP"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextsmallsize, "OUTLINE") - button.timeFontstrings["CENTER"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextbigsize, "OUTLINE") + if button.timeFontstring then + button.timeFontstring:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextsmallsize, "OUTLINE") end end for i,button in ipairs(frame.auras.debuffbuttons) do @@ -523,9 +510,8 @@ function Auras:FullUpdate(frame) button.cooldown:SetPoint("TOPLEFT", button, "TOPLEFT", 0, 0) button.cooldown:SetScale((button:GetWidth() + 0.7)/36) end - if button.timeFontstrings then - button.timeFontstrings["TOP"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextsmallsize, "OUTLINE") - button.timeFontstrings["CENTER"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextbigsize, "OUTLINE") + if button.timeFontstring then + button.timeFontstring:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextsmallsize, "OUTLINE") end end end diff --git a/modules/incheal.lua b/modules/incheal.lua index f22b8a3b..8702d6f0 100644 --- a/modules/incheal.lua +++ b/modules/incheal.lua @@ -17,6 +17,7 @@ function Incheal:OnEnable(frame) frame.incheal.healBar = CreateFrame("StatusBar", nil, frame) frame.incheal.healBar:SetMinMaxValues(0,1) frame.incheal.healBar:SetValue(1) + frame.incheal.healBar:SetFrameLevel(5) end if not AceEvent:IsEventRegistered("HealComm_Healupdate") then AceEvent:RegisterEvent("HealComm_Healupdate", OnHeal) diff --git a/modules/power.lua b/modules/power.lua index 9a3d1e28..971e5422 100644 --- a/modules/power.lua +++ b/modules/power.lua @@ -49,13 +49,12 @@ local function OnEvent() if arg1 ~= this:GetParent().unit then return end if event == "UNIT_DISPLAYPOWER" then Power:UpdateColor(this:GetParent()) - Power:Update(this:GetParent()) else if this.ticker and (not this.ticker.startTime or UnitMana("player") > this.currentPower) then this.ticker.startTime = GetTime() end - Power:Update(this:GetParent()) end + Power:Update(this:GetParent()) end local function updatePower() @@ -159,6 +158,18 @@ function Power:UpdateColor(frame) end function Power:Update(frame) + if UnitPowerType(frame.unit) > 0 then + if LunaUF.db.profile.units[frame.unitGroup].powerBar.hide and not frame.powerBar.hidden then + frame.powerBar.hidden = true + LunaUF.Units:PositionWidgets(frame) + elseif not LunaUF.db.profile.units[frame.unitGroup].powerBar.hide and frame.powerBar.hidden then + frame.powerBar.hidden = nil + LunaUF.Units:PositionWidgets(frame) + end + elseif frame.powerBar.hidden then + frame.powerBar.hidden = nil + LunaUF.Units:PositionWidgets(frame) + end frame.powerBar.currentPower = UnitMana(frame.unit) frame.powerBar:SetMinMaxValues(0, UnitManaMax(frame.unit)) frame.powerBar:SetValue(UnitIsDeadOrGhost(frame.unit) and 0 or not UnitIsConnected(frame.unit) and 0 or frame.powerBar.currentPower)