John@73
|
1 local bsk=bsk
|
John@73
|
2 local _G=_G
|
John@73
|
3 local table=table
|
John@73
|
4 local pairs=pairs
|
John@73
|
5 local setmetatable=setmetatable
|
John@73
|
6 local ipairs=ipairs
|
John@73
|
7 local string=string
|
John@73
|
8 local sformat=string.format
|
John@73
|
9 local tostring=tostring
|
John@73
|
10 local type=type
|
John@73
|
11 local getn=getn
|
John@73
|
12
|
John@73
|
13 local event = LibStub("AceEvent-3.0")
|
John@73
|
14
|
John@73
|
15 setfenv(1,bsk)
|
John@73
|
16
|
John@73
|
17 local isMasterLootEvent = false
|
John@73
|
18
|
John@73
|
19 local function OpenMasterLootList()
|
John@73
|
20 print("Open!")
|
John@73
|
21 isMasterLootEvent = true
|
John@73
|
22 end
|
John@73
|
23
|
John@73
|
24 local function UpdateMasterLootList()
|
John@73
|
25 print("Update MLL!")
|
John@73
|
26 end
|
John@73
|
27
|
John@73
|
28 local function LootClosed()
|
John@73
|
29 print("Close!")
|
John@73
|
30 if isMasterLootEvent then
|
John@73
|
31 isMasterLootEvent = false -- end the event
|
John@73
|
32 InitiateCloseLooting()
|
John@73
|
33 end
|
John@73
|
34 end
|
John@73
|
35
|
John@73
|
36 local function LootOpened()
|
John@73
|
37 print("Open loot!")
|
John@73
|
38 isMasterLootEvent = false
|
John@73
|
39 local n = _G.GetNumLootItems()
|
John@73
|
40 for i = 1,n do
|
John@73
|
41 _G.LootSlot(i)
|
John@73
|
42 end
|
John@73
|
43 local items = {}
|
John@73
|
44 for i = 1,n do
|
John@73
|
45 local link = _G.GetLootSlotLink(i)
|
John@73
|
46 if link then
|
John@73
|
47 table.insert(items,link)
|
John@73
|
48 print("Item: ", link)
|
John@73
|
49 end
|
John@73
|
50 end
|
John@73
|
51 if not isMasterLootEvent then return end
|
John@73
|
52
|
John@73
|
53 print("Let's get started SKing")
|
John@73
|
54 -- todo: check that I am ML and that I'm an admin!
|
John@73
|
55
|
John@73
|
56 -- make state: gather all item links, transmit them plus the new looting
|
John@73
|
57 -- state
|
John@73
|
58 --
|
John@73
|
59 InitiateBeginLoot(items,stateactivelist)
|
John@73
|
60
|
John@73
|
61 end
|
John@73
|
62
|
John@73
|
63 function InitializeLooting()
|
John@73
|
64 event:RegisterEvent("OPEN_MASTER_LOOT_LIST",OpenMasterLootList)
|
John@73
|
65 event:RegisterEvent("UPDATE_MASTER_LOOT_LIST",UpdateMasterLootList)
|
John@73
|
66 event:RegisterEvent("LOOT_CLOSED",LootClosed)
|
John@73
|
67 event:RegisterEvent("LOOT_OPENED",LootOpened)
|
John@73
|
68 end
|
John@73
|
69
|