SHARE
TWEET

DreamMonitor

FeodorKekovich Feb 15th, 2017 (edited) 241 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local a=require('component')local b=require('term')local c=require('event')local d=require('computer')local e=require('unicode').len;local f=true;local g=a.gpu;local h,i=g.getResolution()local j,k=40,20;local l=6;local m=36;local n={gray=0x454545,main=0xff00ff,white=0xffffff,red=0xff0000,black=0x000000}local o={'Technocracy','Mageweave','Spacecross'}local p='http://dreamfinity.org/monAJAX/ajax.php'function getData()for q in require('internet').request(p)do local r=q:gsub('"',""):gsub(":","='"):gsub("'{","{"):gsub(",","',"):gsub("}'","'}"):gsub("}'}","'}"):gsub("\\u",""):gsub(" I","")local s=r:find('timerec')-1;local t=r:find('record')local u=r:sub(1,s)local v=r:sub(t):gsub("timerecday='",'timerecday="'):gsub("}",'"}}')local w=u..v;info=load('return '..w)()end end;function gui()g.setResolution(j,k)g.setForeground(n.gray)g.setBackground(n.black)b.clear()g.set(j-1,1,'x')g.set(2,k,'Суточный рекорд:')g.set(23,k,'Абсол. рекорд:')local x=1;for y=1,3 do g.set(1,x+1,'┌──────────────────────────────────────┐')g.set(1,x+2,'│                             пинг:    │')g.set(1,x+3,'│                                      │')g.set(1,x+4,'│                                      │')g.set(1,x+5,'│                                      │')g.set(1,x+6,'└──────────────────────────────────────┘')x=x+l end;g.setForeground(n.main)g.set(9,1,'Dreamfinity мониторинг:')local x=1;for y=1,3 do g.set(2,x+3,'┌────────────────────────────────────┐')g.set(2,x+4,'│                                    │')g.set(2,x+5,'└────────────────────────────────────┘')x=x+l end end;function check()getData()local z=info.servers.record;local A=info.servers.recordday;local x=1;for y=1,3 do local B=o[y]local C=info.servers[B].status;local D=info.servers[B].online;local E=info.servers[B].slots;local F=tonumber(info.servers[B].percent)local G=info.servers[B].ping;local H=math.floor(m*F/100)g.setForeground(n.main)g.set(3,x+2,B..':')if C=='online'then g.setForeground(n.main)g.set(e(B)+5,x+2,D..'/'..E..'     ')g.set(36,x+2,G..' ')g.fill(3,x+4,m,1,' ')if H<1 then H=1 end;if tonumber(D)>0 then g.fill(3,x+4,H,1,'/')end else g.setForeground(n.gray)g.set(e(B)+5,x+2,'offline    ')g.set(36,x+2,' X ')g.fill(3,x+4,m,1,' ')end;x=x+l end;g.setForeground(n.main)g.set(18,k,A..' ')g.set(37,k,z..' ')end;function clicker(I,I,J,K)if J==j-1 and K==1 then d.beep(1500)g.setForeground(n.red)g.set(j-1,1,'x')os.sleep(0.3)f=false end end;function run()c.listen('touch',clicker)gui()while f do g.setResolution(j,k)pcall(check)os.sleep(1)end;exit()end;function start()if g.getDepth()==1 then d.beep(1500)print('DreamMonitor: Ошибка! Монитор и видеокарта 1 тира не поддерживаются!')elseif not a.isAvailable('internet')then d.beep(1500)print('DreamMonitor: Ошибка! Интернет карта отсутствует!')else run()end end;function exit()c.ignore('touch',clicker)g.setForeground(n.white)b.clear()g.setResolution(h,i)end;function c.shouldInterrupt()return false end;start()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top