GuildRaidSnapShot_SnapShots = {}; GuildRaidSnapShot_Loot = {}; GuildRaidSnapShot_Notes = {}; GRSS_Systems = {}; GRSS_Full_DKP = {}; GRSS_Bosses = {"Lucifron","Magmadar","Gehennas","Garr","Baron Geddon","Shazzrah","Sulfuron Harbinger","Golemagg","Ragnaros","Kazzak","Azuregos","Lethon","Emeriss","Onyxia","Taerar","Ysondre","Razorgore","Vaelastrasz the Corrupt","Flamegor","Ebonroc","Firemaw","Chromaggus","Broodlord Lashlayer","Nefarian","Prophet Skeram","Lord Kri","Princess Yauj","Vem","Battleguard Sartura","Princess Huhuran","Fankriss the Unyielding","Viscidus","Ouro","C'Thun","Emperor Vek'nilash","Emperor Vek'lor","Anub'Rekhan","Grand Widow Faerlina","Maexxna","Feugen","Gluth","Gothik the Harvester","Grobbulus","Heigan the Unclean","Highlord Mograine","Instructor Razuvious","Lady Blaumeux","Loatheb","Noth the Plaguebringer","Patchwerk","Sapphiron","Sir Zeliek","Stalagg","Thaddius","Thane Korth'azz","Ossirian the Unscarred","Moam","Kurinnaxx","General Rajaxx","Buru the Gorger","Ayamiss the Hunter","Bloodlord Mandokir","Gahz'ranka","Gri'lek","Hakkar","Hazza'rah","High Priest Thekal","High Priest Venoxis","High Priestess Arlokk","High Priestess Jeklik","High Priestess Mar'li","Jin'do the Hexxer","Renataki","Wushoolay"}; GRSS_Ignore = {"Onyxian","Onyxia's Elite Guard","Maexxna Spiderling","Patchwerk Golem","Hakkari","Son of Hakkar"," slain by "}; GRSS_Yells = {}; GRSS_LootIgnore = {"Hakkari Bijou","Alabaster Idol","Amber Idol","Azure Idol","Jasper Idol","Lambent Idol","Obsidian Idol","Onyx Idol","Vermillion Idol","Lava Core","Fiery Core","Large .+ Shard","Small .+ Shard","Nexus Crystal","Wartorn Scraps"}; GRSS_Yells["Majordomo Executus"] = "Impossible!.+I submit!"; GRSS_Auto = 1; GRSS_LootCap = 1; GRSS_Bidding = 0; GRSS_Rolling = 0; GRSS_HighBid = 0; GRSS_HighBidder = ""; GRSS_CurrentSort = "total"; GRSS_BidStyle = "Silent Auction"; GRSS_CurrentItem = ""; GRSS_ItemHistory = {}; GRSS_TakeScreenshots = 1; GRSS_CurrentLootDate = ""; GRSS_CurrentLootIndex = 0; GRSS_LastCommand = {}; GRSS_ItemPrices = {}; GRSS_Prefix = "GRSS: "; GRSS_Guild = {}; GRSS_DKP = {}; GRSS_Bids = {}; GRSSCurrentSystem = ""; GRSSCurrentAction = "DKP Standings"; GRSSHelpMsg = { "!help = This help menu", "!dkp = Your current DKP", "!dkp name = the DKP for the player 'name' (i.e. !dkp Joe)", "!items = Your item history", "!items name = Item history for player 'name' (i.e. !items Joe)", "!bid X = Bid X points on the current item", "!dkpclass classname = the current standings for the class 'classname' (i.e. !dkpclass mage)", "!price itemname = the price of the item 'itemname' (parts of names work too, i.e. '!price felheart' will retrieve the prices of all items with 'felheart' in the name)", }; local GRSSVersion = "0.67"; local GRSSUsage = { "Type |c00ffff00/grss |r to take a snapshot.", "|c00ffff00/grss reset|r to delete all your snapshots", "|c00ffff00/grss show|r to bring up the DKP standings/bidding/rolling screen", "|c00ffff00/grss noauto|r to disable auto-snapshot", "|c00ffff00/grss yesauto|r to enable auto-snapshot", "|c00ffff00/grss notes|r to take a snapshot of the guild notes (if you use EternalDKP for importing into your system)", "|c00ffff00/grss yesscreenshot|r to make snapshots also take a screenshot", "|c00ffff00/grss noscreenshot|r to make snapshots NOT take a screenshot", "|c00ffff00/grss yesloot|r to make Loot received (Blue and better) prompt for points spent", "|c00ffff00/grss noloot|r to disable the loot prompt when items are received", "Members can also send you tells like so, for information (you can even send yourself a tell for this info, too)", }; local GRSS_Colors={ --[[["ff9d9d9d"] = "grey", ["ffffffff"] = "white",]]-- ["ff0070dd"] = "rare", ["ffa335ee"] = "epic", ["ffff8000"] = "legendary" }; local GRSS_ChatFrame_OnEvent_Original = nil; function GRSS_IsWhisperGRSSWhisper(w) if string.find(w,"^!dkp") or string.find(w,"^!items") or string.find(w,"^!info") or string.find(w,"^!commands") or string.find(w,"^!price")then return true; else return false; end end function GRSS_ChatFrame_OnEvent_Hook(event) if event == "CHAT_MSG_WHISPER" then if ( GRSS_IsWhisperGRSSWhisper(arg1) ) then return end elseif event == "CHAT_MSG_WHISPER_INFORM" then if string.find(arg1,"^"..GRSS_Prefix) then return end end GRSS_ChatFrame_OnEvent_Original(event, arg1, name); end function GuildRaidSnapShot_OnLoad() --GRSSChangeSystem(0); SlashCmdList["GuildRaidSnapShot"] = GuildRaidSnapShot_SlashHandler; SLASH_GuildRaidSnapShot1 = "/grss"; SLASH_GuildRaidSnapShot1 = "/GRSS"; this:RegisterEvent("CHAT_MSG_COMBAT_HOSTILE_DEATH"); this:RegisterEvent("CHAT_MSG_LOOT"); this:RegisterEvent("CHAT_MSG_MONSTER_YELL"); this:RegisterEvent("PLAYER_GUILD_UPDATE"); this:RegisterEvent("GUILD_ROSTER_UPDATE"); this:RegisterEvent("CHAT_MSG_WHISPER"); this:RegisterEvent("CHAT_MSG_SYSTEM"); DEFAULT_CHAT_FRAME:AddMessage("GuildRaidSnapShot (By DKPSystem.com) Version "..GRSSVersion.." loaded. "); DEFAULT_CHAT_FRAME:AddMessage("Type |c00ffff00/grss|r to get a list of options for GuildRaidSnapShot"); GRSS_ChatFrame_OnEvent_Original = ChatFrame_OnEvent; ChatFrame_OnEvent = GRSS_ChatFrame_OnEvent_Hook; StaticPopupDialogs["GRSS_ITEMPOINTS"] = { text = "How many points did |c00ffff00%s|r spend on %s", button1 = "OK", button2 = "Cancel", OnAccept = function() points = getglobal(this:GetParent():GetName().."EditBox"):GetText(); GuildRaidSnapShot_Loot[GRSS_CurrentLootDate][GRSS_CurrentLootIndex].points = points; GRSS_RecordCurrentPlayerReceivedItem(points); end, EditBoxOnEnterPressed = function() points = getglobal(this:GetParent():GetName().."EditBox"):GetText(); GuildRaidSnapShot_Loot[GRSS_CurrentLootDate][GRSS_CurrentLootIndex].points = points; GRSS_RecordCurrentPlayerReceivedItem(points); this:GetParent():Hide(); end, OnShow = function() if GRSS_HighBid==0 then points = GRSS_GetItemPoints(GuildRaidSnapShot_Loot[GRSS_CurrentLootDate][GRSS_CurrentLootIndex].item); else points = GRSS_HighBid; end getglobal(this:GetName().."EditBox"):SetText(points); end, timeout = 0, whileDead = 1, hideOnEscape = 1, hasEditBox = 1, }; end function GRSS_RecordCurrentPlayerReceivedItem(points) playername = string.lower(GuildRaidSnapShot_Loot[GRSS_CurrentLootDate][GRSS_CurrentLootIndex].player); normalplayername = GuildRaidSnapShot_Loot[GRSS_CurrentLootDate][GRSS_CurrentLootIndex].player; if tonumber(points) ~= nil and tonumber(points) ~= 0 then points = tonumber(points); foundname = false; for i,v in GRSS_Full_DKP[GRSSCurrentSystem] do if string.lower(v.name)==playername then if tonumber(v.spent) == nil then v.spent = points; else v.spent = v.spent + points; end foundname = true; end end if foundname == false then temp = {}; temp.name = normalplayername; temp.class = "?"; temp.spent = points; temp.earned = 0; temp.adj = 0; table.insert(GRSS_Full_DKP[GRSSCurrentSystem],temp); end foundname = false; for i,v in GRSS_DKP do if string.lower(v.name)==playername then if tonumber(v.spent) == nil then v.spent = points; else v.spent = v.spent + points; end if tonumber(v.earned) == nil then v.earned = 0; else v.earned = tonumber(v.earned); end if tonumber(v.adj) == nil then v.adj = 0; else v.adj = tonumber(v.adj); end v.total = v.earned + v.adj - v.spent; foundname = true; end end if foundname == false then temp = {}; temp.class = "?"; temp.name = normalplayername; temp.spent = points; temp.earned = 0; temp.adj = 0; temp.total = -points; table.insert(GRSS_DKP,temp); end temp = "Today: "..normalplayername.." <-- "..GuildRaidSnapShot_Loot[GRSS_CurrentLootDate][GRSS_CurrentLootIndex].item.." for "..points; if GRSS_ItemHistory[string.upper(playername)] ~= nil then table.insert(GRSS_ItemHistory[string.upper(playername)],temp); else GRSS_ItemHistory[string.upper(playername)] = {}; GRSS_ItemHistory[string.upper(playername)][0] = temp; end GRSSScrollBar_Update(); end end function GRSS_GetItemPoints(item) for i,v in GRSS_ItemPrices[GRSSCurrentSystem] do if string.lower(item)==string.lower(v.name) then return v.points; end end return ""; end function GRSSSortBy(sort) GRSS_CurrentSort = sort; table.sort(GRSS_DKP, function(a,b) if sort=="spent" then if GRSSCurrentAction == "DKP Standings" then return GRSSNum(a.spent) > GRSSNum(b.spent); elseif GRSSCurrentAction == "Rolls" then return GRSSNum(a.roll) > GRSSNum(b.roll); elseif GRSSCurrentAction == "Bids" then return GRSSNum(a.bid) > GRSSNum(b.bid); end elseif a[sort]==b[sort] then return GRSSNum(a.total) > GRSSNum(b.total); elseif sort=="name" or sort=="class" then return (string.lower(a[sort]) < string.lower(b[sort])) else return (GRSSNum(a[sort]) > GRSSNum(b[sort])) end end ); GRSSScrollBar_Update(); end function GRSSChangeSystem(sys) if sys ~= nil then local top = table.getn(GRSS_Full_DKP[sys]); GRSS_DKP = {}; for i=1,top do GRSS_DKP[i] = {}; GRSS_DKP[i].name = GRSS_Full_DKP[sys][i].name; GRSS_DKP[i].class = GRSS_Full_DKP[sys][i].class; GRSS_DKP[i].earned = GRSS_Full_DKP[sys][i].earned; GRSS_DKP[i].spent = GRSS_Full_DKP[sys][i].spent; GRSS_DKP[i].adj = GRSS_Full_DKP[sys][i].adj; GRSS_DKP[i].total = GRSS_DKP[i].earned + GRSS_DKP[i].adj - GRSS_DKP[i].spent GRSS_DKP[i].bid = "" GRSS_DKP[i].roll = "" end GRSSScrollBar_Update(); GRSSSortBy("total"); GRSSScrollBar:Show(); end end function GRSSGenerateBids() GRSS_Bids = {}; local temp = {}; local n = 24; local m = table.getn(GRSS_DKP); for i=1,n do temp = {}; temp.name = GRSS_DKP[math.random(m)].name; temp.bid = math.random(1000); table.insert(GRSS_Bids,temp); end GRSSBidsScrollBar_Update(); end function GRSSNum(v) v = tonumber(v); if v == nil then v = -9999999 end return v; end function GRSSScrollBar_Update() local line; -- 1 through 10 of our window to scroll local lineplusoffset; -- an index into our data calculated from the scroll offset local earned,sent,adj; FauxScrollFrame_Update(GRSSScrollBar,table.getn(GRSS_DKP),10,16); for line=1,10 do lineplusoffset = line + FauxScrollFrame_GetOffset(GRSSScrollBar); if lineplusoffset <= table.getn(GRSS_DKP) then if GRSSCurrentAction == "DKP Standings" then spent = GRSS_DKP[lineplusoffset].spent; elseif GRSSCurrentAction == "Rolls" then spent = GRSS_DKP[lineplusoffset].roll; elseif GRSSCurrentAction == "Bids" then spent = GRSS_DKP[lineplusoffset].bid; end if GRSSCurrentAction == "DKP Standings" then earned = GRSS_DKP[lineplusoffset].earned; adj = GRSS_DKP[lineplusoffset].adj; else earned = ""; adj = ""; end getglobal("GRSSRow"..line.."FieldPlayer"):SetText(GRSS_DKP[lineplusoffset].name); getglobal("GRSSRow"..line.."FieldClass"):SetText(GRSS_DKP[lineplusoffset].class); getglobal("GRSSRow"..line.."FieldEarned"):SetText(earned); getglobal("GRSSRow"..line.."FieldSpent"):SetText(spent); getglobal("GRSSRow"..line.."FieldAdj"):SetText(adj); if tonumber(GRSS_DKP[lineplusoffset].total) ~= nil then getglobal("GRSSRow"..line.."FieldDKP"):SetText(string.format("%.2f",GRSS_DKP[lineplusoffset].total)); else getglobal("GRSSRow"..line.."FieldDKP"):SetText(GRSS_DKP[lineplusoffset].total); end getglobal("GRSSRow"..line.."FieldPlayer"):Show(); getglobal("GRSSRow"..line.."FieldClass"):Show(); getglobal("GRSSRow"..line.."FieldEarned"):Show(); getglobal("GRSSRow"..line.."FieldSpent"):Show(); getglobal("GRSSRow"..line.."FieldAdj"):Show(); getglobal("GRSSRow"..line.."FieldDKP"):Show(); getglobal("GRSSRow"..line.."FieldHighlight"):Show(); else getglobal("GRSSRow"..line.."FieldPlayer"):Hide(); getglobal("GRSSRow"..line.."FieldClass"):Hide(); getglobal("GRSSRow"..line.."FieldEarned"):Hide(); getglobal("GRSSRow"..line.."FieldSpent"):Hide(); getglobal("GRSSRow"..line.."FieldAdj"):Hide(); getglobal("GRSSRow"..line.."FieldDKP"):Hide(); getglobal("GRSSRow"..line.."FieldHighlight"):Hide(); end end end function GRSSBidsScrollBar_Update() local line; -- 1 through 10 of our window to scroll local lineplusoffset; -- an index into our data calculated from the scroll offset local earned,sent,adj; FauxScrollFrame_Update(GRSSBidsScrollBar,table.getn(GRSS_Bids),23,16); --GRSSPrint("size: "..table.getn(GRSS_Bids)); for line=1,23 do lineplusoffset = line + FauxScrollFrame_GetOffset(GRSSBidsScrollBar); if lineplusoffset <= table.getn(GRSS_Bids) then getglobal("GRSSBidsRow"..line.."FieldPlayer"):SetText(GRSS_Bids[lineplusoffset].name); getglobal("GRSSBidsRow"..line.."FieldBid"):SetText(GRSS_Bids[lineplusoffset].bid); --GRSSPrint("Printing on line "..line..": "..GRSS_Bids[lineplusoffset].name.." - "..GRSS_Bids[lineplusoffset].bid); getglobal("GRSSBidsRow"..line.."FieldPlayer"):Show(); getglobal("GRSSBidsRow"..line.."FieldBid"):Show(); getglobal("GRSSBidsRow"..line.."Delete"):Show(); getglobal("GRSSBidsRow"..line.."FieldHighlight"):Show(); else getglobal("GRSSBidsRow"..line.."FieldPlayer"):Hide(); getglobal("GRSSBidsRow"..line.."FieldBid"):Hide(); getglobal("GRSSBidsRow"..line.."FieldHighlight"):Hide(); getglobal("GRSSBidsRow"..line.."Delete"):Hide(); end end end function GuildRaidSnapShot_OnEvent(event,arg1,arg2) if(event == "CHAT_MSG_MONSTER_YELL") then --GRSSPrint(arg2.." Yelled "..arg1); if GRSS_Auto==1 and GRSS_Yells[arg2] ~= nil then --GRSSPrint("Searching if "..arg2.." said "..GRSS_Yells[arg2]); if string.find(arg1,GRSS_Yells[arg2]) ~= nil then GRSS_TakeSnapShot(arg2); end end elseif(event == "CHAT_MSG_COMBAT_HOSTILE_DEATH") then local i,v,found=0,foundtext; for i,v in ipairs(GRSS_Bosses) do if string.find(arg1,v)~=nil then found=1; foundtext=v; end end if found == 1 then for i,v in ipairs(GRSS_Ignore) do if string.find(arg1,v)~=nil then found = 0; end end end if found == 1 and GRSS_Auto == 1 then GRSS_TakeSnapShot(foundtext); end elseif(event == "PLAYER_GUILD_UPDATE") then GuildRoster(); elseif(event == "GUILD_ROSTER_UPDATE") then GRSS_TakeGuildOnly(); elseif(event == "CHAT_MSG_LOOT") then GRSS_CaptureLoot(arg1); elseif(event == "CHAT_MSG_WHISPER") then GRSS_ProcessWhisper(arg2,arg1,this.language); elseif(event == "CHAT_MSG_SYSTEM") then if GRSS_Rolling==1 then local name, roll; for name, roll in string.gfind(arg1, "(%a+) rolls (%d+) %(1%-1000%)") do GRSS_RecordRoll(name, roll); end end end end function GRSS_RecordRoll(name,roll) for i,v in GRSS_DKP do if string.lower(v.name)==string.lower(name) then if GRSS_DKP[i].roll == "" or GRSS_DKP[i].roll == nil then GRSS_DKP[i].roll = roll; end return; end end temp = {}; temp.name = name; temp.class = "?"; temp.spent = ""; temp.earned = ""; temp.adj = ""; temp.roll = roll; temp.total = "?"; table.insert(GRSS_DKP,1,temp); GRSSScrollBar_Update(); end function GRSS_SendWhisper(msg,msgtype,lang,to) SendChatMessage(GRSS_Prefix..msg,msgtype,lang,to); end function GRSS_ProcessWhisper(from,msg,lang) temp = {}; if(string.find(msg,"^!bid")) then if GRSS_Bidding == 1 then s,e,amt = string.find(msg,"^!bid%s*(%d*)"); temp.name = from; if amt=="" then amt = "blank"; else amt = tonumber(amt); end temp.bid = amt; table.insert(GRSS_Bids,temp); GRSSBidsScrollBar_Update(); if GRSS_BidStyle=="Silent Auction" then if tonumber(amt)~=nil and tonumber(amt) > GRSS_HighBid then GRSS_SendWhisper("You are now the high bidder with "..amt,"WHISPER",lang,from); GRSS_HighBid = tonumber(amt); if GRSS_HighBidder ~= from and GRSS_HighBidder ~= "" then GRSS_SendWhisper("You are no longer the high bidder. The high bid is now "..GRSS_HighBid..".","WHISPER",nil,GRSS_HighBidder); end GRSS_HighBidder = from; SendChatMessage("The high bid is now "..amt,"RAID"); elseif tonumber(amt)~=nil and tonumber(amt) < GRSS_HighBid then GRSS_SendWhisper(amt.." is too low","WHISPER",lang,from); elseif tonumber(amt)~=nil and tonumber(amt) == GRSS_HighBid then GRSS_SendWhisper("Your bid of "..amt.." ties you with the high bidder", "WHISPER", lang, from); else GRSS_SendWhisper("Your bid was not understood. Please specify a number. (ie: !bid 365)","WHISPER",lang,from); end elseif GRSS_BidStyle=="Silent Non-Auction" then GRSS_SendWhisper("Your bid of "..amt.." has been recorded","WHISPER",lang,from); end local found=false; for i,v in GRSS_DKP do if string.lower(v.name)==string.lower(from) then if tonumber(GRSS_DKP[i].bid)==nil or (tonumber(amt) ~= nil and tonumber(GRSS_DKP[i].bid) < tonumber(amt)) then GRSS_DKP[i].bid = amt; end found=true end end if found==false then temp = {}; temp.name = from; temp.class = "?"; temp.spent = ""; temp.earned = ""; temp.adj = ""; temp.bid = amt; temp.total = "?"; table.insert(GRSS_DKP,1,temp); end GRSSSortBy("bid"); GRSSScrollBar_Update(); else GRSS_SendWhisper("Sorry, bids are not being received right now", "WHISPER", lang, from); end elseif(string.find(msg,"^!dkpclass")) then s,e,class = string.find(msg,"^!dkpclass%s+(.+)%s*"); if class==nil or class == "" then GRSS_SendWhisper("You need to specify a class (i.e. !dkpclass mage)", "WHISPER", lang, from); else SavedSort = GRSS_CurrentSort; GRSSSortBy("total"); found = false; for i,v in GRSS_DKP do if string.lower(v.class) == string.lower(class) then GRSS_SendWhisper(v.name..": "..v.total,"WHISPER",lang,from); found=true; end end if found==false then GRSS_SendWhisper("Sorry, no players were found with the class "..class,"WHISPER",lang,from); end GRSSSortBy(SavedSort); end elseif(string.find(msg,"^!dkp")) then s,e,name = string.find(msg,"^!dkp%s*(.*)%s*"); if name == "" then tosend = GRSSGetPlayerDKP(from); else tosend = GRSSGetPlayerDKP(name); end GRSS_SendWhisper(tosend, "WHISPER", lang, from); elseif(string.find(msg,"^!items")) then s,e,name = string.find(msg,"^!items%s*(.*)%s*"); if name == "" then playername = string.upper(from); else playername = string.upper(name); end if GRSS_ItemHistory[playername] ~= nil then for i,v in GRSS_ItemHistory[playername] do GRSS_SendWhisper(v,"WHISPER",lang,from); end else GRSS_SendWhisper("There is no item history for "..playername,"WHISPER",lang,from); end elseif(string.find(msg,"^!price%s")) then s,e,itemraw = string.find(msg,"^!price%s+(.*)%s*"); s,e,color,item = string.find(itemraw, "|c(%x+)|Hitem:%d+:%d+:%d+:%d+|h%[(.-)%]|h|r"); if not s then item = itemraw end found = false; for i,v in GRSS_ItemPrices[GRSSCurrentSystem] do if string.find(string.lower(v.name),string.lower(item)) then GRSS_SendWhisper(v.name.." = "..v.points.." points","WHISPER",lang,from); found = true; end end if found == false then GRSS_SendWhisper("Sorry no item by the name of '"..item.." was found","WHISPER",lang,from); end elseif(string.find(msg,"^!help") or string.find(msg,"^!%?") or string.find(msg,"^!info") or string.find(msg,"^!commands")) then if string.upper(from) == string.upper(UnitName("player")) then for i,v in GRSSHelpMsg do GRSSPrint(v); end else for i,v in GRSSHelpMsg do GRSS_SendWhisper(v,"WHISPER",lang,from); end end end end function GRSSGetPlayerDKP(player) for i,v in GRSS_DKP do if string.lower(v.name)==string.lower(player) then return "DKP For "..player.." ("..GRSSCurrentSystem.."): "..v.total; end end return "No player named "..player.." found in the current DKP system"; end function GuildRaidSnapShot_SlashHandler(msg) local newboss; if msg == "" then for i,v in GRSSUsage do DEFAULT_CHAT_FRAME:AddMessage(v); end for i,v in GRSSHelpMsg do DEFAULT_CHAT_FRAME:AddMessage(v); end elseif msg == "reset" then GuildRaidSnapShot_SnapShots = {}; GuildRaidSnapShot_Loot = {}; GRSSPrint("Snapshots Purged"); elseif msg == "noauto" then GRSS_Auto = 0; GRSSPrint("Auto Snapshots Disabled"); elseif msg == "yesauto" then GRSS_Auto = 1; GRSSPrint("Auto Snapshots Enabled"); elseif msg == "yesloot" then GRSS_LootCap = 1; GRSSPrint("Looting will now result in popups prompting for points"); elseif msg == "noloot" then GRSS_LootCap = 0; GRSSPrint("Looting will no longer result in popups prompting for points"); elseif msg == "notes" then GRSS_TakeGuildNotes(); elseif msg == "show" then GRSS:Show(); elseif msg == "yesscreenshots" then GRSSPrint("Screenshots of the raid will be taken when snapshots are initiated"); GRSS_TakeScreenshots = 1 elseif msg == "noscreenshots" then GRSS_TakeScreenshots = 0 GRSSPrint("Screenshots of the raid will no longer be taken when snapshots are initiated"); elseif GetNumRaidMembers() > 0 or GetNumPartyMembers() > 0 then GRSS_TakeSnapShot(msg); else GRSSPrint("You're not in a raid"); end end function GRSS_CaptureLoot(msg) if GetNumRaidMembers()>0 or GetNumPartyMembers()>0 then local s, e, player, link = string.find(msg, "([^%s]+) receives loot: (.+)%."); if(player == nil) then s, e, link = string.find(msg, "You receive loot: (.+)%."); if(link ~= nil) then player = UnitName("player"); end end if(link and player) then local s, e, color, item = string.find(link, "|c(%x+)|Hitem:%d+:%d+:%d+:%d+|h%[(.-)%]|h|r"); if(color and item and GRSS_Colors[color]) then -- Checking to see if the item listed is one we should ignore for i,v in GRSS_LootIgnore do if string.find(item,v) then return; end end local lootdate = date("%Y-%m-%d"); if(GuildRaidSnapShot_Loot[lootdate] == nil) then GuildRaidSnapShot_Loot[lootdate] = {}; end local iteminfo = {}; iteminfo.player = player; iteminfo.item = item; iteminfo.date = date("%Y-%m-%d %H:%M:%S"); table.insert(GuildRaidSnapShot_Loot[lootdate],iteminfo); if GRSS_LootCap == 1 then GRSS_CurrentLootDate = lootdate; GRSS_CurrentLootIndex = table.getn(GuildRaidSnapShot_Loot[lootdate]); StaticPopup_Show ("GRSS_ITEMPOINTS",player,link); end end end end end function GRSS_TakeSnapShot(name) local SnapShotName = name.." "..date("%Y-%m-%d %H:%M:%S"); GuildRaidSnapShot_SnapShots[SnapShotName] = {}; local OnlineRaid,RaidList = GRSS_RaidCommaList(); GuildRaidSnapShot_SnapShots[SnapShotName]["Raid"] = RaidList; local OnlineGuild,GuildList = GRSS_GuildCommaList(); GuildRaidSnapShot_SnapShots[SnapShotName]["Guild"] = GuildList; GRSSPrint("SnapShot Taken: "..SnapShotName.." (Guild: "..OnlineGuild.." | Raid: "..OnlineRaid..")"); if GRSS_TakeScreenshots==1 then Screenshot(); end end function GRSS_TakeGuildOnly() local members="", level,class,online,rank,notes; GRSS_Guild = {}; local n = GetNumGuildMembers(true); local NumOnline = 0; for i = 1, n do MemName,rank,_,level,class,_,notes,_,_,online = GetGuildRosterInfo(i); GRSS_Guild[MemName] = level .. ";" .. class..";"..rank..";;;"..notes; end end function GRSS_TakeGuildNotes() local members="", notes,num; num =0; GuildRoster(); GRSS_Guild = {}; local n = GetNumGuildMembers(true); local NumOnline = 0; GuildRaidSnapShot_Notes = {}; for i = 1, n do MemName,_,_,_,_,_,notes = GetGuildRosterInfo(i); if notes ~= "" then num = num + 1; GuildRaidSnapShot_Notes[MemName] = notes; end end GRSSPrint("Guild notes Snapshot Taken: "..num.." Guild Notes Captured"); end function GRSS_RaidCommaList() local members=""; local NumOnline=0; local zone=""; local con; local n = GetNumRaidMembers(); if GetNumRaidMembers()>1 then for i = 1, n do MemName,_,_,_,_,_,zone,Online = GetRaidRosterInfo(i); if Online==1 then if zone==nil then zone = "" end members = members..MemName..":"..zone; if i ~= n then members = members .. ", " end NumOnline=NumOnline+1; end end if GRSS_TakeScreenshots==1 then ToggleFriendsFrame(1); ToggleFriendsFrame(4); end else n = GetNumPartyMembers(); zone = ""; for i = 1, n do MemName = UnitName("party"..i); if UnitIsConnected("party"..i) then con=1 else con=0 end if MemName ~= nil and con==1 then members = members..MemName..":"..zone..", "; NumOnline = NumOnline + 1 end end members = members..UnitName("player")..":"..zone; NumOnline = NumOnline + 1; end return NumOnline,members end function GRSS_GuildCommaList() local members=""; local online; local zone=""; GuildRoster(); local n = GetNumGuildMembers(false); local NumOnline = 0; for i = 1, n do MemName,_,_,_,_,zone,_,_,online = GetGuildRosterInfo(i); if zone==nil then zone = "" end if online==1 then members = members..MemName .. ":" .. zone; if i ~= n then members = members .. ", " end NumOnline = NumOnline + 1; end end return NumOnline,members end function GRSSSystemDropDown_OnLoad() GRSS_Initialize_Data(); GRSSChangeSystem(GRSSCurrentSystem); UIDropDownMenu_Initialize(this, GRSSSystemDropDown_Initialize); if GRSS_Systems[GRSSCurrentSystem]~=nil then UIDropDownMenu_SetText(GRSSCurrentSystem, GRSSSystemDropDown); else UIDropDownMenu_SetText("Select System", GRSSSystemDropDown); end UIDropDownMenu_SetWidth(130, GRSSSystemDropDown); end function GRSSActionDropDown_OnLoad() UIDropDownMenu_Initialize(this, GRSSActionDropDown_Initialize); UIDropDownMenu_SetText("DKP Standings", GRSActionDropDown); UIDropDownMenu_SetWidth(110, GRSSActionDropDown); end function GRSSBidStyleDropDown_OnLoad() UIDropDownMenu_Initialize(this, GRSSBidStyleDropDown_Initialize); if GRSS_BidStyle == "" then UIDropDownMenu_SetText("Bidding Style", GRSSBidStyleDropDown); else UIDropDownMenu_SetText(GRSS_BidStyle, GRSSBidStyleDropDown); end UIDropDownMenu_SetWidth(110, GRSSBidStyleDropDown); end function GRSSSystemDropDown_OnClick() GRSSCurrentSystem = this.value; UIDropDownMenu_SetText(this.value, GRSSSystemDropDown); this.isChecked=true; GRSSChangeSystem(GRSSCurrentSystem) end function GRSSBidStyleDropDown_Initialize() local Actions = {"Silent Auction","Silent Non-Auction"}; local info = {}; info.notCheckable = nil; info.keepShownOnClick = nil; info.func = GRSS_ChangeBidStyle; for i,v in Actions do info.text = v; info.value = v; UIDropDownMenu_AddButton(info); end end function GRSS_ChangeBidStyle() UIDropDownMenu_SetText(this.value,GRSSBidStyleDropDown); GRSS_BidStyle = this.value; end function GRSS_DeleteBid(line) lineplusoffset = line + FauxScrollFrame_GetOffset(GRSSBidsScrollBar); amount = GRSS_Bids[lineplusoffset].bid; name = GRSS_Bids[lineplusoffset].name; table.remove(GRSS_Bids,lineplusoffset); playerhigh = 0; totalhigh = 0; highbidder = ""; for i,v in GRSS_Bids do if string.lower(v.name)==string.lower(name) then if tonumber(v.bid)~=nil and tonumber(v.bid) > playerhigh then playerhigh = tonumber(v.bid); end end if tonumber(v.bid)~=nil and tonumber(v.bid) > totalhigh then totalhigh = tonumber(v.bid); highbidder = v.name; end end if GRSS_HighBid ~= totalhigh and GRSS_Bidding==1 then GRSS_HighBid = totalhigh; GRSS_HighBidder = highbidder; if GRSS_BidStyle=="Silent Auction" then SendChatMessage("The high bid has been changed to "..GRSS_HighBid,"RAID"); end end for i,v in GRSS_DKP do if string.lower(v.name)==string.lower(name) then GRSS_DKP[i].bid = playerhigh; end end GRSSBidsScrollBar_Update(); GRSSScrollBar_Update(); end function GRSSActionDropDown_Initialize() local Actions = {"DKP Standings","Rolls","Bids"}; local info = {}; info.notCheckable = nil; info.keepShownOnClick = nil; info.func = GRSS_DoAction; for i,v in Actions do info.text = v; info.value = v; UIDropDownMenu_AddButton(info); end end function GRSSShowDKP(DKP) if DKP == true then GRSSHeaderEarnedText:SetText("Earned"); GRSSHeaderSpentText:SetText("Spent"); GRSSHeaderAdjText:SetText("Adj"); GRSSHeaderDKPText:SetText("Total"); end end function GRSSShowRolls(Rolls) if Rolls == true then GRSSHeaderEarnedText:SetText(""); GRSSHeaderSpentText:SetText("Roll"); GRSSHeaderAdjText:SetText(""); GRSSHeaderDKPText:SetText("Current DKP"); GRSSToggleRolls:Show(); GRSSClearRolls:Show(); else GRSSToggleRolls:Hide(); GRSSClearRolls:Hide(); end end function GRSSShowBids(Bids) if Bids == true then GRSSHeaderEarnedText:SetText(""); GRSSHeaderSpentText:SetText("Highest Bid"); GRSSHeaderAdjText:SetText(""); GRSSHeaderDKPText:SetText("Current DKP"); GRSSBids:Show(); GRSSToggleBids:Show(); GRSSClearBids:Show(); GRSSBidStyleDropDown:Show(); else GRSSBids:Hide(); GRSSToggleBids:Hide(); GRSSClearBids:Hide(); GRSSBidStyleDropDown:Hide(); end end function GRSS_ToggleRolls() local itemname = GRSSItemName:GetText() if GRSS_Rolling == 1 then GRSSToggleRolls:SetText("Start Rolls"); GRSS_Rolling = 0; GRSS_EnableFunctionalButtons(1); SendChatMessage("Rolling Ended on "..itemname..". No more rolls will be recorded", "RAID"); SendChatMessage("Rolling Ended on "..itemname..". No more rolls will be recorded", "RAID_WARNING"); else GRSSToggleRolls:SetText("Stop Rolls"); GRSS_Rolling = 1; GRSS_EnableFunctionalButtons(0); SendChatMessage("Rolling Started on "..itemname..". If you are interested /random 1000. Rolls with anything but 1000 will be ignored.", "RAID"); SendChatMessage("Rolling Started on "..itemname..". If you are interested /random 1000.", "RAID_WARNING"); end end function GRSS_EnableFunctionalButtons(tf) if tf == 1 then GRSSClearBids:Enable(); GRSSClearRolls:Enable(); GRSSBidStyleDropDown:Show(); GRSSSystemDropDown:Show(); GRSSActionDropDown:Show(); GRSSItemName:Show(); else GRSSClearBids:Disable(); GRSSClearRolls:Disable(); GRSSBidStyleDropDown:Hide(); GRSSSystemDropDown:Hide(); GRSSActionDropDown:Hide(); GRSSItemName:Hide(); end end function GRSS_ToggleBids() local player = UnitName("player"); local itemname = GRSSItemName:GetText() if GRSS_Bidding == 1 then GRSSToggleBids:SetText("Start Bids"); GRSS_Bidding = 0; GRSS_EnableFunctionalButtons(1); SendChatMessage("Bidding Ended for "..itemname..". No more bids will be recorded", "RAID"); SendChatMessage("Bidding Ended for "..itemname..".", "RAID_WARNING"); else GRSSToggleBids:SetText("Stop Bids"); GRSS_Bidding = 1; GRSS_HighBid = 0; GRSS_EnableFunctionalButtons(0); SendChatMessage("Bidding Started for "..itemname.."! To bid: '/w "..player.." !bid X' where X is the amount you wish to bid", "RAID"); SendChatMessage("Bidding Started for "..itemname.."! To bid: '/w "..player.." !bid X' where X is the amount you wish to bid", "RAID_WARNING"); end end function GRSS_ClearBids() GRSS_Bids = {}; for i,v in GRSS_DKP do GRSS_DKP[i].bid = "" end GRSSScrollBar_Update(); GRSSBidsScrollBar_Update(); end function GRSS_ClearRolls() for i,v in GRSS_DKP do GRSS_DKP[i].roll = "" end GRSSScrollBar_Update(); end function GRSS_DoAction() GRSSCurrentAction = this.value; UIDropDownMenu_SetText(this.value, GRSSActionDropDown); local DKP = false; local Rolls = false; local Bids = false; if this.value == "DKP Standings" then --GRSSChangeSystem(GRSSCurrentSystem); DKP = true; elseif this.value == "Rolls" then Rolls = true; elseif this.value == "Bids" then Bids = true; end if Rolls==true or Bids==true then GRSSItemName:Show(); else GRSSItemName:Hide(); end GRSSShowDKP(DKP); GRSSShowRolls(Rolls); GRSSShowBids(Bids); GRSSScrollBar_Update(); end function GRSSSystemDropDown_Initialize() local info = {}; if (not GRSS_Systems) then GRSS_Systems = {}; end; for index, sys in pairs(GRSS_Systems) do info.text = sys; info.value = sys; info.func = GRSSSystemDropDown_OnClick; info.notCheckable = nil; info.keepShownOnClick = nil; UIDropDownMenu_AddButton(info); end end function GRSSPrint(msg) DEFAULT_CHAT_FRAME:AddMessage("GRSS: "..msg); end