diff State.lua @ 82:db7e4ee34dce

Lots of support for mobs with multiple loots
author John@Yosemite-PC
date Fri, 13 Apr 2012 23:14:03 -0400
parents 62805e6b46c5
children b89558d3e833
line wrap: on
line diff
--- a/State.lua	Fri Apr 13 22:09:17 2012 -0400
+++ b/State.lua	Fri Apr 13 23:14:03 2012 -0400
@@ -357,6 +357,25 @@
         Comm:SendStateChange("IR",person,roll)
     end
 end
+
+local function LootSlotCleared(packet)
+    local index = unpack(packet)
+    if state == "looting" or state == "bidding" then
+        for i,v in pairs(stateitemlist) do
+            if v.mlid == index then
+                v.disabled = true
+                print("DISABLING")
+                AlertItemListListeners()
+                return
+            end
+        end
+    end
+end
+function InitiateLSClear(index)
+    if state == "looting" or state == "bidding" then
+        Comm:SendStateChange("SC",index)
+    end
+end
 function DispatchState(packet)
     local state = table.remove(packet,1)
     print("Dispatching", state)
@@ -376,8 +395,10 @@
         ActivateList(packet)
     elseif state == "IR" then
         RollRequest(packet)
+    elseif state == "SC" then
+        LootSlotCleared(packet)
     else -- todo ...
-
+        _G.error("Cannot dispatch message of type:",state)
     end
 end