Simlor_GER

MOB - User Tool (Privates Projekt)

Jul 22nd, 2017
87
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --Copyright by Simlor (http://www.computercraft.info/forums2/index.php?/user/55655-simlor/)
  2.  
  3. --Minecraft Online Banking System (MOB System)
  4.  
  5. os.pullEvent = os.pullEventRaw
  6.  
  7. --SimSoft API
  8.  
  9. function Clear()
  10.  
  11. term.clear()
  12. term.setCursorPos(1,1)
  13.  
  14. end
  15.  
  16. function CP(x,y)
  17.  
  18. term.setCursorPos(x,y)
  19.  
  20. end
  21.  
  22. function BC(farbe)
  23.  
  24. term.setBackgroundColor(farbe)
  25.  
  26. end
  27.  
  28. function TC(farbe)
  29.  
  30. term.setTextColor(farbe)
  31.  
  32. end
  33.  
  34. --Einstellungen Check
  35.  
  36. fscheck = fs.exists(".mob")
  37.  
  38. if fscheck == true then
  39.  
  40. file = fs.open(".mob/settings","r")
  41. local fileData = {}
  42. local line = file.readLine()
  43. repeat
  44. table.insert(fileData,line)
  45. line = file.readLine()
  46. until line == nil
  47. file.close()
  48.  
  49. sideofmodem = fileData[1]
  50. idofserver = fileData[2]
  51.  
  52. idofserver = (idofserver+0)
  53.  
  54. if sideofmodem == "left" or sideofmodem == "right" or sideofmodem == "front" or sideofmodem == "back" or sideofmodem == "top" or sideofmodem == "bottom" then
  55.  
  56. --
  57.  
  58. else
  59.  
  60. local file = fs.open(".mob/settings","a")
  61. file.writeLine("back")
  62. file.writeLine("0")
  63. file.writeLine("")
  64. file.writeLine("1. Side of modem")
  65. file.writeLine("2. ID of main server")
  66. file.close()
  67.  
  68. end
  69.  
  70. else
  71.  
  72. local file = fs.open(".mob/settings","a")
  73. file.writeLine("back")
  74. file.writeLine("0")
  75. file.writeLine("")
  76. file.writeLine("1. Side of modem")
  77. file.writeLine("2. ID of main server")
  78. file.close()
  79.  
  80. sideofmodem = "back"
  81. idofserver = 0
  82.  
  83. end
  84.  
  85. rednet.open(sideofmodem)
  86.  
  87. --MOB Funktionen
  88.  
  89. function MOBlogin(name, pass)
  90.  
  91. msg = nil
  92. error = false
  93. guthaben = nil
  94. saveID = math.random(1, 99999999)
  95.  
  96.  
  97. rednet.send(idofserver, "login", saveID)
  98.  
  99. serverID, msg = rednet.receive(saveID, 0.8)
  100.  
  101. if msg == "login" then
  102.  
  103. rednet.send(idofserver, name, saveID)
  104. rednet.send(idofserver, pass, saveID)
  105.  
  106. serverID, msg = rednet.receive(saveID, 0.8)
  107.  
  108. if msg == "true" then
  109.  
  110. serverID, guthaben = rednet.receive(saveID, 0.8)
  111.  
  112. else
  113.  
  114. if msg == "error:wrong_format" then
  115.  
  116. error = "wrong_format"
  117.  
  118. else
  119.  
  120. error = "wrong_pass"
  121.  
  122. end
  123.  
  124. end
  125.  
  126. else
  127.  
  128. error = "no_server_answer"
  129.  
  130. end
  131.  
  132. end
  133.  
  134. --System
  135.  
  136.  
  137. BC(1)
  138.  
  139. Clear()
  140.  
  141. BC(128)
  142.  
  143. CP(1,1)
  144. write(" ")
  145. CP(1,2)
  146. write(" ")
  147. CP(1,3)
  148. write(" ")
  149.  
  150. CP(4,2)
  151. BC(128)
  152. TC(1)
  153.  
  154. print("MOB - Minecraft Online Banking")
  155.  
  156. BC(1)
  157.  
  158. TC(128)
  159.  
  160. CP(6,8)
  161. print("Username -")
  162.  
  163. CP(6,11)
  164. print("MOB-Code -")
  165.  
  166. TC(512)
  167.  
  168. CP(17,8)
  169. name = read()
  170.  
  171. CP(17,11)
  172. pass = read("#")
  173.  
  174. TC(256)
  175.  
  176. CP(4,18)
  177. print("Warte auf den Server...")
  178.  
  179. C = 0
  180.  
  181. while true do
  182.  
  183. C = (C+1)
  184.  
  185. MOBlogin(name, pass)
  186.  
  187. if error == false then
  188.  
  189. BC(1)
  190. TC(256)
  191.  
  192. CP(4,18)
  193.  
  194. print("Das Login war erfolgreich! ")
  195.  
  196. break
  197.  
  198. elseif error == "wrong_format" then
  199.  
  200. BC(1)
  201. TC(256)
  202.  
  203. CP(4,18)
  204.  
  205. print("Nutze fuer den Code nur Zahlen!")
  206.  
  207. sleep(2)
  208.  
  209. os.reboot()
  210. break
  211.  
  212. elseif error == "wrong_pass" then
  213.  
  214. BC(1)
  215. TC(256)
  216.  
  217. CP(4,18)
  218.  
  219. print("Username oder MOB-Code sind falsch!")
  220.  
  221. sleep(2)
  222.  
  223. os.reboot()
  224. break
  225.  
  226. elseif error == "no_server_answer" then
  227.  
  228. BC(1)
  229. TC(256)
  230.  
  231. CP(4,18)
  232.  
  233. print("Warte auf den Server... ("..(C+1).."/3)")
  234.  
  235. if C == 3 then
  236.  
  237. BC(1)
  238. TC(256)
  239.  
  240. CP(4,18)
  241.  
  242. print("Server hat nicht geantwortet!")
  243.  
  244. sleep(2)
  245.  
  246. os.reboot()
  247. break
  248.  
  249. end
  250.  
  251. end
  252.  
  253. end
  254.  
  255. function StandertAnzeigeLITE()
  256.  
  257. BC(1)
  258.  
  259. Clear()
  260.  
  261. BC(128)
  262.  
  263. CP(1,1)
  264. write(" ")
  265. CP(1,2)
  266. write(" ")
  267. CP(1,3)
  268. write(" ")
  269.  
  270. CP(4,2)
  271. BC(128)
  272. TC(1)
  273.  
  274. print("MOB - Minecraft Online Banking")
  275.  
  276. end
  277.  
  278. function StandertAnzeige()
  279.  
  280. StandertAnzeigeLITE()
  281.  
  282. BC(256)
  283.  
  284. CP(1,5)
  285. write(" ")
  286. CP(1,6)
  287. write(" ")
  288. CP(1,7)
  289. write(" ")
  290.  
  291. BC(512)
  292.  
  293. CP(1,9)
  294. write(" ")
  295. CP(1,10)
  296. write(" ")
  297. CP(1,11)
  298. write(" ")
  299.  
  300. CP(1,13)
  301. write(" ")
  302. CP(1,14)
  303. write(" ")
  304. CP(1,15)
  305. write(" ")
  306.  
  307. TC(1)
  308.  
  309. if error == false then
  310.  
  311. BC(256)
  312.  
  313. CP(1,6)
  314. write(" ")
  315.  
  316. CP(4,6)
  317. print("Dein Guthaben - "..guthaben.." MO$")
  318.  
  319. else
  320.  
  321. BC(16384)
  322.  
  323. CP(1,5)
  324. write(" ")
  325. CP(1,6)
  326. write(" ")
  327. CP(1,7)
  328. write(" ")
  329.  
  330. CP(4,6)
  331. print("Es gab einen Fehler :/")
  332.  
  333. end
  334.  
  335. BC(512)
  336.  
  337. CP(4,14)
  338. print("Abmelden")
  339.  
  340. CP(4,10)
  341. print("Ueberweisung durchfuehren")
  342.  
  343.  
  344. end
  345.  
  346. w, h = term.getSize()
  347.  
  348. while true do
  349.  
  350. StandertAnzeige()
  351.  
  352. event, side, x, y = os.pullEvent()
  353. if event == "mouse_click" then
  354.  
  355. if x >= 1 and x <= w and y >= 5 and y <= 7 then
  356.  
  357. if error == false then
  358.  
  359. BC(256)
  360.  
  361. else
  362.  
  363. BC(16384)
  364.  
  365. end
  366.  
  367. CP(1,6)
  368. write(" ")
  369.  
  370. CP(4,6)
  371. print("Lade neu...")
  372.  
  373. sleep(0.2)
  374.  
  375. MOBlogin(name, pass)
  376.  
  377. end
  378.  
  379. if x >= 1 and x <= w and y >= 13 and y <= 15 then
  380.  
  381. os.reboot()
  382.  
  383. end
  384.  
  385. if x >= 1 and x <= w and y >= 9 and y <= 11 then
  386.  
  387. StandertAnzeigeLITE()
  388.  
  389. BC(1)
  390.  
  391. TC(128)
  392.  
  393. CP(4,8)
  394. print("Senden zum Konto - ")
  395.  
  396. CP(4,10)
  397. print("Menge zum Senden - ")
  398.  
  399. TC(1)
  400.  
  401. BC(32)
  402.  
  403. CP(4,13)
  404. print(" ")
  405. CP(4,14)
  406. print(" Senden ")
  407. CP(4,15)
  408. print(" ")
  409.  
  410. BC(16384)
  411.  
  412. CP(20,13)
  413. print(" ")
  414. CP(20,14)
  415. print(" Abbrechen ")
  416. CP(20,15)
  417. print(" ")
  418.  
  419. TC(512)
  420. BC(1)
  421.  
  422. zukontosenden = nil
  423. mengezusenden = nil
  424.  
  425. CP(23, 8)
  426. zukontosenden = read()
  427.  
  428. CP(23, 10)
  429. mengezusenden = read()
  430.  
  431. while true do
  432.  
  433. event, side, x, y = os.pullEvent()
  434. if event == "mouse_click" then
  435.  
  436. if x >= 4 and x <= 16 and y >= 13 and y <= 15 then
  437.  
  438. CP(4,18)
  439. BC(1)
  440. TC(256)
  441.  
  442. print("Sende Daten...")
  443.  
  444. msg = nil
  445. error = false
  446. guthaben = nil
  447. saveID = math.random(1, 99999999)
  448.  
  449. rednet.send(idofserver, "trans", saveID)
  450.  
  451. serverID, msg = rednet.receive(saveID, 0.8)
  452.  
  453. if msg == "trans" then
  454.  
  455. rednet.send(idofserver, name, saveID)
  456. rednet.send(idofserver, pass, saveID)
  457.  
  458. serverID, msg = rednet.receive(saveID, 0.8)
  459.  
  460. if msg == "true" then
  461.  
  462. rednet.send(idofserver, zukontosenden, saveID)
  463. rednet.send(idofserver, mengezusenden, saveID)
  464.  
  465. msg = nil
  466.  
  467. serverID, msg = rednet.receive(saveID, 0.8)
  468.  
  469. if msg == "true" then
  470.  
  471. CP(4,18)
  472. BC(1)
  473. TC(256)
  474.  
  475. print("Erfolgreich abgeschlossen!")
  476.  
  477. sleep(1)
  478.  
  479. break
  480.  
  481. elseif msg == "error:big_deal" then
  482.  
  483. CP(4,18)
  484. BC(1)
  485. TC(256)
  486.  
  487. print("Es gab einen Fehler bei der Menge!")
  488.  
  489. sleep(1)
  490.  
  491. break
  492.  
  493. elseif msg == "error:wrong_account" then
  494.  
  495. CP(4,18)
  496. BC(1)
  497. TC(256)
  498.  
  499. print("Das Konto wurde nicht gefunden!")
  500.  
  501. sleep(1)
  502.  
  503. break
  504.  
  505. else
  506.  
  507. CP(4,18)
  508. BC(1)
  509. TC(256)
  510.  
  511. print("Es gab einen Fehler!")
  512.  
  513. sleep(1)
  514.  
  515. break
  516.  
  517. end
  518.  
  519. else
  520.  
  521. if msg == "error:wrong_format" then
  522.  
  523. CP(4,18)
  524. BC(1)
  525. TC(256)
  526.  
  527. print("Es gab einen Fehler!")
  528.  
  529. sleep(1)
  530.  
  531. break
  532.  
  533. else
  534.  
  535. CP(4,18)
  536. BC(1)
  537. TC(256)
  538.  
  539. print("Es gab einen Fehler!")
  540.  
  541. sleep(1)
  542.  
  543. break
  544.  
  545. end
  546.  
  547. end
  548.  
  549. else
  550.  
  551. CP(4,18)
  552. BC(1)
  553. TC(256)
  554.  
  555. print("Der Server antwortet nicht!")
  556.  
  557. sleep(1)
  558.  
  559. break
  560.  
  561. end
  562.  
  563. end
  564.  
  565. if x >= 20 and x <= 32 and y >= 13 and y <= 15 then
  566.  
  567. break
  568.  
  569. end
  570.  
  571. end
  572.  
  573. end
  574.  
  575. MOBlogin(name, pass)
  576.  
  577. end
  578.  
  579. end
  580.  
  581. end
RAW Paste Data