Mercurial > wow > breuesk
comparison Looting.lua @ 81:62805e6b46c5
Fleshing out the UI for those without the addon. Announcements in the raid, bidding via whisper.
author | John@Yosemite-PC |
---|---|
date | Fri, 13 Apr 2012 22:09:17 -0400 |
parents | 7b8fcea357d2 |
children | db7e4ee34dce |
comparison
equal
deleted
inserted
replaced
80:40c882db34f8 | 81:62805e6b46c5 |
---|---|
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 InitiateBeginLoot(items,stateactivelist) | 56 InitiateBeginLoot(items,stateactivelist) |
57 | |
58 local chan -- todo: idiom | |
59 if _G.GetNumRaidMembers() > 0 then chan = "RAID" else chan = "PARTY" end | |
60 _G.SendChatMessage("The following items are available -",chan) | |
61 for i,v in pairs(items) do | |
62 _G.SendChatMessage(v.link,chan) | |
63 end | |
57 end | 64 end |
58 | 65 |
59 function FreeLoot(item,person) | 66 function FreeLoot(item,person) |
60 PrintTable(item) | 67 PrintTable(item) |
61 PrintTable(person) | 68 PrintTable(person) |
71 end | 78 end |
72 | 79 |
73 function ExpensiveLoot(item,lref) | 80 function ExpensiveLoot(item,lref) |
74 if getn(statebids) > 0 then | 81 if getn(statebids) > 0 then |
75 if FreeLoot(item,statebids[1]) then | 82 if FreeLoot(item,statebids[1]) then |
83 local chan -- todo: idiom | |
84 if _G.GetNumRaidMembers() > 0 then chan = "RAID" else chan = "PARTY" end | |
85 _G.SendChatMessage(sformat("Awarding %s to %s!",item.link,statebids[1].textPlain),chan) | |
86 --_G.SendChatMessage(sformat("Awarding %s to %s!",item.link,statebids[1].textPlain),"GUILD") -- todo: enable | |
76 lref:SuicidePerson(statebids[1].value) | 87 lref:SuicidePerson(statebids[1].value) |
88 InitiateCloseBidding() | |
77 else | 89 else |
78 printf("Could not suicide %s for item; they are ineligible or offline",statebids[1].textPlain) | 90 printf("Could not suicide %s for item; they are ineligible or offline",statebids[1].textPlain) |
79 end | 91 end |
80 return | 92 return |
81 end | 93 end |
82 if getn(staterolls) > 0 then | 94 if getn(staterolls) > 0 then |
83 if FreeLoot(item,staterolls[1]) then | 95 if FreeLoot(item,staterolls[1]) then |
84 --lref:SuicidePerson(staterolls[1].value) | 96 local chan -- todo: idiom |
97 if _G.GetNumRaidMembers() > 0 then chan = "RAID" else chan = "PARTY" end | |
98 _G.SendChatMessage(sformat("Awarding %s to %s!",item.link,staterolls[1].textPlain),chan) | |
99 InitiateCloseBidding() | |
85 else | 100 else |
86 printf("Could not suicide %s for item; they are ineligible or offline",staterolls[1].textPlain) | 101 printf("Could not suicide %s for item; they are ineligible or offline",staterolls[1].textPlain) |
87 end | 102 end |
88 return | 103 return |
89 end | 104 end |
96 else | 111 else |
97 printf("Could not suicide %s for item; they are ineligible or offline", person.textPlain) | 112 printf("Could not suicide %s for item; they are ineligible or offline", person.textPlain) |
98 end | 113 end |
99 end | 114 end |
100 | 115 |
116 function WhisperReceived(...) | |
117 local _,message,sender = ... | |
118 local senderAction = function(func) | |
119 local le = PersonList:Select(sender) | |
120 if le then | |
121 local person = ConvertLe2Line(le) | |
122 if person then | |
123 func(person) | |
124 end | |
125 end | |
126 end | |
127 | |
128 if state == "bidding" and admin then -- todo: should only be ML | |
129 message = _G.strtrim(message) | |
130 message = _G.strlower(message) | |
131 if message == "bid" then | |
132 senderAction(InitiateBid) | |
133 elseif message == "retract" then | |
134 senderAction(InitiateRetract) | |
135 elseif message == "roll" then | |
136 senderAction(InitiateRollRequest) | |
137 end | |
138 end | |
139 end | |
140 | |
141 local statelistener = | |
142 { | |
143 ["StateEvent"] = function(self) | |
144 if state == "bidding" then | |
145 event:RegisterEvent("CHAT_MSG_WHISPER", WhisperReceived) | |
146 else | |
147 --event:UnregisterEvent("CHAT_MSG_WHISPER") -- todo | |
148 end | |
149 end, | |
150 } | |
151 | |
101 function InitializeLooting() | 152 function InitializeLooting() |
102 event:RegisterEvent("OPEN_MASTER_LOOT_LIST",OpenMasterLootList) | 153 event:RegisterEvent("OPEN_MASTER_LOOT_LIST",OpenMasterLootList) |
103 event:RegisterEvent("UPDATE_MASTER_LOOT_LIST",UpdateMasterLootList) | 154 event:RegisterEvent("UPDATE_MASTER_LOOT_LIST",UpdateMasterLootList) |
104 event:RegisterEvent("LOOT_CLOSED",LootClosed) | 155 event:RegisterEvent("LOOT_CLOSED",LootClosed) |
105 event:RegisterEvent("LOOT_OPENED",LootOpened) | 156 event:RegisterEvent("LOOT_OPENED",LootOpened) |
106 | 157 |
107 -- todo: what are these | 158 -- todo: what are these |
108 event:RegisterEvent("LOOT_SLOT_CLEARED",function() print("LSCleared") end) | 159 event:RegisterEvent("LOOT_SLOT_CLEARED",function() print("LSCleared") end) |
109 event:RegisterEvent("LOOT_SLOT_CHANGED",function() print("LSChanged") end) | 160 event:RegisterEvent("LOOT_SLOT_CHANGED",function() print("LSChanged") end) |
161 | |
162 RegisterListenerStateChange(statelistener) | |
163 statelistener:StateEvent() | |
110 end | 164 end |
111 | 165 |