SHOW:
|
|
- or go back to the newest paste.
| 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 bkText(text, col, bkcol) | |
| 20 | term.setBackgroundColor(colors[bkcol]) | |
| 21 | term.setTextColor(colors[col]) | |
| 22 | print(text) | |
| 23 | end | |
| 24 | ||
| 25 | function text(text, color) | |
| 26 | term.setBackgroundColor(colors.white) | |
| 27 | term.setTextColor(colors[color]) | |
| 28 | print(text) | |
| 29 | end | |
| 30 | ||
| 31 | function n(col) | |
| 32 | term.setBackgroundColor(colors.white) | |
| 33 | term.setTextColor(colors[col]) | |
| 34 | end | |
| 35 | ||
| 36 | function popupPos(aa) | |
| 37 | term.setCursorPos(5, aa) | |
| 38 | end | |
| 39 | ||
| 40 | function popup(text, text1, text2, text3, text4, text5) --TEXT = MAX 15 - MM = MAX 15 | |
| 41 | drawFilledBox(5, 2, 27, 9, colours.grey) | |
| 42 | term.setTextColor(colors.white) | |
| 43 | term.setCursorPos(5, 2) | |
| 44 | print("|---------------------|")
| |
| 45 | term.setCursorPos(5, 3) | |
| 46 | print(text) | |
| 47 | popupPos(4) | |
| 48 | print(text1) | |
| 49 | popupPos(5) | |
| 50 | print(text2) | |
| 51 | popupPos(6) | |
| 52 | print(text3) | |
| 53 | popupPos(7) | |
| 54 | print(text4) | |
| 55 | popupPos(8) | |
| 56 | print(text5) | |
| 57 | term.setCursorPos(5, 9) | |
| 58 | print("|---------------------|")
| |
| 59 | end | |
| 60 | ||
| 61 | local function drawPixelInternal(xPos, yPos) | |
| 62 | term.setCursorPos(xPos, yPos) | |
| 63 | term.write(" ")
| |
| 64 | end | |
| 65 | ||
| 66 | local tColourLookup = {}
| |
| 67 | for n = 1, 16 do | |
| 68 | tColourLookup[string.byte("0123456789abcdef", n, n)] = 2 ^ (n - 1)
| |
| 69 | end | |
| 70 | ||
| 71 | function drawFilledBox(startX, startY, endX, endY, nColour) | |
| 72 | if type(startX) ~= "number" or type(startX) ~= "number" or type(endX) ~= | |
| 73 | "number" or type(endY) ~= "number" or | |
| 74 | (nColour ~= nil and type(nColour) ~= "number") then | |
| 75 | error("Expected startX, startY, endX, endY, colour", 2)
| |
| 76 | end | |
| 77 | ||
| 78 | startX = math.floor(startX) | |
| 79 | startY = math.floor(startY) | |
| 80 | endX = math.floor(endX) | |
| 81 | endY = math.floor(endY) | |
| 82 | ||
| 83 | if nColour then term.setBackgroundColor(nColour) end | |
| 84 | if startX == endX and startY == endY then | |
| 85 | drawPixelInternal(startX, startY) | |
| 86 | return | |
| 87 | end | |
| 88 | ||
| 89 | local minX = math.min(startX, endX) | |
| 90 | if minX == startX then | |
| 91 | minY = startY | |
| 92 | maxX = endX | |
| 93 | maxY = endY | |
| 94 | else | |
| 95 | minY = endY | |
| 96 | maxX = startX | |
| 97 | maxY = startY | |
| 98 | end | |
| 99 | ||
| 100 | for x = minX, maxX do for y = minY, maxY do drawPixelInternal(x, y) end end | |
| 101 | end | |
| 102 | ||
| 103 | if fs.exists("modem") == false then
| |
| 104 | v = 5 | |
| 105 | else | |
| 106 | file = fs.open("modem", "r")
| |
| 107 | modem = file.readAll() | |
| 108 | file.close() | |
| 109 | filea = fs.open("side", "r")
| |
| 110 | side = filea.readAll() | |
| 111 | filea.close() | |
| 112 | rednet.open(side) | |
| 113 | v = 0 | |
| 114 | end | |
| 115 | ||
| 116 | while true do | |
| 117 | if v == 0 then | |
| 118 | ||
| 119 | term.clear() | |
| 120 | header(" GAUGLE [INFO]", "blue")
| |
| 121 | ||
| 122 | text("\n\nBenvenuto su GAUGLE!\nIn questo browser potrai cercare roba bella!", "black")
| |
| 123 | button(15, 7, " CERCA QUALCOSA ", "white", "green") | |
| 124 | button(15, 9, " AGGIORNA GAUGLE ", "white", "orange") | |
| 125 | button(15, 11, " REIMPOSTA GAUGLE ", "white", "orange") | |
| 126 | ||
| 127 | local event, tasto, x, y = os.pullEvent("mouse_click")
| |
| 128 | if y == 7 and x > 15 and x < 33 then | |
| 129 | v = 1 | |
| 130 | elseif y == 9 and x > 15 and x < 33 then | |
| 131 | shell.run("rm startup")
| |
| 132 | shell.run("pastebin get 7Pdn3tqd startup")
| |
| 133 | shell.run("startup")
| |
| 134 | elseif y == 1 and x > 45 then | |
| 135 | v = 3 | |
| 136 | elseif y == 11 and x > 14 and x < 33 then | |
| 137 | v = 5 | |
| 138 | else | |
| 139 | shell.run("startup")
| |
| 140 | end | |
| 141 | elseif v == 1 then | |
| 142 | term.setBackgroundColor(colors.white) | |
| 143 | term.clear() | |
| 144 | header(" GAUGLE ", "blue")
| |
| 145 | term.setCursorPos(10, 6) | |
| 146 | text("Vai al sito:", "black")
| |
| 147 | term.setCursorPos(10, 7) | |
| 148 | url = read() | |
| 149 | if url == "gaugle://info" then | |
| 150 | v = 3 | |
| 151 | elseif url == "gaugle://mail?rtoken=rednet_TEXT_833jdjdu_B" then | |
| 152 | v = 10 | |
| 153 | else | |
| 154 | v = 2 | |
| 155 | end | |
| 156 | elseif v == 2 then | |
| 157 | term.clear() | |
| 158 | ||
| 159 | ||
| 160 | rednet.broadcast(url, "http") | |
| 161 | local ip, msg, ptrc = rednet.receive() | |
| 162 | ||
| 163 | ||
| 164 | if msg == "ERROR_404" then | |
| 165 | term.setBackgroundColor(colors.white) | |
| 166 | term.clear() | |
| 167 | header("[HOME] GAUGLE [RESEARCH]", "blue")
| |
| 168 | text("http://"..url, "gray")
| |
| 169 | text("\nERRORE 404 - Pagina non trovata", "red")
| |
| 170 | elseif msg == nil then | |
| 171 | term.setBackgroundColor(colors.white) | |
| 172 | term.clear() | |
| 173 | header("[HOME] GAUGLE [RESEARCH]", "blue")
| |
| 174 | text("http://"..url, "gray")
| |
| 175 | text("\nERRORE 500 - Il server ha impiegato troppo tempo a rispondere", "red")
| |
| 176 | else | |
| 177 | term.setBackgroundColor(colors.white) | |
| 178 | term.clear() | |
| 179 | header("[HOME] GAUGLE [RESEARCH]", "blue")
| |
| 180 | text("http://"..url, "gray")
| |
| 181 | text("\n"..msg, "black")
| |
| 182 | end | |
| 183 | local event, button, x, y = os.pullEvent("mouse_click")
| |
| 184 | if y == 1 and x < 7 then | |
| 185 | v = 0 | |
| 186 | elseif y == 1 and x > 43 then | |
| 187 | drawFilledBox(5, 7, 37, 10, colours.grey) | |
| 188 | term.setCursorPos(6, 8) | |
| 189 | bkText("Cerca qualcosa:", "white", "gray")
| |
| 190 | drawFilledBox(6, 9, 35, 9, colours.blue) | |
| 191 | term.setCursorPos(6, 9) | |
| 192 | url = read() | |
| 193 | if url == "gaugle://info" then | |
| 194 | v = 3 | |
| 195 | else | |
| 196 | v = 2 | |
| 197 | end | |
| 198 | term.clear() | |
| 199 | end | |
| 200 | elseif v == 3 then | |
| 201 | term.setBackgroundColor(colors.white) | |
| 202 | term.clear() | |
| 203 | header("[HOME] GAUGLE ", "blue")
| |
| 204 | text("gaugle://info", "gray")
| |
| 205 | text("\n\nGAUUUGLE!\n\nMade by: FoxWorn3365\nVersion: v1.0.3E [RELASE 05]\n\nConfiguration Information:\nType: WIRELESS_2.0\nModem IP: 144.91.97."..modem.."\nModem side: "..side, "black")
| |
| 206 | local event, button, x, y = os.pullEvent("mouse_click")
| |
| 207 | if y == 1 and x < 10 then | |
| 208 | v = 0 | |
| 209 | end | |
| 210 | elseif v == 5 then | |
| 211 | term.setBackgroundColor(colors.white) | |
| 212 | term.clear() | |
| 213 | header("[INST] GAUGLE ", "blue")
| |
| 214 | text("\n\nInstallazione di GAUGLE", "black")
| |
| 215 | text("\nInserisci l'ID del Modem WIFI:", "black")
| |
| 216 | local mdwifi = read() | |
| 217 | text("\n\nPerfetto, ora inserisci il lato dove e' presente il wm:", "black")
| |
| 218 | local mdside = read() | |
| 219 | local f = fs.open("modem", "w")
| |
| 220 | f.writeLine(mdwifi) | |
| 221 | f.close() | |
| 222 | local fa = fs.open("side", "w")
| |
| 223 | fa.writeLine(mdside) | |
| 224 | fa.close() | |
| 225 | -- Confermo la creazione | |
| 226 | shell.run("reboot")
| |
| 227 | elseif v == 10 then | |
| 228 | term.setBackgroundColor(colors.white) | |
| 229 | term.clear() | |
| 230 | header("[HOME] GAUGLE [ MAIL ]", "blue")
| |
| 231 | text("gaugle://mail", "gray")
| |
| 232 | text("\nBenvenuto nella casella MAIL di GAUGLE!", "black")
| |
| 233 | button(15, 6, " INVIA UNA EMAIL ", "white", "blue") | |
| 234 | button(15, 8, " LE TUE EMAIL ", "white", "blue") | |
| 235 | local event, button, x, y = os.pullEvent("mouse_click")
| |
| 236 | if y == 6 and x > 15 and x < 32 then | |
| 237 | v = 15 | |
| 238 | elseif y == 8 and x > 15 and x < 32 then | |
| 239 | v = 12 | |
| 240 | elseif y == 1 and x < 7 then | |
| 241 | v = 0 | |
| 242 | end | |
| 243 | elseif v == 15 then | |
| 244 | term.setBackgroundColor(colors.white) | |
| 245 | term.clear() | |
| 246 | header("[HOME] GAUGLE [ MAIL ]", "blue")
| |
| 247 | text("gaugle://mail#send", "gray")
| |
| 248 | text("\n\nInvia un'email!", "black")
| |
| 249 | text("\n\nInserisci il destinatario:", "blue")
| |
| 250 | term.setCursorPos(3, 9) | |
| 251 | print("@mail.com")
| |
| 252 | term.setCursorPos(1, 9) | |
| 253 | to = read() | |
| 254 | print(to) | |
| 255 | text("\n\nInserisci il Messaggio:", "blue")
| |
| 256 | mam = read() | |
| 257 | print(mam) | |
| 258 | text("Inviato "..mam.." a "..to.."@mail.com", "green")
| |
| 259 | rednet.send(to, mam) | |
| 260 | os.pullEvent("mouse_click")
| |
| 261 | v = 10 | |
| 262 | end | |
| 263 | end | |
| 264 |