diff --git a/api/config.lua b/api/config.lua index 77a6b414..477ab051 100644 --- a/api/config.lua +++ b/api/config.lua @@ -103,11 +103,13 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("unitframes", nil, "clickcast_alt", "") pfUI:UpdateConfig("unitframes", nil, "clickcast_ctrl", "") - pfUI:UpdateConfig("unitframes", "player", "visible", "1") + pfUI:UpdateConfig("unitframes", "player", "visible", "1") pfUI:UpdateConfig("unitframes", "player", "portrait", "bar") pfUI:UpdateConfig("unitframes", "player", "width", "200") pfUI:UpdateConfig("unitframes", "player", "height", "50") pfUI:UpdateConfig("unitframes", "player", "pheight", "10") + pfUI:UpdateConfig("unitframes", "player", "pwidth", "-1") + pfUI:UpdateConfig("unitframes", "player", "panchor", "TOP") pfUI:UpdateConfig("unitframes", "player", "pspace", "-3") pfUI:UpdateConfig("unitframes", "player", "buffs", "top") pfUI:UpdateConfig("unitframes", "player", "buffsize", "20") @@ -143,6 +145,8 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("unitframes", "target", "width", "200") pfUI:UpdateConfig("unitframes", "target", "height", "50") pfUI:UpdateConfig("unitframes", "target", "pheight", "10") + pfUI:UpdateConfig("unitframes", "target", "pwidth", "-1") + pfUI:UpdateConfig("unitframes", "target", "panchor", "TOP") pfUI:UpdateConfig("unitframes", "target", "pspace", "-3") pfUI:UpdateConfig("unitframes", "target", "buffs", "top") pfUI:UpdateConfig("unitframes", "target", "buffsize", "20") @@ -175,6 +179,8 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("unitframes", "focus", "width", "120") pfUI:UpdateConfig("unitframes", "focus", "height", "34") pfUI:UpdateConfig("unitframes", "focus", "pheight", "4") + pfUI:UpdateConfig("unitframes", "focus", "pwidth", "-1") + pfUI:UpdateConfig("unitframes", "focus", "panchor", "TOP") pfUI:UpdateConfig("unitframes", "focus", "pspace", "-3") pfUI:UpdateConfig("unitframes", "focus", "buffs", "top") pfUI:UpdateConfig("unitframes", "focus", "buffsize", "12") @@ -206,6 +212,8 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("unitframes", "group", "width", "164") pfUI:UpdateConfig("unitframes", "group", "height", "32") pfUI:UpdateConfig("unitframes", "group", "pheight", "4") + pfUI:UpdateConfig("unitframes", "group", "pwidth", "-1") + pfUI:UpdateConfig("unitframes", "group", "panchor", "TOP") pfUI:UpdateConfig("unitframes", "group", "pspace", "-3") pfUI:UpdateConfig("unitframes", "group", "buffs", "bottom") pfUI:UpdateConfig("unitframes", "group", "buffsize", "8") @@ -238,6 +246,8 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("unitframes", "grouptarget", "width", "120") pfUI:UpdateConfig("unitframes", "grouptarget", "height", "16") pfUI:UpdateConfig("unitframes", "grouptarget", "pheight", "0") + pfUI:UpdateConfig("unitframes", "grouptarget", "pwidth", "-1") + pfUI:UpdateConfig("unitframes", "grouptarget", "panchor", "TOP") pfUI:UpdateConfig("unitframes", "grouptarget", "pspace", "-3") pfUI:UpdateConfig("unitframes", "grouptarget", "buffs", "off") pfUI:UpdateConfig("unitframes", "grouptarget", "buffsize", "16") @@ -269,6 +279,8 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("unitframes", "grouppet", "width", "100") pfUI:UpdateConfig("unitframes", "grouppet", "height", "14") pfUI:UpdateConfig("unitframes", "grouppet", "pheight", "0") + pfUI:UpdateConfig("unitframes", "grouppet", "pwidth", "-1") + pfUI:UpdateConfig("unitframes", "grouppet", "panchor", "TOP") pfUI:UpdateConfig("unitframes", "grouppet", "pspace", "-3") pfUI:UpdateConfig("unitframes", "grouppet", "buffs", "off") pfUI:UpdateConfig("unitframes", "grouppet", "buffsize", "16") @@ -300,6 +312,8 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("unitframes", "raid", "width", "50") pfUI:UpdateConfig("unitframes", "raid", "height", "26") pfUI:UpdateConfig("unitframes", "raid", "pheight", "4") + pfUI:UpdateConfig("unitframes", "raid", "pwidth", "-1") + pfUI:UpdateConfig("unitframes", "raid", "panchor", "TOP") pfUI:UpdateConfig("unitframes", "raid", "pspace", "-3") pfUI:UpdateConfig("unitframes", "raid", "buffs", "off") pfUI:UpdateConfig("unitframes", "raid", "buffsize", "16") @@ -331,6 +345,8 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("unitframes", "ttarget", "width", "100") pfUI:UpdateConfig("unitframes", "ttarget", "height", "20") pfUI:UpdateConfig("unitframes", "ttarget", "pheight", "3") + pfUI:UpdateConfig("unitframes", "ttarget", "pwidth", "-1") + pfUI:UpdateConfig("unitframes", "ttarget", "panchor", "TOP") pfUI:UpdateConfig("unitframes", "ttarget", "pspace", "-3") pfUI:UpdateConfig("unitframes", "ttarget", "buffs", "off") pfUI:UpdateConfig("unitframes", "ttarget", "buffsize", "16") @@ -362,6 +378,8 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("unitframes", "pet", "width", "100") pfUI:UpdateConfig("unitframes", "pet", "height", "16") pfUI:UpdateConfig("unitframes", "pet", "pheight", "4") + pfUI:UpdateConfig("unitframes", "pet", "pwidth", "-1") + pfUI:UpdateConfig("unitframes", "pet", "panchor", "TOP") pfUI:UpdateConfig("unitframes", "pet", "pspace", "-3") pfUI:UpdateConfig("unitframes", "pet", "buffs", "off") pfUI:UpdateConfig("unitframes", "pet", "buffsize", "12") @@ -393,6 +411,8 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("unitframes", "fallback", "width", "200") pfUI:UpdateConfig("unitframes", "fallback", "height", "50") pfUI:UpdateConfig("unitframes", "fallback", "pheight", "10") + pfUI:UpdateConfig("unitframes", "fallback", "pwidth", "-1") + pfUI:UpdateConfig("unitframes", "fallback", "panchor", "TOP") pfUI:UpdateConfig("unitframes", "fallback", "pspace", "-3") pfUI:UpdateConfig("unitframes", "fallback", "buffs", "top") pfUI:UpdateConfig("unitframes", "fallback", "buffsize", "20") diff --git a/api/unitframes.lua b/api/unitframes.lua index bccb09b4..6cb8ff27 100644 --- a/api/unitframes.lua +++ b/api/unitframes.lua @@ -74,6 +74,13 @@ function pfUI.uf:CreateUnitFrame(unit, id, config, tick) f.config = config or pfUI_config.unitframes.fallback f.tick = tick + local relative_point = "BOTTOM" + if f.config.panchor == "TOPLEFT" then + relative_point = "BOTTOMLEFT" + elseif f.config.panchor == "TOPRIGHT" then + relative_point = "BOTTOMRIGHT" + end + f:SetFrameStrata("BACKGROUND") f.hp = CreateFrame("Frame",nil, f) @@ -98,8 +105,8 @@ function pfUI.uf:CreateUnitFrame(unit, id, config, tick) end f.power = CreateFrame("Frame",nil, f) - f.power:SetPoint("TOP", f.hp, "BOTTOM", 0, -2*default_border - f.config.pspace) - f.power:SetWidth(f.config.width) + f.power:SetPoint(f.config.panchor, f.hp, relative_point, 0, -2*default_border - f.config.pspace) + f.power:SetWidth((f.config.pwidth ~= "-1" and f.config.pwidth or f.config.width)) f.power:SetHeight(f.config.pheight) if tonumber(f.config.pheight) < 0 then f.power:Hide() end @@ -553,8 +560,6 @@ function pfUI.uf:CreateUnitFrame(unit, id, config, tick) f.portrait:SetPoint("TOPLEFT", f, "TOPLEFT", 0, 0) f.hp:ClearAllPoints() f.hp:SetPoint("TOPRIGHT", f, "TOPRIGHT", 0, 0) - f.power:ClearAllPoints() - f.power:SetPoint("TOPRIGHT", f.hp, "BOTTOMRIGHT", 0, -2*default_border - f.config.pspace) pfUI.api.CreateBackdrop(f.portrait, default_border) f.portrait:SetFrameStrata("BACKGROUND") f.portrait.model:SetFrameLevel(1) @@ -562,8 +567,6 @@ function pfUI.uf:CreateUnitFrame(unit, id, config, tick) f.portrait:SetPoint("TOPRIGHT", f, "TOPRIGHT", 0, 0) f.hp:ClearAllPoints() f.hp:SetPoint("TOPLEFT", f, "TOPLEFT", 0, 0) - f.power:ClearAllPoints() - f.power:SetPoint("TOPLEFT", f.hp, "BOTTOMLEFT", 0, -2*default_border - f.config.pspace) pfUI.api.CreateBackdrop(f.portrait, default_border) f.portrait:SetFrameStrata("BACKGROUND") f.portrait.model:SetFrameLevel(1) diff --git a/modules/gui.lua b/modules/gui.lua index d63a0823..5b4cf48b 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -406,6 +406,12 @@ pfUI:RegisterModule("gui", function () "13:" .. T["Very Slow"], } + pfUI.gui.dropdowns.uf_powerbar_position = { + "TOPLEFT:" .. T["Left"], + "TOP:" .. T["Center"], + "TOPRIGHT:" .. T["Right"] + } + pfUI.gui.dropdowns.uf_portrait_position = { "bar:" .. T["Healthbar Embedded"], "left:" .. T["Left"], @@ -708,6 +714,8 @@ pfUI:RegisterModule("gui", function () CreateConfig(this, T["Health Bar Width"], C.unitframes.player, "width") CreateConfig(this, T["Health Bar Height"], C.unitframes.player, "height") CreateConfig(this, T["Power Bar Height"], C.unitframes.player, "pheight") + CreateConfig(this, T["Power Bar Width"], C.unitframes.player, "pwidth") + CreateConfig(this, T["Power Bar Anchor"], C.unitframes.player, "panchor", "dropdown", pfUI.gui.dropdowns.uf_powerbar_position) CreateConfig(this, T["Spacing"], C.unitframes.player, "pspace") CreateConfig(this, T["Buff Position"], C.unitframes.player, "buffs", "dropdown", pfUI.gui.dropdowns.uf_buff_position) CreateConfig(this, T["Buff Size"], C.unitframes.player, "buffsize") @@ -749,6 +757,8 @@ pfUI:RegisterModule("gui", function () CreateConfig(this, T["Health Bar Width"], C.unitframes.target, "width") CreateConfig(this, T["Health Bar Height"], C.unitframes.target, "height") CreateConfig(this, T["Power Bar Height"], C.unitframes.target, "pheight") + CreateConfig(this, T["Power Bar Width"], C.unitframes.target, "pwidth") + CreateConfig(this, T["Power Bar Anchor"], C.unitframes.target, "panchor", "dropdown", pfUI.gui.dropdowns.uf_powerbar_position) CreateConfig(this, T["Spacing"], C.unitframes.target, "pspace") CreateConfig(this, T["Buff Position"], C.unitframes.target, "buffs", "dropdown", pfUI.gui.dropdowns.uf_buff_position) CreateConfig(this, T["Buff Size"], C.unitframes.target, "buffsize") @@ -789,6 +799,8 @@ pfUI:RegisterModule("gui", function () CreateConfig(this, T["Health Bar Width"], C.unitframes.ttarget, "width") CreateConfig(this, T["Health Bar Height"], C.unitframes.ttarget, "height") CreateConfig(this, T["Power Bar Height"], C.unitframes.ttarget, "pheight") + CreateConfig(this, T["Power Bar Width"], C.unitframes.ttarget, "pwidth") + CreateConfig(this, T["Power Bar Anchor"], C.unitframes.ttarget, "panchor", "dropdown", pfUI.gui.dropdowns.uf_powerbar_position) CreateConfig(this, T["Spacing"], C.unitframes.ttarget, "pspace") CreateConfig(this, T["Buff Position"], C.unitframes.ttarget, "buffs", "dropdown", pfUI.gui.dropdowns.uf_buff_position) CreateConfig(this, T["Buff Size"], C.unitframes.ttarget, "buffsize") @@ -829,6 +841,8 @@ pfUI:RegisterModule("gui", function () CreateConfig(this, T["Health Bar Width"], C.unitframes.pet, "width") CreateConfig(this, T["Health Bar Height"], C.unitframes.pet, "height") CreateConfig(this, T["Power Bar Height"], C.unitframes.pet, "pheight") + CreateConfig(this, T["Power Bar Width"], C.unitframes.pet, "pwidth") + CreateConfig(this, T["Power Bar Anchor"], C.unitframes.pet, "panchor", "dropdown", pfUI.gui.dropdowns.uf_powerbar_position) CreateConfig(this, T["Spacing"], C.unitframes.pet, "pspace") CreateConfig(this, T["Buff Position"], C.unitframes.pet, "buffs", "dropdown", pfUI.gui.dropdowns.uf_buff_position) CreateConfig(this, T["Buff Size"], C.unitframes.pet, "buffsize") @@ -869,6 +883,8 @@ pfUI:RegisterModule("gui", function () CreateConfig(this, T["Health Bar Width"], C.unitframes.focus, "width") CreateConfig(this, T["Health Bar Height"], C.unitframes.focus, "height") CreateConfig(this, T["Power Bar Height"], C.unitframes.focus, "pheight") + CreateConfig(this, T["Power Bar Width"], C.unitframes.focus, "pwidth") + CreateConfig(this, T["Power Bar Anchor"], C.unitframes.focus, "panchor", "dropdown", pfUI.gui.dropdowns.uf_powerbar_position) CreateConfig(this, T["Spacing"], C.unitframes.focus, "pspace") CreateConfig(this, T["Buff Position"], C.unitframes.focus, "buffs", "dropdown", pfUI.gui.dropdowns.uf_buff_position) CreateConfig(this, T["Buff Size"], C.unitframes.focus, "buffsize") @@ -935,6 +951,8 @@ pfUI:RegisterModule("gui", function () CreateConfig(this, T["Health Bar Width"], C.unitframes.raid, "width") CreateConfig(this, T["Health Bar Height"], C.unitframes.raid, "height") CreateConfig(this, T["Power Bar Height"], C.unitframes.raid, "pheight") + CreateConfig(this, T["Power Bar Width"], C.unitframes.raid, "pwidth") + CreateConfig(this, T["Power Bar Anchor"], C.unitframes.raid, "panchor", "dropdown", pfUI.gui.dropdowns.uf_powerbar_position) CreateConfig(this, T["Spacing"], C.unitframes.raid, "pspace") CreateConfig(this, T["Buff Position"], C.unitframes.raid, "buffs", "dropdown", pfUI.gui.dropdowns.uf_buff_position) CreateConfig(this, T["Buff Size"], C.unitframes.raid, "buffsize") @@ -975,6 +993,8 @@ pfUI:RegisterModule("gui", function () CreateConfig(this, T["Health Bar Width"], C.unitframes.group, "width") CreateConfig(this, T["Health Bar Height"], C.unitframes.group, "height") CreateConfig(this, T["Power Bar Height"], C.unitframes.group, "pheight") + CreateConfig(this, T["Power Bar Width"], C.unitframes.group, "pwidth") + CreateConfig(this, T["Power Bar Anchor"], C.unitframes.group, "panchor", "dropdown", pfUI.gui.dropdowns.uf_powerbar_position) CreateConfig(this, T["Spacing"], C.unitframes.group, "pspace") CreateConfig(this, T["Buff Position"], C.unitframes.group, "buffs", "dropdown", pfUI.gui.dropdowns.uf_buff_position) CreateConfig(this, T["Buff Size"], C.unitframes.group, "buffsize") @@ -1015,6 +1035,8 @@ pfUI:RegisterModule("gui", function () CreateConfig(this, T["Health Bar Width"], C.unitframes.grouptarget, "width") CreateConfig(this, T["Health Bar Height"], C.unitframes.grouptarget, "height") CreateConfig(this, T["Power Bar Height"], C.unitframes.grouptarget, "pheight") + CreateConfig(this, T["Power Bar Width"], C.unitframes.grouptarget, "pwidth") + CreateConfig(this, T["Power Bar Anchor"], C.unitframes.grouptarget, "panchor", "dropdown", pfUI.gui.dropdowns.uf_powerbar_position) CreateConfig(this, T["Spacing"], C.unitframes.grouptarget, "pspace") CreateConfig(this, T["Buff Position"], C.unitframes.grouptarget, "buffs", "dropdown", pfUI.gui.dropdowns.uf_buff_position) CreateConfig(this, T["Buff Size"], C.unitframes.grouptarget, "buffsize") @@ -1055,6 +1077,8 @@ pfUI:RegisterModule("gui", function () CreateConfig(this, T["Health Bar Width"], C.unitframes.grouppet, "width") CreateConfig(this, T["Health Bar Height"], C.unitframes.grouppet, "height") CreateConfig(this, T["Power Bar Height"], C.unitframes.grouppet, "pheight") + CreateConfig(this, T["Power Bar Width"], C.unitframes.grouppet, "pwidth") + CreateConfig(this, T["Power Bar Anchor"], C.unitframes.grouppet, "panchor", "dropdown", pfUI.gui.dropdowns.uf_powerbar_position) CreateConfig(this, T["Spacing"], C.unitframes.grouppet, "pspace") CreateConfig(this, T["Buff Position"], C.unitframes.grouppet, "buffs", "dropdown", pfUI.gui.dropdowns.uf_buff_position) CreateConfig(this, T["Buff Size"], C.unitframes.grouppet, "buffsize") diff --git a/modules/player.lua b/modules/player.lua index 289a490f..90b5373d 100644 --- a/modules/player.lua +++ b/modules/player.lua @@ -86,7 +86,7 @@ pfUI:RegisterModule("player", function () this.energy = UnitMana("player") local value = round((GetTime() - this.lastTick) * 100) - local pos = C.unitframes.player.width / 200 * value + local pos = (C.unitframes.player.pwidth ~= "-1" and C.unitframes.player.pwidth or C.unitframes.player.width) / 200 * value if not C.unitframes.player.pheight then return end this.spark:SetPoint("LEFT", pos-((C.unitframes.player.pheight+5)/2), 0) end)