2023-11-05 08:48
#0
In the EC the Loot All and Organizer will continue to run forever if the destination container is overweight or as too many item. Loot All, Organizer, and Restock will continue to run forever if the source container is closed. The following code will stop them from running forever.
To the file source\ContainerWindow.lua add the following functions
To the file source\ContainerWindow.lua add the following functions
--start of added code
function ContainerWindow.StopLootAll()
local oldOrganizeParent = ContainerWindow.OrganizeParent
ContainerWindow.OrganizeParent = WindowGetId(WindowUtils.GetActiveDialog())
if(oldOrganizeParent ~= nil and oldOrganizeParent ~= ContainerWindow.OrganizeParent)then
ContainerWindow.LootAll[oldOrganizeParent] = nil
end
if(ContainerWindow.OrganizeParent ~= nil) then
ContainerWindow.LootAll[ContainerWindow.OrganizeParent] = nil
end
moveObjects = {} -- cleanup
end
function ContainerWindow.StopOrganizer()
Actions.MassOrganize = false -- abort organizer
ContainerWindow.Organize = false -- enable the button
moveObjects = {} -- cleanup
end
function ContainerWindow.StopRestock()
ContainerWindow.Restock = false -- enable the button
end
--end of added code
Add the following code to the bottom of the function ContainerWindow.UpdatePickupTimer in the file source\ContainerWindow.lua
--start of added code
local organizerParentOpen = false
--end of added code
for id, value in pairs(ContainerWindow.OpenContainers) do
if ContainerWindow.OpenContainers[id] ~= nil then
--start of added code
if(id == ContainerWindow.OrganizeParent) then
organizerParentOpen = true
end
--end of added code
local isDirty = ContainerWindow.OpenContainers[id].dirty
if(isDirty == 1 and ContainerWindow.OpenContainers[id].LastUpdate and ContainerWindow.OpenContainers[id].LastUpdate < ContainerWindow.DeltaRefresh)then
ContainerWindow.UpdateContents(id)
if (ContainerSearch.Container == id) then
ContainerSearch.UpdateList()
end
end
end
end
--start of added code
if(organizerParentOpen == false) then -- stop organizer, restock, loot all
ContainerWindow.StopOrganizer()
ContainerWindow.StopRestock()
ContainerWindow.StopLootAll()
end
--end of added code
end
Add the following code to the function TextParsing.SpecialTexts in the file source\TextParsing.lua
(Note: this code replaces the code added in the post: https://forum.uo.com/discussion/13267/ec-stop-loot-all-from-running-forever-if-the-loot-bag-can-not-hold-more-weight
(Note: this code replaces the code added in the post: https://forum.uo.com/discussion/13267/ec-stop-loot-all-from-running-forever-if-the-loot-bag-can-not-hold-more-weight
function TextParsing.SpecialTexts()
local senderText = SystemData.Text
local find = wstring.find
--start of added code
if ( senderText ~= nil) then
local tooMuchWeight = GetStringFromTid(1080016) -- "That container cannot hold more weight."
local tooManyItems = GetStringFromTid(1080017) -- "That container cannot hold more items."
if( senderText == tooMuchWeight or senderText == tooManyItems) then
ContainerWindow.StopOrganizer()
ContainerWindow.StopLootAll()
return
end
end
--end of added code