Skip to content

Commit

Permalink
added nameplate text position tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
Bunny67 committed Oct 17, 2016
1 parent d531678 commit d8960a7
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 0 deletions.
1 change: 1 addition & 0 deletions ElvUI_CustomTweaks/Categories/load_categories.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
<Include file="minimap\load_tweaks.xml"/>
<Include file="misc\load_tweaks.xml"/>
<Include file="unitframes\load_tweaks.xml"/>
<Include file="nameplates\load_tweaks.xml"/>
</Ui>
107 changes: 107 additions & 0 deletions ElvUI_CustomTweaks/Categories/nameplates/NameplatesText.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
local E, L, V, P, G = unpack(ElvUI)
local NP = E:GetModule("NamePlates");
local CT = E:GetModule("CustomTweaks")
local isEnabled = E.private["nameplate"].enable and E.private["CustomTweaks"] and E.private["CustomTweaks"]["NamePlatesText"] and true or false

P["CustomTweaks"]["NamePlatesText"] = {
["name"] = {
["point"] = "TOP",
["xOffset"] = 0,
["yOffset"] = 12
},
["level"] = {
["point"] = "RIGHT",
["xOffset"] = 12,
["yOffset"] = 1
}
};

local anchorValues = {
["TOP"] = "TOP",
["BOTTOM"] = "BOTTOM",
["CENTER"] = "CENTER",
["LEFT"] = "LEFT",
["RIGHT"] = "RIGHT"
};

local function ConfigTable()
E.Options.args.CustomTweaks.args.NamePlate.args.options.args.NamePlatesText = {
type = "group",
name = "NamePlatesText",
args = {
nameGroup = {
order = 1,
type = "group",
name = L["Name Text"],
guiInline = true,
get = function(info) return E.db.CustomTweaks.NamePlatesText.name[info[#info]]; end,
set = function(info, value) E.db.CustomTweaks.NamePlatesText.name[info[#info]] = value; NP:UpdateAllPlates(); end,
args = {
point = {
order = 1,
type = "select",
name = L["Anchor Point"],
values = anchorValues
},
xOffset = {
order = 2,
type = "range",
name = L["X-Offset"],
min = -50, max = 50, step = 1
},
yOffset = {
order = 3,
type = "range",
name = L["Y-Offset"],
min = -50, max = 50, step = 1
}
}
},
levelGroup = {
order = 2,
type = "group",
name = L["Level Text"],
guiInline = true,
get = function(info) return E.db.CustomTweaks.NamePlatesText.level[info[#info]]; end,
set = function(info, value) E.db.CustomTweaks.NamePlatesText.level[info[#info]] = value; NP:UpdateAllPlates(); end,
args = {
point = {
order = 1,
type = "select",
name = L["Anchor Point"],
values = anchorValues,
},
xOffset = {
order = 2,
type = "range",
name = L["X-Offset"],
min = -50, max = 50, step = 1,
},
yOffset = {
order = 3,
type = "range",
name = L["Y-Offset"],
min = -50, max = 50, step = 1
}
}
}
}
}
end
CT.Configs["NamePlatesText"] = ConfigTable;
if(not isEnabled) then return; end

hooksecurefunc(NP, "ConfigureElement_Name", function(_, frame)
local db = E.db.CustomTweaks.NamePlatesText.name;
local name = frame.Name;
name:ClearAllPoints();
name:SetJustifyH("CENTER");
name:SetPoint(db.point, frame.HealthBar, db.point, db.xOffset, db.yOffset);
end);

hooksecurefunc(NP, "ConfigureElement_Level", function(_, frame)
local db = E.db.CustomTweaks.NamePlatesText.level;
local level = frame.Level;
level:ClearAllPoints();
level:SetPoint(db.point, frame.HealthBar, db.point, db.xOffset, db.yOffset);
end);
3 changes: 3 additions & 0 deletions ElvUI_CustomTweaks/Categories/nameplates/load_tweaks.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file='NameplatesText.lua'/>
</Ui>
6 changes: 6 additions & 0 deletions ElvUI_CustomTweaks/core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ local Tweaks = {
{"PowerBarTexture", L["Allows you to use a separate texture for unitframe power bars."]},
{"UnitFrameSpacingLimits", L["Increases the maximum allowed vertical and horizontal spacing for party and raid frames."]},
},
["NamePlate"] = {
{"NamePlatesText", L["Test."]},
},
}

local Authors = {
Expand All @@ -65,6 +68,9 @@ local Authors = {
"RaidControl",
"UnitFrameSpacingLimits",
}},
{"Bunny", {
"NamePlatesText",
}},
}

local linebreak = "\n"
Expand Down
2 changes: 2 additions & 0 deletions ElvUI_CustomTweaks/locales.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ L["Makes the Consolidated Buffs frame movable and provides some configuration op
L["Max Lines"] = true;
L["Minimap Tweaks"] = true;
L["Misc Tweaks"] = true;
L["NamePlate Tweaks"] = true;
L["Only Free Slots"] = true;
L["Only Used Slots"] = true;
L["Options"] = true;
Expand Down Expand Up @@ -189,6 +190,7 @@ if L then
L["Max Lines"] = true;
L["Minimap Tweaks"] = "Твики мини-карты";
L["Misc Tweaks"] = "Разные твики";
L["NamePlate Tweaks"] = "Твики индикаторов здоровья";
L["Only Free Slots"] = true;
L["Only Used Slots"] = true;
L["Options"] = "Настройки";
Expand Down

0 comments on commit d8960a7

Please sign in to comment.