From cf2633a076446ef407d3abc3a80cfe6cf1b8e82d Mon Sep 17 00:00:00 2001 From: Val Voronov Date: Fri, 23 Oct 2020 21:49:26 +0700 Subject: [PATCH] Add support for multiple phase types --- assets/unit-frame-icons.TGA | Bin 91996 -> 99158 bytes core/constants.lua | 20 ++++++++++---------- core/defaults.lua | 2 +- modules/tooltips/tooltips.lua | 21 ++++++++++----------- 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/assets/unit-frame-icons.TGA b/assets/unit-frame-icons.TGA index bf4bb5fa5ecfc5744a719d1356aea22839761639..4e0520a02c49eccba6bf739e6d8abde215a874fd 100644 GIT binary patch delta 4432 zcmY*d32;6qs>@AmX49h@(@bWw8h&$~cTVQ&Ucvx$#z8>ie9iP8TxHSt5mw+Qy zAj~UZ3zN4O%yntdG$(Z34Vz8YEu0f?vA|-pK}7U`i0cUv9Sac_28$5#4Ns2jAC)aH zEimNyg`?#)k2BP=Xq!m2THuNoNU7B@WUURwZ8ns)=@`0BN3UuPu0#Q=E<5X|BpXHy zyxx&WPM(9*)K&DXruVtZ^3!^ zIKrN3fqvfeSt zpz%uvs*V^a+@>RSf`%ReHqIgom!^nF8SF@wSgPk*tqw#*<)c@x$B>b+4Ov;O$j;tF z?@ee(Pu~bzFt`}e(IsScJcO{({?P+PL)Me>ouZSlP{P36!b0IFS7HMf~$c5eL z-~XU;B{Q>0%>@Dr5eO`xXFlTN?}yu6fUvMcFaM?7u%K_9hLYW3nDj|3rrii&+~r7AP^j`&nohaX1R|0JqI0ZB|BZ%z zb8Sc*WrZ_NKoI`CUhjWpZQ?y+m6=wnj@a0-3Sxuv-p24@=P+QvtLW2b6A}|=Djyw= zBnnX1oPfy4L6i#~SS;f1iGyl`B_$>5REuGUF?&A3_l4j)|1AQSeuC#u zx8Z#K48qnon$Gskgf-Y3+JHP5b+ciwUk+PY6|BB^h3C6=%2_M2bfatJlb4{2J~Fpg zAT)X9YEkT@BrV!zVEhFy9{RQ)W_;ZT3n(l55IH#qk(4wW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WbOH3h@q2bWX;2 zp5=TfieLjOlm;#^1i3VLc{~qhGUVXvNMd@ZK4F2$J6~~GSKBqv?NbV`I=*D~xjTf2 z2dMxRqJnd!X++d4HDfQPWYmcwxEQGMZRRR1KUkpnE~$L!+sa^~Q>_c9>sTD^;*f2* zom}p>bZz*jGar0ibhpYb3p}M$&~a1)GY*CDrmL9QDGA(2(OwcITCAZ&km>e(tNINVW4cR1kW=|mFqqXo9!tC~xo92)cW!mHD6=8#B5t7z;relZAI8iqPN zi!V_FI^8#Mb;T6Amfzxw)+k1a>|1}foR^(FlLc?@eF$9uFy{i{&Dr&=kVjLDC`FYb zOF~Ju7-k(^hP;b2Zs55&i=OgHG5Xm&`blOlcR3W!b$fWIM_mqR{euS&f`6W79;obD z47#3XrypbDENJ6s^JoKU6A2=;nY5v_siw?BqB#_J+TfIoJ$$o^q2hcIq+W>Q9V&Yq z5Ox2<4Z@+cHxW86oMS7&+Iu&bb0A2pmL~#)Ktezvun=GfGz1=d!B1$-@rjruAW3Dx zFwpCU=gVZ!+GnJV?{#&?a%c|TuT+Q-Xe1JZLg7V&@UCwovyovWo=8YUBr*~q#TJ~H zL{1_oku+4h2>tzG{v{J9r5YYyRKb%=B}B}w=LQxF1rNSp*T7jDCAcovvjj0Z9NGkL zf;hpPpiXcn$aC1k+FxuO=4xj={;qHSqyiD5)lhEJ4iG@idaz4iSqV4pE z@HK$$fep|wSj=A#S(j%wi-&>u&Svqb@e}v Cq`89t diff --git a/core/constants.lua b/core/constants.lua index 6877e64b..2a259799 100644 --- a/core/constants.lua +++ b/core/constants.lua @@ -31,12 +31,12 @@ local textures = { ["ALLIANCE"] = {1 / 256, 33 / 256, 34 / 256, 66 / 256}, ["FFA"] = {34 / 256, 66 / 256, 34 / 256, 66 / 256}, ["PHASE"] = {67 / 256, 99 / 256, 34 / 256, 66 / 256}, - ["QUEST"] = {100 / 256, 132 / 256, 34 / 256, 66 / 256}, - ["SHEEP"] = {133 / 256, 165 / 256, 34 / 256, 66 / 256}, - -- ["TEMP"] = {166 / 256, 198 / 256, 34 / 256, 66 / 256}, - -- ["TEMP"] = {199 / 256, 231 / 256, 34 / 256, 66 / 256}, + ["SHARD"] = {100 / 256, 132 / 256, 34 / 256, 66 / 256}, + ["WM"] = {133 / 256, 165 / 256, 34 / 256, 66 / 256}, + ["CHROMIE"] = {166 / 256, 198 / 256, 34 / 256, 66 / 256}, + ["QUEST"] = {199 / 256, 231 / 256, 34 / 256, 66 / 256}, -- third line - -- ["TEMP"] = {1 / 256, 33 / 256, 67 / 256, 99 / 256}, + ["SHEEP"] = {1 / 256, 33 / 256, 67 / 256, 99 / 256}, -- ["TEMP"] = {34 / 256, 66 / 256, 67 / 256, 99 / 256}, -- ["TEMP"] = {67 / 256, 99 / 256, 67 / 256, 99 / 256}, -- ["TEMP"] = {100 / 256, 132 / 256, 67 / 256, 99 / 256}, @@ -89,12 +89,12 @@ local textures = { ["ALLIANCE"] = "|TInterface\\AddOns\\ls_UI\\assets\\unit-frame-icons:%.2f:%.2f:0:0:256:256:1:33:34:66|t", ["FFA"] = "|TInterface\\AddOns\\ls_UI\\assets\\unit-frame-icons:%.2f:%.2f:0:0:256:256:34:66:34:66|t", ["PHASE"] = "|TInterface\\AddOns\\ls_UI\\assets\\unit-frame-icons:%.2f:%.2f:0:0:256:256:67:99:34:66|t", - ["PHASE_WM"] = "|TInterface\\AddOns\\ls_UI\\assets\\unit-frame-icons:%.2f:%.2f:0:0:256:256:100:132:34:66|t", - ["QUEST"] = "|TInterface\\AddOns\\ls_UI\\assets\\unit-frame-icons:%.2f:%.2f:0:0:256:256:133:165:34:66|t", - ["SHEEP"] = "|TInterface\\AddOns\\ls_UI\\assets\\unit-frame-icons:%.2f:%.2f:0:0:256:256:166:198:34:66|t", - -- ["TEMP"] = "|TInterface\\AddOns\\ls_UI\\assets\\unit-frame-icons:%.2f:%.2f:0:0:256:256:199:231:34:66|t", + ["SHARD"] = "|TInterface\\AddOns\\ls_UI\\assets\\unit-frame-icons:%.2f:%.2f:0:0:256:256:100:132:34:66|t", + ["WM"] = "|TInterface\\AddOns\\ls_UI\\assets\\unit-frame-icons:%.2f:%.2f:0:0:256:256:133:165:34:66|t", + ["CHROMIE"] = "|TInterface\\AddOns\\ls_UI\\assets\\unit-frame-icons:%.2f:%.2f:0:0:256:256:166:198:34:66|t", + ["QUEST"] = "|TInterface\\AddOns\\ls_UI\\assets\\unit-frame-icons:%.2f:%.2f:0:0:256:256:199:231:34:66|t", -- third line - -- ["TEMP"] = "|TInterface\\AddOns\\ls_UI\\assets\\unit-frame-icons:%.2f:%.2f:0:0:256:256:1:33:67:99|t", + ["SHEEP"] = "|TInterface\\AddOns\\ls_UI\\assets\\unit-frame-icons:%.2f:%.2f:0:0:256:256:1:33:67:99|t", -- ["TEMP"] = "|TInterface\\AddOns\\ls_UI\\assets\\unit-frame-icons:%.2f:%.2f:0:0:256:256:34:66:67:99|t", -- ["TEMP"] = "|TInterface\\AddOns\\ls_UI\\assets\\unit-frame-icons:%.2f:%.2f:0:0:256:256:67:99:67:99|t", -- ["TEMP"] = "|TInterface\\AddOns\\ls_UI\\assets\\unit-frame-icons:%.2f:%.2f:0:0:256:256:100:132:67:99|t", diff --git a/core/defaults.lua b/core/defaults.lua index 933872c3..92df35ba 100644 --- a/core/defaults.lua +++ b/core/defaults.lua @@ -310,7 +310,7 @@ D.global = { }, ["ls:phaseicon"] = { events = "UNIT_PHASE", - func = "function(unit)\n if UnitIsPlayer(unit) and UnitIsConnected(unit) and UnitPhaseReason(unit) then\n if UnitPhaseReason(unit) == Enum.PhaseReason.WarMode then\n return _VARS.INLINE_ICONS[\"PHASE_WM\"]:format(0, 0)\n else\n return _VARS.INLINE_ICONS[\"PHASE\"]:format(0, 0)\n end\n end\n\n return \"\"\nend", + func = "function(unit)\n local phaseReason = UnitIsPlayer(unit) and UnitIsConnected(unit) and UnitPhaseReason(unit)\n if phaseReason then\n if phaseReason == Enum.PhaseReason.Phasing then\n return _VARS.INLINE_ICONS.PHASE:format(0, 0)\n elseif phaseReason == Enum.PhaseReason.Sharding then\n return _VARS.INLINE_ICONS.SHARD:format(0, 0)\n elseif phaseReason == Enum.PhaseReason.WarMode then\n return _VARS.INLINE_ICONS.WM:format(0, 0)\n elseif phaseReason == Enum.PhaseReason.ChromieTime then\n return _VARS.INLINE_ICONS.CHROMIE:format(0, 0)\n end\n end\n\n return \"\"\nend", }, ["ls:player:class"] = { events = "UNIT_CLASSIFICATION_CHANGED", diff --git a/modules/tooltips/tooltips.lua b/modules/tooltips/tooltips.lua index 232b2305..9ca5b065 100644 --- a/modules/tooltips/tooltips.lua +++ b/modules/tooltips/tooltips.lua @@ -16,9 +16,6 @@ local C_PetJournal = _G.C_PetJournal local C_Timer = _G.C_Timer local C_TradeSkillUI = _G.C_TradeSkillUI local CanInspect = _G.CanInspect -local GetAuctionItemInfo = _G.GetAuctionItemInfo -local GetBackpackCurrencyInfo = _G.GetBackpackCurrencyInfo -local GetCurrencyListLink = _G.GetCurrencyListLink local GetGuildInfo = _G.GetGuildInfo local GetItemCount = _G.GetItemCount local GetLFGDungeonRewardLink = _G.GetLFGDungeonRewardLink @@ -42,7 +39,6 @@ local UnitExists = _G.UnitExists local UnitGroupRolesAssigned = _G.UnitGroupRolesAssigned local UnitGUID = _G.UnitGUID local UnitInParty = _G.UnitInParty -local UnitInPhase = _G.UnitInPhase local UnitInRaid = _G.UnitInRaid local UnitIsAFK = _G.UnitIsAFK local UnitIsBattlePetCompanion = _G.UnitIsBattlePetCompanion @@ -51,16 +47,16 @@ local UnitIsDND = _G.UnitIsDND local UnitIsGroupLeader = _G.UnitIsGroupLeader local UnitIsPlayer = _G.UnitIsPlayer local UnitIsQuestBoss = _G.UnitIsQuestBoss -local UnitIsWarModePhased = _G.UnitIsWarModePhased local UnitIsWildBattlePet = _G.UnitIsWildBattlePet local UnitLevel = _G.UnitLevel local UnitName = _G.UnitName local UnitPVPName = _G.UnitPVPName local UnitRace = _G.UnitRace local UnitRealmRelationship = _G.UnitRealmRelationship +local UnitPhaseReason = _G.UnitPhaseReason --[[ luacheck: globals - CreateFrame GameTooltip GameTooltipStatusBar GameTooltipTextLeft1 + CreateFrame Enum GameTooltip GameTooltipStatusBar GameTooltipTextLeft1 GameTooltipTextLeft2 GameTooltipTextRight1 LSTooltipAnchor UIParent LE_REALM_RELATION_VIRTUAL @@ -85,6 +81,13 @@ local TEXTS_TO_REMOVE = { [_G.PVP] = true, } +local PHASE_ICONS = { + [Enum.PhaseReason.Phasing] = M.textures.icons_inline.PHASE, + [Enum.PhaseReason.Sharding] = M.textures.icons_inline.SHARD, + [Enum.PhaseReason.WarMode] = M.textures.icons_inline.WM, + [Enum.PhaseReason.ChromieTime] = M.textures.icons_inline.CHROMIE, +} + local function addGenericInfo(tooltip, id) if not (id and C.db.profile.tooltips.id) then return end @@ -479,11 +482,7 @@ local function tooltip_SetUnit(self) end if UnitIsPlayer(unit) and UnitIsConnected(unit) and UnitPhaseReason(unit) then - if UnitPhaseReason(unit) == Enum.PhaseReason.WarMode then - status = status .. M.textures.icons_inline["PHASE_WM"]:format(size, size) - else - status = status .. M.textures.icons_inline["PHASE"]:format(size, size) - end + status = status .. PHASE_ICONS[UnitPhaseReason(unit)]:format(size, size) end if isPVPReady then