Advertisement
FoxWorn3365

Gauugle - Client [ Responsive ]

Oct 28th, 2021 (edited)
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.55 KB | None | 0 0
  1. term.setBackgroundColor(colors.white)
  2. term.clear()
  3.  
  4. -- Sistemo le funzioni per tutto
  5. function header(text, color)
  6. term.setBackgroundColor(colors[color])
  7. term.setTextColor(colors.white)
  8. term.setCursorPos(1, 1)
  9. print(text)
  10. end
  11.  
  12. function button(x, y, text, color, bkcolor)
  13. term.setBackgroundColor(colors[bkcolor])
  14. term.setTextColor(colors[color])
  15. term.setCursorPos(x, y)
  16. print(text)
  17. end
  18.  
  19. function giremu(inputstr, sep)
  20. if sep == nil then
  21. sep = "%s"
  22. end
  23. local t={}
  24. for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
  25. table.insert(t, str)
  26. end
  27. return t
  28. end
  29.  
  30. function update(url)
  31. shell.run("rm startup")
  32. shell.run("pastebin get "..url.." startup")
  33. shell.run("reboot")
  34. end
  35.  
  36. function bkText(text, col, bkcol)
  37. term.setBackgroundColor(colors[bkcol])
  38. term.setTextColor(colors[col])
  39. print(text)
  40. end
  41.  
  42. function text(text, color)
  43. term.setBackgroundColor(colors.white)
  44. term.setTextColor(colors[color])
  45. print(text)
  46. end
  47.  
  48. function textNoCC(text, color)
  49. term.setTextColor(colors[color])
  50. print(text)
  51. end
  52.  
  53. function n(col)
  54. term.setBackgroundColor(colors.white)
  55. term.setTextColor(colors[col])
  56. end
  57.  
  58. function downstream()
  59. local startTime = os.clock()
  60. rednet.send(modem, "search()server.speedtest.net")
  61. local ip, msg, ptrc = rednet.receive(6)
  62. local endTime = os.clock()
  63. local difference = endTime - startTime
  64. local ra = 1 / difference
  65. local res = ra * 1000
  66. return res
  67. end
  68.  
  69. function popupPos(aa)
  70. term.setCursorPos(5, aa)
  71. end
  72.  
  73. function popup(text, text1, text2, text3, text4, text5) --TEXT = MAX 15 - MM = MAX 15
  74. drawFilledBox(5, 2, 27, 9, colours.grey)
  75. term.setTextColor(colors.white)
  76. term.setCursorPos(5, 2)
  77. print("|---------------------|")
  78. term.setCursorPos(5, 3)
  79. print(text)
  80. popupPos(4)
  81. print(text1)
  82. popupPos(5)
  83. print(text2)
  84. popupPos(6)
  85. print(text3)
  86. popupPos(7)
  87. print(text4)
  88. popupPos(8)
  89. print(text5)
  90. term.setCursorPos(5, 9)
  91. print("|---------------------|")
  92. end
  93.  
  94. local function drawPixelInternal(xPos, yPos)
  95. term.setCursorPos(xPos, yPos)
  96. term.write(" ")
  97. end
  98.  
  99. local tColourLookup = {}
  100. for n = 1, 16 do
  101. tColourLookup[string.byte("0123456789abcdef", n, n)] = 2 ^ (n - 1)
  102. end
  103.  
  104. function drawFilledBox(startX, startY, endX, endY, nColour)
  105. if type(startX) ~= "number" or type(startX) ~= "number" or type(endX) ~=
  106. "number" or type(endY) ~= "number" or
  107. (nColour ~= nil and type(nColour) ~= "number") then
  108. error("Expected startX, startY, endX, endY, colour", 2)
  109. end
  110.  
  111. startX = math.floor(startX)
  112. startY = math.floor(startY)
  113. endX = math.floor(endX)
  114. endY = math.floor(endY)
  115.  
  116. if nColour then term.setBackgroundColor(nColour) end
  117. if startX == endX and startY == endY then
  118. drawPixelInternal(startX, startY)
  119. return
  120. end
  121.  
  122. local minX = math.min(startX, endX)
  123. if minX == startX then
  124. minY = startY
  125. maxX = endX
  126. maxY = endY
  127. else
  128. minY = endY
  129. maxX = startX
  130. maxY = startY
  131. end
  132.  
  133. for x = minX, maxX do for y = minY, maxY do drawPixelInternal(x, y) end end
  134. end
  135.  
  136. if fs.exists(".settings") == false then
  137. v = 5
  138. else
  139. shell.run(".settings")
  140. v = 0
  141. rednet.open(side)
  142. end
  143.  
  144. while true do
  145. if v == 0 then
  146. term.setBackgroundColor(colors.white)
  147. term.clear()
  148. header(" GAUGLE [INFO]", "blue")
  149.  
  150. text("\n\nBenvenuto su GAUGLE!\nIn questo browser potrai cercare roba bella!", "black")
  151. button(15, 7, " CERCA QUALCOSA ", "white", "green")
  152. button(15, 9, " AGGIORNA GAUGLE ", "white", "orange")
  153. button(15, 11, " IMPOSTAZIONI ", "white", "orange")
  154. button(15, 13, " APPLICAZIONI ", "white", "orange")
  155.  
  156. local event, tasto, x, y = os.pullEvent("mouse_click")
  157. if y == 7 and x > 15 and x < 33 then
  158. v = 1
  159. elseif y == 9 and x > 15 and x < 33 then
  160. v = 100
  161. elseif y == 1 and x > 45 then
  162. v = 3
  163. elseif y == 11 and x > 14 and x < 33 then
  164. v = 49
  165. elseif y == 13 and x > 14 and x < 33 then
  166. v = 550
  167. else
  168. shell.run("startup")
  169. end
  170. elseif v == 1 then
  171. term.setBackgroundColor(colors.white)
  172. term.clear()
  173. header(" GAUGLE ", "blue")
  174. term.setCursorPos(10, 6)
  175. text("Vai al sito:", "black")
  176. term.setCursorPos(10, 7)
  177. url = read()
  178. if url == "gaugle://info" then
  179. v = 3
  180. elseif url == "gaugle://mail?rtoken=rednet_TEXT_833jdjdu_B" then
  181. v = 10
  182. elseif url == "gaugle://dev" then
  183. v = 200
  184. elseif url == "gaugle://form" then
  185. v = 195
  186. else
  187. v = 2
  188. end
  189. elseif v == 2 then
  190. term.clear()
  191.  
  192.  
  193. rednet.send(modem, "search()"..url)
  194. local ip, msg, ptrc = rednet.receive(3)
  195. msgcp = msg
  196.  
  197.  
  198. if msg == nil then
  199. term.setBackgroundColor(colors.white)
  200. term.clear()
  201. header("[HOME] GAUGLE [RESEARCH]", "blue")
  202. text("http://"..url, "gray")
  203. text("\nERRORE 404 - Pagina non trovata", "red")
  204. elseif string.find(msg, "isResponsive") ~= nil then
  205. resp = giremu(msgcp, "$")
  206. bkcolorNow = tostring(resp[3])
  207. term.setBackgroundColor(colors[bkcolorNow])
  208. term.clear()
  209. header("[HOME] GAUGLE [RESEARCH]", "blue")
  210. drawFilledBox(1, 2, 51, 2, colours.white)
  211. term.setCursorPos(1, 2)
  212. text("http://"..url, "gray")
  213. term.setBackgroundColor(colors[bkcolorNow])
  214. textNoCC("\n"..resp[4], resp[2])
  215. else
  216. term.setBackgroundColor(colors.white)
  217. term.clear()
  218. header("[HOME] GAUGLE [RESEARCH]", "blue")
  219. text("http://"..url, "gray")
  220. term.setBackgroundColor(colors.white)
  221. text("\n"..msgcp, "black")
  222. end
  223. local event, button, x, y = os.pullEvent("mouse_click")
  224. if y == 1 and x < 7 then
  225. v = 0
  226. elseif y == 1 and x > 43 then
  227. drawFilledBox(8, 2, 40, 2, colours.white)
  228. term.setCursorPos(8, 2)
  229. term.setTextColor(colors.gray)
  230. url = read()
  231. v = 2
  232. elseif y == 2 then
  233. drawFilledBox(8, 2, 40, 2, colours.white)
  234. term.setCursorPos(8, 2)
  235. term.setTextColor(colors.gray)
  236. url = read()
  237. v = 2
  238. end
  239. elseif v == 3 then
  240. term.setBackgroundColor(colors.white)
  241. term.clear()
  242. header("[HOME] GAUGLE ", "blue")
  243. text("gaugle://info", "gray")
  244. text("\n\nGAUUUGLE!\n\nMade by: FoxWorn3365\nVersion: v2.0 FINALLY!\nType: Responsive (UP-TO-DATE) GOOD!\n\nConfiguration Information:\nType: WIRELESS_2.0\nModem IP: 144.91.97."..modem.."\nModem side: "..side, "black")
  245. local event, button, x, y = os.pullEvent("mouse_click")
  246. if y == 1 and x < 10 then
  247. v = 0
  248. end
  249. elseif v == 5 then
  250. term.setBackgroundColor(colors.white)
  251. term.clear()
  252. header("[INST] GAUGLE ", "blue")
  253. text("\n\nInstallazione di GAUGLE", "black")
  254. text("\nInserisci l'ID del Modem WIFI:", "black")
  255. local mdwifi = read()
  256. text("\n\nPerfetto, ora inserisci il lato dove e' presente il wm:", "black")
  257. local mdside = read()
  258. local f = fs.open(".settings", "w")
  259. f.writeLine("modem = "..mdwifi)
  260. f.writeLine("side = '"..mdside.."'")
  261. f.close()
  262. -- Confermo la creazione
  263. shell.run("startup")
  264. elseif v == 10 then
  265. term.setBackgroundColor(colors.white)
  266. term.clear()
  267. header("[HOME] GAUGLE [ MAIL ]", "blue")
  268. text("gaugle://mail", "gray")
  269. text("\nBenvenuto nella casella MAIL di GAUGLE!", "black")
  270. button(15, 6, " INVIA UNA EMAIL ", "white", "blue")
  271. button(15, 8, " LE TUE EMAIL ", "white", "blue")
  272. local event, button, x, y = os.pullEvent("mouse_click")
  273. if y == 6 and x > 15 and x < 32 then
  274. v = 15
  275. elseif y == 8 and x > 15 and x < 32 then
  276. v = 12
  277. elseif y == 1 and x < 7 then
  278. v = 0
  279. end
  280. elseif v == 15 then
  281. term.setBackgroundColor(colors.white)
  282. term.clear()
  283. header("[HOME] GAUGLE [ MAIL ]", "blue")
  284. text("gaugle://mail#send", "gray")
  285. text("\n\nInvia un'email!", "black")
  286. text("\n\nInserisci il destinatario:", "blue")
  287. term.setCursorPos(3, 9)
  288. print("@mail.com")
  289. term.setCursorPos(1, 9)
  290. to = read()
  291. print(to)
  292. text("\n\nInserisci il Messaggio:", "blue")
  293. mam = read()
  294. print(mam)
  295. text("Inviato "..mam.." a "..to.."@mail.com", "green")
  296. rednet.send(to, mam)
  297. os.pullEvent("mouse_click")
  298. v = 10
  299. elseif v == 49 then
  300. term.setBackgroundColor(colors.white)
  301. term.clear()
  302. header("[HOME] GAUGLE [Impostazioni]", "blue")
  303. text("gaugle://settings", "gray")
  304. text("\n\nImpostazioni di Gauugle:", "black")
  305. button(15, 8, " Impostazioni di Rete ", "white", "orange")
  306. button(15, 10, " Impostazioni Firewall ", "white", "orange")
  307. button(15, 12, " Centro Assistenza ", "white", "red")
  308. local event, bt, x, y = os.pullEvent("mouse_click")
  309. if y == 8 then
  310. v = 5
  311. elseif y == 10 then
  312. v = 51
  313. elseif y == 1 then
  314. v = 0
  315. end
  316. elseif v == 50 then
  317. term.setBackgroundColor(colors.white)
  318. term.clear()
  319. header("[HOME] GAUGLE [FireWall]", "blue")
  320. text("gaugle://firewallManager", "gray")
  321. text("\nImpostazioni dei FireWall:", "black")
  322. rednet.send(modem, "firewall()sus")
  323. ma = {}
  324. lo, msg, ptrc = rednet.receive(5)
  325. if msg == nil then
  326. print("Al momento non ci sono porte aperte...")
  327. else
  328. open = textutils.unserialize(msg)
  329. nan = 1
  330. for v, d in pairs(open) do
  331. ma[nan] = {d, "ATTIVA"}
  332. print("> Porta: "..d.." | Status: APERTA\n")
  333. local x, y = term.getCursorPos()
  334. button(x + 35, y - 2, " CHIUDI ", "white", "red")
  335. term.setBackgroundColor(colors.white)
  336. term.setTextColor(colors.black)
  337. nan = nan + 1
  338. sleep(0.1)
  339. end
  340. end
  341. local event, t, x, y = os.pullEvent("mouse_click")
  342. if y == 1 then
  343. v = 0
  344. elseif y > 4 and y <= nan + 4 then
  345. doa = ma[y - 4]
  346. rednet.send(modem, "remove()"..doa[1])
  347. v = 51
  348. end
  349. elseif v == 51 then
  350. term.setBackgroundColor(colors.white)
  351. term.clear()
  352. header("[HOME] GAUGLE [FireWall]", "blue")
  353. text("gaugle://firewall", "gray")
  354. text("\nGestisci i FireWall", "black")
  355. button(15, 6, " Visualizza le Porte Aperte ", "white", "orange")
  356. button(15, 8, " Apri una Nuova Porta ", "white", "orange")
  357. local event, t, x, y = os.pullEvent("mouse_click")
  358. if y == 6 then
  359. v = 50
  360. elseif y == 8 then
  361. v = 52
  362. elseif y == 1 then
  363. v = 0
  364. end
  365. elseif v == 52 then
  366. term.setBackgroundColor(colors.white)
  367. term.clear()
  368. header("[HOME] GAUGLE [FireWall]", "blue")
  369. text("gaugle://firewallOpenDoor", "gray")
  370. text("\nApri una porta dal Firewall", "black")
  371. text("\n\n\nInserisci la porta da aprire (01 - 128)", "black")
  372. porta = read()
  373. if tonumber(porta) > 128 then
  374. text("NUMERO TROPPO GRANDE! MASSIMO 128!", "red")
  375. sleep(2)
  376. v = 52
  377. else
  378. rednet.send(modem, "add()"..porta)
  379. v = 51
  380. end
  381. elseif v == 100 then
  382. term.setBackgroundColor(colors.white)
  383. term.clear()
  384. header("[HOME] GAUGLE [ Update ]", "blue")
  385. text("gaugle://update", "gray")
  386. text("\nScegli una versione di gaugle:", "black")
  387. button(10, 7, " GAUGLE! Default ", "white", "orange")
  388. button(10, 9, " GAUGLE! ResponsiveTM ", "white", "yellow")
  389. button(10, 11, " GAUGLE! Legacy (No Gaugle Modem) ", "white", "yellow")
  390. button(10, 13, " GAUGLE! Plug-in UP! ", "white", "red")
  391. local event, bt, x, y = os.pullEvent("mouse_click")
  392. if y == 7 then
  393. update("Q9eXCRxV")
  394. elseif y == 9 then
  395. update("9unTEcAt")
  396. elseif y == 11 then
  397. update(" NO sus")
  398. elseif y == 13 then
  399. update(" quite susu")
  400. elseif y == 1 then
  401. v = 0
  402. end
  403. elseif v == 200 then
  404. term.setBackgroundColor(colors.white)
  405. term.clear()
  406. header("[HOME] GAUGLE [ Dev ]", "blue")
  407. text("gaugle://dev", "gray")
  408. text("\nDevelopers Place - Gaugle", "black")
  409. button(10, 6, " Controlla se la pagina e' ResponsiveTM ", "white", "orange")
  410. button(10, 8, " Pinga un sito web ", "white", "orange")
  411. button(10, 10, " Esegui uno Speedtest ", "white", "orange")
  412. local event, ktasto, x, y = os.pullEvent("mouse_click")
  413. if y == 1 then
  414. v = 0
  415. elseif y == 6 then
  416. v = 201
  417. elseif y == 8 then
  418. v = 202
  419. elseif y == 10 then
  420. v = 203
  421. end
  422. elseif v == 201 then
  423. term.setBackgroundColor(colors.white)
  424. term.clear()
  425. header("[HOME] GAUGLE [ Dev ]", "blue")
  426. text("gaugle://dev/isResponsive", "gray")
  427. text("\nDevelopers Place - Gaugle", "black")
  428. text("\n\nControlla se una pagina e' responsive", "black")
  429. text("\n\nInserisci il link: (Ci vorranno circa 10s)", "black")
  430. text("http://", "black")
  431. term.setCursorPos(8, 11)
  432. pageIS = read()
  433. -- Check if the page is responsive
  434. rednet.send(modem, "search()"..pageIS)
  435. local ip, msg, ptrc = rednet.receive(10)
  436. if string.find(msg, "isResponsive") ~= nil then
  437. text("\n\nLa pagina e' responsive (RES_v1.0)", "green")
  438. else
  439. text("\n\nLa pagina NON E' responsive", "red")
  440. end
  441. text("Clicca sullo schermo per continuare", "orange")
  442. os.pullEvent("mouse_click")
  443. elseif v == 202 then
  444. term.setBackgroundColor(colors.white)
  445. term.clear()
  446. header("[HOME] GAUGLE [ Dev ]", "blue")
  447. text("gaugle://dev/pingWebsite", "gray")
  448. text("\nDevelopers Place - Gaugle", "black")
  449. text("\n\nPinga un sito web", "black")
  450. text("\n\nInserisci il link: (Ci vorranno circa 5s max)", "black")
  451. text("http://", "black")
  452. term.setCursorPos(8, 11)
  453. pageIS = read()
  454. local startTime = os.clock()
  455. rednet.send(modem, "search()"..pageIS)
  456. local ip, msg, ptrc = rednet.receive(6)
  457. local endTime = os.clock()
  458. local difference = endTime - startTime
  459. text("\n\nEcco i risultati del ping effettuato al sito web:\nhttp://"..pageIS.."\nPing: "..difference.."s", "green")
  460. text("\n\nClicca sullo schermo per procedere", "orange")
  461. os.pullEvent("mouse_click")
  462. elseif v == 203 then
  463. term.setBackgroundColor(colors.black)
  464. term.clear()
  465. header("[HOME] GAUGLE [ Dev ]", "blue")
  466. drawFilledBox(1, 2, 51, 2, colours.white)
  467. term.setCursorPos(1, 2)
  468. text("gaugle://dev/speedtest", "gray")
  469. term.setBackgroundColor(colors.black)
  470. textNoCC("\nDevelopers Place - Gaugle", "white")
  471. textNoCC("\n\nSpeedtest by Ookla", "white")
  472. textNoCC("\n\n CLICCA SULLO SCHERMO PER INIZIARE!", "white")
  473. os.pullEvent("mouse_click")
  474. textNoCC("Connessione in corso a server.speedtest.net.....\nServer localizzato a Neihemiah, connesso!", "white")
  475. textNoCC("[1 / 4] "..downstream().."Mbps", "lime")
  476. sleep(1)
  477. textNoCC("[2 / 4] "..downstream().."Mbps", "lime")
  478. sleep(1)
  479. textNoCC("[3 / 4] "..downstream().."Mbps", "lime")
  480. sleep(1)
  481. textNoCC("[4 / 4] "..downstream().."Mbps", "lime")
  482. sleep(1)
  483. textNoCC("TEST FINITO! TOCCA LO SCHERMO PER PROCEDERE!", "orange")
  484. os.pullEvent("mouse_click")
  485. elseif v == 195 then
  486. term.setBackgroundColor(colors.white)
  487. term.clear()
  488. header("[HOME] GAUGLE [ Dev ]", "blue")
  489. text("gaugle://formSend", "gray")
  490. text("\nInvia un form a uno specifico sito web:\n\nInserisci il sito web:", "black")
  491. text("http://", "black")
  492. term.setCursorPos(8, 7)
  493. webIS = read()
  494. text("\nOra inserisci il testo da inviare:", "black")
  495. formIS = read()
  496. rednet.send(modem, "search()"..webIS.."$"..formIS)
  497. text("\nFORM INVIATO!\nClicca sullo schermo per tornare alla home", "orange")
  498. local ip, msg, ptrc = rednet.receive(3)
  499. term.setBackgroundColor(colors.white)
  500. term.clear()
  501. header("[HOME] GAUGLE [RESEARCH]", "blue")
  502. text("http://"..webIS, "gray")
  503. term.setBackgroundColor(colors.white)
  504. text("\n"..msg, "black")
  505. os.pullEvent("mouse_click")
  506. v = 0
  507. elseif v == 550 then
  508. term.setBackgroundColor(colors.white)
  509. term.clear()
  510. header("[HOME] GAUGLE [ App ]", "blue")
  511. text("gaugle://app/listAll", "gray")
  512. text("\nApplicazioni Installate", "black")
  513. button(10, 7, " Games ", "white", "orange")
  514. button(10, 9, " Developers ", "white", "orange")
  515. button(10, 11, " Messanger ", "white", "orange")
  516. local event, bt, x, y = os.pullEvent("mouse_click")
  517. if y == 1 then
  518. v = 0
  519. elseif y == 7 then
  520. v = 500
  521. elseif y == 9 then
  522. v = 200
  523. elseif y == 11 then
  524. if fs.exists(".chat") then
  525. v = 701
  526. else
  527. v = 750
  528. end
  529. end
  530. elseif v == 500 then
  531. term.setBackgroundColor(colors.white)
  532. term.clear()
  533. header("[HOME] GAUGLE [ Games ]", "blue")
  534. text("gaugle://games", "gray")
  535. text("\nGiochi di Gaugle! ONLINE!", "black")
  536. text("\nLista dei giochi: http://games.gaugle.com/list", "black")
  537. text("\n\nInserisci il server di gioco:", "black")
  538. text("http://", "black")
  539. term.setCursorPos(8, 10)
  540. games = read()
  541. local startTime = os.clock()
  542. rednet.send(modem, "game()"..games)
  543. local endTime = os.clock()
  544. local e, msg, p = rednet.receive(4)
  545. if msg == nil or msg == "sussy baka" then
  546. text("Il server di gioco non risponde!\nClicca sullo schermo per riprovare!", "red")
  547. os.pullEvent("mouse_click")
  548. v = 0
  549. else
  550. text("Connesso con successo al server di gioco!\nPing: "..startTime - endTime.."s", "green")
  551. text("Clicca sullo schermo per procedere!", "lime")
  552. os.pullEvent("mouse_click")
  553. v = 501
  554. end
  555. elseif v == 501 then
  556. term.setBackgroundColor(colors.white)
  557. term.clear()
  558. header("[HOME] GAUGLE [ Games ]", "blue")
  559. text("gaugle://games/launchGame", "gray")
  560. text("\nGiochi di Gaugle! ONLINE!", "black")
  561. if string.find(games, "x&o") ~= nil then
  562. gName = "Tris"
  563. gPage = 510
  564. else
  565. gName = "Yes or No"
  566. gPage = 520
  567. end
  568. text("\n\nStiamo avviando il gioco "..gName.."....", "orange")
  569. text(textutils.slowPrint("###############"), "red")
  570. rednet.send(modem, "game()"..games.."/user")
  571. local res, mer, sus = rednet.receive(3)
  572. tex = giremu(mer, "&")
  573. for a, ms in pairs(tex) do
  574. write(" "..ms.." |")
  575. end
  576. text("\n\nFatto! Scegli tra uno degli username elencati sopra!", "black")
  577. user = read()
  578. rednet.send(modem, "game()"..games.."/check$"..user)
  579. local hs, msg, sus = rednet.receive(3)
  580. if msg == "NO" then
  581. text("IL TUO USERNAME NON E' VALIDO!\nClicca sullo schermo", "red")
  582. os.pullEvent("mouse_click")
  583. v = 550
  584. else
  585. text("\n\nOk, benvenuto "..user.." in questa partita!\n\nClicca sullo schermo per partire!", "black")
  586. os.pullEvent("mouse_click")
  587. rednet.send(modem, "game()"..games.."/new$"..user)
  588. rednet.receive(5)
  589. v = gPage
  590. end
  591. elseif v == 510 then
  592. term.setBackgroundColor(colors.white)
  593. term.clear()
  594. header("[HOME] GAUGLE [ Games ]", "blue")
  595. text("gaugle://games/playGame/"..gName, "gray")
  596. sleep(0.2)
  597. rednet.send(modem, "game()"..games.."/pick")
  598. aa, ms, sus = rednet.receive(10)
  599.  
  600. if ms == nil then
  601. text("Il server di gioco da te scelto non risponde piu'!\nClicca sullo schermo per continuare", "red")
  602. else
  603. grid = giremu(ms, "$")
  604. if grid[1] ~= "isGrid" then
  605. print("La richiesta ricevuta e' errata, pertanto siete gentilmente pregati di aspettare il prossimo refresh (3.5sec)")
  606. sleep(3)
  607. else
  608. turn = grid[2]
  609. print("\n"..grid[3].."|"..grid[4].."|"..grid[5].."\n-|-|-\n"..grid[6].."|"..grid[7].."|"..grid[8].."\n-|-|-\n"..grid[9].."|"..grid[10].."|"..grid[11])
  610. term.setCursorPos(30, 6)
  611. text("[ FERMA ]", "red")
  612. if turn == user then
  613. text("\n\n\nNON E' IL TUO TURNO, ASPETTA!", "red")
  614. sleep(3.5)
  615. else
  616. text("\n\n\nE' IL TUO TURNO, ESEGUI LA MOSSA!", "green")
  617. local event, ms, x, y = os.pullEvent("mouse_click")
  618. if y == 4 and x == 1 then
  619. rednet.send(modem, "game()"..games.."/update$"..user.."$s1")
  620. sleep(2)
  621. elseif y == 4 and x == 3 then
  622. rednet.send(modem, "game()"..games.."/update$"..user.."$s2")
  623. sleep(2)
  624. elseif y == 4 and x == 5 then
  625. rednet.send(modem, "game()"..games.."/update$"..user.."$s3")
  626. sleep(2)
  627. elseif y == 6 and x == 1 then
  628. rednet.send(modem, "game()"..games.."/update$"..user.."$s4")
  629. sleep(2)
  630. elseif y == 6 and x == 3 then
  631. rednet.send(modem, "game()"..games.."/update$"..user.."$s5")
  632. sleep(2)
  633. elseif y == 6 and x == 5 then
  634. rednet.send(modem, "game()"..games.."/update$"..user.."$s6")
  635. sleep(2)
  636. elseif y == 8 and x == 1 then
  637. rednet.send(modem, "game()"..games.."/update$"..user.."$s7")
  638. sleep(2)
  639. elseif y == 8 and x == 3 then
  640. rednet.send(modem, "game()"..games.."/update$"..user.."$s8")
  641. sleep(2)
  642. elseif y == 8 and x == 5 then
  643. rednet.send(modem, "game()"..games.."/update$"..user.."$s9")
  644. sleep(2)
  645. elseif y == 6 and x > 30 then
  646. rednet.send(modem, "game()"..games.."/stop")
  647. text("\n\nGIOCO FINITO!\nClicca un tasto qualsiasi per tornare alla home dei giochi", "green")
  648. os.pullEvent("mouse_click")
  649. v = 500
  650. end
  651. end
  652. end
  653. end
  654.  
  655.  
  656. elseif v == 710 then
  657. term.setBackgroundColor(colors.white)
  658. term.clear()
  659. header("[HOME] GAUGLE [ Chat ]", "blue")
  660. text("gaugle://games/chat/index", "gray")
  661. text("\n\nIstant Messanger - Iscrizione", "black")
  662. text("\nInserisci un username valido (NO SPAZI E $)", "black")
  663. userT = read()
  664. if userT == nil then
  665. text("\nATTENZIONE: Non hai inserito un username!", "red")
  666. os.pullEvent("mouse_click")
  667. v = 550
  668. else
  669. text("\nOk, ciao "..userT..", ora inserisci una password: (NO $)", "black")
  670. userP = read()
  671. if userP == nil then
  672. text("\nPASSWORD vuota, NON VALIDA!", "red")
  673. os.pullEvent("mouse_click")
  674. v = 550
  675. else
  676. text("\nOk, password valida! Clicca sullo schermo per inscriverti!", "lime")
  677. os.pullEvent("mouse_click")
  678. -- url$username$password
  679. rednet.send(modem, "chat()server.chat.gaugle.com/register$"..userT.."$"..userP)
  680. local x, mes, a = rednet.receive(10)
  681. if mes == nil then
  682. term.clear()
  683. term.setBackgroundColor(colors.white)
  684. header("[HOME] GAUGLE [ Chat ]", "blue")
  685. text("gaugle://games/chat/subscribe", "gray")
  686. text("\n\nATTENZIONE!\nProblemi:\n1) Non sei connesso ad internet - riavvia il modem\n2) La porta 70 e' bloccata dai firewall", "red")
  687. os.pullEvent("mouse_click")
  688. v = 510
  689. elseif mes == "NO" then
  690. term.clear()
  691. term.setBackgroundColor(colors.white)
  692. header("[HOME] GAUGLE [ Chat ]", "blue")
  693. text("gaugle://games/chat/subscribe", "gray")
  694. text("\n\nL'username che hai scelto ("..userT..") e' gia' stato preso!", "orange")
  695. os.pullEvent("mouse_click")
  696. v = 510
  697. else
  698. term.clear()
  699. term.setBackgroundColor(colors.white)
  700. header("[HOME] GAUGLE [ Chat ]", "blue")
  701. text("gaugle://games/chat/subscribe", "gray")
  702. text("\n\nOk, benvenuto "..userT.." nel servizio di chat online di Gaugle!\n\nClicca sullo schermo per procedere!", "black")
  703. os.pullEvent("mouse_click")
  704. v = 711
  705. end
  706. end
  707. end
  708. elseif v == 750 then
  709. term.setBackgroundColor(colors.white)
  710. term.clear()
  711. header("[HOME] GAUGLE [ Chat ]", "blue")
  712. text("gaugle://games/chat/helo", "gray")
  713. text("\n\nIstant Messanger - Hello!", "black")
  714. button(10, 7, " ACCEDI ", "white", "orange")
  715. button(10, 9, " REGISTRATI ", "white", "orange")
  716. local event, xus, x, y = os.pullEvent("mouse_click")
  717. if y == 1 then
  718. v = 0
  719. elseif y == 7 then
  720. v = 711
  721. elseif y == 9 then
  722. v = 710
  723. end
  724. elseif v == 711 then
  725. term.setBackgroundColor(colors.white)
  726. term.clear()
  727. header("[HOME] GAUGLE [ Chat ]", "blue")
  728. text("gaugle://games/chat/login", "gray")
  729. text("\n\nIstant Messanger - Login", "black")
  730. text("\n\n\nUsername:", "black")
  731. useLs = read()
  732. rednet.send(modem, "chat()server.chat.gaugle.com/checkUsername$"..useLs)
  733. local x, mes, so = rednet.receive(10)
  734. if mes ~= "SI" then
  735. text("L'UTENTE NON ESISTE!", "red")
  736. os.pullEvent("mouse_click")
  737. v = 550
  738. else
  739. text("\nOk, ora inserisci la password:", "black")
  740. usePl = read()
  741. -- url$username$password
  742. rednet.send(modem, "chat()server.chat.gaugle.com/login$"..useLs.."$"..usePl)
  743. local as, mes, os = rednet.receive(10)
  744. if mes ~= "SI" then
  745. text("Password ERRATA!", "red")
  746. os.pullEvent("mouse_click")
  747. v = 711
  748. else
  749. text("Sei stato loggato con successo nel tuo account Gaugle Messanger!", "lime")
  750. local h = fs.open(".chat", "w")
  751. h.write(useLs)
  752. h.flush()
  753. h.close()
  754. os.pullEvent("mouse_click")
  755. v = 701
  756. end
  757. end
  758. elseif v == 701 then
  759. -- Recupero l'username
  760. if fs.exists(".chat") == true then
  761. local h = fs.open(".chat", "r")
  762. userChat = h.readAll()
  763. h.close()
  764. else
  765. v = 750
  766. end
  767. term.setBackgroundColor(colors.white)
  768. term.clear()
  769. header("[HOME] GAUGLE [ Chat ]", "blue")
  770. text("gaugle://games/chat/dashboard/", "gray")
  771. text("\n\nIstant Messanger - Dashboard", "black")
  772. text("\nBenvenuto, "..userChat.." nel tuo account Gaugle Messanger!", "black")
  773. text("\n\n\nAccedi ad una conversazione!\nInserisci il nome dell'altro partecipante:", "black")
  774. otherU = read()
  775. text("Ok, sto cercando una chat di nome "..userChat.."&"..otherU, "green")
  776. -- url$chat&chat
  777. v = 702
  778. elseif v == 702 then
  779. term.setBackgroundColor(colors.white)
  780. term.clear()
  781. header("[HOME] GAUGLE [ Chat ]", "blue")
  782. text("gaugle://games/chat/wiewChat", "gray")
  783. text("\n\nIstant Messanger - Wiew Chat\nChat: "..userChat.."&"..otherU, "black")
  784. rednet.send(modem, "chat()server.chat.gaugle.com/get$"..userChat.."&"..otherU)
  785. ar, chata, sus = rednet.receive(5)
  786. text("\n"..chata, "black")
  787. text("\nScrivi un messaggio (scrivi r per ricaricare)", "black")
  788. messageSend = read()
  789. if messageSend ~= "r" then
  790. -- url$chat$message
  791. rednet.send(modem, "chat()server.chat.gaugle.com/sendMessage$"..userChat.."&"..otherU.."$"..messageSend)
  792. sleep(2.5)
  793. end
  794.  
  795. end
  796. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement