Mercurial > wow > breuesk
comparison State.lua @ 89:b89558d3e833
Master looter detection. Starting to filter certain actions to only the ML.
author | John@Yosemite-PC |
---|---|
date | Mon, 16 Apr 2012 07:06:19 -0400 |
parents | db7e4ee34dce |
children |
comparison
equal
deleted
inserted
replaced
88:f844309a0e35 | 89:b89558d3e833 |
---|---|
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 | 137 if admin and masterLooterIsMe then |
138 local chan | 138 local chan |
139 if _G.GetNumRaidMembers() > 0 then chan = "RAID" else chan = "PARTY" end | 139 if _G.GetNumRaidMembers() > 0 then chan = "RAID" else chan = "PARTY" end |
140 _G.SendChatMessage("Bidding is now open for "..item.link.."!",chan) | 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) | 141 _G.SendChatMessage("Whisper me \"bid\" to bid or \"roll\" to offset roll; \"retract\" will remove your bid",chan) |
142 end | 142 end |
203 local lref = LootLists:Select(stateactivelist) | 203 local lref = LootLists:Select(stateactivelist) |
204 table.insert(statebids,person) | 204 table.insert(statebids,person) |
205 statebids = SortByList(lref,statebids) | 205 statebids = SortByList(lref,statebids) |
206 end | 206 end |
207 AlertRollListeners() | 207 AlertRollListeners() |
208 if admin then -- todo: make ML | 208 if admin and masterLooterIsMe then |
209 local leader | 209 local leader |
210 if getn(statebids) > 0 then | 210 if getn(statebids) > 0 then |
211 leader = statebids[1].textPlain | 211 leader = statebids[1].textPlain |
212 elseif getn(staterolls) > 0 then | 212 elseif getn(staterolls) > 0 then |
213 leader = staterolls[1].textPlain | 213 leader = staterolls[1].textPlain |
275 Comm:SendStateChange("RR",person) | 275 Comm:SendStateChange("RR",person) |
276 end | 276 end |
277 end | 277 end |
278 --}}} | 278 --}}} |
279 -- Close Bidding {{{ | 279 -- Close Bidding {{{ |
280 function CloseBidding(packet) -- todo: does not clear enough state | 280 function CloseBidding(packet) |
281 local awardedTo = unpack(packet) | 281 local awardedTo = unpack(packet) -- todo: unused |
282 if state == "bidding" then | 282 if state == "bidding" then |
283 state = "looting" | 283 state = "looting" |
284 stateitem = nil | |
285 statebids = {} | |
286 staterolls = {} | |
287 staterollvalues = {} | |
284 AlertStateChangeListeners() | 288 AlertStateChangeListeners() |
289 AlertItemListListeners() | |
285 -- todo: record history | 290 -- todo: record history |
286 if admin then | 291 if admin then |
287 local chan -- todo: pattern | |
288 local chan -- todo: this idiom is wearing on me already | 292 local chan -- todo: this idiom is wearing on me already |
289 if _G.GetNumRaidMembers() > 0 then chan = "RAID" else chan = "PARTY" end | 293 if _G.GetNumRaidMembers() > 0 then chan = "RAID" else chan = "PARTY" end |
290 _G.SendChatMessage("Bidding is closed",chan) | 294 _G.SendChatMessage("Bidding is closed",chan) |
291 end | 295 end |
292 end | 296 end |
316 end | 320 end |
317 --}}} | 321 --}}} |
318 function RollRequest(packet) | 322 function RollRequest(packet) |
319 local person = unpack(packet) | 323 local person = unpack(packet) |
320 | 324 |
321 if state == "bidding" and admin then -- todo: admin should be ML | 325 if state == "bidding" and admin and masterLooterIsMe then |
322 local roll | 326 local roll |
323 for i,v in pairs(staterollvalues) do | 327 for i,v in pairs(staterollvalues) do |
324 if v and v.value == person.value then | 328 if v and v.value == person.value then |
325 roll = i | 329 roll = i |
326 break | 330 break |
395 ActivateList(packet) | 399 ActivateList(packet) |
396 elseif state == "IR" then | 400 elseif state == "IR" then |
397 RollRequest(packet) | 401 RollRequest(packet) |
398 elseif state == "SC" then | 402 elseif state == "SC" then |
399 LootSlotCleared(packet) | 403 LootSlotCleared(packet) |
400 else -- todo ... | 404 else |
401 _G.error("Cannot dispatch message of type:",state) | 405 _G.error("Cannot dispatch message of type:",state) |
402 end | 406 end |
403 end | 407 end |
404 | 408 |
405 function InitializeState() | 409 function InitializeState() |