From 30588ad38a1eb19236defc074b570f1d97570300 Mon Sep 17 00:00:00 2001 From: shagu Date: Fri, 2 Dec 2016 20:35:57 +0100 Subject: [PATCH] nameplates: add several options - show only players - change vertical position - show healthpoints --- modules/config.lua | 3 +++ modules/gui.lua | 3 +++ modules/nameplates.lua | 29 ++++++++++++++++++++++++++--- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/modules/config.lua b/modules/config.lua index 06c1a92a..19905aed 100644 --- a/modules/config.lua +++ b/modules/config.lua @@ -94,6 +94,9 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("nameplates", nil, "showdebuffs", "0") pfUI:UpdateConfig("nameplates", nil, "clickthrough", "0") pfUI:UpdateConfig("nameplates", nil, "raidiconsize", "16") + pfUI:UpdateConfig("nameplates", nil, "players", "0") + pfUI:UpdateConfig("nameplates", nil, "showhp", "0") + pfUI:UpdateConfig("nameplates", nil, "vpos", "-10") pfUI:UpdateConfig("thirdparty", "dpsmate", "enable", "1") pfUI:UpdateConfig("thirdparty", "wim", "enable", "1") pfUI:UpdateConfig("thirdparty", "healcomm","enable", "1") diff --git a/modules/gui.lua b/modules/gui.lua index 60b2f557..70817a3b 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -729,6 +729,9 @@ pfUI:RegisterModule("gui", function () pfUI.gui:CreateConfig(pfUI.gui.nameplates, "Show debuffs:", pfUI_config.nameplates, "showdebuffs", "checkbox") pfUI.gui:CreateConfig(pfUI.gui.nameplates, "Enable Clickthrough:", pfUI_config.nameplates, "clickthrough", "checkbox") pfUI.gui:CreateConfig(pfUI.gui.nameplates, "Raidicon size:", pfUI_config.nameplates, "raidiconsize") + pfUI.gui:CreateConfig(pfUI.gui.nameplates, "Show Players only:", pfUI_config.nameplates, "players", "checkbox") + pfUI.gui:CreateConfig(pfUI.gui.nameplates, "Show Healthpoints:", pfUI_config.nameplates, "showhp", "checkbox") + pfUI.gui:CreateConfig(pfUI.gui.nameplates, "Vertical position:", pfUI_config.nameplates, "vpos") -- thirdparty pfUI.gui.thirdparty = pfUI.gui:CreateConfigTab("Thirdparty") diff --git a/modules/nameplates.lua b/modules/nameplates.lua index 50126e30..7681c9b9 100644 --- a/modules/nameplates.lua +++ b/modules/nameplates.lua @@ -41,6 +41,12 @@ pfUI:RegisterModule("nameplates", function () local healthbar = nameplate:GetChildren() local border, glow, name, level, levelicon , raidicon = nameplate:GetRegions() + if pfUI_config.nameplates.players == "1" then + if not pfUI_playerDB[name:GetText()] or not pfUI_playerDB[name:GetText()]["class"] then + nameplate:Hide() + end + end + -- scan player (idle targeting) if pfUI.nameplates.targets[name:GetText()] == nil and UnitName("target") == nil then TargetByName(name:GetText(), true) @@ -79,7 +85,7 @@ pfUI:RegisterModule("nameplates", function () -- healthbar healthbar:SetStatusBarTexture("Interface\\AddOns\\pfUI\\img\\bar") healthbar:ClearAllPoints() - healthbar:SetPoint("CENTER", nameplate, "CENTER", 0, -10) + healthbar:SetPoint("TOP", nameplate, "TOP", 0, tonumber(pfUI_config.nameplates.vpos)) healthbar:SetWidth(110) healthbar:SetHeight(7) @@ -87,11 +93,26 @@ pfUI:RegisterModule("nameplates", function () healthbar.bg = healthbar:CreateTexture(nil, "BORDER") healthbar.bg:SetTexture(0,0,0,0.90) healthbar.bg:ClearAllPoints() - healthbar.bg:SetPoint("CENTER", nameplate, "CENTER", 0, -10) + healthbar.bg:SetPoint("CENTER", healthbar, "CENTER", 0, 0) healthbar.bg:SetWidth(healthbar:GetWidth() + 3) healthbar.bg:SetHeight(healthbar:GetHeight() + 3) end + if pfUI_config.nameplates.showhp == "1" then + if healthbar.hptext == nil then + healthbar.hptext = healthbar:CreateFontString("Status", "DIALOG", "GameFontNormal") + healthbar.hptext:SetPoint("RIGHT", healthbar, "RIGHT") + healthbar.hptext:SetNonSpaceWrap(false) + healthbar.hptext:SetFontObject(GameFontWhite) + healthbar.hptext:SetTextColor(1,1,1,1) + healthbar.hptext:SetFont(STANDARD_TEXT_FONT, 10) + end + + local min, max = healthbar:GetMinMaxValues() + local cur = healthbar:GetValue() + healthbar.hptext:SetText(cur .. " / " .. max) + end + -- raidtarget raidicon:ClearAllPoints() raidicon:SetWidth(pfUI_config.nameplates.raidiconsize) @@ -143,8 +164,10 @@ pfUI:RegisterModule("nameplates", function () -- adjust font name:SetFont(STANDARD_TEXT_FONT,12,"OUTLINE") name:SetPoint("BOTTOM", healthbar, "CENTER", 0, 7) - level:SetFont(STANDARD_TEXT_FONT,12, "OUTLINE") -- + level:SetFont(STANDARD_TEXT_FONT,12, "OUTLINE") + level:ClearAllPoints() level:SetPoint("RIGHT", healthbar, "LEFT", -1, 0) + levelicon:ClearAllPoints() levelicon:SetPoint("RIGHT", healthbar, "LEFT", -1, 0) -- tweak the colors to match the rest