Skip to content

Commit

Permalink
Add support for multiple phase types
Browse files Browse the repository at this point in the history
  • Loading branch information
ls- committed Oct 23, 2020
1 parent 11f031d commit cf2633a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 22 deletions.
Binary file modified assets/unit-frame-icons.TGA
Binary file not shown.
20 changes: 10 additions & 10 deletions core/constants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion core/defaults.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
21 changes: 10 additions & 11 deletions modules/tooltips/tooltips.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit cf2633a

Please sign in to comment.