Added coloring of mains who are on an alt in guild roster
This commit is contained in:
parent
9f69520833
commit
38f03047f8
1 changed files with 36 additions and 26 deletions
|
@ -18,6 +18,7 @@ local rosterRaidersOnly = false
|
|||
local rosterRaidersCache = {} -- mains who are raiders
|
||||
local rosterRaidersCount = 0
|
||||
local rosterRaidersOnline = 0
|
||||
local rosterRaidersAlts = {} -- map of mains to whether they have an alt online
|
||||
local BLACKLIST = {
|
||||
Moulder = true,
|
||||
}
|
||||
|
@ -28,8 +29,12 @@ end
|
|||
|
||||
function mod:OnEnable()
|
||||
self:RegisterEvent("RAID_ROSTER_UPDATE")
|
||||
if IsAddOnLoaded("Blizzard_GuildUI") then
|
||||
self:ADDON_LOADED(_, "Blizzard_GuildUI")
|
||||
else
|
||||
self:RegisterEvent("ADDON_LOADED")
|
||||
end
|
||||
end
|
||||
|
||||
function mod:ADDON_LOADED(_, name)
|
||||
if name == "Blizzard_GuildUI" then
|
||||
|
@ -114,25 +119,38 @@ function mod:GuildRoster_Update()
|
|||
end
|
||||
end
|
||||
|
||||
local lastCache = GetTime()
|
||||
local lastCache = 0
|
||||
function mod:ModifyRosterPane()
|
||||
end
|
||||
|
||||
function mod:CacheRaiders()
|
||||
wipe(rosterRaidersCache)
|
||||
wipe(rosterRaidersAlts)
|
||||
rosterRaidersCount = 0
|
||||
|
||||
for i=1,GetNumGuildMembers() do
|
||||
if self:IsRaider(i) then
|
||||
rosterRaidersCache[GetGuildRosterInfo(i)] = true
|
||||
local name, _, rank, _, _, _, note, _, online = GetGuildRosterInfo(i)
|
||||
rosterRaidersCache[name] = true
|
||||
rosterRaidersCount = rosterRaidersCount + 1
|
||||
|
||||
-- set the alt if it is one
|
||||
if (rank == 4 or rank == 2) and online then
|
||||
rosterRaidersAlts[note] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function mod:IsRaider(index)
|
||||
local name, _, rank, _, _, _, note, _, online = GetGuildRosterInfo(index)
|
||||
-- first checking for blacklisted names
|
||||
|
||||
-- first check cache
|
||||
if rosterRaidersCache[name] then
|
||||
return true
|
||||
end
|
||||
|
||||
-- next checking for blacklisted names
|
||||
if BLACKLIST[name] or BLACKLIST[note] then
|
||||
return false
|
||||
end
|
||||
|
@ -207,24 +225,6 @@ function mod:RosterUpdatePostHook()
|
|||
-- self:Print(name, index, rank, note, online, self:IsRaider(index))
|
||||
if ( name and i <= visibleMembers) then
|
||||
if self:IsRaider(index) then
|
||||
-- color if they are on an alt
|
||||
local mainOnAlt = false
|
||||
if (not online and (rankIndex <= 1 or rankIndex == 3 or rankIndex == 5)) then
|
||||
-- elligible main
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
-- self:Print(offset, name)
|
||||
if offset == 0 then
|
||||
i = i + 1
|
||||
|
@ -320,6 +320,16 @@ function mod:RosterUpdatePostHook()
|
|||
offset = offset - 1
|
||||
nonMembers = nonMembers + 1
|
||||
end
|
||||
|
||||
-- color differntly if they are on an alt
|
||||
if (not online and rosterRaidersAlts[name]) then
|
||||
for i=1,4 do
|
||||
local f = button["string"..i]
|
||||
if f then
|
||||
f:SetTextColor(255/255, 218/255, 185/255)
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
nonMembers = nonMembers + 1
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue