Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ------- SOFT PRIVATED -------
- -- Do not use this code --
- ---------by levshx-----------
- local text = require("Text")
- local internet = require("Internet")
- local json = require("JSON")
- local fs = require("Filesystem")
- local bigLetters = require("bigLetters")
- local screen = require("Screen")
- local image = require("Image")
- local GUI = require("GUI")
- local system = require("System")
- local paths = require("Paths")
- local event = require("Event")
- chatEnabled = true
- local chatbox = component.get("chat_box")
- local meController = component.get("me_controller")
- local meInterface = component.get("me_interface")
- local glasses = component.get("openperipheral_bridge")
- chatbox.setName("L] §f[§aTrap§dХата§f")
- -- Тестовый полигон
- -- конец полигона
- function getCountOfItemME(name)
- local filter = {}
- filter["name"] = name
- local itemTable = meController.getItemsInNetwork(filter)
- if itemTable["n"] > 0 then
- return itemTable[1].size -- name, size, label
- else
- return 0
- end
- end
- function startAutocraftME(name, count)
- local fingerprint = {}
- local itemTable = meInterface.getAvailableItems()
- for i = 1, #itemTable do
- if itemTable[i].fingerprint.id == name then
- if itemTable[i].is_craftable then
- fingerprint = itemTable[i].fingerprint
- meInterface.requestCrafting(fingerprint, count, nil)
- chatbox.say("§3Автокрафт: §f"..name.." "..count.. " шт. запрос отправлен")
- break
- else
- chatbox.say("§fПредмет §3"..name.." §fнайден, но автокрафт отсутствует")
- end
- end
- if ((i==#itemTable) and (fingerprint=={})) then
- chatbox.say("§fПредмет §3"..name.." §fне найден, его автокрафт тоже")
- end
- end
- end
- event.interruptingEnabled = false
- local peopleChat = {
- levshx = true,
- bng = true,
- Ians = true,
- Sky_jump = true,
- ziabl = true,
- Sun40 = true,
- Dev1lroot = true
- }
- local currentScriptDirectory = fs.path(system.getCurrentScript())
- local version = 2
- local systemPassword = "девиллох"
- local peoples = fs.readTable(paths.user.applicationData.."TrapHata/Owners.txt")
- -- Fucking minecraft
- ---------------------------------------------------------------------------------
- -- workspace
- local workspace = GUI.workspace()
- workspace:addChild(GUI.panel(1, 1, workspace.width, workspace.height, 0x2D2D2D))
- -- Create horizontally oriented list
- local horizontalList = workspace:addChild(GUI.list(20, 2, workspace.width-40, 3, 2, 0, 0xE1E1E1, 0x4B4B4B, 0xE1E1E1, 0x4B4B4B, 0x696969, 0xFFFFFF, true))
- horizontalList:setDirection(GUI.DIRECTION_HORIZONTAL)
- horizontalList:setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP)
- horizontalList:addItem("Trap-Хата").onTouch = function()
- containerAbout.hidden = false
- containerPeoples.hidden = true
- containerResources.hidden = true
- containerSystem.hidden = true
- workspace:draw()
- end
- horizontalList:addItem("Ресурсы").onTouch = function()
- containerAbout.hidden = true
- containerPeoples.hidden = true
- containerResources.hidden = false
- containerSystem.hidden = true
- workspace:draw()
- end
- horizontalList:addItem("Общество").onTouch = function()
- containerAbout.hidden = true
- containerPeoples.hidden = false
- containerResources.hidden = true
- containerSystem.hidden = true
- workspace:draw()
- end
- horizontalList:addItem("Система").onTouch = function()
- containerAbout.hidden = true
- containerPeoples.hidden = true
- containerResources.hidden = true
- containerSystem.hidden = false
- workspace:draw()
- end
- --------------------------------------------------------------------------------
- -- about TRAP HATA
- -- container with information about TRAP HATA
- containerAbout = workspace:addChild(GUI.container(1, 7, workspace.width-2, workspace.height-9))
- containerAbout:addChild(GUI.panel(1, 1, workspace.width, workspace.height, 0x2D2D2D))
- containerAbout:addChild(GUI.image(24, 2, image.load(currentScriptDirectory.."Icons/banner.pic")))
- containerAbout:addChild(GUI.text(34, 20, 0xFFFFFF, "Версия TrapХата: "..version))
- containerAbout:addChild(GUI.text(34, 22, 0xFFFFFF, "ЧатБот: "))
- aw
- local switchChatBot = containerAbout:addChild(GUI.switch(45, 22, 8, 0x66DB80, 0x1D1D1D, 0xEEEEEE, true))
- --------------------------------------------------------------------------------
- -- Resources
- containerResources = workspace:addChild(GUI.container(15, 7, workspace.width-30, workspace.height-9))
- containerResources:addChild(GUI.panel(1, 1, workspace.width, workspace.height, 0x2D2D2D))
- containerResources:addChild(GUI.image(25, 1, image.load(currentScriptDirectory.."Icons/MainResources.pic")))
- local IngotCount = containerResources:addChild(GUI.text(48, 4, 0xFFFFFF, "Железо: "..getCountOfItemME("minecraft:iron_ingot")))
- local MatterCount = containerResources:addChild(GUI.text(48, 14, 0xFFFFFF, "Материя: "..getCountOfItemME("dwcity:Materia")))
- containerResources:addChild(GUI.text(25, 20, 0xFFFFFF, "Список ресурсов МЭ синхронизирован"))
- containerResources:addChild(GUI.text(25, 21, 0xFFFFFF, "с логгером и сервером"))
- -- тут ещё дохуя дел так-то по факту разобраться в МЭ API ёбаном
- --------------------------------------------------------------------------------
- -- Peoples
- containerPeoples = workspace:addChild(GUI.container(15, 7, workspace.width-30, workspace.height-9))
- containerPeoples:addChild(GUI.panel(1, 1, workspace.width, workspace.height, 0x0a00ff))
- -- Как сохранять и куда сохранять списки Людей и что это даёт и для чего))
- --------------------------------------------------------------------------------
- -- System
- containerSystem = workspace:addChild(GUI.container(15, 7, workspace.width-30, workspace.height-9))
- containerSystem:addChild(GUI.panel(1, 1, workspace.width, workspace.height, 0xff00ff))
- containerResources.hidden = true
- containerPeoples.hidden = true
- containerSystem.hidden = true
- --системная хуита типа закрыть приложение и всё такое, чтобы не ибать мозгу
- local statHandler = event.addHandler(function()
- -- Do someting every 10
- local result, reason = internet.request("https://levshx.000webhostapp.com/loader.php?option=stat")
- if (result and result~="") then
- result = json.decode(result)
- if result.request == "good" then
- if result.msgs > 0 then
- local resultMSG, reasonMSG = internet.request("https://levshx.000webhostapp.com/loader.php?option=getMSG")
- if (resultMSG and resultMSG~="") then
- resultMSG = json.decode(resultMSG)
- chatbox.say("§b"..resultMSG.nick..": §f"..resultMSG.msg)
- end
- end
- if result.autocraft > 0 then
- local resultAutocraft, reasonAutocraft = internet.request("https://levshx.000webhostapp.com/loader.php?option=getAutocraft")
- if (resultAutocraft and resultAutocraft~="") then
- resultAutocraft = json.decode(resultAutocraft)
- startAutocraftME(resultAutocraft.item, resultAutocraft.count)
- end
- end
- -- mds 3d
- else
- chatbox.say("§bFUCK§c > §aInternet")
- end
- else
- chatbox.say("§bFUCK§c > §aInternet")
- end
- end, 10)
- local chatBotHandler = event.addHandler(function(e1, e2, e3, e4) --e2=uuid, e3=senderNick, e4=msg
- if e1 == "chat_message" then
- if peopleChat[e3]==true and switchChatBot.state==true then -- проверка на наличие в таблице чата
- -- Do someting every Return key press
- msgBot = {
- ["ask"] = internet.encode(e4),
- ["userid"] = text.limit(e3.."1234", 12, "right"),
- ["key"] = ""
- }
- local result, reason = internet.request("https://aiproject.ru/api/", "query="..json.encode(msgBot))
- if (result and result~="") then
- result = json.decode(result)
- if result.aiml then
- chatbox.setName("L] §f[§aTrap§dХата §bБот§f")
- chatbox.say("§f"..result.aiml)
- chatbox.setName("L] §f[§aTrap§dХата§f")
- end
- end
- end
- end
- end)
- local resourceHandler = event.addHandler(function()
- IngotCount.text = "Железо: "..getCountOfItemME("minecraft:iron_ingot")
- MatterCount.text = "Материя: "..getCountOfItemME("dwcity:Materia")
- workspace:draw()
- end, 10)
- local function time()
- local f = fs.open("/Temporary/TF","w")
- f:write("test")
- f:close()
- return(fs.lastModified("/Temporary/TF"))
- end
- local glassesHandler = event.addHandler(function()
- glasses.clear()
- glasses.addBox(4,23 , 100 , 250, 0x000000,0.3)
- glasses.addText(5,25,"§aTrap§dХата §fProject")
- glasses.addText(5,36,"§aInfoPanel")
- glasses.sync()
- end, 10)
- ------------------------------------------------
- -- Draw changes on screen after customizing your window
- workspace:draw()
- workspace:start()
Add Comment
Please, Sign In to add comment