Changed the 'invclean' code to behave like the 'portalclean' code.

This change makes it so that a temporary table is created, checked against EqInventory table, and then create list to shove stuff away.
master
icecool 6 years ago
parent b5b9b01aa0
commit fa38b8e02f

@ -437,11 +437,8 @@ function TRIGGER_AddInvListItem( name, line, args )
dnote(("%s TRIGGER_CreateInventoryListItem() did not have an args.objid argument."):format(Prepend))
return
end
local objid = tostring(args.objid)
if EqInventory[objid] then
table.insert(InvList, 1, objid)
dnote(("%s TRIGGER_CreateInventoryListItem added Object ID#%s to InvList table."):format(Prepend,objid))
end
if not temporaryEquipmentList then temporaryEquipmentList = {} end
table.insert(temporaryEquipmentList, 1, tostring(args.objid))
end
function TRIGGER_AddPortalInvItem( name, line, args )
if not (args.objid) then
@ -470,7 +467,8 @@ function TRIGGER_EndInvData( name, line, args )
elseif name == "InvDataInvCleanUpEnd" then
EnableTriggerGroup("GroupInvDataStart", false)
EnableTriggerGroup("GroupInventoryCleanup", false)
InventoryManager.InventoryCleanUp()
dnote(("%s Now creating a temporary 'inventory' table to then process against EqInventory table."):format(Prepend))
InventoryManager.ProcessEquipmentCleanUpList()
elseif name == "InvDataPortalSetupEnd" then
EnableTriggerGroup("GroupInvDataStart", false)
EnableTriggerGroup("GroupPortalInventorySetup", false)
@ -514,6 +512,18 @@ function InventoryManager.WearItemList()
if #TempInventory > 0 then SendNoEcho("wear all") end
TempInventory = { }
end
function InventoryManager.ProcessEquipmentCleanUpList()
for invdata, value in pairs(EqInventory) do
for portal, objid in pairs(temporaryEquipmentList) do
if objid == invdata then
dnote(("%s @wInventoryManager.ProcessEquipmentCleanUpList added equipment(@R%s@w) to InvList for cleanup.@w"):format(Prepend, objid))
table.insert(InvList, 1, objid)
break
end
end
end
InventoryManager.InventoryCleanUp()
end
function InventoryManager.InventoryCleanUp()
if #InvList == 0 then
dnote(("%s InventoryManager.InventoryCleanUp is reporting InvList as emtpy."):format(Prepend))
@ -522,7 +532,7 @@ function InventoryManager.InventoryCleanUp()
dnote(("%s InventoryManager.InventoryCleanUp() is now putting items from InvList table into bag id#%d."):format(Prepend, EqCheckSettings.Bag))
cnote(("%s Putting the managed equipment into bag id#@R%d@w."):format(Prepend,EqCheckSettings.Bag))
for obj, list in pairs(InvList) do
print(("put %s %d"):format(InvList[obj], EqCheckSettings.Bag))
SendNoEcho(("put %s %d"):format(InvList[obj], EqCheckSettings.Bag))
end
InvList = { }
end

Loading…
Cancel
Save