PDA

View Full Version : XenoBot Bug - Open [Other] VPS depo crash



ichbinfamous
07-25-2015, 11:43 AM
Bug ReportOperating System:
Other Short Description:
VPS depo crash Behaviors: Client Freeze/Crash

Indepth Description:
Client crashes when my character returns to depo.

DarkstaR
07-25-2015, 05:42 PM
It from minimizing backpacks, you need to turn it off. The Tibia client doesn't like to minimize when there's no screen attached to it, for some reason.

ichbinfamous
07-25-2015, 10:35 PM
Yup...

This is caused because when you log off a remote Desktop Session the screen is automatically locked and windows server disables the GUI.
I've tried bypassing this shit by simulating connection but it wasn't working properly and the screen was getting locked anyways.

ichbinfamous
07-27-2015, 02:55 PM
Any ways to make the depositer won't minimize backpacks in depot?

shadowart
07-27-2015, 07:19 PM
Any ways to make the depositer won't minimize backpacks in depot?
Use this instead of the regular Self.DepositItems.

function Self.DepositItems(...)
if (#arg > 0) then setBotEnabled(false) end
local depositInfo = {}

function makeDepositInfo(input)
local ret = {}
for i = 1, #input do
local data = input[i]
local spot = 0
local id = 0
if (type(data) == 'table') then
spot = data[2]
id = Item.GetItemIDFromDualInput(data[1])
else
spot = 0
id = Item.GetItemIDFromDualInput(data)
end

if (not ret[spot]) then
ret[spot] = {}
ret[spot].realIndex = -1
ret[spot].items = {}
end
table.insert(ret[spot].items, id)
end
return ret
end

if (#arg > 0) then
depositInfo = makeDepositInfo(arg)
else
local _input = {getDepositorList()}
print(table.serialize(_input))
if (_input == nil) then
return false
end
depositInfo = makeDepositInfo(_input)
end


local indexes = Container.GetAll() -- list of containers open before we start depositing
local depot = Self.OpenDepot()
local badIndexes = #indexes == 0
if (badIndexes or not depot) then
if (badIndexes) then
print("XenoBot: Unable to find open backpacks to deposit from.")
else
print("XenoBot: Depositor failed to open depot.")
end
if (#arg > 0) then setBotEnabled(true) end
return false
end

for spot, data in pairs(depositInfo) do -- loop to open all the needed backpacks
local currentSpot = 0
for i = 0, depot:ItemCount() - 1 do -- search all items in the depot
if (Item.isContainer(depot:GetItemData(i).id)) then -- only consider containers
if (currentSpot == spot) then -- should we open this?
data.realIndex = Container.GetFreeSlot()
while (depot:UseItem(spot) ~= 1) do
wait(100)
end
wait(Self.Ping() + 300)
end
currentSpot = currentSpot + 1 -- increment
end
end
end
local tempDepositInfo = {} -- warn about and get rid of all depot backpacks which cant be opened
for spot, data in pairs(depositInfo) do
if (data.realIndex ~= -1) then
tempDepositInfo[spot] = data
else
print("XenoBot: Depositor is missing a container in depot slot #" .. spot .. ". Please place cascading containers at the required slot in your depot.")
end
end
depositInfo = tempDepositInfo
function depositItem(depositInfo, contFrom, spot) --when this returns true, we skip the item because we cant deposit it
local currentItem = contFrom:GetItemData(spot)
for _, data in pairs(depositInfo) do -- loop through all of our deposit items
if (table.contains(data.items, currentItem.id)) then -- should we deposit this specific one? try
local depositBp = Container.New(data.realIndex)
if (not depositBp:isOpen()) then -- dest container not open, skip this item
return true
end
if (depositBp:ItemCount() < depositBp:ItemCapacity()) then -- if the backpack isn't full, let's use the final slot
contFrom:MoveItemToContainer(spot, data.realIndex, depositBp:ItemCapacity() - 1)
return false
else -- its full, lets either open the next one or find a good spot
local toSpot = -1 -- fine the best place to put it if we can still fit it
for sp = 0, depositBp:ItemCount() - 1 do
local spData = depositBp:GetItemData(sp)
if (spData.id == currentItem.id and spData.count ~= 100) then
toSpot = sp
end
end
if (not Item.isStackable(currentItem.id) or toSpot == -1) then -- no room for this, open a new container
if (not Item.isContainer(depositBp:GetItemData(depositBp:I temCapacity() - 1).id)) then -- cant open this container, continue to the next item
if (not data.warned) then
data.warned = true
print("XenoBot: Depositor is unable to find room in deposit container #" .. data.realIndex .. ".")
end
return true
end
depositBp:UseItem(depositBp:ItemCapacity() - 1, true)
return false
else -- there's at least some room, lets fill it up
contFrom:MoveItemToContainer(spot, data.realIndex, toSpot)
return false
end
end
end
end
return true
end
function depositItems(depositInfo, indexes)
local containers = {}
for _, index in ipairs(indexes) do -- actually deposit now
local container = Container.New(index)
if (container:isOpen()) then
local checkSpot = 0
while (checkSpot < container:ItemCount()) do -- loop until no more items to deposit
if (depositItem(depositInfo, container, checkSpot)) then
checkSpot = checkSpot + 1 -- if we cant deposit this, skip it
else
if (containers[index] == nil) then containers[index] = 0 end
containers[index] = containers[index] + 1
wait(300, 700)
end
end
end
end
return containers
end
-- deposit items, cascading into new backpacks
local cascadedBps = {}
while (true) do
local cascades = depositItems(depositInfo, indexes)
wait(Self.Ping() + 200)

local opened = false
for index, count in pairs(cascades) do
if (count > 0) then
local cont = Container.New(index)
local lastItem = cont:GetItemData(cont:ItemCount() - 1)
if (Item.isContainer(lastItem.id)) then
if (cascadedBps[index] == nil) then cascadedBps[index] = 0 end
repeat
wait(Self.Ping() + 700)
until (cont:UseItem(cont:ItemCount() - 1, true) ~= 0)
wait(Self.Ping() + 700)
cascadedBps[index] = cascadedBps[index] + 1
opened = true
end
end
end

if (opened == false) then break end
end
-- go back to parent backpacks
for index, times in pairs(cascadedBps) do
for i = 1, times do
Container.GoBack(index)
wait(300, 700)
end
end
wait(800, 1300)
-- close everything
depot:Close()
wait(300, 600)
for spot, data in pairs(depositInfo) do
Container.New(data.realIndex):Close()
wait(200, 400)
end
wait(1500)
delayWalker(2500)
if (#arg > 0) then setBotEnabled(true) end
return true
end