--[[ GuildRosterScaner v3.0b1 Part of the GuildToolS package. Dependancy: GTS_Core - Scans the entire guild roster including name, level, class, rank, professions*, main-alt relations*. * - only if the guild note was properly entered (see manual). Author: Roman Tarakanov (RTE/Arthas) Date: May 14 '06 ]]-- --------------------------------------------------------------- ----------------------Standart mesages------------------------- --------------------------------------------------------------- GTS_GRS_VER = "3.0b1"; GTS_MSG["GRS_GREETING"] = "GTS_GuildRosterScan v" .. GTS_GRS_VER .. " is loaded."; GTS_MSG["GRS_DONE"] = "GuildRosterScan | Success : scan was successful, now you can log out and run GuildRosterParser.exe to get html file."; GTS_MSG["GRS_NOGUILD"] = "GuildRosterScan | Error : this character does not belong to any guild."; GTS_MSG["GRS_CLEARED"] = "GuildRosterScan varibles are cleared for this character."; --------------------------------------------------------------- --------------Global GuildRosterScan variables----------------- --------------------------------------------------------------- local prof={}; prof["Alch"]="Alchemy"; prof["BS"]="Blacksmith"; prof["BS(Sw)"]="Master Swordsmith"; prof["BS(Ax)"]="Master Axesmith"; prof["BS(H)"]="Master Hammersmith"; prof["BS(Ar)"]="Armorsmith"; prof["BS(W)"]="Weaponsmith"; prof["Ench"]="Enchanting"; prof["Eng"]="Engineering"; prof["Eng(Gn)"]="Gnome Engineering"; prof["Eng(Go)"]="Goblin Engineering"; prof["Herb"]="Herbalism"; prof["LW"]="Leatherworking"; prof["LW(E)"]="Elemental Leatherworking"; prof["LW(D)"]="Dragonscale Leatherworking"; prof["LW(T)"]="Tribal Leatherworking"; prof["Mine"]="Mining"; prof["Skin"]="Skinning"; prof["Tail"]="Tailoring"; for k,v in prof do prof[v]=v; end prof["Tailor"]="Tailoring"; prof["Skinner"]="Skinning"; prof["Engineer"]="Engineering"; prof["Herbalist"]="Herbalism"; prof["Leaterworker"]="Leatherworking"; --------------------------------------------------------------- -------------Global GuildRosterScan functions------------------ --------------------------------------------------------------- --OnLoad function function GTS_GRS_OnLoad() if (not GTS_Data) then GTS_Data = {}; end if (not GTS_Data.GRS) then GTS_Data.GRS = {}; end if (not GTS_Data.GRS.GuildRoster) then GTS_Data.GRS.GuildRoster = {}; end if (GetGuildInfo("player") and not GTS_Data.GRS.GuildRoster[GetGuildInfo("player")]) then GTS_Data.GRS.GuildRoster[GetGuildInfo("player")] = {}; end --GTS_Menu_GRS_NL:Hide(); GTS_Echo(GTS_MSG["GRS_GREETING"]); end --OnEvent function function GTS_GRS_OnEvent(event) --GTS_Debug("OnEvent is called"); if (event == "BANKFRAME_OPENED") then GTS_Debug("Bank was opened."); return 1; else return nil; end end --Slash command handler function GTS_GRS_SlashCommand(msg) if (msg == "grscan") then if (GetGuildInfo("player")) then GTS_Debug("GTS_GRS_DoScan is called."); GTS_GRS_DoScan(); GTS_Echo(GTS_MSG["GRS_DONE"]); else GTS_Echo(GTS_MSG["GRS_NOGUILD"]); end return 1; elseif (msg == "grsclear") then GTS_Data.GRS.GuildRoster = {}; GTS_Echo(GTS_MSG["GRS_CLEARED"]); return 1; elseif (msg == "grsclearall") then GTS_Data.GRS.GuildRoster = {}; return 1; elseif (msg == "grsinfo") then GTS_Echo("Stores info about all guildmembers in SV.lua."); GTS_Echo("Available commands:"); GTS_Echo("/gts grscan performs a guild roster scan (make sure you load guildroster beforehand)."); GTS_Echo("/gts grsclear clears database for this character."); GTS_Echo("/gts grsinfo shows this screen."); return 1; else return nil; end end --------------------------------------------------------------- -----------------GuildRosterScan functions--------------------- --------------------------------------------------------------- --This function actually scans all the guild members function GTS_GRS_DoScan() GTS_Data.GRS.GuildRoster[GetGuildInfo("player")] = {}; local main, prof1, prof2, prof1lvl, prof2lvl, sorter = 1, "n/a", "n/a", 0, 0, name; for i=1,GetNumGuildMembers(true),1 do local name, rank, rankIndex, level, class, _, note = GetGuildRosterInfo(i); if note then local char; _,_,char=strfind(note,"(%a+)") if char then main=char else main="N/A" end if strlower(main)=="main" then main=1 end local profIndex = 1; local prof1k, prof2k local fixedNote = strsub(note,strlen(main)+1); for k,v in prof do if strfind(fixedNote, k) then if profIndex==1 or strfind(k,prof1k) then prof1k=k prof1=v prof1lvl=300 profIndex=profIndex+1 elseif profIndex==2 then prof2k=k prof2=v prof2lvl=300 break end end end local element = { name = " "..name.." ", main = " "..main.." ", rank = " "..rank.." ", rankNum = " "..rankIndex.." ", level = " "..level.." ", class = " "..class.." ", prof1 = " "..prof1.." ", prof1lvl = " "..prof1lvl.." ", prof2 = " "..prof2.." ", prof2lvl = " "..prof2lvl.." ", sorter = name}; table.insert(GTS_Data.GRS.GuildRoster[GetGuildInfo("player")], element) end end table.sort(GTS_Data.GRS.GuildRoster[GetGuildInfo("player")], function(i,j) return (i.sorter