Bonjour tout le monde.
J'avais un ancien script qui mettait en vente les ressources et allait chercher en banque automatiquement les items pour faire une boucle. Depuis le nouveau bonta le bot ne fonctionne plus, j'ai essayé de changer les id des maps/door/npc rien y fait.
Je vous ai mis un screen pour vous montrer l'erreur que j'ai lorsque je lance le script.
SVP AIDEZ-MOI
VOICI LE SCRIPT :
-- M A S T E R - C H I E F --
-----------------------------
file = io.open("accountndc.txt", "r")
if file then
file:close()
for line in io.lines ("accountndc.txt") do
global:printMessage("Bonjour " .. line .. " !")
end
end
global:printMessage("[Info] Script créé par Master Chief (Discord: Master Chief#6163)")
global:printMessage("[Info] Retour en banque requis : 101%")
-- Settings --
mapid_in_banque = "217060352"
mapid_out_banque = "212600322"
cellid_exit_bank = "518"
cellid_door_bank = "512"
zaapi_banque = "zaapi(212600322)"
--
time_pause = 10
kamas_to_take = 10000
index = 1
pause = false
hdv_full = true
ready_to_start = false
ready_to_sell = false
--
Master_Chief = {
-- Hôtel de vente des consommables --
{
go_sell = false,
name = "consommables",
mapid = "146748",
zaapi = "zaapi(146748)",
idnpc = "341",
items = {
}
}
},
-- Hôtel de vente des ressources --
{
go_sell = true,
name = "ressources",
mapid = "212601350",
zaapi = "zaapi(212601350)",
idnpc = "333",
items = {
{ id = 312 , lot =100, nb_inv = 1, nb_sale = 1, min = 500, oos = false, pth = false, price = 0, sale = 0 }, -- patelle x 100
},
-- Hôtel de vente des runes --
{
go_sell = false,
name = "runes",
mapid = "147767",
zaapi = "zaapi(147767)",
idnpc = "212",
items = {
{ id = 1524, lot = 1, nb_inv = 3, nb_sale = 3, min = 10, oos = false, pth = false, price = 0, sale = 0 }, -- Rune Age x 1
{ id = 1524, lot = 10, nb_inv = 2, nb_sale = 2, min = 100, oos = false, pth = false, price = 0, sale = 0 }, -- Rune Age x 10
{ id = 1557, lot = 1, nb_inv = 5, nb_sale = 5, min = 30000, oos = false, pth = false, price = 0, sale = 0 }, -- Rune Ga PA x 1
}
},
}
function send_error(str)
global:printError(str)
global:finishScript()
end
function mille(v)
local s = string.format("%d", math.floor(v))
local pos = string.len(s) % 3
if pos == 0 then pos = 3 end
return string.sub(s, 1, pos) .. string.gsub(string.sub(s, pos+1), "(...)", ".%1")
end
function cv_lot(nb)
if nb == 100 then
return 3
elseif nb == 10 then
return 2
elseif nb == 1 then
return 1
end
end
function info_kamas()
exchange:getKamas(0)
global:printSuccess("[Banque] : " .. mille(character:kamas()) .. " Kamas")
exchange:putKamas(0)
exchange:getKamas(kamas_to_take)
end
function take_items(items)
exchange:putAllItems()
for i, v in ipairs(items) do
if v.id ~= 0 then
v.oos = false
if exchange:storageItemQuantity(v.id) >= (v.nb_inv * v.lot) then
exchange:getItem(v.id, (v.lot * v.nb_inv))
elseif exchange:storageItemQuantity(v.id) > v.lot then
for j = 1, v.nb_inv do
if exchange:storageItemQuantity(v.id) > (v.lot - 1) then exchange:getItem(v.id, v.lot) end
end
else
global:printError("[Erreur] Stock insuffisant de " .. v.lot .. " x [" .. inventory:itemNameId(v.id) .. "].")
v.oos = true
end
end
end
end
function go_bank(items, name)
if map:onMap(mapid_out_banque) then
return map:door(tonumber(cellid_door_bank))
else
npc:npcBank(-1)
take_items(items)
info_kamas()
global:leaveDialog()
ready_to_sell = true
global:printMessage("[Info] Direction l'hôtel de vente des " .. name .. ".")
return map:door(tonumber(cellid_exit_bank))
end
end
-- Le coeur de la maison, la cuisine ! --
function sell_items(items, idnpc)
npc:npc(tonumber(idnpc), 5)
for j, v in ipairs(items) do
if v.id ~= 0 then
v.sale = 0
for i = 1, sale:ItemsOnSale() do
if sale:GetItemGID(i) == v.id and sale:GetItemQuantity(i) == v.lot then
v.sale = v.sale + 1
my_price = sale:GetItemPrice(i)
hdv_price = sale:GetPriceItem(v.id, cv_lot(v.lot))
if my_price ~= hdv_price and v.price ~= hdv_price then
v.price = hdv_price - 1
else
v.price = hdv_price
end
if v.price > v.min and v.price ~= my_price then
global:printError("[Vente] Mise à jour de " .. v.lot .. " x [" .. inventory:itemNameId(v.id) .. "] : " .. mille(v.price) .. " Kamas.")
sale:EditPrice(sale:GetItemGUID(i), v.price, v.lot)
else
global:printMessage("[Vente] Mise à jour de " .. v.lot .. " x [" .. inventory:itemNameId(v.id) .. "] non nécessaire.")
end
end
end
hdv_price = sale:GetPriceItem(v.id, cv_lot(v.lot))
if v.price == 0 then v.price = hdv_price - 1 end
k = v.sale
v.pth = false
while k < v.nb_sale and inventory:itemCount(v.id) >= v.lot do
if v.price > v.min then
global:printSuccess("[Vente] Mise en vente de " .. v.lot .. " x [" .. inventory:itemNameId(v.id) .. "] : " .. v.price .. " Kamas.")
sale:SellItem(v.id, v.lot, v.price)
else
global:printError("[Vente] Mise en vente impossible de " .. v.lot .. " x [" .. inventory:itemNameId(v.id) .. "], Hdv : " .. mille(v.price) .. " Kamas (Prix minimum : " .. mille(v.min) .. ").")
v.pth = true
end
k = k + 1
end
end
end
npc:leaveDialog()
npc:npc(tonumber(idnpc), 5)
hdv_full = true
for j, v in ipairs(items) do
if v.id ~= 0 then
cs = 0
for j = 1, sale:ItemsOnSale() do
if sale:GetItemGID(j) == v.id and sale:GetItemQuantity(j) == v.lot then cs = cs + 1 end
end
if cs < v.nb_sale and not v.oos and not v.pth then
global:printError("[Vente] Incomplet : " .. v.lot .. " x [" .. inventory:itemNameId(v.id) .. "].")
hdv_full = false
end
end
end
npc:leaveDialog()
ready_to_sell = false
if hdv_full then index = index + 1 end
map:changeMap(zaapi_banque)
end
function do_all(hdv)
if not ready_to_sell and not hdv_full then
return go_bank(hdv.items, hdv.name)
else
if map:onMap(hdv.mapid) then
return sell_items(hdv.items, hdv.idnpc)
else
map:changeMap(hdv.zaapi)
end
end
end
function go_sleep()
global:printMessage("[Info] Pause de : " .. time_pause .. " minutes avant la prochaine actualisation.")
global:delay(time_pause * 60000)
index = 1
end
function get_ready_to_start()
if map:onMap(mapid_out_banque) then
ready_to_start = true
return move()
elseif map:onMap(mapid_in_banque) then
ready_to_start = true
return map:door(tonumber(cellid_exit_bank))
else
ready_to_start = true
return map:changeMap(zaapi_banque)
end
end
function move()
if not ready_to_start then return get_ready_to_start() end
if index > 3 then go_sleep() end
if not Master_Chief[index].go_sell then
index = index + 1
return move()
end
return do_all(Master_Chief[index])
end
function bank()
send_error("[Erreur] Le retour en banque n'est pas sur 101%.")
end