Updated to OTCv8 3.0 rev 91

This commit is contained in:
OTCv8
2021-07-18 11:09:50 +00:00
parent e2e56f82ed
commit de2ac3e972
102 changed files with 3050 additions and 2654 deletions

View File

@@ -0,0 +1,45 @@
CaveBot.Extensions.Withdraw = {}
CaveBot.Extensions.Withdraw.setup = function()
CaveBot.registerAction("withdraw", "#002FFF", function(value, retries)
-- validation
local data = string.split(value, ",")
if #data ~= 3 then
print("CaveBot[Withdraw]: incorrect data! skipping")
return false
end
-- variables declaration
local source = tonumber(data[1])
local id = tonumber(data[2])
local amount = tonumber(data[3])
-- validation for correct values
if not id or not amount then
print("CaveBot[Withdraw]: incorrect id or amount! skipping")
return false
end
-- check for retries
if retries > 100 then
print("CaveBot[Withdraw]: actions limit reached, proceeding")
return true
end
-- check for items
if itemAmount(id) >= amount then
print("CaveBot[Withdraw]: enough items, proceeding")
return true
end
CaveBot.WithdrawItem(id, amount, source)
CaveBot.PingDelay()
return "retry"
end)
CaveBot.Editor.registerAction("withdraw", "withdraw", {
value="source,id,amount",
title="Withdraw Items",
description="index/inbox, item id and amount",
})
end