FoxWorn3365

Hack Store

Dec 4th, 2021 (edited)
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.11 KB | None | 0 0
  1. term.setCursorPos(1, 1)
  2. term.setBackgroundColor(colors.white)
  3. term.clear()
  4.  
  5. -- Hack OS - v0.19
  6. -- By FoxWorn3365
  7.  
  8.  
  9. -- APPUNTI
  10. -- Configurazioni sistema: .localConf
  11. -- Configurazioni pubbliche: .publicConf
  12. -- Immagini: /Hack/images/
  13. -- APP: /Hack/programmi/
  14. -- App di esempio:
  15. -- Directory: /Hack/programmi/fileManager/
  16. -- Icona: /Hack/programmi/fileManager/app.ico
  17. -- File da eseguire: /Hack/programmi/fileManager/exec.luaDir
  18. -- Configurazioni (facoltativo) (OBBLIGO AUTOGENERAZIONE): /Hack/programmi/fileManager/conf.public
  19. -- Nome dell'APP (massimo 4 caratteri): /Hack/programmi/fileManager/app.name
  20. -- API: https://fcosma.it/hackos/api
  21.  
  22. maxw, maxh = term.getSize()
  23. local function drawPixelInternal(xPos, yPos)
  24. term.setCursorPos(xPos, yPos)
  25. term.write(" ")
  26. end
  27.  
  28. local tColourLookup = {}
  29. for n = 1, 16 do
  30. tColourLookup[string.byte("0123456789abcdef", n, n)] = 2 ^ (n - 1)
  31. end
  32.  
  33. function drawFilledBox(startX, startY, endX, endY, nColour)
  34. if type(startX) ~= "number" or type(startX) ~= "number" or type(endX) ~=
  35. "number" or type(endY) ~= "number" or
  36. (nColour ~= nil and type(nColour) ~= "number") then
  37. error("Expected startX, startY, endX, endY, colour", 2)
  38. end
  39.  
  40. startX = math.floor(startX)
  41. startY = math.floor(startY)
  42. endX = math.floor(endX)
  43. endY = math.floor(endY)
  44.  
  45. if nColour then term.setBackgroundColor(nColour) end
  46. if startX == endX and startY == endY then
  47. drawPixelInternal(startX, startY)
  48. return
  49. end
  50.  
  51. local minX = math.min(startX, endX)
  52. if minX == startX then
  53. minY = startY
  54. maxX = endX
  55. maxY = endY
  56. else
  57. minY = endY
  58. maxX = startX
  59. maxY = startY
  60. end
  61.  
  62. for x = minX, maxX do for y = minY, maxY do drawPixelInternal(x, y) end end
  63. end
  64.  
  65. function giremu(inputstr, sep)
  66. local t={}
  67. for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
  68. table.insert(t, str)
  69. end
  70. return t
  71. end
  72.  
  73. function clear()
  74. sfondo(colors.black)
  75. term.clear()
  76. term.setCursorPos(1, 1)
  77. end
  78.  
  79. function clearRed()
  80. sfondo(colors.red)
  81. term.clear()
  82. term.setCursorPos(1, 1)
  83. end
  84.  
  85. function titolo(testo)
  86. drawFilledBox(1, 1, maxw, 1, colors.red)
  87. term.setCursorPos((maxw - #testo) / 2, 1)
  88. term.setTextColor(colors.white)
  89. term.write(testo)
  90. end
  91.  
  92. function alarm(testo, colore, y)
  93. drawFilledBox(1, y, maxw, y, colors[colore])
  94. term.setCursorPos((maxw - #testo) / 2, y)
  95. term.setTextColor(colors.white)
  96. term.write(testo)
  97. no()
  98. end
  99.  
  100. function modi(file, cont)
  101. local h = fs.open(file, "w")
  102. h.writeLine(cont)
  103. h.flush()
  104. h.close()
  105. end
  106.  
  107. function bottone(color, text, x, y)
  108. term.setBackgroundColor(colors[color])
  109. term.setTextColor(colors.white)
  110. term.setCursorPos(x, y)
  111. print(text)
  112. end
  113.  
  114. function drawA()
  115. term.setBackgroundColor(colors.white)
  116. term.setTextColor(colors.black)
  117. end
  118.  
  119. function ico(x, y, color, text)
  120. term.setBackgroundColor(colors[color])
  121. term.setTextColor(colors.white)
  122. term.setCursorPos(x, y)
  123. print(text)
  124. drawA()
  125. end
  126.  
  127. function menu()
  128. drawA()
  129. term.clear()
  130. titolo("Hack OS - Store")
  131. ico(51, 1, "gray", "X")
  132. end
  133.  
  134. don = 0
  135.  
  136. while true do
  137. if don == 0 then
  138. menu()
  139. print("\nAPP Popolari:")
  140. ico(3, 5, "green", " FMan ")
  141. ico(15, 5, "green", " LeNet ")
  142. ico(27, 5, "green", " NPay ")
  143. print("\nAltre APP:")
  144. ico(3, 8, "green", " LuaIN ")
  145. ico(15, 8, "green", " SNAKE ")
  146. ico(27, 8, "green", " XTerm ")
  147. ico(3, 10, "green", " Calc ")
  148. ico(15, 10, "orange", " Hiro Hot Chat <3 ")
  149. local event, lol, x, y = os.pullEvent("mouse_click")
  150. if y == 1 and x == 51 then
  151. shell.run("desktop")
  152. elseif y == 10 and x > 15 then
  153. don = 10
  154. elseif y == 8 and x > 3 and x < 10 then
  155. don = 1
  156. elseif y == 8 and x > 15 and x < 22 then
  157. don = 2
  158. elseif y == 8 and x > 27 then
  159. don = 3
  160. -- Popolari
  161. elseif y == 5 and x > 3 and x < 10 then
  162. don = 4
  163. elseif y == 5 and x > 15 and x < 22 then
  164. don = 5
  165. elseif y == 5 and x > 27 then
  166. don = 6
  167. elseif y == 10 then
  168. don = 7
  169. end
  170. elseif don == 1 then
  171. menu()
  172. print("\nApplicazione: LuaIN")
  173. print("\n\nUsa lua con una semplice interfaccia shell!")
  174. if fs.isDir("/Hack/programmi/luaIn") ~= true then
  175. ico(5, 10, "green", " INSTALLA L'APP ")
  176. app = "installa"
  177. print("\nPeso app: 0.4kb\nAutore: FoxWorn3365")
  178. else
  179. ico(5, 10, "green", " DISINSTALLA ")
  180. app = "disinstalla"
  181. print("\nPeso app: 5kb\nAutore: FoxWorn3365")
  182. end
  183. ico(1, 1, "blue", "<-")
  184. local event, button, x, y = os.pullEvent("mouse_click")
  185. if y == 1 and x == 1 or x == 2 then
  186. don = 0
  187. elseif y == 1 and x == 51 then
  188. shell.run("desktop")
  189. elseif y == 10 then
  190. if app == "installa" then
  191. shell.run("mkdir /Hack/programmi/luaIn")
  192. modi("/Hack/programmi/luaIn/exec.luaDir", "term.setBackgroundColor(colors.black)\nterm.setTextColor(colors.white)\nterm.clear()\nterm.setCursorPos(1, 1)\nshell.run('lua')")
  193. modi("/Hack/programmi/luaIn/app.ico", "4 4\n4 4\n4444")
  194. modi("/Hack/programmi/luaIn/app.name", "LuaIN")
  195. sleep(0.7)
  196. shell.run("desktop")
  197. else
  198. shell.run("rm /Hack/programmi/luaIn")
  199. end
  200. end
  201. elseif don == 2 then
  202. menu()
  203. print("\nApplicazione: SNAKE")
  204. print("\n\nUn fantastico gioco creato da lego11 :D")
  205. if fs.isDir("/Hack/programmi/snakeGame") ~= true then
  206. ico(5, 10, "green", " INSTALLA L'APP ")
  207. app = "installa"
  208. print("\nPeso app: 5kb\nAutore: lego11")
  209. else
  210. ico(5, 10, "green", " DISINSTALLA ")
  211. app = "disinstalla"
  212. print("\nPeso app: 5kb\nAutore: lego11")
  213. end
  214. ico(1, 1, "blue", "<-")
  215. local event, button, x, y = os.pullEvent("mouse_click")
  216. if y == 1 and x == 1 or x == 2 then
  217. don = 0
  218. elseif y == 1 and x == 51 then
  219. shell.run("desktop")
  220. elseif y == 10 then
  221. if app == "installa" then
  222. shell.run("mkdir /Hack/programmi/snakeGame")
  223. shell.run("pastebin get SUwpHUrU /Hack/programmi/snakeGame/exec.luaDir")
  224. modi("/Hack/programmi/snakeGame/app.ico", "5b e\n5\n55")
  225. modi("/Hack/programmi/snakeGame/app.name", " Snake")
  226. sleep(0.7)
  227. shell.run("desktop")
  228. else
  229. shell.run("rm /Hack/programmi/snakeGame")
  230. end
  231. end
  232. elseif don == 3 then
  233. menu()
  234. print("\nApplicazione: XTerm")
  235. print("\n\nAccedi alla console in pochi e semplici passi!")
  236. if fs.isDir("/Hack/programmi/xterm") ~= true then
  237. ico(5, 10, "green", " INSTALLA L'APP ")
  238. app = "installa"
  239. print("\nPeso app: 5kb\nAutore: FoxWorn3365")
  240. else
  241. ico(5, 10, "green", " DISINSTALLA ")
  242. app = "disinstalla"
  243. print("\nPeso app: 0.7kb\nAutore: FoxWorn3365")
  244. end
  245. ico(1, 1, "blue", "<-")
  246. local event, button, x, y = os.pullEvent("mouse_click")
  247. if y == 1 and x == 1 or x == 2 then
  248. don = 0
  249. elseif y == 1 and x == 51 then
  250. shell.run("desktop")
  251. elseif y == 10 then
  252. if app == "installa" then
  253. shell.run("mkdir /Hack/programmi/xterm")
  254. shell.run("pastebin get Y4pWiuQ4 /Hack/programmi/xterm/exec.luaDir")
  255. modi("/Hack/programmi/xterm/app.ico", "7477\n7747\n7477")
  256. modi("/Hack/programmi/xterm/app.name", "XTerm")
  257. sleep(0.7)
  258. shell.run("desktop")
  259. else
  260. shell.run("rm /Hack/programmi/xterm")
  261. end
  262. end
  263. elseif don == 4 then
  264. menu()
  265. print("\nApplicazione: FMan")
  266. print("\n\nUn File Manager semplice, leggero ed intuitivo creato dal nostro mitico Lego11")
  267. ico(5, 10, "orange", " AGGIORNA ")
  268. app = "aggiorna"
  269. print("\nPeso app: 3.59kb\nAutore: lego11")
  270. ico(1, 1, "blue", "<-")
  271. local event, button, x, y = os.pullEvent("mouse_click")
  272. if y == 1 and x == 1 or x == 2 then
  273. don = 0
  274. elseif y == 1 and x == 51 then
  275. shell.run("desktop")
  276. elseif y == 10 then
  277. if app == "aggiorna" then
  278. shell.run("rm /Hack/programmi/fileManager/exec.luaDir")
  279. shell.run("pastebin get 4auWPCSL /Hack/programmi/fileManager/exec.luaDir")
  280. sleep(0.7)
  281. shell.run("desktop")
  282. end
  283. end
  284. elseif don == 5 then
  285. menu()
  286. print("\nApplicazione: LeNet")
  287. print("\n\nUn web browser leggero e facile da usare creato da lego11")
  288. ico(5, 10, "orange", " AGGIORNA ")
  289. app = "aggiorna"
  290. print("\nPeso app: 1.298kb\nAutore: lego11")
  291. ico(1, 1, "blue", "<-")
  292. local event, button, x, y = os.pullEvent("mouse_click")
  293. if y == 1 and x == 1 or x == 2 then
  294. don = 0
  295. elseif y == 1 and x == 51 then
  296. shell.run("desktop")
  297. elseif y == 10 then
  298. shell.run("rm /Hack/programmi/leNet/exec.luaDir")
  299. shell.run("pastebin get 8yUDr8Yt /Hack/programmi/leNet/exec.luaDir")
  300. sleep(0.7)
  301. shell.run("desktop")
  302. end
  303. elseif don == 6 then
  304. menu()
  305. print("\nApplicazione: NPay")
  306. print("\n\nGestisci le tue finanze dal tuo portatile HackOS!")
  307. if fs.isDir("/Hack/programmi/nPay") ~= true then
  308. ico(5, 10, "green", " INSTALLA L'APP ")
  309. app = "installa"
  310. print("\nPeso app: 9.29kb\nAutore: lego11")
  311. else
  312. ico(5, 10, "green", " DISINSTALLA ")
  313. app = "disinstalla"
  314. print("\nPeso app: 9.29kb\nAutore: lego11")
  315. end
  316. ico(1, 1, "blue", "<-")
  317. local event, button, x, y = os.pullEvent("mouse_click")
  318. if y == 1 and x == 1 or x == 2 then
  319. don = 0
  320. elseif y == 1 and x == 51 then
  321. shell.run("startup")
  322. elseif y == 10 then
  323. if app == "installa" then
  324. shell.run("mkdir /Hack/programmi/nPay")
  325. shell.run("pastebin get TFQY7tRH /Hack/programmi/nPay/exec.luaDir")
  326. modi("/Hack/programmi/nPay/app.ico", "44 4\n4 44\n4 4")
  327. modi("/Hack/programmi/nPay/app.name", "NPay")
  328. else
  329. shell.run("rm /Hack/programmi/nPay")
  330. end
  331. end
  332. elseif don == 7 then
  333. menu()
  334. print("\nApplicazione: Calc")
  335. print("\n\nUna semplice, leggera ma rapida applicazione per il tuo HackOS")
  336. if fs.isDir("/Hack/programmi/calculator") ~= true then
  337. ico(5, 10, "green", " INSTALLA L'APP ")
  338. app = "installa"
  339. print("\nPeso app: 0.04kb\nAutore: FoxWorn3365")
  340. else
  341. ico(5, 10, "green", " DISINSTALLA ")
  342. app = "disinstalla"
  343. print("\nPeso app: 0.04kb\nAutore: FoxWorn3365")
  344. end
  345. ico(1, 1, "blue", "<-")
  346. local event, button, x, y = os.pullEvent("mouse_click")
  347. if y == 1 and x == 1 or x == 2 then
  348. don = 0
  349. elseif y == 1 and x == 51 then
  350. shell.run("startup")
  351. elseif y == 10 then
  352. if app == "installa" then
  353. shell.run("mkdir /Hack/programmi/calculator")
  354. shell.run("pastebin get yadZMu0c /Hack/programmi/calculator/exec.luaDir")
  355. modi("/Hack/programmi/calculator/app.ico", "bbb \n bb \nbbbb")
  356. modi("/Hack/programmi/calculator/app.name", "Calc")
  357. else
  358. shell.run("rm /Hack/programmi/calculator")
  359. end
  360. end
  361. elseif don == 10 then
  362. menu()
  363. print("\nApplicazione: Chat Hot con Hiro")
  364. print("\n\nChatta direttamente con Hiro")
  365. if fs.isDir("/Hack/programmi/chatHiro") ~= true then
  366. ico(5, 10, "green", " INSTALLA L'APP ")
  367. app = "installa"
  368. print("\nPeso app: 19.6kb\nAutore: FoxWorn3365")
  369. else
  370. ico(5, 10, "green", " DISINSTALLA ")
  371. app = "disinstalla"
  372. print("\nPeso app: 19.6kb\nAutore: FoxWorn3365")
  373. end
  374. ico(1, 1, "blue", "<-")
  375. local event, button, x, y = os.pullEvent("mouse_click")
  376. if y == 1 and x == 1 or x == 2 then
  377. don = 0
  378. elseif y == 1 and x == 51 then
  379. shell.run("desktop")
  380. elseif y == 10 then
  381. if app == "installa" then
  382. shell.run("mkdir /Hack/programmi/chatHiro")
  383. shell.run("pastebin get 2Kw6KdQ7 /Hack/programmi/chatHiro/exec.luaDir")
  384. modi("/Hack/programmi/chatHiro/app.ico", "1111\n1616\n6666")
  385. modi("/Hack/programmi/chatHiro/app.name", "Hiro")
  386. else
  387. shell.run("rm /Hack/programmi/chatHiro")
  388. end
  389. end
  390. end
  391. end
Advertisement
Add Comment
Please, Sign In to add comment