PK N
RaidRolls/PK
zsN2 2 RaidRolls/cli.lualocal Addon_Name, bc = ...
SLASH_COLORENCODE1 = '/raidrolls';
SLASH_COLORENCODE2 = '/rr';
SlashCmdList["COLORENCODE"] = function(msg, editbox)
if msg == "" then
print("Cmds: show, hide, help, reset.")
elseif msg == "show" then
bc.show(true)
elseif msg == "hide" then
bc.show(false)
elseif msg == "help" then
raidrollsHelp()
elseif msg == "reset" then
bc.reset()
end
end
function raidrollsHelp()
print(GetAddOnMetadata("RaidRolls", "Title") .. " v" .. GetAddOnMetadata("RaidRolls", "Version") .. ".");
print("Slash Commands '/raidrolls' (or '/rr'):")
print(" none - Commands list.")
print(" 'show'/'hide' - Show/Hide GUI.")
print(" 'help' - Uroboros!")
print(" 'reset' - Erace all rolls.")
end
PK
jNJ8 8 RaidRolls/colours.lualocal Addon_Name, bc = ...
-- From https://wow.gamepedia.com/Class_colors.
classColours = {
["HUNTER"] = "|cFFABD473",
["WARLOCK"] = "|cFF8787ED",
["PRIEST"] = "|cFFFFFFFF",
["PALADIN"] = "|cFFF58CBA",
["MAGE"] = "|cFF40C7EB",
["ROGUE"] = "|cFFFFF569",
["DRUID"] = "|cFFFF7D0A",
["SHAMAN"] = "|cFF0070DE",
["WARRIOR"] = "|cFFC79C6E",
["DEATHKNIGHT"] = "|cFFC41F3B",
["MONK"] = "|cFF00FF96",
["DEMONHUNTER"] = "|cFFA330C9",
};
bc.classColours = classColours
channelColours = {
['RAID'] = "|cFFFF7D00",
['PARTY'] = "|cFFAAA7FF",
}
bc.channelColours = channelColours
PK
-Nק RaidRolls/main.lualocal Addon_Name, bc = ...
local rollers = {}
RaidRollsShown = true
local FSPool = {}
local function getFS(i)
local f = FSPool[i]
if not f then
f = {}
l = RaidRolls_MainFrame:CreateFontString("$parent_FSL" .. tostring(i), "RaidRolls_MainFrame", "GameTooltipText")
l:SetHeight(20)
r = RaidRolls_MainFrame:CreateFontString("$parent_FSR" .. tostring(i), "RaidRolls_MainFrame", "GameTooltipText")
r:SetHeight(20)
f = { L = l, R = r}
tinsert(FSPool, f)
else
f.L:Show()
f.R:Show()
end
return f
end
function onload(self)
print(GetAddOnMetadata("RaidRolls", "Title") .. " v" .. GetAddOnMetadata("RaidRolls", "Version") .. " loaded. Type /raidrolls for help.");
end
local function name2raidIndex(target)
for i = 1, GetNumRaidMembers() do
local name, _, _, _, _, _, _, _, _, _, _ = GetRaidRosterInfo(i)
if (name == target) then
return i
end
end
return nil
end
local function myLength(tab)
local count = 0
for k,v in pairs(tab) do
count = count + 1
end
return count
end
local function group()
groupType = nil
if (UnitInRaid("player")) then
groupType = "RAID"
elseif (UnitInParty("player")) then
groupType = "PARTY"
end
return groupType
end
local function update()
groupType = group()
if (groupType == nil) then return end
RaidRolls_MainFrame:SetHeight(5 + 15 + 10 + 20 * myLength(rollers));
sortedRollers = {}
for k, v in pairs(rollers) do
-- k = name; v = roll
table.insert(sortedRollers, { k = k, v = v })
end
table.sort(sortedRollers,
function(lhs, rhs) return math.abs(lhs.v) > math.abs(rhs.v) end)
local i = 1
for k, v in pairs(sortedRollers) do
-- v.k = name; v.v = roll
local Name, subgroup, class, fileName
if (groupType == "RAID") then
local index = name2raidIndex(v.k)
Name, _, subgroup, _, class, fileName, _, _, _, _, _ = GetRaidRosterInfo(index)
elseif (groupType == "PARTY") then
if (not UnitInParty(v.k)) then return end
Name = v.k
subgroup = "P"
class, fileName = UnitClass(v.k)
end
local roll = ""
if (v.v > 0) then
roll = v.v
else
roll = "|cFFFF0000" .. math.abs(v.v) .. "|r"
end
local parent = ""
if (i == 1) then
parentL = "$parent_Player"
parentR = "$parent_Roll"
else
parentL = "$parent_FSL" .. tostring(i - 1)
parentR = "$parent_FSR" .. tostring(i - 1)
end
local FS = getFS(i)
FS.L:SetText(Name .. " (" .. bc.classColours[fileName] .. class .. "|r)[" .. bc.channelColours[groupType] .. subgroup .. "|r]")
FS.R:SetText(roll)
FS.L:SetPoint("TOPLEFT", parentL, "BOTTOMLEFT")
FS.R:SetPoint("TOPLEFT", parentR, "BOTTOMLEFT")
i = i + 1
end
local myLengthFSPool = myLength(FSPool)
while (i <= myLengthFSPool) do
FS = getFS(i)
FS.L:Hide()
FS.R:Hide()
i = i + 1
end
end
local function reset()
rollers = {}
update()
end
bc.reset = reset
local function show(bool)
RaidRollsShown = bool
if (bool) then
RaidRolls_MainFrame:Show()
else
RaidRolls_MainFrame:Hide()
end
end
bc.show = show
local ChatSystem_EventFrame = CreateFrame("Frame")
ChatSystem_EventFrame:RegisterEvent("CHAT_MSG_SYSTEM")
ChatSystem_EventFrame:SetScript("OnEvent",
function(self, event, ...)
if (group() == nil) then return end
local msg = select(1, ...)
if msg then
-- Roll message.
if (string.find(msg, "rolls") ~= nil) then
local name, roll, minRoll, maxRoll = msg:match("^(.+) rolls (%d+) %((%d+)%-(%d+)%)$")
local minRoll = tonumber(minRoll)
local maxRoll = tonumber(maxRoll)
if not(name and minRoll == 1 and maxRoll == 100) then return end
if (rollers[name] == nil) then
rollers[name] = tonumber(roll)
else
--~ rollers[name] = -math.max(math.abs(rollers[name]), roll)
rollers[name] = -roll
end
update()
-- Leave raid msg.
elseif (string.find(msg, "has left the raid group.") ~= nil) then
local name = msg:match("^(.+) has left the raid group.$")
if name then
rollers[name] = nil
update()
end
-- Leave party msg.
elseif (string.find(msg, "leaves the party.") ~= nil) then
local name = msg:match("^(.+) leaves the party.$")
if name then
print("X" .. name .. "X")
rollers[name] = nil
update()
end
end
end
end)
local ChatChannel_EventFrame = CreateFrame("Frame")
ChatChannel_EventFrame:RegisterEvent("CHAT_MSG_PARTY")
ChatChannel_EventFrame:RegisterEvent("CHAT_MSG_RAID")
ChatChannel_EventFrame:SetScript("OnEvent",
function(self, event, ...)
if (group() == nil) then return end
local msg = select(1, ...)
if msg then
-- Find "pass".
--~ update()
end
end)
local Raid_EventFrame = CreateFrame("Frame")
Raid_EventFrame:RegisterEvent("PARTY_MEMBERS_CHANGED")
Raid_EventFrame:SetScript("OnEvent",
function(self, event, ...)
update()
end)
local Load_EventFrame = CreateFrame("Frame")
Load_EventFrame:RegisterEvent("ADDON_LOADED")
Load_EventFrame:SetScript("OnEvent",
function(self, event, ...)
if (event == "ADDON_LOADED" and ... == "RaidRolls") then
if RaidRollsShown == nil then
-- This is the first time this addon is loaded; initialize to true.
RaidRollsShown = true;
end
show(RaidRollsShown)
end
end)
PK
7N:K RaidRolls/main.xml
RaidRolls_MainFrame:StartMoving();
RaidRolls_MainFrame:StopMovingOrSizing();
PK
N RaidRolls/RaidRolls.toc## Interface: 40300
## Title: Raid Rolls
## Notes: List raid member rolls.
## Author: Martin Brajer
## Version: 1.1
## SavedVariablesPerCharacter: RaidRollsShown
cli.lua
colours.lua
main.xml
PK? N
$ RaidRolls/
Nj@FNj@Fߌ