WoWInterface SVN LT3GuildRoster

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk
    from Rev 1 to Rev 2
    Reverse comparison

Rev 1 → Rev 2

Main.lua New file
0,0 → 1,460
--==========================================================
-- Variables
--==========================================================
GuildRole_Class_Icon_Tcoords = {["MONK"] = {0, 0.25, 0, 0.25},["WARRIOR"] = {0, 0.25, 0, 0.25}, ["MAGE"] = {0.25, 0.50, 0, 0.25}, ["ROGUE"] = {0.50, 0.75, 0, 0.25}, ["DRUID"] = {0.75, 1, 0, 0.25}, ["HUNTER"] = {0, 0.25, 0.25, 0.5}, ["SHAMAN"] = {0.25, 0.50, 0.25, 0.5}, ["PRIEST"] = {0.50, 0.75, 0.25, 0.5}, ["WARLOCK"] = {0.75, 1, 0.25, 0.5}, ["PALADIN"] = {0, 0.25, 0.5, 0.75}, ["DEATH KNIGHT"] = {0.25, 0.5, 0.5, 0.75} };
GuildRole_Class_Colors = {["MONK"] = "C79C6E", ["WARRIOR"] = "C79C6E", ["MAGE"] = "69CCF0", ["ROGUE"] = "FFF569", ["DRUID"] = "FF7D0A", ["HUNTER"] = "ABD473", ["SHAMAN"] = "0070DE", ["PRIEST"] = "FFFFFF", ["WARLOCK"] = "9482C9", ["PALADIN"] = "F58CBA", ["DEATH KNIGHT"] = "C41F3B" };
-- { Lead, Heal, Tank, Damage }
GuildRole_PortraitRoles_Coords = {{0, 0.32, 0, 0.32}, {0.33, 0.65, 0, 0.32}, {0, 0.32, 0.33, 0.65}, {0.33, 0.65, 0.33, 0.65}};
GuildRole_Roles_Coords = {{0, 0.26, 0, 0.26}, {0.26, 0.51, 0, 0.26}, {0, 0.26, 0.26, 0.51}, {0.26, 0.51, 0.26, 0.51}};
-- Heal, Tank, Damage
Class_Roles = {["MONK"] = "1011", ["WARRIOR"] = "1011", ["MAGE"] = "1001", ["ROGUE"] = "1001", ["DRUID"] = "1111", ["HUNTER"] = "1001", ["SHAMAN"] = "1101", ["PRIEST"] = "1101", ["WARLOCK"] = "1001", ["PALADIN"] = "1111", ["DEATH KNIGHT"] = "1011" };
 
--==========================================================
-- Functions
--==========================================================
 
function GetGuildMemberList(showOffline)
local dataArray = {};
local totalMembers, onlineMembers = GetNumGuildMembers();
local numGuildMembers = (showOffline and totalMembers or onlineMembers);
local sliderMax = numGuildMembers
if sliderMax <13 then sliderMax = 1 end
GGsetSlider(sliderMax)
for i = 1, numGuildMembers do
local name, rank, rankIndex, level, class, zone, note, officernote, online, status, classFileName, achievementPoints, achievementRank, isMobile= GetGuildRosterInfo(i);
name = removeServerFromName(name)
local equip = getiLvl()
-- Info from Saved Variables
if not LT3Roster[name] then
local pData = {};
pData.ScannedAt = date("%m/%d/%y %H:%M:%S")
pData.Level = level;
pData.Name = name;
pData.Online = online;
pData.Roles = Class_Roles[class:upper()]
pData.Class = class
pData.ScannedAt = 0;
pData.iLvL = 0;
pData.Raids = 0;
pData.Dngs = 0;
pData.PrvngGnds = 0;
LT3Roster[name] = pData;
end
local playerData = LT3Roster[name];
playerData.Online = online
table.insert(dataArray, playerData);
end
return dataArray;
end
--==========================================================
-- OnEvent handler with integration code
--==========================================================
function GuildRosterButton_OnClick()
GetGuildMemberList(GuildRosterShowOfflineButton:GetChecked())
RefreshMemeberList()
end
 
function RefreshMemeberList()
loadList()
end
 
function GetStatisticId(StatisticTitle)
local catlist = GetCategoryList()
for x = 1, #catlist do
for i = 1, 1 do
local IDNumber, Name, Points, Completed, Month, Day, Year, Description, Flags, Image, RewardText, IsGuild, WasEarnedByMe, EarnedBy = GetAchievementInfo(catlist[x],i)
if not Name then return -1 end
if string.match(Name,StatisticTitle) then return Name end
end
end
return -1
end
 
function getProvingGround()
local achiveString = GetStatisticId("Proving")
if achiveString == -1 then
return 0
else
if string.match(achiveString,"Bronze") then return 1
elseif string.match(achiveString,"Silver") then return 2
elseif string.match(achiveString,"Gold") then return 3
elseif string.match(achiveString,"Plat") then return 4
else return 5
end
end
end
 
OnEvent = {};
function OnEvent:ADDON_LOADED(arg1)
if arg1 == "LT3GuildRoster" then
if not LT3Options or LT3Options == nil then
LT3Options = {}
LT3Options["Version"] = "1.3"
LT3Options["FirstLoad"] = true
LT3Options["point"] = "Center"
LT3Options["rel2"] = "Center"
LT3Options["x"] = 0
LT3Options["y"] = 0
LT3Options["GuildGroup"] = false
LT3Options["GuildRaid"] = false
LT3Options["Engage"] = 0
end
if not LT3Roster or LT3Roster == nil then
LT3Roster = {}
LT3Roster = {}
end
LT3OnEnable()
GetGuildMemberList(GuildRosterShowOfflineButton:GetChecked());
local loaded, finished = IsAddOnLoaded("LT3GuildRoster")
LT3GuildRoster:SetPoint( LT3Options["point"], nil, LT3Options["rel2"], LT3Options["x"], LT3Options["y"]);
LT3Options["Version"] = "1.3"
revText:SetText(LT3Options["Version"])
if finished then
ShowGroupMemberList();
end
lt3Guildslider:SetScript("OnValueChanged", function (self, value) ShowGroupMemberList() end)
lt3Guildslider:SetScript("OnMouseWheel", function(self, delta) ShowGroupMemberList() end)
 
AutoRefresh:SetChecked()
SendMessage("SET",getUnitName("player"))
end
end
function setRole(roles)
roleButton:Refresh()
end
function LT3OnEnable()
showTitleBar()
showButtonBar()
end
function raidInstance( name, reset)
if LT3Options["RaidName"] == name then
if GetTime() - LT3Options["RaidTime"] > 3600 then
if LT3Options["GuildRaid"] == true then IncEvent("RAIDINC") end
else
 
end
end
LT3Options["RaidName"] = name
LT3Options["RaidTime"] = GetTime()
 
end
function OnEvent:INSTANCE_ENCOUNTER_ENGAGE_UNIT()
if LT3Options["Engage"] == 0 and LT3Options["GuildRaid"] == true then IncEvent("RAIDINC") end
if LT3Options["Engage"] == 0 and LT3Options["GuildGroup"] == true then IncEvent("DNGINC") end
LT3Options["Engage"] = LT3Options["Engage"] + 1
end
function OnEvent:PLAYER_ENTERING_WORLD()
LT3Options["DngTime"] = GetTime()
LT3Options["RaidTime"] = GetTime()
LT3Options["Engage"] = 0
local mapFileName, textureHeight, textureWidth, isIndoor, indoorMapFileName = GetMapInfo();
LT3Options["LastWorld"] = mapFileName
end
 
function OnEvent:RAID_INSTANCE_WELCOME( name, reset)
raidInstance( name, reset)
end
 
function OnEvent:GROUP_ROSTER_UPDATE()
local numGroupMembers = GetNumGroupMembers( )
local isInRaid = IsInRaid()
local inGroup = IsInGroup()
local raidCntr = 0
local guildRaidThreashold = 5
local guildGroupThreashold = 3
local groupCntr = 0
if numGroupMembers > 0 then
if isInRaid then
for i = 1, numGroupMembers do
local name = getUnitName(UnitName("raid"..i));
if LT3Roster[name] then
raidCntr = raidCntr + 1
if raidCntr > guildRaidThreashold then
LT3Options["GuildRaid"] = true
else
LT3Options["GuildRaid"] = false
end
end
end
else
for i = 1, numGroupMembers do
local name = getUnitName(UnitName("party"..i));
if LT3Roster[name] then
groupCntr = groupCntr + 1
if groupCntr > guildGroupThreashold then
LT3Options["GuildGroup"] = true
else
LT3Options["GuildGroup"] = false
end
end
end
end
end
 
end
function removeServerFromName(name)
local N
if name == nil then return -1 end
N = strfind(name,"-")
if N == nil then
return name
else
return strsub(name,1,strfind(name,"-") -1 )
end
end
function OnEvent:GUILD_ROSTER_UPDATE(arg1)
if not AutoRefresh then return end
if AutoRefresh:GetChecked() then
RefreshMemeberList()
end
end
function OnEvent:CHAT_MSG_ADDON( GRprefix, GRMessage, GRType, GRWho)
local q1 = strfind(GRMessage,"#",1)
tWho = strsub(GRMessage,q1 + 1,strfind(GRMessage,"#",q1 +1) -1 )
if GRMessage == "" then return end
if GRprefix == "LT3" then
ACT = strsub(GRMessage,1,strfind(GRMessage,"#") -1 )
if ACT == "SET" then
UpdatePData(GRMessage, removeServerFromName(strtrim(GRWho)))
elseif ACT == "RESET" then
ResetPData(GRMessage)
elseif ACT == "DNGINC" then
IncEvent(ACT, tWho)
elseif ACT == "RAIDINC" then
IncEvent(ACT, tWho)
elseif ACT == "REQUEST" then
SendMessage("SET")
end
end
end
function OnEvent:PLAYER_EQUIPMENT_CHANGED(slotid, wasadded )
local name = getUnitName("player")
if wasadded then
if LT3Roster[name].iLvL == getiLvl() then
 
else
LT3Roster[name].iLvL = getiLvl()
SendMessage("SET")
end
end
end
function IncEvent(ACT, tWho)
local name = getUnitName("player")
print(tWho .. " : ".. name .. " : " .. strmatch(tWho,name))
if tWho == name then
if ACT == "DNGINC" then
LT3Roster[name].Dngs = LT3Roster[name].Dngs + 1
elseif ACT == "RAIDINC" then
LT3Roster[name].Raids = LT3Roster[name].Raids + 1
end
else
if ACT == "DNGINC" then
LT3Roster[name].Dngs = LT3Roster[name].Dngs + 1
elseif ACT == "RAIDINC" then
LT3Roster[name].Raids = LT3Roster[name].Raids + 1
end
end
showChanges(LT3Roster[name])
end
function showChanges(name)
-- if GroupMemberList then
-- GroupMemberList:UpdateMember(pData.Name);
RefreshMemeberList()
-- end
SendMessage("SET", name)
end
function ResetPData(GRMessage)
local a, b, name, pData
a = 1
b = strfind(GRMessage,"#",a)
trash = strsub(GRMessage, a, b - 1)
a = b +1
b = strfind(GRMessage,"#",a)
name = strsub(GRMessage, a, b - 1)
if strsub(GRMessage,7,11) == "Reset" then
name = getUnitName("player")
pData = LT3Roster[name]
else
pData = LT3Roster[name]
end
LT3Roster[name].Dngs = 0
LT3Roster[name].Raids = 0
LT3Roster[pData.Name] = pData
showChanges(pData)
end
function UpdatePData(GRMessage, GRWho)
local a,b,trash
-- Info from Saved Variables
a = 1
b = strfind(GRMessage,"#",a)
trash = strsub(GRMessage, a, b - 1)
a = b +1
b = strfind(GRMessage,"#",a)
LT3Roster[GRWho].Roles = strsub(GRMessage, a, b - 1)
a = b +1
b = strfind(GRMessage,"#",a)
LT3Roster[GRWho].iLvL = strsub(GRMessage, a, b - 1)
a = b +1
b = strfind(GRMessage,"#",a)
LT3Roster[GRWho].Raids = strsub(GRMessage, a, b - 1)
a = b + 1
b = strfind(GRMessage,"#",a)
LT3Roster[GRWho].Dngs = strsub(GRMessage, a, b - 1)
a = b + 1
b = strfind(GRMessage,"#",a)
LT3Roster[GRWho].PrvngGnds = strsub(GRMessage, a, b - 1)
a = b +1
LT3Roster[GRWho].ScannedAt = date("%m/%d/%y %H:%M:%S")
 
RefreshMemeberList()
end
function getiLvl()
local eown , equip = GetAverageItemLevel();
return floor(equip)
end
 
function getUnitName(unit)
local name, realm = UnitName(unit)
return removeServerFromName(name)
end
 
 
function MkMessage(mType,MWho)
local GRMessage
local pData = LT3Roster[getUnitName("player")]
if pData == nil then return end
if mType == "SET" then
GRMessage = "SET#"
GRMessage = GRMessage .. pData.Roles .."#"
GRMessage = GRMessage .. getiLvl() .."#"
GRMessage = GRMessage .. pData.Raids .."#"
GRMessage = GRMessage .. pData.Dngs .."#"
GRMessage = GRMessage .. getProvingGround() .."#"
return GRMessage
elseif mType =="RESET" then
if MWho == nil then
GRMessage = "RESET##ResetEventCounters#"
else
GRMessage = "RESET#".. MWho .. "#ResetEventCounters#"
end
return GRMessage
elseif mType == "DNGINC" then
if MWho == nil then
GRMessage = "DNGINC##INCREMENTDNGEventCounters#"
else
GRMessage = "DNGINC#".. MWho .. "#IncrementDNGEventCounters#"
end
return GRMessage
elseif mType == "RAIDINC" then
if MWho == nil then
GRMessage = "RAIDINC##INCREMENTDNGEventCounters#"
else
GRMessage = "RAIDINC#".. MWho .. "#IncrementRaidEventCounters#"
end
return GRMessage
elseif mType == "REQUEST" then
if MWho == nil then
GRMessage = "REQUEST##BROADCASTREQUEST#"
else
GRMessage = "REQUEST#".. MWho .. "#BROADCASTREQUEST#"
end
return GRMessage
else
GRMessage = "ERROR#OOPSYOUGOTWRONGMESSAGE#"
return GRMessage
end
 
end
function SendMessage(mType, MWho)
GRMessage = MkMessage(mType, MWho)
if GRMessage == -1 then print("No Message") return end
SendAddonMessage("LT3",GRMessage, "GUILD")
print(GRMessage)
 
end
--==========================================================
-- Main frame init
--==========================================================
 
function GR_SlashHandler(msg)
local tWho
local w = strfind(msg, " ")
if w then tWho = strsub(msg, w + 1) end
if strmatch(msg,"send" , 1) then
SendMessage("SET")
elseif strmatch(msg,"reset" ,1) then
if w then
SendMessage("RESET", tWho)
else
SendMessage("RESET")
end
elseif strmatch(msg,"dnginc" , 1) then
if w then
SendMessage("DNGINC", tWho)
else
SendMessage("DNGINC")
end
elseif strmatch(msg,"raidinc" , 1) then
SendMessage("RAIDINC")
elseif strmatch(msg,"show" , 1) then
LT3GuildRoster:Show()
elseif strmatch(msg,"refresh" , 1) then
RefreshMemeberList()
elseif strmatch(msg,"hide" , 1 )then
LT3GuildRoster:Hide()
elseif strmatch(msg,"req" , 1 )then
SendMessage("REQUEST")
else
print("LT3GuildRoster Slash commands are: \r show -- Show LT3 \r hide -- Hide LT3 \r send -- Broadcast your information ")
 
end
end
 
if not LT3GuildRoster then
if RegisterAddonMessagePrefix("LT3") then print("YEA") end
LT3GuildRoster = CreateFrame("Frame", nil, UIParent);
LT3GuildRoster:SetFrameStrata("DIALOG");
LT3GuildRoster:SetWidth(430);
LT3GuildRoster:SetHeight(340); --"Interface/Tooltips/UI-Tooltip-Background""Interface/Tooltips/UI-Tooltip-Border"
LT3GuildRoster:SetBackdrop({bgFile = "Interface/FrameGeneral/UI-Background-Marble", edgeFile = "Interface/DialogFrame/UI-DialogBox-Border", tile = true, tileSize = 16, edgeSize = 16,
insets = { left = 4, right = 4, top = 4, bottom = 4 }});
LT3GuildRoster:SetBackdropColor(0,0,0,.7);
LT3GuildRoster:EnableMouse(true)
LT3GuildRoster:SetMovable(true)
LT3GuildRoster:SetClampedToScreen(true)
LT3GuildRoster:RegisterForDrag("RightButton")
LT3GuildRoster:SetScript("OnDragStart", function(self)if IsAltKeyDown() then self:StartMoving()end end)
LT3GuildRoster:SetScript("OnDragStop",function(self)
self:StopMovingOrSizing()
local a, b, c, x, y = self:GetPoint()
LT3Options["x"] = math.floor(x)
LT3Options["y"] = math.floor(y)
LT3Options["point"] = a
LT3Options["rel1"] = b
LT3Options["rel2"] = c
end)
LT3GuildRoster:SetScript("OnHide", LT3GuildRoster.StopMovingOrSizing)
LT3GuildRoster:Hide()
local closeButton = CreateFrame("Button", nil, LT3GuildRoster);
closeButton:SetWidth(32); closeButton:SetHeight(32);
closeButton:SetPoint("TOPRIGHT", 0, 0);
closeButton:SetScript("OnClick",function (self) LT3GuildRoster:Hide() end)
closeButton:SetNormalTexture( "Interface\\BUTTONS\\UI-Panel-HideButton-Up")
closeButton:SetPushedTexture( "Interface\\BUTTONS\\UI-Panel-HideButton-Up")
lt3Guildslider = GGMakeSlider(LT3GuildRoster)
GroupMemberList = GGCreateFrame(LT3GuildRoster, nil, "TOPLEFT", 10, -53, 400, 210, LT3GuildRoster);
GroupMemberList:Show();
LT3GuildRoster:RegisterEvent("ADDON_LOADED");
LT3GuildRoster:RegisterEvent("CHAT_MSG_ADDON");
LT3GuildRoster:RegisterEvent("PLAYER_ENTERING_WORLD");
LT3GuildRoster:RegisterEvent("GUILD_ROSTER_UPDATE")
LT3GuildRoster:RegisterEvent("GROUP_ROSTER_UPDATE");
LT3GuildRoster:RegisterEvent("INSTANCE_ENCOUNTER_ENGAGE_UNIT")
LT3GuildRoster:RegisterEvent("PLAYER_EQUIPMENT_CHANGED")
LT3GuildRoster:SetScript("OnEvent", function(self, event, ...) OnEvent[event](self, ...) end);
SlashCmdList['LT3GuildRoster_SLASHCMD'] = function(msg)
DEFAULT_CHAT_FRAME:AddMessage(msg or 'nil')
GR_SlashHandler(msg)
end
SLASH_LT3GuildRoster_SLASHCMD1 = '/lt3'
end
UIForms.lua New file
0,0 → 1,310
--==========================================================
-- GroupMemberList Form
--==========================================================
 
function provingGroundsTexture( pgLevel)
if pgLevel == 0 then return "Interface\\BUTTONS\\UI-GroupLoot-Pass-Up"
elseif pgLevel == "1" then return "Interface\\MONEYFRAME\\UI-CopperIcon" --"Interface\\Challenges\\challenges-bronze-sm" end
elseif pgLevel == "2" then return "Interface\\MONEYFRAME\\UI-SilverIcon" --"Interface\\Challenges\\challenges-silver-sm" end
elseif pgLevel == "3" then return "Interface\\MONEYFRAME\\UI-GoldIcon" -- "Interface\\Challenges\\challenges-gold-sm" end
elseif pgLevel == "4" then return "Interface\\ICONS\\INV_Misc_Coin_16"
else return "Interface\\ICONS\\INV_Misc_Coin_17" end
end
function showButtonBar()
-- Buttons on bottom of main frame
local VPointer = 5
local bb = GGCreateFrame(LT3GuildRoster,nil, "BOTTOMLEFT", 5, VPointer,LT3GuildRoster:GetWidth()-10, 65 , LT3GuildRoster)
local mb = CreateFrame("CheckButton", "GuildRosterShowOfflineButton", bb, "ChatConfigCheckButtonTemplate")
mb:SetPoint("BOTTOMLEFT",10,5 );
mb.tooltip = "Check to show offline members";
mb:SetScript("OnClick",
function()
RefreshMemeberList()
end
)
mbText = GGCreateFontString(bb, "$parentName", "BOTTOMLEFT", 40, 0, 200, 32, "GameFontHighlightLeft", true, "Show Offline Members" )
mb:Show()
mbText:Show()
local ar = CreateFrame("CheckButton", "AutoRefresh", bb, "ChatConfigCheckButtonTemplate")
ar:SetPoint("TOPLEFT",10,-5 );
ar.tooltip = "Auto update member list";
--[[ ar:SetScript("OnClick",
function()
RefreshMemeberList()
end
) ]]--
arText = GGCreateFontString(bb, nil, "TOPLEFT", 40, 0, 200, 32, "GameFontHighlightLeft", true, "Auto Refresh" )
ar:Show()
arText:Show()
 
revText = GGCreateFontString(bb, "$parentName", "BOTTOMRIGHT", 0, 0, 30, 32, "GameFontHighlightLeft", true, "1.1")
bb.RoleButtons = {};
for i = 1, 4 do
local coords = GuildRole_Roles_Coords[i];
roleButton = CreateFrame("Button", nil, bb);
roleButton:SetWidth(30); roleButton:SetHeight(30);
roleButton:SetPoint("BOTTOMRIGHT",-60 -40*(i-1),20);
roleButton.Index = i;
 
roleButton.Icon = GGCreateTexture(roleButton, nil, "TOPLEFT", 0, 0, 40, 40, "ARTWORK", "Interface\\LFGFrame\\UI-LFG-ICON-ROLES");
roleButton.Icon:SetTexCoord(coords[1], coords[2], coords[3], coords[4]);
roleButton.HoverIcon = roleButton:CreateTexture(nil, "OVERLAY");
-- if not LT3Roster[getUnitName("player")] then return end
function roleButton:Refresh()
local classRoles
 
if LT3Roster[getUnitName("player")] == nil then
-- classRoles = "0000"
local classDisplayName, class, classID = UnitClass("player")
classRoles = Class_Roles[class:upper()]
else
classRoles = LT3Roster[getUnitName("player")].Roles
end
if not classRoles then return end
local roleIcon = self.Icon;
local hoverIcon = self.HoverIcon;
if classRoles:sub(i,i) == "0" then
roleIcon:SetAlpha(0); -- Hiding roles player cant perform by class.
else
hoverIcon:SetTexture(nil);
if classRoles:sub(i,i) == "1" then roleIcon:SetAlpha(0.4); else roleIcon:SetAlpha(1); end
if classRoles:sub(i,i) == "P" then
hoverIcon:SetTexture("Interface\\LFGFrame\\UI-LFG-ICON-ROLES");
hoverIcon:SetWidth(40);hoverIcon:SetHeight(40);
hoverIcon:SetPoint("TOPLEFT", 0, 0);
hoverIcon:SetTexCoord(coords[1], coords[2], coords[3], coords[4]);
hoverIcon:SetBlendMode("ADD");
end
if classRoles:sub(i,i) == "X" then
hoverIcon:SetTexture("Interface\\BUTTONS\\UI-GroupLoot-Pass-Up")
hoverIcon:SetWidth(60);hoverIcon:SetHeight(60);
hoverIcon:SetPoint("TOPLEFT", -9, 12);
hoverIcon:SetTexCoord(0, 1, 0, 1);
hoverIcon:SetBlendMode("ADD");
end
end
end -- function end
 
roleButton:Refresh();
 
roleButton:SetScript("OnClick", function(self, button, down)
local index = self.Index;
local choices = "1PX";
local curRoles = LT3Roster[getUnitName("player")].Roles;
local roles = ""; local cIndex;
for i = 1, string.len(choices) do if choices:sub(i,i) == curRoles:sub(index, index) then cIndex = i end end;
for i = 1, 4 do if i == index then
roles = roles..(cIndex < string.len(choices) and choices:sub(cIndex+1,cIndex+1) or choices:sub(1,1));
else roles = roles..curRoles:sub(i, i);
end
end
LT3Roster[getUnitName("player")].Roles = roles;
SendMessage("SET",getUnitName("player"))
self:Refresh();
end);
end
 
end
function showTitleBar()
-- Top of Main Frame with Guild Name and column names
local VPointer = -5
local TitleOffset = 50
local function NextLine() VPointer = VPointer - 15; return VPointer; end
local function NextColumn(LastH) HPointer = HPointer + LastH return HPointer end
tt = GGCreateFrame(LT3GuildRoster,nil, "TOPLEFT", 0, VPointer, LT3GuildRoster:GetWidth(), 48, LT3GuildRoster)
NextLine()
local titleString = GGCreateFontString(tt, nil, "TOPLEFT", TitleOffset, 0, 300, 32, "GameFontHighlightLeft", true, "Less Than 3 Guild Roster" )
titleString:SetTextColor(1, .1, .1)
GGCreateFontString(tt, nil, "TOPLEFT", 15, NextLine(), 30, 16, "GameFontHighlightLeft", true, "Lvl" )
GGCreateFontString(tt, nil, "TOPLEFT",48, VPointer, 32, 16, "GameFontHighlightLeft", true, "Cls" )
GGCreateFontString(tt, nil, "TOPLEFT", 88, VPointer, 32, 16, "GameFontHighlightLeft", true, "Role" )
GGCreateFontString(tt, nil, "TOPLEFT", 160, VPointer, 100, 16, "GameFontHighlightLeft", true, "Name" )
GGCreateFontString(tt, nil, "TOPLEFT",235, VPointer, 40, 16, "GameFontHighlightLeft", true, "PVG" )
GGCreateFontString(tt, nil, "TOPLEFT", 280, VPointer, 40, 16, "GameFontHighlightLeft", true, "iLvL" )
GGCreateFontString(tt, nil, "TOPLEFT", 320, VPointer, 40, 16, "GameFontHighlightLeft", true, "Raids" )
GGCreateFontString(tt, nil, "TOPLEFT", 370, VPointer, 40, 16, "GameFontHighlightLeft", true, "Dngs" )
local refreshButton = CreateFrame("Button", nil, tt);
refreshButton:SetWidth(80); refreshButton:SetHeight(30);
refreshButton:SetPoint("RIGHT", tt, "RIGHT", -50, 10);
refreshButton:SetText("Refresh")
refreshButton:SetNormalFontObject("GameFontNormal")
local ntex = refreshButton:CreateTexture()
ntex:SetTexture("Interface/Buttons/UI-Panel-Button-Up")
ntex:SetTexCoord(0, 0.625, 0, 0.6875)
ntex:SetAllPoints()
refreshButton:SetNormalTexture(ntex)
local ptex = refreshButton:CreateTexture()
ptex:SetTexture("Interface/Buttons/UI-Panel-Button-Down")
ptex:SetTexCoord(0, 0.625, 0, 0.6875)
ptex:SetAllPoints()
refreshButton:SetPushedTexture(ptex)
refreshButton:SetPushedTexture(ptex)
refreshButton:SetScript("OnClick",function (self) RefreshMemeberList() end )
end
 
function clearRow(i)
rowLevel[i]:SetText(nil)
rowNames[i]:SetText(nil)
clasIcon[i]:SetTexture(nil)
roleIcon1[i]:SetAlpha(0)
roleIconH1[i]:SetAlpha(0)
roleIcon2[i]:SetAlpha(0)
roleIconH2[i]:SetAlpha(0)
roleIcon3[i]:SetAlpha(0)
roleIconH3[i]:SetAlpha(0)
roleIcon4[i]:SetAlpha(0)
roleIconH4[i]:SetAlpha(0)
rowPVG[i]:SetTexture(nil)
rowiLvL[i]:SetText(nil)
rowRaids[i]:SetText(nil)
rowDngs[i]:SetText(nil)
end
 
function loadList()
local displayRows = 14
local displayRowHeight = 16
local ofsx = 0
ofsy = 0
local pInfoArray = GetGuildMemberList(GuildRosterShowOfflineButton:GetChecked());
-- if not pInfoArray then return end
v = lt3Guildslider:GetValue()
for i = 1, displayRows do
if pInfoArray[v] == nil then
clearRow(i)
else
local name = pInfoArray[v].Name;
if LT3Roster[pInfoArray[v].Name].Class and LT3Roster[pInfoArray[v].Name].Class:upper() ~= "UNKNOWN" then
name = "\124cFF"..(pInfoArray[v].Online and GuildRole_Class_Colors[pInfoArray[v].Class:upper()] or "808080")..pInfoArray[v].Name.."\124r";
end
rowNames[i]:SetText(name)
rowLevel[i]:SetText(LT3Roster[pInfoArray[v].Name].Level)
clasIcon[i]:SetTexture("Interface\\Glues\\CharacterCreate\\UI-CharacterCreate-Classes")
local coords;
if LT3Roster[pInfoArray[v].Name].Class and LT3Roster[pInfoArray[v].Name].Class:upper() ~= "UNKNOWN" then coords = GuildRole_Class_Icon_Tcoords[LT3Roster[pInfoArray[v].Name].Class:upper()]; end
if coords then clasIcon[i]:SetTexCoord(coords[1], coords[2], coords[3], coords[4]);
else clasIcon[i]:SetTexCoord(0.5, 0.75, 0.5, 0.75);
end
if LT3Roster[pInfoArray[v].Name].Roles:sub(1,1) == "P" then
roleIcon1[i]:SetAlpha(1)
elseif LT3Roster[pInfoArray[v].Name].Roles:sub(1,1) == "X" then
roleIcon1[i]:SetAlpha(1)
roleIconH1[i]:SetAlpha(1)
else
roleIcon1[i]:SetAlpha(0)
roleIconH1[i]:SetAlpha(0)
end
if LT3Roster[pInfoArray[v].Name].Roles:sub(2,2) == "P" then
roleIcon2[i]:SetAlpha(1)
elseif LT3Roster[pInfoArray[v].Name].Roles:sub(2,2) == "X" then
roleIcon2[i]:SetAlpha(1)
roleIconH2[i]:SetAlpha(1)
else
roleIcon2[i]:SetAlpha(0)
roleIconH2[i]:SetAlpha(0)
end
if LT3Roster[pInfoArray[v].Name].Roles:sub(3,3) == "P" then
roleIcon3[i]:SetAlpha(1)
elseif LT3Roster[pInfoArray[v].Name].Roles:sub(3,3) == "X" then
roleIcon3[i]:SetAlpha(1)
roleIconH3[i]:SetAlpha(1)
else
roleIcon3[i]:SetAlpha(0)
roleIconH3[i]:SetAlpha(0)
end
if LT3Roster[pInfoArray[v].Name].Roles:sub(4,4) == "P" then
roleIcon4[i]:SetAlpha(1)
elseif LT3Roster[pInfoArray[v].Name].Roles:sub(4,4) == "X" then
roleIcon4[i]:SetAlpha(1)
roleIconH4[i]:SetAlpha(1)
else
roleIcon4[i]:SetAlpha(0)
roleIconH4[i]:SetAlpha(0)
end
if not pInfoArray[v] then return end
if rowPVG[i] then rowPVG[i]:SetTexture(provingGroundsTexture( LT3Roster[pInfoArray[v].Name].PrvngGnds)) end
if rowiLvL[i] then rowiLvL[i]:SetText(LT3Roster[pInfoArray[v].Name].iLvL) end
if rowRaids[i] then rowRaids[i]:SetText(LT3Roster[pInfoArray[v].Name].Raids) end
if rowDngs[i] then rowDngs[i]:SetText(LT3Roster[pInfoArray[v].Name].Dngs)end
end
v=v+1
end
end
 
local function CreateRow(i, ofsx, ofsy, MLwidth, displayRowHeight)
local fb = GGCreateListButton(GroupMemberList, nil,"TOPLEFT", 0, - ofsy, MLwidth - 10, displayRowHeight, nil, nil)
rowLevel[i] = GGCreatePDField(fb,"TOPLEFT", 0,0 , 35, 16)
clasIcon[i] = GGCreateTexture(fb , nil, "TOPLEFT", 40, 0 , 16, 16, "BORDER", nil)
roleIcon1[i] = GGCreateTexture(fb, nil, "TOPLEFT", 108, 0, 16, 16, "BORDER", "Interface\\LFGFrame\\UI-LFG-ICON-PORTRAITROLES" )
roleIcon1[i]:SetTexCoord(0, 0.32, 0, 0.32);
roleIcon1[i]:SetAlpha(0)
roleIconH1[i] = GGCreateTexture(fb, nil, "TOPLEFT", 108, 0, 16, 16, "OVERLAY", "Interface\\BUTTONS\\UI-GroupLoot-Pass-Up" )
roleIconH1[i]:SetTexCoord(0, 1, 0, 1)
roleIconH1[i]:SetBlendMode("ADD");
roleIconH1[i]:SetAlpha(0)
roleIcon2[i] = GGCreateTexture(fb, nil, "TOPLEFT", 92, 0, 16, 16,"BORDER", "Interface\\LFGFrame\\UI-LFG-ICON-PORTRAITROLES" )
roleIcon2[i]:SetTexCoord(0.33, 0.65, 0, 0.32);
roleIcon2[i]:SetAlpha(0)
roleIconH2[i] = GGCreateTexture(fb, nil, "TOPLEFT", 92, 0, 16, 16, "OVERLAY","Interface\\BUTTONS\\UI-GroupLoot-Pass-Up")
roleIconH2[i]:SetTexCoord(0, 1, 0, 1);
roleIconH2[i]:SetBlendMode("ADD");
roleIconH2[i]:SetAlpha(0)
roleIcon3[i] = GGCreateTexture(fb, nil, "TOPLEFT", 76, 0, 16, 16, "BORDER", "Interface\\LFGFrame\\UI-LFG-ICON-PORTRAITROLES")
roleIcon3[i]:SetTexCoord(0, 0.32, 0.33, 0.65);
roleIcon3[i]:SetAlpha(0)
roleIconH3[i] = GGCreateTexture(fb, nil, "TOPLEFT", 76, 0, 16, 16,"OVERLAY", "Interface\\BUTTONS\\UI-GroupLoot-Pass-Up")
roleIconH3[i]:SetTexCoord(0, 1, 0, 1);
roleIconH3[i]:SetBlendMode("ADD");
roleIconH3[i]:SetAlpha(0)
roleIcon4[i] = GGCreateTexture(fb, nil, "TOPLEFT", 60, 0, 16, 16, "BORDER", "Interface\\LFGFrame\\UI-LFG-ICON-PORTRAITROLES")
roleIcon4[i]:SetTexCoord(0.33, 0.65, 0.33, 0.65);
roleIcon4[i]:SetAlpha(0)
roleIconH4[i] = GGCreateTexture(fb, nil, "TOPLEFT", 60, 0, 16, 16,"OVERLAY","Interface\\BUTTONS\\UI-GroupLoot-Pass-Up" )
roleIconH4[i]:SetTexCoord(0, 1, 0, 1);
roleIconH4[i]:SetBlendMode("ADD");
roleIconH4[i]:SetAlpha(0)
rowNames[i] = GGCreatePDField(fb, "TOPLEFT", 120, 0, 100, 16)
rowPVG[i] = GGCreateTexture(fb , nil, "TOPLEFT", 230, 0 , 16, 16, "BORDER", nil)
rowiLvL[i] = GGCreatePDField(fb,"TOPLEFT", 265,0 , 40, 16)
rowRaids[i] = GGCreatePDField(fb, "TOPLEFT", 308,0 , 40, 16)
rowDngs[i] = GGCreatePDField(fb, "TOPLEFT", 355, 0 , 40, 16)
return
-- rowlevel , clasIcon, roleIcon1,roleIcon2,roleIcon3,roleIcon4, rowNames, rowPVG, rowiLvL , rowRaids, rowDngs
end
rowLevel={}
clasIcon={}
roleIcon1 = {}
roleIconH1 = {}
roleIcon2= {}
roleIconH2= {}
roleIcon3 = {}
roleIconH3 = {}
roleIcon4 = {}
roleIconH4 = {}
rowNames={}
rowPVG = {}
rowiLvL = {}
rowRaids = {}
rowDngs = {}
 
function ShowGroupMemberList()
local displayRows = 14
local displayRowHeight = 16
local mofsx = 0
local mofsy = 0
if #rowLevel > 10 then
 
loadList()
else
lt3Guildslider:SetValue(1)
local v = lt3Guildslider:GetValue()
 
for i = 1, displayRows do
CreateRow(i, mofsx, mofsy, 355, 16)
i = i + 1
mofsy = mofsy + displayRowHeight
end
end
return
end
 
 
\ No newline at end of file
LT3GuildRoster.toc New file
0,0 → 1,9
## Interface: 60000
## Title: LT3GuildRoster
## SavedVariables: LT3Roster, LT3Options
 
 
 
UIElements.lua
UIForms.lua
Main.lua
\ No newline at end of file
UIElements.lua New file
0,0 → 1,143
--==========================================================
-- Saved Variable Definitions
--==========================================================
 
--==========================================================
-- UI Elements
--==========================================================
function GGCreateFrame(frame, name, point, ofsx, ofsy, width, height, inherit)
local lframe = CreateFrame("Frame", name, frame, inherit);
lframe:SetFrameStrata("DIALOG");
lframe:SetPoint(point, ofsx, ofsy);
lframe:SetWidth(width);
lframe:SetHeight(height);
return lframe;
end
 
function GGCreateScrollFrame(frame, name, point, ofsx, ofsy, width, height, child, sliderTemplate)
local scrollFrame = CreateFrame("ScrollFrame", name, frame);
scrollFrame:SetFrameStrata("DIALOG");
scrollFrame:SetPoint(point, ofsx, ofsy);
scrollFrame:SetWidth(width);
scrollFrame:SetHeight(height);
scrollFrame:SetScrollChild(child);
function scrollFrame:Update()
local slider = self.ScrollBar;
local max = scrollFrame:GetScrollChild():GetHeight() - self:GetHeight(); if max < 0 then max = 0; slider:Disable(); else slider:Enable(); end
slider:SetMinMaxValues(0, max);
end
local slider = CreateFrame("Slider", "$parentScrollBar", scrollFrame, sliderTemplate);
slider:SetPoint("TOPLEFT", scrollFrame, "TOPRIGHT", 6, -16);
slider:SetPoint("BOTTOMLEFT", scrollFrame, "BOTTOMRIGHT", 6, 16);
slider:SetValueStep(1);
slider:SetValue(0);
slider:SetScript("OnValueChanged", function(self, value) self.ScrollFrame:SetVerticalScroll(value) end);
slider.ScrollFrame = scrollFrame;
scrollFrame.ScrollBar = slider;
scrollFrame.ScrollBar:Show();
scrollFrame:Update();
 
scrollFrame:SetScript("OnMouseWheel", function(self, value)
local sliderMin, sliderMax = self.ScrollBar:GetMinMaxValues();
local svalue = self.ScrollBar:GetValue();
svalue = svalue - value*50;
if svalue < sliderMin then svalue = sliderMin; end
if svalue > sliderMax then svalue = sliderMax; end
self.ScrollBar:SetValue(svalue);
end);
 
return scrollFrame;
end
 
function GGCreateTexture(frame, name, point, ofsx, ofsy, width, height, layer, path)
local texture = frame:CreateTexture(nil, layer);
texture:SetWidth(width); texture:SetHeight(height);
texture:SetPoint(point, ofsx, ofsy);
texture:SetTexture(path);
return texture;
end
 
function GGCreateButton(frame, name, point, ofsx, ofsy, width, height, inherit, handler, text)
local button = CreateFrame("Button", name, frame, inherit);
button:SetFrameStrata("DIALOG");
button:SetPoint(point, ofsx, ofsy);
if width then button:SetWidth(width); end
if height then button:SetHeight(height); end
if text then button:SetText(text); end
button:SetScript("OnClick", handler);
return button;
end
 
function GGCreateEditBox(frame, name, point, ofsx, ofsy, width, height, inherit, multiline, font, text, maxLetters)
local editBox = CreateFrame("EditBox", name, frame, inherit);
editBox:ClearAllPoints()
editBox:SetFrameStrata("DIALOG");
editBox:SetWidth(width);
if height then editBox:SetHeight(height); end
editBox:SetPoint(point, ofsx, ofsy)
editBox:SetText(text);
editBox:EnableMouse(true);
editBox:SetAutoFocus(false);
editBox:SetFontObject(font or GameFontHighlightLeft);
if multiline then editBox:SetMultiLine(multiline); end
if maxLetters then editBox:SetMaxLetters(maxLetters); end
return editBox;
end
 
function GGCreateFontString(frame, name, point, ofsx, ofsy, width, height, inherit, nospacewrap, text)
local fontString = frame:CreateFontString(name, "OVERLAY", inherit);
fontString:SetPoint(point, ofsx, ofsy);
fontString:SetText(text);
if width then fontString:SetWidth(width); end
if height then fontString:SetHeight(height); end
if nospacewrap then fontString:SetNonSpaceWrap(nospacewrap); end
return fontString;
end
 
function GGCreateListButton(frame, name, point, ofsx, ofsy, width, height, inherit, handler)
local button = CreateFrame("Button", name, frame, inherit);
button:SetFrameStrata("DIALOG");
button:SetPoint(point, ofsx, ofsy);
if width then button:SetWidth(width); end
if height then button:SetHeight(height); end
button:SetHighlightTexture("Interface\\FriendsFrame\\UI-FriendsFrame-HighlightBar", "ADD");
button:SetScript("OnClick", handler);
button:RegisterForClicks("AnyUp");
return button;
end
 
function GGCreatePDField(f,Point, ofsx , ofsy, fwidth, fheight)
local text = f:CreateFontString(nil, "OVERLAY", nil)
-- text:SetTextColor(1, 1, 1, 1)
-- text:ClearAllPoints()
text:SetWidth(fwidth)
text:SetHeight(fheight)
text:SetPoint(Point, f,Point, ofsx, ofsy)
-- text:SetJustifyH("LEFT")
-- text:SetJustifyV("TOP")
text:SetFont(STANDARD_TEXT_FONT, 12, "OUTLINE")
return text
end
 
function GGMakeSlider(Parent)
local lt3GuildSlider = CreateFrame("Slider", nil, LT3GuildRoster) -- , "OptionsSliderTemplate");
lt3GuildSlider:SetPoint("RIGHT", -10, 0);
lt3GuildSlider:SetWidth(10)
lt3GuildSlider:SetHeight(200)
lt3GuildSlider:SetOrientation("VERTICAL")
lt3GuildSlider:SetThumbTexture("Interface\\Buttons\\UI-ScrollBar-Knob")
-- lt3GuildSlider:SetMinMaxValues(1,28)
lt3GuildSlider:SetValueStep(1);
lt3GuildSlider:SetObeyStepOnDrag(true)
lt3GuildSlider:SetStepsPerPage(14)
lt3GuildSlider:SetBackdrop({
bgFile = "Interface\\Buttons\\UI-SliderBar-Background",
edgeFile = "Interface\\Buttons\\UI-SliderBar-Border",
tile = true, tileSize = 8, edgeSize = 8,
insets = { left = 3, right = 3, top = 6, bottom = 6 }})
lt3GuildSlider:EnableMouseWheel(true)
function GGsetSlider(maxValue)
lt3GuildSlider:SetMinMaxValues(1,maxValue)
end
return lt3GuildSlider
end
\ No newline at end of file
ReadMe.txt New file
0,0 → 1,42
LT3GuildRoster - Version 1.3
 
LT3GuildRoster is an addon that displays a guildmember list
with additional guildie information like desired roles, ilevel,
and guild event counters.
 
LT3GuildRoster is a multi player distributed addon.
Each character broadcasts their information via the addon chat channel.
Each character has its own guild memberlist db.
 
Character level, Class, and Name are taken from the local (system your sitting at)
System and are not part of the broadcast.
 
The local user can set the role for any and all other characters.
Only the role set for the local users currently active character is broadcast.
only the last DB update is retained.
This means that a local user can set roles for all characters even if that character does
not have the addon.
 
A characters ilevel, raid count, dungeon count, Proving Grounds rating are only
available by chatterer broadcast.
 
The addon has the following slash commands.
\lt3 show - show the addon, used if addon is closed.
\lt3 hide - hides the addon, used if addon is visable.
\lt3 send - broadcasts a request for other apps to broadcast
\lt3 refresh - force an update of the apps Guildmember list
 
Use the games Key Binding - TOGGLE_LT3GuildRoster to bind a show/hide key
 
The main window is moved by holding down the <alt> and right mouse click, Drag and drop.
 
The following criteria is required for Guild Event Counting (Raid and Dungeons) (not fully tested).
Raid Counter
1) A Raid group with at least 4 other guild members
2) zone into a Raid Instance
3) Attack a Boss.
Dungeon Counter
1) A Raid group with at least 2 other guild members
2) zone into a Raid Instance
3) Attack a Boss.
 
Bindings.xml New file
0,0 → 1,9
<Bindings>
<Binding name="TOGGLE_LT3GuildRoster" description="Toggle LT3GuildRoster window" header="LT3GuildRoster">
if LT3GuildRoster:IsShown() then
LT3GuildRoster:Hide()
else
LT3GuildRoster:Show()
end
</Binding>
</Bindings>
\ No newline at end of file