EC: Stop Loot All from looting an item weighing 50 stones.

TimStTimSt Posts: 1,799
edited October 2023 in General Discussions
On mobs and tmap chests the occasional item weighing 50 stones shows up. If you use the Loot All button in the EC you will end up getting that 50 stone item placed in your backpack.  The following code will stop Loot All from looting those 50 stone items.

To the file source\ItemProperties.lua add the following function
--start of added code
function ItemProperties.GetItemWeight(itemId)
local weight = 0
local props = ItemProperties.GetObjectPropertiesArray( itemId, "GetItemWeight" )

if (props) then
local params = ItemProperties.BuildParamsArray( props )
for j = 1, #props.PropertiesTids do
if (ItemPropertiesInfo.WeightONLYTid[props.PropertiesTids[j]]) then
token = ItemPropertiesInfo.WeightONLYTid[props.PropertiesTids[j]]
val = tostring(params[props.PropertiesTids[j]][token])
weight = tonumber(val)
return weight
end
end
end

return weight
end
--end of added code
To the function ContainerWindow.UpdatePickupTimer in the file source\ContainerWindow.lua add the 3 code fragments between the "start of added code" and "end of added code" comments.  Including the entire existing Loot All code here to avoid issues of where to put the added code.

	if ContainerWindow.OrganizeParent and ContainerWindow.LootAll[ContainerWindow.OrganizeParent] and ContainerWindow.CanPickUp then

if not moveObjects or #moveObjects == 0 then
moveObjects = {}
local numItems = WindowData.ContainerWindow[ContainerWindow.OrganizeParent].numItems
for i = 1, numItems do
local item = WindowData.ContainerWindow[ContainerWindow.OrganizeParent].ContainedItems[i]
local itemData = WindowData.ObjectInfo[item.objectId]
--start of added code
if (itemData) then
local weight = ItemProperties.GetItemWeight(item.objectId)
if(weight == 50 and itemData.quantity == 1) then
itemData = nil
end
end
--end of added code
if (itemData) then
table.insert(moveObjects,item.objectId)
end
end
if(#moveObjects == 0)then
ContainerWindow.LootAll[ContainerWindow.OrganizeParent] = nil
end
end

if moveObjects and #moveObjects > 0 and ContainerWindow.CanPickUp then

local OrganizeBag = Interface.LootBoxID
if not OrganizeBag or OrganizeBag == 0 then
OrganizeBag = ContainerWindow.PlayerBackpack
end

local key = moveObjects[1]
local itemData = WindowData.ObjectInfo[key]

if itemData and itemData.containerId == ContainerWindow.OrganizeParent then
ContainerWindow.TimePassedSincePickUp = 0
ContainerWindow.CanPickUp = false
ObjectHandleWindow.lastItem = key

MoveItemToContainer(key,itemData.quantity, OrganizeBag)

table.remove(moveObjects, 1)
if #moveObjects == 0 then
moveObjects = {}
local numItems = WindowData.ContainerWindow[ContainerWindow.OrganizeParent].numItems
for i = 1, numItems do
local item = WindowData.ContainerWindow[ContainerWindow.OrganizeParent].ContainedItems[i]
local itemData = WindowData.ObjectInfo[item.objectId]

--start of added code
if (itemData) then
local weight = ItemProperties.GetItemWeight(item.objectId)
if(weight == 50 and itemData.quantity == 1) then
itemData = nil
end
end
--end of added code
if (itemData) then
table.insert(moveObjects,item.objectId)
end
end
if #moveObjects == 0 then
ContainerWindow.LootAll[ContainerWindow.OrganizeParent] = nil
end
end
else
table.remove(moveObjects, 1)
if #moveObjects == 0 then
moveObjects = {}
local numItems = WindowData.ContainerWindow[ContainerWindow.OrganizeParent].numItems
for i = 1, numItems do
local item = WindowData.ContainerWindow[ContainerWindow.OrganizeParent].ContainedItems[i]
local itemData = WindowData.ObjectInfo[item.objectId]

--start of added code
if (itemData) then
local weight = ItemProperties.GetItemWeight(item.objectId)
if(weight == 50 and itemData.quantity == 1) then
itemData = nil
end
end
--end of added code
if (itemData) then
table.insert(moveObjects,item.objectId)
end
end
if #moveObjects == 0 then
ContainerWindow.LootAll[ContainerWindow.OrganizeParent] = nil
end
end
end
end
end



Comments

  • WhitewolfWhitewolf Posts: 191
    man you need to go work for broadsword, you are better at this then they are
Sign In or Register to comment.