Skip to content

Commit

Permalink
- Fixed some issue with the npc name glitching its size when anchorin…
Browse files Browse the repository at this point in the history
…g the name inside the nameplate.

- Added options to adjust the anchor of the spell name.
- Pressing SHIFT + Enter apply the script with losing focus in the text editor.
  • Loading branch information
Tercioo authored and Tercioo committed Feb 14, 2019
1 parent 731b178 commit 6f1d965
Show file tree
Hide file tree
Showing 8 changed files with 215 additions and 16 deletions.
18 changes: 9 additions & 9 deletions Plater.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1617,6 +1617,7 @@ Plater.DefaultSpellRangeList = {
ShowBorder = false,
CanModifyHealhBarColor = false,
ShowTargetOverlay = false,
ShowUnitName = false, --let Plater control the unit name
}

local healthBarOptions = {
Expand Down Expand Up @@ -2068,14 +2069,13 @@ Plater.DefaultSpellRangeList = {
unitFrame.HasHooksRegistered = true
end


--allow the framework to set the unit name
unitFrame.Settings.ShowUnitName = true

--powerbar are disabled by default in the settings table, called SetUnit will make the framework hide the power bar
--SetPowerBarSize() will show the power bar or the personal resource bar update also will show it
unitFrame:SetUnit (unitID)

--show unit name, the frame work will hide it due to ShowUnitName is set to false
unitFrame.unitName:Show()

--set the unitID in the unitFrame, several script and external addons read this member, adding different variations to be compatible with all
unitFrame.unit = unitID
unitFrame.namePlateUnitToken = unitID
Expand Down Expand Up @@ -3379,7 +3379,11 @@ end

--expose to scripts
newIcon.StackText = newIcon.CountFrame.Count

newIcon.Cooldown.Timer = newIcon.Cooldown:CreateFontString (nil, "overlay", "NumberFontNormal")
newIcon.Cooldown.Timer:SetPoint ("center")
newIcon.TimerText = newIcon.Cooldown.Timer

return newIcon
end

Expand All @@ -3405,11 +3409,7 @@ end
self.PlaterBuffList[i] = newFrameIcon

newFrameIcon:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1})

local timer = newFrameIcon.Cooldown:CreateFontString (nil, "overlay", "NumberFontNormal")
newFrameIcon.Cooldown.Timer = timer
timer:SetPoint ("center")


local auraWidth = Plater.db.profile.aura_width
local auraHeight = Plater.db.profile.aura_height
newFrameIcon:SetSize (auraWidth, auraHeight)
Expand Down
1 change: 1 addition & 0 deletions Plater_ChangeLog.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function Plater.GetChangelogTable()
{1550006686, "Buf Fix", "February 12, 2019", "Fixed the neutral nameplate color."},
{1550006686, "Buf Fix", "February 12, 2019", "Fixed the channeling color sometimes using the finished cast color."},
{1550006686, "Buf Fix", "February 12, 2019", "Fixed hook script load conditions not showing reaping affix."},
{1550006686, "Options Changes", "February 12, 2019", "Added options to change the spell name anchor."},
{1550006686, "Scripting", "February 12, 2019", "Added Plater.GetConfig (unitFrame) for scripts to have access to the nameplate settings."},
{1550006686, "Scripting", "February 12, 2019", "Added Plater:GetPlayerRole() which returns the name of the current role the player is in (TANK DAMAGER, HEALER, NONE)."},
{1550006686, "Scripting", "February 12, 2019", "Added option 'Offset if Buff is Shown' for resource at the Personal Bar tab."},
Expand Down
192 changes: 187 additions & 5 deletions Plater_OptionsPanel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2910,7 +2910,7 @@ do
},

--energy bar settings
{type = "blank"},
--{type = "blank"},
{type = "label", get = function() return "Power Bar:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},

{
Expand Down Expand Up @@ -2956,7 +2956,7 @@ do
},

--cast bar settings
{type = "blank"},
--{type = "blank"},
{type = "label", get = function() return "Cast Bar:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},

{
Expand Down Expand Up @@ -3091,6 +3091,43 @@ do
desc = "|cFFFFFF00Important|r: hide and show nameplates to see changes.",
},

--spell name text anchor
{
type = "select",
get = function() return Plater.db.profile.plate_config.player.spellname_text_anchor.side end,
values = function() return build_anchor_side_table ("player", "spellname_text_anchor") end,
name = "Anchor",
desc = "Which side of the nameplate this widget is attach to.",
},
--spell name text anchor x offset
{
type = "range",
get = function() return Plater.db.profile.plate_config.player.spellname_text_anchor.x end,
set = function (self, fixedparam, value)
Plater.db.profile.plate_config.player.spellname_text_anchor.x = value
Plater.UpdateAllPlates()
end,
min = -100,
max = 100,
step = 1,
name = "X Offset",
desc = "Slightly move the text horizontally.",
},
--spell name text anchor x offset
{
type = "range",
get = function() return Plater.db.profile.plate_config.player.spellname_text_anchor.y end,
set = function (self, fixedparam, value)
Plater.db.profile.plate_config.player.spellname_text_anchor.y = value
Plater.UpdateAllPlates()
end,
min = -100,
max = 100,
step = 1,
name = "Y Offset",
desc = "Slightly move the text vertically.",
},

{type = "breakline"},

{type = "label", get = function() return "Spell Cast Time Text:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
Expand Down Expand Up @@ -5089,6 +5126,44 @@ local relevance_options = {
name = "Shadow Color",
desc = "|cFFFFFF00Important|r: hide and show nameplates to see changes.",
},

--spell name text anchor
{
type = "select",
get = function() return Plater.db.profile.plate_config.friendlyplayer.spellname_text_anchor.side end,
values = function() return build_anchor_side_table ("friendlyplayer", "spellname_text_anchor") end,
name = "Anchor",
desc = "Which side of the nameplate this widget is attach to.",
},
--spell name text anchor x offset
{
type = "range",
get = function() return Plater.db.profile.plate_config.friendlyplayer.spellname_text_anchor.x end,
set = function (self, fixedparam, value)
Plater.db.profile.plate_config.friendlyplayer.spellname_text_anchor.x = value
Plater.UpdateAllPlates()
end,
min = -100,
max = 100,
step = 1,
name = "X Offset",
desc = "Slightly move the text horizontally.",
},
--spell name text anchor x offset
{
type = "range",
get = function() return Plater.db.profile.plate_config.friendlyplayer.spellname_text_anchor.y end,
set = function (self, fixedparam, value)
Plater.db.profile.plate_config.friendlyplayer.spellname_text_anchor.y = value
Plater.UpdateAllPlates()
end,
min = -100,
max = 100,
step = 1,
name = "Y Offset",
desc = "Slightly move the text vertically.",
},


{type = "blank"},
{type = "label", get = function() return "Spell Cast Time Text:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
Expand Down Expand Up @@ -5898,6 +5973,42 @@ local relevance_options = {
desc = "|cFFFFFF00Important|r: hide and show nameplates to see changes.",
},

--spell name text anchor
{
type = "select",
get = function() return Plater.db.profile.plate_config.enemyplayer.spellname_text_anchor.side end,
values = function() return build_anchor_side_table ("enemyplayer", "spellname_text_anchor") end,
name = "Anchor",
desc = "Which side of the nameplate this widget is attach to.",
},
--spell name text anchor x offset
{
type = "range",
get = function() return Plater.db.profile.plate_config.enemyplayer.spellname_text_anchor.x end,
set = function (self, fixedparam, value)
Plater.db.profile.plate_config.enemyplayer.spellname_text_anchor.x = value
Plater.UpdateAllPlates()
end,
min = -100,
max = 100,
step = 1,
name = "X Offset",
desc = "Slightly move the text horizontally.",
},
--spell name text anchor x offset
{
type = "range",
get = function() return Plater.db.profile.plate_config.enemyplayer.spellname_text_anchor.y end,
set = function (self, fixedparam, value)
Plater.db.profile.plate_config.enemyplayer.spellname_text_anchor.y = value
Plater.UpdateAllPlates()
end,
min = -100,
max = 100,
step = 1,
name = "Y Offset",
desc = "Slightly move the text vertically.",
},

--level text settings
{type = "blank"},
Expand Down Expand Up @@ -6796,9 +6907,45 @@ local relevance_options = {
name = "Shadow Color",
desc = "|cFFFFFF00Important|r: hide and show nameplates to see changes.",
},

{type = "blank"},

--spell name text anchor
{
type = "select",
get = function() return Plater.db.profile.plate_config.friendlynpc.spellname_text_anchor.side end,
values = function() return build_anchor_side_table ("friendlynpc", "spellname_text_anchor") end,
name = "Anchor",
desc = "Which side of the nameplate this widget is attach to.",
},
--spell name text anchor x offset
{
type = "range",
get = function() return Plater.db.profile.plate_config.friendlynpc.spellname_text_anchor.x end,
set = function (self, fixedparam, value)
Plater.db.profile.plate_config.friendlynpc.spellname_text_anchor.x = value
Plater.UpdateAllPlates()
end,
min = -100,
max = 100,
step = 1,
name = "X Offset",
desc = "Slightly move the text horizontally.",
},
--spell name text anchor x offset
{
type = "range",
get = function() return Plater.db.profile.plate_config.friendlynpc.spellname_text_anchor.y end,
set = function (self, fixedparam, value)
Plater.db.profile.plate_config.friendlynpc.spellname_text_anchor.y = value
Plater.UpdateAllPlates()
end,
min = -100,
max = 100,
step = 1,
name = "Y Offset",
desc = "Slightly move the text vertically.",
},

{type = "blank"},
{type = "label", get = function() return "Spell Cast Time Text:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
{
type = "toggle",
Expand Down Expand Up @@ -7697,9 +7844,44 @@ local relevance_options = {
desc = "|cFFFFFF00Important|r: hide and show nameplates to see changes.",
},

--spell name text anchor
{
type = "select",
get = function() return Plater.db.profile.plate_config.enemynpc.spellname_text_anchor.side end,
values = function() return build_anchor_side_table ("enemynpc", "spellname_text_anchor") end,
name = "Anchor",
desc = "Which side of the nameplate this widget is attach to.",
},
--spell name text anchor x offset
{
type = "range",
get = function() return Plater.db.profile.plate_config.enemynpc.spellname_text_anchor.x end,
set = function (self, fixedparam, value)
Plater.db.profile.plate_config.enemynpc.spellname_text_anchor.x = value
Plater.UpdateAllPlates()
end,
min = -100,
max = 100,
step = 1,
name = "X Offset",
desc = "Slightly move the text horizontally.",
},
--spell name text anchor x offset
{
type = "range",
get = function() return Plater.db.profile.plate_config.enemynpc.spellname_text_anchor.y end,
set = function (self, fixedparam, value)
Plater.db.profile.plate_config.enemynpc.spellname_text_anchor.y = value
Plater.UpdateAllPlates()
end,
min = -100,
max = 100,
step = 1,
name = "Y Offset",
desc = "Slightly move the text vertically.",
},

{type = "blank"},

{type = "label", get = function() return "Spell Cast Time Text:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
{
type = "toggle",
Expand Down
13 changes: 13 additions & 0 deletions Plater_ScriptingPanels.lua
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,19 @@ Plater.TriggerDefaultMembers = {
--
end)

code_editor.editbox:HookScript ("OnEnterPressed", function()
if (IsShiftKeyDown()) then
mainFrame.SaveScript()
code_editor.editbox:SetFocus (true)

--elseif (IsControlKeyDown()) then
-- RuntimeEditor.SaveCode()

else
code_editor.editbox:Insert ("\n")
end
end)

--apply button
local apply_script_button = DF:CreateButton (code_editor, mainFrame.ApplyScript, buttons_size[1], buttons_size[2], "Apply", -1, nil, nil, nil, nil, nil, DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE"), DF:GetTemplate ("font", "PLATER_BUTTON"))
apply_script_button:SetIcon ([[Interface\BUTTONS\UI-Panel-BiggerButton-Up]], 20, 20, "overlay", {0.1, .9, 0.1, .9})
Expand Down
Binary file added images/segment_texture_2.blp
Binary file not shown.
Binary file added images/segment_texture_3.blp
Binary file not shown.
2 changes: 1 addition & 1 deletion libs/DF/fw.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

local dversion = 138
local dversion = 139
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary (major, minor)

Expand Down
5 changes: 4 additions & 1 deletion libs/DF/panel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8465,6 +8465,10 @@ end
else
self.border:Hide()
end

if (not self.Settings.ShowUnitName) then
self.unitName:Hide()
end
else
self:UnregisterEvents()
self.healthBar:SetUnit (nil)
Expand Down Expand Up @@ -8605,7 +8609,6 @@ end
--> misc
UpdateName = function (self)
if (not self.Settings.ShowUnitName) then
self.unitName:Hide()
return
end

Expand Down

0 comments on commit 6f1d965

Please sign in to comment.