From 0cef1bf4117fe81f42f357f57542f46f843249fb Mon Sep 17 00:00:00 2001 From: Val Voronov Date: Mon, 1 Oct 2018 04:17:04 +0700 Subject: [PATCH 01/17] :lipstick: --- assets/console.TGA | Bin 339429 -> 356761 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/assets/console.TGA b/assets/console.TGA index 7be6f2a35472dbb39d025de573dd494b43413620..f454d0f8ec0fb09acfe47293d6481a2f86280845 100644 GIT binary patch delta 25357 zcmd^ITTB#Z6rR-qF$S0ADhOhfDiWhrY3Wk|1;ujFl$$74(wnA;SXv(%qlaBEUTRgy z+R+-)G-{ftfdDl=)nFndP(w(3=!3RR(+CP;wU-BJo9Q{r>@EYtG8*PT518=#XZAnm zJO4N5d~;@Y#0U2x&;J%xTW_nMRX_VXIpqGFm8t*QY_`XW{k}ZtxHoIoto|q*2JqNW z#FFJo@K18*){&5qke;ZhC}rWog-6tcgoIkN!)aO^O=e_HZX%OXMwEp=%N^Tpr=+CR zWoBmXE+{A{FD@=FRZB`rOb=hs;uta`b8Rrn zmoIO+di83yv#qUdgR`ZjB}?+pnwy)mru_pD0TKWMtlwe)^p-5Jn&5!wQXBYAv?Zr^ z3iP%%(9(o}|G3awS}6bc&?)~o(WPdvLR6;AI)Bo^^h??cpl3O;{sbwlaah2L z-nIdRTxE>+PFu(NxBMD6IXc!qD|(hRCjVH3z?Xk4=)U}8Lf7(-4c(J}jOdtutmw^n z{o%a;z_fSNfz)QA*!cTD|Ak28De?AyJm}v3j|+XY|Kmd!bpH`cJEXk4cI{gBrAwDK zx!vx3y5~$!4^FR*h={nY^gWPUAu4(G$btn6y0&cDQeRhB_dYH!x^?STK~GOlo_gob zom{iSX<8gjW@Juo$Q`*Q_m0G*k(h($)Zh<~szGm8tI~#dRC#}+`sILp3Sv^$jKs&s zcjImI@l&TxRbIb-y}Y}-yQHtLuSmUn_imxtp@9}hkr|nj8*)c($$j|ZWh3)z8rAUq zpR3Z2gK8Mg=N(W~CG??u0+L@H!Dj(Kl$MsB#6SC5TU#r-y1L46SKC~@y}hLpx-D_~ zW_7;V^c;ifcKCw+z|!4K9Sn>TJoQ40*1J>52DZ$9mEx%T4sYCCV-xKVoZ=FMWYqobq9>~NMAN01qrlN)kJZppp! z-y`{4#qjFYtG_BQFaNlqp`rNV#fw|6T)C33;!RJU*+HSj;bcbUKjr^OC3BXe>??$G;y^6QZ7-rB!x*|NhM zH*VZkSy{PWt*WZZG&@|N#bIPd=Hy0}<$k5}v0QEoQED~fC0jHtPcjnQLP8oa6!O1HU!pik$CXV6SGzI58ZPM{BmH^6OTWvb ze~cP{`o~FsCa`9|E06S#k^cOd-v6bUr{BJI?b=f6)@RS2-LHHzEW3019S%orVq)TU zb=9g>S!RbOT5KmXGN-pSl|xTtHw?_1H?JPQaH??P3zu(6_)Sc1oo{CSF^JE#9wYz; z2;Z?j81RzL!~*crFM;TU)6<^-TFx`kp9@^T8ZPoLwBE`p1=ozy++~lKwH$@6|sx7X13h!@^AO|K9NG zUts!ObeXb8Mn>+Ub{+qT)qqm=JKhUCnmc#yiLkJ+J!(u$Op)24i5A<*jLgy7BjvTH z`0ap0X?%*`4m?7P(|Aj;FE%!|JT5M7hm$6CG_wgf1mYoeh#+K_I!GNN2;|x*3gln# z8P`VvB9crGsY3*Dscskr@X~Js0X1&8ac$oqOlgdx0M_ic#UlR8XFl8U$YY<4}J&>G#w>BmLzwz5iNn*nc@m6YSI# zQ+Mp?nH|sY`T3yTZg0fTYMe<)NxN)ImoBZKiHjyK>kol=NF5>w*`*FrhX?|>Hi`m- zpK*N@AR@{1kUB&Vm+FR5faro77X=8Y@o|tkL=dJl#!(>uLiKKZ6j=WZs_TyeL6)=0<$mWKbE#ZaHTVpFF$qmGlEDzSr`u*`bLR+sTZ~@lBXPrTY)`Hne#0 zVkI>-^)od)JA1d;p@|mT$&AeL-S{Ep@}JnrKTb|gzL1fTaoAN|$=JWG z`~*Y+O@adg_i7XZh^2c%2q657>q8*^IYWRdE3;d_SEH?Z@}DsTZ~k+IFed+5LI7b( zXPgVjzc{fq2m$j?sNRnc0a&ZQ%H`poQGhW2S@PbS_M`dF7lJSUnL-$w{~RFzYxNfv z0&Df}m394}R|^H62;`r!`U|T-;9iZkO8L(jf|mbmA^7v3Cj?#oGlbyn{}@Wola6Eh zKb8>IOD5~|q8ZHPu+Y>_o(Fr#$1mLB=#&h9h%mCz{H3NWg@3eJl+&M$AO8@Gp zuI%gAuXmBYquf6Z`_!!l7ks1!zh0oqdycD;Bn?ZFGWQ?(aL$uOixyp7xpL)MH7zae zsM(>37Td{;%n{>>@_{X=As3(VKAS&({`cYG;Vmlu2N2(y9hzvdoy^Fb+$cZJ33BH= i$2T^f;?ENmhheir6D_ur8U8%Q?LNQJ9ulmA0^HJ delta 7907 zcmc&&T})I*6kg!oEw#WESOi2sXe|p?q82C;jM>EqN<%=JRLhSjjfyE&TdRpwM_6pr zHYzGOSaO?~^wFek(x%n$p!`TpDhZDb&}P|n!%x~`#E_uv^nC3;?1Grvq|Du9PiB+z zeczcg=bSrtuX^I{58KYPhO~yZhJCAqk36?7_en@d$Q0K`l*!1E(9lqy4Zm&acD`&> z=`VjA9v*%-E-tQP)v8r4k&=?ajG7B@UI7^3ps~G_^_ZvrqTJfmo0XMyrl_c>zOu4% z*Y4fBD@9dR)lQ@49Gv3;0~|Dn>TN6>Fw>^ z{L#R`K%wQ%ojZj~y<##%o}s}c?Q^jZ*it8WF=4+h<$uY~_*o$^Ic2tJ2uxa~KRpCy zZu$$ElrDez-m!Jczo`|#Os)Px%fZD{^ItP_7Ns2D*VniC#*G_WFwQa7G2UZiV{h}i z-<5CJ3j6xG#Kgqjii(QUZEbB;Jv}|8qobo+eLkO4OioTZjG7B@UI7^3paC6dK_8R4 zW-h*|Q&{(ZEYzLv3QJL~P>x&@yzLL=JWI&hIG2=^)L&g)-Q3mHRW~>|SUx^JzT?4z z2PNXsqesO?%|$rJ0R}i|KnGgT$EIb>MZI@P#2oodSgM-Da$3Le0T*1KRz5wLxqglw zw*xgbH7&ZX?;RQ%s-P{E&dkhg7qhdoB}UCVoer>FCf&s?L1!#M^pz(E5#&|0n5N#6ID(!R@^pP&E!@#Dvfhlht>nVOo)5_AZe zM$J_?M*{{pXh28oUjDUE+RNS9+1Upg8X5|yv{nnR*PCk8bisK!V1R>0Q51JayIOrE zN>w^$)SMD`dV2cXRHwP3ySsa(QKQ3I0}Sx6urN3OF+y!Ganp6JJ~uZvN1Qr!D$%IX z;j94$INc-N{L4tNMMXvJPfJV77sbWJ$wrM1XALmG=|bw}KPM8~SVTm`A!>xpf|On~ zYIHbjfB{ZyWBj|7|K^X!B~b!Bq|%t0n(7dnHf^#SH9DL%zyK#&4}a@r3esb<*$%H= zyVfbFjx&uK9nKnHfKviJS2lu-Zqbc2@EoG4smX5C=y28m1Dwv*!$3>x>#5&Kh8VtE%eZdyCX|<}D~FI7XlC z%{1>fwD$M+Z)lOYVshmcs4?j~4i15tk@SENnAFn_5ccab*#$Q*1ZG0b2Zq38Hd~;u zUzhT4Y6UR)BPVFX)PJT{z*5aW7y3%WT&Kt7F&g*Y<;U8Ewd|0v=9LNM;3vXjvHWJS z@QLl}Y38%r?JkGIv9Ed0o;_u)b#--REfQBuuG|7OCVj`jAuuzN9uNYPdfEZPeqAQJ z;O2$EOsM(55SYwn3l#S2QvOY?049Ir1Z|l5&(sQN2#V(a3&w@M!u!a+jEoEyJp_FG zs~ze^Mz1*&(b3VLCnO}CbzMDD^VWCHi|5}s wDwdTsh?oz%aP8+`l&Z}ov-H>51buyi%zdLqhqDG4eJ6-)_WJ{`s~gw+4YHU}(*OVf From 72d986700947c1aaab53d5b9724e12789a312188 Mon Sep 17 00:00:00 2001 From: Val Voronov Date: Mon, 1 Oct 2018 08:50:03 +0700 Subject: [PATCH 02/17] Cleaned up action bar controller's code --- modules/bars/controller.lua | 279 ++++++++++++++---------------------- 1 file changed, 109 insertions(+), 170 deletions(-) diff --git a/modules/bars/controller.lua b/modules/bars/controller.lua index b18cdc79..1b99ae52 100644 --- a/modules/bars/controller.lua +++ b/modules/bars/controller.lua @@ -16,126 +16,77 @@ local C_Timer = _G.C_Timer -- Mine local isInit = false -local controller -local anim_controller - -local elements = { - top = { - left = { - size = {232 / 2, 90 / 2}, - coords = {1 / 2048, 233 / 2048, 1 / 256, 91 / 256}, +local barController + +local WIDGETS = { + ACTION_BAR = { + frame_level_offset = 2, + point = {"BOTTOM", "LSActionBarControllerBottom", "BOTTOM", 0, 15}, + children = { + "LSActionBar2", + "LSActionBar3", + "LSActionBar4", + "LSActionBar5", + "LSPetBar", + "LSStanceBar", }, - mid = { - size = {432 / 2, 90 / 2}, - coords = {233 / 2048, 665 / 2048, 1 / 256, 91 / 256}, - }, - right = { - size = {232 / 2, 90 / 2}, - coords = {665 / 2048, 897 / 2048, 1 / 256, 91 / 256}, + attributes = { + ["_childupdate-numbuttons"] = [[ + self:Hide() + self:SetWidth(36 * message) + self:Show() + + for i = 7, 12 do + if message == 6 then + buttons[i]:SetAttribute("statehidden", true) + buttons[i]:Hide() + else + buttons[i]:SetAttribute("statehidden", nil) + buttons[i]:Show() + end + end + ]], }, }, - bottom = { - left = { - size = {568 / 2, 46 / 2}, - coords = {1 / 2048, 569 / 2048, 92 / 256, 138 / 256}, - }, - mid = { - size = {432 / 2, 46 / 2}, - coords = {569 / 2048, 1001 / 2048, 92 / 256, 138 / 256}, - }, - right = { - size = {568 / 2, 46 / 2}, - coords = {1001 / 2048, 1569 / 2048, 92 / 256, 138 / 256}, - }, + PET_BATTLE_BAR = { + frame_level_offset = 2, + point = {"BOTTOM", "LSActionBarControllerBottom", "BOTTOM", 0, 15}, }, -} - -local WIDGETS = {} - -WIDGETS.ACTION_BAR = { - frame = false, - children = false, - point = {"BOTTOM", "LSActionBarControllerBottom", "BOTTOM", 0, 15}, - on_add = function () - WIDGETS.ACTION_BAR.children = { - [1] = _G["LSActionBar2"], - [2] = _G["LSActionBar3"], - [3] = _G["LSActionBar4"], - [4] = _G["LSActionBar5"], - [5] = _G["LSPetBar"], - [6] = _G["LSStanceBar"], - } - end, - attribute = { - name = "_childupdate-numbuttons", - condition = [[ - self:Hide() - self:SetWidth(36 * message) - self:Show() - - for i = 7, 12 do - if message == 6 then - buttons[i]:SetAttribute("statehidden", true) - buttons[i]:Hide() - else - buttons[i]:SetAttribute("statehidden", nil) - buttons[i]:Show() - end - end - ]] + XP_BAR = { + frame_level_offset = 3, + point = {"BOTTOM", "LSActionBarControllerBottom", "BOTTOM", 0, 0}, + on_play = function(frame, newstate) + frame:UpdateSize(newstate == 6 and 756 / 2 or 1188 / 2, 12) + end, }, } -WIDGETS.PET_BATTLE_BAR = { - frame = false, - children = false, - point = {"BOTTOM", "LSActionBarControllerBottom", "BOTTOM", 0, 15}, -} - -WIDGETS.XP_BAR = { - frame = false, - children = false, - point = {"BOTTOM", "LSActionBarControllerBottom", "BOTTOM", 0, 0}, - on_play = function(_, newstate) - MODULE:GetBar("xpbar"):UpdateSize(newstate == 6 and 756 / 2 or 1188 / 2, 12) - end -} - function MODULE.ActionBarController_AddWidget(_, frame, slot) if isInit then - if WIDGETS[slot].frame == false then - WIDGETS[slot].frame = frame - - frame:SetParent(controller) + local widget = WIDGETS[slot] + if widget and not widget.frame then + frame:SetParent(barController) + frame:SetFrameLevel(barController:GetFrameLevel() + widget.frame_level_offset) frame:ClearAllPoints() - frame:SetPoint(unpack(WIDGETS[slot].point)) + frame:SetPoint(unpack(widget.point)) - if slot == "ACTION_BAR" then - frame:SetFrameLevel(controller:GetFrameLevel() + 2) - elseif slot == "XP_BAR" then - frame:SetFrameLevel(controller:GetFrameLevel() + 3) - end - - if WIDGETS[slot].attribute then - frame:SetAttribute(WIDGETS[slot].attribute.name, WIDGETS[slot].attribute.condition) + if widget.attributes then + for attr, body in next, widget.attributes do + frame:SetAttribute(attr, body) + end end - if WIDGETS[slot].on_add then - WIDGETS[slot].on_add(frame) - end + widget.frame = frame - -- register state driver & trigger update - if not controller.isDriverRegistered - and WIDGETS["ACTION_BAR"].frame - and WIDGETS["PET_BATTLE_BAR"].frame - and WIDGETS["XP_BAR"].frame then + if not barController.isDriverRegistered and WIDGETS.ACTION_BAR.frame + and WIDGETS.PET_BATTLE_BAR.frame and WIDGETS.XP_BAR.frame then - -- _"childupdate-numbuttons" is executed in controller's environment + -- _"childupdate-numbuttons" is executed in barController's environment for i = 1, 12 do - controller:SetFrameRef("button" .. i, _G["LSActionBar1Button" .. i]) + barController:SetFrameRef("button" .. i, _G["LSActionBar1Button" .. i]) end - controller:Execute([[ + barController:Execute([[ top = self:GetFrameRef("top") bottom = self:GetFrameRef("bottom") buttons = table.new() @@ -145,7 +96,7 @@ function MODULE.ActionBarController_AddWidget(_, frame, slot) end ]]) - controller:SetAttribute("_onstate-mode", [[ + barController:SetAttribute("_onstate-mode", [[ if newstate ~= self:GetAttribute("numbuttons") then self:SetAttribute("numbuttons", newstate) self:ChildUpdate("numbuttons", newstate) @@ -156,9 +107,9 @@ function MODULE.ActionBarController_AddWidget(_, frame, slot) end ]]) - RegisterStateDriver(controller, "mode", "[vehicleui][petbattle][overridebar][possessbar] 6; 12") + RegisterStateDriver(barController, "mode", "[vehicleui][petbattle][overridebar][possessbar] 6; 12") - controller.isDriverRegistered = true + barController.isDriverRegistered = true end end end @@ -170,94 +121,94 @@ end function MODULE.SetupActionBarController() if not isInit and C.db.char.bars.restricted then - controller = CreateFrame("Frame", "LSActionBarController", UIParent, "SecureHandlerStateTemplate") - controller:SetSize(32, 32) - controller:SetPoint("BOTTOM", 0, 0) - controller:SetAttribute("numbuttons", 12) - controller.Update = function() - if controller.Shuffle:IsPlaying() then - controller.Shuffle:Stop() + barController = CreateFrame("Frame", "LSActionBarController", UIParent, "SecureHandlerStateTemplate") + barController:SetSize(32, 32) + barController:SetPoint("BOTTOM", 0, 0) + barController:SetAttribute("numbuttons", 12) + barController.Update = function() + if barController.Shuffle:IsPlaying() then + barController.Shuffle:Stop() end - controller.Shuffle:Play() + barController.Shuffle:Play() end - anim_controller = CreateFrame("Frame", "LSActionBarAnimController", UIParent) - anim_controller:SetFrameLevel(controller:GetFrameLevel()) - anim_controller:SetAllPoints(controller) - - -- These frames are used as anchors/parents for other frames, some of - -- which are protected, so make these secure too - local top = CreateFrame("Frame", "$parentTop", controller, "SecureHandlerBaseTemplate") - top:SetFrameLevel(controller:GetFrameLevel() + 1) + -- These frames are used as anchors/parents for secure/protected frames + local top = CreateFrame("Frame", "$parentTop", barController, "SecureHandlerBaseTemplate") + top:SetFrameLevel(barController:GetFrameLevel() + 1) top:SetPoint("BOTTOM", 0, 28 / 2) - top:SetSize(unpack(elements.top.mid.size)) - controller.Top = top - controller:SetFrameRef("top", top) + top:SetSize(432 / 2, 90 / 2) + barController.Top = top + barController:SetFrameRef("top", top) - local bottom = CreateFrame("Frame", "$parentBottom", controller, "SecureHandlerBaseTemplate") - bottom:SetFrameLevel(controller:GetFrameLevel() + 7) + local bottom = CreateFrame("Frame", "$parentBottom", barController, "SecureHandlerBaseTemplate") + bottom:SetFrameLevel(barController:GetFrameLevel() + 7) bottom:SetPoint("BOTTOM", 0, 0) - bottom:SetSize(unpack(elements.bottom.mid.size)) - controller.Bottom = bottom - controller:SetFrameRef("bottom", bottom) - - -- These frames are used as anchors/parents for textures - top = CreateFrame("Frame", "$parentTop", anim_controller) - top:SetFrameLevel(anim_controller:GetFrameLevel() + 1) + bottom:SetSize(432 / 2, 46 / 2) + barController.Bottom = bottom + barController:SetFrameRef("bottom", bottom) + + -- These frames are used as anchors/parents for textures because I'm using C_Timer.After, + -- so I can't resize protected frames while in combat + local animController = CreateFrame("Frame", nil, UIParent) + animController:SetFrameLevel(barController:GetFrameLevel()) + animController:SetAllPoints(barController) + + top = CreateFrame("Frame", nil, animController) + top:SetFrameLevel(animController:GetFrameLevel() + 1) top:SetPoint("BOTTOM", 0, 28 / 2) - top:SetSize(unpack(elements.top.mid.size)) - anim_controller.Top = top + top:SetSize(432 / 2, 90 / 2) + animController.Top = top local texture = top:CreateTexture(nil, "ARTWORK") texture:SetTexture("Interface\\AddOns\\ls_UI\\assets\\console") - texture:SetTexCoord(unpack(elements.top.left.coords)) + texture:SetTexCoord(1 / 2048, 233 / 2048, 1 / 256, 91 / 256) texture:SetPoint("BOTTOMRIGHT", top, "BOTTOMLEFT", 0, 0) - texture:SetSize(unpack(elements.top.left.size)) + texture:SetSize(232 / 2, 90 / 2) top.Left = texture texture = top:CreateTexture(nil, "ARTWORK") texture:SetTexture("Interface\\AddOns\\ls_UI\\assets\\console") - texture:SetTexCoord(unpack(elements.top.mid.coords)) + texture:SetTexCoord(233 / 2048, 665 / 2048, 1 / 256, 91 / 256) texture:SetAllPoints() top.Mid = texture texture = top:CreateTexture(nil, "ARTWORK") texture:SetTexture("Interface\\AddOns\\ls_UI\\assets\\console") - texture:SetTexCoord(unpack(elements.top.right.coords)) + texture:SetTexCoord(665 / 2048, 897 / 2048, 1 / 256, 91 / 256) texture:SetPoint("BOTTOMLEFT", top, "BOTTOMRIGHT", 0, 0) - texture:SetSize(unpack(elements.top.right.size)) + texture:SetSize(232 / 2, 90 / 2) top.Right = texture - bottom = CreateFrame("Frame", "$parentBottom", anim_controller) - bottom:SetFrameLevel(anim_controller:GetFrameLevel() + 7) + bottom = CreateFrame("Frame", nil, animController) + bottom:SetFrameLevel(animController:GetFrameLevel() + 7) bottom:SetPoint("BOTTOM", 0, 0) - bottom:SetSize(unpack(elements.bottom.mid.size)) - anim_controller.Bottom = bottom + bottom:SetSize(432 / 2, 46 / 2) + animController.Bottom = bottom texture = bottom:CreateTexture(nil, "ARTWORK") texture:SetTexture("Interface\\AddOns\\ls_UI\\assets\\console") - texture:SetTexCoord(unpack(elements.bottom.left.coords)) + texture:SetTexCoord(1 / 2048, 569 / 2048, 92 / 256, 138 / 256) texture:SetPoint("BOTTOMRIGHT", bottom, "BOTTOMLEFT", 0, 0) - texture:SetSize(unpack(elements.bottom.left.size)) + texture:SetSize(568 / 2, 46 / 2) bottom.Left = texture texture = bottom:CreateTexture(nil, "ARTWORK") texture:SetTexture("Interface\\AddOns\\ls_UI\\assets\\console") - texture:SetTexCoord(unpack(elements.bottom.mid.coords)) + texture:SetTexCoord(569 / 2048, 1001 / 2048, 92 / 256, 138 / 256) texture:SetAllPoints() bottom.Mid = texture texture = bottom:CreateTexture(nil, "ARTWORK") texture:SetTexture("Interface\\AddOns\\ls_UI\\assets\\console") - texture:SetTexCoord(unpack(elements.bottom.right.coords)) + texture:SetTexCoord(1001 / 2048, 1569 / 2048, 92 / 256, 138 / 256) texture:SetPoint("BOTTOMLEFT", bottom, "BOTTOMRIGHT", 0, 0) - texture:SetSize(unpack(elements.bottom.right.size)) + texture:SetSize(568 / 2, 46 / 2) bottom.Right = texture - local ag = anim_controller:CreateAnimationGroup() + local ag = animController:CreateAnimationGroup() ag:SetScript("OnPlay", function() - local newstate = controller:GetAttribute("numbuttons") + local newstate = barController:GetAttribute("numbuttons") for _, widget in next, WIDGETS do if widget.frame then @@ -265,7 +216,7 @@ function MODULE.SetupActionBarController() if widget.children then for _, child in next, widget.children do - E:FadeOut(child) + E:FadeOut(_G[child]) end end end @@ -280,8 +231,8 @@ function MODULE.SetupActionBarController() end) C_Timer.After(0.25, function() - anim_controller.Top:SetWidth(newstate == 6 and 0.001 or 216) - anim_controller.Bottom:SetWidth(newstate == 6 and 0.001 or 216) + animController.Top:SetWidth(newstate == 6 and 0.001 or 216) + animController.Bottom:SetWidth(newstate == 6 and 0.001 or 216) end) end) ag:SetScript("OnFinished", function() @@ -295,17 +246,17 @@ function MODULE.SetupActionBarController() if widget.children then for _, child in next, widget.children do - if child:IsShown() then - E:FadeIn(child) + if _G[child]:IsShown() then + E:FadeIn(_G[child]) else - child:SetAlpha(1) + _G[child]:SetAlpha(1) end end end end end end) - controller.Shuffle = ag + barController.Shuffle = ag local anim = ag:CreateAnimation("Translation") anim:SetChildKey("Top") @@ -320,24 +271,12 @@ function MODULE.SetupActionBarController() anim:SetOffset(0, -23) anim:SetDuration(0.1) - anim = ag:CreateAnimation("Translation") - anim:SetChildKey("Bag") - anim:SetOrder(2) - anim:SetOffset(0, -23) - anim:SetDuration(0.1) - anim = ag:CreateAnimation("Translation") anim:SetChildKey("Bottom") anim:SetOrder(3) anim:SetOffset(0, 23) anim:SetDuration(0.1) - anim = ag:CreateAnimation("Translation") - anim:SetChildKey("Bag") - anim:SetOrder(3) - anim:SetOffset(0, 23) - anim:SetDuration(0.1) - anim = ag:CreateAnimation("Translation") anim:SetChildKey("Top") anim:SetOrder(4) From bdd208094309633818ada0f89d790daa3d13a643 Mon Sep 17 00:00:00 2001 From: Val Voronov Date: Mon, 1 Oct 2018 09:27:32 +0700 Subject: [PATCH 03/17] Updated embedded LAB --- embeds/LibActionButton-1.0 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/embeds/LibActionButton-1.0 b/embeds/LibActionButton-1.0 index 19b2f155..6bbd98fb 160000 --- a/embeds/LibActionButton-1.0 +++ b/embeds/LibActionButton-1.0 @@ -1 +1 @@ -Subproject commit 19b2f1552e2ca04af123368aff4e3dc1bb7aa59f +Subproject commit 6bbd98fb39e2ea32d630d33776a9630e1a028c7e From 9875fd56a93c74bc6b18f3fa17238928afc4d7d5 Mon Sep 17 00:00:00 2001 From: Val Voronov Date: Tue, 2 Oct 2018 15:26:25 +0700 Subject: [PATCH 04/17] :lipstick: --- modules/bars/zone.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/bars/zone.lua b/modules/bars/zone.lua index ef2d0788..aec4f4b8 100644 --- a/modules/bars/zone.lua +++ b/modules/bars/zone.lua @@ -14,7 +14,6 @@ local isInit = false function MODULE.CreateZoneButton() if not isInit then - local bar = CreateFrame("Frame", "LSZoneAbilityBar", UIParent, "SecureHandlerStateTemplate") bar._id = "zone" bar._buttons = {} From a771a3d85fbf5b0560608f5e051428c53cc80e89 Mon Sep 17 00:00:00 2001 From: Val Voronov Date: Tue, 2 Oct 2018 15:27:47 +0700 Subject: [PATCH 05/17] Removed cooldown text's horizontal alignment --- config/auras.lua | 8 +------- config/auratracker.lua | 8 +------- config/bars.lua | 8 +------- config/unitframes.lua | 8 +------- core/cooldown.lua | 3 +-- core/defaults.lua | 16 ---------------- 6 files changed, 5 insertions(+), 46 deletions(-) diff --git a/config/auras.lua b/config/auras.lua index eec22ce7..d2a9c7c5 100644 --- a/config/auras.lua +++ b/config/auras.lua @@ -277,14 +277,8 @@ local function getOptionsTable_Aura(order, name, filter) name = L["FLAG"], values = FLAGS, }, - h_alignment = { - order = 4, - type = "select", - name = L["TEXT_HORIZ_ALIGNMENT"], - values = H_ALIGNMENTS, - }, v_alignment = { - order = 5, + order = 4, type = "select", name = L["TEXT_VERT_ALIGNMENT"], values = V_ALIGNMENTS, diff --git a/config/auratracker.lua b/config/auratracker.lua index 0daad347..0f86f31b 100644 --- a/config/auratracker.lua +++ b/config/auratracker.lua @@ -314,14 +314,8 @@ function CONFIG.CreateAuraTrackerPanel(_, order) name = L["FLAG"], values = FLAGS, }, - h_alignment = { - order = 15, - type = "select", - name = L["TEXT_HORIZ_ALIGNMENT"], - values = H_ALIGNMENTS, - }, v_alignment = { - order = 16, + order = 15, type = "select", name = L["TEXT_VERT_ALIGNMENT"], values = V_ALIGNMENTS, diff --git a/config/bars.lua b/config/bars.lua index 1d15b997..b3cf7456 100644 --- a/config/bars.lua +++ b/config/bars.lua @@ -502,14 +502,8 @@ local function getOptionsTable_Bar(barID, order, name) name = L["FLAG"], values = FLAGS, }, - h_alignment = { - order = 4, - type = "select", - name = L["TEXT_HORIZ_ALIGNMENT"], - values = H_ALIGNMENTS, - }, v_alignment = { - order = 5, + order = 4, type = "select", name = L["TEXT_VERT_ALIGNMENT"], values = V_ALIGNMENTS, diff --git a/config/unitframes.lua b/config/unitframes.lua index 1a803850..1f518829 100644 --- a/config/unitframes.lua +++ b/config/unitframes.lua @@ -1692,14 +1692,8 @@ local function getOptionsTable_Auras(order, unit) name = L["FLAG"], values = FLAGS, }, - h_alignment = { - order = 4, - type = "select", - name = L["TEXT_HORIZ_ALIGNMENT"], - values = H_ALIGNMENTS, - }, v_alignment = { - order = 5, + order = 4, type = "select", name = L["TEXT_VERT_ALIGNMENT"], values = V_ALIGNMENTS, diff --git a/core/cooldown.lua b/core/cooldown.lua index 453a0019..4bc272d4 100644 --- a/core/cooldown.lua +++ b/core/cooldown.lua @@ -35,7 +35,6 @@ local defaults = { enabled = true, size = 12, flag = "_Outline", -- "_Shadow", "" - h_alignment = "CENTER", v_alignment = "MIDDLE", }, } @@ -138,7 +137,7 @@ local function cooldown_UpdateFontObject(self, fontObject) local config = self.config.text self.Timer:SetFontObject(fontObject or "LSFont" .. config.size .. config.flag) - self.Timer:SetJustifyH(config.h_alignment) + self.Timer:SetJustifyH("CENTER") self.Timer:SetJustifyV(config.v_alignment) self.Timer:SetShown(config.enabled) self.Timer:SetWordWrap(false) diff --git a/core/defaults.lua b/core/defaults.lua index 7bb6ae2b..f3f72276 100644 --- a/core/defaults.lua +++ b/core/defaults.lua @@ -370,7 +370,6 @@ D.profile = { enabled = true, size = 10, flag = "_Outline", -- "_Shadow", "" - h_alignment = "CENTER", v_alignment = "BOTTOM", }, }, @@ -793,7 +792,6 @@ D.profile = { enabled = true, size = 10, flag = "_Outline", -- "_Shadow", "" - h_alignment = "CENTER", v_alignment = "BOTTOM", }, }, @@ -1104,7 +1102,6 @@ D.profile = { enabled = true, size = 10, flag = "_Outline", -- "_Shadow", "" - h_alignment = "CENTER", v_alignment = "BOTTOM", }, }, @@ -1424,7 +1421,6 @@ D.profile = { enabled = true, size = 10, flag = "_Outline", -- "_Shadow", "" - h_alignment = "CENTER", v_alignment = "BOTTOM", }, }, @@ -1591,7 +1587,6 @@ D.profile = { enabled = true, size = 12, flag = "_Outline", -- "_Shadow", "" - h_alignment = "CENTER", v_alignment = "MIDDLE", }, }, @@ -1643,7 +1638,6 @@ D.profile = { enabled = true, size = 12, flag = "_Outline", -- "_Shadow", "" - h_alignment = "CENTER", v_alignment = "MIDDLE", }, }, @@ -1695,7 +1689,6 @@ D.profile = { enabled = true, size = 12, flag = "_Outline", -- "_Shadow", "" - h_alignment = "CENTER", v_alignment = "MIDDLE", }, }, @@ -1747,7 +1740,6 @@ D.profile = { enabled = true, size = 12, flag = "_Outline", -- "_Shadow", "" - h_alignment = "CENTER", v_alignment = "MIDDLE", }, }, @@ -1799,7 +1791,6 @@ D.profile = { enabled = true, size = 12, flag = "_Outline", -- "_Shadow", "" - h_alignment = "CENTER", v_alignment = "MIDDLE", }, }, @@ -1841,7 +1832,6 @@ D.profile = { enabled = true, size = 10, flag = "_Outline", -- "_Shadow", "" - h_alignment = "CENTER", v_alignment = "MIDDLE", }, }, @@ -1875,7 +1865,6 @@ D.profile = { enabled = true, size = 10, flag = "_Outline", -- "_Shadow", "" - h_alignment = "CENTER", v_alignment = "MIDDLE", }, }, @@ -1934,7 +1923,6 @@ D.profile = { enabled = true, size = 14, flag = "_Outline", -- "_Shadow", "" - h_alignment = "CENTER", v_alignment = "MIDDLE", }, }, @@ -1964,7 +1952,6 @@ D.profile = { enabled = true, size = 14, flag = "_Outline", -- "_Shadow", "" - h_alignment = "CENTER", v_alignment = "MIDDLE", }, }, @@ -2177,7 +2164,6 @@ D.profile = { enabled = true, size = 12, flag = "_Outline", -- "_Shadow", "" - h_alignment = "CENTER", v_alignment = "BOTTOM", }, }, @@ -2225,7 +2211,6 @@ D.profile = { enabled = true, size = 12, flag = "_Outline", -- "_Shadow", "" - h_alignment = "CENTER", v_alignment = "BOTTOM", }, }, @@ -2263,7 +2248,6 @@ D.profile = { enabled = true, size = 12, flag = "_Outline", -- "_Shadow", "" - h_alignment = "CENTER", v_alignment = "BOTTOM", }, }, From 3d2c7500bf01318bc894f716c065f59e089b3c8f Mon Sep 17 00:00:00 2001 From: Val Voronov Date: Fri, 5 Oct 2018 10:51:05 +0700 Subject: [PATCH 06/17] :lipstick: --- modules/minimap/minimap.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/minimap/minimap.lua b/modules/minimap/minimap.lua index 247124c3..7222b173 100644 --- a/modules/minimap/minimap.lua +++ b/modules/minimap/minimap.lua @@ -652,13 +652,13 @@ function MODULE.Init() GameTooltip:SetOwner(self, "ANCHOR_NONE") GameTooltip:SetPoint(p, self, rP, x, y) + GameTooltip:AddLine(L["CALENDAR"], 1, 1, 1) + GameTooltip:AddLine(L["CALENDAR_TOGGLE_TOOLTIP"]) if self.pendingCalendarInvites > 0 then GameTooltip:AddLine(L["CALENDAR_PENDING_INVITES_TOOLTIP"]) end - GameTooltip:AddLine(L["CALENDAR"], 1, 1, 1) - GameTooltip:AddLine(L["CALENDAR_TOGGLE_TOOLTIP"]) GameTooltip:Show() end) button:SetScript("OnLeave", function() From 1f13818d5ed3d16fce9d656479eab45861858610 Mon Sep 17 00:00:00 2001 From: Val Voronov Date: Sun, 7 Oct 2018 20:08:27 +0700 Subject: [PATCH 07/17] Slightly reworked unit frame insets --- assets/border-thick.TGA | Bin 17383 -> 17409 bytes assets/unit-frame-sep-horiz.TGA | Bin 1817 -> 1793 bytes config/unitframes.lua | 13 +-- modules/unitframes/elements/insets.lua | 140 ++++++++++++------------- 4 files changed, 74 insertions(+), 79 deletions(-) diff --git a/assets/border-thick.TGA b/assets/border-thick.TGA index e3d3b5ef514cc00dce958a28a8f4f9b08fb7fd55..b9193de3629cfe7ffddb1bb1b96a1d3eb3aef3a7 100644 GIT binary patch literal 17409 zcma*uXOvad`N#2bh8Ym#Z%m@t9YBhRJr?}Oh7<+SBt{XtVg&`UV@v^i!7d}1YS$El zDXjFhQcSXpd6m~11HOsQTlxEj^Z$MJy=UgmfL>hd%RO_--p_uX-+p#E$BvHC9RvUE z)Z5Y9d+$#9Z`Yjb47-GV!a?EaFh5)$)`k8@9(km?;)*M(JMX-+`q7VmROQ?|;p}k0 z<8>(qG|#+q(@i&37hQBwb>fL9Rtpy{ba#JvHYica#{@Nv3oPhbQtf?-&^wMhO%9Yixe)X$1wz%v3^UtqNIN^lqt6%-H8%qFnH-G_1iX9TzN5m-uq2c~J^l34)wS1NTitQT z9mD<7n|nGR6>=pBxih5w&MmjxQeAS%CDm!ComO3b`Q^1uT6aw#g(Jhnz^0u;=e7Z( zX7OZt?IiBiA4<=niM#H)tNO`LezF5j5~x#8J+-xGY2tN3z|^2;afN_&59wLXFqN8* z5Ay?CxVeAr+O?&bn%!PJaskU{&YW3&`O9Cfox>J#B!%MwTlNUT(^Y!bZaES#`u=QS zOC7LlbF739AA9VvA{;$z-MV#3e>W@&?(YtrrDaMJG-q6K$GbP)cw-UK{Q2`s|IE4m z@Km@u%nFBx@!|74aBRp0v7x2g>rHng!t zPt)tAp_Y`mzFDG@wRTz{6<+8rffFol7C3I}4Tpvk!WH51@S$MoW%u28U-iB3eUB~g zhZRA#Dz46N=RGVlWl*D<_Yb>;;;*3r z?8<3HwmMCQ<+KvOTECLu#*G`>IL$a>)G>}2Pf`j+DM^V+7M3Z2(-<_^^Lp}^0J`E1 z&E#hNq}Zb8En2jwqV`|@@|SIFVKM0$Ut4Uc$Jg4H$tj(f1aM>tAR)13bm02^!Xbh5 zE({Na4_1BWJKw2B{on^bsDA$QpI3(+cG$-`yD^*}4h#b!d_V|4mou#)bcZ`Pjvqh% zQ1XRsELlP@- zv1Mv-CtI!$MO+U*{BTK?dOt_z{HM%&Ns!WKW<-?ib2nQAREbJHK4`T}pytLDhW5F9 z=OCc$F{wBrEC{!Rw<49TeSLjJzW3jMfA#(Ef4}%=>eQ)%`g+(VsP}wYP+y-sdGZ#y z#AwOxFMa7t6@O-6*s8{GV_?BifyCHN7^90^2Ii%Vr_Wl6f=a)dU4m+QBRoc^_6rDO zDuX1rVU8pdB@2~aszwG4E+F($ws4}b>!tGpTS`!kOwy-h+ujxyyL;BGSyju(EvRgn z6Vy=mQhl;}J-6qeqidC;RgT8wADwoDKLRryb6tI|)7|-dWaunU<)EYUuIA~E&UKFV z$T=mrOG9Py1H!a$Qdk_A_uiRjp1Jj*haM^})T1cIyiVM6eY=V&b*X`^Y->#euTPvf zam(Fz-(6jO_0`q9dGm_Wt$#8>rkMA_`oMxy0*iXXxWF;=JuJVgMir_Q&tt>fAX*wx z=2>zoO|+ksk}u^9ixv$o33O0*K}M;0aG2)QvB4FcR9xAzEGVJh+-7lBH0C$$hiP|F z&dj8P7UirDBxy>Gdi0rLMR-1J%6xO{*T4StGDExWy6Y;5#47K= z0}tGi>)RFADwTesxI8IOTz~!bMO<^{%&C?yUoMu!wJE$1ZU_qkiw+EX2IH0%cMVNT zqjHLKG{UVyKPPbiGofGSmX?e)?N?t0K2kJsZdvh=sS-&=K-E-_H6sSb8UfffX#SKi zBd}$8SQq-`bha34+D~LS#-!n-lTK=#JdkN^%P~1-%RYfDx}N6#q2d~m^I%;qtTALk zOC7s9`m857c$~jJ?@mIIbv_r2S8nEhzdO6Dn~ZqBM~%*Ou5H%cNNhcI#QcsAhlW$a z!f<K1}WUI}juYBbz)siJkss|r@u(Fcx?d_$p4dMJi36nyviVoP_QE!a2eE;;_&gG*;lcmEN`OB16N~DX3gt2emK9Win#~ zGuE`9K#-xkWv`Z%SuL=70-ePb>}3gnsR>#om6ED0|6T!#2*= zr=-?QIxT;zk-)m28jP`{yPT6>D2q1e<@4OQH)F?#-Z0UbDgK$PMNV6o^aj%9TVkt) zCZj1(!NfS2DT}_{-W}XRfgY>-|Is-Q$23lTSWb?YG~4M7A-k z2#d7lY^5)1p4nK7%F2dBiAwTH;%XJu%G^(cv%?WV_=t)(G?ilz*_8k&vS3MI0)p=40db@j+OiDd|J=s|lCS^ITa<{2?-=HpT6z7Y>?V%_v z+9(R65t9>x9F=8J^>OZbKfFs_?i{M81?LmBhbug3PuuP{-!1=eF8pSg>G0>2lVmIxFo_mrXXA&#%GI zy}WFO?_P5pa~-q&Y|Gcmdo^X>5iSn3^7xZ2TA@F%u~^^iti!g&N9MAi?;SXDMo<*F z^o26(uO~yl`ORl9q@0VYmPX*Ne<#3pr?pU~(l}iU1#f{P8kw za$EZsPKJ=}OcJ$9iMknyPYGHt+&$$L+SDA?0<3=ta8!`rYVmQir-_e{P7Y^=MZu=p z)#2K(wE3&nCE=QIS-2=H44xrOWgHU3K^hwu)F-u#4kLq3%1_%SK=#*>lzNn;eWwLA ztqd=RO@>(>tY;vEX4F`m^^~Ns$_DoC{&EKolAwJi67-ubo?3#hq(tded(|YmY91dX zH4?0CFEYHJ4hOa?^eIi$RIU_q#SqK-FtDjeSnWez=RfjmSr?EW=g$o@0tXAZnul&G zaR(r=S(`eExa5y8AJ^e9D3DNSCtvj z8E2eP*6C(QhK|!uKfMgRTxjNGibs#lG`Oi**2?@!x$5B7>7h6571&ZYgN?=Jp*m!? z)-svb6)`V}J@56~e-urbdB@VA<%8Km%j;Z8Ofr}sjt!H78W}hEl8Gyw5pB_^bx6UY z*>CTWD|FoUOBp&m=bUpmto$mWS(4V(woK0Po?+L}^;mPThz=c`6~0{&wAl3 z?b&jV9HqYZ!t>$wpu{t#q{de;8)_?u$ zUuDeDN7(Aci;Y7OH?Q_)+eVpp8&5s;l>S}E_Jw9y7vz^}>ez~py4k>5aUIpPx2w!v znaPV$sv|em0rt?IVSLc!8A0I-gKi_({|KAI2jRne@=w12eb_wX%G*IGJmE>w;{vWw zGDnuB{g@my+&1DtCJqd`{K+m2(IAcE!0UpN%b=?Z+@0xX`$1PmmgI&_^tEPrV4nmr zDeM*0JUHj$KrM7daLK_Fo|Hz)peymRWyb_Zo)WL5r-V@3GCRk7C25g37d5^(ai(6+ zN+a?OyDT=`IUyVpJk3{xaa(vf{3oem>l<&pQT_SPf39A8?X_zC`t@aMZ_#L6Gof0X z`IPTo%)D$c`clBX&4uKDQqD_ZWiUpb9=;ePlmmjOvSk;l>LD;u91&Xb;7(2nwVS%j z?KzMM$A#XYnXNO2%k%fGfzlogj|a1dwc(l2r=+z)X5O$StPVGZ#o^3wVmLAo^n}3B zT?6Nh4xOtRl!K1W@|Jo)g*`c?;MT~`%iq_B68U-?*3!3q)hrm0~@7-CEPL5^u?`z>KT!c5wb+cNdjs-?}6)gTzPyGCrA_PVF%IxVub z4&byLdzJ<-3oFB`VN+DU^%uYRMddZquYdjP>YxAoXJw)wVLNB5Lpt{Emc0&V{8oL`SCfN6SWcW(BCx`zH?j$_EAiUlns=J4ht4Ei*o5E|%3CagoL)6D=Ef5E# zsYQHB#BB=IJ+%F27$#34FAZWP;?n{<)jT*F^N%yE=MTMpUZB2pp}coB zsgyl->>Y636KuIEA+*|}wOTC-BGpy$p!(~WwW{uboabdR(nBu}cLvJXym;~At>69b zcZ+RyiY(J)H(R*5{(fj|?wXjt>x@sTcvNf5cZ}1%b(=ePZmqdja^K3Jra3{p`EI|U zAJAM6g>YR*=aT~M&&C3NCr6>YAs#a#M-q}q?;W(JymC=s$Kk8<&leO^Ys#>CgufsY247;MxYSJ>iCwoqr$m}$91n5eWLYrVxV-kW{4Z28o-(7PNpEzmn# z8e2Z1AU5pbA3dA`DUn@A1R66NyDhvLHb?tgfBfSgmsi7P9B;k#R`t8z{jNIXkVCfQ z`o^##G+t5B*`nr|jRzfc(Eok=+uttRyB3t@2i}2Zj!8Aq%bDr}ARq3rk?aSX~*pfKxS+w6jsgu~upf;jfNxyo z@k7Ij;kC;UCRy>6Cmq){y3_H9RZU5EbPg4o8|vU{_A%kKuq>3| zTG$)^e7wvSAx_eJQOL8plovdj(x#Fq3f+TXYygBLlX0^4ZXD6sm>R{wpP$ zQ1!c$Ve>{M&J9|t)oLWEhAmvn@f^vaobMc~zYxv{{PTP$UkiCRY#m?@Dck@3?|-ij zKm715x&C@MJLtrvwfXHV!BAoy9#`Dq&e!+ZXP=McLiXE0GtcxA>-gi3C%8@F#lV8I z0)O(Bq$EQU5m|MWFP{WoE%karyZE__kQ{W3b~MI)5|Z{RfozKuS36NZRpgozWrXhD zDMy1_*kzA%Ab}}M84?)3wZ?LYuK29|EQ~LtJGwHfNQwPHNn%MQwXSqJ{v2G5vRYeO zZ4v#Yq1fX8Eixmtrfa`4))VvyYk(GA^)*YBz>W=cwO8QL#wMH&%rA9++ds$C!^z>2 zARYfZBlXt5{q1ih#YmMB*KdFO+xDL}Dt)_p8aHm-M|#f9H{V=7;;0i?d`VC51-M;5o9NfJy+!NlHhpg-0eDlrfuYdh( z$pg(RWI3otQ9zdl;So^zV2>~~pd)i;Y^Zw% z2hI-Mub-FAZW9K!w9go3bre5LT&)>{Eu2b19Mo9q8+HYhb$rtsriT;5rD09@FLB$* z)?5Gbm%muze4O(e!}&p}N>ol`XIH7igXzwVQ>IM$SOCpP*=*U9^B)8?SzvuJkd#1L zcZ?35LwjZ&NZOnfjtzAn`*Pe*AN0LruSErtt2wV_gyuYfR5Gau}GzBDl$8cqsVhsVN) zdZzL8rI%i+jMO>zepnI6V<3p1{{I1*bNKSt+EvcUlOKl1!K8apYZ;@SNlBb0X_JWbpvJLbaOzIA+{m5o;0RB6 zQVC_f$`)z9eO53jBqp}BOtG}8wuP7kaQ8q=jWlnn&K8NwmGR-oFgtMTQ=$LaXP+%T zv3+1_m2>ZgMPX9#d}H;iw7Lhn;*NLaxB6r2<~M-?w>GF@b`Ur<%UI+va%kWbIVLdB zn8;akf~L{vz&B!ckJ^72!yr!5^IB4;+ zjBvf-6aHU!^IrR3{$F=<-`vS2vXq%-1p|i~>wt|I8Ze4r823>(?adDiD^8Lk=~XD& z@5Z>xtjhn{*ODr0b?d_n5)M6$f(BD1WjnKHsBMwZ*rJ58rL0uxyM0eHmv;AdW~P!a zDQNA~AYf!WXiHE2;uopX9qy!mw)BOvVE4k-3$ylL+nSu1+ztC*Sd}DDTFEbxGP&*? I8Y%Jr0qt;pj{pDw literal 17383 zcma*u*_Tz-wa0O+qLpaW1Ozmp0BHmi#VCypiuBke#0Koame#&cQ=r%0YlAdu8a0NP zj07AR@jm4-_de+T7wo_nwO%j!!nwcCs#;a2O3Z;VzIFE5XYaM=n)5g3T6^uypg~6u z>iu_A$Dodm|2QiDzMp+V!^kiuObKU&Wnp938M-!Z+}K#Ta%E%Px^;~=-gu*teIJEY zVf;(AmGM1$KDzP78ygE2ENIM_F{6BDe^=NYHiV^NZa6i#;;~`a^R<<>d}GVlFfIHf zEDvni5xVZa`|idSS6tC}_~D0-z?K_sxS`l^>ZzwT&OP^BmVXu4vN@~>bAl_K7`_*V z{cp8paK5o+R5&G^6BdO#Lh;Ln4I3Iumo9DGbkj|Z=bn46g>vW8!!e<~#Hcq=?b*e|ae@0BzA|v@uF$o9{rbkLRjV3Xwrpv< z`R1D~400s%XU?42m_L8MqidiTBv86MIh+(orL8wmL-LJ@Lg)xb63zNhoO8=9w=}N4 z`s&7}O`DD|P#0f(abw!FY0aW}Ev*R@=gbS7!xmm>D}g#LTLf$mTLg+}NkKw*30nzi#$RM}BYnPa)S5`PoC-AKiTO&5esLx~TX^;Ii+lup?;M74(`-qr!+V zq<_GMWEXw=nPKw-Cka?_(&o*ZOJ>QiKmPHL&4wK&vnYs@rca;Vm^W`;4Vch32aG{n zAv}En8YiMt#aTaygtQR=BDKCmG0(R-8mo~O-+ja!D ztX;dd*rGi5ltj+alECSu{83*>g>$+CcS5$fnk}{kZdSN3tPR}z{fgtlj8Ty4=Fzc|8?pQ{^-7A-23z-RW!yqCf);rt+g9YGr`8W2ED z+N}$d1E;MB>qBwcop;_@il6bMb><0R&AbH}+tLcB$r}M|E|tQhGks$kTaF2AQ3Z%e z$a@3$;DZmA%zNO02acdru359DsC&wkDJ28bQVpOM7l%1Pj=Lfm4=<(i2iX$9VS(;{ z98M1l!j0ki@a5x=Ki-giTeog)y!z^^M)7a5|NXEguwU==sqJY&tgYJP7e_eq{qf_+ ze`91+LRE-`3m5X+7vY(3bC?&V2bQQ!Y#mTS8LL@t)wDn^37f)ep-fILyX>-tf^_6% z>x?tbXdY)sVsls?80AW%f-Cn0QdN)-+{(RdsevrE5Ytb8`qPF$zW(~_y8CY?N+u_& zg2{<;m7@i6XJCs=Bo(&kJvny=Qt-?L_(lO78@N%}uMFG50TZ>CUV5qV!V52y${?^) zr%pYX-}Z%7LCbnrg88IiYMDfugXze93Fg;VUU_BX+H0?EtXQ$4q4q6ayqL`gLT6YL z_-4oW?H ze4iN32$zKW!UsS9`OgpCe*5i>%P+sYao>ISl^LfJJ9+YCLERg^71SpLRcnU}>fVly zj<4Blq}5Av3awvo!3BqM&WFL3FApr45_pP*{5Z6KU@1}(JA@iJQ(!lS;!G0^b566= zx8HudMPQ9nvchDiX`Is1=D?YA182G-N%f7Hy35291GDFc6+sw^EoP-e#*wY7hPk70 zD6TFUn^uTSOIp-RwSb(>PDh6JU0k1yL2aG3Sk!JKpF=urjIhV=LEwk=Y!ib0KILJ% zyj#9}c_~j%Jn=-S@28w{%6BSf zn=2@I<)Zm?1s$ZZy%Q%+{My{rK;5ahkG$lPOU$?E=9A#MYr}#tGpO)C2wEwv_ScTS z(vEo1POYpGQBz&_+;dN3*|KG2a@u;hu9H*RX}Yt~(w0C8bAs-S3*yx`QDz=9rH!H> zWvg~}XS<7LqzetTE(&+taYt`~YO3;8J5|RDR86k7*Ev5sqMiI{x5-1peH%$P)XwVq zX`k=xwoe~MIGTV44c(eQ?VTF6uWhHTsvcE{>y>P&!u6K~6S23#{&e+_WK{Ac!d-XW z)%e9Pe$hDjQ1LCd}rOsU~-Ti4VBVL-7&Z%&FN=Xmef%FDBCnN zQYQw?_aqPp=#`S7_^b>Y!>&*!?4}8XbY!E7V5#J(hDw!$7yb=F%VaS*oEW&hy?0cp zg>Y>4vW5M^OnN&*S;Np@0{Z*k|K6ey)-?>pr%6Cs;vv!$GXiqO68_!%-&|Y>;%I)O zltIVZI^n4NG2oB!Z8U-Di>MJIPyWy^$JfaK|2o}w{vNW`RkAUt?NwXOu7%6>s7h;c ze@3_6mQmS$mlTmD0p`9pz3nU23=-cdrk- zLYFCuO2FvWRmt2*3AO-aQmlngD}k2h27w$GxO;FvQQ0#pu!a1Vg?<8e7ie_dv13OI zQMsWZrU7?>&7yJz@^wXC7`$DO#h|+?Wn<7_Ux)J3(LoyUTM<=0f28hAFb@#Q=#N%gAYdN;>C5^f4h0-uQv2bAhu3?ItU0VAR$;WBo!nQNAYUTs-hQ+eIn zv|iPBkHAJ#s-_W9JhiB0wh0E?jt#?mi&wL@*g}QQpoF4xev+70LRzn+n^L*?G$Ia| z-chTT^>%7t3stwj+^enPE1uyxkrfY7mWAU3QOyY2m>(8|3&KUtTuLL0oo<(bL}#kL zCTDv>&=kkJG*^rWgFBg^jkY56vDu>Ws&B_Q)_!IP^SMFTRkL4&J>h`b!&%ZxMYFnX zB=Sjs>XQm*X!X6*#&NgadTY7+61=m|KD%MUo|${I&|JZlmIWP`F%yH{=t-GTmOGKb z`8MFbepq%fpU0&m@5%B_p~P4XGs=tc?%lf^+5b^k6%Mo3U2p$p&6+iEp{B-|<2hU{ zV_u)$hUObv7*3J%0$VnR-dbj^aAex&KLhrFHHNBvExQ6+P7K5`r09*R+C)8{Ld`DW zraZq1HGesCR?s6u$Yo(o5R6;G9bp6IY%-v%54VT4;pT94SQ(r-C(y1e(=rdx_tC-C z1&#&PsryW!EG_e+C5ofbL*OL&e4DNcXdpW@iOJ}&+Xx*@N97GePLa=B53QZpl#P`7Nj7uW^hl6w3Vcpkv+|}w&yz`N-Lq~OD&xq z<^*EAHdHZwX8DTnJclqlHy|q`7R(J9K0WiCJ$rU}5Nko-&8@nb2eT?78SV)WhZ}=y zoEua`wVB7H)v;lOE;DjaTmRdK8hqKM`?7m+5GpS0^6*F*b~pXo-~P5mMYPsp%0A$6 zt(LU7BDjKjH#Trr|Jj{AoHseh;^kpuD7JV4DJj_W$}6w5u*I+0fQjpDy12%C7K5_&hjF zXSM{VUmWHHE>XV51PT&0mlm{g2h%+uv!pEy>G?_gMh2%y?Nh>xFfS|(F7aS^Gkjw9 zXLYvIWNxq(X%aL<8##P-ng$XW`Gi2ZzKlXscuMXgyRbQdSdu~=vzOlw#X4j zaF=coDS;GQOa!>=4}bVW3#obBb(jTy)srnNf-4ZUE0WdF7ZjAS*{XF!{i|UWd6n^p zL0Bh-nL#Uhwk8PcTj7(`ghPM*>tD;GFi%sgVVg74?WcA%)iF*)&Sg7X6i4n zp9aEEKM7@Vm>W(Hge0&u%o-vS*dfgB%tqUbwz832v1JUV#$ka9oIsUwYf?BZ2#AYZ z748l@!-qlMd=Vr|SN+^(L)g9yj`$!rqo&THY-@2wa0Ovz1(9*&;L!aLw^xG<^E1Dn z8md1xW?Qtncu2Xk%=5e7{jNpaO}bR(!`yIau{rLH`(Efj0knsM*uwKGL$3zi{J61p zM^5rOYHif?Cz`GJ8qh6lo) z@R^lY3G%@QA2i;2>#cHUB!TNwAoC~X#%#-7xtjnIG?7TfX&%TPNqg6YB|%)tup>wr zLE|j;v9ri9pWSoAYz%7KN`)QSs(o;dK8y(y!jzzLUlcA6>%zTZYj`%i6n2DNf!l0v z@A>rG^Pw|1$GMjVQ-|3>0Dl}@>-!EmT8Sx^=Ciwimq*e4q&PCajSkJ>-;nQAURGf1 zX!q{B@3xSl@Edt8+>xXfg1&4D;x;!-4Qwpo@4feBEAQ43|H3LebpBOeaoDyXDim*8p9rBGyy{93q?}+$7Z!$#!_u(ar?VGQ)&;>4j#L0o3#W#Ofwrqj zq{V&1LNTipo!%;FxBO=aO%SpRk$q90iHt$eq^9)>V14gsz>VSHEb{Guzm$J5T#LV0!7q)_!}eJ^Br%LLVc+_V}=$JG}4)@!|IOZW4+(YAWjSF_Wv zlqcG(=k~>c@*WL)!hxvf(2Fm=SY8-V-QIcUoyOn(_P55QNt3?G@1KVOtGlu78#Pmo z*H>-z(Cw)fgO*+4xsubj~loXu}^FKVt*7XR8xq3iKq+jBO0<>n`fqWe4csv;R9l=$B<0CnodC4HA2R5= zdn0|fa#{#%(Yqx<$&lq^Ly=o~r&vg2rkcQ+oa!j{$o*@=BcVtv33kZaTIQw(Rt3(z zM?7#a$Gjiz4*j1}-IG24<#h}zN$c_m)T0OYOUhi&gM|G#=1;+uTv6pA2vJf`Sf)S= zGtae`$GM~@rse&UA&&D~kwQMnLY1q%GBS3ANr8+e2JK6zx^F_ZwNvF)&)1gtks`6X z&X95o)GIE#nJCoF0o|1EC7>3+1yn72^2sNK=%cVI9AAzKk*G%KD$51UKuV5GeW6r`BbgS@?(2>*v9xeC7?K+5^(#6 z1-d9NeU#b%@pkFEQWJ=-j`|Aejib8PjBhBVmyj4T_227g;xYK3N|hq+;Kkl8y! zms}K1>%~XDG-jEuX=0=$ViitT;7(U0>h5p~pWfReOUQgqSQ&b4F`%%;XY2dcI%FFr zy``0w$o#cHtV@EBvW4SZxqFgUw(@Og;C%rTyejugv#mF8h0n<9FMs(`1-V$xf^Jf>&6`LoD$M72{Z<-EZpRVNbl zv-?J?w`MUy$Ap=Sxq3<9IN4nm!p#27d0M|nWsY>amN^6NJFM<=* zr(t(k7ZwIS>Igik9fBELUg@NoZUOUYEn7v_4Dj<17WkF8O5O3Ld#fyd4|Y^h%~3YC z=1=!xORsjE;JU6qIVc&tDsB0vXh%PcF|Ff8WeYRj4Jb+?uf=7d76J;Pl)j=w$27zi z1;EHi$D2d3#ltIW+MXe_UeKju6S@H})9y@b8-fBUrCq7o()~b9eXp@)k6-208R3#} zfA}y@Ne)?Dlu!OMivPplZIzCWj)VDqZ}?U@DsM?E9kum-${9Cq+(B;~C`HCO?@TDH zSqP+@55oiD(!dgSj|cNvJk5s4u7lTWy(^?Ky$#6$FV;Y|&M-_149SEee649>x~Zof}A5*pz{8TdLcK zW)FMJBiTa&Yr^B9{9lHB`}Q^d`OklrNy~fhz1Qd|1^e>*w*p$8!)ftw0o^xx^yq_~ zRsco{qftgt$kF?Q%)B~O&#}imRl#ce?|$KwqiPskiaL{PI7?orsRnDGt>2jP(52S* z0XIAY^MbyP4t;Y{(vr0&hFUM=s56T#Dz+;KXKP!`=@zD5449J=DQT$}=LWqdEnesj z=MS>Q@%C`r_%JhE5Y~q0!xvU&lymp_|N7UzOclP#{`Z5BpAw2#^V#D6808K2Z_Gi} zH@)*HJ!gFxUI^ER^8yQ4;$}r42lo%;u-n?kY0&4nk`UZ-h&bK#+}EH+R#*+LR* z(K6Xi39cvuyJvu0C6L2|9Gw(qg^Pkfz7oEwuO(V8?0J#-^X$Jn7*6y(e24N(22{?=1?C4u^lmQA<&0w@fm z!D+%H_erPkl@FOHq%x6P9jUOgr38=-y6QH+^_?nZdy=fMHcjE#vL!4DuAs<|4I@K$ zCd$6Hz&f_n0CMO0@M-V}YisuS#StGH$$M6`YUT;t z_HcVx6pV-h#{zN~P(nFN;F!*x@`8K0d3WfY=9nV4UX*4~eNH#vrBf|dwNK6V=)j=9 zz)`y5z!qJcAK20xILm&Dj3tI6dwyv|98f~_N{frbydZGng1~j#a$L6fg>~G1g z5sy+iU>!z_HPfbLTkmWivR=TJgUcT}Phsm3G{Bp0GlBr!o0 zjYbI)d<|b^)oGnzpvKw7$Ns&CN~WgO$tW1PMP8*zmwMHa2X(y1Ht7 zuv98#xrn0@tAqGIYj^bZ^=W8mNTE{qt+9o61{y@3tA>F$jJz2%fA0zSg$)$@&#|XaNsTfC~fy@|w-2 z+}+)sK5?&mdwZtzLZP5yv1k*5slX&*axhJp1e9fZWV2bD9F7s;;c=NvM(?(_w=H&e zch_Fw@bFOedRv4erau7XUn- i7allyxCQn+OQX?veh?b1ZQB6+w$YxqrZw&#eSQM>amqRX literal 1817 zcmb7^$x2*N5QcBNN+elC2$4Y0or}5i&+TCUEDfV_5W3M&Z#<{m+ARm#LM+^bDu-$?>TMD;n&XZ)tjH6 zm)qLfQh0WDRx>j*T3K1q^z^hgH#db1r|(-@TGIOZx>i?LwYIh<^trh?ZEtTI4jU1% zO-)UiL?`Cr;-baDP7FBY!Oxmlu~^L38yg!|3)tP=U5iC+;E6>&{9LRVEu78x@U41A9Y5L*Ro44nG`p zBynnLY6KRYHSrzb5GXt@5{W1adu3&1z{P_Njvt4bph94cow)Fj*ugstpNS6w#{1~( zgy=*7^NsUZSXj{D;GmY5m+eHy#>O-;F(F?L4Gq~jf*lmm;6wU7MvuS; zOO;@$2OKqgy1Kg3&CQJt4-a*8bfk-m3!R*t=Cb%rBZSLG7k<8%#utd_3-eZ z`}=!ggZ1?Er1SH0?eFhfG>7pk-0SOWU0z;VOe9F+V?TJu`}hP(iI4Ir;TUJQ~=C`L4qNZ4+ibBf2~LUM{o2A)TU2M8Zcz{tYo zBDrMRkTs2ggiu8>Kud zOG3`z$Ar)#?(y+a*&H#=K{L=CtZ68};qcQ~FljQbX>V`OV7H~;_u diff --git a/config/unitframes.lua b/config/unitframes.lua index 1f518829..73d4e704 100644 --- a/config/unitframes.lua +++ b/config/unitframes.lua @@ -40,11 +40,6 @@ local POINTS_EXT = { ["TOPRIGHT"] = "TOPRIGHT", } -local INSETS = { - [8] = "8", - [12] = "12", -} - local H_ALIGNMENTS = { ["CENTER"] = "CENTER", ["LEFT"] = "LEFT", @@ -2200,10 +2195,10 @@ local function getOptionsTable_UnitFrame(order, unit, name) }, top_inset = { order = 15, - type = "select", + type = "range", name = L["TOP_INSET_SIZE"], desc = L["TOP_INSET_SIZE_DESC"], - values = INSETS, + min = 8, max = 32, step = 2, get = function() return C.db.profile.units[unit].insets.t_height end, @@ -2217,10 +2212,10 @@ local function getOptionsTable_UnitFrame(order, unit, name) }, bottom_inset = { order = 16, - type = "select", + type = "range", name = L["BOTTOM_INSET_SIZE"], desc = L["BOTTOM_INSET_SIZE_DESC"], - values = INSETS, + min = 8, max = 32, step = 2, get = function() return C.db.profile.units[unit].insets.b_height end, diff --git a/modules/unitframes/elements/insets.lua b/modules/unitframes/elements/insets.lua index b8501de2..c81d6415 100644 --- a/modules/unitframes/elements/insets.lua +++ b/modules/unitframes/elements/insets.lua @@ -64,8 +64,8 @@ local function frame_UpdateInsets(self) local top = self.Insets.Top local bottom = self.Insets.Bottom - top._height = self._config.insets.t_height + 2 - bottom._height = self._config.insets.b_height + 2 + top._height = self._config.insets.t_height + bottom._height = self._config.insets.b_height if top:IsExpanded() then top:SetHeight(top._height) @@ -85,40 +85,40 @@ function UF:CreateInsets(frame, texParent) topInset:SetPoint("TOPLEFT", 0, 0) topInset:SetPoint("TOPRIGHT", 0, 0) - local texture1 = (texParent or frame):CreateTexture(nil, "OVERLAY", nil, 4) - texture1:SetTexture("Interface\\AddOns\\ls_UI\\assets\\unit-frame-sep-horiz") - texture1:SetTexCoord(1 / 64, 15 / 64, 11 / 32, 23 / 32) - texture1:SetSize(14 / 2, 12 / 2) - texture1:SetPoint("BOTTOMLEFT", topInset, "BOTTOMLEFT", -1, -2) - - local texture2 = (texParent or frame):CreateTexture(nil, "OVERLAY", nil, 4) - texture2:SetTexture("Interface\\AddOns\\ls_UI\\assets\\unit-frame-sep-horiz", true) - texture2:SetTexCoord(16 / 64, 30 / 64, 11 / 32, 23 / 32) - texture2:SetSize(14 / 2, 12 / 2) - texture2:SetPoint("BOTTOMRIGHT", topInset, "BOTTOMRIGHT", 1, -2) - - local texture3 = (texParent or frame):CreateTexture(nil, "OVERLAY", nil, 4) - texture3:SetTexture("Interface\\AddOns\\ls_UI\\assets\\unit-frame-sep-horiz", true) - texture3:SetTexCoord(0 / 64, 64 / 64, 0 / 32, 12 / 32) - texture3:SetHorizTile(true) - texture3:SetPoint("TOPLEFT", texture1, "TOPRIGHT", 0, 0) - texture3:SetPoint("BOTTOMRIGHT", texture2, "BOTTOMLEFT", 0, 0) - - local texture4 = (texParent or frame):CreateTexture(nil, "OVERLAY", nil, 0) - texture4:SetTexture("Interface\\AddOns\\ls_UI\\assets\\statusbar-glass") - texture4:SetPoint("TOPLEFT", topInset, "TOPLEFT", 0, 0) - texture4:SetPoint("BOTTOMRIGHT", topInset, "BOTTOMRIGHT", 0, 2) - - local texture5 = (texParent or frame):CreateTexture(nil, "OVERLAY", nil, -1) - texture5:SetTexture("Interface\\AddOns\\ls_UI\\assets\\statusbar-glass-shadow") - texture5:SetPoint("TOPLEFT", topInset, "TOPLEFT", 0, 0) - texture5:SetPoint("BOTTOMRIGHT", topInset, "BOTTOMRIGHT", 0, 2) - - topInset.Left = texture1 - topInset.Mid = texture3 - topInset.Right = texture2 - topInset.Glass = texture4 - topInset.GlassShadow = texture5 + local left = (texParent or frame):CreateTexture(nil, "OVERLAY", nil, 4) + left:SetTexture("Interface\\AddOns\\ls_UI\\assets\\unit-frame-sep-horiz") + left:SetTexCoord(1 / 64, 17 / 64, 11 / 32, 23 / 32) + left:SetSize(16 / 2, 12 / 2) + left:SetPoint("BOTTOMLEFT", topInset, "BOTTOMLEFT", 0, -2) + + local right = (texParent or frame):CreateTexture(nil, "OVERLAY", nil, 4) + right:SetTexture("Interface\\AddOns\\ls_UI\\assets\\unit-frame-sep-horiz", true) + right:SetTexCoord(18 / 64, 34 / 64, 11 / 32, 23 / 32) + right:SetSize(16 / 2, 12 / 2) + right:SetPoint("BOTTOMRIGHT", topInset, "BOTTOMRIGHT", 0, -2) + + local mid = (texParent or frame):CreateTexture(nil, "OVERLAY", nil, 4) + mid:SetTexture("Interface\\AddOns\\ls_UI\\assets\\unit-frame-sep-horiz", true) + mid:SetTexCoord(0 / 64, 64 / 64, 0 / 32, 12 / 32) + mid:SetHorizTile(true) + mid:SetPoint("TOPLEFT", left, "TOPRIGHT", 0, 0) + mid:SetPoint("BOTTOMRIGHT", right, "BOTTOMLEFT", 0, 0) + + local glass = (texParent or frame):CreateTexture(nil, "OVERLAY", nil, 0) + glass:SetTexture("Interface\\AddOns\\ls_UI\\assets\\statusbar-glass") + glass:SetPoint("TOPLEFT", topInset, "TOPLEFT", 0, 0) + glass:SetPoint("BOTTOMRIGHT", topInset, "BOTTOMRIGHT", 0, 2) + + local shadow = (texParent or frame):CreateTexture(nil, "OVERLAY", nil, -1) + shadow:SetTexture("Interface\\AddOns\\ls_UI\\assets\\statusbar-glass-shadow") + shadow:SetPoint("TOPLEFT", topInset, "TOPLEFT", 0, 0) + shadow:SetPoint("BOTTOMRIGHT", topInset, "BOTTOMRIGHT", 0, 2) + + topInset.Left = left + topInset.Mid = mid + topInset.Right = right + topInset.Glass = glass + topInset.GlassShadow = shadow topInset.Expand = inset_Expand topInset.Collapse = inset_Collapse topInset.IsExpanded = inset_IsExpanded @@ -131,40 +131,40 @@ function UF:CreateInsets(frame, texParent) bottomInset:SetPoint("BOTTOMLEFT", 0, 0) bottomInset:SetPoint("BOTTOMRIGHT", 0, 0) - texture1 = (texParent or frame):CreateTexture(nil, "OVERLAY", nil, 4) - texture1:SetTexture("Interface\\AddOns\\ls_UI\\assets\\unit-frame-sep-horiz") - texture1:SetTexCoord(1 / 64, 15 / 64, 11 / 32, 23 / 32) - texture1:SetSize(14 / 2, 12 / 2) - texture1:SetPoint("TOPLEFT", bottomInset, "TOPLEFT", -1, 2) - - texture2 = (texParent or frame):CreateTexture(nil, "OVERLAY", nil, 4) - texture2:SetTexture("Interface\\AddOns\\ls_UI\\assets\\unit-frame-sep-horiz", true) - texture2:SetTexCoord(16 / 64, 30 / 64, 11 / 32, 23 / 32) - texture2:SetSize(14 / 2, 12 / 2) - texture2:SetPoint("TOPRIGHT", bottomInset, "TOPRIGHT", 1, 2) - - texture3 = (texParent or frame):CreateTexture(nil, "OVERLAY", nil, 4) - texture3:SetTexture("Interface\\AddOns\\ls_UI\\assets\\unit-frame-sep-horiz", true) - texture3:SetTexCoord(0 / 64, 64 / 64, 0 / 32, 12 / 32) - texture3:SetHorizTile(true) - texture3:SetPoint("TOPLEFT", texture1, "TOPRIGHT", 0, 0) - texture3:SetPoint("BOTTOMRIGHT", texture2, "BOTTOMLEFT", 0, 0) - - texture4 = (texParent or frame):CreateTexture(nil, "OVERLAY", nil, 0) - texture4:SetTexture("Interface\\AddOns\\ls_UI\\assets\\statusbar-glass") - texture4:SetPoint("TOPLEFT", bottomInset, "TOPLEFT", 0, -2) - texture4:SetPoint("BOTTOMRIGHT", bottomInset, "BOTTOMRIGHT", 0, 0) - - texture5 = (texParent or frame):CreateTexture(nil, "OVERLAY", nil, -1) - texture5:SetTexture("Interface\\AddOns\\ls_UI\\assets\\statusbar-glass-shadow") - texture5:SetPoint("TOPLEFT", bottomInset, "TOPLEFT", 0, -2) - texture5:SetPoint("BOTTOMRIGHT", bottomInset, "BOTTOMRIGHT", 0, 0) - - bottomInset.Left = texture1 - bottomInset.Mid = texture3 - bottomInset.Right = texture2 - bottomInset.Glass = texture4 - bottomInset.GlassShadow = texture5 + left = (texParent or frame):CreateTexture(nil, "OVERLAY", nil, 4) + left:SetTexture("Interface\\AddOns\\ls_UI\\assets\\unit-frame-sep-horiz") + left:SetTexCoord(1 / 64, 17 / 64, 11 / 32, 23 / 32) + left:SetSize(16 / 2, 12 / 2) + left:SetPoint("TOPLEFT", bottomInset, "TOPLEFT", 0, 2) + + right = (texParent or frame):CreateTexture(nil, "OVERLAY", nil, 4) + right:SetTexture("Interface\\AddOns\\ls_UI\\assets\\unit-frame-sep-horiz", true) + right:SetTexCoord(18 / 64, 34 / 64, 11 / 32, 23 / 32) + right:SetSize(16 / 2, 12 / 2) + right:SetPoint("TOPRIGHT", bottomInset, "TOPRIGHT", 0, 2) + + mid = (texParent or frame):CreateTexture(nil, "OVERLAY", nil, 4) + mid:SetTexture("Interface\\AddOns\\ls_UI\\assets\\unit-frame-sep-horiz", true) + mid:SetTexCoord(0 / 64, 64 / 64, 0 / 32, 12 / 32) + mid:SetHorizTile(true) + mid:SetPoint("TOPLEFT", left, "TOPRIGHT", 0, 0) + mid:SetPoint("BOTTOMRIGHT", right, "BOTTOMLEFT", 0, 0) + + glass = (texParent or frame):CreateTexture(nil, "OVERLAY", nil, 0) + glass:SetTexture("Interface\\AddOns\\ls_UI\\assets\\statusbar-glass") + glass:SetPoint("TOPLEFT", bottomInset, "TOPLEFT", 0, -2) + glass:SetPoint("BOTTOMRIGHT", bottomInset, "BOTTOMRIGHT", 0, 0) + + shadow = (texParent or frame):CreateTexture(nil, "OVERLAY", nil, -1) + shadow:SetTexture("Interface\\AddOns\\ls_UI\\assets\\statusbar-glass-shadow") + shadow:SetPoint("TOPLEFT", bottomInset, "TOPLEFT", 0, -2) + shadow:SetPoint("BOTTOMRIGHT", bottomInset, "BOTTOMRIGHT", 0, 0) + + bottomInset.Left = left + bottomInset.Mid = mid + bottomInset.Right = right + bottomInset.Glass = glass + bottomInset.GlassShadow = shadow bottomInset.Expand = inset_Expand bottomInset.Collapse = inset_Collapse bottomInset.IsExpanded = inset_IsExpanded From c4bc70175e1449b4c908d1fc28c728224e2d8d59 Mon Sep 17 00:00:00 2001 From: Val Voronov Date: Wed, 10 Oct 2018 11:47:48 +0700 Subject: [PATCH 08/17] Update UF aura text options Might need to rename few functions later --- config/unitframes.lua | 40 ++++++++------- core/defaults.lua | 20 +++++--- modules/unitframes/elements/auras.lua | 71 +++++++++++++++++---------- 3 files changed, 79 insertions(+), 52 deletions(-) diff --git a/config/unitframes.lua b/config/unitframes.lua index 73d4e704..52cc7867 100644 --- a/config/unitframes.lua +++ b/config/unitframes.lua @@ -1607,19 +1607,20 @@ local function getOptionsTable_Auras(order, unit) type = "description", name = " ", }, - count = { + text = { order = 40, type = "group", name = L["COUNT_TEXT"], inline = true, get = function(info) - return C.db.profile.units[unit].auras.count[info[#info]] + return C.db.profile.units[unit].auras.text[info[#info]] end, set = function(info, value) - if C.db.profile.units[unit].auras.count[info[#info]] ~= value then - C.db.profile.units[unit].auras.count[info[#info]] = value + if C.db.profile.units[unit].auras.text[info[#info]] ~= value then + C.db.profile.units[unit].auras.text[info[#info]] = value UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateAuras") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Auras", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Auras", "UpdateFonts") end end, args = { @@ -1629,20 +1630,24 @@ local function getOptionsTable_Auras(order, unit) name = L["SIZE"], min = 10, max = 20, step = 2, }, - flag = { + outline = { order = 2, - type = "select", - name = L["FLAG"], - values = FLAGS, + type = "toggle", + name = L["OUTLINE"], }, - h_alignment = { + shadow = { order = 3, + type = "toggle", + name = L["SHADOW"], + }, + h_alignment = { + order = 4, type = "select", name = L["TEXT_HORIZ_ALIGNMENT"], values = H_ALIGNMENTS, }, v_alignment = { - order = 4, + order = 5, type = "select", name = L["TEXT_VERT_ALIGNMENT"], values = V_ALIGNMENTS, @@ -2020,14 +2025,15 @@ local function getOptionsTable_Auras(order, unit) end end - temp.args.count.get = function(info) - return C.db.profile.units[unit][E.UI_LAYOUT].auras.count[info[#info]] + temp.args.text.get = function(info) + return C.db.profile.units[unit][E.UI_LAYOUT].auras.text[info[#info]] end - temp.args.count.set = function(info, value) - if C.db.profile.units[unit][E.UI_LAYOUT].auras.count[info[#info]] ~= value then - C.db.profile.units[unit][E.UI_LAYOUT].auras.count[info[#info]] = value + temp.args.text.set = function(info, value) + if C.db.profile.units[unit][E.UI_LAYOUT].auras.text[info[#info]] ~= value then + C.db.profile.units[unit][E.UI_LAYOUT].auras.text[info[#info]] = value UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateAuras") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Auras", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Auras", "UpdateFonts") end end diff --git a/core/defaults.lua b/core/defaults.lua index f3f72276..a337ce9e 100644 --- a/core/defaults.lua +++ b/core/defaults.lua @@ -359,9 +359,10 @@ D.profile = { x_growth = "RIGHT", y_growth = "UP", disable_mouse = false, - count = { + text = { size = 10, - flag = "_Outline", -- "_Shadow", "" + outline = true, + shadow = false, h_alignment = "RIGHT", v_alignment = "TOP", }, @@ -781,9 +782,10 @@ D.profile = { x_growth = "RIGHT", y_growth = "UP", disable_mouse = false, - count = { + text = { size = 10, - flag = "_Outline", -- "_Shadow", "" + outline = true, + shadow = false, h_alignment = "RIGHT", v_alignment = "TOP", }, @@ -1091,9 +1093,10 @@ D.profile = { x_growth = "RIGHT", y_growth = "UP", disable_mouse = false, - count = { + text = { size = 10, - flag = "_Outline", -- "_Shadow", "" + outline = true, + shadow = false, h_alignment = "RIGHT", v_alignment = "TOP", }, @@ -1410,9 +1413,10 @@ D.profile = { x_growth = "LEFT", y_growth = "DOWN", disable_mouse = false, - count = { + text = { size = 10, - flag = "_Outline", -- "_Shadow", "" + outline = true, + shadow = false, h_alignment = "RIGHT", v_alignment = "TOP", }, diff --git a/modules/unitframes/elements/auras.lua b/modules/unitframes/elements/auras.lua index 5f99856b..ef189599 100644 --- a/modules/unitframes/elements/auras.lua +++ b/modules/unitframes/elements/auras.lua @@ -268,12 +268,12 @@ local function element_CreateAuraIcon(element, index) local count = button.Count count:SetAllPoints() - count:SetFontObject("LSFont" .. config.count.size .. config.count.flag) - count:SetJustifyH(config.count.h_alignment) - count:SetJustifyV(config.count.v_alignment) + count:SetFontObject("LSFont" .. config.text.size .. (config.text.outline and "_Outline" or "")) + count:SetJustifyH(config.text.h_alignment) + count:SetJustifyV(config.text.v_alignment) count:SetWordWrap(false) - if config.count.flag == "_Shadow" then + if config.text.shadow then count:SetShadowOffset(1, -1) else count:SetShadowOffset(0, 0) @@ -318,7 +318,7 @@ local function element_CreateAuraIcon(element, index) return button end -local function element_UpdateAuraType(self, _, aura, _, _, _, _, debuffType) +local function element_PostUpdateIcon(self, _, aura, _, _, _, _, debuffType) if aura.isDebuff then if self._config.type.debuff_type then aura.AuraType:SetTexCoord(unpack(ICONS[debuffType] or ICONS["Debuff"])) @@ -357,6 +357,38 @@ local function element_UpdateCooldownConfig(element) end end +local function element_UpdateFonts(element) + local config = element._config.text + local fontObj = "LSFont" .. config.size .. (config.outline and "_Outline" or "") + local count + + for i = 1, element.createdIcons do + count = element[i].count + count:SetFontObject(fontObj) + count:SetJustifyH(config.h_alignment) + count:SetJustifyV(config.v_alignment) + count:SetWordWrap(false) + + if config.shadow then + count:SetShadowOffset(1, -1) + else + count:SetShadowOffset(0, 0) + end + end +end + +local function element_UpdateAuraTypeIcon(element) + local config = element._config.type + local auraType + + for i = 1, element.createdIcons do + auraType = element[i].AuraType + auraType:ClearAllPoints() + auraType:SetPoint(config.position, 0, 0) + auraType:SetSize(config.size, config.size) + end +end + local function frame_UpdateAuras(self) local element = self.Auras element:UpdateConfig() @@ -390,31 +422,14 @@ local function frame_UpdateAuras(self) element:SetSize((size * config.per_row + element.spacing * (config.per_row - 1)), size * config.rows + element.spacing * (config.rows - 1)) element:ClearAllPoints() - local auraType, count - for i = 1, element.createdIcons do - auraType = element[i].AuraType - auraType:ClearAllPoints() - auraType:SetPoint(config.type.position, 0, 0) - auraType:SetSize(config.type.size, config.type.size) - - count = element[i].count - count:SetFontObject("LSFont" .. config.count.size .. config.count.flag) - count:SetJustifyH(config.count.h_alignment) - count:SetJustifyV(config.count.v_alignment) - count:SetWordWrap(false) - - if config.count.flag == "_Shadow" then - count:SetShadowOffset(1, -1) - else - count:SetShadowOffset(0, 0) - end - end - local point1 = config.point1 if point1 and point1.p then element:SetPoint(point1.p, E:ResolveAnchorPoint(self, point1.anchor), point1.rP, point1.x, point1.y) end + element:UpdateAuraTypeIcon() + element:UpdateFonts() + if config.enabled and not self:IsElementEnabled("Auras") then self:EnableElement("Auras") elseif not config.enabled and self:IsElementEnabled("Auras") then @@ -430,14 +445,16 @@ function UF:CreateAuras(frame, unit) local element = CreateFrame("Frame", nil, frame) element:SetSize(48, 48) - element.spacing = 4 element.showDebuffType = true element.showStealableBuffs = true + element.spacing = 4 element.CreateIcon = element_CreateAuraIcon element.CustomFilter = filterFunctions[unit] or filterFunctions.default - element.PostUpdateIcon = element_UpdateAuraType + element.PostUpdateIcon = element_PostUpdateIcon + element.UpdateAuraTypeIcon = element_UpdateAuraTypeIcon element.UpdateConfig = element_UpdateConfig element.UpdateCooldownConfig = element_UpdateCooldownConfig + element.UpdateFonts = element_UpdateFonts frame.UpdateAuras = frame_UpdateAuras From 5281d568fee9a6edd71d31a623113187f78cbc43 Mon Sep 17 00:00:00 2001 From: Val Voronov Date: Wed, 10 Oct 2018 15:54:43 +0700 Subject: [PATCH 09/17] Added key blacklisting to E:CopyTable --- core/core.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/core/core.lua b/core/core.lua index 70860659..12809c32 100644 --- a/core/core.lua +++ b/core/core.lua @@ -166,16 +166,18 @@ end -- TABLES -- ------------ -function E:CopyTable(src, dest) +function E:CopyTable(src, dest, ignore) if type(dest) ~= "table" then dest = {} end for k, v in next, src do - if type(v) == "table" then - dest[k] = self:CopyTable(v, dest[k]) - else - dest[k] = v + if not ignore or not ignore[k] then + if type(v) == "table" then + dest[k] = self:CopyTable(v, dest[k]) + else + dest[k] = v + end end end From ea92bafe816c9fad335d204191d467d7cf1d4875 Mon Sep 17 00:00:00 2001 From: Val Voronov Date: Wed, 10 Oct 2018 19:05:44 +0700 Subject: [PATCH 10/17] Reworked health text handling and options That includes both health and heal prediction elements --- config/unitframes.lua | 474 +++++++++++++++------- core/defaults.lua | 228 ++++++++++- modules/unitframes/elements/health.lua | 178 ++++---- modules/unitframes/units/boss.lua | 4 +- modules/unitframes/units/focus.lua | 4 +- modules/unitframes/units/focustarget.lua | 4 +- modules/unitframes/units/pet.lua | 13 +- modules/unitframes/units/player.lua | 8 +- modules/unitframes/units/target.lua | 4 +- modules/unitframes/units/targettarget.lua | 4 +- 10 files changed, 681 insertions(+), 240 deletions(-) diff --git a/config/unitframes.lua b/config/unitframes.lua index 52cc7867..52a52d2f 100644 --- a/config/unitframes.lua +++ b/config/unitframes.lua @@ -130,7 +130,8 @@ local function getOptionsTable_Health(order, unit) set = function(info, value) C.db.profile.units[unit].health.color[info[#info]] = value UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateHealth") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateColorSettings") end, args = { class = { @@ -158,50 +159,102 @@ local function getOptionsTable_Health(order, unit) name = L["BAR_TEXT"], inline = true, get = function(info) - return C.db.profile.units[unit].health.text.point1[info[#info]] + return C.db.profile.units[unit].health.text[info[#info]] end, set = function(info, value) - if C.db.profile.units[unit].health.text.point1[info[#info]] ~= value then - C.db.profile.units[unit].health.text.point1[info[#info]] = value + if C.db.profile.units[unit].health.text[info[#info]] ~= value then + C.db.profile.units[unit].health.text[info[#info]] = value UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateHealth") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateFontObjects") end end, args = { - p = { - order = 4, - type = "select", - name = L["POINT"], - desc = L["POINT_DESC"], - values = POINTS, + size = { + order = 1, + type = "range", + name = L["SIZE"], + min = 10, max = 20, step = 2, }, - anchor = { - order = 5, - type = "select", - name = L["ANCHOR"], - values = getRegionAnchors({["Health.Text"] = true}), + outline = { + order = 2, + type = "toggle", + name = L["OUTLINE"], }, - rP = { - order = 6, + shadow = { + order = 3, + type = "toggle", + name = L["SHADOW"], + }, + h_alignment = { + order = 4, type = "select", - name = L["RELATIVE_POINT"], - desc = L["RELATIVE_POINT_DESC"], - values = POINTS, + name = L["TEXT_HORIZ_ALIGNMENT"], + values = H_ALIGNMENTS, }, - x = { - order = 7, - type = "range", - name = L["X_OFFSET"], - min = -128, max = 128, step = 1, + spacer_1 = { + order = 9, + type = "description", + name = " ", }, - y = { - order = 8, - type = "range", - name = L["Y_OFFSET"], - min = -128, max = 128, step = 1, + point = { + order = 10, + type = "group", + name = "", + inline = true, + get = function(info) + return C.db.profile.units[unit].health.text.point1[info[#info]] + end, + set = function(info, value) + if C.db.profile.units[unit].health.text.point1[info[#info]] ~= value then + C.db.profile.units[unit].health.text.point1[info[#info]] = value + UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateTextPoints") + end + end, + args = { + p = { + order = 4, + type = "select", + name = L["POINT"], + desc = L["POINT_DESC"], + values = POINTS, + }, + anchor = { + order = 5, + type = "select", + name = L["ANCHOR"], + values = getRegionAnchors({["Health.Text"] = true}), + }, + rP = { + order = 6, + type = "select", + name = L["RELATIVE_POINT"], + desc = L["RELATIVE_POINT_DESC"], + values = POINTS, + }, + x = { + order = 7, + type = "range", + name = L["X_OFFSET"], + min = -128, max = 128, step = 1, + }, + y = { + order = 8, + type = "range", + name = L["Y_OFFSET"], + min = -128, max = 128, step = 1, + }, + }, + }, + spacer_2 = { + order = 19, + type = "description", + name = " ", }, tag = { - order = 10, + order = 20, type = "input", width = "full", name = L["FORMAT"], @@ -214,7 +267,8 @@ local function getOptionsTable_Health(order, unit) C.db.profile.units[unit].health.text.tag = value:gsub("\124\124+", "\124") UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateHealth") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateTags") end, }, }, @@ -254,50 +308,102 @@ local function getOptionsTable_Health(order, unit) name = L["DAMAGE_ABSORB_TEXT"], inline = true, get = function(info) - return C.db.profile.units[unit].health.prediction.absorb_text.point1[info[#info]] + return C.db.profile.units[unit].health.prediction.absorb_text[info[#info]] end, set = function(info, value) - if C.db.profile.units[unit].health.prediction.absorb_text.point1[info[#info]] ~= value then - C.db.profile.units[unit].health.prediction.absorb_text.point1[info[#info]] = value + if C.db.profile.units[unit].health.prediction.absorb_text[info[#info]] ~= value then + C.db.profile.units[unit].health.prediction.absorb_text[info[#info]] = value UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateHealthPrediction") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateFontObjects") end end, args = { - p = { + size = { order = 1, - type = "select", - name = L["POINT"], - desc = L["POINT_DESC"], - values = POINTS, + type = "range", + name = L["SIZE"], + min = 10, max = 20, step = 2, }, - anchor = { + outline = { order = 2, - type = "select", - name = L["ANCHOR"], - values = getRegionAnchors(), + type = "toggle", + name = L["OUTLINE"], }, - rP = { + shadow = { order = 3, - type = "select", - name = L["RELATIVE_POINT"], - desc = L["RELATIVE_POINT_DESC"], - values = POINTS, + type = "toggle", + name = L["SHADOW"], }, - x = { + h_alignment = { order = 4, - type = "range", - name = L["X_OFFSET"], - min = -128, max = 128, step = 1, + type = "select", + name = L["TEXT_HORIZ_ALIGNMENT"], + values = H_ALIGNMENTS, }, - y = { - order = 5, - type = "range", - name = L["Y_OFFSET"], - min = -128, max = 128, step = 1, + spacer_1 = { + order = 9, + type = "description", + name = " ", + }, + point = { + order = 10, + type = "group", + name = "", + inline = true, + get = function(info) + return C.db.profile.units[unit].health.prediction.absorb_text.point1[info[#info]] + end, + set = function(info, value) + if C.db.profile.units[unit].health.prediction.absorb_text.point1[info[#info]] ~= value then + C.db.profile.units[unit].health.prediction.absorb_text.point1[info[#info]] = value + UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateTextPoints") + end + end, + args = { + p = { + order = 1, + type = "select", + name = L["POINT"], + desc = L["POINT_DESC"], + values = POINTS, + }, + anchor = { + order = 2, + type = "select", + name = L["ANCHOR"], + values = getRegionAnchors(), + }, + rP = { + order = 3, + type = "select", + name = L["RELATIVE_POINT"], + desc = L["RELATIVE_POINT_DESC"], + values = POINTS, + }, + x = { + order = 4, + type = "range", + name = L["X_OFFSET"], + min = -128, max = 128, step = 1, + }, + y = { + order = 5, + type = "range", + name = L["Y_OFFSET"], + min = -128, max = 128, step = 1, + }, + }, + }, + spacer_2 = { + order = 19, + type = "description", + name = " ", }, tag = { - order = 9, + order = 20, type = "input", width = "full", name = L["FORMAT"], @@ -310,7 +416,8 @@ local function getOptionsTable_Health(order, unit) C.db.profile.units[unit].health.prediction.absorb_text.tag = value:gsub("\124\124+", "\124") UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateHealthPrediction") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateTags") end, }, }, @@ -326,50 +433,102 @@ local function getOptionsTable_Health(order, unit) name = L["HEAL_ABSORB_TEXT"], inline = true, get = function(info) - return C.db.profile.units[unit].health.prediction.heal_absorb_text.point1[info[#info]] + return C.db.profile.units[unit].health.prediction.heal_absorb_text[info[#info]] end, set = function(info, value) - if C.db.profile.units[unit].health.prediction.heal_absorb_text.point1[info[#info]] ~= value then - C.db.profile.units[unit].health.prediction.heal_absorb_text.point1[info[#info]] = value + if C.db.profile.units[unit].health.prediction.heal_absorb_text[info[#info]] ~= value then + C.db.profile.units[unit].health.prediction.heal_absorb_text[info[#info]] = value UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateHealthPrediction") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateFontObjects") end end, args = { - p = { + size = { order = 1, - type = "select", - name = L["POINT"], - desc = L["POINT_DESC"], - values = POINTS, + type = "range", + name = L["SIZE"], + min = 10, max = 20, step = 2, }, - anchor = { + outline = { order = 2, - type = "select", - name = L["ANCHOR"], - values = getRegionAnchors(), + type = "toggle", + name = L["OUTLINE"], }, - rP = { + shadow = { order = 3, - type = "select", - name = L["RELATIVE_POINT"], - desc = L["RELATIVE_POINT_DESC"], - values = POINTS, + type = "toggle", + name = L["SHADOW"], }, - x = { + h_alignment = { order = 4, - type = "range", - name = L["X_OFFSET"], - min = -128, max = 128, step = 1, + type = "select", + name = L["TEXT_HORIZ_ALIGNMENT"], + values = H_ALIGNMENTS, }, - y = { - order = 5, - type = "range", - name = L["Y_OFFSET"], - min = -128, max = 128, step = 1, + spacer_1 = { + order = 9, + type = "description", + name = " ", + }, + point = { + order = 10, + type = "group", + name = "", + inline = true, + get = function(info) + return C.db.profile.units[unit].health.prediction.heal_absorb_text.point1[info[#info]] + end, + set = function(info, value) + if C.db.profile.units[unit].health.prediction.heal_absorb_text.point1[info[#info]] ~= value then + C.db.profile.units[unit].health.prediction.heal_absorb_text.point1[info[#info]] = value + UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateTextPoints") + end + end, + args = { + p = { + order = 1, + type = "select", + name = L["POINT"], + desc = L["POINT_DESC"], + values = POINTS, + }, + anchor = { + order = 2, + type = "select", + name = L["ANCHOR"], + values = getRegionAnchors(), + }, + rP = { + order = 3, + type = "select", + name = L["RELATIVE_POINT"], + desc = L["RELATIVE_POINT_DESC"], + values = POINTS, + }, + x = { + order = 4, + type = "range", + name = L["X_OFFSET"], + min = -128, max = 128, step = 1, + }, + y = { + order = 5, + type = "range", + name = L["Y_OFFSET"], + min = -128, max = 128, step = 1, + }, + }, + }, + spacer_2 = { + order = 19, + type = "description", + name = " ", }, tag = { - order = 9, + order = 20, type = "input", width = "full", name = L["FORMAT"], @@ -382,7 +541,8 @@ local function getOptionsTable_Health(order, unit) C.db.profile.units[unit].health.prediction.heal_absorb_text.tag = value:gsub("\124\124+", "\124") UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateHealthPrediction") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateTags") end, }, }, @@ -406,18 +566,30 @@ local function getOptionsTable_Health(order, unit) temp.args.color.set = function(info, value) C.db.profile.units[unit][E.UI_LAYOUT].health.color[info[#info]] = value UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateHealth") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateColorSettings") end temp.args.color.args.reaction = nil temp.args.text.get = function(info) - return C.db.profile.units[unit][E.UI_LAYOUT].health.text.point1[info[#info]] + return C.db.profile.units[unit][E.UI_LAYOUT].health.text[info[#info]] end temp.args.text.set = function(info, value) + C.db.profile.units[unit][E.UI_LAYOUT].health.text[info[#info]] = value + UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateFontObjects") + end + + temp.args.text.args.point.get = function(info) + return C.db.profile.units[unit][E.UI_LAYOUT].health.text.point1[info[#info]] + end + temp.args.text.args.point.set = function(info, value) C.db.profile.units[unit][E.UI_LAYOUT].health.text.point1[info[#info]] = value UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateHealth") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateTextPoints") end temp.args.text.args.tag.get = function() @@ -427,8 +599,9 @@ local function getOptionsTable_Health(order, unit) if not CONFIG:IsTagStringValid(value) then return end C.db.profile.units[unit][E.UI_LAYOUT].health.text.tag = value:gsub("\124\124+", "\124") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateHealth") + UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateTags") end temp.args.prediction.args.enabled.get = function() @@ -440,66 +613,77 @@ local function getOptionsTable_Health(order, unit) UNITFRAMES:UpdateUnitFrame(unit, "UpdateHealthPrediction") end - if unit == "player" then - temp.args.prediction.args.absorb_text.get = function(info) - return C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.absorb_text.point1[info[#info]] - end - temp.args.prediction.args.absorb_text.set = function(info, value) - if C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.absorb_text.point1[info[#info]] ~= value then - C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.absorb_text.point1[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateHealthPrediction") - end - end - - temp.args.prediction.args.absorb_text.args.tag.get = function() - return C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.absorb_text.tag:gsub("\124", "\124\124") + temp.args.prediction.args.absorb_text.get = function(info) + return C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.absorb_text[info[#info]] + end + temp.args.prediction.args.absorb_text.set = function(info, value) + if C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.absorb_text[info[#info]] ~= value then + C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.absorb_text[info[#info]] = value + UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateFontObjects") end - temp.args.prediction.args.absorb_text.args.tag.set = function(_, value) - if not CONFIG:IsTagStringValid(value) then return end + end - C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.absorb_text.tag = value:gsub("\124\124+", "\124") + temp.args.prediction.args.absorb_text.args.point.get = function(info) + return C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.absorb_text.point1[info[#info]] + end + temp.args.prediction.args.absorb_text.args.point.set = function(info, value) + if C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.absorb_text.point1[info[#info]] ~= value then + C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.absorb_text.point1[info[#info]] = value UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateHealthPrediction") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateTextPoints") end + end - temp.args.prediction.args.heal_absorb_text.get = function(info) - return C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.heal_absorb_text.point1[info[#info]] - end - temp.args.prediction.args.heal_absorb_text.set = function(info, value) - if C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.heal_absorb_text.point1[info[#info]] ~= value then - C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.heal_absorb_text.point1[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateHealthPrediction") - end - end + temp.args.prediction.args.absorb_text.args.tag.get = function() + return C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.absorb_text.tag:gsub("\124", "\124\124") + end + temp.args.prediction.args.absorb_text.args.tag.set = function(_, value) + if not CONFIG:IsTagStringValid(value) then return end - temp.args.prediction.args.heal_absorb_text.args.tag.get = function() - return C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.heal_absorb_text.tag:gsub("\124", "\124\124") + C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.absorb_text.tag = value:gsub("\124\124+", "\124") + UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateTags") + end + + temp.args.prediction.args.heal_absorb_text.get = function(info) + return C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.heal_absorb_text[info[#info]] + end + temp.args.prediction.args.heal_absorb_text.set = function(info, value) + if C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.heal_absorb_text[info[#info]] ~= value then + C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.heal_absorb_text[info[#info]] = value + UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateFontObjects") end - temp.args.prediction.args.heal_absorb_text.args.tag.set = function(_, value) - if not CONFIG:IsTagStringValid(value) then return end + end - C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.heal_absorb_text.tag = value:gsub("\124\124+", "\124") + temp.args.prediction.args.heal_absorb_text.args.point.get = function(info) + return C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.heal_absorb_text.point1[info[#info]] + end + temp.args.prediction.args.heal_absorb_text.args.point.set = function(info, value) + if C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.heal_absorb_text.point1[info[#info]] ~= value then + C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.heal_absorb_text.point1[info[#info]] = value UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateHealthPrediction") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateTextPoints") end - else - temp.args.prediction.args.spacer_1 = nil - temp.args.prediction.args.absorb_text = nil - temp.args.prediction.args.spacer_2 = nil - temp.args.prediction.args.heal_absorb_text = nil end - elseif unit == "targettarget" then - temp.args.prediction.args.spacer_1 = nil - temp.args.prediction.args.absorb_text = nil - temp.args.prediction.args.spacer_2 = nil - temp.args.prediction.args.heal_absorb_text = nil - elseif unit == "focustarget" then - temp.args.prediction.args.spacer_1 = nil - temp.args.prediction.args.absorb_text = nil - temp.args.prediction.args.spacer_2 = nil - temp.args.prediction.args.heal_absorb_text = nil + + temp.args.prediction.args.heal_absorb_text.args.tag.get = function() + return C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.heal_absorb_text.tag:gsub("\124", "\124\124") + end + temp.args.prediction.args.heal_absorb_text.args.tag.set = function(_, value) + if not CONFIG:IsTagStringValid(value) then return end + + C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.heal_absorb_text.tag = value:gsub("\124\124+", "\124") + UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateTags") + end end return temp diff --git a/core/defaults.lua b/core/defaults.lua index a337ce9e..c9ec73f2 100644 --- a/core/defaults.lua +++ b/core/defaults.lua @@ -35,6 +35,7 @@ D.profile = { traditional = {"BOTTOM", "UIParent", "BOTTOM", -312 , 74}, }, health = { + enabled = true, orientation = "VERTICAL", color = { class = false, @@ -42,6 +43,11 @@ D.profile = { }, text = { tag = "[ls:health:cur]", + size = 16, + outline = false, + shadow = true, + h_alignment = "CENTER", + v_alignment = "MIDDLE", point1 = { p = "BOTTOM", anchor = "", -- frame[anchor] or "" if anchor is frame itself @@ -54,6 +60,11 @@ D.profile = { enabled = true, absorb_text = { tag = "[ls:color:absorb-damage][ls:absorb:damage]|r", + size = 12, + outline = false, + shadow = true, + h_alignment = "CENTER", + v_alignment = "MIDDLE", point1 = { p = "BOTTOM", anchor = "Health.Text", @@ -64,6 +75,11 @@ D.profile = { }, heal_absorb_text = { tag = "[ls:color:absorb-heal][ls:absorb:heal]|r", + size = 12, + outline = false, + shadow = true, + h_alignment = "CENTER", + v_alignment = "MIDDLE", point1 = { p = "BOTTOM", anchor = "Health.Text", @@ -203,6 +219,7 @@ D.profile = { b_height = 12, }, health = { + enabled = true, orientation = "HORIZONTAL", color = { class = false, @@ -210,7 +227,11 @@ D.profile = { }, text = { tag = "[ls:health:cur]", + size = 12, + outline = false, + shadow = true, h_alignment = "LEFT", + v_alignment = "MIDDLE", point1 = { p = "LEFT", anchor = "Health", @@ -223,7 +244,11 @@ D.profile = { enabled = true, absorb_text = { tag = "[ls:color:absorb-damage][ls:absorb:damage]|r", + size = 10, + outline = false, + shadow = true, h_alignment = "RIGHT", + v_alignment = "MIDDLE", point1 = { p = "BOTTOMRIGHT", anchor = "Health", @@ -234,7 +259,11 @@ D.profile = { }, heal_absorb_text = { tag = "[ls:color:absorb-heal][ls:absorb:heal]|r", + size = 10, + outline = false, + shadow = true, h_alignment = "RIGHT", + v_alignment = "MIDDLE", point1 = { p = "TOPRIGHT", anchor = "Health", @@ -425,6 +454,7 @@ D.profile = { traditional = {"RIGHT", "LSPlayerFrame" , "LEFT", -2, 0}, }, health = { + enabled = true, orientation = "VERTICAL", color = { class = true, @@ -432,7 +462,11 @@ D.profile = { }, text = { tag = "[ls:health:cur]", + size = 12, + outline = false, + shadow = true, h_alignment = "RIGHT", + v_alignment = "MIDDLE", point1 = { p = "BOTTOMRIGHT", anchor = "", @@ -443,6 +477,36 @@ D.profile = { }, prediction = { enabled = true, + absorb_text = { + tag = "", + size = 10, + outline = false, + shadow = true, + h_alignment = "CENTER", + v_alignment = "MIDDLE", + point1 = { + p = "CENTER", + anchor = "Health", + rP = "CENTER", + x = 0, + y = 0, + }, + }, + heal_absorb_text = { + tag = "", + size = 10, + outline = false, + shadow = true, + h_alignment = "CENTER", + v_alignment = "MIDDLE", + point1 = { + p = "CENTER", + anchor = "Health", + rP = "CENTER", + x = 0, + y = 0, + }, + }, }, }, power = { @@ -521,6 +585,7 @@ D.profile = { b_height = 12, }, health = { + enabled = true, orientation = "HORIZONTAL", color = { class = true, @@ -528,7 +593,11 @@ D.profile = { }, text = { tag = "[ls:health:cur]", + size = 12, + outline = false, + shadow = true, h_alignment = "LEFT", + v_alignment = "MIDDLE", point1 = { p = "LEFT", anchor = "Health", @@ -539,6 +608,36 @@ D.profile = { }, prediction = { enabled = true, + absorb_text = { + tag = "", + size = 10, + outline = false, + shadow = true, + h_alignment = "CENTER", + v_alignment = "MIDDLE", + point1 = { + p = "CENTER", + anchor = "Health", + rP = "CENTER", + x = 0, + y = 0, + }, + }, + heal_absorb_text = { + tag = "", + size = 10, + outline = false, + shadow = true, + h_alignment = "CENTER", + v_alignment = "MIDDLE", + point1 = { + p = "CENTER", + anchor = "Health", + rP = "CENTER", + x = 0, + y = 0, + }, + }, }, }, power = { @@ -640,6 +739,7 @@ D.profile = { b_height = 12, }, health = { + enabled = true, orientation = "HORIZONTAL", color = { class = false, @@ -647,7 +747,11 @@ D.profile = { }, text = { tag = "[ls:health:cur-perc]", + size = 12, + outline = false, + shadow = true, h_alignment = "RIGHT", + v_alignment = "MIDDLE", point1 = { p = "RIGHT", anchor = "Health", @@ -660,9 +764,14 @@ D.profile = { enabled = true, absorb_text = { tag = "", + size = 10, + outline = false, + shadow = true, + h_alignment = "CENTER", + v_alignment = "MIDDLE", point1 = { p = "CENTER", - anchor = "", + anchor = "Health", rP = "CENTER", x = 0, y = 0, @@ -670,9 +779,14 @@ D.profile = { }, heal_absorb_text = { tag = "", + size = 10, + outline = false, + shadow = true, + h_alignment = "CENTER", + v_alignment = "MIDDLE", point1 = { p = "CENTER", - anchor = "", + anchor = "Health", rP = "CENTER", x = 0, y = 0, @@ -866,6 +980,7 @@ D.profile = { b_height = 12, }, health = { + enabled = true, orientation = "HORIZONTAL", color = { class = false, @@ -873,6 +988,11 @@ D.profile = { }, text = { tag = "", + size = 12, + outline = false, + shadow = true, + h_alignment = "CENTER", + v_alignment = "MIDDLE", point1 = { p = "CENTER", anchor = "", @@ -883,6 +1003,36 @@ D.profile = { }, prediction = { enabled = true, + absorb_text = { + tag = "", + size = 10, + outline = false, + shadow = true, + h_alignment = "CENTER", + v_alignment = "MIDDLE", + point1 = { + p = "CENTER", + anchor = "Health", + rP = "CENTER", + x = 0, + y = 0, + }, + }, + heal_absorb_text = { + tag = "", + size = 10, + outline = false, + shadow = true, + h_alignment = "CENTER", + v_alignment = "MIDDLE", + point1 = { + p = "CENTER", + anchor = "Health", + rP = "CENTER", + x = 0, + y = 0, + }, + }, }, }, power = { @@ -952,6 +1102,7 @@ D.profile = { b_height = 12, }, health = { + enabled = true, orientation = "HORIZONTAL", color = { class = false, @@ -959,7 +1110,11 @@ D.profile = { }, text = { tag = "[ls:health:cur-perc]", + size = 12, + outline = false, + shadow = true, h_alignment = "LEFT", + v_alignment = "MIDDLE", point1 = { p = "LEFT", anchor = "Health", @@ -972,9 +1127,14 @@ D.profile = { enabled = true, absorb_text = { tag = "", + size = 10, + outline = false, + shadow = true, + h_alignment = "CENTER", + v_alignment = "MIDDLE", point1 = { p = "CENTER", - anchor = "", + anchor = "Health", rP = "CENTER", x = 0, y = 0, @@ -982,9 +1142,14 @@ D.profile = { }, heal_absorb_text = { tag = "", + size = 10, + outline = false, + shadow = true, + h_alignment = "CENTER", + v_alignment = "MIDDLE", point1 = { p = "CENTER", - anchor = "", + anchor = "Health", rP = "CENTER", x = 0, y = 0, @@ -1177,6 +1342,7 @@ D.profile = { b_height = 12, }, health = { + enabled = true, orientation = "HORIZONTAL", color = { class = false, @@ -1184,6 +1350,11 @@ D.profile = { }, text = { tag = "", + size = 12, + outline = false, + shadow = true, + h_alignment = "CENTER", + v_alignment = "MIDDLE", point1 = { p = "CENTER", anchor = "", @@ -1194,6 +1365,36 @@ D.profile = { }, prediction = { enabled = true, + absorb_text = { + tag = "", + size = 10, + outline = false, + shadow = true, + h_alignment = "CENTER", + v_alignment = "MIDDLE", + point1 = { + p = "CENTER", + anchor = "Health", + rP = "CENTER", + x = 0, + y = 0, + }, + }, + heal_absorb_text = { + tag = "", + size = 10, + outline = false, + shadow = true, + h_alignment = "CENTER", + v_alignment = "MIDDLE", + point1 = { + p = "CENTER", + anchor = "Health", + rP = "CENTER", + x = 0, + y = 0, + }, + }, }, }, power = { @@ -1267,6 +1468,7 @@ D.profile = { b_height = 12, }, health = { + enabled = true, orientation = "HORIZONTAL", color = { class = false, @@ -1274,7 +1476,11 @@ D.profile = { }, text = { tag = "[ls:health:perc]", + size = 12, + outline = false, + shadow = true, h_alignment = "RIGHT", + v_alignment = "MIDDLE", point1 = { p = "RIGHT", anchor = "Health", @@ -1287,9 +1493,14 @@ D.profile = { enabled = true, absorb_text = { tag = "", + size = 10, + outline = false, + shadow = true, + h_alignment = "CENTER", + v_alignment = "MIDDLE", point1 = { p = "CENTER", - anchor = "", + anchor = "Health", rP = "CENTER", x = 0, y = 0, @@ -1297,9 +1508,14 @@ D.profile = { }, heal_absorb_text = { tag = "", + size = 10, + outline = false, + shadow = true, + h_alignment = "CENTER", + v_alignment = "MIDDLE", point1 = { p = "CENTER", - anchor = "", + anchor = "Health", rP = "CENTER", x = 0, y = 0, diff --git a/modules/unitframes/elements/health.lua b/modules/unitframes/elements/health.lua index e57b2cfa..2fc7ba5c 100644 --- a/modules/unitframes/elements/health.lua +++ b/modules/unitframes/elements/health.lua @@ -15,8 +15,43 @@ local UnitIsDeadOrGhost = _G.UnitIsDeadOrGhost ]] -- Mine +local function updateFontObject(_, fontString, config) + fontString:SetFontObject("LSFont" .. config.size .. (config.outline and "_Outline" or "")) + fontString:SetJustifyH(config.h_alignment) + fontString:SetJustifyV(config.v_alignment) + fontString:SetWordWrap(false) + + if config.shadow then + fontString:SetShadowOffset(1, -1) + else + fontString:SetShadowOffset(0, 0) + end +end + +local function updateTextPoint(frame, fontString, config) + fontString:ClearAllPoints() + + if config and config.p then + fontString:SetPoint(config.p, E:ResolveAnchorPoint(frame, config.anchor), config.rP, config.x, config.y) + end +end + +local function updateTag(frame, fontString, tag) + if tag ~= "" then + frame:Tag(fontString, tag) + fontString:UpdateTag() + else + frame:Untag(fontString) + fontString:SetText("") + end +end + -- .Health do + local ignoredKeys = { + prediction = true, + } + local function setStatusBarColorHook(self, r, g, b) self._texture:SetColorTexture(r, g, b) end @@ -28,58 +63,63 @@ do end end - local function frame_UpdateHealth(self) - local config = self._config.health - local element = self.Health - - element:SetOrientation(config.orientation) + local function element_UpdateConfig(element) + element._config = E:CopyTable(element.__owner._config.health, element._config, ignoredKeys) + end - if config.color then - element.colorClass = config.color.class - element.colorReaction = config.color.reaction - end + local function element_UpdateColorSettings(element) + element.colorClass = element._config.color.class + element.colorReaction = element._config.color.reaction + element:ForceUpdate() + end - if element.Text then - element.Text:SetJustifyV(config.text.v_alignment or "MIDDLE") - element.Text:SetJustifyH(config.text.h_alignment or "CENTER") - element.Text:ClearAllPoints() + local function element_UpdateFontObjects(element) + updateFontObject(element.__owner, element.Text, element._config.text) + end - local point1 = config.text.point1 + local function element_UpdateTextPoints(element) + updateTextPoint(element.__owner, element.Text, element._config.text.point1) + end - if point1 and point1.p then - element.Text:SetPoint(point1.p, E:ResolveAnchorPoint(self, point1.anchor), point1.rP, point1.x, point1.y) - end + local function element_UpdateTags(element) + updateTag(element.__owner, element.Text, element._config.enabled and element._config.text.tag or "") + end - self:Tag(element.Text, config.text.tag) - element.Text:UpdateTag() - end + local function frame_UpdateHealth(self) + local element = self.Health + element:UpdateConfig() + element:SetOrientation(element._config.orientation) + element:UpdateColorSettings() + element:UpdateFontObjects() + element:UpdateTextPoints() + element:UpdateTags() if element.ForceUpdate then element:ForceUpdate() end end - function UF:CreateHealth(frame, text, textFontObject, textParent) + function UF:CreateHealth(frame, textParent) local element = CreateFrame("StatusBar", nil, frame) element:SetStatusBarTexture("Interface\\BUTTONS\\WHITE8X8") element:GetStatusBarTexture():SetColorTexture(0, 0, 0, 0) - E:SmoothBar(element) element._texture = element:CreateTexture(nil, "ARTWORK") element._texture:SetAllPoints(element:GetStatusBarTexture()) - hooksecurefunc(element, "SetStatusBarColor", setStatusBarColorHook) - if text then - text = (textParent or element):CreateFontString(nil, "ARTWORK", textFontObject) - element.Text = text - end + element.Text = (textParent or element):CreateFontString(nil, "ARTWORK", "LSFont12") element.colorHealth = true element.colorTapping = true element.colorDisconnected = true element.PostUpdate = element_PostUpdate + element.UpdateColorSettings = element_UpdateColorSettings + element.UpdateConfig = element_UpdateConfig + element.UpdateFontObjects = element_UpdateFontObjects + element.UpdateTags = element_UpdateTags + element.UpdateTextPoints = element_UpdateTextPoints frame.UpdateHealth = frame_UpdateHealth @@ -89,9 +129,31 @@ end -- .HealthPrediction do + local function element_UpdateConfig(element) + element._config = E:CopyTable(element.__owner._config.health.prediction, element._config) + element._config.orientation = element.__owner._config.health.orientation + end + + local function element_UpdateFontObjects(element) + updateFontObject(element.__owner, element.absorbBar.Text, element._config.absorb_text) + updateFontObject(element.__owner, element.healAbsorbBar.Text, element._config.heal_absorb_text) + end + + local function element_UpdateTextPoints(element) + updateTextPoint(element.__owner, element.absorbBar.Text, element._config.absorb_text.point1) + updateTextPoint(element.__owner, element.healAbsorbBar.Text, element._config.heal_absorb_text.point1) + end + + local function element_UpdateTags(element) + updateTag(element.__owner, element.absorbBar.Text, element._config.enabled and element._config.absorb_text.tag or "") + updateTag(element.__owner, element.healAbsorbBar.Text, element._config.enabled and element._config.heal_absorb_text.tag or "") + end + local function frame_UpdateHealthPrediction(self) - local config = self._config.health local element = self.HealthPrediction + element:UpdateConfig() + + local config = element._config local myBar = element.myBar local otherBar = element.otherBar local absorbBar = element.absorbBar @@ -158,39 +220,13 @@ do healAbsorbBar:SetHeight(height) end - if absorbBar.Text then - absorbBar.Text:SetJustifyV(config.prediction.absorb_text.v_alignment or "MIDDLE") - absorbBar.Text:SetJustifyH(config.prediction.absorb_text.h_alignment or "CENTER") - absorbBar.Text:ClearAllPoints() - - local point1 = config.prediction.absorb_text.point1 - - if point1 and point1.p then - absorbBar.Text:SetPoint(point1.p, E:ResolveAnchorPoint(self, point1.anchor), point1.rP, point1.x, point1.y) - end - - self:Tag(absorbBar.Text, config.prediction.enabled and config.prediction.absorb_text.tag or "") - absorbBar.Text:UpdateTag() - end - - if healAbsorbBar.Text then - healAbsorbBar.Text:SetJustifyV(config.prediction.heal_absorb_text.v_alignment or "MIDDLE") - healAbsorbBar.Text:SetJustifyH(config.prediction.heal_absorb_text.h_alignment or "CENTER") - healAbsorbBar.Text:ClearAllPoints() - - local point1 = config.prediction.heal_absorb_text.point1 + element:UpdateFontObjects() + element:UpdateTextPoints() + element:UpdateTags() - if point1 and point1.p then - healAbsorbBar.Text:SetPoint(point1.p, E:ResolveAnchorPoint(self, point1.anchor), point1.rP, point1.x, point1.y) - end - - self:Tag(healAbsorbBar.Text, config.prediction.enabled and config.prediction.heal_absorb_text.tag or "") - healAbsorbBar.Text:UpdateTag() - end - - if config.prediction.enabled and not self:IsElementEnabled("HealthPrediction") then + if config.enabled and not self:IsElementEnabled("HealthPrediction") then self:EnableElement("HealthPrediction") - elseif not config.prediction.enabled and self:IsElementEnabled("HealthPrediction") then + elseif not config.enabled and self:IsElementEnabled("HealthPrediction") then self:DisableElement("HealthPrediction") end @@ -199,7 +235,7 @@ do end end - function UF:CreateHealthPrediction(frame, parent, text, textFontObject, textParent) + function UF:CreateHealthPrediction(frame, parent, textParent) local level = parent:GetFrameLevel() local myBar = CreateFrame("StatusBar", nil, parent) @@ -207,6 +243,7 @@ do myBar:SetStatusBarTexture("Interface\\BUTTONS\\WHITE8X8") myBar:GetStatusBarTexture():SetColorTexture(0, 0, 0, 0) myBar:SetStatusBarColor(M.COLORS.HEALPREDICTION.MY_HEAL:GetRGB()) + E:SmoothBar(myBar) parent.MyHeal = myBar myBar._texture = myBar:CreateTexture(nil, "ARTWORK") @@ -217,6 +254,7 @@ do otherBar:SetFrameLevel(level) otherBar:SetStatusBarTexture("Interface\\BUTTONS\\WHITE8X8") otherBar:GetStatusBarTexture():SetColorTexture(0, 0, 0, 0) + E:SmoothBar(otherBar) parent.OtherHeal = otherBar otherBar._texture = otherBar:CreateTexture(nil, "ARTWORK") @@ -227,6 +265,7 @@ do absorbBar:SetFrameLevel(level + 1) absorbBar:SetStatusBarTexture("Interface\\BUTTONS\\WHITE8X8") absorbBar:GetStatusBarTexture():SetColorTexture(0, 0, 0, 0) + E:SmoothBar(absorbBar) parent.DamageAbsorb = absorbBar local overlay = absorbBar:CreateTexture(nil, "ARTWORK", nil, 1) @@ -236,29 +275,22 @@ do overlay:SetAllPoints(absorbBar:GetStatusBarTexture()) absorbBar.Overlay = overlay + absorbBar.Text = (textParent or parent):CreateFontString(nil, "ARTWORK", "LSFont10") + local healAbsorbBar = CreateFrame("StatusBar", nil, parent) healAbsorbBar:SetReverseFill(true) healAbsorbBar:SetFrameLevel(level + 1) healAbsorbBar:SetStatusBarTexture("Interface\\BUTTONS\\WHITE8X8") healAbsorbBar:GetStatusBarTexture():SetColorTexture(0, 0, 0, 0) healAbsorbBar:SetStatusBarColor(M.COLORS.HEALPREDICTION.HEAL_ABSORB:GetRGB()) + E:SmoothBar(healAbsorbBar) parent.HealAbsorb = healAbsorbBar healAbsorbBar._texture = healAbsorbBar:CreateTexture(nil, "ARTWORK") healAbsorbBar._texture:SetAllPoints(healAbsorbBar:GetStatusBarTexture()) healAbsorbBar._texture:SetColorTexture(M.COLORS.HEALPREDICTION.HEAL_ABSORB:GetRGB()) - E:SmoothBar(myBar) - E:SmoothBar(otherBar) - E:SmoothBar(healAbsorbBar) - - if text then - text = (textParent or parent):CreateFontString(nil, "ARTWORK", textFontObject) - absorbBar.Text = text - - text = (textParent or parent):CreateFontString(nil, "ARTWORK", textFontObject) - healAbsorbBar.Text = text - end + healAbsorbBar.Text = (textParent or parent):CreateFontString(nil, "ARTWORK", "LSFont10") frame.UpdateHealthPrediction = frame_UpdateHealthPrediction @@ -268,6 +300,10 @@ do absorbBar = absorbBar, healAbsorbBar = healAbsorbBar, maxOverflow = 1, + UpdateConfig = element_UpdateConfig, + UpdateFontObjects = element_UpdateFontObjects, + UpdateTags = element_UpdateTags, + UpdateTextPoints = element_UpdateTextPoints, } end end diff --git a/modules/unitframes/units/boss.lua b/modules/unitframes/units/boss.lua index f2ff2b46..997bc486 100644 --- a/modules/unitframes/units/boss.lua +++ b/modules/unitframes/units/boss.lua @@ -93,7 +93,7 @@ function UF:CreateBossFrame(frame) frame.Insets = self:CreateInsets(frame, textureParent) - local health = self:CreateHealth(frame, true, "LSFont12_Shadow", textParent) + local health = self:CreateHealth(frame, textParent) health:SetFrameLevel(level + 1) health:SetPoint("LEFT", frame, "LEFT", 0, 0) health:SetPoint("RIGHT", frame, "RIGHT", 0, 0) @@ -102,7 +102,7 @@ function UF:CreateBossFrame(frame) health:SetClipsChildren(true) frame.Health = health - frame.HealthPrediction = self:CreateHealthPrediction(frame, health) + frame.HealthPrediction = self:CreateHealthPrediction(frame, health, textParent) local power = self:CreatePower(frame, true, "LSFont12_Shadow", textParent) power:SetFrameLevel(level + 1) diff --git a/modules/unitframes/units/focus.lua b/modules/unitframes/units/focus.lua index 7edcd072..5891d943 100644 --- a/modules/unitframes/units/focus.lua +++ b/modules/unitframes/units/focus.lua @@ -64,7 +64,7 @@ function UF:CreateFocusFrame(frame) frame.Insets = self:CreateInsets(frame, textureParent) - local health = self:CreateHealth(frame, true, "LSFont12_Shadow", textParent) + local health = self:CreateHealth(frame, textParent) health:SetFrameLevel(level + 1) health:SetPoint("LEFT", frame, "LEFT", 0, 0) health:SetPoint("RIGHT", frame, "RIGHT", 0, 0) @@ -73,7 +73,7 @@ function UF:CreateFocusFrame(frame) health:SetClipsChildren(true) frame.Health = health - frame.HealthPrediction = self:CreateHealthPrediction(frame, health) + frame.HealthPrediction = self:CreateHealthPrediction(frame, health, textParent) local power = self:CreatePower(frame, true, "LSFont12_Shadow", textParent) power:SetFrameLevel(level + 1) diff --git a/modules/unitframes/units/focustarget.lua b/modules/unitframes/units/focustarget.lua index 80613d03..4cc09a22 100644 --- a/modules/unitframes/units/focustarget.lua +++ b/modules/unitframes/units/focustarget.lua @@ -54,7 +54,7 @@ function UF:CreateFocusTargetFrame(frame) frame.Insets = self:CreateInsets(frame, textureParent) - local health = self:CreateHealth(frame, true, "LSFont12_Shadow", textParent) + local health = self:CreateHealth(frame, textParent) health:SetFrameLevel(level + 1) health:SetPoint("LEFT", frame, "LEFT", 0, 0) health:SetPoint("RIGHT", frame, "RIGHT", 0, 0) @@ -63,7 +63,7 @@ function UF:CreateFocusTargetFrame(frame) health:SetClipsChildren(true) frame.Health = health - frame.HealthPrediction = self:CreateHealthPrediction(frame, health) + frame.HealthPrediction = self:CreateHealthPrediction(frame, health, textParent) local power = self:CreatePower(frame, true, "LSFont12_Shadow", textParent) power:SetFrameLevel(level + 1) diff --git a/modules/unitframes/units/pet.lua b/modules/unitframes/units/pet.lua index 318829c6..f3d586cb 100644 --- a/modules/unitframes/units/pet.lua +++ b/modules/unitframes/units/pet.lua @@ -47,13 +47,18 @@ do textureParent:SetAllPoints() frame.TextureParent = textureParent + local textParent = CreateFrame("Frame", nil, frame) + textParent:SetFrameLevel(level + 6) + textParent:SetAllPoints() + frame.TextParent = textParent + local fg = textureParent:CreateTexture(nil, "ARTWORK", nil, 1) fg:SetSize(80 / 2, 148 / 2) fg:SetTexture("Interface\\AddOns\\ls_UI\\assets\\pet-frame") fg:SetTexCoord(1 / 128, 81 / 128, 1 / 256, 149 / 256) fg:SetPoint("CENTER", 0, 0) - local health = self:CreateHealth(frame, true, "LSFont12_Shadow", frame) + local health = self:CreateHealth(frame, textParent) health:SetFrameLevel(level + 1) health:SetSize(8, 112) health:SetPoint("CENTER", -6, 0) @@ -64,7 +69,7 @@ do healthBG:SetColorTexture(M.COLORS.DARK_GRAY:GetRGB()) healthBG:SetAllPoints() - frame.HealthPrediction = self:CreateHealthPrediction(frame, health) + frame.HealthPrediction = self:CreateHealthPrediction(frame, health, textParent) local power = self:CreatePower(frame, true, "LSFont12_Shadow", frame) power:SetFrameLevel(level + 1) @@ -156,7 +161,7 @@ do frame.Insets = self:CreateInsets(frame, textureParent) - local health = self:CreateHealth(frame, true, "LSFont12_Shadow", textParent) + local health = self:CreateHealth(frame, textParent) health:SetFrameLevel(level + 1) health:SetPoint("LEFT", frame, "LEFT", 0, 0) health:SetPoint("RIGHT", frame, "RIGHT", 0, 0) @@ -165,7 +170,7 @@ do health:SetClipsChildren(true) frame.Health = health - frame.HealthPrediction = self:CreateHealthPrediction(frame, health) + frame.HealthPrediction = self:CreateHealthPrediction(frame, health, textParent) local power = self:CreatePower(frame, true, "LSFont12_Shadow", textParent) power:SetFrameLevel(level + 1) diff --git a/modules/unitframes/units/player.lua b/modules/unitframes/units/player.lua index 88095ff1..937d7efb 100644 --- a/modules/unitframes/units/player.lua +++ b/modules/unitframes/units/player.lua @@ -179,7 +179,7 @@ do mask:SetPoint("CENTER") -- health - local health = self:CreateHealth(frame, true, "LSFont16_Shadow", textParent) + local health = self:CreateHealth(frame, textParent) health:SetFrameLevel(level + 1) health:SetSize(180 / 2, 280 / 2) health:SetPoint("CENTER") @@ -187,7 +187,7 @@ do frame.Health = health -- health prediction - local healthPrediction = self:CreateHealthPrediction(frame, health, true, "LSFont12_Shadow", textParent) + local healthPrediction = self:CreateHealthPrediction(frame, health, textParent) frame.HealthPrediction = healthPrediction -- masking @@ -444,7 +444,7 @@ do end -- health - local health = self:CreateHealth(frame, true, "LSFont12_Shadow", textParent) + local health = self:CreateHealth(frame, textParent) health:SetFrameLevel(level + 1) health:SetPoint("LEFT", frame, "LEFT", 0, 0) health:SetPoint("RIGHT", frame, "RIGHT", 0, 0) @@ -453,7 +453,7 @@ do health:SetClipsChildren(true) frame.Health = health - frame.HealthPrediction = self:CreateHealthPrediction(frame, health, true, "LSFont10_Shadow", textParent) + frame.HealthPrediction = self:CreateHealthPrediction(frame, health, textParent) -- power local power = self:CreatePower(frame, true, "LSFont12_Shadow", textParent) diff --git a/modules/unitframes/units/target.lua b/modules/unitframes/units/target.lua index f48bd261..7768a5a8 100644 --- a/modules/unitframes/units/target.lua +++ b/modules/unitframes/units/target.lua @@ -64,7 +64,7 @@ function UF:CreateTargetFrame(frame) frame.Insets = self:CreateInsets(frame, textureParent) - local health = self:CreateHealth(frame, true, "LSFont12_Shadow", textParent) + local health = self:CreateHealth(frame, textParent) health:SetFrameLevel(level + 1) health:SetPoint("LEFT", frame, "LEFT", 0, 0) health:SetPoint("RIGHT", frame, "RIGHT", 0, 0) @@ -73,7 +73,7 @@ function UF:CreateTargetFrame(frame) health:SetClipsChildren(true) frame.Health = health - frame.HealthPrediction = self:CreateHealthPrediction(frame, health, true, "LSFont10_Shadow", textParent) + frame.HealthPrediction = self:CreateHealthPrediction(frame, health, textParent) local power = self:CreatePower(frame, true, "LSFont12_Shadow", textParent) power:SetFrameLevel(level + 1) diff --git a/modules/unitframes/units/targettarget.lua b/modules/unitframes/units/targettarget.lua index d7c58772..571fe410 100644 --- a/modules/unitframes/units/targettarget.lua +++ b/modules/unitframes/units/targettarget.lua @@ -54,7 +54,7 @@ function UF:CreateTargetTargetFrame(frame) frame.Insets = self:CreateInsets(frame, textureParent) - local health = self:CreateHealth(frame, true, "LSFont12_Shadow", textParent) + local health = self:CreateHealth(frame, textParent) health:SetFrameLevel(level + 1) health:SetPoint("LEFT", frame, "LEFT", 0, 0) health:SetPoint("RIGHT", frame, "RIGHT", 0, 0) @@ -63,7 +63,7 @@ function UF:CreateTargetTargetFrame(frame) health:SetClipsChildren(true) frame.Health = health - frame.HealthPrediction = self:CreateHealthPrediction(frame, health) + frame.HealthPrediction = self:CreateHealthPrediction(frame, health, textParent) local power = self:CreatePower(frame, true, "LSFont12_Shadow", textParent) power:SetFrameLevel(level + 1) From 12ce7e60553cf8135aa3ba24f5fd41e0f4ca3c1a Mon Sep 17 00:00:00 2001 From: Val Voronov Date: Wed, 17 Oct 2018 15:59:12 +0700 Subject: [PATCH 11/17] Added options to adjust texts of various UF elements Yeah, and def nothing else... --- config/blizzard.lua | 27 +- config/core.lua | 84 + config/unitframes.lua | 2377 ++++++++--------- core/defaults.lua | 544 ++-- init.lua | 160 +- locales/enUS.lua | 3 + locales/ruRU.lua | 3 + modules/blizzard/castbar.lua | 89 +- modules/unitframes/core.lua | 20 +- modules/unitframes/elements/auras.lua | 157 +- modules/unitframes/elements/castbar.lua | 187 +- .../unitframes/elements/classindicator.lua | 61 +- modules/unitframes/elements/classpower.lua | 193 +- .../unitframes/elements/combatfeedback.lua | 18 +- .../unitframes/elements/debuffindicator.lua | 67 +- modules/unitframes/elements/health.lua | 82 +- modules/unitframes/elements/insets.lua | 69 +- modules/unitframes/elements/name.lua | 67 +- modules/unitframes/elements/power.lua | 341 ++- modules/unitframes/elements/pvpindicator.lua | 114 +- .../elements/raidtargetindicator.lua | 35 +- modules/unitframes/elements/tags.lua | 9 +- .../unitframes/elements/threatindicator.lua | 14 +- modules/unitframes/units/boss.lua | 10 +- modules/unitframes/units/focus.lua | 12 +- modules/unitframes/units/focustarget.lua | 8 +- modules/unitframes/units/pet.lua | 14 +- modules/unitframes/units/player.lua | 68 +- modules/unitframes/units/target.lua | 12 +- modules/unitframes/units/targettarget.lua | 8 +- 30 files changed, 2597 insertions(+), 2256 deletions(-) diff --git a/config/blizzard.lua b/config/blizzard.lua index e8bc9e66..b55a8197 100644 --- a/config/blizzard.lua +++ b/config/blizzard.lua @@ -344,6 +344,21 @@ function CONFIG.CreateBlizzardPanel(_, order) }, }, }, + icon = { + order = 20, + type = "select", + name = L["ICON"], + values = CONFIG.CASTBAR_ICON_POSITIONS, + get = function() + return C.db.profile.blizzard.castbar.icon.position + end, + set = function(_, value) + if C.db.profile.blizzard.castbar.icon.position ~= value then + C.db.profile.blizzard.castbar.icon.position = value + BLIZZARD:UpdateCastBars() + end + end, + }, spacer_3 = { order = 29, type = "description", @@ -368,11 +383,15 @@ function CONFIG.CreateBlizzardPanel(_, order) name = L["SIZE"], min = 10, max = 20, step = 2, }, - flag = { + outline = { order = 2, - type = "select", - name = L["FLAG"], - values = FLAGS, + type = "toggle", + name = L["OUTLINE"], + }, + shadow = { + order = 3, + type = "toggle", + name = L["SHADOW"], }, }, }, diff --git a/config/core.lua b/config/core.lua index 55677afe..16fbab0f 100644 --- a/config/core.lua +++ b/config/core.lua @@ -40,6 +40,90 @@ local AceConfig = LibStub("AceConfig-3.0") local AceConfigDialog = LibStub("AceConfigDialog-3.0") local LibKeyBound = LibStub("LibKeyBound-1.0-ls") +MODULE.H_ALIGNMENTS = { + ["CENTER"] = "CENTER", + ["LEFT"] = "LEFT", + ["RIGHT"] = "RIGHT", +} + +MODULE.V_ALIGNMENTS = { + ["BOTTOM"] = "BOTTOM", + ["MIDDLE"] = "MIDDLE", + ["TOP"] = "TOP", +} + +MODULE.POINTS = { + ["BOTTOM"] = "BOTTOM", + ["BOTTOMLEFT"] = "BOTTOMLEFT", + ["BOTTOMRIGHT"] = "BOTTOMRIGHT", + ["CENTER"] = "CENTER", + ["LEFT"] = "LEFT", + ["RIGHT"] = "RIGHT", + ["TOP"] = "TOP", + ["TOPLEFT"] = "TOPLEFT", + ["TOPRIGHT"] = "TOPRIGHT", +} + +MODULE.POINTS_EXT = { + [""] = "NONE", + ["BOTTOM"] = "BOTTOM", + ["BOTTOMLEFT"] = "BOTTOMLEFT", + ["BOTTOMRIGHT"] = "BOTTOMRIGHT", + ["CENTER"] = "CENTER", + ["LEFT"] = "LEFT", + ["RIGHT"] = "RIGHT", + ["TOP"] = "TOP", + ["TOPLEFT"] = "TOPLEFT", + ["TOPRIGHT"] = "TOPRIGHT", +} + +MODULE.CASTBAR_ICON_POSITIONS = { + ["NONE"] = L["NONE"], + ["LEFT"] = L["LEFT"], + ["RIGHT"] = L["RIGHT"], +} + +MODULE.FLAGS = { + -- [""] = L["NONE"], + ["_Outline"] = L["OUTLINE"], + ["_Shadow"] = L["SHADOW"], +} +MODULE.GROWTH_DIRS = { + ["LEFT_DOWN"] = L["LEFT_DOWN"], + ["LEFT_UP"] = L["LEFT_UP"], + ["RIGHT_DOWN"] = L["RIGHT_DOWN"], + ["RIGHT_UP"] = L["RIGHT_UP"], +} + +MODULE.FCF_MODES = { + ["Fountain"] = "Fountain", + ["Standard"] = "Straight", +} + +function MODULE:GetRegionAnchors(anchorsToRemove, anchorsToAdd) + local temp = { + [""] = L["FRAME"], + ["Health"] = L["HEALTH"], + ["Health.Text"] = L["HEALTH_TEXT"], + ["Power"] = L["POWER"], + ["Power.Text"] = L["POWER_TEXT"], + } + + if anchorsToRemove then + for anchor in next, anchorsToRemove do + temp[anchor] = nil + end + end + + if anchorsToAdd then + for anchor, name in next, anchorsToAdd do + temp[anchor] = name + end + end + + return temp +end + -- MODULE.OpenAuraConfig do -- Mine diff --git a/config/unitframes.lua b/config/unitframes.lua index 52a52d2f..f14216b1 100644 --- a/config/unitframes.lua +++ b/config/unitframes.lua @@ -5,99 +5,206 @@ local UNITFRAMES = P:GetModule("UnitFrames") -- Lua local _G = getfenv(0) -local next = _G.next local s_split = _G.string.split +local tonumber = _G.tonumber +local tostring = _G.tostring local unpack = _G.unpack -- Mine -local FCF_MODES = { - ["Fountain"] = "Fountain", - ["Standard"] = "Straight", -} +local function isModuleDisabled() + return not UNITFRAMES:IsInit() +end -local POINTS = { - ["BOTTOM"] = "BOTTOM", - ["BOTTOMLEFT"] = "BOTTOMLEFT", - ["BOTTOMRIGHT"] = "BOTTOMRIGHT", - ["CENTER"] = "CENTER", - ["LEFT"] = "LEFT", - ["RIGHT"] = "RIGHT", - ["TOP"] = "TOP", - ["TOPLEFT"] = "TOPLEFT", - ["TOPRIGHT"] = "TOPRIGHT", -} +local function isPlayerFrameDisabled() + return not UNITFRAMES:HasPlayerFrame() +end -local POINTS_EXT = { - [""] = "NONE", - ["BOTTOM"] = "BOTTOM", - ["BOTTOMLEFT"] = "BOTTOMLEFT", - ["BOTTOMRIGHT"] = "BOTTOMRIGHT", - ["CENTER"] = "CENTER", - ["LEFT"] = "LEFT", - ["RIGHT"] = "RIGHT", - ["TOP"] = "TOP", - ["TOPLEFT"] = "TOPLEFT", - ["TOPRIGHT"] = "TOPRIGHT", -} +local function isTargetFrameDisabled() + return not UNITFRAMES:HasTargetFrame() +end -local H_ALIGNMENTS = { - ["CENTER"] = "CENTER", - ["LEFT"] = "LEFT", - ["RIGHT"] = "RIGHT", -} -local V_ALIGNMENTS = { - ["BOTTOM"] = "BOTTOM", - ["MIDDLE"] = "MIDDLE", - ["TOP"] = "TOP", -} +local function isFocusFrameDisabled() + return not UNITFRAMES:HasFocusFrame() +end -local FLAGS = { - -- [""] = L["NONE"], - ["_Outline"] = L["OUTLINE"], - ["_Shadow"] = L["SHADOW"], -} +local function isBossFrameDisabled() + return not UNITFRAMES:HasBossFrame() +end -local CASTBAR_ICON_POSITIONS = { - ["LEFT"] = L["LEFT"], - ["RIGHT"] = L["RIGHT"], +local resetIgnoredKeys = { + ["point"] = true, } -local GROWTH_DIRS = { - ["LEFT_DOWN"] = L["LEFT_DOWN"], - ["LEFT_UP"] = L["LEFT_UP"], - ["RIGHT_DOWN"] = L["RIGHT_DOWN"], - ["RIGHT_UP"] = L["RIGHT_UP"], +local aurasResetIgnoredKeys = { + ["point"] = true, + ["filter"] = true, } -local function isModuleDisabled() - return not UNITFRAMES:IsInit() +local function getUFOption_Copy(order, unit) + local ignoredUnits = { + [unit] = true, + ["pet"] = true, + ["player"] = true, + } + + return { + order = order, + type = "select", + name = L["COPY_FROM"], + desc = L["COPY_FROM_DESC"], + values = function() + return UNITFRAMES:GetUnits(ignoredUnits) + end, + get = function() end, + set = function(_, value) + CONFIG:CopySettings(C.db.profile.units[value], C.db.profile.units[unit], resetIgnoredKeys) + UNITFRAMES:UpdateUnitFrame(unit, "Update") + end, + } end -local function getRegionAnchors(anchorsToRemove, anchorsToAdd) - local temp = { - [""] = L["FRAME"], - ["Health"] = L["HEALTH"], - ["Health.Text"] = L["HEALTH_TEXT"], - ["Power"] = L["POWER"], - ["Power.Text"] = L["POWER_TEXT"], +local function getUFOption_Preview(order, unit) + return { + order = order, + type = "execute", + name = L["PREVIEW"], + func = function() + UNITFRAMES:UpdateUnitFrame(unit, "Preview") + end, } +end - if anchorsToRemove then - for anchor in next, anchorsToRemove do - temp[anchor] = nil - end - end +local function getUFOption_PvPIndicator(order, unit) + return { + order = order, + type = "toggle", + name = L["PVP_ICON"], + get = function() + return C.db.profile.units[unit].pvp.enabled + end, + set = function(_, value) + C.db.profile.units[unit].pvp.enabled = value + UNITFRAMES:UpdateUnitFrame(unit, "UpdatePvPIndicator") + end, + } +end - if anchorsToAdd then - for anchor, name in next, anchorsToAdd do - temp[anchor] = name - end +local function getUFOption_Border(order, unit) + local temp = { + order = order, + type = "group", + name = L["BORDER_COLOR"], + inline = true, + get = function(info) + return C.db.profile.units[unit].class[info[#info]] + end, + set = function(info, value) + C.db.profile.units[unit].class[info[#info]] = value + UNITFRAMES:UpdateUnitFrame(unit, "UpdateClassIndicator") + end, + args = { + player = { + order = 1, + type = "toggle", + name = L["PLAYER_CLASS"], + desc = L["COLOR_CLASS_DESC"], + }, + }, + } + + if unit ~= "player" and unit ~= "pet" then + temp.args.npc = { + order = 2, + type = "toggle", + name = L["NPC_CLASSIFICATION"], + desc = L["COLOR_CLASSIFICATION_DESC"], + } end return temp end -local function getOptionsTable_Health(order, unit) +local function getUFOption_Width(order, unit) + return { + order = order, + type = "range", + name = L["WIDTH"], + min = 96, max = 512, step = 2, + get = function() + return C.db.profile.units[unit].width + end, + set = function(_, value) + if C.db.profile.units[unit].width ~= value then + C.db.profile.units[unit].width = value + UNITFRAMES:UpdateUnitFrame(unit, "Update") + end + end, + } +end + +local function getUFOption_Height(order, unit) + return { + order = order, + type = "range", + name = L["HEIGHT"], + min = 28, max = 256, step = 2, + get = function() + return C.db.profile.units[unit].height + end, + set = function(_, value) + if C.db.profile.units[unit].height ~= value then + C.db.profile.units[unit].height = value + UNITFRAMES:UpdateUnitFrame(unit, "Update") + end + end, + } +end + +local function getUFOption_TopInset(order, unit) + return { + order = order, + type = "range", + name = L["TOP_INSET_SIZE"], + desc = L["TOP_INSET_SIZE_DESC"], + min = 8, max = 32, step = 2, + get = function() + return C.db.profile.units[unit].insets.t_height + end, + set = function(_, value) + if C.db.profile.units[unit].insets.t_height ~= value then + C.db.profile.units[unit].insets.t_height = value + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Insets", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Insets", "UpdateTopInset") + end + end, + } +end + +local function getUFOption_BottomInset(order, unit) + return { + order = order, + type = "range", + name = L["BOTTOM_INSET_SIZE"], + desc = L["BOTTOM_INSET_SIZE_DESC"], + min = 8, max = 32, step = 2, + get = function() + return C.db.profile.units[unit].insets.b_height + end, + set = function(_, value) + if C.db.profile.units[unit].insets.b_height ~= value then + C.db.profile.units[unit].insets.b_height = value + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Insets", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Insets", "UpdateBottomInset") + end + end, + } +end + +local function getUFOption_Health(order, unit) + local ignoredAnchors = { + ["Health.Text"] = true + } + local temp = { order = order, type = "group", @@ -108,8 +215,7 @@ local function getOptionsTable_Health(order, unit) order = 1, name = L["RESTORE_DEFAULTS"], func = function() - CONFIG:CopySettings(D.profile.units[unit].health, C.db.profile.units[unit].health, {["point"] = true}) - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") + CONFIG:CopySettings(D.profile.units[unit].health, C.db.profile.units[unit].health, resetIgnoredKeys) UNITFRAMES:UpdateUnitFrame(unit, "UpdateHealth") UNITFRAMES:UpdateUnitFrame(unit, "UpdateHealthPrediction") end, @@ -129,9 +235,8 @@ local function getOptionsTable_Health(order, unit) end, set = function(info, value) C.db.profile.units[unit].health.color[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateColorSettings") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateColors") end, args = { class = { @@ -140,12 +245,6 @@ local function getOptionsTable_Health(order, unit) name = L["PLAYER_CLASS"], desc = L["COLOR_CLASS_DESC"], }, - reaction = { - order = 2, - type = "toggle", - name = L["REACTION"], - desc = L["COLOR_REACTION_DESC"], - }, }, }, spacer_2 = { @@ -153,8 +252,27 @@ local function getOptionsTable_Health(order, unit) type = "description", name = " ", }, + -- change_threshold = { + -- order = 20, + -- type = "input", + -- name = L["GAIN_LOSS_THRESHOLD"], + -- desc = L["GAIN_LOSS_THRESHOLD_DESC"], + -- get = function() + -- return tostring(C.db.profile.units[unit].health.change_threshold * 100) + -- end, + -- set = function(_, value) + -- C.db.profile.units[unit].health.change_threshold = E:Clamp((tonumber(value) or 0.1) / 100, 0.001, 1) + -- UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateConfig") + -- UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateGainLossThreshold") + -- end, + -- }, + -- spacer_3 = { + -- order = 29, + -- type = "description", + -- name = " ", + -- }, text = { - order = 20, + order = 30, type = "group", name = L["BAR_TEXT"], inline = true, @@ -164,7 +282,6 @@ local function getOptionsTable_Health(order, unit) set = function(info, value) if C.db.profile.units[unit].health.text[info[#info]] ~= value then C.db.profile.units[unit].health.text[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateConfig") UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateFontObjects") end @@ -190,7 +307,7 @@ local function getOptionsTable_Health(order, unit) order = 4, type = "select", name = L["TEXT_HORIZ_ALIGNMENT"], - values = H_ALIGNMENTS, + values = CONFIG.H_ALIGNMENTS, }, spacer_1 = { order = 9, @@ -208,7 +325,6 @@ local function getOptionsTable_Health(order, unit) set = function(info, value) if C.db.profile.units[unit].health.text.point1[info[#info]] ~= value then C.db.profile.units[unit].health.text.point1[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateConfig") UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateTextPoints") end @@ -219,20 +335,20 @@ local function getOptionsTable_Health(order, unit) type = "select", name = L["POINT"], desc = L["POINT_DESC"], - values = POINTS, + values = CONFIG.POINTS, }, anchor = { order = 5, type = "select", name = L["ANCHOR"], - values = getRegionAnchors({["Health.Text"] = true}), + values = CONFIG:GetRegionAnchors(ignoredAnchors), }, rP = { order = 6, type = "select", name = L["RELATIVE_POINT"], desc = L["RELATIVE_POINT_DESC"], - values = POINTS, + values = CONFIG.POINTS, }, x = { order = 7, @@ -266,20 +382,19 @@ local function getOptionsTable_Health(order, unit) if not CONFIG:IsTagStringValid(value) then return end C.db.profile.units[unit].health.text.tag = value:gsub("\124\124+", "\124") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateConfig") UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateTags") end, }, }, }, - spacer_3 = { - order = 29, + spacer_4 = { + order = 39, type = "description", name = " ", }, prediction = { - order = 30, + order = 40, type = "group", name = L["HEAL_PREDICTION"], inline = true, @@ -293,7 +408,6 @@ local function getOptionsTable_Health(order, unit) end, set = function(_, value) C.db.profile.units[unit].health.prediction.enabled = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") UNITFRAMES:UpdateUnitFrame(unit, "UpdateHealthPrediction") end, }, @@ -313,7 +427,6 @@ local function getOptionsTable_Health(order, unit) set = function(info, value) if C.db.profile.units[unit].health.prediction.absorb_text[info[#info]] ~= value then C.db.profile.units[unit].health.prediction.absorb_text[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateConfig") UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateFontObjects") end @@ -339,7 +452,7 @@ local function getOptionsTable_Health(order, unit) order = 4, type = "select", name = L["TEXT_HORIZ_ALIGNMENT"], - values = H_ALIGNMENTS, + values = CONFIG.H_ALIGNMENTS, }, spacer_1 = { order = 9, @@ -357,7 +470,6 @@ local function getOptionsTable_Health(order, unit) set = function(info, value) if C.db.profile.units[unit].health.prediction.absorb_text.point1[info[#info]] ~= value then C.db.profile.units[unit].health.prediction.absorb_text.point1[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateConfig") UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateTextPoints") end @@ -368,20 +480,20 @@ local function getOptionsTable_Health(order, unit) type = "select", name = L["POINT"], desc = L["POINT_DESC"], - values = POINTS, + values = CONFIG.POINTS, }, anchor = { order = 2, type = "select", name = L["ANCHOR"], - values = getRegionAnchors(), + values = CONFIG:GetRegionAnchors(), }, rP = { order = 3, type = "select", name = L["RELATIVE_POINT"], desc = L["RELATIVE_POINT_DESC"], - values = POINTS, + values = CONFIG.POINTS, }, x = { order = 4, @@ -415,7 +527,6 @@ local function getOptionsTable_Health(order, unit) if not CONFIG:IsTagStringValid(value) then return end C.db.profile.units[unit].health.prediction.absorb_text.tag = value:gsub("\124\124+", "\124") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateConfig") UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateTags") end, @@ -438,7 +549,6 @@ local function getOptionsTable_Health(order, unit) set = function(info, value) if C.db.profile.units[unit].health.prediction.heal_absorb_text[info[#info]] ~= value then C.db.profile.units[unit].health.prediction.heal_absorb_text[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateConfig") UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateFontObjects") end @@ -464,7 +574,7 @@ local function getOptionsTable_Health(order, unit) order = 4, type = "select", name = L["TEXT_HORIZ_ALIGNMENT"], - values = H_ALIGNMENTS, + values = CONFIG.H_ALIGNMENTS, }, spacer_1 = { order = 9, @@ -482,7 +592,6 @@ local function getOptionsTable_Health(order, unit) set = function(info, value) if C.db.profile.units[unit].health.prediction.heal_absorb_text.point1[info[#info]] ~= value then C.db.profile.units[unit].health.prediction.heal_absorb_text.point1[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateConfig") UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateTextPoints") end @@ -493,20 +602,20 @@ local function getOptionsTable_Health(order, unit) type = "select", name = L["POINT"], desc = L["POINT_DESC"], - values = POINTS, + values = CONFIG.POINTS, }, anchor = { order = 2, type = "select", name = L["ANCHOR"], - values = getRegionAnchors(), + values = CONFIG:GetRegionAnchors(), }, rP = { order = 3, type = "select", name = L["RELATIVE_POINT"], desc = L["RELATIVE_POINT_DESC"], - values = POINTS, + values = CONFIG.POINTS, }, x = { order = 4, @@ -540,7 +649,6 @@ local function getOptionsTable_Health(order, unit) if not CONFIG:IsTagStringValid(value) then return end C.db.profile.units[unit].health.prediction.heal_absorb_text.tag = value:gsub("\124\124+", "\124") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateConfig") UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateTags") end, @@ -552,144 +660,23 @@ local function getOptionsTable_Health(order, unit) }, } - if unit == "player" or unit == "pet" then - temp.args.reset.func = function() - CONFIG:CopySettings(D.profile.units[unit][E.UI_LAYOUT].health, C.db.profile.units[unit][E.UI_LAYOUT].health, {["point"] = true}) - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateHealth") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateHealthPrediction") - end - - temp.args.color.get = function(info) - return C.db.profile.units[unit][E.UI_LAYOUT].health.color[info[#info]] - end - temp.args.color.set = function(info, value) - C.db.profile.units[unit][E.UI_LAYOUT].health.color[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateColorSettings") - end - - temp.args.color.args.reaction = nil - - temp.args.text.get = function(info) - return C.db.profile.units[unit][E.UI_LAYOUT].health.text[info[#info]] - end - temp.args.text.set = function(info, value) - C.db.profile.units[unit][E.UI_LAYOUT].health.text[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateFontObjects") - end - - temp.args.text.args.point.get = function(info) - return C.db.profile.units[unit][E.UI_LAYOUT].health.text.point1[info[#info]] - end - temp.args.text.args.point.set = function(info, value) - C.db.profile.units[unit][E.UI_LAYOUT].health.text.point1[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateTextPoints") - end - - temp.args.text.args.tag.get = function() - return C.db.profile.units[unit][E.UI_LAYOUT].health.text.tag:gsub("\124", "\124\124") - end - temp.args.text.args.tag.set = function(_, value) - if not CONFIG:IsTagStringValid(value) then return end - - C.db.profile.units[unit][E.UI_LAYOUT].health.text.tag = value:gsub("\124\124+", "\124") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateTags") - end - - temp.args.prediction.args.enabled.get = function() - return C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.enabled - end - temp.args.prediction.args.enabled.set = function(_, value) - C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.enabled = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateHealthPrediction") - end - - temp.args.prediction.args.absorb_text.get = function(info) - return C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.absorb_text[info[#info]] - end - temp.args.prediction.args.absorb_text.set = function(info, value) - if C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.absorb_text[info[#info]] ~= value then - C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.absorb_text[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateFontObjects") - end - end - - temp.args.prediction.args.absorb_text.args.point.get = function(info) - return C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.absorb_text.point1[info[#info]] - end - temp.args.prediction.args.absorb_text.args.point.set = function(info, value) - if C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.absorb_text.point1[info[#info]] ~= value then - C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.absorb_text.point1[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateTextPoints") - end - end - - temp.args.prediction.args.absorb_text.args.tag.get = function() - return C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.absorb_text.tag:gsub("\124", "\124\124") - end - temp.args.prediction.args.absorb_text.args.tag.set = function(_, value) - if not CONFIG:IsTagStringValid(value) then return end - - C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.absorb_text.tag = value:gsub("\124\124+", "\124") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateTags") - end - - temp.args.prediction.args.heal_absorb_text.get = function(info) - return C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.heal_absorb_text[info[#info]] - end - temp.args.prediction.args.heal_absorb_text.set = function(info, value) - if C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.heal_absorb_text[info[#info]] ~= value then - C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.heal_absorb_text[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateFontObjects") - end - end - - temp.args.prediction.args.heal_absorb_text.args.point.get = function(info) - return C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.heal_absorb_text.point1[info[#info]] - end - temp.args.prediction.args.heal_absorb_text.args.point.set = function(info, value) - if C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.heal_absorb_text.point1[info[#info]] ~= value then - C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.heal_absorb_text.point1[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateTextPoints") - end - end - - temp.args.prediction.args.heal_absorb_text.args.tag.get = function() - return C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.heal_absorb_text.tag:gsub("\124", "\124\124") - end - temp.args.prediction.args.heal_absorb_text.args.tag.set = function(_, value) - if not CONFIG:IsTagStringValid(value) then return end - - C.db.profile.units[unit][E.UI_LAYOUT].health.prediction.heal_absorb_text.tag = value:gsub("\124\124+", "\124") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "HealthPrediction", "UpdateTags") - end + if unit ~= "player" and unit ~= "pet" then + temp.args.color.args.reaction = { + order = 2, + type = "toggle", + name = L["REACTION"], + desc = L["COLOR_REACTION_DESC"], + } end return temp end -local function getOptionsTable_Power(order, unit) +local function getUFOption_Power(order, unit) + local ignoredAnchors = { + ["Power.Text"] = true + } + local temp = { order = order, type = "group", @@ -704,7 +691,6 @@ local function getOptionsTable_Power(order, unit) end, set = function(_, value) C.db.profile.units[unit].power.enabled = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") UNITFRAMES:UpdateUnitFrame(unit, "UpdatePower") UNITFRAMES:UpdateUnitFrame(unit, "UpdatePowerPrediction") end, @@ -714,8 +700,7 @@ local function getOptionsTable_Power(order, unit) order = 2, name = L["RESTORE_DEFAULTS"], func = function() - CONFIG:CopySettings(D.profile.units[unit].power, C.db.profile.units[unit].power, {["point"] = true}) - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") + CONFIG:CopySettings(D.profile.units[unit].power, C.db.profile.units[unit].power, resetIgnoredKeys) UNITFRAMES:UpdateUnitFrame(unit, "UpdatePower") UNITFRAMES:UpdateUnitFrame(unit, "UpdatePowerPrediction") end, @@ -725,144 +710,469 @@ local function getOptionsTable_Power(order, unit) type = "description", name = " ", }, + -- change_threshold = { + -- order = 10, + -- type = "input", + -- name = L["GAIN_LOSS_THRESHOLD"], + -- desc = L["GAIN_LOSS_THRESHOLD_DESC"], + -- get = function() + -- return tostring(C.db.profile.units[unit].power.change_threshold * 100) + -- end, + -- set = function(_, value) + -- C.db.profile.units[unit].power.change_threshold = E:Clamp((tonumber(value) or 0.1) / 100, 0.001, 1) + -- UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Power", "UpdateConfig") + -- UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Power", "UpdateGainLossThreshold") + -- end, + -- }, + -- spacer_2 = { + -- order = 19, + -- type = "description", + -- name = " ", + -- }, text = { - order = 10, + order = 20, type = "group", name = L["BAR_TEXT"], inline = true, get = function(info) - return C.db.profile.units[unit].power.text.point1[info[#info]] + return C.db.profile.units[unit].power.text[info[#info]] end, set = function(info, value) - if C.db.profile.units[unit].power.text.point1[info[#info]] ~= value then - C.db.profile.units[unit].power.text.point1[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdatePower") + if C.db.profile.units[unit].power.text[info[#info]] ~= value then + C.db.profile.units[unit].power.text[info[#info]] = value + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Power", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Power", "UpdateFontObjects") end end, args = { - p = { - order = 4, - type = "select", - name = L["POINT"], - desc = L["POINT_DESC"], - values = POINTS, + size = { + order = 1, + type = "range", + name = L["SIZE"], + min = 10, max = 20, step = 2, }, - anchor = { - order = 5, - type = "select", - name = L["ANCHOR"], - values = getRegionAnchors({["Power.Text"] = true}), + outline = { + order = 2, + type = "toggle", + name = L["OUTLINE"], }, - rP = { - order = 6, - type = "select", - name = L["RELATIVE_POINT"], - desc = L["RELATIVE_POINT_DESC"], - values = POINTS, + shadow = { + order = 3, + type = "toggle", + name = L["SHADOW"], }, - x = { - order = 7, - type = "range", - name = L["X_OFFSET"], - min = -128, max = 128, step = 1, + h_alignment = { + order = 4, + type = "select", + name = L["TEXT_HORIZ_ALIGNMENT"], + values = CONFIG.H_ALIGNMENTS, }, - y = { - order = 8, - type = "range", - name = L["Y_OFFSET"], - min = -128, max = 128, step = 1, + spacer_1 = { + order = 9, + type = "description", + name = " ", }, - tag = { + point = { order = 10, - type = "input", - width = "full", - name = L["FORMAT"], - desc = L["POWER_FORMAT_DESC"], - get = function() - return C.db.profile.units[unit].power.text.tag:gsub("\124", "\124\124") + type = "group", + name = "", + inline = true, + get = function(info) + return C.db.profile.units[unit].power.text.point1[info[#info]] end, - set = function(_, value) - if not CONFIG:IsTagStringValid(value) then return end - - C.db.profile.units[unit].power.text.tag = value:gsub("\124\124+", "\124") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdatePower") + set = function(info, value) + if C.db.profile.units[unit].power.text.point1[info[#info]] ~= value then + C.db.profile.units[unit].power.text.point1[info[#info]] = value + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Power", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Power", "UpdateTextPoints") + end end, + args = { + p = { + order = 4, + type = "select", + name = L["POINT"], + desc = L["POINT_DESC"], + values = CONFIG.POINTS, + }, + anchor = { + order = 5, + type = "select", + name = L["ANCHOR"], + values = CONFIG:GetRegionAnchors(ignoredAnchors), + }, + rP = { + order = 6, + type = "select", + name = L["RELATIVE_POINT"], + desc = L["RELATIVE_POINT_DESC"], + values = CONFIG.POINTS, + }, + x = { + order = 7, + type = "range", + name = L["X_OFFSET"], + min = -128, max = 128, step = 1, + }, + y = { + order = 8, + type = "range", + name = L["Y_OFFSET"], + min = -128, max = 128, step = 1, + }, + }, }, }, }, - }, - } - - if unit == "player" or unit == "pet" then - temp.args.enabled.get = function() - return C.db.profile.units[unit][E.UI_LAYOUT].power.enabled - end - temp.args.enabled.set = function(_, value) - C.db.profile.units[unit][E.UI_LAYOUT].power.enabled = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdatePower") - UNITFRAMES:UpdateUnitFrame(unit, "UpdatePowerPrediction") - end - - temp.args.reset.func = function() - CONFIG:CopySettings(D.profile.units[unit][E.UI_LAYOUT].power, C.db.profile.units[unit][E.UI_LAYOUT].power, {["point"] = true}) - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdatePower") - UNITFRAMES:UpdateUnitFrame(unit, "UpdatePowerPrediction") - end - - temp.args.text.get = function(info) - return C.db.profile.units[unit][E.UI_LAYOUT].power.text.point1[info[#info]] - end - temp.args.text.set = function(info, value) - if C.db.profile.units[unit][E.UI_LAYOUT].power.text.point1[info[#info]] ~= value then - C.db.profile.units[unit][E.UI_LAYOUT].power.text.point1[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdatePower") - end - end - - temp.args.text.args.tag.get = function() - return C.db.profile.units[unit][E.UI_LAYOUT].power.text.tag:gsub("\124", "\124\124") - end - temp.args.text.args.tag.set = function(_, value) - if not CONFIG:IsTagStringValid(value) then return end + spacer_3 = { + order = 29, + type = "description", + name = " ", + }, + tag = { + order = 30, + type = "input", + width = "full", + name = L["FORMAT"], + desc = L["POWER_FORMAT_DESC"], + get = function() + return C.db.profile.units[unit].power.text.tag:gsub("\124", "\124\124") + end, + set = function(_, value) + if not CONFIG:IsTagStringValid(value) then return end - C.db.profile.units[unit][E.UI_LAYOUT].power.text.tag = value:gsub("\124\124+", "\124") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdatePower") - end + C.db.profile.units[unit].power.text.tag = value:gsub("\124\124+", "\124") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Power", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Power", "UpdateTags") + end, + }, + }, + } - if unit == "player" then - temp.args.spacer_2 = { - order = 19, + if unit == "player" then + temp.args.spacer_3 = { + order = 29, + type = "description", + name = " ", + } + + temp.args.prediction = { + order = 30, + type = "toggle", + name = L["COST_PREDICTION"], + desc = L["COST_PREDICTION_DESC"], + get = function() + return C.db.profile.units[unit].power.prediction.enabled + end, + set = function(_, value) + C.db.profile.units[unit].power.prediction.enabled = value + UNITFRAMES:UpdateUnitFrame(unit, "UpdatePowerPrediction") + end, + } + end + + return temp +end + +local function getUFOption_AlternativePower(order, unit) + local additonalAnchors = { + ["AlternativePower"] = L["ALTERNATIVE_POWER"] + } + + local temp = { + order = order, + type = "group", + name = L["ALTERNATIVE_POWER"], + args = { + enabled = { + order = 1, + type = "toggle", + name = L["ENABLE"], + get = function() + return C.db.profile.units[unit].alt_power.enabled + end, + set = function(_, value) + C.db.profile.units[unit].alt_power.enabled = value + UNITFRAMES:UpdateUnitFrame(unit, "UpdateAlternativePower") + end, + }, + reset = { + type = "execute", + order = 2, + name = L["RESTORE_DEFAULTS"], + func = function() + CONFIG:CopySettings(D.profile.units[unit].alt_power, C.db.profile.units[unit].alt_power, resetIgnoredKeys) + UNITFRAMES:UpdateUnitFrame(unit, "UpdateAlternativePower") + end, + }, + spacer_1 = { + order = 9, + type = "description", + name = " ", + }, + -- change_threshold = { + -- order = 10, + -- type = "input", + -- name = L["GAIN_LOSS_THRESHOLD"], + -- desc = L["GAIN_LOSS_THRESHOLD_DESC"], + -- get = function() + -- return tostring(C.db.profile.units[unit].alt_power.change_threshold * 100) + -- end, + -- set = function(_, value) + -- C.db.profile.units[unit].alt_power.change_threshold = E:Clamp((tonumber(value) or 0.1) / 100, 0.001, 1) + -- UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "AlternativePower", "UpdateConfig") + -- UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "AlternativePower", "UpdateGainLossThreshold") + -- end, + -- }, + -- spacer_2 = { + -- order = 19, + -- type = "description", + -- name = " ", + -- }, + text = { + order = 20, + type = "group", + name = L["BAR_TEXT"], + inline = true, + get = function(info) + return C.db.profile.units[unit].alt_power.text[info[#info]] + end, + set = function(info, value) + if C.db.profile.units[unit].alt_power.text[info[#info]] ~= value then + C.db.profile.units[unit].alt_power.text[info[#info]] = value + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "AlternativePower", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "AlternativePower", "UpdateFontObjects") + end + end, + args = { + size = { + order = 1, + type = "range", + name = L["SIZE"], + min = 10, max = 20, step = 2, + }, + outline = { + order = 2, + type = "toggle", + name = L["OUTLINE"], + }, + shadow = { + order = 3, + type = "toggle", + name = L["SHADOW"], + }, + h_alignment = { + order = 4, + type = "select", + name = L["TEXT_HORIZ_ALIGNMENT"], + values = CONFIG.H_ALIGNMENTS, + }, + spacer_1 = { + order = 9, + type = "description", + name = " ", + }, + point = { + order = 10, + type = "group", + name = "", + inline = true, + get = function(info) + return C.db.profile.units[unit].alt_power.text.point1[info[#info]] + end, + set = function(info, value) + if C.db.profile.units[unit].alt_power.text.point1[info[#info]] ~= value then + C.db.profile.units[unit].alt_power.text.point1[info[#info]] = value + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "AlternativePower", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "AlternativePower", "UpdateTextPoints") + end + end, + args = { + p = { + order = 4, + type = "select", + name = L["POINT"], + desc = L["POINT_DESC"], + values = CONFIG.POINTS, + }, + anchor = { + order = 5, + type = "select", + name = L["ANCHOR"], + values = CONFIG:GetRegionAnchors(nil, additonalAnchors), + }, + rP = { + order = 6, + type = "select", + name = L["RELATIVE_POINT"], + desc = L["RELATIVE_POINT_DESC"], + values = CONFIG.POINTS, + }, + x = { + order = 7, + type = "range", + name = L["X_OFFSET"], + min = -128, max = 128, step = 1, + }, + y = { + order = 8, + type = "range", + name = L["Y_OFFSET"], + min = -128, max = 128, step = 1, + }, + }, + }, + }, + }, + spacer_3 = { + order = 29, type = "description", name = " ", - } + }, + tag = { + order = 30, + type = "input", + width = "full", + name = L["FORMAT"], + desc = L["ALT_POWER_FORMAT_DESC"], + get = function() + return C.db.profile.units[unit].alt_power.text.tag:gsub("\124", "\124\124") + end, + set = function(_, value) + if not CONFIG:IsTagStringValid(value) then return end + + C.db.profile.units[unit].alt_power.text.tag = value:gsub("\124\124+", "\124") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "AlternativePower", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "AlternativePower", "UpdateTags") + end, + }, + }, + } + + return temp +end - temp.args.prediction = { +local function getUFOption_ClassPower(order, unit) + return { + order = order, + type = "group", + name = L["CLASS_POWER"], + args = { + enabled = { + order = 1, + type = "toggle", + name = L["ENABLE"], + get = function() + return C.db.profile.units[unit].class_power.enabled + end, + set = function(_, value) + C.db.profile.units[unit].class_power.enabled = value + UNITFRAMES:UpdateUnitFrame(unit, "UpdateAdditionalPower") + UNITFRAMES:UpdateUnitFrame(unit, "UpdatePowerPrediction") + UNITFRAMES:UpdateUnitFrame(unit, "UpdateClassPower") + UNITFRAMES:UpdateUnitFrame(unit, "UpdateRunes") + UNITFRAMES:UpdateUnitFrame(unit, "UpdateStagger") + end, + }, + reset = { + type = "execute", + order = 2, + name = L["RESTORE_DEFAULTS"], + func = function() + CONFIG:CopySettings(D.profile.units[unit].class_power, C.db.profile.units[unit].class_power, resetIgnoredKeys) + UNITFRAMES:UpdateUnitFrame(unit, "UpdateAdditionalPower") + UNITFRAMES:UpdateUnitFrame(unit, "UpdatePowerPrediction") + UNITFRAMES:UpdateUnitFrame(unit, "UpdateClassPower") + UNITFRAMES:UpdateUnitFrame(unit, "UpdateRunes") + UNITFRAMES:UpdateUnitFrame(unit, "UpdateStagger") + end, + }, + spacer_1 = { + order = 9, + type = "description", + name = " ", + }, + -- change_threshold = { + -- order = 10, + -- type = "input", + -- name = L["GAIN_LOSS_THRESHOLD"], + -- desc = L["GAIN_LOSS_THRESHOLD_DESC"], + -- get = function() + -- return tostring(C.db.profile.units[unit].class_power.change_threshold * 100) + -- end, + -- set = function(_, value) + -- C.db.profile.units[unit].class_power.change_threshold = E:Clamp((tonumber(value) or 0.1) / 100, 0.001, 1) + -- UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Stagger", "UpdateConfig") + -- UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Stagger", "UpdateGainLossThreshold") + -- UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "AdditionalPower", "UpdateConfig") + -- UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "AdditionalPower", "UpdateGainLossThreshold") + -- end, + -- }, + -- spacer_2 = { + -- order = 19, + -- type = "description", + -- name = " ", + -- }, + prediction = { order = 20, type = "toggle", name = L["COST_PREDICTION"], desc = L["COST_PREDICTION_DESC"], get = function() - return C.db.profile.units[unit][E.UI_LAYOUT].power.prediction.enabled + return C.db.profile.units[unit].class_power.prediction.enabled end, set = function(_, value) - C.db.profile.units[unit][E.UI_LAYOUT].power.prediction.enabled = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") + C.db.profile.units[unit].class_power.prediction.enabled = value UNITFRAMES:UpdateUnitFrame(unit, "UpdatePowerPrediction") - end, - } - end - end - return temp + end, + }, + spacer_3 = { + order = 29, + type = "description", + name = " ", + }, + runes = { + order = 30, + type = "group", + name = L["RUNES"], + inline = true, + get = function(info) + return C.db.profile.units[unit].class_power.runes[info[#info]] + end, + args = { + color_by_spec = { + order = 1, + type = "toggle", + name = L["COLOR_BY_SPEC"], + set = function(_, value) + C.db.profile.units[unit].class_power.runes.color_by_spec = value + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Runes", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Runes", "UpdateColors") + end, + }, + sort_order = { + order = 2, + type = "select", + name = L["SORT_DIR"], + values = { + ["none"] = L["NONE"], + ["asc"] = L["ASCENDING"], + ["desc"] = L["DESCENDING"], + }, + set = function(_, value) + C.db.profile.units[unit].class_power.runes.color_by_spec = value + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Runes", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Runes", "UpdateSortOrder") + end, + }, + }, + }, + }, + } end -local function getOptionsTable_Castbar(order, unit) +local function getUFOption_Castbar(order, unit) local temp = { order = order, type = "group", @@ -873,7 +1183,6 @@ local function getOptionsTable_Castbar(order, unit) set = function(info, value) if C.db.profile.units[unit].castbar[info[#info]] ~= value then C.db.profile.units[unit].castbar[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") UNITFRAMES:UpdateUnitFrame(unit, "UpdateCastbar") UNITFRAMES:UpdateUnitFrame(unit, "UpdatePvPIndicator") end @@ -889,8 +1198,7 @@ local function getOptionsTable_Castbar(order, unit) order = 2, name = L["RESTORE_DEFAULTS"], func = function() - CONFIG:CopySettings(D.profile.units[unit].castbar, C.db.profile.units[unit].castbar, {["point"] = true}) - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") + CONFIG:CopySettings(D.profile.units[unit].castbar, C.db.profile.units[unit].castbar, resetIgnoredKeys) UNITFRAMES:UpdateUnitFrame(unit, "UpdateCastbar") UNITFRAMES:UpdateUnitFrame(unit, "UpdatePvPIndicator") end, @@ -916,14 +1224,14 @@ local function getOptionsTable_Castbar(order, unit) return not C.db.profile.units[unit].castbar.detached end, set = function(info, value) - if C.db.profile.units[unit].castbar[info[#info]] ~= value then + if C.db.profile.units[unit].castbar.width_override ~= value then if value < info.option.softMin then value = info.option.min end - C.db.profile.units[unit].castbar[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateCastbar") + C.db.profile.units[unit].castbar.width_override = value + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Castbar", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Castbar", "UpdateSize") UNITFRAMES:UpdateUnitFrame(unit, "UpdatePvPIndicator") end end, @@ -933,63 +1241,48 @@ local function getOptionsTable_Castbar(order, unit) type = "range", name = L["HEIGHT"], min = 8, max = 32, step = 4, - }, - latency = { - order = 13, - type = "toggle", - name = L["LATENCY"], - }, - spacer_2 = { - order = 19, - type = "description", - name = " ", + set = function(_, value) + if C.db.profile.units[unit].castbar.height ~= value then + C.db.profile.units[unit].castbar.height = value + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Castbar", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Castbar", "UpdateSize") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Castbar", "UpdateIcon") + end + end, }, icon = { - order = 20, - type = "group", + order = 14, + type = "select", name = L["ICON"], - inline = true, - get = function(info) - return C.db.profile.units[unit].castbar.icon[info[#info]] + values = CONFIG.CASTBAR_ICON_POSITIONS, + get = function() + return C.db.profile.units[unit].castbar.icon.position end, - set = function(info, value) - if C.db.profile.units[unit].castbar.icon[info[#info]] ~= value then - C.db.profile.units[unit].castbar.icon[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateCastbar") + set = function(_, value) + if C.db.profile.units[unit].castbar.icon.position ~= value then + C.db.profile.units[unit].castbar.icon.position = value + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Castbar", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Castbar", "UpdateIcon") end end, - args = { - enabled = { - order = 1, - type = "toggle", - name = L["ENABLE"], - }, - position = { - order = 2, - type = "select", - name = L["POSITION"], - values = CASTBAR_ICON_POSITIONS, - }, - }, }, - spacer_3 = { - order = 29, + spacer_2 = { + order = 19, type = "description", name = " ", }, text = { - order = 30, + order = 20, type = "group", name = L["TEXT"], inline = true, get = function(info) - return C.db.profile.units[unit].castbar[info[#info - 1]][info[#info]] + return C.db.profile.units[unit].castbar.text[info[#info]] end, set = function(info, value) - C.db.profile.units[unit].castbar[info[#info - 1]][info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateCastbar") + C.db.profile.units[unit].castbar.text[info[#info]] = value + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Castbar", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Castbar", "UpdateFontObjects") end, args = { size = { @@ -998,11 +1291,15 @@ local function getOptionsTable_Castbar(order, unit) name = L["SIZE"], min = 10, max = 20, step = 2, }, - flag = { + outline = { order = 2, - type = "select", - name = L["FLAG"], - values = FLAGS, + type = "toggle", + name = L["OUTLINE"], + }, + shadow = { + order = 3, + type = "toggle", + name = L["SHADOW"], }, }, }, @@ -1010,76 +1307,33 @@ local function getOptionsTable_Castbar(order, unit) } if unit == "player" or unit == "pet" then - temp.get = function(info) - return C.db.profile.units[unit][E.UI_LAYOUT].castbar[info[#info]] - end - temp.set = function(info, value) - if C.db.profile.units[unit][E.UI_LAYOUT].castbar[info[#info]] ~= value then - C.db.profile.units[unit][E.UI_LAYOUT].castbar[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateCastbar") - UNITFRAMES:UpdateUnitFrame(unit, "UpdatePvPIndicator") - end - end - - temp.args.reset.func = function() - CONFIG:CopySettings(D.profile.units[unit][E.UI_LAYOUT].castbar, C.db.profile.units[unit][E.UI_LAYOUT].castbar, {["point"] = true}) - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateCastbar") - UNITFRAMES:UpdateUnitFrame(unit, "UpdatePvPIndicator") - end - - temp.args.width_override.disabled = function() - return not C.db.profile.units[unit][E.UI_LAYOUT].castbar.detached - end - - temp.args.width_override.set = function(info, value) - if C.db.profile.units[unit][E.UI_LAYOUT].castbar[info[#info]] ~= value then - if value < info.option.softMin then - value = info.option.min - end - - C.db.profile.units[unit][E.UI_LAYOUT].castbar[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateCastbar") - UNITFRAMES:UpdateUnitFrame(unit, "UpdatePvPIndicator") - end - end - - temp.args.icon.get = function(info) - return C.db.profile.units[unit][E.UI_LAYOUT].castbar.icon[info[#info]] - end - temp.args.icon.set = function(info, value) - if C.db.profile.units[unit][E.UI_LAYOUT].castbar.icon[info[#info]] ~= value then - C.db.profile.units[unit][E.UI_LAYOUT].castbar.icon[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateCastbar") - end - end - - temp.args.text.get = function(info) - return C.db.profile.units[unit][E.UI_LAYOUT].castbar.text[info[#info]] - end - temp.args.text.set = function(info, value) - if C.db.profile.units[unit][E.UI_LAYOUT].castbar.text[info[#info]] ~= value then - C.db.profile.units[unit][E.UI_LAYOUT].castbar.text[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateCastbar") - end - end - if E.UI_LAYOUT == "ls" then temp.args.detached = nil temp.args.width_override.name = L["WIDTH"] end - else - temp.args.latency = nil + + temp.args.latency = { + order = 13, + type = "toggle", + name = L["LATENCY"], + set = function(_, value) + if C.db.profile.units[unit].castbar.latency ~= value then + C.db.profile.units[unit].castbar.latency = value + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Castbar", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Castbar", "UpdateLatency") + end + end, + } end return temp end -local function getOptionsTable_Name(order, unit) +local function getUFOption_Name(order, unit) + local function isSecondaryAnchorDisabled() + return C.db.profile.units[unit].name.point2.p == "" + end + local temp = { order = order, type = "group", @@ -1090,8 +1344,8 @@ local function getOptionsTable_Name(order, unit) set = function(info, value) if C.db.profile.units[unit].name[info[#info]] ~= value then C.db.profile.units[unit].name[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateName") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Name", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Name", "UpdateFontObjects") end end, args = { @@ -1100,8 +1354,7 @@ local function getOptionsTable_Name(order, unit) order = 1, name = L["RESTORE_DEFAULTS"], func = function() - CONFIG:CopySettings(D.profile.units[unit].name, C.db.profile.units[unit].name, {["point"] = true}) - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") + CONFIG:CopySettings(D.profile.units[unit].name, C.db.profile.units[unit].name, resetIgnoredKeys) UNITFRAMES:UpdateUnitFrame(unit, "UpdateName") end, }, @@ -1121,8 +1374,8 @@ local function getOptionsTable_Name(order, unit) set = function(info, value) if C.db.profile.units[unit].name.point1[info[#info]] ~= value then C.db.profile.units[unit].name.point1[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateName") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Name", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Name", "UpdatePoints") end end, args = { @@ -1131,20 +1384,20 @@ local function getOptionsTable_Name(order, unit) type = "select", name = L["POINT"], desc = L["POINT_DESC"], - values = POINTS, + values = CONFIG.POINTS, }, anchor = { order = 2, type = "select", name = L["ANCHOR"], - values = getRegionAnchors(), + values = CONFIG:GetRegionAnchors(), }, rP = { order = 3, type = "select", name = L["RELATIVE_POINT"], desc = L["RELATIVE_POINT_DESC"], - values = POINTS, + values = CONFIG.POINTS, }, x = { order = 4, @@ -1176,46 +1429,46 @@ local function getOptionsTable_Name(order, unit) set = function(info, value) if C.db.profile.units[unit].name.point2[info[#info]] ~= value then C.db.profile.units[unit].name.point2[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateName") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Name", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Name", "UpdatePoints") end end, - disabled = function() - return C.db.profile.units[unit].name.point2.p == "" - end, args = { p = { order = 1, type = "select", name = L["POINT"], desc = L["POINT_DESC"], - values = POINTS_EXT, - disabled = false, + values = CONFIG.POINTS_EXT, }, anchor = { order = 2, type = "select", name = L["ANCHOR"], - values = getRegionAnchors(), + values = CONFIG:GetRegionAnchors(), + disabled = isSecondaryAnchorDisabled, }, rP = { order = 3, type = "select", name = L["RELATIVE_POINT"], desc = L["RELATIVE_POINT_DESC"], - values = POINTS, + values = CONFIG.POINTS, + disabled = isSecondaryAnchorDisabled, }, x = { order = 4, type = "range", name = L["X_OFFSET"], min = -128, max = 128, step = 1, + disabled = isSecondaryAnchorDisabled, }, y = { order = 5, type = "range", name = L["Y_OFFSET"], min = -128, max = 128, step = 1, + disabled = isSecondaryAnchorDisabled, }, }, }, @@ -1224,34 +1477,48 @@ local function getOptionsTable_Name(order, unit) type = "description", name = " ", }, - h_alignment = { + size = { order = 30, + type = "range", + name = L["SIZE"], + min = 10, max = 20, step = 2, + }, + outline = { + order = 31, + type = "toggle", + name = L["OUTLINE"], + }, + shadow = { + order = 32, + type = "toggle", + name = L["SHADOW"], + }, + h_alignment = { + order = 33, type = "select", name = L["TEXT_HORIZ_ALIGNMENT"], - values = H_ALIGNMENTS, - disabled = function() - return C.db.profile.units[unit].name.point2.p == "" - end, + values = CONFIG.H_ALIGNMENTS, }, v_alignment = { - order = 31, + order = 34, type = "select", name = L["TEXT_VERT_ALIGNMENT"], - values = V_ALIGNMENTS, - disabled = function() - return C.db.profile.units[unit].name.point2.p == "" - end, + values = CONFIG.V_ALIGNMENTS, + disabled = isSecondaryAnchorDisabled, }, word_wrap = { - order = 32, + order = 35, type = "toggle", name = L["WORD_WRAP"], - disabled = function() - return C.db.profile.units[unit].name.point2.p == "" - end, + disabled = isSecondaryAnchorDisabled, + }, + spacer_4 = { + order = 39, + type = "description", + name = " ", }, tag = { - order = 34, + order = 40, type = "input", width = "full", name = L["FORMAT"], @@ -1263,84 +1530,17 @@ local function getOptionsTable_Name(order, unit) if not CONFIG:IsTagStringValid(value) then return end C.db.profile.units[unit].name.tag = value:gsub("\124\124+", "\124") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateName") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Name", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Name", "UpdateTags") end, }, }, } - if unit == "player" or unit == "pet" then - temp.get = function(info) - return C.db.profile.units[unit][E.UI_LAYOUT].name[info[#info]] - end - temp.set = function(info, value) - if C.db.profile.units[unit][E.UI_LAYOUT].name[info[#info]] ~= value then - C.db.profile.units[unit][E.UI_LAYOUT].name[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateName") - end - end - - temp.args.reset.func = function() - CONFIG:CopySettings(D.profile.units[unit][E.UI_LAYOUT].name, C.db.profile.units[unit][E.UI_LAYOUT].name, {["point"] = true}) - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateName") - end - - temp.args.point1.get = function(info) - return C.db.profile.units[unit][E.UI_LAYOUT].name.point1[info[#info]] - end - temp.args.point1.set = function(info, value) - if C.db.profile.units[unit][E.UI_LAYOUT].name.point1[info[#info]] ~= value then - C.db.profile.units[unit][E.UI_LAYOUT].name.point1[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateName") - end - end - - temp.args.point2.get = function(info) - return C.db.profile.units[unit][E.UI_LAYOUT].name.point2[info[#info]] - end - temp.args.point2.set = function(info, value) - if C.db.profile.units[unit][E.UI_LAYOUT].name.point2[info[#info]] ~= value then - C.db.profile.units[unit][E.UI_LAYOUT].name.point2[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateName") - end - end - temp.args.point2.disabled = function() - return C.db.profile.units[unit][E.UI_LAYOUT].name.point2.p == "" - end - - temp.args.h_alignment.disabled = function() - return C.db.profile.units[unit][E.UI_LAYOUT].name.point2.p == "" - end - - temp.args.v_alignment.disabled = function() - return C.db.profile.units[unit][E.UI_LAYOUT].name.point2.p == "" - end - - temp.args.word_wrap.disabled = function() - return C.db.profile.units[unit][E.UI_LAYOUT].name.point2.p == "" - end - - temp.args.tag.get = function() - return C.db.profile.units[unit][E.UI_LAYOUT].name.tag:gsub("\124", "\124\124") - end - temp.args.tag.set = function(_, value) - if not CONFIG:IsTagStringValid(value) then return end - - C.db.profile.units[unit][E.UI_LAYOUT].name.tag = value:gsub("\124\124+", "\124") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateName") - end - end - return temp end -local function getOptionsTable_RaidIcon(order, unit) +local function getUFOption_RaidTargetIndicator(order, unit) local temp = { order = order, type = "group", @@ -1351,7 +1551,6 @@ local function getOptionsTable_RaidIcon(order, unit) set = function(info, value) if C.db.profile.units[unit].raid_target[info[#info]] ~= value then C.db.profile.units[unit].raid_target[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") UNITFRAMES:UpdateUnitFrame(unit, "UpdateRaidTargetIndicator") end end, @@ -1366,8 +1565,7 @@ local function getOptionsTable_RaidIcon(order, unit) order = 2, name = L["RESTORE_DEFAULTS"], func = function() - CONFIG:CopySettings(D.profile.units[unit].raid_target, C.db.profile.units[unit].raid_target, {["point"] = true}) - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") + CONFIG:CopySettings(D.profile.units[unit].raid_target, C.db.profile.units[unit].raid_target, resetIgnoredKeys) UNITFRAMES:UpdateUnitFrame(unit, "UpdateRaidTargetIndicator") end, }, @@ -1381,6 +1579,13 @@ local function getOptionsTable_RaidIcon(order, unit) type = "range", name = L["SIZE"], min = 8, max = 64, step = 1, + set = function(info, value) + if C.db.profile.units[unit].raid_target[info[#info]] ~= value then + C.db.profile.units[unit].raid_target[info[#info]] = value + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "RaidTargetIndicator", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "RaidTargetIndicator", "UpdateSize") + end + end, }, spacer_2 = { order = 19, @@ -1398,8 +1603,8 @@ local function getOptionsTable_RaidIcon(order, unit) set = function(info, value) if C.db.profile.units[unit].raid_target.point1[info[#info]] ~= value then C.db.profile.units[unit].raid_target.point1[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateRaidTargetIndicator") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "RaidTargetIndicator", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "RaidTargetIndicator", "UpdatePoints") end end, args = { @@ -1408,14 +1613,14 @@ local function getOptionsTable_RaidIcon(order, unit) type = "select", name = L["POINT"], desc = L["POINT_DESC"], - values = POINTS, + values = CONFIG.POINTS, }, rP = { order = 2, type = "select", name = L["RELATIVE_POINT"], desc = L["RELATIVE_POINT_DESC"], - values = POINTS, + values = CONFIG.POINTS, }, x = { order = 3, @@ -1434,40 +1639,16 @@ local function getOptionsTable_RaidIcon(order, unit) }, } - if unit == "player" or unit == "pet" then - temp.get = function(info) - return C.db.profile.units[unit][E.UI_LAYOUT].raid_target[info[#info]] - end - temp.set = function(info, value) - if C.db.profile.units[unit][E.UI_LAYOUT].raid_target[info[#info]] ~= value then - C.db.profile.units[unit][E.UI_LAYOUT].raid_target[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateRaidTargetIndicator") - end - end - - temp.args.reset.func = function() - CONFIG:CopySettings(D.profile.units[unit][E.UI_LAYOUT].raid_target, C.db.profile.units[unit][E.UI_LAYOUT].raid_target, {["point"] = true}) - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateRaidTargetIndicator") - end - - temp.args.point.get = function(info) - return C.db.profile.units[unit][E.UI_LAYOUT].raid_target.point1[info[#info]] - end - temp.args.point.set = function(info, value) - if C.db.profile.units[unit][E.UI_LAYOUT].raid_target.point1[info[#info]] ~= value then - C.db.profile.units[unit][E.UI_LAYOUT].raid_target.point1[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateRaidTargetIndicator") - end - end - end - return temp end -local function getOptionsTable_DebuffIcons(order, unit) +local function getUFOption_DebuffIcons(order, unit) + local ignoredAnchors = { + ["Health.Text"] = true, + ["Power"] = true, + ["Power.Text"] = true, + } + local temp = { order = order, type = "group", @@ -1483,7 +1664,6 @@ local function getOptionsTable_DebuffIcons(order, unit) set = function(_, value) if C.db.profile.units[unit].debuff.enabled ~= value then C.db.profile.units[unit].debuff.enabled = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") UNITFRAMES:UpdateUnitFrame(unit, "UpdateDebuffIndicator") end end, @@ -1493,8 +1673,7 @@ local function getOptionsTable_DebuffIcons(order, unit) order = 2, name = L["RESTORE_DEFAULTS"], func = function() - CONFIG:CopySettings(D.profile.units[unit].debuff, C.db.profile.units[unit].debuff, {["point"] = true}) - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") + CONFIG:CopySettings(D.profile.units[unit].debuff, C.db.profile.units[unit].debuff, resetIgnoredKeys) UNITFRAMES:UpdateUnitFrame(unit, "UpdateDebuffIndicator") end, }, @@ -1503,7 +1682,7 @@ local function getOptionsTable_DebuffIcons(order, unit) order = 3, name = L["PREVIEW"], func = function() - UNITFRAMES:UpdateUnitFrame(unit, "PreviewDebuffIndicator") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "DebuffIndicator", "Preview") end, }, spacer_1 = { @@ -1522,8 +1701,8 @@ local function getOptionsTable_DebuffIcons(order, unit) set = function(info, value) if C.db.profile.units[unit].debuff.point1[info[#info]] ~= value then C.db.profile.units[unit].debuff.point1[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateDebuffIndicator") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "DebuffIndicator", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "DebuffIndicator", "UpdatePoints") end end, args = { @@ -1532,20 +1711,20 @@ local function getOptionsTable_DebuffIcons(order, unit) type = "select", name = L["POINT"], desc = L["POINT_DESC"], - values = POINTS, + values = CONFIG.POINTS, }, anchor = { order = 2, type = "select", name = L["ANCHOR"], - values = getRegionAnchors({["Health.Text"] = true, ["Power"] = true, ["Power.Text"] = true}), + values = CONFIG:GetRegionAnchors(ignoredAnchors), }, rP = { order = 3, type = "select", name = L["RELATIVE_POINT"], desc = L["RELATIVE_POINT_DESC"], - values = POINTS, + values = CONFIG.POINTS, }, x = { order = 4, @@ -1564,40 +1743,22 @@ local function getOptionsTable_DebuffIcons(order, unit) }, } - if unit == "player" or unit == "pet" then - temp.args.enabled.get = function() - return C.db.profile.units[unit][E.UI_LAYOUT].debuff.enabled - end - temp.args.enabled.set = function(_, value) - if C.db.profile.units[unit][E.UI_LAYOUT].debuff.enabled ~= value then - C.db.profile.units[unit][E.UI_LAYOUT].debuff.enabled = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateDebuffIndicator") - end - end - - temp.args.reset.func = function() - CONFIG:CopySettings(D.profile.units[unit][E.UI_LAYOUT].debuff, C.db.profile.units[unit][E.UI_LAYOUT].debuff, {["point"] = true}) - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateDebuffIndicator") - end - - temp.args.point.get = function(info) - return C.db.profile.units[unit][E.UI_LAYOUT].debuff.point1[info[#info]] - end - temp.args.point.set = function(info, value) - if C.db.profile.units[unit][E.UI_LAYOUT].debuff.point1[info[#info]] ~= value then - C.db.profile.units[unit][E.UI_LAYOUT].debuff.point1[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateDebuffIndicator") - end - end - end - return temp end -local function getOptionsTable_Auras(order, unit) +local function getUFOption_Auras(order, unit) + local copyIgnoredKeys = { + ["filter"] = true, + } + + local ignoredUnits = { + [unit] = true, + ["player"] = true, + ["pet"] = true, + ["targettarget"] = true, + ["focustarget"] = true + } + local temp = { order = order, type = "group", @@ -1608,7 +1769,6 @@ local function getOptionsTable_Auras(order, unit) set = function(info, value) if C.db.profile.units[unit].auras[info[#info]] ~= value then C.db.profile.units[unit].auras[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") UNITFRAMES:UpdateUnitFrame(unit, "UpdateAuras") end end, @@ -1623,11 +1783,12 @@ local function getOptionsTable_Auras(order, unit) type = "select", name = L["COPY_FROM"], desc = L["COPY_FROM_DESC"], - values = function() return UNITFRAMES:GetUnits({[unit] = true, ["player"] = true, ["pet"] = true, ["targettarget"] = true, ["focustarget"] = true}) end, + values = function() + return UNITFRAMES:GetUnits(ignoredUnits) + end, get = function() end, set = function(_, value) - CONFIG:CopySettings(C.db.profile.units[value].auras, C.db.profile.units[unit].auras, {["filter"] = true}) - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") + CONFIG:CopySettings(C.db.profile.units[value].auras, C.db.profile.units[unit].auras, copyIgnoredKeys) UNITFRAMES:UpdateUnitFrame(unit, "UpdateAuras") end, }, @@ -1636,8 +1797,7 @@ local function getOptionsTable_Auras(order, unit) order = 3, name = L["RESTORE_DEFAULTS"], func = function() - CONFIG:CopySettings(D.profile.units[unit].auras, C.db.profile.units[unit].auras, {["point"] = true, ["filter"] = true}) - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") + CONFIG:CopySettings(D.profile.units[unit].auras, C.db.profile.units[unit].auras, aurasResetIgnoredKeys) UNITFRAMES:UpdateUnitFrame(unit, "UpdateAuras") end, }, @@ -1651,12 +1811,26 @@ local function getOptionsTable_Auras(order, unit) type = "range", name = L["NUM_ROWS"], min = 1, max = 4, step = 1, + set = function(_, value) + if C.db.profile.units[unit].auras.rows ~= value then + C.db.profile.units[unit].auras.rows = value + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Auras", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Auras", "UpdateSize") + end + end, }, per_row = { order = 11, type = "range", name = L["PER_ROW"], min = 1, max = 10, step = 1, + set = function(_, value) + if C.db.profile.units[unit].auras.per_row ~= value then + C.db.profile.units[unit].auras.per_row = value + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Auras", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Auras", "UpdateSize") + end + end, }, size_override = { order = 12, @@ -1666,14 +1840,14 @@ local function getOptionsTable_Auras(order, unit) min = 0, max = 64, step = 1, softMin = 24, set = function(info, value) - if C.db.profile.units[unit].auras[info[#info]] ~= value then + if C.db.profile.units[unit].auras.size_override ~= value then if value < info.option.softMin then value = info.option.min end - C.db.profile.units[unit].auras[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateAuras") + C.db.profile.units[unit].auras.size_override = value + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Auras", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Auras", "UpdateSize") end end, }, @@ -1681,14 +1855,14 @@ local function getOptionsTable_Auras(order, unit) order = 13, type = "select", name = L["GROWTH_DIR"], - values = GROWTH_DIRS, + values = CONFIG.GROWTH_DIRS, get = function() return C.db.profile.units[unit].auras.x_growth .. "_" .. C.db.profile.units[unit].auras.y_growth end, set = function(_, value) C.db.profile.units[unit].auras.x_growth, C.db.profile.units[unit].auras.y_growth = s_split("_", value) - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateAuras") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Auras", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Auras", "UpdateGrowthDirection") end, }, disable_mouse = { @@ -1713,8 +1887,8 @@ local function getOptionsTable_Auras(order, unit) set = function(info, value) if C.db.profile.units[unit].auras.point1[info[#info]] ~= value then C.db.profile.units[unit].auras.point1[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateAuras") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Auras", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Auras", "UpdatePoints") end end, args = { @@ -1723,14 +1897,14 @@ local function getOptionsTable_Auras(order, unit) type = "select", name = L["POINT"], desc = L["POINT_DESC"], - values = POINTS, + values = CONFIG.POINTS, }, rP = { order = 2, type = "select", name = L["RELATIVE_POINT"], desc = L["RELATIVE_POINT_DESC"], - values = POINTS, + values = CONFIG.POINTS, }, x = { order = 3, @@ -1754,7 +1928,7 @@ local function getOptionsTable_Auras(order, unit) type = { order = 30, type = "group", - name = "Aura Type", + name = L["AURA_TYPE"], inline = true, get = function(info) return C.db.profile.units[unit].auras.type[info[#info]] @@ -1762,15 +1936,15 @@ local function getOptionsTable_Auras(order, unit) set = function(info, value) if C.db.profile.units[unit].auras.type[info[#info]] ~= value then C.db.profile.units[unit].auras.type[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateAuras") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Auras", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Auras", "UpdateAuraTypeIcon") end end, args = { debuff_type = { order = 1, type = "toggle", - name = "Debuff Type", + name = L["DEBUFF_TYPE"], }, size = { order = 2, @@ -1782,7 +1956,7 @@ local function getOptionsTable_Auras(order, unit) order = 3, type = "select", name = L["POINT"], - values = POINTS, + values = CONFIG.POINTS, }, }, }, @@ -1791,20 +1965,19 @@ local function getOptionsTable_Auras(order, unit) type = "description", name = " ", }, - text = { + count = { order = 40, type = "group", name = L["COUNT_TEXT"], inline = true, get = function(info) - return C.db.profile.units[unit].auras.text[info[#info]] + return C.db.profile.units[unit].auras.count[info[#info]] end, set = function(info, value) - if C.db.profile.units[unit].auras.text[info[#info]] ~= value then - C.db.profile.units[unit].auras.text[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") + if C.db.profile.units[unit].auras.count[info[#info]] ~= value then + C.db.profile.units[unit].auras.count[info[#info]] = value UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Auras", "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Auras", "UpdateFonts") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Auras", "UpdateFontObjects") end end, args = { @@ -1828,13 +2001,13 @@ local function getOptionsTable_Auras(order, unit) order = 4, type = "select", name = L["TEXT_HORIZ_ALIGNMENT"], - values = H_ALIGNMENTS, + values = CONFIG.H_ALIGNMENTS, }, v_alignment = { order = 5, type = "select", name = L["TEXT_VERT_ALIGNMENT"], - values = V_ALIGNMENTS, + values = CONFIG.V_ALIGNMENTS, }, }, }, @@ -1854,8 +2027,8 @@ local function getOptionsTable_Auras(order, unit) set = function(info, value) if C.db.profile.units[unit].auras.cooldown.text[info[#info]] ~= value then C.db.profile.units[unit].auras.cooldown.text[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateAuras") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Auras", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Auras", "UpdateCooldownConfig") end end, args = { @@ -1874,13 +2047,13 @@ local function getOptionsTable_Auras(order, unit) order = 3, type = "select", name = L["FLAG"], - values = FLAGS, + values = CONFIG.FLAGS, }, v_alignment = { order = 4, type = "select", name = L["TEXT_VERT_ALIGNMENT"], - values = V_ALIGNMENTS, + values = CONFIG.V_ALIGNMENTS, }, }, }, @@ -1899,8 +2072,8 @@ local function getOptionsTable_Auras(order, unit) end, set = function(info, value) C.db.profile.units[unit].auras.filter[info[#info - 2]][info[#info - 1]][info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateAuras") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Auras", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Auras", "ForceUpdate") end, args = { copy = { @@ -1908,7 +2081,9 @@ local function getOptionsTable_Auras(order, unit) type = "select", name = L["COPY_FROM"], desc = L["COPY_FROM_DESC"], - values = function() return UNITFRAMES:GetUnits({[unit] = true, ["player"] = true, ["pet"] = true, ["targettarget"] = true, ["focustarget"] = true}) end, + values = function() + return UNITFRAMES:GetUnits(ignoredUnits) + end, get = function() end, }, reset = { @@ -1917,8 +2092,8 @@ local function getOptionsTable_Auras(order, unit) name = L["RESTORE_DEFAULTS"], func = function() CONFIG:CopySettings(D.profile.units[unit].auras.filter, C.db.profile.units[unit].auras.filter) - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateAuras") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Auras", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Auras", "ForceUpdate") end, }, friendly = { @@ -2143,122 +2318,15 @@ local function getOptionsTable_Auras(order, unit) } if unit == "player" then - temp.get = function(info) - return C.db.profile.units[unit][E.UI_LAYOUT].auras[info[#info]] - end - temp.set = function(info, value) - if C.db.profile.units[unit][E.UI_LAYOUT].auras[info[#info]] ~= value then - C.db.profile.units[unit][E.UI_LAYOUT].auras[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateAuras") - end - end - - temp.args.copy.set = function(_, value) - CONFIG:CopySettings(C.db.profile.units[value].auras, C.db.profile.units[unit][E.UI_LAYOUT].auras, {["filter"] = true}) - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateAuras") - end - - temp.args.reset.func = function() - CONFIG:CopySettings(D.profile.units[unit][E.UI_LAYOUT].auras, C.db.profile.units[unit][E.UI_LAYOUT].auras, {["point"] = true, ["filter"] = true}) - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateAuras") - end - - temp.args.size_override.set = function(info, value) - if C.db.profile.units[unit][E.UI_LAYOUT].auras[info[#info]] ~= value then - if value < info.option.softMin then - value = info.option.min - end - - C.db.profile.units[unit][E.UI_LAYOUT].auras[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateAuras") - end - end - - temp.args.growth_dir.get = function() - return C.db.profile.units[unit][E.UI_LAYOUT].auras.x_growth .. "_" .. C.db.profile.units[unit][E.UI_LAYOUT].auras.y_growth - end - temp.args.growth_dir.set = function(_, value) - C.db.profile.units[unit][E.UI_LAYOUT].auras.x_growth, C.db.profile.units[unit][E.UI_LAYOUT].auras.y_growth = s_split("_", value) - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateAuras") - end - - temp.args.point.get = function(info) - return C.db.profile.units[unit][E.UI_LAYOUT].auras.point1[info[#info]] - end - temp.args.point.set = function(info, value) - if C.db.profile.units[unit][E.UI_LAYOUT].auras.point1[info[#info]] ~= value then - C.db.profile.units[unit][E.UI_LAYOUT].auras.point1[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateAuras") - end - end - - temp.args.type.get = function(info) - return C.db.profile.units[unit][E.UI_LAYOUT].auras.type[info[#info]] - end - temp.args.type.set = function(info, value) - if C.db.profile.units[unit][E.UI_LAYOUT].auras.type[info[#info]] ~= value then - C.db.profile.units[unit][E.UI_LAYOUT].auras.type[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateAuras") - end - end - - temp.args.text.get = function(info) - return C.db.profile.units[unit][E.UI_LAYOUT].auras.text[info[#info]] - end - temp.args.text.set = function(info, value) - if C.db.profile.units[unit][E.UI_LAYOUT].auras.text[info[#info]] ~= value then - C.db.profile.units[unit][E.UI_LAYOUT].auras.text[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Auras", "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Auras", "UpdateFonts") - end - end - - temp.args.cooldown.get = function(info) - return C.db.profile.units[unit][E.UI_LAYOUT].auras.cooldown.text[info[#info]] - end - temp.args.cooldown.set = function(info, value) - if C.db.profile.units[unit][E.UI_LAYOUT].auras.cooldown.text[info[#info]] ~= value then - C.db.profile.units[unit][E.UI_LAYOUT].auras.cooldown.text[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateAuras") - end - end - - temp.args.filter.get = function(info) - return C.db.profile.units[unit][E.UI_LAYOUT].auras.filter[info[#info - 2]][info[#info - 1]][info[#info]] - end - temp.args.filter.set = function(info, value) - C.db.profile.units[unit][E.UI_LAYOUT].auras.filter[info[#info - 2]][info[#info - 1]][info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateAuras") - end + local ignoredFilters = { + ["player"] = true, + ["player_permanent"] = true, + } temp.args.filter.args.copy.set = function(_, value) - CONFIG:CopySettings(C.db.profile.units[value].auras.filter.friendly, C.db.profile.units[unit][E.UI_LAYOUT].auras.filter.friendly, {["player"] = true, ["player_permanent"] = true}) - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateAuras") - end - - temp.args.filter.args.reset.func = function() - CONFIG:CopySettings(D.profile.units[unit][E.UI_LAYOUT].auras.filter, C.db.profile.units[unit][E.UI_LAYOUT].auras.filter) - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateAuras") - end - - temp.args.filter.args.friendly.args.buff.args.selfcast_permanent.disabled = function() - return not C.db.profile.units[unit][E.UI_LAYOUT].auras.filter.friendly.buff.selfcast - end - - temp.args.filter.args.friendly.args.debuff.args.selfcast_permanent.disabled = function() - return not C.db.profile.units[unit][E.UI_LAYOUT].auras.filter.friendly.debuff.selfcast + CONFIG:CopySettings(C.db.profile.units[value].auras.filter.friendly, C.db.profile.units[unit].auras.filter.friendly, ignoredFilters) + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Auras", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Auras", "ForceUpdate") end temp.args.filter.args.friendly.args.buff.args.player = nil @@ -2269,11 +2337,17 @@ local function getOptionsTable_Auras(order, unit) temp.args.filter.args.enemy = nil elseif unit == "boss" then + local ignoredFilters = { + ["mount"] = true, + ["selfcast"] = true, + ["selfcast_permanent"] = true, + } + temp.args.filter.args.copy.set = function(_, value) - CONFIG:CopySettings(C.db.profile.units[value].auras.filter.friendly, C.db.profile.units[unit].auras.filter.friendly, {["mount"] = true, ["selfcast"] = true, ["selfcast_permanent"] = true}) - CONFIG:CopySettings(C.db.profile.units[value].auras.filter.enemy, C.db.profile.units[unit].auras.filter.enemy, {["mount"] = true, ["selfcast"] = true, ["selfcast_permanent"] = true}) - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateAuras") + CONFIG:CopySettings(C.db.profile.units[value].auras.filter.friendly, C.db.profile.units[unit].auras.filter.friendly, ignoredFilters) + CONFIG:CopySettings(C.db.profile.units[value].auras.filter.enemy, C.db.profile.units[unit].auras.filter.enemy, ignoredFilters) + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Auras", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Auras", "ForceUpdate") end temp.args.filter.args.friendly.args.buff.args.mount = nil @@ -2292,15 +2366,71 @@ local function getOptionsTable_Auras(order, unit) else temp.args.filter.args.copy.set = function(_, value) CONFIG:CopySettings(C.db.profile.units[value].auras.filter, C.db.profile.units[unit].auras.filter) - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateAuras") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Auras", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Auras", "ForceUpdate") end end return temp end -local function getOptionsTable_UnitFrame(order, unit, name) +local function getUFOption_CombatFeedback(order, unit) + return { + order = order, + type = "group", + name = L["FCF"], + get = function(info) + return C.db.profile.units[unit].combat_feedback[info[#info]] + end, + set = function(info, value) + C.db.profile.units[unit].combat_feedback[info[#info]] = value + UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "UpdateCombatFeedback") + end, + args = { + enabled = { + order = 1, + type = "toggle", + name = L["ENABLE"], + }, + reset = { + type = "execute", + order = 2, + name = L["RESTORE_DEFAULTS"], + func = function() + CONFIG:CopySettings(D.profile.units[unit].combat_feedback, C.db.profile.units[unit].combat_feedback, resetIgnoredKeys) + UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "UpdateCombatFeedback") + end, + }, + spacer_1 = { + order = 9, + type = "description", + name = " ", + }, + x_offset = { + order = 10, + type = "range", + name = L["X_OFFSET"], + min = 0, max = 128, step = 1, + }, + y_offset = { + order = 12, + type = "range", + name = L["Y_OFFSET"], + min = 0, max = 128, step = 1, + }, + mode = { + order = 13, + type = "select", + name = L["MODE"], + values = CONFIG.FCF_MODES, + }, + }, + } +end + +local function getUFOptions(order, unit, name) local temp = { order = order, type = "group", @@ -2319,104 +2449,20 @@ local function getOptionsTable_UnitFrame(order, unit, name) UNITFRAMES:UpdateUnitFrame(unit, "Update") end, }, - copy = { - order = 2, - type = "select", - name = L["COPY_FROM"], - desc = L["COPY_FROM_DESC"], - values = function() return UNITFRAMES:GetUnits({[unit] = true, ["player"] = true, ["pet"] = true}) end, - get = function() end, - set = function(_, value) - CONFIG:CopySettings(C.db.profile.units[value], C.db.profile.units[unit], {["point"] = true}) - UNITFRAMES:UpdateUnitFrame(unit, "Update") - end, - }, reset = { type = "execute", order = 3, name = L["RESTORE_DEFAULTS"], func = function() - CONFIG:CopySettings(D.profile.units[unit], C.db.profile.units[unit], {["point"] = true}) + CONFIG:CopySettings(D.profile.units[unit], C.db.profile.units[unit], resetIgnoredKeys) UNITFRAMES:UpdateUnitFrame(unit, "Update") end, }, - preview = { - order = 4, - type = "execute", - name = L["PREVIEW"], - func = function() - UNITFRAMES:UpdateUnitFrame(unit, "Preview") - end, - }, spacer_1 = { order = 9, type = "description", name = " ", }, - width = { - order = 10, - type = "range", - name = L["WIDTH"], - min = 96, max = 512, step = 2, - get = function() - return C.db.profile.units[unit].width - end, - set = function(_, value) - if C.db.profile.units[unit].width ~= value then - C.db.profile.units[unit].width = value - UNITFRAMES:UpdateUnitFrame(unit, "Update") - end - end, - }, - height = { - order = 11, - type = "range", - name = L["HEIGHT"], - min = 28, max = 256, step = 2, - get = function() - return C.db.profile.units[unit].height - end, - set = function(_, value) - if C.db.profile.units[unit].height ~= value then - C.db.profile.units[unit].height = value - UNITFRAMES:UpdateUnitFrame(unit, "Update") - end - end, - }, - top_inset = { - order = 15, - type = "range", - name = L["TOP_INSET_SIZE"], - desc = L["TOP_INSET_SIZE_DESC"], - min = 8, max = 32, step = 2, - get = function() - return C.db.profile.units[unit].insets.t_height - end, - set = function(_, value) - if C.db.profile.units[unit].insets.t_height ~= value then - C.db.profile.units[unit].insets.t_height = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateInsets") - end - end, - }, - bottom_inset = { - order = 16, - type = "range", - name = L["BOTTOM_INSET_SIZE"], - desc = L["BOTTOM_INSET_SIZE_DESC"], - min = 8, max = 32, step = 2, - get = function() - return C.db.profile.units[unit].insets.b_height - end, - set = function(_, value) - if C.db.profile.units[unit].insets.b_height ~= value then - C.db.profile.units[unit].insets.b_height = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateInsets") - end - end, - }, threat = { order = 17, type = "toggle", @@ -2426,345 +2472,129 @@ local function getOptionsTable_UnitFrame(order, unit, name) end, set = function(_, value) C.db.profile.units[unit].threat.enabled = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") UNITFRAMES:UpdateUnitFrame(unit, "UpdateThreatIndicator") end, }, - pvp = { - order = 18, - type = "toggle", - name = L["PVP_ICON"], - get = function() - return C.db.profile.units[unit].pvp.enabled - end, - set = function(_, value) - C.db.profile.units[unit].pvp.enabled = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdatePvPIndicator") - end, - }, spacer_2 = { order = 19, type = "description", name = " ", }, - border = { - order = 20, - type = "group", - name = L["BORDER_COLOR"], - inline = true, - get = function(info) - return C.db.profile.units[unit].class[info[#info]] - end, - set = function(info, value) - C.db.profile.units[unit].class[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateClassIndicator") - end, - args = { - player = { - order = 1, - type = "toggle", - name = L["PLAYER_CLASS"], - desc = L["COLOR_CLASS_DESC"], - }, - npc = { - order = 2, - type = "toggle", - name = L["NPC_CLASSIFICATION"], - desc = L["COLOR_CLASSIFICATION_DESC"], - }, - }, - }, }, } - temp.args.health = getOptionsTable_Health(100, unit) - temp.args.power = getOptionsTable_Power(200, unit) - temp.args.castbar = getOptionsTable_Castbar(400, unit) - temp.args.name = getOptionsTable_Name(500, unit) - temp.args.raid_target = getOptionsTable_RaidIcon(600, unit) - temp.args.debuff = getOptionsTable_DebuffIcons(700, unit) - temp.args.auras = getOptionsTable_Auras(800, unit) - - if unit == "player" or unit == "pet" then - temp.disabled = function() return not UNITFRAMES:HasPlayerFrame() end - - temp.args.enabled.get = function() - return C.db.profile.units[unit][E.UI_LAYOUT].enabled - end - temp.args.enabled.set = function(_, value) - C.db.profile.units[unit][E.UI_LAYOUT].enabled = value - UNITFRAMES:UpdateUnitFrame(unit, "Update") - end - - temp.args.copy.set = function(_, value) - CONFIG:CopySettings(C.db.profile.units[value], C.db.profile.units[unit][E.UI_LAYOUT], {["point"] = true}) - UNITFRAMES:UpdateUnitFrame(unit, "Update") - end - - temp.args.reset.func = function() - CONFIG:CopySettings(D.profile.units[unit][E.UI_LAYOUT], C.db.profile.units[unit][E.UI_LAYOUT], {["point"] = true}) - UNITFRAMES:UpdateUnitFrame(unit, "Update") - end - - if unit == "player" then - temp.args.preview = nil - end - - temp.args.width.get = function() - return C.db.profile.units[unit][E.UI_LAYOUT].width - end - temp.args.width.set = function(_, value) - if C.db.profile.units[unit][E.UI_LAYOUT].width ~= value then - C.db.profile.units[unit][E.UI_LAYOUT].width = value - UNITFRAMES:UpdateUnitFrame(unit, "Update") - end - end - - temp.args.height.get = function() - return C.db.profile.units[unit][E.UI_LAYOUT].height - end - temp.args.height.set = function(_, value) - if C.db.profile.units[unit][E.UI_LAYOUT].height ~= value then - C.db.profile.units[unit][E.UI_LAYOUT].height = value - UNITFRAMES:UpdateUnitFrame(unit, "Update") - end - end - - temp.args.threat.get = function() - return C.db.profile.units[unit][E.UI_LAYOUT].threat.enabled - end - temp.args.threat.set = function(_, value) - C.db.profile.units[unit][E.UI_LAYOUT].threat.enabled = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateThreatIndicator") - end - - temp.args.pvp.get = function() - return C.db.profile.units[unit][E.UI_LAYOUT].pvp.enabled - end - temp.args.pvp.set = function(_, value) - C.db.profile.units[unit][E.UI_LAYOUT].pvp.enabled = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdatePvPIndicator") - end - - temp.args.border.get = function(info) - return C.db.profile.units[unit][E.UI_LAYOUT].class[info[#info]] - end - temp.args.border.set = function(info, value) - C.db.profile.units[unit][E.UI_LAYOUT].class[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateClassIndicator") - end - - if unit == "player" then - temp.args.class_power = { - order = 300, - type = "group", - name = L["CLASS_POWER"], - args = { - enabled = { - order = 1, - type = "toggle", - name = L["ENABLE"], - get = function() - return C.db.profile.units[unit][E.UI_LAYOUT].class_power.enabled - end, - set = function(_, value) - C.db.profile.units[unit][E.UI_LAYOUT].class_power.enabled = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateAdditionalPower") - UNITFRAMES:UpdateUnitFrame(unit, "UpdatePowerPrediction") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateClassPower") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateRunes") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateStagger") - end, - }, - spacer_1 = { - order = 9, - type = "description", - name = " ", - }, - prediction = { - order = 10, - type = "toggle", - name = L["COST_PREDICTION"], - desc = L["COST_PREDICTION_DESC"], - get = function() - return C.db.profile.units[unit][E.UI_LAYOUT].class_power.prediction.enabled - end, - set = function(_, value) - C.db.profile.units[unit][E.UI_LAYOUT].class_power.prediction.enabled = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdatePowerPrediction") - - end, - }, - spacer_2 = { - order = 19, - type = "description", - name = " ", - }, - runes = { - order = 20, - type = "group", - name = L["RUNES"], - inline = true, - get = function(info) - return C.db.profile.units[unit][E.UI_LAYOUT].class_power.runes[info[#info]] - end, - set = function(info, value) - C.db.profile.units[unit][E.UI_LAYOUT].class_power.runes[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateRunes") - end, - args = { - color_by_spec = { - order = 1, - type = "toggle", - name = L["COLOR_BY_SPEC"], - }, - sort_order = { - order = 2, - type = "select", - name = L["SORT_DIR"], - values = { - ["none"] = L["NONE"], - ["asc"] = L["ASCENDING"], - ["desc"] = L["DESCENDING"], - }, - }, - }, - }, - }, - } - - temp.args.combat_feedback = { - order = 900, - type = "group", - name = L["FCF"], - get = function(info) - return C.db.profile.units[unit][E.UI_LAYOUT].combat_feedback[info[#info]] - end, - set = function(info, value) - C.db.profile.units[unit][E.UI_LAYOUT].combat_feedback[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateCombatFeedback") - end, - args = { - enabled = { - order = 1, - type = "toggle", - name = L["ENABLE"], - }, - reset = { - type = "execute", - order = 2, - name = L["RESTORE_DEFAULTS"], - func = function() - CONFIG:CopySettings(D.profile.units[unit][E.UI_LAYOUT].combat_feedback, C.db.profile.units[unit][E.UI_LAYOUT].combat_feedback, {["point"] = true}) - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateCombatFeedback") - end, - }, - spacer_1 = { - order = 9, - type = "description", - name = " ", - }, - x_offset = { - order = 10, - type = "range", - name = L["X_OFFSET"], - min = 0, max = 128, step = 1, - }, - y_offset = { - order = 12, - type = "range", - name = L["Y_OFFSET"], - min = 0, max = 128, step = 1, - }, - mode = { - order = 13, - type = "select", - name = L["MODE"], - values = FCF_MODES, - }, - }, - } - end - - if E.UI_LAYOUT == "ls" then - temp.args.copy = nil - temp.args.width = nil - temp.args.height = nil - temp.args.top_inset = nil - temp.args.bottom_inset = nil - temp.args.auras = nil - - temp.args.border.args.npc = nil - - if unit == "pet" then - temp.args.border = nil - temp.args.pvp = nil - temp.args.name = nil - end - else - temp.args.top_inset.get = function() - return C.db.profile.units[unit][E.UI_LAYOUT].insets.t_height - end - temp.args.top_inset.set = function(_, value) - if C.db.profile.units[unit][E.UI_LAYOUT].insets.t_height ~= value then - C.db.profile.units[unit][E.UI_LAYOUT].insets.t_height = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateInsets") - end - end - - temp.args.bottom_inset.get = function() - return C.db.profile.units[unit][E.UI_LAYOUT].insets.b_height - end - temp.args.bottom_inset.set = function(_, value) - if C.db.profile.units[unit][E.UI_LAYOUT].insets.b_height ~= value then - C.db.profile.units[unit][E.UI_LAYOUT].insets.b_height = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateInsets") - end - end - - temp.args.border.args.npc = nil - - if unit == "pet" then - temp.args.pvp = nil - temp.args.auras = nil - end + if unit == "player" then + temp.disabled = isPlayerFrameDisabled + temp.args.pvp = getUFOption_PvPIndicator(18, unit) + temp.args.border = getUFOption_Border(20, unit) + temp.args.health = getUFOption_Health(100, unit) + temp.args.power = getUFOption_Power(200, unit) + temp.args.class_power = getUFOption_ClassPower(300, unit) + temp.args.castbar = getUFOption_Castbar(400, unit) + temp.args.name = getUFOption_Name(500, unit) + temp.args.raid_target = getUFOption_RaidTargetIndicator(600, unit) + temp.args.debuff = getUFOption_DebuffIcons(700, unit) + temp.args.combat_feedback = getUFOption_CombatFeedback(900, unit) + + if E.UI_LAYOUT == "traditional" then + temp.args.copy = getUFOption_Copy(2, unit) + temp.args.width = getUFOption_Width(10, unit) + temp.args.height = getUFOption_Height(11, unit) + temp.args.top_inset = getUFOption_TopInset(15, unit) + temp.args.bottom_inset = getUFOption_BottomInset(16, unit) + temp.args.auras = getUFOption_Auras(800, unit) + end + elseif unit == "pet" then + temp.disabled = isPlayerFrameDisabled + temp.args.preview = getUFOption_Preview(4, unit) + temp.args.health = getUFOption_Health(100, unit) + temp.args.power = getUFOption_Power(200, unit) + temp.args.castbar = getUFOption_Castbar(400, unit) + temp.args.raid_target = getUFOption_RaidTargetIndicator(600, unit) + temp.args.debuff = getUFOption_DebuffIcons(700, unit) + + if E.UI_LAYOUT == "traditional" then + temp.args.copy = getUFOption_Copy(2, unit) + temp.args.width = getUFOption_Width(10, unit) + temp.args.height = getUFOption_Height(11, unit) + temp.args.top_inset = getUFOption_TopInset(15, unit) + temp.args.bottom_inset = getUFOption_BottomInset(16, unit) + temp.args.border = getUFOption_Border(20, unit) + temp.args.name = getUFOption_Name(500, unit) end elseif unit == "target" then - temp.disabled = function() return not UNITFRAMES:HasTargetFrame() end - temp.args.preview = nil + temp.disabled = isTargetFrameDisabled + temp.args.copy = getUFOption_Copy(2, unit) + temp.args.width = getUFOption_Width(10, unit) + temp.args.height = getUFOption_Height(11, unit) + temp.args.top_inset = getUFOption_TopInset(15, unit) + temp.args.bottom_inset = getUFOption_BottomInset(16, unit) + temp.args.pvp = getUFOption_PvPIndicator(18, unit) + temp.args.border = getUFOption_Border(20, unit) + temp.args.health = getUFOption_Health(100, unit) + temp.args.power = getUFOption_Power(200, unit) + temp.args.castbar = getUFOption_Castbar(400, unit) + temp.args.name = getUFOption_Name(500, unit) + temp.args.raid_target = getUFOption_RaidTargetIndicator(600, unit) + temp.args.debuff = getUFOption_DebuffIcons(700, unit) + temp.args.auras = getUFOption_Auras(800, unit) elseif unit == "targettarget" then - temp.disabled = function() return not UNITFRAMES:HasTargetFrame() end - temp.args.preview = nil - temp.args.pvp = nil - temp.args.castbar = nil - temp.args.debuff = nil - temp.args.auras = nil + temp.disabled = isTargetFrameDisabled + temp.args.copy = getUFOption_Copy(2, unit) + temp.args.width = getUFOption_Width(10, unit) + temp.args.height = getUFOption_Height(11, unit) + temp.args.top_inset = getUFOption_TopInset(15, unit) + temp.args.bottom_inset = getUFOption_BottomInset(16, unit) + temp.args.border = getUFOption_Border(20, unit) + temp.args.health = getUFOption_Health(100, unit) + temp.args.power = getUFOption_Power(200, unit) + temp.args.name = getUFOption_Name(500, unit) + temp.args.raid_target = getUFOption_RaidTargetIndicator(600, unit) elseif unit == "focus" then - temp.disabled = function() return not UNITFRAMES:HasFocusFrame() end - temp.args.preview = nil + temp.disabled = isFocusFrameDisabled + temp.args.copy = getUFOption_Copy(2, unit) + temp.args.width = getUFOption_Width(10, unit) + temp.args.height = getUFOption_Height(11, unit) + temp.args.top_inset = getUFOption_TopInset(15, unit) + temp.args.bottom_inset = getUFOption_BottomInset(16, unit) + temp.args.pvp = getUFOption_PvPIndicator(18, unit) + temp.args.border = getUFOption_Border(20, unit) + temp.args.health = getUFOption_Health(100, unit) + temp.args.power = getUFOption_Power(200, unit) + temp.args.castbar = getUFOption_Castbar(400, unit) + temp.args.name = getUFOption_Name(500, unit) + temp.args.raid_target = getUFOption_RaidTargetIndicator(600, unit) + temp.args.debuff = getUFOption_DebuffIcons(700, unit) + temp.args.auras = getUFOption_Auras(800, unit) elseif unit == "focustarget" then - temp.disabled = function() return not UNITFRAMES:HasFocusFrame() end - temp.args.preview = nil - temp.args.pvp = nil - temp.args.castbar = nil - temp.args.debuff = nil - temp.args.auras = nil + temp.disabled = isFocusFrameDisabled + temp.args.copy = getUFOption_Copy(2, unit) + temp.args.width = getUFOption_Width(10, unit) + temp.args.height = getUFOption_Height(11, unit) + temp.args.top_inset = getUFOption_TopInset(15, unit) + temp.args.bottom_inset = getUFOption_BottomInset(16, unit) + temp.args.border = getUFOption_Border(20, unit) + temp.args.health = getUFOption_Health(100, unit) + temp.args.power = getUFOption_Power(200, unit) + temp.args.name = getUFOption_Name(500, unit) + temp.args.raid_target = getUFOption_RaidTargetIndicator(600, unit) elseif unit == "boss" then - temp.disabled = function() return not UNITFRAMES:HasBossFrame() end - temp.args.pvp = nil - temp.args.debuff = nil + temp.disabled = isBossFrameDisabled + temp.args.copy = getUFOption_Copy(2, unit) + temp.args.preview = getUFOption_Preview(4, unit) + temp.args.width = getUFOption_Width(10, unit) + temp.args.height = getUFOption_Height(11, unit) + temp.args.top_inset = getUFOption_TopInset(15, unit) + temp.args.bottom_inset = getUFOption_BottomInset(16, unit) + temp.args.border = getUFOption_Border(20, unit) + temp.args.health = getUFOption_Health(100, unit) + temp.args.power = getUFOption_Power(200, unit) + temp.args.alt_power = getUFOption_AlternativePower(300, unit) + temp.args.castbar = getUFOption_Castbar(400, unit) + temp.args.name = getUFOption_Name(500, unit) + temp.args.raid_target = getUFOption_RaidTargetIndicator(600, unit) + temp.args.debuff = getUFOption_DebuffIcons(700, unit) + temp.args.auras = getUFOption_Auras(800, unit) temp.args.per_row = { order = 12, @@ -2802,7 +2632,7 @@ local function getOptionsTable_UnitFrame(order, unit, name) order = 14, type = "select", name = L["GROWTH_DIR"], - values = GROWTH_DIRS, + values = CONFIG.GROWTH_DIRS, get = function() return C.db.profile.units[unit].x_growth .. "_" .. C.db.profile.units[unit].y_growth end, @@ -2811,109 +2641,6 @@ local function getOptionsTable_UnitFrame(order, unit, name) UNITFRAMES:UpdateBossHolder() end, } - - temp.args.alt_power = { - order = 300, - type = "group", - name = L["ALTERNATIVE_POWER"], - args = { - enabled = { - order = 1, - type = "toggle", - name = L["ENABLE"], - get = function() - return C.db.profile.units[unit].alt_power.enabled - end, - set = function(_, value) - C.db.profile.units[unit].alt_power.enabled = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateAlternativePower") - end, - }, - reset = { - type = "execute", - order = 2, - name = L["RESTORE_DEFAULTS"], - func = function() - CONFIG:CopySettings(D.profile.units[unit].alt_power, C.db.profile.units[unit].alt_power, {["point"] = true}) - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateAlternativePower") - end, - }, - spacer_1 = { - order = 9, - type = "description", - name = " ", - }, - text = { - order = 10, - type = "group", - name = L["BAR_TEXT"], - inline = true, - get = function(info) - return C.db.profile.units[unit].alt_power.text.point1[info[#info]] - end, - set = function(info, value) - if C.db.profile.units[unit].alt_power.text.point1[info[#info]] ~= value then - C.db.profile.units[unit].alt_power.text.point1[info[#info]] = value - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateAlternativePower") - end - end, - args = { - p = { - order = 4, - type = "select", - name = L["POINT"], - desc = L["POINT_DESC"], - values = POINTS, - }, - anchor = { - order = 5, - type = "select", - name = L["ANCHOR"], - values = getRegionAnchors(nil, {["AlternativePower"] = L["ALTERNATIVE_POWER"]}), - }, - rP = { - order = 6, - type = "select", - name = L["RELATIVE_POINT"], - desc = L["RELATIVE_POINT_DESC"], - values = POINTS, - }, - x = { - order = 7, - type = "range", - name = L["X_OFFSET"], - min = -128, max = 128, step = 1, - }, - y = { - order = 8, - type = "range", - name = L["Y_OFFSET"], - min = -128, max = 128, step = 1, - }, - tag = { - order = 10, - type = "input", - width = "full", - name = L["FORMAT"], - desc = L["ALT_POWER_FORMAT_DESC"], - get = function() - return C.db.profile.units[unit].alt_power.text.tag:gsub("\124", "\124\124") - end, - set = function(_, value) - if not CONFIG:IsTagStringValid(value) then return end - - C.db.profile.units[unit].alt_power.text.tag = value:gsub("\124\124+", "\124") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateConfig") - UNITFRAMES:UpdateUnitFrame(unit, "UpdateAlternativePower") - end, - }, - }, - }, - }, - } end return temp @@ -3034,8 +2761,8 @@ function CONFIG.CreateUnitFramesPanel(_, order) set = function(info, value) if C.db.profile.units.cooldown[info[#info]] ~= value then C.db.profile.units.cooldown[info[#info]] = value - UNITFRAMES:UpdateUnitFrames("UpdateConfig") - UNITFRAMES:UpdateUnitFrames("UpdateAuras") + UNITFRAMES:UpdateUnitFrames("ForElement", "Auras", "UpdateConfig") + UNITFRAMES:UpdateUnitFrames("ForElement", "Auras", "UpdateCooldownConfig") end end, args = { @@ -3045,8 +2772,8 @@ function CONFIG.CreateUnitFramesPanel(_, order) name = L["RESTORE_DEFAULTS"], func = function() CONFIG:CopySettings(D.profile.units.cooldown, C.db.profile.units.cooldown) - UNITFRAMES:UpdateUnitFrames("UpdateConfig") - UNITFRAMES:UpdateUnitFrames("UpdateAuras") + UNITFRAMES:UpdateUnitFrames("ForElement", "Auras", "UpdateConfig") + UNITFRAMES:UpdateUnitFrames("ForElement", "Auras", "UpdateCooldownConfig") end, }, spacer_1 = { @@ -3075,8 +2802,8 @@ function CONFIG.CreateUnitFramesPanel(_, order) end C.db.profile.units.cooldown[info[#info]] = value - UNITFRAMES:UpdateUnitFrames("UpdateConfig") - UNITFRAMES:UpdateUnitFrames("UpdateAuras") + UNITFRAMES:UpdateUnitFrames("ForElement", "Auras", "UpdateConfig") + UNITFRAMES:UpdateUnitFrames("ForElement", "Auras", "UpdateCooldownConfig") end end, }, @@ -3098,8 +2825,8 @@ function CONFIG.CreateUnitFramesPanel(_, order) local color = C.db.profile.units.cooldown.colors[info[#info]] if color[1] ~= r or color[2] ~= g or color[3] ~= b then color[1], color[2], color[3] = r, g, b - UNITFRAMES:UpdateUnitFrames("UpdateConfig") - UNITFRAMES:UpdateUnitFrames("UpdateAuras") + UNITFRAMES:UpdateUnitFrames("ForElement", "Auras", "UpdateConfig") + UNITFRAMES:UpdateUnitFrames("ForElement", "Auras", "UpdateCooldownConfig") end end end, @@ -3113,8 +2840,8 @@ function CONFIG.CreateUnitFramesPanel(_, order) end, set = function(_, value) C.db.profile.units.cooldown.colors.enabled = value - UNITFRAMES:UpdateUnitFrames("UpdateConfig") - UNITFRAMES:UpdateUnitFrames("UpdateAuras") + UNITFRAMES:UpdateUnitFrames("ForElement", "Auras", "UpdateConfig") + UNITFRAMES:UpdateUnitFrames("ForElement", "Auras", "UpdateCooldownConfig") end, }, expiration = { @@ -3165,7 +2892,6 @@ function CONFIG.CreateUnitFramesPanel(_, order) local color = C.db.profile.units.castbar.colors[info[#info]] if color[1] ~= r or color[2] ~= g or color[3] ~= b then color[1], color[2], color[3] = r, g, b - UNITFRAMES:UpdateUnitFrames("UpdateConfig") UNITFRAMES:UpdateUnitFrames("ForElement", "Castbar", "UpdateConfig") end end @@ -3177,7 +2903,6 @@ function CONFIG.CreateUnitFramesPanel(_, order) name = L["RESTORE_DEFAULTS"], func = function() CONFIG:CopySettings(D.profile.units.castbar.colors, C.db.profile.units.castbar.colors) - UNITFRAMES:UpdateUnitFrames("UpdateConfig") UNITFRAMES:UpdateUnitFrames("ForElement", "Castbar", "UpdateConfig") end, }, @@ -3208,13 +2933,13 @@ function CONFIG.CreateUnitFramesPanel(_, order) }, }, }, - player = getOptionsTable_UnitFrame(3, "player", L["PLAYER_FRAME"]), - pet = getOptionsTable_UnitFrame(4, "pet", L["PET_FRAME"]), - target = getOptionsTable_UnitFrame(5, "target", L["TARGET_FRAME"]), - targettarget = getOptionsTable_UnitFrame(6, "targettarget", L["TOT_FRAME"]), - focus = getOptionsTable_UnitFrame(7, "focus", L["FOCUS_FRAME"]), - focustarget = getOptionsTable_UnitFrame(8, "focustarget", L["TOF_FRAME"]), - boss = getOptionsTable_UnitFrame(9, "boss", L["BOSS_FRAMES"]), + player = getUFOptions(3, "player", L["PLAYER_FRAME"]), + pet = getUFOptions(4, "pet", L["PET_FRAME"]), + target = getUFOptions(5, "target", L["TARGET_FRAME"]), + targettarget = getUFOptions(6, "targettarget", L["TOT_FRAME"]), + focus = getUFOptions(7, "focus", L["FOCUS_FRAME"]), + focustarget = getUFOptions(8, "focustarget", L["TOF_FRAME"]), + boss = getUFOptions(9, "boss", L["BOSS_FRAMES"]), }, } end diff --git a/core/defaults.lua b/core/defaults.lua index c9ec73f2..d93c19c8 100644 --- a/core/defaults.lua +++ b/core/defaults.lua @@ -1,32 +1,95 @@ local _, ns = ... local D = ns.D +-- local function rbga(r, g, b, a) +-- return {r / 255, g / 255, b / 255, a} +-- end + +local function rgb(r, g, b) + return {r / 255, g / 255, b / 255} +end + D.global = {} D.profile = { + -- colors = { + -- castbar = { + -- casting = rgb(246, 196, 66), -- #F6C442 (2.5Y 8/10); + -- channeling = rgb(46, 172, 52), -- #2EAC34 (10GY 6/12); + -- failed = rgb(220, 68, 54), -- #DC4436 (7.5R 5/14); + -- notinterruptible = rgb(136, 137, 135), -- #888987 (N 5); + -- }, + -- cooldown = { + -- expiration = rgb(240, 32, 30), -- #F0201E (7.5R 5/18); + -- second = rgb(246, 196, 66), -- #F6C442 (2.5Y 8/10); + -- minute = rgb(255, 255, 255), -- #FFFFFF + -- hour = rgb(255, 255, 255), -- #FFFFFF + -- day = rgb(255, 255, 255), -- #FFFFFF + -- }, + -- disconnected = rgb(136, 137, 135), -- #888987 (N 5); + -- gain = rgb(120, 225, 107), -- #78E16B (10GY 8/12); + -- health = rgb(46, 172, 52), -- #2EAC34 (10GY 6/12); + -- loss = rgb(140, 29, 30), -- #8C1D1E (7.5R 3/10); + -- power = { + -- MANA = rgb(69, 155, 218), -- #459BDA (2.5PB 6/10); + -- RAGE = rgb(220, 68, 54), -- #DC4436 (7.5R 5/14); + -- FOCUS = rgb(230, 118, 47), -- #E6762F (2.5YR 6/12); + -- ENERGY = rgb(246, 196, 66), -- #F6C442 (2.5Y 8/10); + -- COMBO_POINTS = rgb(215, 77, 18), -- #D74D12 (10R 5/14); + -- RUNES = rgb(99, 185, 228), -- #63B9E4 (10B 7/8); + -- RUNIC_POWER = rgb(60, 190, 219), -- #3CBEDB (5B 7/8); + -- SOUL_SHARDS = rgb(149, 99, 202), -- #9563CA (2.5P 5/14); + -- LUNAR_POWER = rgb(72, 152, 235), -- #4898EB (5PB 6/12); + -- HOLY_POWER = rgb(238, 234, 140), -- #EEEA8C (10Y 9/6); + -- MAELSTROM = rgb(38, 125, 206), -- #267DCE (5PB 5/12); + -- INSANITY = rgb(125, 70, 174), -- #7D46AE (2.5P 4/14); + -- CHI = rgb(108, 254, 214), -- #6CFED6 (10G 9/6); + -- ARCANE_CHARGES = rgb(28, 129, 191), -- #1C81BF (2.5PB 5/10); + -- FURY = rgb(187, 57, 231), -- #BB39E7 (5P 5/22); + -- PAIN = rgb(243, 157, 28), -- #F39D1C (7.5YR 7/12); + -- AMMOSLOT = rgb(217, 169, 35), -- #D9A923 (2.5Y 7/10); + -- FUEL = rgb(42, 137, 122), -- #2A897A (2.5BG 5/6); + -- STAGGER = { + -- rgb(111, 255, 99), -- #6FFF63 (10GY 9/14); + -- rgb(229, 237, 142), -- #E5ED8E (2.5GY 9/6); + -- rgb(211, 77, 81), -- #D34D51 (5R 5/12); + -- }, + -- }, + -- reaction = { + -- [1] = rgb(220, 68, 54), -- #DC4436 (7.5R 5/14); + -- [2] = rgb(220, 68, 54), -- #DC4436 (7.5R 5/14); + -- [3] = rgb(230, 118, 47), -- #E6762F (2.5YR 6/12); + -- [4] = rgb(246, 196, 66), -- #F6C442 (2.5Y 8/10); + -- [5] = rgb(46, 172, 52), -- #2EAC34 (10GY 6/12); + -- [6] = rgb(46, 172, 52), -- #2EAC34 (10GY 6/12); + -- [7] = rgb(46, 172, 52), -- #2EAC34 (10GY 6/12); + -- [8] = rgb(46, 172, 52), -- #2EAC34 (10GY 6/12); + -- }, + -- tapped = rgb(163, 162, 162), -- #A3A2A2 (N 6); + -- }, units = { cooldown = { exp_threshold = 5, -- [1; 10] m_ss_threshold = 600, -- [91; 3599] colors = { enabled = true, - expiration = {229 / 255, 25 / 255, 25 / 255}, - second = {255 / 255, 191 / 255, 25 / 255}, - minute = {255 / 255, 255 / 255, 255 / 255}, - hour = {255 / 255, 255 / 255, 255 / 255}, - day = {255 / 255, 255 / 255, 255 / 255}, + expiration = rgb(229, 25, 25), + second = rgb(255, 191, 25), + minute = rgb(255, 255, 255), + hour = rgb(255, 255, 255), + day = rgb(255, 255, 255), }, }, castbar = { colors = { - casting = {250 / 255, 193 / 255, 74 / 255}, - channeling = {60 / 255, 170 / 255, 59 / 255}, - failed = {222 / 255, 67 / 255, 58 / 255}, - notinterruptible = {125 / 255, 122 / 255, 125 / 255}, + casting = rgb(250, 193, 74), + channeling = rgb(46, 172, 52), + failed = rgb(220, 68, 54), + notinterruptible = rgb(136, 137, 135), }, }, - player = { - ls = { + ls = { + player = { enabled = true, width = 166, height = 166, @@ -36,6 +99,7 @@ D.profile = { }, health = { enabled = true, + change_threshold = 0.001, orientation = "VERTICAL", color = { class = false, @@ -92,9 +156,15 @@ D.profile = { }, power = { enabled = true, + change_threshold = 0.01, orientation = "VERTICAL", text = { tag = "[ls:color:power][ls:power:cur]|r", + size = 14, + outline = false, + shadow = true, + h_alignment = "CENTER", + v_alignment = "MIDDLE", point1 = { p = "TOP", anchor = "Health", @@ -109,6 +179,7 @@ D.profile = { }, class_power = { enabled = true, + change_threshold = 0.01, orientation = "VERTICAL", prediction = { enabled = true, @@ -125,12 +196,12 @@ D.profile = { width_override = 200, height = 12, icon = { - enabled = true, - position = "LEFT", -- or "RIGHT" + position = "LEFT", -- "RIGHT", "NONE" }, text = { size = 12, - flag = "_Shadow", -- "_Outline", "" + outline = false, + shadow = true, }, point1 = { p = "BOTTOM", @@ -142,7 +213,10 @@ D.profile = { }, }, name = { + size = 12, tag = "", + outline = false, + shadow = true, h_alignment = "CENTER", v_alignment = "MIDDLE", word_wrap = false, @@ -206,7 +280,142 @@ D.profile = { npc = false, }, }, - traditional = { + pet = { + enabled = true, + width = 42, + height = 134, + point = { + ls = {"RIGHT", "LSPlayerFrame" , "LEFT", -2, 0}, + traditional = {"RIGHT", "LSPlayerFrame" , "LEFT", -2, 0}, + }, + health = { + enabled = true, + change_threshold = 0.001, + orientation = "VERTICAL", + color = { + class = true, + reaction = true, + }, + text = { + tag = "[ls:health:cur]", + size = 12, + outline = false, + shadow = true, + h_alignment = "RIGHT", + v_alignment = "MIDDLE", + point1 = { + p = "BOTTOMRIGHT", + anchor = "", + rP = "BOTTOMLEFT", + x = 8, + y = 26, + }, + }, + prediction = { + enabled = true, + absorb_text = { + tag = "", + size = 10, + outline = false, + shadow = true, + h_alignment = "CENTER", + v_alignment = "MIDDLE", + point1 = { + p = "CENTER", + anchor = "Health", + rP = "CENTER", + x = 0, + y = 0, + }, + }, + heal_absorb_text = { + tag = "", + size = 10, + outline = false, + shadow = true, + h_alignment = "CENTER", + v_alignment = "MIDDLE", + point1 = { + p = "CENTER", + anchor = "Health", + rP = "CENTER", + x = 0, + y = 0, + }, + }, + }, + }, + power = { + enabled = true, + change_threshold = 0.01, + orientation = "VERTICAL", + text = { + tag = "[ls:color:power][ls:power:cur]|r", + size = 12, + outline = false, + shadow = true, + h_alignment = "RIGHT", + v_alignment = "MIDDLE", + point1 = { + p = "BOTTOMRIGHT", + anchor = "", + rP = "BOTTOMLEFT", + x = 8, + y = 14, + }, + }, + }, + castbar = { + enabled = true, + latency = true, + detached = true, + width_override = 200, + height = 12, + icon = { + position = "LEFT", -- "RIGHT", "NONE" + }, + text = { + size = 12, + outline = false, + shadow = true, + }, + point1 = { + p = "BOTTOM", + anchor = "LSPlayerFrameCastbarHolder", + detached_anchor = "LSPlayerFrameCastbarHolder", + rP = "TOP", + x = 0, + y = 6, + }, + }, + raid_target = { + enabled = true, + size = 24, + point1 = { + p = "CENTER", + anchor = "", + rP = "TOP", + x = 0, + y = 6, + }, + }, + debuff = { + enabled = true, + point1 = { + p = "CENTER", + anchor = "", + rP = "CENTER", + x = 0, + y = 0, + }, + }, + threat = { + enabled = true, + }, + }, + }, + traditional = { + player = { enabled = true, width = 250, height = 52, @@ -220,6 +429,7 @@ D.profile = { }, health = { enabled = true, + change_threshold = 0.001, orientation = "HORIZONTAL", color = { class = false, @@ -276,10 +486,15 @@ D.profile = { }, power = { enabled = true, + change_threshold = 0.01, orientation = "HORIZONTAL", text = { tag = "[ls:color:power][ls:power:cur]|r", + size = 12, + outline = false, + shadow = true, h_alignment = "LEFT", + v_alignment = "MIDDLE", point1 = { p = "LEFT", anchor = "Power", @@ -294,6 +509,7 @@ D.profile = { }, class_power = { enabled = true, + change_threshold = 0.01, orientation = "HORIZONTAL", prediction = { enabled = true, @@ -310,12 +526,12 @@ D.profile = { width_override = 0, height = 12, icon = { - enabled = true, - position = "LEFT", -- or "RIGHT" + position = "LEFT", -- "RIGHT", "NONE" }, text = { size = 12, - flag = "_Shadow", -- "_Outline", "" + outline = false, + shadow = true, }, point1 = { p = "TOPRIGHT", @@ -327,7 +543,10 @@ D.profile = { }, }, name = { + size = 12, tag = "", + outline = false, + shadow = true, h_alignment = "CENTER", v_alignment = "MIDDLE", word_wrap = false, @@ -388,7 +607,7 @@ D.profile = { x_growth = "RIGHT", y_growth = "UP", disable_mouse = false, - text = { + count = { size = 10, outline = true, shadow = false, @@ -443,136 +662,7 @@ D.profile = { npc = true, }, }, - }, - pet = { - ls = { - enabled = true, - width = 42, - height = 134, - point = { - ls = {"RIGHT", "LSPlayerFrame" , "LEFT", -2, 0}, - traditional = {"RIGHT", "LSPlayerFrame" , "LEFT", -2, 0}, - }, - health = { - enabled = true, - orientation = "VERTICAL", - color = { - class = true, - reaction = true, - }, - text = { - tag = "[ls:health:cur]", - size = 12, - outline = false, - shadow = true, - h_alignment = "RIGHT", - v_alignment = "MIDDLE", - point1 = { - p = "BOTTOMRIGHT", - anchor = "", - rP = "BOTTOMLEFT", - x = 8, - y = 26, - }, - }, - prediction = { - enabled = true, - absorb_text = { - tag = "", - size = 10, - outline = false, - shadow = true, - h_alignment = "CENTER", - v_alignment = "MIDDLE", - point1 = { - p = "CENTER", - anchor = "Health", - rP = "CENTER", - x = 0, - y = 0, - }, - }, - heal_absorb_text = { - tag = "", - size = 10, - outline = false, - shadow = true, - h_alignment = "CENTER", - v_alignment = "MIDDLE", - point1 = { - p = "CENTER", - anchor = "Health", - rP = "CENTER", - x = 0, - y = 0, - }, - }, - }, - }, - power = { - enabled = true, - orientation = "VERTICAL", - text = { - tag = "[ls:color:power][ls:power:cur]|r", - h_alignment = "RIGHT", - point1 = { - p = "BOTTOMRIGHT", - anchor = "", - rP = "BOTTOMLEFT", - x = 8, - y = 14, - }, - }, - }, - castbar = { - enabled = true, - latency = true, - detached = true, - width_override = 200, - height = 12, - icon = { - enabled = true, - position = "LEFT", -- or "RIGHT" - }, - text = { - size = 12, - flag = "_Shadow", -- "_Outline", "" - }, - point1 = { - p = "BOTTOM", - anchor = "LSPlayerFrameCastbarHolder", - detached_anchor = "LSPlayerFrameCastbarHolder", - rP = "TOP", - x = 0, - y = 6, - }, - }, - raid_target = { - enabled = true, - size = 24, - point1 = { - p = "CENTER", - anchor = "", - rP = "TOP", - x = 0, - y = 6, - }, - }, - debuff = { - enabled = true, - point1 = { - p = "CENTER", - anchor = "", - rP = "CENTER", - x = 0, - y = 0, - }, - }, - threat = { - enabled = true, - }, - }, - traditional = { + pet = { enabled = true, width = 112, height = 28, @@ -586,6 +676,7 @@ D.profile = { }, health = { enabled = true, + change_threshold = 0.001, orientation = "HORIZONTAL", color = { class = true, @@ -642,10 +733,15 @@ D.profile = { }, power = { enabled = true, + change_threshold = 0.01, orientation = "HORIZONTAL", text = { tag = "[ls:color:power][ls:power:cur]|r", + size = 12, + outline = false, + shadow = true, h_alignment = "LEFT", + v_alignment = "MIDDLE", point1 = { p = "LEFT", anchor = "Power", @@ -662,12 +758,12 @@ D.profile = { width_override = 0, height = 12, icon = { - enabled = true, - position = "LEFT", -- or "RIGHT" + position = "LEFT", -- "RIGHT", "NONE" }, text = { size = 12, - flag = "_Shadow", -- "_Outline", "" + outline = false, + shadow = true, }, point1 = { p = "TOPLEFT", @@ -679,8 +775,13 @@ D.profile = { }, }, name = { + size = 12, tag = "", + outline = false, + shadow = true, h_alignment = "CENTER", + v_alignment = "MIDDLE", + word_wrap = false, point1 = { p = "CENTER", anchor = "Health", @@ -740,6 +841,7 @@ D.profile = { }, health = { enabled = true, + change_threshold = 0.001, orientation = "HORIZONTAL", color = { class = false, @@ -796,10 +898,15 @@ D.profile = { }, power = { enabled = true, + change_threshold = 0.01, orientation = "HORIZONTAL", text = { tag = "[ls:power:cur-color-max]", + size = 12, + outline = false, + shadow = true, h_alignment = "RIGHT", + v_alignment = "MIDDLE", point1 = { p = "RIGHT", anchor = "Power", @@ -816,12 +923,12 @@ D.profile = { width_override = 0, height = 12, icon = { - enabled = true, - position = "LEFT", -- or "RIGHT" + position = "LEFT", -- "RIGHT", "NONE" }, text = { size = 12, - flag = "_Shadow", -- "_Outline", "" + outline = false, + shadow = true, }, point1 = { p = "TOPLEFT", @@ -833,7 +940,10 @@ D.profile = { }, }, name = { + size = 12, tag = "[ls:color:difficulty][ls:level:effective][ls:npc:type]|r [ls:name][ls:server]", + outline = false, + shadow = true, h_alignment = "LEFT", v_alignment = "MIDDLE", word_wrap = false, @@ -875,7 +985,6 @@ D.profile = { }, debuff = { enabled = true, - h_alignment = "RIGHT", point1 = { p = "TOPRIGHT", anchor = "Health", @@ -896,7 +1005,7 @@ D.profile = { x_growth = "RIGHT", y_growth = "UP", disable_mouse = false, - text = { + count = { size = 10, outline = true, shadow = false, @@ -981,6 +1090,7 @@ D.profile = { }, health = { enabled = true, + change_threshold = 0.001, orientation = "HORIZONTAL", color = { class = false, @@ -1037,9 +1147,15 @@ D.profile = { }, power = { enabled = false, + change_threshold = 0.01, orientation = "HORIZONTAL", text = { tag = "", + size = 12, + outline = false, + shadow = true, + h_alignment = "CENTER", + v_alignment = "MIDDLE", point1 = { p = "CENTER", anchor = "", @@ -1050,7 +1166,10 @@ D.profile = { }, }, name = { + size = 12, tag = "[ls:color:difficulty][ls:level:effective][ls:npc:type]|r [ls:name][ls:server]", + outline = false, + shadow = true, h_alignment = "CENTER", v_alignment = "MIDDLE", word_wrap = false, @@ -1103,6 +1222,7 @@ D.profile = { }, health = { enabled = true, + change_threshold = 0.001, orientation = "HORIZONTAL", color = { class = false, @@ -1159,10 +1279,15 @@ D.profile = { }, power = { enabled = true, + change_threshold = 0.01, orientation = "HORIZONTAL", text = { tag = "[ls:power:cur-color-max]", + size = 12, + outline = false, + shadow = true, h_alignment = "LEFT", + v_alignment = "MIDDLE", point1 = { p = "LEFT", anchor = "Power", @@ -1179,12 +1304,12 @@ D.profile = { width_override = 0, height = 12, icon = { - enabled = true, - position = "LEFT", -- or "RIGHT" + position = "LEFT", -- "RIGHT", "NONE" }, text = { size = 12, - flag = "_Shadow", -- "_Outline", "" + outline = false, + shadow = true, }, point1 = { p = "TOPRIGHT", @@ -1196,7 +1321,10 @@ D.profile = { }, }, name = { + size = 12, tag = "[ls:color:difficulty][ls:level:effective][ls:npc:type]|r [ls:name][ls:server]", + outline = false, + shadow = true, h_alignment = "RIGHT", v_alignment = "MIDDLE", word_wrap = false, @@ -1258,7 +1386,7 @@ D.profile = { x_growth = "RIGHT", y_growth = "UP", disable_mouse = false, - text = { + count = { size = 10, outline = true, shadow = false, @@ -1335,7 +1463,7 @@ D.profile = { height = 28, point = { ls = {"BOTTOMRIGHT", "LSFocusFrame", "BOTTOMLEFT", -12, 0}, - traditional = {"BOTTOMRIGHT", "LSFocusFrame", "BOTTOMLEFT", -12, 0}, + traditional = {"BOTTOMLEFT", "LSFocusFrame", "BOTTOMRIGHT", 12, 0}, }, insets = { t_height = 12, @@ -1343,6 +1471,7 @@ D.profile = { }, health = { enabled = true, + change_threshold = 0.001, orientation = "HORIZONTAL", color = { class = false, @@ -1399,9 +1528,15 @@ D.profile = { }, power = { enabled = false, + change_threshold = 0.01, orientation = "HORIZONTAL", text = { tag = "", + size = 12, + outline = false, + shadow = true, + h_alignment = "CENTER", + v_alignment = "MIDDLE", point1 = { p = "CENTER", anchor = "", @@ -1412,7 +1547,10 @@ D.profile = { }, }, name = { + size = 12, tag = "[ls:color:difficulty][ls:level:effective][ls:npc:type]|r [ls:name][ls:server]", + outline = false, + shadow = true, h_alignment = "CENTER", v_alignment = "MIDDLE", word_wrap = false, @@ -1469,6 +1607,7 @@ D.profile = { }, health = { enabled = true, + change_threshold = 0.001, orientation = "HORIZONTAL", color = { class = false, @@ -1525,10 +1664,15 @@ D.profile = { }, power = { enabled = true, + change_threshold = 0.01, orientation = "HORIZONTAL", text = { tag = "[ls:power:cur-color-perc]", + size = 12, + outline = false, + shadow = true, h_alignment = "RIGHT", + v_alignment = "MIDDLE", point1 = { p = "RIGHT", anchor = "Power", @@ -1540,10 +1684,15 @@ D.profile = { }, alt_power = { enabled = true, + change_threshold = 0.01, orientation = "HORIZONTAL", text = { tag = "[ls:altpower:cur-color-perc]", + size = 12, + outline = false, + shadow = true, h_alignment = "RIGHT", + v_alignment = "MIDDLE", point1 = { p = "RIGHT", anchor = "AlternativePower", @@ -1560,12 +1709,12 @@ D.profile = { width_override = 0, height = 12, icon = { - enabled = true, - position = "LEFT", -- or "RIGHT" + position = "LEFT", -- "RIGHT", "NONE" }, text = { size = 12, - flag = "_Shadow", -- "_Outline", "" + outline = false, + shadow = true, }, point1 = { p = "TOPLEFT", @@ -1577,7 +1726,10 @@ D.profile = { }, }, name = { + size = 12, tag = "[ls:name]", + outline = false, + shadow = true, h_alignment = "LEFT", v_alignment = "MIDDLE", word_wrap = false, @@ -1629,7 +1781,7 @@ D.profile = { x_growth = "LEFT", y_growth = "DOWN", disable_mouse = false, - text = { + count = { size = 10, outline = true, shadow = false, @@ -1726,10 +1878,10 @@ D.profile = { }, buttons = {}, colors = { - contested = {250 / 255, 193 / 255, 74 / 255}, - friendly = {85 / 255, 240 / 255, 83 / 255}, - hostile = {240 / 255, 72 / 255, 63 / 255}, - sanctuary = {105 / 255, 204 / 255, 240 / 255}, + contested = rgb(250, 193, 74), + friendly = rgb(85, 240, 83), + hostile = rgb(240, 72, 63), + sanctuary = rgb(105, 204, 240), }, color = { border = false, @@ -1748,18 +1900,18 @@ D.profile = { m_ss_threshold = 120, -- [91; 3599] colors = { enabled = true, - expiration = {229 / 255, 25 / 255, 25 / 255}, - second = {255 / 255, 191 / 255, 25 / 255}, - minute = {255 / 255, 255 / 255, 255 / 255}, - hour = {255 / 255, 255 / 255, 255 / 255}, - day = {255 / 255, 255 / 255, 255 / 255}, + expiration = rgb(229, 25, 25), + second = rgb(255, 191, 25), + minute = rgb(255, 255, 255), + hour = rgb(255, 255, 255), + day = rgb(255, 255, 255), }, }, colors = { - normal = {255 / 255, 255 / 255, 255 / 255}, - unusable = {102 / 255, 102 / 255, 102 / 255}, - mana = {38 / 255, 97 / 255, 172 / 255}, - range = {141 / 255, 28 / 255, 33 / 255}, + normal = rgb(255, 255, 255), + unusable = rgb(102, 102, 102), + mana = rgb(38, 97, 172), + range = rgb(140, 29, 30), }, desaturation = { cooldown = true, @@ -2355,11 +2507,11 @@ D.profile = { m_ss_threshold = 600, -- [91; 3599] colors = { enabled = true, - expiration = {229 / 255, 25 / 255, 25 / 255}, - second = {255 / 255, 191 / 255, 25 / 255}, - minute = {255 / 255, 255 / 255, 255 / 255}, - hour = {255 / 255, 255 / 255, 255 / 255}, - day = {255 / 255, 255 / 255, 255 / 255}, + expiration = rgb(229, 25, 25), + second = rgb(255, 191, 25), + minute = rgb(255, 255, 255), + hour = rgb(255, 255, 255), + day = rgb(255, 255, 255), }, }, HELPFUL = { @@ -2509,20 +2661,20 @@ D.profile = { width = 200, height = 12, icon = { - enabled = true, - position = "LEFT", + position = "LEFT", -- "RIGHT", "NONE" }, text = { size = 12, - flag = "_Shadow", -- "_Outline", "" + outline = false, + shadow = true, }, show_pet = -1, -- -1 - auto, 0 - false, 1 - true latency = true, colors = { - casting = {250 / 255, 193 / 255, 74 / 255}, - channeling = {60 / 255, 170 / 255, 59 / 255}, - failed = {222 / 255, 67 / 255, 58 / 255}, - notinterruptible = {125 / 255, 122 / 255, 125 / 255}, + casting = rgb(250, 193, 74), + channeling = rgb(46, 172, 52), + failed = rgb(220, 68, 54), + notinterruptible = rgb(136, 137, 135), }, }, digsite_bar = { -- ArcheologyDigsiteProgressBar @@ -2577,11 +2729,11 @@ D.char = { m_ss_threshold = 0, -- [91; 3599] colors = { enabled = true, - expiration = {229 / 255, 25 / 255, 25 / 255}, - second = {255 / 255, 191 / 255, 25 / 255}, - minute = {255 / 255, 255 / 255, 255 / 255}, - hour = {255 / 255, 255 / 255, 255 / 255}, - day = {255 / 255, 255 / 255, 255 / 255}, + expiration = rgb(229, 25, 25), + second = rgb(255, 191, 25), + minute = rgb(255, 255, 255), + hour = rgb(255, 255, 255), + day = rgb(255, 255, 255), }, text = { enabled = true, diff --git a/init.lua b/init.lua index bb3d9653..7323ce6d 100644 --- a/init.lua +++ b/init.lua @@ -11,122 +11,84 @@ local next = _G.next ]] -- Mine -local function cleanUpProfile() - -- -> 80000.03 - if not C.db.profile.version or C.db.profile.version < 8000003 then - C.db.profile.movers.ls.LSMicroMenu = nil - C.db.profile.movers.traditional.LSMicroMenu = nil - - C.db.profile.bars.micromenu.bags = nil - C.db.profile.bars.micromenu.height = nil - C.db.profile.bars.micromenu.menu1 = nil - C.db.profile.bars.micromenu.menu2 = nil - C.db.profile.bars.micromenu.num = nil - C.db.profile.bars.micromenu.per_row = nil - C.db.profile.bars.micromenu.point = nil - C.db.profile.bars.micromenu.spacing = nil - C.db.profile.bars.micromenu.tooltip = nil - C.db.profile.bars.micromenu.width = nil - C.db.profile.bars.micromenu.x_growth = nil - C.db.profile.bars.micromenu.y_growth = nil - - C.db.char.bars.bags = nil - C.db.profile.bars.bags = nil - end +local function cleanUpStep1() + -- -> 80000.12 + if not C.db.profile.version or C.db.profile.version < 8000012 then + if C.db.profile.units.player and C.db.profile.units.player.ls then + E:CopyTable(C.db.profile.units.player.ls, C.db.profile.units.ls.player) - -- -> 80000.04 - if not C.db.profile.version or C.db.profile.version < 8000004 then - C.db.profile.bars.micromenu.bars.micromenu1.fade = nil - C.db.profile.bars.micromenu.bars.micromenu1.visible = nil - C.db.profile.bars.micromenu.bars.micromenu2.fade = nil - C.db.profile.bars.micromenu.bars.micromenu2.visible = nil - C.db.profile.bars.micromenu.bars.bags.fade = nil - C.db.profile.bars.micromenu.bars.bags.visible = nil - - if C.db.profile.auras[E.UI_LAYOUT] then - if C.db.profile.auras[E.UI_LAYOUT].HELPFUL then - E:CopyTable(C.db.profile.auras[E.UI_LAYOUT].HELPFUL, C.db.profile.auras.HELPFUL) - end + C.db.profile.units.player.ls = nil + end - if C.db.profile.auras[E.UI_LAYOUT].HARMFUL then - E:CopyTable(C.db.profile.auras[E.UI_LAYOUT].HARMFUL, C.db.profile.auras.HARMFUL) - end + if C.db.profile.units.player and C.db.profile.units.player.traditional then + E:CopyTable(C.db.profile.units.player.traditional, C.db.profile.units.traditional.player) - if C.db.profile.auras[E.UI_LAYOUT].TOTEM then - E:CopyTable(C.db.profile.auras[E.UI_LAYOUT].TOTEM, C.db.profile.auras.TOTEM) - end + C.db.profile.units.player.traditional = nil end - C.db.profile.auras.ls = nil - C.db.profile.auras.traditional = nil - end + if C.db.profile.units.pet and C.db.profile.units.pet.ls then + E:CopyTable(C.db.profile.units.pet.ls, C.db.profile.units.ls.pet) - -- -> 80000.05 - if not C.db.profile.version or C.db.profile.version < 8000005 then - C.db.profile.bars.desaturate_on_cd = nil - C.db.profile.bars.desaturate_when_unusable = nil - end + C.db.profile.units.pet.ls = nil + end - -- -> 80000.07 - if not C.db.profile.version or C.db.profile.version < 8000007 then - if C.db.profile.units.ls then - if C.db.profile.units.ls.player then - C.db.profile.units.ls.player.point = nil - E:CopyTable(C.db.profile.units.ls.player, C.db.profile.units.player.ls) - end + if C.db.profile.units.pet and C.db.profile.units.pet.traditional then + E:CopyTable(C.db.profile.units.pet.traditional, C.db.profile.units.traditional.pet) - if C.db.profile.units.ls.pet then - C.db.profile.units.ls.pet.point = nil - E:CopyTable(C.db.profile.units.ls.pet, C.db.profile.units.pet.ls) - end + C.db.profile.units.pet.traditional = nil end - if C.db.profile.units.traditional then - if C.db.profile.units.traditional.player then - C.db.profile.units.traditional.player.point = nil - E:CopyTable(C.db.profile.units.traditional.player, C.db.profile.units.player.traditional) - end + local bars = {"bar1", "bar2", "bar3", "bar4", "bar5", "bar6", "bar7", "pet_battle", "extra", + "zone"} - if C.db.profile.units.traditional.pet then - C.db.profile.units.traditional.pet.point = nil - E:CopyTable(C.db.profile.units.traditional.pet, C.db.profile.units.pet.traditional) + for _, bar in next, bars do + if C.db.profile.bars[bar] then + if C.db.profile.bars[bar].cooldown then + C.db.profile.bars[bar].cooldown.text.h_alignment = nil + end end end - if C.db.profile.units[E.UI_LAYOUT] then - if C.db.profile.units[E.UI_LAYOUT].target then - C.db.profile.units[E.UI_LAYOUT].target.point = nil - E:CopyTable(C.db.profile.units[E.UI_LAYOUT].target, C.db.profile.units.target) - end + C.db.profile.auras.HELPFUL.cooldown.text.h_alignment = nil + C.db.profile.auras.HARMFUL.cooldown.text.h_alignment = nil + C.db.profile.auras.TOTEM.cooldown.text.h_alignment = nil - if C.db.profile.units[E.UI_LAYOUT].targettarget then - C.db.profile.units[E.UI_LAYOUT].targettarget.point = nil - E:CopyTable(C.db.profile.units[E.UI_LAYOUT].targettarget, C.db.profile.units.targettarget) - end + C.db.profile.blizzard.castbar.icon.enabled = nil + C.db.profile.blizzard.castbar.text.flag = nil + end +end - if C.db.profile.units[E.UI_LAYOUT].focus then - C.db.profile.units[E.UI_LAYOUT].focus.point = nil - E:CopyTable(C.db.profile.units[E.UI_LAYOUT].focus, C.db.profile.units.focus) - end +local function cleanUpStep2() + if not C.db.profile.version or C.db.profile.version < 8000012 then + local units = {"player", "pet", "target", "targettarget", "focustarget", "boss"} - if C.db.profile.units[E.UI_LAYOUT].focustarget then - C.db.profile.units[E.UI_LAYOUT].focustarget.point = nil - E:CopyTable(C.db.profile.units[E.UI_LAYOUT].focustarget, C.db.profile.units.focustarget) - end + for _, unit in next, units do + if C.db.profile.units[unit] then + if C.db.profile.units[unit].castbar then + C.db.profile.units[unit].castbar.icon.enabled = nil + C.db.profile.units[unit].castbar.text.flag = nil + end + + if C.db.profile.units[unit].debuff then + C.db.profile.units[unit].debuff.h_alignment = nil + end - if C.db.profile.units[E.UI_LAYOUT].boss then - C.db.profile.units[E.UI_LAYOUT].boss.point = nil - E:CopyTable(C.db.profile.units[E.UI_LAYOUT].boss, C.db.profile.units.boss) + if C.db.profile.units[unit].auras then + C.db.profile.units[unit].auras.cooldown.text.h_alignment = nil + end end end - - C.db.profile.units.ls = nil - C.db.profile.units.traditional = nil end end local function updateAll() - cleanUpProfile() + cleanUpStep1() + + C.db.profile.units.player = C.db.profile.units[E.UI_LAYOUT].player + C.db.profile.units.pet = C.db.profile.units[E.UI_LAYOUT].pet + + cleanUpStep2() + P:UpdateModules() P.Movers:UpdateConfig() end @@ -140,17 +102,29 @@ E:RegisterEvent("ADDON_LOADED", function(arg1) -- layout type change shouldn't affect anything after SVs are loaded E.UI_LAYOUT = C.db.char.layout - cleanUpProfile() + D.profile.units.player = D.profile.units[E.UI_LAYOUT].player + D.profile.units.pet = D.profile.units[E.UI_LAYOUT].pet + + cleanUpStep1() + + C.db.profile.units.player = C.db.profile.units[E.UI_LAYOUT].player + C.db.profile.units.pet = C.db.profile.units[E.UI_LAYOUT].pet + + cleanUpStep2() C.db:RegisterCallback("OnDatabaseShutdown", function() C.db.char.version = E.VER.number C.db.profile.version = E.VER.number + C.db.profile.units.player = nil + C.db.profile.units.pet = nil P.Movers:CleanUpConfig() end) C.db:RegisterCallback("OnProfileShutdown", function() C.db.profile.version = E.VER.number + C.db.profile.units.player = nil + C.db.profile.units.pet = nil P.Movers:CleanUpConfig() end) diff --git a/locales/enUS.lua b/locales/enUS.lua index 4fb36e74..83ee51b7 100644 --- a/locales/enUS.lua +++ b/locales/enUS.lua @@ -107,6 +107,7 @@ L["ARTIFACT_LEVEL_TOOLTIP"] = "Artefact Level: |cffffffff%s|r" L["ARTIFACT_POWER"] = "Artefact Power" L["ASCENDING"] = "Ascending" L["AURA_TRACKER"] = "Aura Tracker" +L["AURA_TYPE"] = "Aura Type" L["AURAS"] = "Auras" L["AUTO"] = "Auto" L["BAG_SLOTS"] = "Bag Slots" @@ -217,6 +218,8 @@ L["FRAME"] = "Frame" L["FREE_BAG_SLOTS_TOOLTIP"] = "Free Bag Slots: |cffffffff%s|r" L["FRIENDLY_TERRITORY"] = "Friendly Territory" L["FRIENDLY_UNITS"] = "Friendly Units" +L["GAIN_LOSS_THRESHOLD"] = "Gain/Loss Threshold" +L["GAIN_LOSS_THRESHOLD_DESC"] = "The threshold (in percentages) above which resource gain and loss will be animated. Set to 100 to disable." L["GM_FRAME"] = "Ticket Status Frame" L["GOLD"] = "Gold" L["GROWTH_DIR"] = "Growth Direction" diff --git a/locales/ruRU.lua b/locales/ruRU.lua index 482c6e4b..1f2a161e 100644 --- a/locales/ruRU.lua +++ b/locales/ruRU.lua @@ -40,6 +40,7 @@ L["ARTIFACT_LEVEL_TOOLTIP"] = "Уровень артефакта: |cffffffff%s|r L["ARTIFACT_POWER"] = "Сила артефакта" L["ASCENDING"] = "По возрастанию" L["AURA_TRACKER"] = "Отслеживание аур" +L["AURA_TYPE"] = "Тип ауры" L["AURAS"] = "Ауры" L["AUTO"] = "Авто" L["BAG_SLOTS"] = "Ячейки сумок" @@ -150,6 +151,8 @@ L["FRAME"] = "Рамка" L["FREE_BAG_SLOTS_TOOLTIP"] = "Свободные ячейки: |cffffffff%s|r" L["FRIENDLY_TERRITORY"] = "Дружелюбная территория" L["FRIENDLY_UNITS"] = "Дружественные юниты" +L["GAIN_LOSS_THRESHOLD"] = "Порог изменения" +L["GAIN_LOSS_THRESHOLD_DESC"] = "Если изменение ресурса выше данного значения (в процентах), то оно будет анимировано. Установите на 100, чтобы отключить." L["GM_FRAME"] = "Панель статуса запроса к ГМ" L["GOLD"] = "Золото" L["GROWTH_DIR"] = "Направление роста" diff --git a/modules/blizzard/castbar.lua b/modules/blizzard/castbar.lua index 029e72c7..cc8d42ca 100644 --- a/modules/blizzard/castbar.lua +++ b/modules/blizzard/castbar.lua @@ -161,6 +161,8 @@ local function handleCastBar(self) self.TexParent = texParent local time = texParent:CreateFontString(nil, "ARTWORK") + time:SetPoint("TOP", self, "TOP", 0, 0) + time:SetPoint("BOTTOM", self, "BOTTOM", 0, 0) time:SetPoint("RIGHT", self, "RIGHT", 0, 0) self.Time = time @@ -168,10 +170,23 @@ local function handleCastBar(self) text:SetParent(texParent) text:SetSize(0, 0) text:ClearAllPoints() + text:SetPoint("TOP", self, "TOP", 0, 0) + text:SetPoint("BOTTOM", self, "BOTTOM", 0, 0) text:SetPoint("LEFT", self, "LEFT", 2, 0) text:SetPoint("RIGHT", time, "LEFT", -2, 0) end +local function updateFontObject(fontString, config) + fontString:SetFontObject("LSFont" .. config.size .. (config.outline and "_Outline" or "")) + fontString:SetWordWrap(false) + + if config.shadow then + fontString:SetShadowOffset(1, -1) + else + fontString:SetShadowOffset(0, 0) + end +end + local function updateCastBar(self) local config = C.db.profile.blizzard.castbar local holder = self.Holder @@ -188,40 +203,38 @@ local function updateCastBar(self) end end - if config.icon.enabled then - if config.icon.position == "LEFT" then - self.Icon = self.LeftIcon - self.Icon:Show() + if config.icon.position == "LEFT" then + self.Icon = self.LeftIcon + self.Icon:Show() - self.Icon_:Hide() - self.LeftIcon:SetSize(height * 1.5, height) - self.RightIcon:SetSize(0.0001, height) + self.Icon_:Hide() + self.LeftIcon:SetSize(height * 1.5, height) + self.RightIcon:SetSize(0.0001, height) - self.LeftSep:SetSize(12, height) - self.LeftSep:SetTexCoord(1 / 32, 25 / 32, 0 / 8, height / 4) - self.RightSep:SetSize(0.0001, height) + self.LeftSep:SetSize(12, height) + self.LeftSep:SetTexCoord(1 / 32, 25 / 32, 0 / 8, height / 4) + self.RightSep:SetSize(0.0001, height) - self:SetSize(0, 0) - self:ClearAllPoints() - self:SetPoint("TOPLEFT", holder, "TOPLEFT", 5 + height * 1.5, 0) - self:SetPoint("BOTTOMRIGHT", holder, "BOTTOMRIGHT", -3, 0) - elseif config.icon.position == "RIGHT" then - self.Icon = self.RightIcon - self.Icon:Show() + self:SetSize(0, 0) + self:ClearAllPoints() + self:SetPoint("TOPLEFT", holder, "TOPLEFT", 5 + height * 1.5, 0) + self:SetPoint("BOTTOMRIGHT", holder, "BOTTOMRIGHT", -3, 0) + elseif config.icon.position == "RIGHT" then + self.Icon = self.RightIcon + self.Icon:Show() - self.Icon_:Hide() - self.LeftIcon:SetSize(0.0001, height) - self.RightIcon:SetSize(height * 1.5, height) + self.Icon_:Hide() + self.LeftIcon:SetSize(0.0001, height) + self.RightIcon:SetSize(height * 1.5, height) - self.LeftSep:SetSize(0.0001, height) - self.RightSep:SetSize(12, height) - self.RightSep:SetTexCoord(1 / 32, 25 / 32, 0 / 8, height / 4) + self.LeftSep:SetSize(0.0001, height) + self.RightSep:SetSize(12, height) + self.RightSep:SetTexCoord(1 / 32, 25 / 32, 0 / 8, height / 4) - self:SetSize(0, 0) - self:ClearAllPoints() - self:SetPoint("TOPLEFT", holder, "TOPLEFT", 3, 0) - self:SetPoint("BOTTOMRIGHT", holder, "BOTTOMRIGHT", -5 - height * 1.5, 0) - end + self:SetSize(0, 0) + self:ClearAllPoints() + self:SetPoint("TOPLEFT", holder, "TOPLEFT", 3, 0) + self:SetPoint("BOTTOMRIGHT", holder, "BOTTOMRIGHT", -5 - height * 1.5, 0) else self.Icon = self.Icon_ self.Icon:Hide() @@ -255,25 +268,11 @@ local function updateCastBar(self) CastingBarFrame_SetFailedCastColor(self, unpack(config.colors.failed)) CastingBarFrame_SetUseStartColorForFinished(self, true) - self.Text:SetFontObject("LSFont" .. config.text.size .. config.text.flag) + updateFontObject(self.Text, config.text) self.Text:SetJustifyH("LEFT") - self.Text:SetWordWrap(false) - if config.text.flag == "_Shadow" then - self.Text:SetShadowOffset(1, -1) - else - self.Text:SetShadowOffset(0, 0) - end - - self.Time:SetFontObject("LSFont" .. config.text.size .. config.text.flag) + updateFontObject(self.Time, config.text) self.Time:SetJustifyH("RIGHT") - self.Time:SetWordWrap(false) - - if config.text.flag == "_Shadow" then - self.Time:SetShadowOffset(1, -1) - else - self.Time:SetShadowOffset(0, 0) - end end local function bar_SetLook(self) @@ -287,6 +286,8 @@ local function bar_SetLook(self) local text = self.Text text:SetSize(0, 0) text:ClearAllPoints() + text:SetPoint("TOP", self, "TOP", 0, 0) + text:SetPoint("BOTTOM", self, "BOTTOM", 0, 0) text:SetPoint("LEFT", self, "LEFT", 2, 0) text:SetPoint("RIGHT", self.Time, "LEFT", -2, 0) end diff --git a/modules/unitframes/core.lua b/modules/unitframes/core.lua index 88cd8585..d8c91a8e 100644 --- a/modules/unitframes/core.lua +++ b/modules/unitframes/core.lua @@ -36,9 +36,25 @@ local function frame_OnLeave(self) PartyMemberBuffTooltip:Hide() end +local configIgnoredKeys = { + alt_power = true, + auras = true, + castbar = true, + class = true, + class_power = true, + combat_feedback = true, + debuff = true, + health = true, + insets = true, + name = true, + power = true, + pvp = true, + raid_target = true, + threat = true, +} + local function frame_UpdateConfig(self) - self._config = E:CopyTable(C.db.profile.units[self._unit], self._config) - -- self._config.cooldown = E:CopyTable(C.db.profile.units.cooldown, self._config.cooldown) + self._config = E:CopyTable(C.db.profile.units[self._unit], self._config, configIgnoredKeys) end local function frame_UpdateSize(self) diff --git a/modules/unitframes/elements/auras.lua b/modules/unitframes/elements/auras.lua index ef189599..8c3554ed 100644 --- a/modules/unitframes/elements/auras.lua +++ b/modules/unitframes/elements/auras.lua @@ -114,14 +114,14 @@ local function isUnitBoss(unit) end local filterFunctions = { - default = function(element, unit, aura, _, _, _, debuffType, duration, _, caster, isStealable, _, spellID, _, isBossAura) + default = function(self, unit, aura, _, _, _, debuffType, duration, _, caster, isStealable, _, spellID, _, isBossAura) -- blacklist if BLACKLIST[spellID] then return false end local isFriend = UnitIsFriend("player", unit) - local config = element._config and element._config.filter or nil + local config = self._config and self._config.filter or nil if config then config = isFriend and config.friendly or config.enemy @@ -187,9 +187,9 @@ local filterFunctions = { return false end, - boss = function(element, unit, aura, _, _, _, debuffType, duration, _, caster, isStealable, _, _, _, isBossAura) + boss = function(self, unit, aura, _, _, _, debuffType, duration, _, caster, isStealable, _, _, _, isBossAura) local isFriend = UnitIsFriend("player", unit) - local config = element._config and element._config.filter or nil + local config = self._config and self._config.filter or nil if config then config = isFriend and config.friendly or config.enemy @@ -259,21 +259,26 @@ local function button_OnLeave() GameTooltip:Hide() end -local function element_CreateAuraIcon(element, index) - local config = element._config - local button = E:CreateButton(element, "$parentAura" .. index, true) +local function element_CreateAuraIcon(self, index) + local config = self._config + if not config then + self:UpdateConfig() + config = self._config + end + + local button = E:CreateButton(self, "$parentAura" .. index, true) button.icon = button.Icon button.Icon = nil local count = button.Count count:SetAllPoints() - count:SetFontObject("LSFont" .. config.text.size .. (config.text.outline and "_Outline" or "")) - count:SetJustifyH(config.text.h_alignment) - count:SetJustifyV(config.text.v_alignment) + count:SetFontObject("LSFont" .. config.count.size .. (config.count.outline and "_Outline" or "")) + count:SetJustifyH(config.count.h_alignment) + count:SetJustifyV(config.count.v_alignment) count:SetWordWrap(false) - if config.text.shadow then + if config.count.shadow then count:SetShadowOffset(1, -1) else count:SetShadowOffset(0, 0) @@ -286,7 +291,7 @@ local function element_CreateAuraIcon(element, index) button.CD = nil if button.cd.UpdateConfig then - button.cd:UpdateConfig(element.cooldownConfig or {}) + button.cd:UpdateConfig(self.cooldownConfig or {}) button.cd:UpdateFontObject() end @@ -330,40 +335,45 @@ local function element_PostUpdateIcon(self, _, aura, _, _, _, _, debuffType) end end -local function element_UpdateConfig(element) - element._config = E:CopyTable(element.__owner._config.auras, element._config) +local function element_UpdateConfig(self) + local unit = self.__owner._unit + self._config = E:CopyTable(C.db.profile.units[unit].auras, self._config) + + local size = self._config.size_override ~= 0 and self._config.size_override + or E:Round((C.db.profile.units[unit].width - (self.spacing * (self._config.per_row - 1)) + 2) / self._config.per_row) + self._config.size = m_min(m_max(size, 24), 64) end -local function element_UpdateCooldownConfig(element) - if not element.cooldownConfig then - element.cooldownConfig = { +local function element_UpdateCooldownConfig(self) + if not self.cooldownConfig then + self.cooldownConfig = { colors = {}, text = {}, } end - element.cooldownConfig.exp_threshold = C.db.profile.units.cooldown.exp_threshold - element.cooldownConfig.m_ss_threshold = C.db.profile.units.cooldown.m_ss_threshold - element.cooldownConfig.colors = E:CopyTable(C.db.profile.units.cooldown.colors, element.cooldownConfig.colors) - element.cooldownConfig.text = E:CopyTable(element._config.cooldown.text, element.cooldownConfig.text) + self.cooldownConfig.exp_threshold = C.db.profile.units.cooldown.exp_threshold + self.cooldownConfig.m_ss_threshold = C.db.profile.units.cooldown.m_ss_threshold + self.cooldownConfig.colors = E:CopyTable(C.db.profile.units.cooldown.colors, self.cooldownConfig.colors) + self.cooldownConfig.text = E:CopyTable(self._config.cooldown.text, self.cooldownConfig.text) - for i = 1, #element do - if not element[i].cd.UpdateConfig then + for i = 1, self.createdIcons do + if not self[i].cd.UpdateConfig then break end - element[i].cd:UpdateConfig(element.cooldownConfig) - element[i].cd:UpdateFontObject() + self[i].cd:UpdateConfig(self.cooldownConfig) + self[i].cd:UpdateFontObject() end end -local function element_UpdateFonts(element) - local config = element._config.text +local function element_UpdateFontObjects(self) + local config = self._config.count local fontObj = "LSFont" .. config.size .. (config.outline and "_Outline" or "") local count - for i = 1, element.createdIcons do - count = element[i].count + for i = 1, self.createdIcons do + count = self[i].count count:SetFontObject(fontObj) count:SetJustifyH(config.h_alignment) count:SetJustifyV(config.v_alignment) @@ -377,62 +387,76 @@ local function element_UpdateFonts(element) end end -local function element_UpdateAuraTypeIcon(element) - local config = element._config.type +local function element_UpdateAuraTypeIcon(self) + local config = self._config.type local auraType - for i = 1, element.createdIcons do - auraType = element[i].AuraType + for i = 1, self.createdIcons do + auraType = self[i].AuraType auraType:ClearAllPoints() auraType:SetPoint(config.position, 0, 0) auraType:SetSize(config.size, config.size) end end -local function frame_UpdateAuras(self) - local element = self.Auras - element:UpdateConfig() - element:UpdateCooldownConfig() +local function element_UpdateSize(self) + local config = self._config + + self.size = config.size + self.numTotal = config.per_row * config.rows + + self:SetSize(config.size * config.per_row + self.spacing * (config.per_row - 1), config.size * config.rows + self.spacing * (config.rows - 1)) +end + +local function element_UpdatePoints(self) + local config = self._config.point1 + + self:ClearAllPoints() + + if config.p and config.p ~= "" then + self:SetPoint(config.p, E:ResolveAnchorPoint(self.__owner, config.anchor), config.rP, config.x, config.y) + end +end - local config = element._config - local size = config.size_override ~= 0 and config.size_override - or E:Round((self._config.width - (element.spacing * (config.per_row - 1)) + 2) / config.per_row) - size = m_min(m_max(size, 24), 64) +local function element_UpdateGrowthDirection(self) + local config = self._config - element.size = size - element.numTotal = config.per_row * config.rows - element.disableMouse = config.disable_mouse - element["growth-x"] = config.x_growth - element["growth-y"] = config.y_growth + self["growth-x"] = config.x_growth + self["growth-y"] = config.y_growth if config.y_growth == "UP" then if config.x_growth == "RIGHT" then - element.initialAnchor = "BOTTOMLEFT" + self.initialAnchor = "BOTTOMLEFT" else - element.initialAnchor = "BOTTOMRIGHT" + self.initialAnchor = "BOTTOMRIGHT" end else if config.x_growth == "RIGHT" then - element.initialAnchor = "TOPLEFT" + self.initialAnchor = "TOPLEFT" else - element.initialAnchor = "TOPRIGHT" + self.initialAnchor = "TOPRIGHT" end end +end - element:SetSize((size * config.per_row + element.spacing * (config.per_row - 1)), size * config.rows + element.spacing * (config.rows - 1)) - element:ClearAllPoints() - - local point1 = config.point1 - if point1 and point1.p then - element:SetPoint(point1.p, E:ResolveAnchorPoint(self, point1.anchor), point1.rP, point1.x, point1.y) - end +local function element_UpdateMouse(self) + self.disableMouse = self._config.disable_mouse +end +local function frame_UpdateAuras(self) + local element = self.Auras + element:UpdateConfig() + element:UpdateCooldownConfig() + element:UpdateSize() + element:UpdatePoints() + element:UpdateGrowthDirection() element:UpdateAuraTypeIcon() - element:UpdateFonts() + element:UpdateFontObjects() + element:UpdateMouse() - if config.enabled and not self:IsElementEnabled("Auras") then + if element._config.enabled and not self:IsElementEnabled("Auras") then self:EnableElement("Auras") - elseif not config.enabled and self:IsElementEnabled("Auras") then + elseif not element._config.enabled and self:IsElementEnabled("Auras") then self:DisableElement("Auras") end @@ -445,16 +469,21 @@ function UF:CreateAuras(frame, unit) local element = CreateFrame("Frame", nil, frame) element:SetSize(48, 48) - element.showDebuffType = true - element.showStealableBuffs = true - element.spacing = 4 element.CreateIcon = element_CreateAuraIcon element.CustomFilter = filterFunctions[unit] or filterFunctions.default element.PostUpdateIcon = element_PostUpdateIcon + element.showDebuffType = true + element.showStealableBuffs = true + element.spacing = 4 + element.UpdateAuraTypeIcon = element_UpdateAuraTypeIcon element.UpdateConfig = element_UpdateConfig element.UpdateCooldownConfig = element_UpdateCooldownConfig - element.UpdateFonts = element_UpdateFonts + element.UpdateFontObjects = element_UpdateFontObjects + element.UpdateGrowthDirection = element_UpdateGrowthDirection + element.UpdateMouse = element_UpdateMouse + element.UpdatePoints = element_UpdatePoints + element.UpdateSize = element_UpdateSize frame.UpdateAuras = frame_UpdateAuras diff --git a/modules/unitframes/elements/castbar.lua b/modules/unitframes/elements/castbar.lua index 012ea57f..819aac0c 100644 --- a/modules/unitframes/elements/castbar.lua +++ b/modules/unitframes/elements/castbar.lua @@ -12,6 +12,17 @@ local unpack = _G.unpack ]] -- Mine +local function updateFontObject(_, fontString, config) + fontString:SetFontObject("LSFont" .. config.size .. (config.outline and "_Outline" or "")) + fontString:SetWordWrap(false) + + if config.shadow then + fontString:SetShadowOffset(1, -1) + else + fontString:SetShadowOffset(0, 0) + end +end + local function element_PostCastStart(self) if self.notInterruptible then self:SetStatusBarColor(unpack(self._config.colors.notinterruptible)) @@ -65,28 +76,88 @@ local function element_CustomDelayText(self, duration) end local function element_UpdateConfig(self) - self._config = E:CopyTable(self.__owner._config.castbar, self._config) + local unit = self.__owner._unit + self._config = E:CopyTable(C.db.profile.units[unit].castbar, self._config) self._config.colors = E:CopyTable(C.db.profile.units.castbar.colors, self._config.colors) + self._config.width = (self._config.detached and self._config.width_override ~= 0) + and self._config.width_override or C.db.profile.units[unit].width end -local function frame_UpdateCastbar(self) - local element = self.Castbar - element:UpdateConfig() +local function element_UpdateFontObjects(self) + updateFontObject(self.__owner, self.Text, self._config.text) + self.Text:SetJustifyH("LEFT") - local config = element._config - local holder = element.Holder - local width = (config.detached and config.width_override ~= 0) and config.width_override or self._config.width + updateFontObject(self.__owner, self.Time, self._config.text) + self.Time:SetJustifyH("RIGHT") +end + +local function element_UpdateIcon(self) + local config = self._config local height = config.height + if config.icon.position == "LEFT" then + self.Icon = self.LeftIcon + + self.LeftIcon:SetSize(height * 1.5, height) + self.RightIcon:SetSize(0.0001, height) + + self.LeftSep:SetSize(12, height) + self.LeftSep:SetTexCoord(1 / 32, 25 / 32, 0 / 8, height / 4) + self.RightSep:SetSize(0.0001, height) + + self:SetPoint("TOPLEFT", 5 + height * 1.5, 0) + self:SetPoint("BOTTOMRIGHT", -3, 0) + elseif config.icon.position == "RIGHT" then + self.Icon = self.RightIcon + + self.LeftIcon:SetSize(0.0001, height) + self.RightIcon:SetSize(height * 1.5, height) + + self.LeftSep:SetSize(0.0001, height) + self.RightSep:SetSize(12, height) + self.RightSep:SetTexCoord(1 / 32, 25 / 32, 0 / 8, height / 4) + + self:SetPoint("TOPLEFT", 3, 0) + self:SetPoint("BOTTOMRIGHT", -5 - height * 1.5, 0) + else + self.Icon = nil + + self.LeftIcon:SetSize(0.0001, height) + self.RightIcon:SetSize(0.0001, height) + + self.LeftSep:SetSize(0.0001, height) + self.RightSep:SetSize(0.0001, height) + + self:SetPoint("TOPLEFT", 3, 0) + self:SetPoint("BOTTOMRIGHT", -3, 0) + end +end + +local function element_UpdateLatency(self) + if self._config.latency then + self.SafeZone = self.SafeZone_ + self.SafeZone_:Show() + else + self.SafeZone = nil + self.SafeZone_:Hide() + end +end + +local function element_UpdateSize(self) + local holder = self.Holder + local frame = self.__owner + local width = self._config.width + local height = self._config.height + holder:SetSize(width, height) holder._width = width - local point1 = config.point1 + local point1 = self._config.point1 if point1 and point1.p then - if config.detached then + if self._config.detached then local mover = E.Movers:Get(holder, true) if not mover then - holder:SetPoint(point1.p, E:ResolveAnchorPoint(nil, point1.detached_anchor == "FRAME" and self:GetName() or point1.detached_anchor), point1.rP, point1.x, point1.y) + holder:SetPoint(point1.p, E:ResolveAnchorPoint(nil, point1.detached_anchor == "FRAME" and frame:GetName() or point1.detached_anchor), point1.rP, point1.x, point1.y) E.Movers:Create(holder) else mover:Enable() @@ -94,7 +165,7 @@ local function frame_UpdateCastbar(self) end else holder:ClearAllPoints() - holder:SetPoint(point1.p, E:ResolveAnchorPoint(self, point1.anchor), point1.rP, point1.x, point1.y, true) + holder:SetPoint(point1.p, E:ResolveAnchorPoint(frame, point1.anchor), point1.rP, point1.x, point1.y, true) local mover = E.Movers:Get(holder) if mover then @@ -103,78 +174,20 @@ local function frame_UpdateCastbar(self) end end - if config.icon.enabled then - if config.icon.position == "LEFT" then - element.Icon = element.LeftIcon - - element.LeftIcon:SetSize(height * 1.5, height) - element.RightIcon:SetSize(0.0001, height) - - element.LeftSep:SetSize(12, height) - element.LeftSep:SetTexCoord(1 / 32, 25 / 32, 0 / 8, height / 4) - element.RightSep:SetSize(0.0001, height) - - element:SetPoint("TOPLEFT", 5 + height * 1.5, 0) - element:SetPoint("BOTTOMRIGHT", -3, 0) - elseif config.icon.position == "RIGHT" then - element.Icon = element.RightIcon - - element.LeftIcon:SetSize(0.0001, height) - element.RightIcon:SetSize(height * 1.5, height) - - element.LeftSep:SetSize(0.0001, height) - element.RightSep:SetSize(12, height) - element.RightSep:SetTexCoord(1 / 32, 25 / 32, 0 / 8, height / 4) - - element:SetPoint("TOPLEFT", 3, 0) - element:SetPoint("BOTTOMRIGHT", -5 - height * 1.5, 0) - end - else - element.Icon = nil - - element.LeftIcon:SetSize(0.0001, height) - element.RightIcon:SetSize(0.0001, height) - - element.LeftSep:SetSize(0.0001, height) - element.RightSep:SetSize(0.0001, height) - - element:SetPoint("TOPLEFT", 3, 0) - element:SetPoint("BOTTOMRIGHT", -3, 0) - end - - if config.latency then - element.SafeZone = element.SafeZone_ - element.SafeZone_:Show() - else - element.SafeZone = nil - element.SafeZone_:Hide() - end - - E:SetStatusBarSkin(element.TexParent, "HORIZONTAL-" .. height) - - element.Text:SetFontObject("LSFont" .. config.text.size .. config.text.flag) - element.Text:SetJustifyH("LEFT") - element.Text:SetWordWrap(false) - - if config.text.flag == "_Shadow" then - element.Text:SetShadowOffset(1, -1) - else - element.Text:SetShadowOffset(0, 0) - end - - element.Time:SetFontObject("LSFont" .. config.text.size .. config.text.flag) - element.Time:SetJustifyH("RIGHT") - element.Time:SetWordWrap(false) + E:SetStatusBarSkin(self.TexParent, "HORIZONTAL-" .. height) +end - if config.text.flag == "_Shadow" then - element.Time:SetShadowOffset(1, -1) - else - element.Time:SetShadowOffset(0, 0) - end +local function frame_UpdateCastbar(self) + local element = self.Castbar + element:UpdateConfig() + element:UpdateSize() + element:UpdateIcon() + element:UpdateLatency() + element:UpdateFontObjects() - if config.enabled and not self:IsElementEnabled("Castbar") then + if element._config.enabled and not self:IsElementEnabled("Castbar") then self:EnableElement("Castbar") - elseif not config.enabled and self:IsElementEnabled("Castbar") then + elseif not element._config.enabled and self:IsElementEnabled("Castbar") then self:DisableElement("Castbar") end @@ -225,14 +238,18 @@ function UF:CreateCastbar(frame) texParent:SetPoint("BOTTOMRIGHT", holder, "BOTTOMRIGHT", -3, 0) element.TexParent = texParent - local time = texParent:CreateFontString(nil, "ARTWORK", "LSFont12_Shadow") + local time = texParent:CreateFontString(nil, "ARTWORK", "LSFont12") time:SetWordWrap(false) + time:SetPoint("TOP", element, "TOP", 0, 0) + time:SetPoint("BOTTOM", element, "BOTTOM", 0, 0) time:SetPoint("RIGHT", element, "RIGHT", 0, 0) element.Time = time - local text = texParent:CreateFontString(nil, "ARTWORK", "LSFont12_Shadow") + local text = texParent:CreateFontString(nil, "ARTWORK", "LSFont12") text:SetWordWrap(false) text:SetJustifyH("LEFT") + text:SetPoint("TOP", element, "TOP", 0, 0) + text:SetPoint("BOTTOM", element, "BOTTOM", 0, 0) text:SetPoint("LEFT", element, "LEFT", 2, 0) text:SetPoint("RIGHT", time, "LEFT", -2, 0) element.Text = text @@ -244,8 +261,12 @@ function UF:CreateCastbar(frame) element.PostCastInterrupted = element_PostCastFailed element.PostCastStart = element_PostCastStart element.PostChannelStart = element_PostCastStart - element.UpdateConfig = element_UpdateConfig element.timeToHold = 0.4 + element.UpdateConfig = element_UpdateConfig + element.UpdateFontObjects = element_UpdateFontObjects + element.UpdateIcon = element_UpdateIcon + element.UpdateLatency = element_UpdateLatency + element.UpdateSize = element_UpdateSize frame.UpdateCastbar = frame_UpdateCastbar diff --git a/modules/unitframes/elements/classindicator.lua b/modules/unitframes/elements/classindicator.lua index 65ec3944..4bc93a54 100644 --- a/modules/unitframes/elements/classindicator.lua +++ b/modules/unitframes/elements/classindicator.lua @@ -11,38 +11,37 @@ local hooksecurefunc = _G.hooksecurefunc ]] -- Mine -local function checkUnitClass(frame) +local function update(self) + local element = self.ClassIndicator local class, _ - if UnitIsPlayer(frame.unit) then - if frame._config and frame._config.class.player then - _, class = UnitClass(frame.unit) + if UnitIsPlayer(self.unit) then + if element._config and element._config.player then + _, class = UnitClass(self.unit) + if class and self._skin ~= class then + self.Border:SetVertexColor(M.COLORS.CLASS[class]:GetRGB()) - if class and frame._skin ~= class then - frame.Border:SetVertexColor(M.COLORS.CLASS[class]:GetRGB()) - - if frame.Insets then - frame.Insets:SetVertexColor(M.COLORS.CLASS[class]:GetRGB()) + if self.Insets then + self.Insets:SetVertexColor(M.COLORS.CLASS[class]:GetRGB()) end - frame._skin = class + self._skin = class return end end else - if frame._config and frame._config.class.npc then - class = UnitClassification(frame.unit) - + if element._config and element._config.npc then + class = UnitClassification(self.unit) if class and (class == "worldboss" or class == "elite" or class == "rareelite") then - if frame._skin ~= "elite" then - frame.Border:SetVertexColor(M.COLORS.YELLOW:GetRGB()) + if self._skin ~= "elite" then + self.Border:SetVertexColor(M.COLORS.YELLOW:GetRGB()) - if frame.Insets then - frame.Insets:SetVertexColor(M.COLORS.YELLOW:GetRGB()) + if self.Insets then + self.Insets:SetVertexColor(M.COLORS.YELLOW:GetRGB()) end - frame._skin = "elite" + self._skin = "elite" return end @@ -52,25 +51,31 @@ local function checkUnitClass(frame) end end - if not class and frame._skin ~= "none" then - frame.Border:SetVertexColor(1, 1, 1) + if not class and self._skin ~= "none" then + self.Border:SetVertexColor(1, 1, 1) - if frame.Insets then - frame.Insets:SetVertexColor(1, 1, 1) + if self.Insets then + self.Insets:SetVertexColor(1, 1, 1) end - frame._skin = "none" + self._skin = "none" end end +local function element_UpdateConfig(self) + local unit = self.__owner._unit + self._config = E:CopyTable(C.db.profile.units[unit].class, self._config) +end + local function frame_UpdateClassIndicator(self) - checkUnitClass(self) + self.ClassIndicator:UpdateConfig() + update(self) end function UF:CreateClassIndicator(frame) frame._skin = "none" - hooksecurefunc(frame, "Show", checkUnitClass) + hooksecurefunc(frame, "Show", update) if frame.Border then E:SmoothColor(frame.Border) @@ -80,6 +85,10 @@ function UF:CreateClassIndicator(frame) E:SmoothColor(frame.Insets) end - frame.ClassIndicator = true frame.UpdateClassIndicator = frame_UpdateClassIndicator + + return { + __owner = frame, + UpdateConfig = element_UpdateConfig, + } end diff --git a/modules/unitframes/elements/classpower.lua b/modules/unitframes/elements/classpower.lua index d7a8baaa..4dd65063 100644 --- a/modules/unitframes/elements/classpower.lua +++ b/modules/unitframes/elements/classpower.lua @@ -78,14 +78,28 @@ end -- .Runes do - local function element_PostUpdate(self) - if not self.isEnabled then - self:Hide() + local ignoredKeys = { + prediction = true, + } - self._active = false - else - local hasVehicle = UnitHasVehicleUI("player") + local function element_UpdateConfig(self) + local unit = self.__owner._unit + self._config = E:CopyTable(C.db.profile.units[unit].class_power, self._config, ignoredKeys) + end + + local function element_UpdateColors(self) + self.colorSpec = self._config.runes.color_by_spec + self:ForceUpdate() + end + local function element_UpdateSortOrder(self) + self.sortOrder = self._config.runes.sort_order + self:ForceUpdate() + end + + local function element_PostUpdate(self) + if self.isEnabled then + local hasVehicle = UnitHasVehicleUI("player") if hasVehicle and self._active then self:Hide() @@ -99,26 +113,26 @@ do end local function frame_UpdateRunes(self) - local config = self._config.class_power local element = self.Runes - local width, height = element:GetSize() + element:UpdateConfig() + element:UpdateColors() + element:UpdateSortOrder() + + local orientation = element._config.orientation local layout - if config.orientation == "HORIZONTAL" then - layout = E:CalcSegmentsSizes(width, 2, 6) + if orientation == "HORIZONTAL" then + layout = E:CalcSegmentsSizes(element:GetWidth(), 2, 6) else - layout = E:CalcSegmentsSizes(height, 2, 6) + layout = E:CalcSegmentsSizes(element:GetHeight(), 2, 6) end - element.colorSpec = config.runes.color_by_spec - element.sortOrder = config.runes.sort_order - for i = 1, 6 do local bar = element[i] - bar:SetOrientation(config.orientation) + bar:SetOrientation(orientation) bar:ClearAllPoints() - if config.orientation == "HORIZONTAL" then + if orientation == "HORIZONTAL" then bar:SetWidth(layout[i]) bar:SetPoint("TOP", 0, 0) bar:SetPoint("BOTTOM", 0, 0) @@ -141,26 +155,32 @@ do end end - if config.enabled and not self:IsElementEnabled("Runes") then + if element._config.enabled and not self:IsElementEnabled("Runes") then self:EnableElement("Runes") + elseif not element._config.enabled and self:IsElementEnabled("Runes") then + self:DisableElement("Runes") + end + if self:IsElementEnabled("Runes") then element.isEnabled = true - elseif not config.enabled and self:IsElementEnabled("Runes") then - self:DisableElement("Runes") + element:ForceUpdate() + else element.isEnabled = false - end + element._active = nil - element:ForceUpdate() + element:Hide() + end end function UF:CreateRunes(frame) local element = createElement(frame, 6, "Rune") element:Hide() - element.isEnabled = true - element.colorSpec = true element.PostUpdate = element_PostUpdate + element.UpdateColors = element_UpdateColors + element.UpdateConfig = element_UpdateConfig + element.UpdateSortOrder = element_UpdateSortOrder frame.UpdateRunes = frame_UpdateRunes @@ -168,16 +188,23 @@ do end end +-- .ClassPower do + local ignoredKeys = { + prediction = true, + runes = true, + } + + local function element_UpdateConfig(self) + local unit = self.__owner._unit + self._config = E:CopyTable(C.db.profile.units[unit].class_power, self._config, ignoredKeys) + end + local function element_PostUpdate(self, _, max, maxChanged, powerType) - if self._state ~= self.isEnabled or self._powerID ~= powerType or maxChanged then + if self._active ~= self.isEnabled or self._powerID ~= powerType or maxChanged then if not self.isEnabled then self:Hide() - - if self.UpdateContainer then - self:UpdateContainer(false, 0) - end - elseif self.isEnabled or self._powerID ~= powerType or maxChanged then + else self:Show() local orientation = self[1]:GetOrientation() @@ -190,40 +217,47 @@ do end for i = 1, max do - local bar = self[i] - if orientation == "HORIZONTAL" then - bar:SetWidth(layout[i]) + self[i]:SetWidth(layout[i]) else - bar:SetHeight(layout[i]) + self[i]:SetHeight(layout[i]) end - bar:SetStatusBarColor(M.COLORS.POWER[powerType]:GetRGB()) - end - - if self.UpdateContainer then - self:UpdateContainer(true, max) + self[i]:SetStatusBarColor(M.COLORS.POWER[powerType]:GetRGB()) end end - self._state = self.isEnabled + self._active = self.isEnabled self._powerID = powerType end end local function frame_UpdateClassPower(self) - local config = self._config.class_power local element = self.ClassPower - local width, height = element:GetSize() + element:UpdateConfig() + + local orientation = element._config.orientation + local max = element.__max + local layout + + if max then + if orientation == "HORIZONTAL" then + layout = E:CalcSegmentsSizes(element:GetWidth(), 2, max) + else + layout = E:CalcSegmentsSizes(element:GetHeight(), 2, max) + end + end for i = 1, 10 do local bar = element[i] - - bar:SetOrientation(config.orientation) + bar:SetOrientation(orientation) bar:ClearAllPoints() - if config.orientation == "HORIZONTAL" then - bar:SetHeight(height) + if orientation == "HORIZONTAL" then + if layout and i <= max then + bar:SetWidth(layout[i]) + end + bar:SetPoint("TOP", 0, 0) bar:SetPoint("BOTTOM", 0, 0) @@ -233,28 +267,34 @@ do bar:SetPoint("LEFT", element[i - 1], "RIGHT", 2, 0) end else - bar:SetWidth(width) + if layout and i <= max then + bar:SetHeight(layout[i]) + end + bar:SetPoint("LEFT", 0, 0) bar:SetPoint("RIGHT", 0, 0) if i == 1 then - element[i]:SetPoint("BOTTOM", 0, 0) + bar:SetPoint("BOTTOM", 0, 0) else - element[i]:SetPoint("BOTTOM", element[i - 1], "TOP", 0, 2) + bar:SetPoint("BOTTOM", element[i - 1], "TOP", 0, 2) end end end - if config.enabled and not self:IsElementEnabled("ClassPower") then + if element._config.enabled and not self:IsElementEnabled("ClassPower") then self:EnableElement("ClassPower") - elseif not config.enabled and self:IsElementEnabled("ClassPower") then + elseif not element._config.enabled and self:IsElementEnabled("ClassPower") then self:DisableElement("ClassPower") end - if element.isEnabled then - element._state = nil - element._powerID = nil + if self:IsElementEnabled("ClassPower") then element:ForceUpdate() + else + element._active = nil + element._powerID = nil + + element:Hide() end end @@ -263,6 +303,7 @@ do element:Hide() element.PostUpdate = element_PostUpdate + element.UpdateConfig = element_UpdateConfig frame.UpdateClassPower = frame_UpdateClassPower @@ -272,6 +313,10 @@ end -- .Stagger do + local ignoredKeys = { + runes = true, + } + local function element_Override(self, _, unit) if unit and unit ~= self.unit then return end @@ -285,43 +330,53 @@ do element:SetValue(cur) element:SetStatusBarColor(r, g, b) - if element:IsShown() then - element:UpdateGainLoss(cur, max) - end + element:UpdateGainLoss(cur, max) + -- element.GainLossIndicators:Update(cur, max) + end + + local function element_UpdateConfig(self) + local unit = self.__owner._unit + self._config = E:CopyTable(C.db.profile.units[unit].class_power, self._config, ignoredKeys) + end + + local function element_UpdateGainLossThreshold(self) + self.GainLossIndicators.threshold = self._config.change_threshold end local function frame_UpdateStagger(self) - local config = self._config.class_power local element = self.Stagger + element:UpdateConfig() + element:SetOrientation(element._config.orientation) - element:SetOrientation(config.orientation) - - E:ReanchorGainLossIndicators(element, config.orientation) + E:ReanchorGainLossIndicators(element, element._config.orientation) + -- element.GainLossIndicators:UpdatePoints(element._config.orientation) + -- element:UpdateGainLossThreshold() - if config.enabled and not self:IsElementEnabled("Stagger") then + if element._config.enabled and not self:IsElementEnabled("Stagger") then self:EnableElement("Stagger") - - element.isEnabled = true - elseif not config.enabled and self:IsElementEnabled("Stagger") then + elseif not element._config.enabled and self:IsElementEnabled("Stagger") then self:DisableElement("Stagger") - - element.isEnabled = false end - if element.isEnabled then + if self:IsElementEnabled("Stagger") then element:ForceUpdate() + else + element:Hide() end end function UF:CreateStagger(frame) local element = CreateFrame("StatusBar", nil, frame) element:SetStatusBarTexture("Interface\\BUTTONS\\WHITE8X8") + E:SmoothBar(element) element:Hide() - E:SmoothBar(element) E:CreateGainLossIndicators(element) + -- element.GainLossIndicators = E:CreateGainLossIndicators(element) - element.element_Override = element_Override + element.Override = element_Override + element.UpdateConfig = element_UpdateConfig + element.UpdateGainLossThreshold = element_UpdateGainLossThreshold frame.UpdateStagger = frame_UpdateStagger diff --git a/modules/unitframes/elements/combatfeedback.lua b/modules/unitframes/elements/combatfeedback.lua index 6a4eb83b..6279452c 100644 --- a/modules/unitframes/elements/combatfeedback.lua +++ b/modules/unitframes/elements/combatfeedback.lua @@ -10,17 +10,22 @@ local _G = getfenv(0) ]] -- Mine +local function element_UpdateConfig(self) + local unit = self.__owner._unit + self._config = E:CopyTable(C.db.profile.units[unit].combat_feedback, self._config) +end + local function frame_UpdateCombatFeedback(self) - local config = self._config.combat_feedback local element = self.FloatingCombatFeedback + element:UpdateConfig() - element.mode = config.mode - element.xOffset = config.x_offset - element.yOffset = config.y_offset + element.mode = element._config.mode + element.xOffset = element._config.x_offset + element.yOffset = element._config.y_offset - if config.enabled and not self:IsElementEnabled("FloatingCombatFeedback") then + if element._config.enabled and not self:IsElementEnabled("FloatingCombatFeedback") then self:EnableElement("FloatingCombatFeedback") - elseif not config.enabled and self:IsElementEnabled("FloatingCombatFeedback") then + elseif not element._config.enabled and self:IsElementEnabled("FloatingCombatFeedback") then self:DisableElement("FloatingCombatFeedback") end @@ -38,6 +43,7 @@ function UF:CreateCombatFeedback(frame) end element.abbreviateNumbers = true + element.UpdateConfig = element_UpdateConfig frame.UpdateCombatFeedback = frame_UpdateCombatFeedback diff --git a/modules/unitframes/elements/debuffindicator.lua b/modules/unitframes/elements/debuffindicator.lua index 48880c24..5664ef9e 100644 --- a/modules/unitframes/elements/debuffindicator.lua +++ b/modules/unitframes/elements/debuffindicator.lua @@ -6,44 +6,69 @@ local UF = P:GetModule("UnitFrames") local _G = getfenv(0) -- Mine -local function frame_PreviewDebuffIndicator(self) - local element = self.DebuffIndicator +local ALL_ICONS = "|TInterface\\AddOns\\ls_UI\\assets\\unit-frame-aura-icons:0:0:0:0:128:128:67:99:1:33|t" + .. "|TInterface\\AddOns\\ls_UI\\assets\\unit-frame-aura-icons:0:0:0:0:128:128:1:33:34:66|t" + .. "|TInterface\\AddOns\\ls_UI\\assets\\unit-frame-aura-icons:0:0:0:0:128:128:34:66:34:66|t" + .. "|TInterface\\AddOns\\ls_UI\\assets\\unit-frame-aura-icons:0:0:0:0:128:128:67:99:34:66|t" - if element._preview then - self:Tag(element, self._config.debuff.enabled and "[ls:debuffs]" or "") - element:UpdateTag() +local function element_UpdateConfig(self) + local unit = self.__owner._unit + self._config = E:CopyTable(C.db.profile.units[unit].debuff, self._config) +end - element._preview = false - else - self:Tag(element, "|TInterface\\RaidFrame\\Raid-Icon-DebuffCurse:0:0:0:0:16:16:2:14:2:14|t|TInterface\\RaidFrame\\Raid-Icon-DebuffDisease:0:0:0:0:16:16:2:14:2:14|t|TInterface\\RaidFrame\\Raid-Icon-DebuffMagic:0:0:0:0:16:16:2:14:2:14|t|TInterface\\RaidFrame\\Raid-Icon-DebuffPoison:0:0:0:0:16:16:2:14:2:14|t") - element:UpdateTag() +local function element_UpdatePoints(self) + self:ClearAllPoints() - element._preview = true + local config = self._config.point1 + if config and config.p and config.p ~= "" then + self:SetPoint(config.p, E:ResolveAnchorPoint(self.__owner, config.anchor), config.rP, config.x, config.y) end end -local function frame_UpdateDebuffIndicator(self) - local config = self._config.debuff - local element = self.DebuffIndicator +local function element_UpdateTags(self) + local tag = self._config.enabled and "[ls:debuffs]" or "" + if tag ~= "" then + self.__owner:Tag(self, tag) + self:UpdateTag() + else + self.__owner:Untag(self) + self:SetText("") + end - element:SetJustifyV(config.v_alignment or "MIDDLE") - element:SetJustifyH(config.h_alignment or "CENTER") - element:ClearAllPoints() + self._preview = nil +end - local point1 = config.point1 +local function element_Preview(self) + if self._preview then + self:UpdateTags() + else + self.__owner:Tag(self, ALL_ICONS) + self:UpdateTag() - if point1 and point1.p then - element:SetPoint(point1.p, E:ResolveAnchorPoint(self, point1.anchor), point1.rP, point1.x, point1.y) + self._preview = true end +end - self:Tag(element, config.enabled and "[ls:debuffs]" or "") +local function frame_UpdateDebuffIndicator(self) + local element = self.DebuffIndicator + element:UpdateConfig() + element:UpdatePoints() + element:UpdateTags() end function UF:CreateDebuffIndicator(frame, textParent) local element = (textParent or frame):CreateFontString(nil, "ARTWORK", "LSStatusIcon12Font") + element:SetJustifyH("CENTER") + element:SetJustifyV("MIDDLE") element:SetNonSpaceWrap(true) - frame.PreviewDebuffIndicator = frame_PreviewDebuffIndicator + element.__owner = frame + + element.Preview = element_Preview + element.UpdateConfig = element_UpdateConfig + element.UpdatePoints = element_UpdatePoints + element.UpdateTags = element_UpdateTags + frame.UpdateDebuffIndicator = frame_UpdateDebuffIndicator return element diff --git a/modules/unitframes/elements/health.lua b/modules/unitframes/elements/health.lua index 2fc7ba5c..6d51c6cd 100644 --- a/modules/unitframes/elements/health.lua +++ b/modules/unitframes/elements/health.lua @@ -7,6 +7,7 @@ local _G = getfenv(0) local hooksecurefunc = _G.hooksecurefunc -- Blizz +local UnitGUID = _G.UnitGUID local UnitIsConnected = _G.UnitIsConnected local UnitIsDeadOrGhost = _G.UnitIsDeadOrGhost @@ -56,47 +57,57 @@ do self._texture:SetColorTexture(r, g, b) end - local function element_PostUpdate(element, unit) - if not UnitIsConnected(unit) or UnitIsDeadOrGhost(unit) then - element:SetMinMaxValues(0, 1) - element:SetValue(0) + local function element_PostUpdate(self, unit, cur, max) + -- local unitGUID = UnitGUID(unit) + -- self.GainLossIndicators:Update(cur, max, unitGUID == self.GainLossIndicators._UnitGUID) + -- self.GainLossIndicators._UnitGUID = unitGUID + + if not (self:IsShown() and max and max ~= 0) or not UnitIsConnected(unit) or UnitIsDeadOrGhost(unit) then + self:SetMinMaxValues(0, 1) + self:SetValue(0) end end - local function element_UpdateConfig(element) - element._config = E:CopyTable(element.__owner._config.health, element._config, ignoredKeys) + local function element_UpdateConfig(self) + local unit = self.__owner._unit + self._config = E:CopyTable(C.db.profile.units[unit].health, self._config, ignoredKeys) end - local function element_UpdateColorSettings(element) - element.colorClass = element._config.color.class - element.colorReaction = element._config.color.reaction - element:ForceUpdate() + local function element_UpdateColors(self) + self.colorClass = self._config.color.class + self.colorReaction = self._config.color.reaction + self:ForceUpdate() end - local function element_UpdateFontObjects(element) - updateFontObject(element.__owner, element.Text, element._config.text) + local function element_UpdateFontObjects(self) + updateFontObject(self.__owner, self.Text, self._config.text) end - local function element_UpdateTextPoints(element) - updateTextPoint(element.__owner, element.Text, element._config.text.point1) + local function element_UpdateTextPoints(self) + updateTextPoint(self.__owner, self.Text, self._config.text.point1) end - local function element_UpdateTags(element) - updateTag(element.__owner, element.Text, element._config.enabled and element._config.text.tag or "") + local function element_UpdateTags(self) + updateTag(self.__owner, self.Text, self._config.enabled and self._config.text.tag or "") + end + + local function element_UpdateGainLossThreshold(self) + self.GainLossIndicators.threshold = self._config.change_threshold end local function frame_UpdateHealth(self) local element = self.Health element:UpdateConfig() element:SetOrientation(element._config.orientation) - element:UpdateColorSettings() + element:UpdateColors() element:UpdateFontObjects() element:UpdateTextPoints() element:UpdateTags() - if element.ForceUpdate then - element:ForceUpdate() - end + -- element.GainLossIndicators:UpdatePoints(element._config.orientation) + -- element:UpdateGainLossThreshold() + + element:ForceUpdate() end function UF:CreateHealth(frame, textParent) @@ -111,13 +122,17 @@ do element.Text = (textParent or element):CreateFontString(nil, "ARTWORK", "LSFont12") + -- element.GainLossIndicators = E:CreateGainLossIndicators(element) + -- element.GainLossIndicators.Gain = nil + element.colorHealth = true element.colorTapping = true element.colorDisconnected = true element.PostUpdate = element_PostUpdate - element.UpdateColorSettings = element_UpdateColorSettings + element.UpdateColors = element_UpdateColors element.UpdateConfig = element_UpdateConfig element.UpdateFontObjects = element_UpdateFontObjects + element.UpdateGainLossThreshold = element_UpdateGainLossThreshold element.UpdateTags = element_UpdateTags element.UpdateTextPoints = element_UpdateTextPoints @@ -129,24 +144,25 @@ end -- .HealthPrediction do - local function element_UpdateConfig(element) - element._config = E:CopyTable(element.__owner._config.health.prediction, element._config) - element._config.orientation = element.__owner._config.health.orientation + local function element_UpdateConfig(self) + local unit = self.__owner._unit + self._config = E:CopyTable(C.db.profile.units[unit].health.prediction, self._config) + self._config.orientation = C.db.profile.units[unit].health.orientation end - local function element_UpdateFontObjects(element) - updateFontObject(element.__owner, element.absorbBar.Text, element._config.absorb_text) - updateFontObject(element.__owner, element.healAbsorbBar.Text, element._config.heal_absorb_text) + local function element_UpdateFontObjects(self) + updateFontObject(self.__owner, self.absorbBar.Text, self._config.absorb_text) + updateFontObject(self.__owner, self.healAbsorbBar.Text, self._config.heal_absorb_text) end - local function element_UpdateTextPoints(element) - updateTextPoint(element.__owner, element.absorbBar.Text, element._config.absorb_text.point1) - updateTextPoint(element.__owner, element.healAbsorbBar.Text, element._config.heal_absorb_text.point1) + local function element_UpdateTextPoints(self) + updateTextPoint(self.__owner, self.absorbBar.Text, self._config.absorb_text.point1) + updateTextPoint(self.__owner, self.healAbsorbBar.Text, self._config.heal_absorb_text.point1) end - local function element_UpdateTags(element) - updateTag(element.__owner, element.absorbBar.Text, element._config.enabled and element._config.absorb_text.tag or "") - updateTag(element.__owner, element.healAbsorbBar.Text, element._config.enabled and element._config.heal_absorb_text.tag or "") + local function element_UpdateTags(self) + updateTag(self.__owner, self.absorbBar.Text, self._config.enabled and self._config.absorb_text.tag or "") + updateTag(self.__owner, self.healAbsorbBar.Text, self._config.enabled and self._config.heal_absorb_text.tag or "") end local function frame_UpdateHealthPrediction(self) diff --git a/modules/unitframes/elements/insets.lua b/modules/unitframes/elements/insets.lua index c81d6415..98e18f97 100644 --- a/modules/unitframes/elements/insets.lua +++ b/modules/unitframes/elements/insets.lua @@ -4,6 +4,7 @@ local UF = P:GetModule("UnitFrames") -- Lua local _G = getfenv(0) +local next = _G.next --[[ luacheck: globals CreateFrame @@ -19,6 +20,10 @@ local function inset_Collapse(self) self.Glass:Hide() self.GlassShadow:Hide() + for _, sep in next, self.Seps do + sep:Hide() + end + self._expanded = false if self.PostCollapse then @@ -35,6 +40,11 @@ local function inset_Expand(self) self.Glass:Show() self.GlassShadow:Show() + for _, sep in next, self.Seps do + sep:SetTexCoord(1 / 32, 25 / 32, 0 / 8, self._height / 4) + sep:SetSize(12, self._height) + end + self._expanded = true if self.PostExpand then @@ -60,20 +70,37 @@ local function inset_SetVertexColor(self, r, g, b, a) self.Bottom.Right:SetVertexColor(r, g, b, a) end -local function frame_UpdateInsets(self) - local top = self.Insets.Top - local bottom = self.Insets.Bottom +local function updateInset(inset, height) + inset._height = height - top._height = self._config.insets.t_height - bottom._height = self._config.insets.b_height + if inset:IsExpanded() then + inset:SetHeight(height) - if top:IsExpanded() then - top:SetHeight(top._height) + for _, sep in next, inset.Seps do + sep:SetTexCoord(1 / 32, 25 / 32, 0 / 8, height / 4) + sep:SetSize(12, height) + end end +end - if bottom:IsExpanded() then - bottom:SetHeight(bottom._height) - end +local function element_UpdateConfig(self) + local unit = self.__owner._unit + self._config = E:CopyTable(C.db.profile.units[unit].insets, self._config) +end + +local function element_UpdateTopInset(self) + updateInset(self.Top, self._config.t_height) +end + +local function element_UpdateBottomInset(self) + updateInset(self.Bottom, self._config.b_height) +end + +local function frame_UpdateInsets(self) + local element = self.Insets + element:UpdateConfig() + element:UpdateBottomInset() + element:UpdateTopInset() end function UF:CreateInsets(frame, texParent) @@ -114,11 +141,20 @@ function UF:CreateInsets(frame, texParent) shadow:SetPoint("TOPLEFT", topInset, "TOPLEFT", 0, 0) shadow:SetPoint("BOTTOMRIGHT", topInset, "BOTTOMRIGHT", 0, 2) + local seps, sep = {} + for i = 1, 9 do + sep = (texParent or frame):CreateTexture(nil, "ARTWORK", nil, 1) + sep:SetTexture("Interface\\AddOns\\ls_UI\\assets\\statusbar-sep", "REPEAT", "REPEAT") + sep:Hide() + seps[i] = sep + end + topInset.Left = left topInset.Mid = mid topInset.Right = right topInset.Glass = glass topInset.GlassShadow = shadow + topInset.Seps = seps topInset.Expand = inset_Expand topInset.Collapse = inset_Collapse topInset.IsExpanded = inset_IsExpanded @@ -160,11 +196,20 @@ function UF:CreateInsets(frame, texParent) shadow:SetPoint("TOPLEFT", bottomInset, "TOPLEFT", 0, -2) shadow:SetPoint("BOTTOMRIGHT", bottomInset, "BOTTOMRIGHT", 0, 0) + seps = {} + for i = 1, 9 do + sep = (texParent or frame):CreateTexture(nil, "ARTWORK", nil, 1) + sep:SetTexture("Interface\\AddOns\\ls_UI\\assets\\statusbar-sep", "REPEAT", "REPEAT") + sep:Hide() + seps[i] = sep + end + bottomInset.Left = left bottomInset.Mid = mid bottomInset.Right = right bottomInset.Glass = glass bottomInset.GlassShadow = shadow + bottomInset.Seps = seps bottomInset.Expand = inset_Expand bottomInset.Collapse = inset_Collapse bottomInset.IsExpanded = inset_IsExpanded @@ -174,9 +219,13 @@ function UF:CreateInsets(frame, texParent) frame.UpdateInsets = frame_UpdateInsets return { + __owner = frame, Bottom = bottomInset, GetVertexColor = inset_GetVertexColor, SetVertexColor = inset_SetVertexColor, Top = topInset, + UpdateBottomInset = element_UpdateBottomInset, + UpdateConfig = element_UpdateConfig, + UpdateTopInset = element_UpdateTopInset, } end diff --git a/modules/unitframes/elements/name.lua b/modules/unitframes/elements/name.lua index d6859f45..e89e32e4 100644 --- a/modules/unitframes/elements/name.lua +++ b/modules/unitframes/elements/name.lua @@ -6,33 +6,66 @@ local UF = P:GetModule("UnitFrames") local _G = getfenv(0) -- Mine -local function frame_UpdateName(self) - local config = self._config.name - local element = self.Name +local function updateTextPoint(frame, fontString, config) + if config and config.p and config.p ~= "" then + fontString:SetPoint(config.p, E:ResolveAnchorPoint(frame, config.anchor), config.rP, config.x, config.y) + end +end - element:SetJustifyV(config.v_alignment or "MIDDLE") - element:SetJustifyH(config.h_alignment or "CENTER") - element:SetWordWrap(config.word_wrap) - element:ClearAllPoints() +local function element_UpdateConfig(self) + local unit = self.__owner._unit + self._config = E:CopyTable(C.db.profile.units[unit].name, self._config) +end + +local function element_UpdateFontObjects(self) + local config = self._config - local point1 = config.point1 + self:SetFontObject("LSFont" .. config.size .. (config.outline and "_Outline" or "")) + self:SetJustifyH(config.h_alignment) + self:SetJustifyV(config.v_alignment) + self:SetWordWrap(config.word_wrap) - if point1 and point1.p then - element:SetPoint(point1.p, E:ResolveAnchorPoint(self, point1.anchor), point1.rP, point1.x, point1.y) + if config.shadow then + self:SetShadowOffset(1, -1) + else + self:SetShadowOffset(0, 0) end +end - local point2 = config.point2 +local function element_UpdatePoints(self) + self:ClearAllPoints() - if point2 and point2.p ~= "" then - element:SetPoint(point2.p, E:ResolveAnchorPoint(self, point2.anchor), point2.rP, point2.x, point2.y) + updateTextPoint(self.__owner, self, self._config.point1) + updateTextPoint(self.__owner, self, self._config.point2) +end + +local function element_UpdateTags(self) + if self._config.tag ~= "" then + self.__owner:Tag(self, self._config.tag) + self:UpdateTag() + else + self.__owner:Untag(self) + self:SetText("") end +end - self:Tag(element, config.tag) - element:UpdateTag() +local function frame_UpdateName(self) + local element = self.Name + element:UpdateConfig() + element:UpdateFontObjects() + element:UpdatePoints() + element:UpdateTags() end -function UF:CreateName(frame, textFontObject, textParent) - local element = (textParent or frame):CreateFontString(nil, "OVERLAY", textFontObject) +function UF:CreateName(frame, textParent) + local element = (textParent or frame):CreateFontString(nil, "OVERLAY", "LSFont12") + + element.__owner = frame + + element.UpdateConfig = element_UpdateConfig + element.UpdateFontObjects = element_UpdateFontObjects + element.UpdatePoints = element_UpdatePoints + element.UpdateTags = element_UpdateTags frame.UpdateName = frame_UpdateName diff --git a/modules/unitframes/elements/power.lua b/modules/unitframes/elements/power.lua index 1b6e3dbb..1e54728e 100644 --- a/modules/unitframes/elements/power.lua +++ b/modules/unitframes/elements/power.lua @@ -15,81 +15,134 @@ local UnitIsDeadOrGhost = _G.UnitIsDeadOrGhost ]] -- Mine +local ignoredKeys = { + prediction = true, + runes = true, +} + +local function updateFontObject(_, fontString, config) + fontString:SetFontObject("LSFont" .. config.size .. (config.outline and "_Outline" or "")) + fontString:SetJustifyH(config.h_alignment) + fontString:SetJustifyV(config.v_alignment) + fontString:SetWordWrap(false) + + if config.shadow then + fontString:SetShadowOffset(1, -1) + else + fontString:SetShadowOffset(0, 0) + end +end + +local function updateTextPoint(frame, fontString, config) + fontString:ClearAllPoints() + + if config and config.p then + fontString:SetPoint(config.p, E:ResolveAnchorPoint(frame, config.anchor), config.rP, config.x, config.y) + end +end + +local function updateTag(frame, fontString, tag) + if tag ~= "" then + frame:Tag(fontString, tag) + fontString:UpdateTag() + else + frame:Untag(fontString) + fontString:SetText("") + end +end + +local function element_UpdateFontObjects(self) + updateFontObject(self.__owner, self.Text, self._config.text) +end + +local function element_UpdateTextPoints(self) + updateTextPoint(self.__owner, self.Text, self._config.text.point1) +end + +local function element_UpdateTags(self) + updateTag(self.__owner, self.Text, self._config.enabled and self._config.text.tag or "") +end + +local function element_UpdateGainLossThreshold(self) + self.GainLossIndicators.threshold = self._config.change_threshold +end + -- .Power do - local function element_PostUpdate(element, unit, cur, _, max) - local shouldShown = element:IsShown() and max and max ~= 0 + local function element_PostUpdate(self, unit, cur, _, max) + local shouldShown = self:IsShown() and max and max ~= 0 - if element.UpdateContainer then - element:UpdateContainer(shouldShown) + if self.UpdateContainer then + self:UpdateContainer(shouldShown) end - if shouldShown then - local unitGUID = UnitGUID(unit) - - element:UpdateGainLoss(cur, max, unitGUID == element._UnitGUID) - - element._UnitGUID = unitGUID + local unitGUID = UnitGUID(unit) + self:UpdateGainLoss(cur, max, unitGUID == self._UnitGUID) + self._UnitGUID = unitGUID + -- self.GainLossIndicators:Update(cur, max, unitGUID == self.GainLossIndicators._UnitGUID) + -- self.GainLossIndicators._UnitGUID = unitGUID - element.Text:Show() + if shouldShown then + self.Text:Show() else - element.Text:Hide() + self.Text:Hide() end - if not UnitIsConnected(unit) or UnitIsDeadOrGhost(unit) then - element:SetMinMaxValues(0, 1) - element:SetValue(0) + if not shouldShown or not UnitIsConnected(unit) or UnitIsDeadOrGhost(unit) then + self:SetMinMaxValues(0, 1) + self:SetValue(0) end end + local function element_UpdateConfig(self) + local unit = self.__owner._unit + self._config = E:CopyTable(C.db.profile.units[unit].power, self._config, ignoredKeys) + end + local function frame_UpdatePower(self) - local config = self._config.power local element = self.Power + element:UpdateConfig() + element:SetOrientation(element._config.orientation) + element:UpdateFontObjects() + element:UpdateTextPoints() + element:UpdateTags() - element:SetOrientation(config.orientation) - - if element.Text then - element.Text:SetJustifyV(config.text.v_alignment or "MIDDLE") - element.Text:SetJustifyH(config.text.h_alignment or "CENTER") - element.Text:ClearAllPoints() - - local point1 = config.text.point1 - - if point1 and point1.p then - element.Text:SetPoint(point1.p, E:ResolveAnchorPoint(self, point1.anchor), point1.rP, point1.x, point1.y) - end - - self:Tag(element.Text, config.enabled and config.text.tag or "") - element.Text:UpdateTag() - end - - E:ReanchorGainLossIndicators(element, config.orientation) + E:ReanchorGainLossIndicators(element, element._config.orientation) + -- element.GainLossIndicators:UpdatePoints(element._config.orientation) + -- element:UpdateGainLossThreshold() - if config.enabled and not self:IsElementEnabled("Power") then + if element._config.enabled and not self:IsElementEnabled("Power") then self:EnableElement("Power") - elseif not config.enabled and self:IsElementEnabled("Power") then + elseif not element._config.enabled and self:IsElementEnabled("Power") then self:DisableElement("Power") end - element:ForceUpdate() + if self:IsElementEnabled("Power") then + element:ForceUpdate() + elseif element.UpdateContainer then + element:UpdateContainer(false) + end end - function UF:CreatePower(frame, text, textFontObject, textParent) + function UF:CreatePower(frame, textParent) local element = CreateFrame("StatusBar", nil, frame) element:SetStatusBarTexture("Interface\\BUTTONS\\WHITE8X8") + E:SmoothBar(element) - if text then - text = (textParent or element):CreateFontString(nil, "ARTWORK", textFontObject) - element.Text = text - end + element.Text = (textParent or element):CreateFontString(nil, "ARTWORK", "LSFont12") - E:SmoothBar(element) E:CreateGainLossIndicators(element) + -- element.GainLossIndicators = E:CreateGainLossIndicators(element) - element.colorPower = true element.colorDisconnected = true + element.colorPower = true element.frequentUpdates = true element.PostUpdate = element_PostUpdate + element.UpdateConfig = element_UpdateConfig + element.UpdateFontObjects = element_UpdateFontObjects + element.UpdateGainLossThreshold = element_UpdateGainLossThreshold + element.UpdateTags = element_UpdateTags + element.UpdateTextPoints = element_UpdateTextPoints frame.UpdatePower = frame_UpdatePower @@ -99,46 +152,54 @@ end -- .AdditionalPower do - local function element_PostUpdate(element, unit, cur, max) - if element:IsShown() and max and max ~= 0 then - element:UpdateGainLoss(cur, max) + local function element_PostUpdate(self, unit, cur, max) + if self:IsShown() and max and max ~= 0 then + self:UpdateGainLoss(cur, max) + -- self.GainLossIndicators:Update(cur, max) end if not UnitIsConnected(unit) or UnitIsDeadOrGhost(unit) then - element:SetMinMaxValues(0, 1) - element:SetValue(0) + self:SetMinMaxValues(0, 1) + self:SetValue(0) end end + local function element_UpdateConfig(self) + local unit = self.__owner._unit + self._config = E:CopyTable(C.db.profile.units[unit].class_power, self._config, ignoredKeys) + end + local function frame_UpdateAdditionalPower(frame) - local config = frame._config.class_power local element = frame.AdditionalPower + element:UpdateConfig() + element:SetOrientation(element._config.orientation) - element:SetOrientation(config.orientation) - - E:ReanchorGainLossIndicators(element, config.orientation) + E:ReanchorGainLossIndicators(element, element._config.orientation) + -- element.GainLossIndicators:UpdatePoints(element._config.orientation) + -- element:UpdateGainLossThreshold() - if config.enabled and not frame:IsElementEnabled("AdditionalPower") then + if element._config.enabled and not frame:IsElementEnabled("AdditionalPower") then frame:EnableElement("AdditionalPower") - elseif not config.enabled and frame:IsElementEnabled("AdditionalPower") then + elseif not element._config.enabled and frame:IsElementEnabled("AdditionalPower") then frame:DisableElement("AdditionalPower") end - if frame:IsElementEnabled("AdditionalPower") then - element:ForceUpdate() - end + element:ForceUpdate() end function UF:CreateAdditionalPower(frame) local element = CreateFrame("StatusBar", nil, frame) element:SetStatusBarTexture("Interface\\BUTTONS\\WHITE8X8") + E:SmoothBar(element) element:Hide() - E:SmoothBar(element) E:CreateGainLossIndicators(element) + -- element.GainLossIndicators = E:CreateGainLossIndicators(element) element.colorPower = true element.PostUpdate = element_PostUpdate + element.UpdateConfig = element_UpdateConfig + element.UpdateGainLossThreshold = element_UpdateGainLossThreshold frame.UpdateAdditionalPower = frame_UpdateAdditionalPower @@ -148,77 +209,78 @@ end -- .AlternativePower do - local function element_PostUpdate(element, unit, cur, _, max) - local shouldShown = element:IsShown() and max and max ~= 0 + local function element_PostUpdate(self, unit, cur, _, max) + local shouldShown = self:IsShown() and max and max ~= 0 - if element.UpdateContainer then - element:UpdateContainer(shouldShown) + if self.UpdateContainer then + self:UpdateContainer(shouldShown) end - if shouldShown then - local unitGUID = UnitGUID(unit) - - element:UpdateGainLoss(cur, max, unitGUID == element._UnitGUID) - - element._UnitGUID = unitGUID + local unitGUID = UnitGUID(unit) + self:UpdateGainLoss(cur, max, unitGUID == self._UnitGUID) + self._UnitGUID = unitGUID + -- self.GainLossIndicators:Update(cur, max, unitGUID == self.GainLossIndicators._UnitGUID) + -- self.GainLossIndicators._UnitGUID = unitGUID - element.Text:Show() + if shouldShown then + self.Text:Show() else - element.Text:Hide() + self.Text:Hide() end - if not UnitIsConnected(unit) or UnitIsDeadOrGhost(unit) then - element:SetMinMaxValues(0, 1) - element:SetValue(0) + if not shouldShown or not UnitIsConnected(unit) or UnitIsDeadOrGhost(unit) then + self:SetMinMaxValues(0, 1) + self:SetValue(0) end end + local function element_UpdateConfig(self) + local unit = self.__owner._unit + self._config = E:CopyTable(C.db.profile.units[unit].alt_power, self._config) + end + local function frame_UpdateAlternativePower(self) - local config = self._config.alt_power local element = self.AlternativePower + element:UpdateConfig() + element:SetOrientation(element._config.orientation) + element:UpdateFontObjects() + element:UpdateTextPoints() + element:UpdateTags() - element:SetOrientation(config.orientation) - - if element.Text then - element.Text:SetJustifyV(config.text.v_alignment or "MIDDLE") - element.Text:SetJustifyH(config.text.h_alignment or "CENTER") - element.Text:ClearAllPoints() - - local point1 = config.text.point1 - - if point1 and point1.p then - element.Text:SetPoint(point1.p, E:ResolveAnchorPoint(self, point1.anchor), point1.rP, point1.x, point1.y) - end - - self:Tag(element.Text, config.enabled and config.text.tag or "") - element.Text:UpdateTag() - end - - E:ReanchorGainLossIndicators(element, config.orientation) + E:ReanchorGainLossIndicators(element, element._config.orientation) + -- element.GainLossIndicators:UpdatePoints(element._config.orientation) + -- element:UpdateGainLossThreshold() - if config.enabled and not self:IsElementEnabled("AlternativePower") then + if element._config.enabled and not self:IsElementEnabled("AlternativePower") then self:EnableElement("AlternativePower") - elseif not config.enabled and self:IsElementEnabled("AlternativePower") then + elseif not element._config.enabled and self:IsElementEnabled("AlternativePower") then self:DisableElement("AlternativePower") end - element:ForceUpdate() + if self:IsElementEnabled("AlternativePower") then + element:ForceUpdate() + elseif element.UpdateContainer then + element:UpdateContainer(false) + end end - function UF:CreateAlternativePower(frame, text, textFontObject, textParent) + function UF:CreateAlternativePower(frame, textParent) local element = CreateFrame("StatusBar", nil, frame) element:SetStatusBarTexture("Interface\\BUTTONS\\WHITE8X8") element:SetStatusBarColor(M.COLORS.INDIGO:GetRGB()) + E:SmoothBar(element) - if text then - text = (textParent or element):CreateFontString(nil, "ARTWORK", textFontObject) - element.Text = text - end + element.Text = (textParent or element):CreateFontString(nil, "ARTWORK", "LSFont12") - E:SmoothBar(element) E:CreateGainLossIndicators(element) + -- element.GainLossIndicators = E:CreateGainLossIndicators(element) element.PostUpdate = element_PostUpdate + element.UpdateConfig = element_UpdateConfig + element.UpdateFontObjects = element_UpdateFontObjects + element.UpdateGainLossThreshold = element_UpdateGainLossThreshold + element.UpdateTags = element_UpdateTags + element.UpdateTextPoints = element_UpdateTextPoints frame.UpdateAlternativePower = frame_UpdateAlternativePower @@ -228,31 +290,46 @@ end -- .PowerPrediction do - local function frame_UpdatePowerPrediction(self) - local config1 = self._config.power - local config2 = self._config.class_power - local element = self.PowerPrediction + local function element_UpdateConfig(self) + if not self._config then + self._config = { + power = {}, + class_power = {}, + } + end + + local unit = self.__owner._unit + self._config.power.enabled = C.db.profile.units[unit].power.prediction.enabled + self._config.power.orientation = C.db.profile.units[unit].power.orientation + self._config.class_power.enabled = C.db.profile.units[unit].class_power.prediction.enabled + self._config.class_power.orientation = C.db.profile.units[unit].class_power.orientation + end - if config1.prediction.enabled then + local function frame_UpdatePowerPrediction(frame) + local element = frame.PowerPrediction + element:UpdateConfig() + + local config1 = element._config.power + if config1.enabled then local mainBar_ = element.mainBar_ mainBar_:SetOrientation(config1.orientation) mainBar_:ClearAllPoints() if config1.orientation == "HORIZONTAL" then - local width = self.Power:GetWidth() - width = width > 0 and width or self:GetWidth() + local width = frame.Power:GetWidth() + width = width > 0 and width or frame:GetWidth() mainBar_:SetPoint("TOP") mainBar_:SetPoint("BOTTOM") - mainBar_:SetPoint("RIGHT", self.Power:GetStatusBarTexture(), "RIGHT") + mainBar_:SetPoint("RIGHT", frame.Power:GetStatusBarTexture(), "RIGHT") mainBar_:SetWidth(width) else - local height = self.Power:GetHeight() - height = height > 0 and height or self:GetHeight() + local height = frame.Power:GetHeight() + height = height > 0 and height or frame:GetHeight() mainBar_:SetPoint("LEFT") mainBar_:SetPoint("RIGHT") - mainBar_:SetPoint("TOP", self.Power:GetStatusBarTexture(), "TOP") + mainBar_:SetPoint("TOP", frame.Power:GetStatusBarTexture(), "TOP") mainBar_:SetHeight(height) end @@ -264,26 +341,27 @@ do element.mainBar_:ClearAllPoints() end - if config2.prediction.enabled then + local config2 = element._config.class_power + if config2.enabled then local altBar_ = element.altBar_ altBar_:SetOrientation(config2.orientation) altBar_:ClearAllPoints() if config2.orientation == "HORIZONTAL" then - local width = self.AdditionalPower:GetWidth() - width = width > 0 and width or self:GetWidth() + local width = frame.AdditionalPower:GetWidth() + width = width > 0 and width or frame:GetWidth() altBar_:SetPoint("TOP") altBar_:SetPoint("BOTTOM") - altBar_:SetPoint("RIGHT", self.AdditionalPower:GetStatusBarTexture(), "RIGHT") + altBar_:SetPoint("RIGHT", frame.AdditionalPower:GetStatusBarTexture(), "RIGHT") altBar_:SetWidth(width) else - local height = self.AdditionalPower:GetHeight() - height = height > 0 and height or self:GetHeight() + local height = frame.AdditionalPower:GetHeight() + height = height > 0 and height or frame:GetHeight() altBar_:SetPoint("LEFT") altBar_:SetPoint("RIGHT") - altBar_:SetPoint("TOP", self.AdditionalPower:GetStatusBarTexture(), "TOP") + altBar_:SetPoint("TOP", frame.AdditionalPower:GetStatusBarTexture(), "TOP") altBar_:SetHeight(height) end @@ -295,15 +373,16 @@ do element.altBar_:ClearAllPoints() end - local isEnabled = config1.prediction.enabled or config2.prediction.enabled - - if isEnabled and not self:IsElementEnabled("PowerPrediction") then - self:EnableElement("PowerPrediction") - elseif not isEnabled and self:IsElementEnabled("PowerPrediction") then - self:DisableElement("PowerPrediction") + local isEnabled = config1.enabled or config2.enabled + if isEnabled and not frame:IsElementEnabled("PowerPrediction") then + frame:EnableElement("PowerPrediction") + elseif not isEnabled and frame:IsElementEnabled("PowerPrediction") then + frame:DisableElement("PowerPrediction") end - element:ForceUpdate() + if frame:IsElementEnabled("PowerPrediction") then + element:ForceUpdate() + end end function UF:CreatePowerPrediction(frame, parent1, parent2) @@ -311,24 +390,22 @@ do mainBar:SetStatusBarTexture("Interface\\BUTTONS\\WHITE8X8") mainBar:SetStatusBarColor(0.55, 0.75, 0.95) -- MOVE TO CONSTANTS! mainBar:SetReverseFill(true) + E:SmoothBar(mainBar) parent1.CostPrediction = mainBar local altBar = CreateFrame("StatusBar", nil, parent2) altBar:SetStatusBarTexture("Interface\\BUTTONS\\WHITE8X8") altBar:SetStatusBarColor(0.55, 0.75, 0.95) -- MOVE TO CONSTANTS! altBar:SetReverseFill(true) - parent2.CostPrediction = altBar - - E:SmoothBar(mainBar) E:SmoothBar(altBar) + parent2.CostPrediction = altBar frame.UpdatePowerPrediction = frame_UpdatePowerPrediction return { mainBar_ = mainBar, - mainBar = mainBar, altBar_ = altBar, - altBar = altBar, + UpdateConfig = element_UpdateConfig, } end end diff --git a/modules/unitframes/elements/pvpindicator.lua b/modules/unitframes/elements/pvpindicator.lua index 658d06f1..036da665 100644 --- a/modules/unitframes/elements/pvpindicator.lua +++ b/modules/unitframes/elements/pvpindicator.lua @@ -6,21 +6,27 @@ local UF = P:GetModule("UnitFrames") local _G = getfenv(0) -- Blizz -local CreateFrame = _G.CreateFrame +local C_PvP = _G.C_PvP local UnitFactionGroup = _G.UnitFactionGroup +local UnitHonorLevel = _G.UnitHonorLevel local UnitIsMercenary = _G.UnitIsMercenary local UnitIsPVP = _G.UnitIsPVP local UnitIsPVPFreeForAll = _G.UnitIsPVPFreeForAll +--[[ luacheck: globals + CreateFrame +]] + + -- Mine local function element_Override(self, _, unit) if unit ~= self.unit then return end - local pvp = self.PvPIndicator + local element = self.PvPIndicator - local status local factionGroup = UnitFactionGroup(unit) local honorRewardInfo = C_PvP.GetHonorRewardInfo(UnitHonorLevel(unit)) + local status if UnitIsPVPFreeForAll(unit) then status = "FFA" @@ -40,28 +46,28 @@ local function element_Override(self, _, unit) if status then if honorRewardInfo then - pvp:SetTexture(honorRewardInfo.badgeFileDataID) - pvp:SetTexCoord(0, 1, 0, 1) + element:SetTexture(honorRewardInfo.badgeFileDataID) + element:SetTexCoord(0, 1, 0, 1) else - pvp:SetTexture("Interface\\AddOns\\ls_UI\\assets\\pvp-banner-" .. status) - pvp:SetTexCoord(102 / 256, 162 / 256, 22 / 128, 82 / 128) + element:SetTexture("Interface\\AddOns\\ls_UI\\assets\\pvp-banner-" .. status) + element:SetTexCoord(102 / 256, 162 / 256, 22 / 128, 82 / 128) end - pvp:Show() + element:Show() - pvp.Banner:SetTexture("Interface\\AddOns\\ls_UI\\assets\\pvp-banner-" .. status) - pvp.Banner:SetTexCoord(1 / 256, 101 / 256, 1 / 128, 109 / 128) - pvp.Banner:Show() + element.Banner:SetTexture("Interface\\AddOns\\ls_UI\\assets\\pvp-banner-" .. status) + element.Banner:SetTexCoord(1 / 256, 101 / 256, 1 / 128, 109 / 128) + element.Banner:Show() - if not pvp.Holder:IsExpanded() then - pvp.Holder:Expand() + if not element.Holder:IsExpanded() then + element.Holder:Expand() end else - pvp:Hide() - pvp.Banner:Hide() + element:Hide() + element.Banner:Hide() - if pvp.Holder:IsExpanded() then - pvp.Holder:Collapse() + if element.Holder:IsExpanded() then + element.Holder:Collapse() end end end @@ -90,37 +96,53 @@ local function holder_IsExpanded(self) return self._expanded end -local function frame_UpdatePvPIndicator(self) - local config = self._config.pvp - local element = self.PvPIndicator - - element:ClearAllPoints() +local function element_UpdateConfig(self) + local unit = self.__owner._unit + self._config = E:CopyTable(C.db.profile.units[unit].pvp, self._config) +end - local point1 = config.point1 +local function element_UpdatePoints(self) + self:ClearAllPoints() - if point1 and point1.p then - element:SetPoint(point1.p, E:ResolveAnchorPoint(self, point1.anchor), point1.rP, point1.x, point1.y) + local config = self._config.point1 + if config and config.p and config.p ~= "" then + self:SetPoint(config.p, E:ResolveAnchorPoint(self.__owner, config.anchor), config.rP, config.x, config.y) end +end - if element.Holder:IsExpanded() and element.Holder.PostExpand then - element.Holder:PostExpand() +local function element_UpdateTags(self) + if self.Timer then + local tag = self._config.enabled and "[ls:pvptimer]" or "" + if tag ~= "" then + self.Timer.frequentUpdates = 0.1 + self.__owner:Tag(self.Timer, tag) + self.Timer:UpdateTag() + else + self.Timer.frequentUpdates = nil + self.__owner:Untag(self.Timer) + self.Timer:SetText("") + end end +end - if config.enabled and not self:IsElementEnabled("PvPIndicator") then - self:EnableElement("PvPIndicator") - elseif not config.enabled and self:IsElementEnabled("PvPIndicator") then - self:DisableElement("PvPIndicator") - end +local function frame_UpdatePvPIndicator(self) + local element = self.PvPIndicator + element:UpdateConfig() + element:UpdatePoints() - local timer = element.Timer + element:UpdateTags() - if timer then - timer.frequentUpdates = config.enabled and 0.1 or nil - self:Tag(timer, config.enabled and "[ls:pvptimer]" or "") - timer:UpdateTag() + if element._config.enabled and not self:IsElementEnabled("PvPIndicator") then + self:EnableElement("PvPIndicator") + elseif not element._config.enabled and self:IsElementEnabled("PvPIndicator") then + self:DisableElement("PvPIndicator") end if self:IsElementEnabled("PvPIndicator") then + if element.Holder:IsExpanded() and element.Holder.PostExpand then + element.Holder:PostExpand() + end + element:ForceUpdate() else element.Holder:Collapse() @@ -135,18 +157,22 @@ function UF:CreatePvPIndicator(frame, parent) holder.Collapse = holder_Collapse holder.IsExpanded = holder_IsExpanded - local pvp = holder:CreateTexture(nil, "ARTWORK", nil, 0) - pvp:SetSize(30, 30) + local element = holder:CreateTexture(nil, "ARTWORK", nil, 0) + element:SetSize(30, 30) local banner = holder:CreateTexture(nil, "ARTWORK", nil, -1) banner:SetSize(50, 54) - banner:SetPoint("TOP", pvp, "TOP", 0, 11) + banner:SetPoint("TOP", element, "TOP", 0, 11) + + element.Holder = holder + element.Banner = banner + element.Override = element_Override - pvp.Holder = holder - pvp.Banner = banner - pvp.Override = element_Override + element.UpdateConfig = element_UpdateConfig + element.UpdatePoints = element_UpdatePoints + element.UpdateTags = element_UpdateTags frame.UpdatePvPIndicator = frame_UpdatePvPIndicator - return pvp + return element end diff --git a/modules/unitframes/elements/raidtargetindicator.lua b/modules/unitframes/elements/raidtargetindicator.lua index 8d6dec88..e6d1c1d3 100644 --- a/modules/unitframes/elements/raidtargetindicator.lua +++ b/modules/unitframes/elements/raidtargetindicator.lua @@ -6,22 +6,33 @@ local UF = P:GetModule("UnitFrames") local _G = getfenv(0) -- Mine -local function frame_UpdateRaidTargetIndicator(self) - local config = self._config.raid_target - local element = self.RaidTargetIndicator +local function element_UpdateConfig(self) + local unit = self.__owner._unit + self._config = E:CopyTable(C.db.profile.units[unit].raid_target, self._config) +end - element:SetSize(config.size, config.size) - element:ClearAllPoints() +local function element_UpdateSize(self) + self:SetSize(self._config.size, self._config.size) +end - local point1 = config.point1 +local function element_UpdatePoints(self) + self:ClearAllPoints() - if point1 and point1.p then - element:SetPoint(point1.p, E:ResolveAnchorPoint(self, point1.anchor), point1.rP, point1.x, point1.y) + local config = self._config.point1 + if config and config.p and config.p ~= "" then + self:SetPoint(config.p, E:ResolveAnchorPoint(self.__owner, config.anchor), config.rP, config.x, config.y) end +end - if config.enabled and not self:IsElementEnabled("RaidTargetIndicator") then +local function frame_UpdateRaidTargetIndicator(self) + local element = self.RaidTargetIndicator + element:UpdateConfig() + element:UpdateSize() + element:UpdatePoints() + + if element._config.enabled and not self:IsElementEnabled("RaidTargetIndicator") then self:EnableElement("RaidTargetIndicator") - elseif not config.enabled and self:IsElementEnabled("RaidTargetIndicator") then + elseif not element._config.enabled and self:IsElementEnabled("RaidTargetIndicator") then self:DisableElement("RaidTargetIndicator") end @@ -33,6 +44,10 @@ end function UF:CreateRaidTargetIndicator(frame, parent) local element = (parent or frame):CreateTexture(nil, "ARTWORK", nil, 3) + element.UpdateConfig = element_UpdateConfig + element.UpdatePoints = element_UpdatePoints + element.UpdateSize = element_UpdateSize + frame.UpdateRaidTargetIndicator = frame_UpdateRaidTargetIndicator return element diff --git a/modules/unitframes/elements/tags.lua b/modules/unitframes/elements/tags.lua index a88b18d3..7a18ff72 100644 --- a/modules/unitframes/elements/tags.lua +++ b/modules/unitframes/elements/tags.lua @@ -47,7 +47,12 @@ local UnitReaction = _G.UnitReaction local UnitRealmRelationship = _G.UnitRealmRelationship -- Mine -local DEBUFF_ICON_TEMPLATE = "|TInterface\\RaidFrame\\Raid-Icon-Debuff%s:0:0:0:0:16:16:2:14:2:14|t" +local DEBUFF_ICONS = { + ["Curse"] = "|TInterface\\AddOns\\ls_UI\\assets\\unit-frame-aura-icons:0:0:0:0:128:128:67:99:1:33|t", + ["Disease"] = "|TInterface\\AddOns\\ls_UI\\assets\\unit-frame-aura-icons:0:0:0:0:128:128:1:33:34:66|t", + ["Magic"] = "|TInterface\\AddOns\\ls_UI\\assets\\unit-frame-aura-icons:0:0:0:0:128:128:34:66:34:66|t", + ["Poison"] = "|TInterface\\AddOns\\ls_UI\\assets\\unit-frame-aura-icons:0:0:0:0:128:128:67:99:34:66|t", +} local SHEEPABLE_TYPES = { ["Beast"] = true, ["Bestia"] = true, @@ -591,7 +596,7 @@ oUF.Tags.Methods["ls:debuffs"] = function(unit) if name then if types[type] and not hasDebuff[type] then - status = status .. DEBUFF_ICON_TEMPLATE:format(type) + status = status .. DEBUFF_ICONS[type] hasDebuff[type] = true end else diff --git a/modules/unitframes/elements/threatindicator.lua b/modules/unitframes/elements/threatindicator.lua index 70a73145..a6082577 100644 --- a/modules/unitframes/elements/threatindicator.lua +++ b/modules/unitframes/elements/threatindicator.lua @@ -3,6 +3,11 @@ local E, C, M, L, P = ns.E, ns.C, ns.M, ns.L, ns.P local UF = P:GetModule("UnitFrames") -- Mine +local function element_UpdateConfig(self) + local unit = self.__owner._unit + self._config = E:CopyTable(C.db.profile.units[unit].threat, self._config) +end + local function element_PostUpdate(self, _, status) if status and status == 0 then self:SetVertexColor(M.COLORS.THREAT[1]:GetRGB()) @@ -11,14 +16,14 @@ local function element_PostUpdate(self, _, status) end local function frame_UpdateThreatIndicator(self) - local config = self._config.threat local element = self.ThreatIndicator + element:UpdateConfig() - element.feedbackUnit = config.feedback_unit + element.feedbackUnit = element._config.feedback_unit - if config.enabled and not self:IsElementEnabled("ThreatIndicator") then + if element._config.enabled and not self:IsElementEnabled("ThreatIndicator") then self:EnableElement("ThreatIndicator") - elseif not config.enabled and self:IsElementEnabled("ThreatIndicator") then + elseif not element._config.enabled and self:IsElementEnabled("ThreatIndicator") then self:DisableElement("ThreatIndicator") end @@ -40,6 +45,7 @@ function UF:CreateThreatIndicator(frame, parent, isTexture) end element.PostUpdate = element_PostUpdate + element.UpdateConfig = element_UpdateConfig frame.UpdateThreatIndicator = frame_UpdateThreatIndicator diff --git a/modules/unitframes/units/boss.lua b/modules/unitframes/units/boss.lua index 997bc486..a20ae0f1 100644 --- a/modules/unitframes/units/boss.lua +++ b/modules/unitframes/units/boss.lua @@ -104,7 +104,7 @@ function UF:CreateBossFrame(frame) frame.HealthPrediction = self:CreateHealthPrediction(frame, health, textParent) - local power = self:CreatePower(frame, true, "LSFont12_Shadow", textParent) + local power = self:CreatePower(frame, textParent) power:SetFrameLevel(level + 1) power:SetPoint("LEFT", frame, "LEFT", 0, 0) power:SetPoint("RIGHT", frame, "RIGHT", 0, 0) @@ -124,7 +124,7 @@ function UF:CreateBossFrame(frame) end end - local altPower = self:CreateAlternativePower(frame, true, "LSFont12_Shadow", textParent) + local altPower = self:CreateAlternativePower(frame, textParent) altPower:SetFrameLevel(level + 1) altPower:SetPoint("LEFT", frame, "LEFT", 0, 0) altPower:SetPoint("RIGHT", frame, "RIGHT", 0, 0) @@ -147,7 +147,7 @@ function UF:CreateBossFrame(frame) frame.Castbar = self:CreateCastbar(frame) frame.Castbar.Holder:SetPoint("TOPLEFT", frame, "BOTTOMLEFT", 3, -6) - frame.Name = self:CreateName(frame, "LSFont12_Shadow", textParent) + frame.Name = self:CreateName(frame, textParent) frame.RaidTargetIndicator = self:CreateRaidTargetIndicator(frame, textParent) @@ -163,6 +163,8 @@ function UF:CreateBossFrame(frame) border:SetOffset(-6) frame.Border = border + frame.ClassIndicator = self:CreateClassIndicator(frame) + local glass = textureParent:CreateTexture(nil, "OVERLAY", nil, 0) glass:SetAllPoints(health) glass:SetTexture("Interface\\AddOns\\ls_UI\\assets\\statusbar-glass") @@ -171,8 +173,6 @@ function UF:CreateBossFrame(frame) shadow:SetAllPoints(health) shadow:SetTexture("Interface\\AddOns\\ls_UI\\assets\\statusbar-glass-shadow") - self:CreateClassIndicator(frame) - frame.Update = frame_Update isInit = true diff --git a/modules/unitframes/units/focus.lua b/modules/unitframes/units/focus.lua index 5891d943..1f441a62 100644 --- a/modules/unitframes/units/focus.lua +++ b/modules/unitframes/units/focus.lua @@ -75,7 +75,7 @@ function UF:CreateFocusFrame(frame) frame.HealthPrediction = self:CreateHealthPrediction(frame, health, textParent) - local power = self:CreatePower(frame, true, "LSFont12_Shadow", textParent) + local power = self:CreatePower(frame, textParent) power:SetFrameLevel(level + 1) power:SetPoint("LEFT", frame, "LEFT", 0, 0) power:SetPoint("RIGHT", frame, "RIGHT", 0, 0) @@ -97,7 +97,7 @@ function UF:CreateFocusFrame(frame) frame.Castbar = self:CreateCastbar(frame) - frame.Name = self:CreateName(frame, "LSFont12_Shadow", textParent) + frame.Name = self:CreateName(frame, textParent) frame.RaidTargetIndicator = self:CreateRaidTargetIndicator(frame, textParent) @@ -105,13 +105,13 @@ function UF:CreateFocusFrame(frame) frame.PvPIndicator = pvp pvp.Holder.PostExpand = function() - if not frame._config.castbar.detached then + if not frame.Castbar._config.detached then frame.Castbar.Holder:SetWidth(frame.Castbar.Holder._width - 52) end end pvp.Holder.PostCollapse = function() - if not frame._config.castbar.detached then + if not frame.Castbar._config.detached then frame.Castbar.Holder:SetWidth(frame.Castbar.Holder._width) end end @@ -133,6 +133,8 @@ function UF:CreateFocusFrame(frame) border:SetOffset(-6) frame.Border = border + frame.ClassIndicator = self:CreateClassIndicator(frame) + local glass = textureParent:CreateTexture(nil, "OVERLAY", nil, 0) glass:SetAllPoints(health) glass:SetTexture("Interface\\AddOns\\ls_UI\\assets\\statusbar-glass") @@ -141,8 +143,6 @@ function UF:CreateFocusFrame(frame) shadow:SetAllPoints(health) shadow:SetTexture("Interface\\AddOns\\ls_UI\\assets\\statusbar-glass-shadow") - self:CreateClassIndicator(frame) - frame.Update = frame_Update isInit = true diff --git a/modules/unitframes/units/focustarget.lua b/modules/unitframes/units/focustarget.lua index 4cc09a22..51aae23d 100644 --- a/modules/unitframes/units/focustarget.lua +++ b/modules/unitframes/units/focustarget.lua @@ -65,7 +65,7 @@ function UF:CreateFocusTargetFrame(frame) frame.HealthPrediction = self:CreateHealthPrediction(frame, health, textParent) - local power = self:CreatePower(frame, true, "LSFont12_Shadow", textParent) + local power = self:CreatePower(frame, textParent) power:SetFrameLevel(level + 1) power:SetPoint("LEFT", frame, "LEFT", 0, 0) power:SetPoint("RIGHT", frame, "RIGHT", 0, 0) @@ -85,7 +85,7 @@ function UF:CreateFocusTargetFrame(frame) end end - frame.Name = self:CreateName(frame, "LSFont12_Shadow", textParent) + frame.Name = self:CreateName(frame, textParent) frame.RaidTargetIndicator = self:CreateRaidTargetIndicator(frame, textParent) @@ -102,6 +102,8 @@ function UF:CreateFocusTargetFrame(frame) border:SetOffset(-6) frame.Border = border + frame.ClassIndicator = self:CreateClassIndicator(frame) + local glass = textureParent:CreateTexture(nil, "OVERLAY", nil, 0) glass:SetAllPoints(health) glass:SetTexture("Interface\\AddOns\\ls_UI\\assets\\statusbar-glass") @@ -110,7 +112,5 @@ function UF:CreateFocusTargetFrame(frame) shadow:SetAllPoints(health) shadow:SetTexture("Interface\\AddOns\\ls_UI\\assets\\statusbar-glass-shadow") - self:CreateClassIndicator(frame) - frame.Update = frame_Update end diff --git a/modules/unitframes/units/pet.lua b/modules/unitframes/units/pet.lua index f3d586cb..90b1f948 100644 --- a/modules/unitframes/units/pet.lua +++ b/modules/unitframes/units/pet.lua @@ -71,7 +71,7 @@ do frame.HealthPrediction = self:CreateHealthPrediction(frame, health, textParent) - local power = self:CreatePower(frame, true, "LSFont12_Shadow", frame) + local power = self:CreatePower(frame, textParent) power:SetFrameLevel(level + 1) power:SetSize(8, 102) power:SetPoint("CENTER", 6, 0) @@ -110,7 +110,7 @@ do E:SetStatusBarSkin(rightTube, "VERTICAL-8") frame.Update = frame_Update - frame.UpdateConfig = frame_UpdateConfig + -- frame.UpdateConfig = frame_UpdateConfig end end @@ -172,7 +172,7 @@ do frame.HealthPrediction = self:CreateHealthPrediction(frame, health, textParent) - local power = self:CreatePower(frame, true, "LSFont12_Shadow", textParent) + local power = self:CreatePower(frame, textParent) power:SetFrameLevel(level + 1) power:SetPoint("LEFT", frame, "LEFT", 0, 0) power:SetPoint("RIGHT", frame, "RIGHT", 0, 0) @@ -195,7 +195,7 @@ do frame.Castbar = self:CreateCastbar(frame) frame.Castbar.Holder:SetPoint("TOPRIGHT", frame, "BOTTOMRIGHT", -3, -6) - frame.Name = self:CreateName(frame, "LSFont12_Shadow", textParent) + frame.Name = self:CreateName(frame, textParent) frame.RaidTargetIndicator = self:CreateRaidTargetIndicator(frame, textParent) @@ -209,6 +209,8 @@ do border:SetOffset(-6) frame.Border = border + frame.ClassIndicator = self:CreateClassIndicator(frame) + local glass = textureParent:CreateTexture(nil, "OVERLAY", nil, 0) glass:SetAllPoints(health) glass:SetTexture("Interface\\AddOns\\ls_UI\\assets\\statusbar-glass") @@ -217,9 +219,7 @@ do shadow:SetAllPoints(health) shadow:SetTexture("Interface\\AddOns\\ls_UI\\assets\\statusbar-glass-shadow") - self:CreateClassIndicator(frame) - frame.Update = frame_Update - frame.UpdateConfig = frame_UpdateConfig + -- frame.UpdateConfig = frame_UpdateConfig end end diff --git a/modules/unitframes/units/player.lua b/modules/unitframes/units/player.lua index 937d7efb..8c54f8ea 100644 --- a/modules/unitframes/units/player.lua +++ b/modules/unitframes/units/player.lua @@ -196,9 +196,10 @@ do healthPrediction.otherBar._texture:AddMaskTexture(mask) healthPrediction.absorbBar.Overlay:AddMaskTexture(mask) healthPrediction.healAbsorbBar._texture:AddMaskTexture(mask) + health.GainLossIndicators.Loss:AddMaskTexture(mask) -- power - local power = self:CreatePower(frame, true, "LSFont14_Shadow", textParent) + local power = self:CreatePower(frame, textParent) power:SetFrameLevel(level + 4) power:SetSize(12, 128) power:SetPoint("RIGHT", -23, 0) @@ -266,9 +267,12 @@ do classPower:SetSize(12, 128) frame.ClassPower = classPower - classPower.UpdateContainer = function(self, isVisible, slots) - leftTube:Refresh(self, isVisible, slots) - end + classPower:HookScript("OnHide", function(self) + leftTube:Refresh(self, false, 0) + end) + classPower:HookScript("OnShow", function(self) + leftTube:Refresh(self, true, self.__max) + end) -- pvp frame.PvPIndicator = self:CreatePvPIndicator(frame, textureParent) @@ -285,7 +289,7 @@ do -- castbar frame.Castbar = self:CreateCastbar(frame) - frame.Name = self:CreateName(frame, "LSFont12_Shadow", textParent) + frame.Name = self:CreateName(frame, textParent) -- status icons/texts local status = textParent:CreateFontString(nil, "OVERLAY", "LSStatusIcon16Font") @@ -319,15 +323,15 @@ do threat:SetPoint("CENTER", 0, 0) frame.ThreatIndicator = threat + frame.ClassIndicator = self:CreateClassIndicator(frame) + local shadow = borderParent:CreateTexture(nil, "BACKGROUND", nil, -1) shadow:SetAllPoints(health) shadow:SetTexture("Interface\\AddOns\\ls_UI\\assets\\statusbar-glass-shadow") shadow:AddMaskTexture(mask) - self:CreateClassIndicator(frame) - frame.Update = frame_Update - frame.UpdateConfig = frame_UpdateConfig + -- frame.UpdateConfig = frame_UpdateConfig isInit = true end @@ -403,14 +407,6 @@ do frame.Insets = self:CreateInsets(frame, textureParent) - local seps = {} - - for i = 1, 9 do - local sep = textureParent:CreateTexture(nil, "ARTWORK", nil, 1) - sep:SetTexture("Interface\\AddOns\\ls_UI\\assets\\statusbar-sep", "REPEAT", "REPEAT") - seps[i] = sep - end - function frame.Insets.Top:Refresh(sender, visible, slots) if (slots == self._slots and visible == self._visible) or (not visible and sender ~= self._sender) then return end @@ -423,26 +419,20 @@ do self:Expand() for i = 1, 9 do - local sep = seps[i] - if i < slots then - sep:SetTexCoord(1 / 32, 25 / 32, 0 / 8, (self:GetHeight() - 2) / 4) - sep:SetPoint("LEFT", sender[i], "RIGHT", -5, 0) - sep:SetSize(24 / 2, self:GetHeight() - 2) - sep:Show() + self.Seps[i]:SetPoint("LEFT", sender[i], "RIGHT", -5, 0) + self.Seps[i]:Show() else - sep:Hide() + self.Seps[i]:Hide() end end else self:Collapse() - - for i = 1, 9 do - seps[i]:Hide() - end end end + frame.Insets.Top:Refresh(nil, false, 0) + -- health local health = self:CreateHealth(frame, textParent) health:SetFrameLevel(level + 1) @@ -456,7 +446,7 @@ do frame.HealthPrediction = self:CreateHealthPrediction(frame, health, textParent) -- power - local power = self:CreatePower(frame, true, "LSFont12_Shadow", textParent) + local power = self:CreatePower(frame, textParent) power:SetFrameLevel(level + 1) power:SetPoint("LEFT", frame, "LEFT", 0, 0) power:SetPoint("RIGHT", frame, "RIGHT", 0, 0) @@ -488,7 +478,6 @@ do addPower:HookScript("OnHide", function(self) frame.Insets.Top:Refresh(self, false, 0) end) - addPower:HookScript("OnShow", function(self) frame.Insets.Top:Refresh(self, true, 1) end) @@ -537,15 +526,18 @@ do classPower:SetPoint("BOTTOM", frame.Insets.Top, "BOTTOM", 0, 2) frame.ClassPower = classPower - classPower.UpdateContainer = function(self, isVisible, slots) - frame.Insets.Top:Refresh(self, isVisible, slots) - end + classPower:HookScript("OnHide", function(self) + frame.Insets.Top:Refresh(self, false, 0) + end) + classPower:HookScript("OnShow", function(self) + frame.Insets.Top:Refresh(self, true, self.__max) + end) -- castbar frame.Castbar = self:CreateCastbar(frame) -- frame.Castbar.Holder:SetPoint("TOPRIGHT", frame, "BOTTOMRIGHT", -3, -6) - frame.Name = self:CreateName(frame, "LSFont12_Shadow", textParent) + frame.Name = self:CreateName(frame, textParent) frame.RaidTargetIndicator = self:CreateRaidTargetIndicator(frame, textParent) @@ -554,13 +546,13 @@ do frame.PvPIndicator = pvp pvp.Holder.PostExpand = function() - if not frame._config.castbar.detached then + if not frame.Castbar._config.detached then frame.Castbar.Holder:SetWidth(frame.Castbar.Holder._width - 52) end end pvp.Holder.PostCollapse = function() - if not frame._config.castbar.detached then + if not frame.Castbar._config.detached then frame.Castbar.Holder:SetWidth(frame.Castbar.Holder._width) end end @@ -597,6 +589,8 @@ do border:SetOffset(-6) frame.Border = border + frame.ClassIndicator = self:CreateClassIndicator(frame) + local glass = textureParent:CreateTexture(nil, "OVERLAY", nil, 0) glass:SetAllPoints(health) glass:SetTexture("Interface\\AddOns\\ls_UI\\assets\\statusbar-glass") @@ -605,10 +599,8 @@ do shadow:SetAllPoints(health) shadow:SetTexture("Interface\\AddOns\\ls_UI\\assets\\statusbar-glass-shadow") - self:CreateClassIndicator(frame) - frame.Update = frame_Update - frame.UpdateConfig = frame_UpdateConfig + -- frame.UpdateConfig = frame_UpdateConfig isInit = true end diff --git a/modules/unitframes/units/target.lua b/modules/unitframes/units/target.lua index 7768a5a8..be264104 100644 --- a/modules/unitframes/units/target.lua +++ b/modules/unitframes/units/target.lua @@ -75,7 +75,7 @@ function UF:CreateTargetFrame(frame) frame.HealthPrediction = self:CreateHealthPrediction(frame, health, textParent) - local power = self:CreatePower(frame, true, "LSFont12_Shadow", textParent) + local power = self:CreatePower(frame, textParent) power:SetFrameLevel(level + 1) power:SetPoint("LEFT", frame, "LEFT", 0, 0) power:SetPoint("RIGHT", frame, "RIGHT", 0, 0) @@ -97,7 +97,7 @@ function UF:CreateTargetFrame(frame) frame.Castbar = self:CreateCastbar(frame) - frame.Name = self:CreateName(frame, "LSFont12_Shadow", textParent) + frame.Name = self:CreateName(frame, textParent) frame.RaidTargetIndicator = self:CreateRaidTargetIndicator(frame, textParent) @@ -105,13 +105,13 @@ function UF:CreateTargetFrame(frame) frame.PvPIndicator = pvp pvp.Holder.PostExpand = function() - if not frame._config.castbar.detached then + if not frame.Castbar._config.detached then frame.Castbar.Holder:SetWidth(frame.Castbar.Holder._width - 52) end end pvp.Holder.PostCollapse = function() - if not frame._config.castbar.detached then + if not frame.Castbar._config.detached then frame.Castbar.Holder:SetWidth(frame.Castbar.Holder._width) end end @@ -133,6 +133,8 @@ function UF:CreateTargetFrame(frame) border:SetOffset(-6) frame.Border = border + frame.ClassIndicator = self:CreateClassIndicator(frame) + local glass = textureParent:CreateTexture(nil, "OVERLAY", nil, 0) glass:SetAllPoints(health) glass:SetTexture("Interface\\AddOns\\ls_UI\\assets\\statusbar-glass") @@ -141,8 +143,6 @@ function UF:CreateTargetFrame(frame) shadow:SetAllPoints(health) shadow:SetTexture("Interface\\AddOns\\ls_UI\\assets\\statusbar-glass-shadow") - self:CreateClassIndicator(frame) - frame.Update = frame_Update isInit = true diff --git a/modules/unitframes/units/targettarget.lua b/modules/unitframes/units/targettarget.lua index 571fe410..eb831ffd 100644 --- a/modules/unitframes/units/targettarget.lua +++ b/modules/unitframes/units/targettarget.lua @@ -65,7 +65,7 @@ function UF:CreateTargetTargetFrame(frame) frame.HealthPrediction = self:CreateHealthPrediction(frame, health, textParent) - local power = self:CreatePower(frame, true, "LSFont12_Shadow", textParent) + local power = self:CreatePower(frame, textParent) power:SetFrameLevel(level + 1) power:SetPoint("LEFT", frame, "LEFT", 0, 0) power:SetPoint("RIGHT", frame, "RIGHT", 0, 0) @@ -85,7 +85,7 @@ function UF:CreateTargetTargetFrame(frame) end end - frame.Name = self:CreateName(frame, "LSFont12_Shadow", textParent) + frame.Name = self:CreateName(frame, textParent) frame.RaidTargetIndicator = self:CreateRaidTargetIndicator(frame, textParent) @@ -102,6 +102,8 @@ function UF:CreateTargetTargetFrame(frame) border:SetOffset(-6) frame.Border = border + frame.ClassIndicator = self:CreateClassIndicator(frame) + local glass = textureParent:CreateTexture(nil, "OVERLAY", nil, 0) glass:SetAllPoints(health) glass:SetTexture("Interface\\AddOns\\ls_UI\\assets\\statusbar-glass") @@ -110,7 +112,5 @@ function UF:CreateTargetTargetFrame(frame) shadow:SetAllPoints(health) shadow:SetTexture("Interface\\AddOns\\ls_UI\\assets\\statusbar-glass-shadow") - self:CreateClassIndicator(frame) - frame.Update = frame_Update end From 832f07a2d3f05e920fdb0d18bf5812e11c494b0e Mon Sep 17 00:00:00 2001 From: Val Voronov Date: Wed, 17 Oct 2018 16:14:49 +0700 Subject: [PATCH 12/17] Reworked gain/loss indicators --- config/unitframes.lua | 156 ++++++++-------- core/statusbar.lua | 198 ++++++++++++--------- modules/unitframes/elements/classpower.lua | 11 +- modules/unitframes/elements/health.lua | 14 +- modules/unitframes/elements/power.lua | 39 ++-- 5 files changed, 218 insertions(+), 200 deletions(-) diff --git a/config/unitframes.lua b/config/unitframes.lua index f14216b1..00ea73f6 100644 --- a/config/unitframes.lua +++ b/config/unitframes.lua @@ -252,25 +252,25 @@ local function getUFOption_Health(order, unit) type = "description", name = " ", }, - -- change_threshold = { - -- order = 20, - -- type = "input", - -- name = L["GAIN_LOSS_THRESHOLD"], - -- desc = L["GAIN_LOSS_THRESHOLD_DESC"], - -- get = function() - -- return tostring(C.db.profile.units[unit].health.change_threshold * 100) - -- end, - -- set = function(_, value) - -- C.db.profile.units[unit].health.change_threshold = E:Clamp((tonumber(value) or 0.1) / 100, 0.001, 1) - -- UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateConfig") - -- UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateGainLossThreshold") - -- end, - -- }, - -- spacer_3 = { - -- order = 29, - -- type = "description", - -- name = " ", - -- }, + change_threshold = { + order = 20, + type = "input", + name = L["GAIN_LOSS_THRESHOLD"], + desc = L["GAIN_LOSS_THRESHOLD_DESC"], + get = function() + return tostring(C.db.profile.units[unit].health.change_threshold * 100) + end, + set = function(_, value) + C.db.profile.units[unit].health.change_threshold = E:Clamp((tonumber(value) or 0.1) / 100, 0.001, 1) + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Health", "UpdateGainLossThreshold") + end, + }, + spacer_3 = { + order = 29, + type = "description", + name = " ", + }, text = { order = 30, type = "group", @@ -710,25 +710,25 @@ local function getUFOption_Power(order, unit) type = "description", name = " ", }, - -- change_threshold = { - -- order = 10, - -- type = "input", - -- name = L["GAIN_LOSS_THRESHOLD"], - -- desc = L["GAIN_LOSS_THRESHOLD_DESC"], - -- get = function() - -- return tostring(C.db.profile.units[unit].power.change_threshold * 100) - -- end, - -- set = function(_, value) - -- C.db.profile.units[unit].power.change_threshold = E:Clamp((tonumber(value) or 0.1) / 100, 0.001, 1) - -- UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Power", "UpdateConfig") - -- UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Power", "UpdateGainLossThreshold") - -- end, - -- }, - -- spacer_2 = { - -- order = 19, - -- type = "description", - -- name = " ", - -- }, + change_threshold = { + order = 10, + type = "input", + name = L["GAIN_LOSS_THRESHOLD"], + desc = L["GAIN_LOSS_THRESHOLD_DESC"], + get = function() + return tostring(C.db.profile.units[unit].power.change_threshold * 100) + end, + set = function(_, value) + C.db.profile.units[unit].power.change_threshold = E:Clamp((tonumber(value) or 0.1) / 100, 0.001, 1) + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Power", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Power", "UpdateGainLossThreshold") + end, + }, + spacer_2 = { + order = 19, + type = "description", + name = " ", + }, text = { order = 20, type = "group", @@ -910,25 +910,25 @@ local function getUFOption_AlternativePower(order, unit) type = "description", name = " ", }, - -- change_threshold = { - -- order = 10, - -- type = "input", - -- name = L["GAIN_LOSS_THRESHOLD"], - -- desc = L["GAIN_LOSS_THRESHOLD_DESC"], - -- get = function() - -- return tostring(C.db.profile.units[unit].alt_power.change_threshold * 100) - -- end, - -- set = function(_, value) - -- C.db.profile.units[unit].alt_power.change_threshold = E:Clamp((tonumber(value) or 0.1) / 100, 0.001, 1) - -- UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "AlternativePower", "UpdateConfig") - -- UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "AlternativePower", "UpdateGainLossThreshold") - -- end, - -- }, - -- spacer_2 = { - -- order = 19, - -- type = "description", - -- name = " ", - -- }, + change_threshold = { + order = 10, + type = "input", + name = L["GAIN_LOSS_THRESHOLD"], + desc = L["GAIN_LOSS_THRESHOLD_DESC"], + get = function() + return tostring(C.db.profile.units[unit].alt_power.change_threshold * 100) + end, + set = function(_, value) + C.db.profile.units[unit].alt_power.change_threshold = E:Clamp((tonumber(value) or 0.1) / 100, 0.001, 1) + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "AlternativePower", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "AlternativePower", "UpdateGainLossThreshold") + end, + }, + spacer_2 = { + order = 19, + type = "description", + name = " ", + }, text = { order = 20, type = "group", @@ -1092,27 +1092,27 @@ local function getUFOption_ClassPower(order, unit) type = "description", name = " ", }, - -- change_threshold = { - -- order = 10, - -- type = "input", - -- name = L["GAIN_LOSS_THRESHOLD"], - -- desc = L["GAIN_LOSS_THRESHOLD_DESC"], - -- get = function() - -- return tostring(C.db.profile.units[unit].class_power.change_threshold * 100) - -- end, - -- set = function(_, value) - -- C.db.profile.units[unit].class_power.change_threshold = E:Clamp((tonumber(value) or 0.1) / 100, 0.001, 1) - -- UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Stagger", "UpdateConfig") - -- UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Stagger", "UpdateGainLossThreshold") - -- UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "AdditionalPower", "UpdateConfig") - -- UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "AdditionalPower", "UpdateGainLossThreshold") - -- end, - -- }, - -- spacer_2 = { - -- order = 19, - -- type = "description", - -- name = " ", - -- }, + change_threshold = { + order = 10, + type = "input", + name = L["GAIN_LOSS_THRESHOLD"], + desc = L["GAIN_LOSS_THRESHOLD_DESC"], + get = function() + return tostring(C.db.profile.units[unit].class_power.change_threshold * 100) + end, + set = function(_, value) + C.db.profile.units[unit].class_power.change_threshold = E:Clamp((tonumber(value) or 0.1) / 100, 0.001, 1) + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Stagger", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "Stagger", "UpdateGainLossThreshold") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "AdditionalPower", "UpdateConfig") + UNITFRAMES:UpdateUnitFrame(unit, "ForElement", "AdditionalPower", "UpdateGainLossThreshold") + end, + }, + spacer_2 = { + order = 19, + type = "description", + name = " ", + }, prediction = { order = 20, type = "toggle", diff --git a/core/statusbar.lua b/core/statusbar.lua index e277004c..51b57862 100644 --- a/core/statusbar.lua +++ b/core/statusbar.lua @@ -457,136 +457,168 @@ do end do - local function attachGainToVerticalBar(object, prev, max) - local offset = object:GetHeight() * (1 - E:Clamp(prev / max)) + local function clamp(v, min, max) + return m_min(max or 1, m_max(min or 0, v)) + end - object.Gain:SetPoint("BOTTOMLEFT", object, "TOPLEFT", 0, -offset) - object.Gain:SetPoint("BOTTOMRIGHT", object, "TOPRIGHT", 0, -offset) + local function attachGainToVerticalBar(self, object, prev, max) + local offset = object:GetHeight() * (1 - clamp(prev / max)) + + self:SetPoint("BOTTOMLEFT", object, "TOPLEFT", 0, -offset) + self:SetPoint("BOTTOMRIGHT", object, "TOPRIGHT", 0, -offset) end - local function attachLossToVerticalBar(object, prev, max) - local offset = object:GetHeight() * (1 - E:Clamp(prev / max)) + local function attachLossToVerticalBar(self, object, prev, max) + local offset = object:GetHeight() * (1 - clamp(prev / max)) - object.Loss:SetPoint("TOPLEFT", object, "TOPLEFT", 0, -offset) - object.Loss:SetPoint("TOPRIGHT", object, "TOPRIGHT", 0, -offset) + self:SetPoint("TOPLEFT", object, "TOPLEFT", 0, -offset) + self:SetPoint("TOPRIGHT", object, "TOPRIGHT", 0, -offset) end - local function attachGainToHorizontalBar(object, prev, max) - local offset = object:GetWidth() * (1 - E:Clamp(prev / max)) + local function attachGainToHorizontalBar(self, object, prev, max) + local offset = object:GetWidth() * (1 - clamp(prev / max)) - object.Gain:SetPoint("TOPLEFT", object, "TOPRIGHT", -offset, 0) - object.Gain:SetPoint("BOTTOMLEFT", object, "BOTTOMRIGHT", -offset, 0) + self:SetPoint("TOPLEFT", object, "TOPRIGHT", -offset, 0) + self:SetPoint("BOTTOMLEFT", object, "BOTTOMRIGHT", -offset, 0) end - local function attachLossToHorizontalBar(object, prev, max) - local offset = object:GetWidth() * (1 - E:Clamp(prev / max)) + local function attachLossToHorizontalBar(self, object, prev, max) + local offset = object:GetWidth() * (1 - clamp(prev / max)) - object.Loss:SetPoint("TOPRIGHT", object, "TOPRIGHT", -offset, 0) - object.Loss:SetPoint("BOTTOMRIGHT", object, "BOTTOMRIGHT", -offset, 0) + self:SetPoint("TOPRIGHT", object, "TOPRIGHT", -offset, 0) + self:SetPoint("BOTTOMRIGHT", object, "BOTTOMRIGHT", -offset, 0) end - local function object_UpdateGainLoss(object, cur, max, condition) - if max ~= 0 and (condition == nil or condition) then - local prev = object._prev or 0 + local function update(self, cur, max, condition) + if max and max ~= 0 and (condition == nil or condition) then + local prev = (self._prev or cur) * max / (self._max or max) local diff = cur - prev - if m_abs(diff) / max < 0.1 then + if m_abs(diff) / max < self.threshold then diff = 0 end if diff > 0 then - if object.Gain:GetAlpha() == 0 then - object.Gain:SetAlpha(1) + if self.Gain and self.Gain:GetAlpha() == 0 then + self.Gain:SetAlpha(1) - if object:GetOrientation() == "VERTICAL" then - attachGainToVerticalBar(object, prev, max) + if self.orientation == "VERTICAL" then + attachGainToVerticalBar(self.Gain, self.__owner, prev, max) else - attachGainToHorizontalBar(object, prev, max) + attachGainToHorizontalBar(self.Gain, self.__owner, prev, max) end - object.Gain.FadeOut:Play() + self.Gain.FadeOut:Play() end elseif diff < 0 then - object.Gain.FadeOut:Stop() - object.Gain:SetAlpha(0) + if self.Gain then + self.Gain.FadeOut:Stop() + self.Gain:SetAlpha(0) + end - if object.Loss:GetAlpha() == 0 then - object.Loss:SetAlpha(1) + if self.Loss then + if self.Loss:GetAlpha() <= 0.33 then + self.Loss:SetAlpha(1) - if object:GetOrientation() == "VERTICAL" then - attachLossToVerticalBar(object, prev, max) - else - attachLossToHorizontalBar(object, prev, max) - end + if self.orientation == "VERTICAL" then + attachLossToVerticalBar(self.Loss, self.__owner, prev, max) + else + attachLossToHorizontalBar(self.Loss, self.__owner, prev, max) + end - object.Loss.FadeOut:Play() + self.Loss.FadeOut:Restart() + elseif self.Loss.FadeOut.Alpha:IsDelaying() or self.Loss:GetAlpha() >= 0.66 then + self.Loss.FadeOut:Restart() + end end end else - object.Gain.FadeOut:Stop() - object.Gain:SetAlpha(0) + if self.Gain then + self.Gain.FadeOut:Stop() + self.Gain:SetAlpha(0) + end - object.Loss.FadeOut:Stop() - object.Loss:SetAlpha(0) + if self.Loss then + self.Loss.FadeOut:Stop() + self.Loss:SetAlpha(0) + end end - object._prev = cur + if max and max ~= 0 then + self._prev = cur + self._max = max + else + self._prev = nil + self._max = nil + end end - function E.CreateGainLossIndicators(_, object) + local function updatePoints(self, orientation) + orientation = orientation or "HORIZONTAL" + if orientation == "HORIZONTAL" then + self.Gain_:ClearAllPoints() + self.Gain_:SetPoint("TOPRIGHT", self.__owner:GetStatusBarTexture(), "TOPRIGHT", 0, 0) + self.Gain_:SetPoint("BOTTOMRIGHT", self.__owner:GetStatusBarTexture(), "BOTTOMRIGHT", 0, 0) + + self.Loss_:ClearAllPoints() + self.Loss_:SetPoint("TOPLEFT", self.__owner:GetStatusBarTexture(), "TOPRIGHT", 0, 0) + self.Loss_:SetPoint("BOTTOMLEFT", self.__owner:GetStatusBarTexture(), "BOTTOMRIGHT", 0, 0) + else + self.Gain_:ClearAllPoints() + self.Gain_:SetPoint("TOPLEFT", self.__owner:GetStatusBarTexture(), "TOPLEFT", 0, 0) + self.Gain_:SetPoint("TOPRIGHT", self.__owner:GetStatusBarTexture(), "TOPRIGHT", 0, 0) + + self.Loss_:ClearAllPoints() + self.Loss_:SetPoint("BOTTOMLEFT", self.__owner:GetStatusBarTexture(), "TOPLEFT", 0, 0) + self.Loss_:SetPoint("BOTTOMRIGHT", self.__owner:GetStatusBarTexture(), "TOPRIGHT", 0, 0) + end + + self.orientation = orientation + end + + function E:CreateGainLossIndicators(object) local gainTexture = object:CreateTexture(nil, "ARTWORK", nil, 1) - gainTexture:SetColorTexture(M.COLORS.LIGHT_GREEN:GetRGB()) + gainTexture:SetColorTexture(0.47, 0.88, 0.42) gainTexture:SetAlpha(0) - object.Gain = gainTexture - - local lossTexture = object:CreateTexture(nil, "BACKGROUND") - lossTexture:SetColorTexture(M.COLORS.DARK_RED:GetRGB()) - lossTexture:SetAlpha(0) - object.Loss = lossTexture local ag = gainTexture:CreateAnimationGroup() ag:SetToFinalAlpha(true) gainTexture.FadeOut = ag - local anim1 = ag:CreateAnimation("Alpha") - anim1:SetOrder(1) - anim1:SetFromAlpha(1) - anim1:SetToAlpha(0) - anim1:SetStartDelay(0.6) - anim1:SetDuration(0.2) + local anim = ag:CreateAnimation("Alpha") + anim:SetOrder(1) + anim:SetFromAlpha(1) + anim:SetToAlpha(0) + anim:SetStartDelay(0.25) + anim:SetDuration(0.1) + ag.Alpha = anim + + local lossTexture = object:CreateTexture(nil, "BACKGROUND") + lossTexture:SetColorTexture(0.55, 0.11, 0.13) + lossTexture:SetAlpha(0) ag = lossTexture:CreateAnimationGroup() ag:SetToFinalAlpha(true) lossTexture.FadeOut = ag - anim1 = ag:CreateAnimation("Alpha") - anim1:SetOrder(1) - anim1:SetFromAlpha(1) - anim1:SetToAlpha(0) - anim1:SetStartDelay(0.6) - anim1:SetDuration(0.2) - - object.UpdateGainLoss = object_UpdateGainLoss - end - - function E.ReanchorGainLossIndicators(_, object, orientation) - if orientation == "HORIZONTAL" then - object.Gain:ClearAllPoints() - object.Gain:SetPoint("TOPRIGHT", object:GetStatusBarTexture(), "TOPRIGHT", 0, 0) - object.Gain:SetPoint("BOTTOMRIGHT", object:GetStatusBarTexture(), "BOTTOMRIGHT", 0, 0) - - object.Loss:ClearAllPoints() - object.Loss:SetPoint("TOPLEFT", object:GetStatusBarTexture(), "TOPRIGHT", 0, 0) - object.Loss:SetPoint("BOTTOMLEFT", object:GetStatusBarTexture(), "BOTTOMRIGHT", 0, 0) - else - object.Gain:ClearAllPoints() - object.Gain:SetPoint("TOPLEFT", object:GetStatusBarTexture(), "TOPLEFT", 0, 0) - object.Gain:SetPoint("TOPRIGHT", object:GetStatusBarTexture(), "TOPRIGHT", 0, 0) - - object.Loss:ClearAllPoints() - object.Loss:SetPoint("BOTTOMLEFT", object:GetStatusBarTexture(), "TOPLEFT", 0, 0) - object.Loss:SetPoint("BOTTOMRIGHT", object:GetStatusBarTexture(), "TOPRIGHT", 0, 0) - end + anim = ag:CreateAnimation("Alpha") + anim:SetOrder(1) + anim:SetFromAlpha(1) + anim:SetToAlpha(0) + anim:SetStartDelay(0.25) + anim:SetDuration(0.1) + ag.Alpha = anim + + return { + __owner = object, + threshold = 0.01, + Gain = gainTexture, + Gain_ = gainTexture, + Loss = lossTexture, + Loss_ = lossTexture, + Update = update, + UpdatePoints = updatePoints, + } end end diff --git a/modules/unitframes/elements/classpower.lua b/modules/unitframes/elements/classpower.lua index 4dd65063..e3637d52 100644 --- a/modules/unitframes/elements/classpower.lua +++ b/modules/unitframes/elements/classpower.lua @@ -330,8 +330,7 @@ do element:SetValue(cur) element:SetStatusBarColor(r, g, b) - element:UpdateGainLoss(cur, max) - -- element.GainLossIndicators:Update(cur, max) + element.GainLossIndicators:Update(cur, max) end local function element_UpdateConfig(self) @@ -348,9 +347,8 @@ do element:UpdateConfig() element:SetOrientation(element._config.orientation) - E:ReanchorGainLossIndicators(element, element._config.orientation) - -- element.GainLossIndicators:UpdatePoints(element._config.orientation) - -- element:UpdateGainLossThreshold() + element.GainLossIndicators:UpdatePoints(element._config.orientation) + element:UpdateGainLossThreshold() if element._config.enabled and not self:IsElementEnabled("Stagger") then self:EnableElement("Stagger") @@ -371,8 +369,7 @@ do E:SmoothBar(element) element:Hide() - E:CreateGainLossIndicators(element) - -- element.GainLossIndicators = E:CreateGainLossIndicators(element) + element.GainLossIndicators = E:CreateGainLossIndicators(element) element.Override = element_Override element.UpdateConfig = element_UpdateConfig diff --git a/modules/unitframes/elements/health.lua b/modules/unitframes/elements/health.lua index 6d51c6cd..3ce2c0ea 100644 --- a/modules/unitframes/elements/health.lua +++ b/modules/unitframes/elements/health.lua @@ -58,9 +58,9 @@ do end local function element_PostUpdate(self, unit, cur, max) - -- local unitGUID = UnitGUID(unit) - -- self.GainLossIndicators:Update(cur, max, unitGUID == self.GainLossIndicators._UnitGUID) - -- self.GainLossIndicators._UnitGUID = unitGUID + local unitGUID = UnitGUID(unit) + self.GainLossIndicators:Update(cur, max, unitGUID == self.GainLossIndicators._UnitGUID) + self.GainLossIndicators._UnitGUID = unitGUID if not (self:IsShown() and max and max ~= 0) or not UnitIsConnected(unit) or UnitIsDeadOrGhost(unit) then self:SetMinMaxValues(0, 1) @@ -104,8 +104,8 @@ do element:UpdateTextPoints() element:UpdateTags() - -- element.GainLossIndicators:UpdatePoints(element._config.orientation) - -- element:UpdateGainLossThreshold() + element.GainLossIndicators:UpdatePoints(element._config.orientation) + element:UpdateGainLossThreshold() element:ForceUpdate() end @@ -122,8 +122,8 @@ do element.Text = (textParent or element):CreateFontString(nil, "ARTWORK", "LSFont12") - -- element.GainLossIndicators = E:CreateGainLossIndicators(element) - -- element.GainLossIndicators.Gain = nil + element.GainLossIndicators = E:CreateGainLossIndicators(element) + element.GainLossIndicators.Gain = nil element.colorHealth = true element.colorTapping = true diff --git a/modules/unitframes/elements/power.lua b/modules/unitframes/elements/power.lua index 1e54728e..5a59ca90 100644 --- a/modules/unitframes/elements/power.lua +++ b/modules/unitframes/elements/power.lua @@ -77,10 +77,8 @@ do end local unitGUID = UnitGUID(unit) - self:UpdateGainLoss(cur, max, unitGUID == self._UnitGUID) - self._UnitGUID = unitGUID - -- self.GainLossIndicators:Update(cur, max, unitGUID == self.GainLossIndicators._UnitGUID) - -- self.GainLossIndicators._UnitGUID = unitGUID + self.GainLossIndicators:Update(cur, max, unitGUID == self.GainLossIndicators._UnitGUID) + self.GainLossIndicators._UnitGUID = unitGUID if shouldShown then self.Text:Show() @@ -107,9 +105,8 @@ do element:UpdateTextPoints() element:UpdateTags() - E:ReanchorGainLossIndicators(element, element._config.orientation) - -- element.GainLossIndicators:UpdatePoints(element._config.orientation) - -- element:UpdateGainLossThreshold() + element.GainLossIndicators:UpdatePoints(element._config.orientation) + element:UpdateGainLossThreshold() if element._config.enabled and not self:IsElementEnabled("Power") then self:EnableElement("Power") @@ -131,8 +128,7 @@ do element.Text = (textParent or element):CreateFontString(nil, "ARTWORK", "LSFont12") - E:CreateGainLossIndicators(element) - -- element.GainLossIndicators = E:CreateGainLossIndicators(element) + element.GainLossIndicators = E:CreateGainLossIndicators(element) element.colorDisconnected = true element.colorPower = true @@ -154,8 +150,7 @@ end do local function element_PostUpdate(self, unit, cur, max) if self:IsShown() and max and max ~= 0 then - self:UpdateGainLoss(cur, max) - -- self.GainLossIndicators:Update(cur, max) + self.GainLossIndicators:Update(cur, max) end if not UnitIsConnected(unit) or UnitIsDeadOrGhost(unit) then @@ -174,9 +169,8 @@ do element:UpdateConfig() element:SetOrientation(element._config.orientation) - E:ReanchorGainLossIndicators(element, element._config.orientation) - -- element.GainLossIndicators:UpdatePoints(element._config.orientation) - -- element:UpdateGainLossThreshold() + element.GainLossIndicators:UpdatePoints(element._config.orientation) + element:UpdateGainLossThreshold() if element._config.enabled and not frame:IsElementEnabled("AdditionalPower") then frame:EnableElement("AdditionalPower") @@ -193,8 +187,7 @@ do E:SmoothBar(element) element:Hide() - E:CreateGainLossIndicators(element) - -- element.GainLossIndicators = E:CreateGainLossIndicators(element) + element.GainLossIndicators = E:CreateGainLossIndicators(element) element.colorPower = true element.PostUpdate = element_PostUpdate @@ -217,10 +210,8 @@ do end local unitGUID = UnitGUID(unit) - self:UpdateGainLoss(cur, max, unitGUID == self._UnitGUID) - self._UnitGUID = unitGUID - -- self.GainLossIndicators:Update(cur, max, unitGUID == self.GainLossIndicators._UnitGUID) - -- self.GainLossIndicators._UnitGUID = unitGUID + self.GainLossIndicators:Update(cur, max, unitGUID == self.GainLossIndicators._UnitGUID) + self.GainLossIndicators._UnitGUID = unitGUID if shouldShown then self.Text:Show() @@ -247,9 +238,8 @@ do element:UpdateTextPoints() element:UpdateTags() - E:ReanchorGainLossIndicators(element, element._config.orientation) - -- element.GainLossIndicators:UpdatePoints(element._config.orientation) - -- element:UpdateGainLossThreshold() + element.GainLossIndicators:UpdatePoints(element._config.orientation) + element:UpdateGainLossThreshold() if element._config.enabled and not self:IsElementEnabled("AlternativePower") then self:EnableElement("AlternativePower") @@ -272,8 +262,7 @@ do element.Text = (textParent or element):CreateFontString(nil, "ARTWORK", "LSFont12") - E:CreateGainLossIndicators(element) - -- element.GainLossIndicators = E:CreateGainLossIndicators(element) + element.GainLossIndicators = E:CreateGainLossIndicators(element) element.PostUpdate = element_PostUpdate element.UpdateConfig = element_UpdateConfig From a7a042e36320bc71059dfa7d00b448281a381ce5 Mon Sep 17 00:00:00 2001 From: Val Voronov Date: Wed, 17 Oct 2018 16:16:19 +0700 Subject: [PATCH 13/17] Improved compatibility w/ Masque Because my UI loads earlier than Masque and uses LibButtonGlow as well, it's causing weird issues :P --- ls_UI.toc | 1 + 1 file changed, 1 insertion(+) diff --git a/ls_UI.toc b/ls_UI.toc index 9b1c18de..73587fbf 100644 --- a/ls_UI.toc +++ b/ls_UI.toc @@ -5,6 +5,7 @@ ## Notes: Yet another UI, but this one is a bit special... ## SavedVariablesPerCharacter: LS_UI_CHAR_CONFIG ## SavedVariables: LS_UI_GLOBAL_CONFIG +## OptionalDeps: Masque embeds\_embeds.xml core\_core.xml From 60905e8fd8a1ff8de2025bef3d49c7b1cae93ead Mon Sep 17 00:00:00 2001 From: Val Voronov Date: Wed, 17 Oct 2018 16:22:20 +0700 Subject: [PATCH 14/17] :lipstick: --- modules/unitframes/elements/debuffindicator.lua | 1 - modules/unitframes/elements/name.lua | 1 - modules/unitframes/elements/pvpindicator.lua | 5 ++--- modules/unitframes/elements/tags.lua | 1 - modules/unitframes/elements/threatindicator.lua | 1 - 5 files changed, 2 insertions(+), 7 deletions(-) diff --git a/modules/unitframes/elements/debuffindicator.lua b/modules/unitframes/elements/debuffindicator.lua index 5664ef9e..a88e9f78 100644 --- a/modules/unitframes/elements/debuffindicator.lua +++ b/modules/unitframes/elements/debuffindicator.lua @@ -63,7 +63,6 @@ function UF:CreateDebuffIndicator(frame, textParent) element:SetNonSpaceWrap(true) element.__owner = frame - element.Preview = element_Preview element.UpdateConfig = element_UpdateConfig element.UpdatePoints = element_UpdatePoints diff --git a/modules/unitframes/elements/name.lua b/modules/unitframes/elements/name.lua index e89e32e4..b5f2a09b 100644 --- a/modules/unitframes/elements/name.lua +++ b/modules/unitframes/elements/name.lua @@ -61,7 +61,6 @@ function UF:CreateName(frame, textParent) local element = (textParent or frame):CreateFontString(nil, "OVERLAY", "LSFont12") element.__owner = frame - element.UpdateConfig = element_UpdateConfig element.UpdateFontObjects = element_UpdateFontObjects element.UpdatePoints = element_UpdatePoints diff --git a/modules/unitframes/elements/pvpindicator.lua b/modules/unitframes/elements/pvpindicator.lua index 036da665..07f807d7 100644 --- a/modules/unitframes/elements/pvpindicator.lua +++ b/modules/unitframes/elements/pvpindicator.lua @@ -159,15 +159,14 @@ function UF:CreatePvPIndicator(frame, parent) local element = holder:CreateTexture(nil, "ARTWORK", nil, 0) element:SetSize(30, 30) + element.Holder = holder local banner = holder:CreateTexture(nil, "ARTWORK", nil, -1) banner:SetSize(50, 54) banner:SetPoint("TOP", element, "TOP", 0, 11) - - element.Holder = holder element.Banner = banner - element.Override = element_Override + element.Override = element_Override element.UpdateConfig = element_UpdateConfig element.UpdatePoints = element_UpdatePoints element.UpdateTags = element_UpdateTags diff --git a/modules/unitframes/elements/tags.lua b/modules/unitframes/elements/tags.lua index 7a18ff72..d034c2de 100644 --- a/modules/unitframes/elements/tags.lua +++ b/modules/unitframes/elements/tags.lua @@ -11,7 +11,6 @@ local LE_REALM_RELATION_VIRTUAL = _G.LE_REALM_RELATION_VIRTUAL local GetPVPTimer = _G.GetPVPTimer local IsPVPTimerRunning = _G.IsPVPTimerRunning local IsResting = _G.IsResting -local SecondsToTimeAbbrev = _G.SecondsToTimeAbbrev local UnitAffectingCombat = _G.UnitAffectingCombat local UnitAlternatePowerInfo = _G.UnitAlternatePowerInfo local UnitBattlePetLevel = _G.UnitBattlePetLevel diff --git a/modules/unitframes/elements/threatindicator.lua b/modules/unitframes/elements/threatindicator.lua index a6082577..7622eac0 100644 --- a/modules/unitframes/elements/threatindicator.lua +++ b/modules/unitframes/elements/threatindicator.lua @@ -34,7 +34,6 @@ end function UF:CreateThreatIndicator(frame, parent, isTexture) local element - if isTexture then element = (parent or frame):CreateTexture(nil, "BACKGROUND", nil, -7) else From b95ff58a38498e83d072a373a8ebdbf3d5f2a65a Mon Sep 17 00:00:00 2001 From: Val Voronov Date: Wed, 17 Oct 2018 17:30:58 +0700 Subject: [PATCH 15/17] Updated embedded oUF --- embeds/oUF | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/embeds/oUF b/embeds/oUF index 1d9dcd9e..ae680577 160000 --- a/embeds/oUF +++ b/embeds/oUF @@ -1 +1 @@ -Subproject commit 1d9dcd9edb2a4dbe67bca031b3677e3c726bd88f +Subproject commit ae68057775a70ea4da15f217c266450fadc0e6c8 From b4f7a8b825f9b37c16d32a4470a1f74f985dfce2 Mon Sep 17 00:00:00 2001 From: Val Voronov Date: Wed, 17 Oct 2018 17:31:14 +0700 Subject: [PATCH 16/17] .toc bump --- ls_UI.toc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ls_UI.toc b/ls_UI.toc index 73587fbf..37e552f4 100644 --- a/ls_UI.toc +++ b/ls_UI.toc @@ -1,6 +1,6 @@ ## Interface: 80000 ## Author: lightspark -## Version: 80000.11 +## Version: 80000.12 ## Title: ls: |cff1a9fc0UI|r ## Notes: Yet another UI, but this one is a bit special... ## SavedVariablesPerCharacter: LS_UI_CHAR_CONFIG From ef66ca8eb670e4e40e935d505757130d34e1fc97 Mon Sep 17 00:00:00 2001 From: Val Voronov Date: Wed, 17 Oct 2018 17:31:32 +0700 Subject: [PATCH 17/17] Updated CHANGELOG --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f668bd31..662211f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # CHANGELOG +## Version 80000.12 + +- Added options to adjust text size, outline, and shadow of various unit frame elements, e.g., + health, power, etc; +- Reworked resource gain/loss animations. Added health loss animations, and options to adjust + health, power, class power, and alternative power gain/loss thresholds; +- Tweaked unit frame border textures; +- Fixed compatibility issues with Masque; +- Updated embeds. + +![Imgur](https://i.imgur.com/3qWfxxS.gif) + ## Version 80000.11 - Added options to adjust auras' count text and aura type icon. It's also possible to display