add RaidRoleIcons (party leader, master looter, etc..)

This commit is contained in:
Crum
2019-01-13 18:38:08 -06:00
parent edc1e0f938
commit e8821e3b88
8 changed files with 509 additions and 302 deletions
@@ -18,6 +18,7 @@
<Script file="PvPIndicator.lua"/>
<Script file="RaidDebuffs.lua"/>
<Script file="RaidIcon.lua"/>
<Script file="RaidRoleIcons.lua"/>
<Script file="Range.lua"/>
<Script file="RestingIndicator.lua"/>
<Script file="FrameGlow.lua"/>
@@ -0,0 +1,131 @@
local E, L, V, P, G = unpack(ElvUI)
local UF = E:GetModule("UnitFrames")
local select, tonumber = select, tonumber
local match = string.match
local CreateFrame = CreateFrame
local GetNumRaidMembers = GetNumRaidMembers
local GetRaidRosterInfo = GetRaidRosterInfo
local IsPartyLeader = IsPartyLeader
local UnitInParty = UnitInParty
local UnitInRaid = UnitInRaid
local function CheckLeader(unit)
if unit == "player" then
return IsPartyLeader()
elseif unit ~= "player" and (UnitInParty(unit) or UnitInRaid(unit)) then
local gtype, index = match(unit, "(%D+)(%d+)")
index = tonumber(index)
if gtype == "party" and GetNumRaidMembers() == 0 then
return GetPartyLeaderIndex() == index
elseif gtype == "raid" and GetNumRaidMembers() > 0 then
return select(2, GetRaidRosterInfo(index)) == 2
end
end
end
local function UpdateOverride(self)
local element = self.LeaderIndicator
if element.PreUpdate then
element:PreUpdate()
end
local isLeader = CheckLeader(self.unit)
if isLeader then
element:Show()
else
element:Hide()
end
if element.PostUpdate then
return element:PostUpdate(isLeader)
end
end
function UF:Construct_RaidRoleFrames(frame)
local anchor = CreateFrame("Frame", nil, frame.RaisedElementParent)
frame.LeaderIndicator = anchor:CreateTexture(nil, "OVERLAY")
frame.AssistantIndicator = anchor:CreateTexture(nil, "OVERLAY")
frame.MasterLooterIndicator = anchor:CreateTexture(nil, "OVERLAY")
E:Size(anchor, 24, 12)
E:Size(frame.LeaderIndicator, 12)
E:Size(frame.AssistantIndicator, 12)
E:Size(frame.MasterLooterIndicator, 11)
frame.LeaderIndicator.Override = UpdateOverride
frame.LeaderIndicator.PostUpdate = UF.RaidRoleUpdate
frame.AssistantIndicator.PostUpdate = UF.RaidRoleUpdate
frame.MasterLooterIndicator.PostUpdate = UF.RaidRoleUpdate
return anchor
end
function UF:Configure_RaidRoleIcons(frame)
local raidRoleFrameAnchor = frame.RaidRoleFramesAnchor
if not raidRoleFrameAnchor then return end
if frame.db.raidRoleIcons.enable then
raidRoleFrameAnchor:Show()
if not frame:IsElementEnabled("LeaderIndicator") then
frame:EnableElement("LeaderIndicator")
frame:EnableElement("MasterLooterIndicator")
frame:EnableElement("AssistantIndicator")
end
raidRoleFrameAnchor:ClearAllPoints()
if frame.db.raidRoleIcons.position == "TOPLEFT" then
E:Point(raidRoleFrameAnchor, "LEFT", frame, "TOPLEFT", 2, 0)
else
E:Point(raidRoleFrameAnchor, "RIGHT", frame, "TOPRIGHT", -2, 0)
end
elseif frame:IsElementEnabled("LeaderIndicator") then
raidRoleFrameAnchor:Hide()
frame:DisableElement("LeaderIndicator")
frame:DisableElement("MasterLooterIndicator")
frame:DisableElement("AssistantIndicator")
end
end
function UF:RaidRoleUpdate()
local anchor = self:GetParent()
local frame = anchor:GetParent():GetParent()
local leader = frame.LeaderIndicator
local assistant = frame.AssistantIndicator
local masterLooter = frame.MasterLooterIndicator
if not leader or not masterLooter or not assistant then return end
local db = frame.db
local isLeader = leader:IsShown()
local isMasterLooter = masterLooter:IsShown()
local isAssist = assistant:IsShown()
leader:ClearAllPoints()
assistant:ClearAllPoints()
masterLooter:ClearAllPoints()
if db and db.raidRoleIcons then
if isLeader and db.raidRoleIcons.position == "TOPLEFT" then
E:Point(leader, "LEFT", anchor, "LEFT")
E:Point(masterLooter, "RIGHT", anchor, "RIGHT")
elseif isLeader and db.raidRoleIcons.position == "TOPRIGHT" then
E:Point(leader, "RIGHT", anchor, "RIGHT")
E:Point(masterLooter, "LEFT", anchor, "LEFT")
elseif isAssist and db.raidRoleIcons.position == "TOPLEFT" then
E:Point(assistant, "LEFT", anchor, "LEFT")
E:Point(masterLooter, "RIGHT", anchor, "RIGHT")
elseif isAssist and db.raidRoleIcons.position == "TOPRIGHT" then
E:Point(assistant, "RIGHT", anchor, "RIGHT")
E:Point(masterLooter, "LEFT", anchor, "LEFT")
elseif isMasterLooter and db.raidRoleIcons.position == "TOPLEFT" then
E:Point(masterLooter, "LEFT", anchor, "LEFT")
else
E:Point(masterLooter, "RIGHT", anchor, "RIGHT")
end
end
end
@@ -27,6 +27,7 @@ function UF:Construct_PartyFrames()
if self.isChild then
self.Health = UF:Construct_HealthBar(self, true)
self.RaidRoleFramesAnchor = UF:Construct_RaidRoleFrames(self)
self.MouseGlow = UF:Construct_MouseGlow(self)
self.TargetGlow = UF:Construct_TargetGlow(self)
self.Name = UF:Construct_NameText(self)
@@ -223,6 +224,8 @@ function UF:Update_PartyFrames(frame, db)
UF:Configure_GPS(frame)
UF:Configure_RaidRoleIcons(frame)
UF:UpdateAuraWatch(frame)
UF:Configure_CustomTexts(frame)
+3
View File
@@ -38,6 +38,7 @@ function UF:Construct_RaidFrames()
self.AuraWatch = UF:Construct_AuraWatch(self)
self.RaidDebuffs = UF:Construct_RaidDebuffs(self)
self.DebuffHighlight = UF:Construct_DebuffHighlight(self)
self.RaidRoleFramesAnchor = UF:Construct_RaidRoleFrames(self)
self.MouseGlow = UF:Construct_MouseGlow(self)
self.TargetGlow = UF:Construct_TargetGlow(self)
self.InfoPanel = UF:Construct_InfoPanel(self)
@@ -155,6 +156,8 @@ function UF:Update_RaidFrames(frame, db)
UF:Configure_GPS(frame)
UF:Configure_RaidRoleIcons(frame)
UF:Configure_Range(frame)
UF:UpdateAuraWatch(frame)
@@ -38,6 +38,7 @@ function UF:Construct_Raid40Frames()
self.AuraWatch = UF:Construct_AuraWatch(self)
self.RaidDebuffs = UF:Construct_RaidDebuffs(self)
self.DebuffHighlight = UF:Construct_DebuffHighlight(self)
self.RaidRoleFramesAnchor = UF:Construct_RaidRoleFrames(self)
self.MouseGlow = UF:Construct_MouseGlow(self)
self.TargetGlow = UF:Construct_TargetGlow(self)
self.InfoPanel = UF:Construct_InfoPanel(self)
@@ -156,6 +157,8 @@ function UF:Update_Raid40Frames(frame, db)
UF:Configure_GPS(frame)
UF:Configure_RaidRoleIcons(frame)
UF:Configure_Range(frame)
UF:UpdateAuraWatch(frame)
@@ -38,6 +38,7 @@ function UF:Construct_PlayerFrame(frame)
frame.MouseGlow = self:Construct_MouseGlow(frame)
frame.TargetGlow = self:Construct_TargetGlow(frame)
frame.RaidTargetIndicator = self:Construct_RaidIcon(frame)
frame.RaidRoleFramesAnchor = self:Construct_RaidRoleFrames(frame)
frame.RestingIndicator = self:Construct_RestingIndicator(frame)
frame.CombatIndicator = self:Construct_CombatIndicator(frame)
frame.PvPText = self:Construct_PvPIndicator(frame)
@@ -136,6 +137,8 @@ function UF:Update_PlayerFrame(frame, db)
UF:Configure_PVPIcon(frame)
UF:Configure_RaidRoleIcons(frame)
UF:Configure_CustomTexts(frame)
E:SetMoverSnapOffset(frame:GetName().."Mover", -(12 + db.castbar.height))
+252 -301
View File
File diff suppressed because it is too large Load Diff
+113 -1
View File
@@ -60,7 +60,7 @@ local petAnchors = {
}
local attachToValues = {
["Health"] = HEALTH,
["Health"] = L["Health"],
["Power"] = L["Power"],
["InfoPanel"] = L["Information Panel"],
["Frame"] = L["Frame"]
@@ -3162,6 +3162,34 @@ E.Options.args.unitframe.args.player = {
width = "full"
}
}
},
raidRoleIcons = {
order = 703,
type = "group",
name = L["RL / ML Icons"],
get = function(info) return E.db.unitframe.units.player.raidRoleIcons[ info[getn(info)] ] end,
set = function(info, value) E.db.unitframe.units.player.raidRoleIcons[ info[getn(info)] ] = value UF:CreateAndUpdateUF("player") end,
args = {
header = {
order = 1,
type = "header",
name = L["RL / ML Icons"]
},
enable = {
order = 2,
type = "toggle",
name = L["Enable"]
},
position = {
order = 3,
type = "select",
name = L["Position"],
values = {
["TOPLEFT"] = "TOPLEFT",
["TOPRIGHT"] = "TOPRIGHT"
}
}
}
}
}
}
@@ -4462,6 +4490,34 @@ E.Options.args.unitframe.args.party = {
}--]]
}
},
raidRoleIcons = {
order = 750,
type = "group",
name = L["RL / ML Icons"],
get = function(info) return E.db.unitframe.units.party.raidRoleIcons[ info[getn(info)] ] end,
set = function(info, value) E.db.unitframe.units.party.raidRoleIcons[ info[getn(info)] ] = value UF:CreateAndUpdateHeaderGroup("party") end,
args = {
header = {
order = 1,
type = "header",
name = L["RL / ML Icons"]
},
enable = {
order = 2,
type = "toggle",
name = L["Enable"]
},
position = {
order = 3,
type = "select",
name = L["Position"],
values = {
["TOPLEFT"] = "TOPLEFT",
["TOPRIGHT"] = "TOPRIGHT"
}
}
}
},
health = GetOptionsTable_Health(true, UF.CreateAndUpdateHeaderGroup, "party"),
power = GetOptionsTable_Power(false, UF.CreateAndUpdateHeaderGroup, "party"),
infoPanel = GetOptionsTable_InformationPanel(UF.CreateAndUpdateHeaderGroup, "party"),
@@ -4976,6 +5032,34 @@ E.Options.args.unitframe.args.raid = {
}--]]
}
},
raidRoleIcons = {
order = 750,
type = "group",
name = L["RL / ML Icons"],
get = function(info) return E.db.unitframe.units.raid.raidRoleIcons[ info[getn(info)] ] end,
set = function(info, value) E.db.unitframe.units.raid.raidRoleIcons[ info[getn(info)] ] = value UF:CreateAndUpdateHeaderGroup("raid") end,
args = {
header = {
order = 1,
type = "header",
name = L["RL / ML Icons"]
},
enable = {
order = 2,
type = "toggle",
name = L["Enable"]
},
position = {
order = 3,
type = "select",
name = L["Position"],
values = {
["TOPLEFT"] = "TOPLEFT",
["TOPRIGHT"] = "TOPRIGHT"
}
}
}
},
rdebuffs = GetOptionsTable_RaidDebuff(UF.CreateAndUpdateHeaderGroup, "raid"),
raidicon = GetOptionsTable_RaidIcon(UF.CreateAndUpdateHeaderGroup, "raid"),
GPSArrow = GetOptionsTable_GPS("raid")
@@ -5304,6 +5388,34 @@ E.Options.args.unitframe.args.raid40 = {
}--]]
}
},
raidRoleIcons = {
order = 750,
type = "group",
name = L["RL / ML Icons"],
get = function(info) return E.db.unitframe.units.raid40.raidRoleIcons[ info[getn(info)] ] end,
set = function(info, value) E.db.unitframe.units.raid40.raidRoleIcons[ info[getn(info)] ] = value UF:CreateAndUpdateHeaderGroup("raid40") end,
args = {
header = {
order = 1,
type = "header",
name = L["RL / ML Icons"]
},
enable = {
order = 2,
type = "toggle",
name = L["Enable"]
},
position = {
order = 3,
type = "select",
name = L["Position"],
values = {
["TOPLEFT"] = "TOPLEFT",
["TOPRIGHT"] = "TOPRIGHT"
}
}
}
},
rdebuffs = GetOptionsTable_RaidDebuff(UF.CreateAndUpdateHeaderGroup, "raid40"),
raidicon = GetOptionsTable_RaidIcon(UF.CreateAndUpdateHeaderGroup, "raid40"),
GPSArrow = GetOptionsTable_GPS("raid40")