Перейти к содержимому

Лидеры


Популярный контент

Показан контент с высокой репутацией 06.06.2022 в Сообщения

  1. 1 балл
  2. 1 балл
    local computer = require("computer") local component = require("component") local unicode = require("unicode") function proxy(cT) local address = component.list(cT)() if address then return component.proxy(address) end end internet = proxy("internet") chat_box = proxy("chat_box") me_interface = proxy("me_interface") computer.addUser("addyourself_here") pcall(function () chat_box.setName("PC") end) function getITL() local handle, data, chunk = internet.request("ссылка на pastebin raw со списком крафта"), "" -- Строки-таблица вида "return {{}, {}, {}, и так далее}" while true do chunk = handle.read(math.huge) if chunk then data = data .. chunk else break end end return data end function sleep(timeout) local deadline = computer.uptime() + (timeout or math.huge) repeat computer.pullSignal(deadline - computer.uptime()) until computer.uptime() >= deadline end function execute(data, stdin, sandbox) local chunk, err = load(data, stdin, "t", sandbox and setmetatable({}, {__index = _G, __metatable = ""})) if not chunk and err then else local data = table.pack(xpcall(chunk, debug.traceback)) if data[1] then if data.n > 1 then return table.unpack(data, 2, data.n) end else end end end items = {} items = execute(getITL(), "items", true) pcall(function () chat_box.say("Cписок вещей для крафта загружен", 32) end) sleep(1) if items ~= nil then while true do local err, meTbl = pcall(me_interface.getAvailableItems,"none") for curINDEX = 1, #items do itemName = items[curINDEX]["itemName"] itemLabel = items[curINDEX]["itemLabel"] itemDamage = items[curINDEX]["itemDamage"] autoStockQty = items[curINDEX]["autoStockQty"] itemmaxSize = items[curINDEX]["itemmaxSize"] nbt_hash = items[curINDEX]["nbt_hash"] storedItemQty = 0 craftAmount = 0 for i = 1, #meTbl do if type(nbt_hash) == "string" then if meTbl[i]["fingerprint"].id == itemName and meTbl[i]["fingerprint"].dmg == itemDamage and meTbl[i]["fingerprint"].nbt_hash == nbt_hash and meTbl[i].size ~= nil then storedItemQty = meTbl[i].size goto CRAFT end elseif type(nbt_hash) ~= "string" then if meTbl[i]["fingerprint"].id == itemName and meTbl[i]["fingerprint"].dmg == itemDamage and meTbl[i]["fingerprint"].nbt_hash == nil and meTbl[i].size ~= nil then storedItemQty = meTbl[i].size goto CRAFT end end end ::CRAFT:: if storedItemQty < (autoStockQty == 0 and itemmaxSize or autoStockQty) then craftAmount = ((autoStockQty == 0 and itemmaxSize or autoStockQty) - storedItemQty) if craftAmount <= 0 then craftAmount = 0 break end -- pcall(function () chat_box.say(tostring(itemLabel .." в мэ хранится: "..storedItemQty.." заказываю количеством "..craftAmount), 2) end) local err, res = pcall(function () if type(nbt_hash) == "string" then me_interface.requestCrafting({id=itemName, dmg = itemDamage, nbt_hash = nbt_hash}, 0) else me_interface.requestCrafting({id=itemName, dmg = itemDamage}, craftAmount) end end) sleep(8) if err == false then chat_box.say(tostring(" Recipe404: " ..itemLabel), 5) sleep(0.1) end end end sleep(300) pcall(function () chat_box.say(tostring(" M-F: " ..tostring(math.floor(computer.freeMemory() / 1024))), 32) end) end else pcall(function () chat_box.say("TBL EMPTY", 20)end) end
Эта таблица лидеров рассчитана в Москва/GMT+03:00
×
×
  • Создать...