comparison 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
comparison
equal deleted inserted replaced
81:62805e6b46c5 82:db7e4ee34dce
353 print(person.value .. " is already on the list") 353 print(person.value .. " is already on the list")
354 return -- no double adds please 354 return -- no double adds please
355 end 355 end
356 end 356 end
357 Comm:SendStateChange("IR",person,roll) 357 Comm:SendStateChange("IR",person,roll)
358 end
359 end
360
361 local function LootSlotCleared(packet)
362 local index = unpack(packet)
363 if state == "looting" or state == "bidding" then
364 for i,v in pairs(stateitemlist) do
365 if v.mlid == index then
366 v.disabled = true
367 print("DISABLING")
368 AlertItemListListeners()
369 return
370 end
371 end
372 end
373 end
374 function InitiateLSClear(index)
375 if state == "looting" or state == "bidding" then
376 Comm:SendStateChange("SC",index)
358 end 377 end
359 end 378 end
360 function DispatchState(packet) 379 function DispatchState(packet)
361 local state = table.remove(packet,1) 380 local state = table.remove(packet,1)
362 print("Dispatching", state) 381 print("Dispatching", state)
374 CloseLooting(packet) 393 CloseLooting(packet)
375 elseif state == "AL" then 394 elseif state == "AL" then
376 ActivateList(packet) 395 ActivateList(packet)
377 elseif state == "IR" then 396 elseif state == "IR" then
378 RollRequest(packet) 397 RollRequest(packet)
398 elseif state == "SC" then
399 LootSlotCleared(packet)
379 else -- todo ... 400 else -- todo ...
380 401 _G.error("Cannot dispatch message of type:",state)
381 end 402 end
382 end 403 end
383 404
384 function InitializeState() 405 function InitializeState()
385 -- basically, find a value for stateactivelist. it really doesn't matter 406 -- basically, find a value for stateactivelist. it really doesn't matter