Skip to content

Commit 60055d9

Browse files
author
Shadowed
committed
Added a class indicator, shows class icons for players, enabled on all units except player and pets
Added a global font color/alpha setting (Advanced only) Fixed range check issues being stuck on a resurrect spell Fixed a state bug causing display issues if something changes while the world map or the entire interface is hidden Fixed a separated raid frame bug if you were in a group that had players skipping groups (group 1 and group 3, but not group 2, etc) and the column growth was left or right
1 parent 14b00de commit 60055d9

7 files changed

+75
-26
lines changed

ShadowedUnitFrames.lua

+18
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,20 @@ function ShadowUF:OnInitialize()
8888
end
8989

9090
function ShadowUF:CheckUpgrade()
91+
-- June 19th
92+
if( not ShadowUF.db.profile.font.color ) then
93+
ShadowUF.db.profile.font.color = {r = 1, g = 1, b = 1, a = 1}
94+
for unit, config in pairs(self.db.profile.units) do
95+
local indicators = ShadowUF.db.profile.units[unit].indicators
96+
if( indicators and indicators.class ) then
97+
indicators.class.anchorTo = "$parent"
98+
indicators.class.anchorPoint = "BL"
99+
indicators.class.x = 0
100+
indicators.class.y = 0
101+
end
102+
end
103+
end
104+
91105
-- April 29th
92106
if( self.db.profile.filters.zones ) then
93107
for unit, filter in pairs(self.db.profile.filters.zones) do
@@ -206,6 +220,10 @@ function ShadowUF:LoadUnitDefaults()
206220

207221
if( unit ~= "player" ) then
208222
self.defaults.profile.units[unit].range = {enabled = false, oorAlpha = 0.80, inAlpha = 1.0}
223+
224+
if( not string.match(unit, "pet") ) then
225+
self.defaults.profile.units[unit].indicators.class = {enabled = false, size = 19}
226+
end
209227
end
210228

211229
-- Want pvp/leader/ML enabled for these units

modules/defaultlayout.lua

+3-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ function ShadowUF:LoadDefaultLayout(useMerge)
9494
name = "Myriad Condensed Web",
9595
size = 11,
9696
extra = "",
97-
shadowColor = {r = 0, g = 0, b = 0, a = 1.0},
97+
shadowColor = {r = 0, g = 0, b = 0, a = 1},
98+
color = {r = 1, g = 1, b = 1, a = 1},
9899
shadowX = 0.80,
99100
shadowY = -0.80,
100101
}
@@ -198,6 +199,7 @@ function ShadowUF:LoadDefaultLayout(useMerge)
198199
},
199200
indicators = {
200201
raidTarget = {anchorTo = "$parent", anchorPoint = "C", size = 20, x = 0, y = 0},
202+
class = {anchorTo = "$parent", anchorPoint = "BL", size = 16, x = 0, y = 0},
201203
masterLoot = {anchorTo = "$parent", anchorPoint = "TL", size = 12, x = 16, y = -10},
202204
leader = {anchorTo = "$parent", anchorPoint = "TL", size = 14, x = 2, y = -12},
203205
pvp = {anchorTo = "$parent", anchorPoint = "TR", size = 22, x = 11, y = -21},

modules/indicators.lua

+20-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,22 @@
1-
local Indicators = {list = {"status", "pvp", "leader", "masterLoot", "raidTarget", "happiness", "ready", "role", "lfdRole"}}
1+
local Indicators = {list = {"status", "pvp", "leader", "masterLoot", "raidTarget", "happiness", "ready", "role", "lfdRole", "class"}}
22
local leavingWorld
33

44
ShadowUF:RegisterModule(Indicators, "indicators", ShadowUF.L["Indicators"])
55

6+
function Indicators:UpdateClass(frame)
7+
if( not frame.indicators.class or not frame.indicators.class.enabled ) then return end
8+
9+
local class = select(2, UnitClass(frame.unit))
10+
if( UnitIsPlayer(frame.unit) and class ) then
11+
local coords = CLASS_BUTTONS[class]
12+
frame.indicators.class:SetTexture("Interface\\Glues\\CharacterCreate\\UI-CharacterCreate-Classes")
13+
frame.indicators.class:SetTexCoord(coords[1], coords[2], coords[3], coords[4])
14+
frame.indicators.class:Show()
15+
else
16+
frame.indicators.class:Hide()
17+
end
18+
end
19+
620
function Indicators:UpdateHappiness(frame)
721
if( not frame.indicators.happiness or not frame.indicators.happiness.enabled ) then return end
822

@@ -253,6 +267,11 @@ function Indicators:OnEnable(frame)
253267

254268
frame.indicators.pvp = frame.indicators.pvp or frame.indicators:CreateTexture(nil, "OVERLAY")
255269
end
270+
271+
if( config.indicators.class and config.indicators.class.enabled ) then
272+
frame:RegisterUpdateFunc(self, "UpdateClass")
273+
frame.indicators.class = frame.indicators.class or frame.indicators:CreateTexture(nil, "OVERLAY")
274+
end
256275

257276
if( config.indicators.leader and config.indicators.leader.enabled ) then
258277
frame:RegisterNormalEvent("PARTY_LEADER_CHANGED", self, "UpdateLeader")

modules/layout.lua

+2-1
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ function Layout:SetupFontString(fontString, extraSize)
365365
fontString:SetFont(mediaPath.font, size, ShadowUF.db.profile.font.extra)
366366

367367
if( ShadowUF.db.profile.font.shadowColor and ShadowUF.db.profile.font.shadowX and ShadowUF.db.profile.font.shadowY ) then
368-
fontString:SetShadowColor(ShadowUF.db.profile.font.shadowColor.r, ShadowUF.db.profile.font.shadowColor.g, ShadowUF.db.profile.font.shadowColor.b, ShadowUF.db.profile.font.a)
368+
fontString:SetShadowColor(ShadowUF.db.profile.font.shadowColor.r, ShadowUF.db.profile.font.shadowColor.g, ShadowUF.db.profile.font.shadowColor.b, ShadowUF.db.profile.font.shadowColor.a)
369369
fontString:SetShadowOffset(ShadowUF.db.profile.font.shadowX, ShadowUF.db.profile.font.shadowY)
370370
else
371371
fontString:SetShadowColor(0, 0, 0, 0)
@@ -390,6 +390,7 @@ function Layout:SetupText(frame, config)
390390
if( parent and parent:IsShown() and row.enabled and row.text ~= "" ) then
391391
local fontString = frame.fontStrings[id] or frame.highFrame:CreateFontString(nil, "ARTWORK")
392392
self:SetupFontString(fontString, row.size)
393+
fontString:SetTextColor(ShadowUF.db.profile.font.color.r, ShadowUF.db.profile.font.color.g, ShadowUF.db.profile.font.color.b, ShadowUF.db.profile.font.color.a)
393394
fontString:SetText(row.text)
394395
fontString:SetJustifyH(self:GetJustify(row))
395396
self:AnchorFrame(frame, fontString, row)

modules/range.lua

+5-17
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,17 @@ ShadowUF:RegisterModule(Range, "range", ShadowUF.L["Range indicator"])
77

88
local playerClass = select(2, UnitClass("player"))
99
local friendlySpell, hostileSpell
10+
local resurrectSpell = Range.resurrect[playerClass]
1011

1112
local function checkRange(self, elapsed)
1213
self.timeElapsed = self.timeElapsed + elapsed
1314
if( self.timeElapsed <= 0.50 ) then return end
1415
self.timeElapsed = 0
1516

17+
if( self.isFriendly and resurrectSpell and UnitIsDead(self.parent.unit) ) then
18+
self.parent:SetRangeAlpha(IsSpellInRange(resurrectSpell, self.parent.unit) == 1 and ShadowUF.db.profile.units[self.parent.unitType].range.inAlpha or ShadowUF.db.profile.units[self.parent.unitType].range.oorAlpha)
1619
-- We set a spell for them in our flags check, use that
17-
if( self.spell ) then
20+
elseif( self.spell ) then
1821
self.parent:SetRangeAlpha(IsSpellInRange(self.spell, self.parent.unit) == 1 and ShadowUF.db.profile.units[self.parent.unitType].range.inAlpha or ShadowUF.db.profile.units[self.parent.unitType].range.oorAlpha)
1922
-- That didn't work, but they are grouped lets try the actual API for this, it's a bit flaky though and not that useful generally
2023
elseif( self.grouped ) then
@@ -47,11 +50,6 @@ function Range:OnEnable(frame)
4750

4851
frame:RegisterUpdateFunc(self, "UpdateFlags")
4952
frame:RegisterUpdateFunc(self, "ForceUpdate")
50-
51-
-- RRU and PMC don't fire when a target is dead and comes back up, check health for a state change.
52-
if( self.resurrect[playerClass] ) then
53-
frame:RegisterUnitEvent("UNIT_HEALTH", self, "CheckHealth")
54-
end
5553
end
5654

5755
function Range:OnLayoutApplied(frame)
@@ -70,22 +68,12 @@ function Range:OnDisable(frame)
7068
end
7169
end
7270

73-
function Range:CheckHealth(frame)
74-
local isDead = UnitIsDead(frame.unit)
75-
if( isDead and not frame.range.isDead or not isDead and frame.range.isDead ) then
76-
frame.range.isDead = isDead
77-
78-
self:UpdateFlags(frame)
79-
self:ForceUpdate(frame)
80-
end
81-
end
82-
8371
-- I'd rather store the flags here, they rarely change and we can do that based off events, no sense in doing it eveyr 0.50s
8472
function Range:UpdateFlags(frame)
8573
frame.range.canAttack = UnitCanAttack("player", frame.unit)
8674
frame.range.isFriendly = UnitIsFriend("player", frame.unit) and UnitCanAssist("player", frame.unit)
8775
frame.range.grouped = UnitInRaid(frame.unit) or UnitInParty(frame.unit)
88-
frame.range.spell = UnitIsDead(frame.unit) and frame.range.isFriendly and self.resurrect[playerClass] or frame.range.canAttack and frame.range.hostileSpell or frame.range.isFriendly and frame.range.friendlySpell or nil
76+
frame.range.spell = frame.range.canAttack and frame.range.hostileSpell or frame.range.isFriendly and frame.range.friendlySpell or nil
8977

9078
-- No sense in updating range if we have no data
9179
if( UnitIsGhost(frame.unit) or not UnitIsConnected(frame.unit) or ( not frame.range.spell and not frame.range.grouped and not frame.range.isFriendly ) ) then

modules/units.lua

+12-3
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ local function OnHide(self)
150150
self:SetScript("OnEvent", nil)
151151

152152
-- If it's a volatile such as target or focus, next time it's shown it has to do an update
153-
if( self.isUnitVolatile ) then
153+
-- OR if the unit is still shown, but it's been hidden because our parent (Basically UIParent)
154+
-- we want to flag it as having changed so it can be updated
155+
if( self.isUnitVolatile or self:IsShown() ) then
154156
self.unitGUID = nil
155157
end
156158
end
@@ -668,6 +670,8 @@ function Units:SetHeaderAttributes(frame, type)
668670
local config = ShadowUF.db.profile.units[type]
669671
local xMod = config.attribPoint == "LEFT" and 1 or config.attribPoint == "RIGHT" and -1 or 0
670672
local yMod = config.attribPoint == "TOP" and -1 or config.attribPoint == "BOTTOM" and 1 or 0
673+
local widthMod = (config.attribPoint == "LEFT" or config.attribPoint == "RIGHT") and MEMBERS_PER_RAID_GROUP or 1
674+
local heightMod = (config.attribPoint == "TOP" or config.attribPoint == "BOTTOM") and MEMBERS_PER_RAID_GROUP or 1
671675

672676
frame:SetAttribute("point", config.attribPoint)
673677
frame:SetAttribute("sortMethod", config.sortMethod)
@@ -687,10 +691,11 @@ function Units:SetHeaderAttributes(frame, type)
687691
for id=1, 8 do
688692
local childHeader = headerFrames["raid" .. id]
689693
if( childHeader and childHeader:IsVisible() ) then
690-
childHeader:SetAttribute("minWidth", config.width)
691-
childHeader:SetAttribute("minHeight", config.height * 5)
692694
childHeader:SetAttribute("showRaid", ShadowUF.db.profile.locked and true)
693695

696+
childHeader:SetAttribute("minWidth", config.width * widthMod)
697+
childHeader:SetAttribute("minHeight", config.height * heightMod)
698+
694699
if( childHeader ~= frame ) then
695700
childHeader:SetAttribute("point", config.attribPoint)
696701
childHeader:SetAttribute("sortMethod", config.sortMethod)
@@ -815,6 +820,10 @@ function Units:LoadSplitGroupHeader(type)
815820
frame.unitType = type
816821
frame.splitParent = type
817822
frame.groupID = id
823+
--frame:SetBackdrop({bgFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeSize = 1})
824+
--frame:SetBackdropBorderColor(1, 0, 0, 1)
825+
--frame:SetBackdropColor(0, 0, 0, 0)
826+
818827
headerFrames["raid" .. id] = frame
819828
end
820829

options/config.lua

+15-3
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ local PAGE_DESC = {
3636
["tags"] = L["Advanced tag management, allows you to add your own custom tags."],
3737
["filter"] = L["Simple aura filtering by whitelists and blacklists."],
3838
}
39-
local INDICATOR_NAMES = {["happiness"] = L["Happiness"], ["leader"] = L["Leader"], ["lfdRole"] = L["Dungeon role"], ["masterLoot"] = L["Master looter"], ["pvp"] = L["PvP Flag"],["raidTarget"] = L["Raid target"], ["ready"] = L["Ready status"], ["role"] = L["Raid role"], ["status"] = L["Combat status"],}
39+
local INDICATOR_NAMES = {["happiness"] = L["Happiness"], ["leader"] = L["Leader"], ["lfdRole"] = L["Dungeon role"], ["masterLoot"] = L["Master looter"], ["pvp"] = L["PvP Flag"],["raidTarget"] = L["Raid target"], ["ready"] = L["Ready status"], ["role"] = L["Raid role"], ["status"] = L["Combat status"], ["class"] = L["Class icon"]}
4040
local AREA_NAMES = {["arena"] = L["Arenas"],["none"] = L["Everywhere else"], ["party"] = L["Party instances"], ["pvp"] = L["Battlegrounds"], ["raid"] = L["Raid instances"],}
4141
local INDICATOR_DESC = {["happiness"] = L["Indicator for your pet's happiness, only applies to Hunters."],
4242
["leader"] = L["Crown indicator for group leaders."], ["lfdRole"] = L["Role the unit is playing in dungeons formed through the Looking For Dungeon system."],
4343
["masterLoot"] = L["Bag indicator for master looters."], ["pvp"] = L["PVP flag indicator, Horde for Horde flagged pvpers and Alliance for Alliance flagged pvpers."],
4444
["raidTarget"] = L["Raid target indicator."], ["ready"] = L["Ready status of group members."],
45-
["role"] = L["Raid role indicator, adds a shield indicator for main tanks and a sword icon for main assists."], ["status"] = L["Status indicator, shows if the unit is currently in combat. For the plyer it will also show if you are rested."],}
45+
["role"] = L["Raid role indicator, adds a shield indicator for main tanks and a sword icon for main assists."], ["status"] = L["Status indicator, shows if the unit is currently in combat. For the player it will also show if you are rested."], ["class"] = L["Class icon for players."]}
4646
local TAG_GROUPS = {["classification"] = L["Classifications"], ["health"] = L["Health"], ["misc"] = L["Miscellaneous"], ["playerthreat"] = L["Player threat"], ["power"] = L["Power"], ["status"] = L["Status"], ["threat"] = L["Threat"], ["raid"] = L["Raid"],}
4747

4848
local pointPositions = {["BOTTOM"] = L["Bottom"], ["TOP"] = L["Top"], ["LEFT"] = L["Left"], ["RIGHT"] = L["Right"], ["TOPLEFT"] = L["Top Left"], ["TOPRIGHT"] = L["Top Right"], ["BOTTOMLEFT"] = L["Bottom Left"], ["BOTTOMRIGHT"] = L["Bottom Right"], ["CENTER"] = L["Center"]}
@@ -826,8 +826,20 @@ local function loadGeneralOptions()
826826
inline = true,
827827
name = L["Font"],
828828
args = {
829-
font = {
829+
color = {
830830
order = 1,
831+
type = "color",
832+
name = L["Default color"],
833+
desc = L["Default font color, any color tags inside individual tag texts will override this."],
834+
hasAlpha = true,
835+
set = setColor,
836+
get = getColor,
837+
arg = "font.color",
838+
hidden = hideAdvancedOption,
839+
},
840+
sep = {order = 1.25, type = "description", name = "", hidden = hideAdvancedOption},
841+
font = {
842+
order = 1.5,
831843
type = "select",
832844
name = L["Font"],
833845
dialogControl = "LSM30_Font",

0 commit comments

Comments
 (0)