diff Looting.lua @ 78:5b507f4125d4

Finalized bid handling
author John@Yosemite-PC
date Thu, 12 Apr 2012 22:19:15 -0400
parents 39be9328acd0
children 7b8fcea357d2
line wrap: on
line diff
--- a/Looting.lua	Thu Apr 12 22:18:05 2012 -0400
+++ b/Looting.lua	Thu Apr 12 22:19:15 2012 -0400
@@ -44,8 +44,8 @@
     for i = 1,n do
         local link = _G.GetLootSlotLink(i)
         if link then
-            table.insert(items,link)
-            print("Item: ", link)
+            table.insert(items,{link=link,mlid=i})
+            print("Item: ", link, i)
         end
     end
     if not isMasterLootEvent then return end
@@ -53,11 +53,7 @@
     print("Let's get started SKing")
     -- todo: check that I am ML and that I'm an admin!
 
-    -- make state: gather all item links, transmit them plus the new looting
-    -- state
-    --
     InitiateBeginLoot(items,stateactivelist)
-
 end
 
 function FreeLoot(item,person)
@@ -65,8 +61,8 @@
     PrintTable(person)
     for ci = 1, 40 do
         if _G.GetMasterLootCandidate(ci) == person.textPlain then
-            print("GML",item.value,ci)
-            _G.GiveMasterLoot(item.value, ci)
+            print("GML",item.mlid,ci)
+            _G.GiveMasterLoot(item.mlid, ci)
             return true
         end
     end
@@ -75,7 +71,6 @@
 end
 
 function ExpensiveLoot(item,lref)
-    local person
     if getn(statebids) > 0 then
         if FreeLoot(item,statebids[1]) then
             lref:SuicidePerson(statebids[1].value)
@@ -95,6 +90,14 @@
     _G.error("Trying to suicide+loot without bids or rolls")
 end
 
+function DirectSuicideLoot(item,person,lref)
+    if FreeLoot(item,person) then
+        lref:SuicidePerson(person.value)
+    else
+        printf("Could not suicide %s for item; they are ineligible or offline", person.textPlain)
+    end
+end
+
 function InitializeLooting()
     event:RegisterEvent("OPEN_MASTER_LOOT_LIST",OpenMasterLootList)
     event:RegisterEvent("UPDATE_MASTER_LOOT_LIST",UpdateMasterLootList)