function Open_Containers()
local tries = 10
while #Container.GetAll() > 0 do
for i = 0, 15 do
closeContainer(i)
end
end
while #Container.GetAll() < 5 or tries > 0 do
while #Container.GetAll() > 0 do
for i = 0, 15 do
end
end
Client.HideEquipment()
if Self.BrowseField(Coordinates.Counter.x, Coordinates.Counter.y, Coordinates.Counter.z) == 1 then
wait(500 + Self.Ping())
Containers.Counter = Container(_OpenTibia and _OpenTibia_Indexes[1] - 1 or 0)
Containers.Counter:Minimize()
wait(100)
Client.HideEquipment()
ProcessDebugMessage('Casino Debugger', 'Counter browse field opened')
if Self.BrowseField(Coordinates.Locker.x, Coordinates.Locker.y, Coordinates.Locker.z) == 1 then
wait(500 + Self.Ping())
Containers.Locker = Container(_OpenTibia and _OpenTibia_Indexes[2] - 1 or 1)
Containers.Locker:Minimize()
wait(100)
Client.HideEquipment()
ProcessDebugMessage('Casino Debugger', 'Locker browse field opened')
if table.contains(Locker_IDs, Containers.Locker:GetItemData(0).id) then
Containers.Locker:OpenChildren({Containers.Locker: GetItemData(0).id, false})
wait(500 + Self.Ping())
if Container(_OpenTibia and _OpenTibia_Indexes[3] - 1 or 2):UseItem(0, true) == 1 then
local index = 0
wait(500 + Self.Ping())
Containers.Depot = Container(_OpenTibia and _OpenTibia_Indexes[3] - 1 or 2)
Containers.Depot:Minimize()
wait(100 + Self.Ping())
if Accept_Items then
Client.HideEquipment()
if Count_Extended(Containers.Depot, {Item.GetID(_Containers_Items)}) > 0 then
for i = 0, Containers.Depot:ItemCount()-1 do
local item = Containers.Depot:GetItemData(i)
if item.id == Item.GetID(_Containers_Items) then
local opento = Container.GetFreeSlot()
while (Containers.Depot:UseItem(i) ~= 1) do wait(300 + Self.Ping()) end
wait(500 + Self.Ping())
Containers.Items = Container(opento)
Containers.Items:Minimize()
wait(100 + Self.Ping())
ProcessDebugMessage('Casino Debugger', 'Items container opened')
break
end
end
else
ProcessDebugMessage('Casino', 'Error. Items container not found: '.._Containers_Items)
return false
end
end
Client.HideEquipment()
index = 1
if Count_Extended(Containers.Depot, {Item.GetID(_Containers_CrystalCoins)}) > 0 then
for i = 0, Containers.Depot:ItemCount()-1 do
if index < 3 then
local item = Containers.Depot:GetItemData(i)
if item.id == Item.GetID(_Containers_CrystalCoins) then
local opento = Container.GetFreeSlot()
while (Containers.Depot:UseItem(i) ~= 1) do wait(300 + Self.Ping()) end
wait(500 + Self.Ping())
Containers.Crystal[index] = Container(opento)
Containers.Crystal[index]:Minimize()
wait(100 + Self.Ping())
index = index + 1
end
else
break
end
end
else
ProcessDebugMessage('Casino', 'Error. Crystal coins containers not found: '.._Containers_CrystalCoins)
return false
end
Client.HideEquipment()
ProcessDebugMessage('Casino Debugger', 'Crystal coins containers opened')
index = 1
if Count_Extended(Containers.Depot, {Item.GetID(_Containers_PlatinumCoins)}) > 0 then
for i = 0, Containers.Depot:ItemCount()-1 do
if index < 8 then
local item = Containers.Depot:GetItemData(i)
if item.id == Item.GetID(_Containers_PlatinumCoins) then
local opento = Container.GetFreeSlot()
while (Containers.Depot:UseItem(i) ~= 1) do wait(300 + Self.Ping()) end
wait(500 + Self.Ping())
Containers.Platinum[index] = Container(opento)
Containers.Platinum[index]:Minimize()
wait(100 + Self.Ping())
index = index + 1
end
else
break
end
end
else
ProcessDebugMessage('Casino', 'Error. Platinum coins container not found: '.._Containers_PlatinumCoins)
return false
end
wait(500 + Self.Ping())
Client.HideEquipment()
ProcessDebugMessage('Casino Debugger', 'Platinum coins containers opened')
ProcessDebugMessage('Casino', 'All containers were loaded successfully')
return true
end
end
end
end
tries = tries - 1
end
return false
end