Skip to content

Commit

Permalink
And the rest
Browse files Browse the repository at this point in the history
- Fixed duplicating of bars in order widget
- Option to hide non mana bars
- Option to color debuff borders
- Fixed incheal on inverted bars
  • Loading branch information
Aviana committed Nov 5, 2016
1 parent d966fd6 commit 66f01db
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 60 deletions.
4 changes: 0 additions & 4 deletions LunaUnitFrames.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 2 additions & 0 deletions locales/enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
40 changes: 36 additions & 4 deletions modules/Options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down
86 changes: 36 additions & 50 deletions modules/auras.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions modules/incheal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
15 changes: 13 additions & 2 deletions modules/power.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 66f01db

Please sign in to comment.