John@73: local bsk=bsk John@73: local _G=_G John@73: local table=table John@73: local pairs=pairs John@73: local setmetatable=setmetatable John@73: local ipairs=ipairs John@73: local string=string John@73: local sformat=string.format John@73: local tostring=tostring John@73: local type=type John@73: local getn=getn John@73: John@73: local event = LibStub("AceEvent-3.0") John@73: John@73: setfenv(1,bsk) John@73: John@73: local isMasterLootEvent = false John@73: John@73: local function OpenMasterLootList() John@73: print("Open!") John@73: isMasterLootEvent = true John@73: end John@73: John@73: local function UpdateMasterLootList() John@73: print("Update MLL!") John@73: end John@73: John@73: local function LootClosed() John@73: print("Close!") John@73: if isMasterLootEvent then John@73: isMasterLootEvent = false -- end the event John@73: InitiateCloseLooting() John@73: end John@73: end John@73: John@73: local function LootOpened() John@73: print("Open loot!") John@73: isMasterLootEvent = false John@73: local n = _G.GetNumLootItems() John@73: for i = 1,n do John@73: _G.LootSlot(i) John@73: end John@73: local items = {} John@73: for i = 1,n do John@73: local link = _G.GetLootSlotLink(i) John@73: if link then John@73: table.insert(items,link) John@73: print("Item: ", link) John@73: end John@73: end John@73: if not isMasterLootEvent then return end John@73: John@73: print("Let's get started SKing") John@73: -- todo: check that I am ML and that I'm an admin! John@73: John@73: -- make state: gather all item links, transmit them plus the new looting John@73: -- state John@73: -- John@73: InitiateBeginLoot(items,stateactivelist) John@73: John@73: end John@73: John@73: function InitializeLooting() John@73: event:RegisterEvent("OPEN_MASTER_LOOT_LIST",OpenMasterLootList) John@73: event:RegisterEvent("UPDATE_MASTER_LOOT_LIST",UpdateMasterLootList) John@73: event:RegisterEvent("LOOT_CLOSED",LootClosed) John@73: event:RegisterEvent("LOOT_OPENED",LootOpened) John@73: end John@73: