Mercurial > wow > breuesk
comparison Looting.lua @ 78:5b507f4125d4
Finalized bid handling
author | John@Yosemite-PC |
---|---|
date | Thu, 12 Apr 2012 22:19:15 -0400 |
parents | 39be9328acd0 |
children | 7b8fcea357d2 |
comparison
equal
deleted
inserted
replaced
77:0a3f590f69e6 | 78:5b507f4125d4 |
---|---|
42 end | 42 end |
43 local items = {} | 43 local items = {} |
44 for i = 1,n do | 44 for i = 1,n do |
45 local link = _G.GetLootSlotLink(i) | 45 local link = _G.GetLootSlotLink(i) |
46 if link then | 46 if link then |
47 table.insert(items,link) | 47 table.insert(items,{link=link,mlid=i}) |
48 print("Item: ", link) | 48 print("Item: ", link, i) |
49 end | 49 end |
50 end | 50 end |
51 if not isMasterLootEvent then return end | 51 if not isMasterLootEvent then return end |
52 | 52 |
53 print("Let's get started SKing") | 53 print("Let's get started SKing") |
54 -- todo: check that I am ML and that I'm an admin! | 54 -- todo: check that I am ML and that I'm an admin! |
55 | 55 |
56 -- make state: gather all item links, transmit them plus the new looting | |
57 -- state | |
58 -- | |
59 InitiateBeginLoot(items,stateactivelist) | 56 InitiateBeginLoot(items,stateactivelist) |
60 | |
61 end | 57 end |
62 | 58 |
63 function FreeLoot(item,person) | 59 function FreeLoot(item,person) |
64 PrintTable(item) | 60 PrintTable(item) |
65 PrintTable(person) | 61 PrintTable(person) |
66 for ci = 1, 40 do | 62 for ci = 1, 40 do |
67 if _G.GetMasterLootCandidate(ci) == person.textPlain then | 63 if _G.GetMasterLootCandidate(ci) == person.textPlain then |
68 print("GML",item.value,ci) | 64 print("GML",item.mlid,ci) |
69 _G.GiveMasterLoot(item.value, ci) | 65 _G.GiveMasterLoot(item.mlid, ci) |
70 return true | 66 return true |
71 end | 67 end |
72 end | 68 end |
73 | 69 |
74 print("Could not assign loot to ", person.textPlain) | 70 print("Could not assign loot to ", person.textPlain) |
75 end | 71 end |
76 | 72 |
77 function ExpensiveLoot(item,lref) | 73 function ExpensiveLoot(item,lref) |
78 local person | |
79 if getn(statebids) > 0 then | 74 if getn(statebids) > 0 then |
80 if FreeLoot(item,statebids[1]) then | 75 if FreeLoot(item,statebids[1]) then |
81 lref:SuicidePerson(statebids[1].value) | 76 lref:SuicidePerson(statebids[1].value) |
82 else | 77 else |
83 printf("Could not suicide %s for item; they are ineligible or offline",statebids[1].textPlain) | 78 printf("Could not suicide %s for item; they are ineligible or offline",statebids[1].textPlain) |
93 return | 88 return |
94 end | 89 end |
95 _G.error("Trying to suicide+loot without bids or rolls") | 90 _G.error("Trying to suicide+loot without bids or rolls") |
96 end | 91 end |
97 | 92 |
93 function DirectSuicideLoot(item,person,lref) | |
94 if FreeLoot(item,person) then | |
95 lref:SuicidePerson(person.value) | |
96 else | |
97 printf("Could not suicide %s for item; they are ineligible or offline", person.textPlain) | |
98 end | |
99 end | |
100 | |
98 function InitializeLooting() | 101 function InitializeLooting() |
99 event:RegisterEvent("OPEN_MASTER_LOOT_LIST",OpenMasterLootList) | 102 event:RegisterEvent("OPEN_MASTER_LOOT_LIST",OpenMasterLootList) |
100 event:RegisterEvent("UPDATE_MASTER_LOOT_LIST",UpdateMasterLootList) | 103 event:RegisterEvent("UPDATE_MASTER_LOOT_LIST",UpdateMasterLootList) |
101 event:RegisterEvent("LOOT_CLOSED",LootClosed) | 104 event:RegisterEvent("LOOT_CLOSED",LootClosed) |
102 event:RegisterEvent("LOOT_OPENED",LootOpened) | 105 event:RegisterEvent("LOOT_OPENED",LootOpened) |