diff 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
line wrap: on
line diff
--- a/State.lua	Mon Apr 16 07:05:37 2012 -0400
+++ b/State.lua	Mon Apr 16 07:06:19 2012 -0400
@@ -134,7 +134,7 @@
         state = "bidding"
         stateitem = item
         AlertStateChangeListeners()
-        if admin then -- todo: only ML
+        if admin and masterLooterIsMe then
             local chan
             if _G.GetNumRaidMembers() > 0 then chan = "RAID" else chan = "PARTY" end
             _G.SendChatMessage("Bidding is now open for "..item.link.."!",chan)
@@ -205,7 +205,7 @@
             statebids = SortByList(lref,statebids)
         end
         AlertRollListeners()
-        if admin then -- todo: make ML
+        if admin and masterLooterIsMe then
             local leader
             if getn(statebids) > 0 then
                 leader = statebids[1].textPlain
@@ -277,14 +277,18 @@
 end
 --}}}
 -- Close Bidding {{{
-function CloseBidding(packet) -- todo: does not clear enough state
-    local awardedTo = unpack(packet) 
+function CloseBidding(packet)
+    local awardedTo = unpack(packet)  -- todo: unused
     if state == "bidding" then
         state = "looting"
+        stateitem = nil
+        statebids = {}
+        staterolls = {}
+        staterollvalues = {}
         AlertStateChangeListeners()
+        AlertItemListListeners()
         -- todo: record history
         if admin then
-            local chan -- todo: pattern
             local chan -- todo: this idiom is wearing on me already
             if _G.GetNumRaidMembers() > 0 then chan = "RAID" else chan = "PARTY" end
             _G.SendChatMessage("Bidding is closed",chan)
@@ -318,7 +322,7 @@
 function RollRequest(packet)
     local person = unpack(packet)
     
-    if state == "bidding" and admin then -- todo: admin should be ML
+    if state == "bidding" and admin and masterLooterIsMe then
         local roll
         for i,v in pairs(staterollvalues) do
             if v and v.value == person.value then
@@ -397,7 +401,7 @@
         RollRequest(packet)
     elseif state == "SC" then
         LootSlotCleared(packet)
-    else -- todo ...
+    else
         _G.error("Cannot dispatch message of type:",state)
     end
 end