comparison Looting.lua @ 76:39be9328acd0

Turning bidding admin buttons into state responders Starting to integrate master looting along with the bids
author John@Yosemite-PC
date Tue, 10 Apr 2012 23:50:07 -0400
parents 7eb2963eea7d
children 5b507f4125d4
comparison
equal deleted inserted replaced
75:ed1c9fd4cc95 76:39be9328acd0
58 -- 58 --
59 InitiateBeginLoot(items,stateactivelist) 59 InitiateBeginLoot(items,stateactivelist)
60 60
61 end 61 end
62 62
63 function FreeLoot(item,person)
64 PrintTable(item)
65 PrintTable(person)
66 for ci = 1, 40 do
67 if _G.GetMasterLootCandidate(ci) == person.textPlain then
68 print("GML",item.value,ci)
69 _G.GiveMasterLoot(item.value, ci)
70 return true
71 end
72 end
73
74 print("Could not assign loot to ", person.textPlain)
75 end
76
77 function ExpensiveLoot(item,lref)
78 local person
79 if getn(statebids) > 0 then
80 if FreeLoot(item,statebids[1]) then
81 lref:SuicidePerson(statebids[1].value)
82 else
83 printf("Could not suicide %s for item; they are ineligible or offline",statebids[1].textPlain)
84 end
85 return
86 end
87 if getn(staterolls) > 0 then
88 if FreeLoot(item,staterolls[1]) then
89 lref:SuicidePerson(staterolls[1].value)
90 else
91 printf("Could not suicide %s for item; they are ineligible or offline",staterolls[1].textPlain)
92 end
93 return
94 end
95 _G.error("Trying to suicide+loot without bids or rolls")
96 end
97
63 function InitializeLooting() 98 function InitializeLooting()
64 event:RegisterEvent("OPEN_MASTER_LOOT_LIST",OpenMasterLootList) 99 event:RegisterEvent("OPEN_MASTER_LOOT_LIST",OpenMasterLootList)
65 event:RegisterEvent("UPDATE_MASTER_LOOT_LIST",UpdateMasterLootList) 100 event:RegisterEvent("UPDATE_MASTER_LOOT_LIST",UpdateMasterLootList)
66 event:RegisterEvent("LOOT_CLOSED",LootClosed) 101 event:RegisterEvent("LOOT_CLOSED",LootClosed)
67 event:RegisterEvent("LOOT_OPENED",LootOpened) 102 event:RegisterEvent("LOOT_OPENED",LootOpened)
103
104 -- todo: what are these
105 event:RegisterEvent("LOOT_SLOT_CLEARED",function() print("LSCleared") end)
106 event:RegisterEvent("LOOT_SLOT_CHANGED",function() print("LSChanged") end)
68 end 107 end
69 108