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)) dnote(("%s TRIGGER_CreateInventoryListItem() did not have an args.objid argument."):format(Prepend))
return return
end end
local objid = tostring(args.objid) if not temporaryEquipmentList then temporaryEquipmentList = {} end
if EqInventory[objid] then table.insert(temporaryEquipmentList, 1, tostring(args.objid))
table.insert(InvList, 1, objid)
dnote(("%s TRIGGER_CreateInventoryListItem added Object ID#%s to InvList table."):format(Prepend,objid))
end
end end
function TRIGGER_AddPortalInvItem( name, line, args ) function TRIGGER_AddPortalInvItem( name, line, args )
if not (args.objid) then if not (args.objid) then
@ -470,7 +467,8 @@ function TRIGGER_EndInvData( name, line, args )
elseif name == "InvDataInvCleanUpEnd" then elseif name == "InvDataInvCleanUpEnd" then
EnableTriggerGroup("GroupInvDataStart", false) EnableTriggerGroup("GroupInvDataStart", false)
EnableTriggerGroup("GroupInventoryCleanup", 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 elseif name == "InvDataPortalSetupEnd" then
EnableTriggerGroup("GroupInvDataStart", false) EnableTriggerGroup("GroupInvDataStart", false)
EnableTriggerGroup("GroupPortalInventorySetup", false) EnableTriggerGroup("GroupPortalInventorySetup", false)
@ -514,6 +512,18 @@ function InventoryManager.WearItemList()
if #TempInventory > 0 then SendNoEcho("wear all") end if #TempInventory > 0 then SendNoEcho("wear all") end
TempInventory = { } TempInventory = { }
end 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() function InventoryManager.InventoryCleanUp()
if #InvList == 0 then if #InvList == 0 then
dnote(("%s InventoryManager.InventoryCleanUp is reporting InvList as emtpy."):format(Prepend)) 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)) 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)) cnote(("%s Putting the managed equipment into bag id#@R%d@w."):format(Prepend,EqCheckSettings.Bag))
for obj, list in pairs(InvList) do 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 end
InvList = { } InvList = { }
end end

Loading…
Cancel
Save