comparison State.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 40c882db34f8
children db7e4ee34dce
comparison
equal deleted inserted replaced
80:40c882db34f8 81:62805e6b46c5
132 local item = unpack(packet) 132 local item = unpack(packet)
133 if state == "looting" then 133 if state == "looting" then
134 state = "bidding" 134 state = "bidding"
135 stateitem = item 135 stateitem = item
136 AlertStateChangeListeners() 136 AlertStateChangeListeners()
137 if admin then -- todo: only ML
138 local chan
139 if _G.GetNumRaidMembers() > 0 then chan = "RAID" else chan = "PARTY" end
140 _G.SendChatMessage("Bidding is now open for "..item.link.."!",chan)
141 _G.SendChatMessage("Whisper me \"bid\" to bid or \"roll\" to offset roll; \"retract\" will remove your bid",chan)
142 end
137 end 143 end
138 end 144 end
139 145
140 function InitiateOpenBid(item) 146 function InitiateOpenBid(item)
141 if state == "looting" then 147 if state == "looting" then
188 function ReceivedBid(packet) -- no state transition, but only matters during one state 194 function ReceivedBid(packet) -- no state transition, but only matters during one state
189 local person, roll = unpack(packet) 195 local person, roll = unpack(packet)
190 196
191 if state == "bidding" then 197 if state == "bidding" then
192 if roll then 198 if roll then
193 print("RB: ",person.value,roll)
194 table.insert(staterolls,person) 199 table.insert(staterolls,person)
195 staterollvalues[roll] = person 200 staterollvalues[roll] = person
196 staterolls = SortByRoll(staterollvalues,staterolls) 201 staterolls = SortByRoll(staterollvalues,staterolls)
197 else 202 else
198 local lref = LootLists:Select(stateactivelist) 203 local lref = LootLists:Select(stateactivelist)
199 table.insert(statebids,person) 204 table.insert(statebids,person)
200 statebids = SortByList(lref,statebids) 205 statebids = SortByList(lref,statebids)
201 end 206 end
202 AlertRollListeners() 207 AlertRollListeners()
208 if admin then -- todo: make ML
209 local leader
210 if getn(statebids) > 0 then
211 leader = statebids[1].textPlain
212 elseif getn(staterolls) > 0 then
213 leader = staterolls[1].textPlain
214 end
215
216 local chan -- todo: this idiom is wearing on me already
217 if _G.GetNumRaidMembers() > 0 then chan = "RAID" else chan = "PARTY" end
218
219 if roll then
220 _G.SendChatMessage(sformat("Received roll of %d from %s; current leader is %s", roll, person.textPlain, leader),chan)
221 else
222 _G.SendChatMessage(sformat("Received bid from %s; current leader is %s", person.textPlain, leader),chan) -- todo: tell what spot they're bidding from
223 end
224 end
203 end 225 end
204 226
205 -- else ignore ... 227 -- else ignore ...
206 end 228 end
207 229
248 end 270 end
249 end 271 end
250 272
251 function InitiateRetract(person) 273 function InitiateRetract(person)
252 if state == "bidding" then 274 if state == "bidding" then
253 Comm:SendStateChange("RR",person,roll) 275 Comm:SendStateChange("RR",person)
254 end 276 end
255 end 277 end
256 --}}} 278 --}}}
257 -- Close Bidding {{{ 279 -- Close Bidding {{{
258 function CloseBidding(packet) -- todo: does not clear enough state 280 function CloseBidding(packet) -- todo: does not clear enough state
259 local awardedTo = unpack(packet) 281 local awardedTo = unpack(packet)
260 if state == "bidding" then 282 if state == "bidding" then
261 state = "looting" 283 state = "looting"
262 AlertStateChangeListeners() 284 AlertStateChangeListeners()
263 -- todo: remove the item from the window, record history 285 -- todo: record history
286 if admin then
287 local chan -- todo: pattern
288 local chan -- todo: this idiom is wearing on me already
289 if _G.GetNumRaidMembers() > 0 then chan = "RAID" else chan = "PARTY" end
290 _G.SendChatMessage("Bidding is closed",chan)
291 end
264 end 292 end
265 end 293 end
266 294
267 function InitiateCloseBidding(awardedTo) 295 function InitiateCloseBidding(awardedTo)
268 if state == "bidding" then 296 if state == "bidding" then