MavricMC

ATM

Apr 16th, 2022 (edited)
2,369
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 45.81 KB | None | 0 0
  1. --ATM version 0.1.2--
  2. --Must be startup program--
  3. os.pullEvent = os.pullEventRaw
  4. local vers = "0.1.2"
  5.  
  6. --Settings--
  7. local server = 0
  8. local atm = "atm_1"
  9. local bankSide = "modem_0"
  10. local drive = "bottom"
  11. local chests = {"minecraft:chest_0"}
  12. local dropper = "minecraft:dropper_0"
  13. local junk = "minecraft:dropper_1"
  14.  
  15. local logFile = "log"
  16. local enableLogging = true
  17.  
  18. local coin = "minecraft:diamond"
  19. local coinValue = 1 --How much currency each physical coin is worth. Values other than one will cause both currency and coin amounts to be displayed. greater or less than 1 work
  20. local withdrawFee = 0 -- 0.05 = 5%  --Percentage of coin withheld at withdrawl. When set to 0 fee calculation will not be displayed
  21. local transferFee = 0 -- 0.1 = 10%  --Percentage of currecy withheld at transfer. When set to 0 fee calculation will not be displayed
  22. local transferMax = 1000 -- Max amount that a transfer can be
  23.  
  24. local allowSignUp = true
  25. local backgroundColour = colors.black
  26. local bankTimeout = 10 --How many seconds the bank function will wait before timing out
  27.  
  28. local enableReceipt = false
  29. local printer = "printer_0"
  30. local inkStorage = "minecraft:chest_0"
  31. local textColour = "minecraft:black_dye"
  32. local output = drive --Drive must be connected to the wired modem and drive must be "drive_0" or similar. Drive as simply "bottom" wont work
  33. --Default config is: Each page is moved to drive and ejected. If you want something else, then change the output and edit sendToOutput()
  34. --Also add some code to the end of printReceipt() when sendToOutput() is run for thne last time. Eg: If you want to output all pages at once or bind them together
  35.  
  36. --Button settings. Changes to any setting will not break click detection
  37. local doneButton = {"Done", 23, 10, colors.blue, colors.white} --Text, lop left x and y, background color, text color
  38. local createButton = {"Sign Up", 39, 15, colors.blue, colors.white}
  39. local receiptButton = {"Recepit", 39, 15, colors.blue, colors.white}
  40. local mainButtons = {
  41.     {"Deposit", 10, 10, colors.green, colors.white},
  42.     {"Withdraw", 21, 10, colors.red, colors.white},
  43.     {"Transfer", 33, 10, colors.lightBlue, colors.white}
  44. }
  45.  
  46. local backupDyes = { --Fallback dyes for if the correct dye is not found. White dye is illegible
  47.     "minecraft:light_gray_dye",
  48.     "minecraft:gray_dye",
  49.     "minecraft:black_dye",
  50.     "minecraft:brown_dye",
  51.     "minecraft:red_dye",
  52.     "minecraft:orange_dye",
  53.     "minecraft:yellow_dye",
  54.     "minecraft:lime_dye",
  55.     "minecraft:green_dye",
  56.     "minecraft:cyan_dye",
  57.     "minecraft:light_blue_dye",
  58.     "minecraft:blue_dye",
  59.     "minecraft:purple_dye",
  60.     "minecraft:magenta_dye",
  61.     "minecraft:pink_dye"
  62. }
  63.  
  64. --Vars--
  65. local d = peripheral.wrap(dropper)
  66. local j = peripheral.wrap(junk)
  67. local screen = 0
  68. local padAmm = ""
  69. local pin = ""
  70. local afterFees = 0
  71. local padAcc = ""
  72. local tranFee = 0
  73. local transActionList = {}
  74. local newSession = true
  75. local p
  76. local s
  77.  
  78. if (enableReceipt) then
  79.     p = peripheral.wrap(printer)
  80.     s = peripheral.wrap(inkStorage)
  81. end
  82.  
  83. if (enableLogging) then
  84.     os.loadAPI("json.lua") --No need to load up json api and waste ram if not logging json
  85. end
  86.  
  87. --Functions--
  88.  
  89. --From pullapi--
  90. function getStored()
  91.     local count = 0
  92.     for _, v in pairs(chests) do
  93.         cs = peripheral.wrap(v)
  94.         for k2, v2 in pairs(cs.list()) do
  95.             if v2.name == coin then
  96.                 count = count + v2.count
  97.             else
  98.                 j.pullItems(v, k2, v2.count)
  99.             end
  100.         end
  101.     end
  102.     return count
  103. end
  104.  
  105. function pullapideposit()
  106.     local count = 0
  107.     for _, v in pairs(chests) do
  108.         for i = 1, 9 do
  109.             local tab = d.getItemDetail(i)
  110.             if tab ~= nil then
  111.                 if tab.name == coin then
  112.                     local deped = d.pushItems(v, i, 64)
  113.                     count = count + deped
  114.                 else
  115.                     d.pushItems(junk, i, 64)
  116.                 end
  117.             end
  118.         end
  119.     end
  120.     if count > 0 then
  121.         return true, count
  122.     else
  123.         return false, "Ammount enterd must be more than 0"
  124.     end
  125. end
  126.  
  127. function pullapiwithdraw(amount)
  128.     if amount > 576 then
  129.         return false, "Amount must be at maximum 9 stacks or 576 items"
  130.     end
  131.     if amount > getStored() then
  132.         return false, "Not enough in storage"
  133.     end
  134.    
  135.     local count = 0
  136.     for _, v in pairs(chests) do
  137.         cs = peripheral.wrap(v)
  138.         for i = 1, 54 do
  139.             tab = cs.getItemDetail(i)
  140.             if tab ~= nil then
  141.                 if tab.name == coin then
  142.                     if (count + tab.count) > amount then
  143.                         d.pullItems(v, i, (amount - count))
  144.                         return true
  145.                     else
  146.                         d.pullItems(v, i, tab.count)
  147.                         count = count + tab.count
  148.                     end
  149.                     if count == amount then
  150.                         return true
  151.                     end
  152.                 else
  153.                     j.pullItems(chests, i, 64)
  154.                 end
  155.             end
  156.         end
  157.     end
  158. end
  159.  
  160. --From api--
  161. function smallLogo(x, y)
  162.     term.setBackgroundColor(backgroundColour)
  163.     term.setTextColor(colors.lightBlue)
  164.     term.setCursorPos(x + 2, y)
  165.     term.write("\134")
  166.     term.setCursorPos(x, y + 2)
  167.     term.write("\134")
  168.     term.setTextColor(1)
  169.     term.setCursorPos(x + 1, y + 1)
  170.     term.write("M")
  171.  
  172.     term.setTextColor(colors.cyan)
  173.     term.setCursorPos(x + 3, y)
  174.     term.write("\134")
  175.     term.setCursorPos(x + 1, y + 2)
  176.     term.write("\134")
  177.     term.setTextColor(1)
  178.     term.setCursorPos(x + 2, y + 1)
  179.     term.write("P")
  180.  
  181.     term.setTextColor(colors.blue)
  182.     term.setCursorPos(x + 4, y)
  183.     term.write("\134")
  184.     term.setCursorPos(x + 2, y + 2)
  185.     term.write("\134")
  186.     term.setTextColor(1)
  187.     term.setCursorPos(x + 3, y + 1)
  188.     term.write("N")
  189. end
  190.  
  191. function clear(col, exit, small, id)
  192.     term.setBackgroundColor(col)
  193.     term.setTextColor(colors.yellow)
  194.     term.clear()
  195.     term.setCursorPos(1, 1)
  196.     term.write("ATM ".. vers)
  197.     term.setCursorPos(1, 19)
  198.     term.setTextColor(colors.lightGray)
  199.     term.write("Made By Mavric, Please Report Bugs")
  200.     term.setTextColor(colors.white)
  201.     if (small) then
  202.         smallLogo(46, 2)
  203.     end
  204.     if (exit) then
  205.         term.setBackgroundColor(colors.red)
  206.         term.setTextColor(1)
  207.         term.setCursorPos(49, 17)
  208.         term.write("X")
  209.         term.setBackgroundColor(colors.black)
  210.     end
  211.     if id >= 0 then --Use -1 to disable
  212.         term.setBackgroundColor(col)
  213.         term.setTextColor(colours.lime)
  214.         term.setCursorPos(1, 3)
  215.         term.write("ID: ".. id)
  216.     end
  217. end
  218.  
  219. function balance(account, ATM, pin)
  220.     local msg = {"bal", account, ATM, pin, getStored(), coinValue, coin}
  221.     rednet.send(server, msg, "banking")
  222.     local send, mes, pro = rednet.receive("banking", bankTimeout)
  223.     if not send then
  224.         return false, "timeout"
  225.     else
  226.         if mes[1] == "balR" then
  227.             return mes[2], mes[3]
  228.         end
  229.     end
  230.     return false, "oof"
  231. end
  232.  
  233. function deposit(account, amount, ATM, pin)
  234.     local msg = {"dep", account, amount, ATM, pin, getStored(), coinValue, coin}
  235.     rednet.send(server, msg, "banking")
  236.     local send, mes, pro = rednet.receive("banking", bankTimeout)
  237.     if not send then
  238.         return false, "timeout"
  239.     else
  240.         if mes[1] == "depR" then
  241.             return mes[2], mes[3]
  242.         end
  243.     end
  244.     return false, "oof"
  245. end
  246.  
  247. function withdraw(account, amount, ATM, pin)
  248.     local msg = {"wit", account, amount, ATM, pin, getStored(), coinValue, coin}
  249.     rednet.send(server, msg, "banking")
  250.     local send, mes, pro = rednet.receive("banking", bankTimeout)
  251.     if not send then
  252.         return false, "timeout"
  253.     else
  254.         if mes[1] == "witR" then
  255.             return mes[2], mes[3], amount
  256.         end
  257.     end
  258.     return false, "oof"
  259. end
  260.  
  261. function transfer(account, account2, amount, ATM, pin)
  262.     local msg = {"tra", account, account2, amount, ATM, pin, getStored(), coinValue, coin}
  263.     rednet.send(server, msg, "banking")
  264.     local send, mes, pro = rednet.receive("banking", bankTimeout)
  265.     if not send then
  266.         return false, "timeout"
  267.     else
  268.         if mes[1] == "traR" then
  269.             return mes[2], mes[3]
  270.         end
  271.     end
  272.     return false, "oof"
  273. end
  274.  
  275. function create(account, ATM, pin)
  276.     local msg = {"cre", account, ATM, pin, getStored(), coinValue, coin}
  277.     rednet.send(server, msg, "banking")
  278.     local send, mes, pro = rednet.receive("banking", bankTimeout)
  279.     if not send then
  280.         return false, "timeout"
  281.     else
  282.         if mes[1] == "creR" then
  283.             return mes[2], mes[3]
  284.         end
  285.     end
  286.     return false, "oof"
  287. end
  288.  
  289. --From printer test--
  290. function prepForPrint()
  291.     for i = 1, 13 do
  292.         j.pullItems(peripheral.getName(p), i) --Empty printer
  293.     end
  294.     j.pullItems(peripheral.getName(s), s.size()) --Empty last slot in ink storage. Used as temporary storage by recycle()
  295. end
  296.  
  297. function backupInk()
  298.     for k, v in pairs(s.list()) do
  299.         for _, v2 in pairs(backupDyes) do
  300.             if v.name == v2 then
  301.                 s.pushItems(peripheral.getName(p), k, 1, 1)
  302.                 return true
  303.             end
  304.         end
  305.     end
  306.     return false
  307. end
  308.  
  309. function addInk(name) --Add 1 ink of desired name to printer
  310.     for k, v in pairs(s.list()) do
  311.         if v.name == name then
  312.             s.pushItems(peripheral.getName(p), k, 1, 1)
  313.             return true
  314.         end
  315.     end
  316.     return backupInk() --Get a dye if correct dye is not found
  317. end
  318.  
  319. function addPaper() --Add 1 paper to printer
  320.     for k, v in pairs(s.list()) do
  321.         if v.name == "minecraft:paper" then
  322.             s.pushItems(peripheral.getName(p), k, 1, 2)
  323.             return true
  324.         end
  325.     end
  326.     return false
  327. end
  328.  
  329. function recycle() --Moves paper from output to input of printer for new ink
  330.     s.pullItems(peripheral.getName(p), 8, 1, s.size())
  331.     s.pushItems(peripheral.getName(p), s.size(), 1, 2)
  332. end
  333.  
  334. function sendToOutput()
  335.     p.endPage()
  336.     s.pullItems(peripheral.getName(p), 8, 1, s.size())
  337.     s.pushItems(output, s.size(), 1)
  338.     --Change up the code here if outputing to something differnt
  339.     if (output == drive) then --Dont eject if not outputing to drive
  340.         disk.eject(output)
  341.     end
  342. end
  343.  
  344. function printDate(y, date)
  345.     p.setCursorPos(16, y)
  346.     p.write(string.format("%02d/", date.day))
  347.     p.write(string.format("%02d/", date.month))
  348.     p.write(date.year)
  349. end
  350.  
  351. function printTime(y, time)
  352.     p.setCursorPos(18, y)
  353.     p.write(string.format("%02d:", time.hour))
  354.     p.write(string.format("%02d:", time.min))
  355.     p.write(string.format("%02d", time.sec))
  356. end
  357.  
  358. function lineBreak(y)
  359.     p.setCursorPos(1, y)
  360.     p.write("\140\140\140\140\140\140\140\140\140\140\140\140\140\140\140\140\140\140\140\140\140\140\140\140\140")
  361. end
  362.  
  363. function startPage(number)
  364.     prepForPrint()
  365.  
  366.     if (not addInk("minecraft:light_blue_dye")) then
  367.         return false, "Out of ink: minecraft:light_blue_dye"
  368.     end
  369.    
  370.     if (not addPaper()) then
  371.         return false, "Out of paper"
  372.     end
  373.     p.newPage()
  374.     p.setPageTitle(string.format("Receipt #%03d", number))
  375.     p.setCursorPos(13, 1)
  376.     p.write("\134")
  377.     p.setCursorPos(11, 3)
  378.     p.write("\134")
  379.     p.setCursorPos(12, 2)
  380.     p.write("M")
  381.     p.endPage()
  382.  
  383.     if (not addInk("minecraft:cyan_dye")) then
  384.         return false, "Out of ink: minecraft:cyan_dye"
  385.     end
  386.  
  387.     recycle()
  388.     p.newPage()
  389.     p.setCursorPos(14, 1)
  390.     p.write("\134")
  391.     p.setCursorPos(12, 3)
  392.     p.write("\134")
  393.     p.setCursorPos(13, 2)
  394.     p.write("P")
  395.     p.endPage()
  396.  
  397.     if (not addInk("minecraft:blue_dye")) then
  398.         return false, "Out of ink: minecraft:blue_dye"
  399.     end
  400.     recycle()
  401.     p.newPage()
  402.     p.setCursorPos(15, 1)
  403.     p.write("\134")
  404.     p.setCursorPos(13, 3)
  405.     p.write("\134")
  406.     p.setCursorPos(14, 2)
  407.     p.write("N")
  408.  
  409.     if textColour ~= "minecraft:blue_dye" then --Dont waste blue dye
  410.         p.endPage()
  411.         if (not addInk(textColour)) then
  412.             return false, "Out of ink: ".. textColour
  413.         end
  414.         recycle()
  415.         p.newPage()
  416.     end
  417.  
  418.     return true
  419. end
  420.  
  421. function printReceipt(transAcs)
  422.     drawScreen(9)
  423.  
  424.     local result, response = startPage(1)
  425.     if (not result) then
  426.         return false, response
  427.     end
  428.  
  429.     p.setCursorPos(1, 4)
  430.     p.write("ID")
  431.     p.setCursorPos(1, 5)
  432.     p.write(transAcs[1].card)
  433.  
  434.     p.setCursorPos(1, 7)
  435.     p.write("Balance")
  436.     p.setCursorPos(1, 8)
  437.     p.write("$".. transAcs[1].startingBalance)
  438.  
  439.     p.setCursorPos(18, 4)
  440.     p.write("Location")
  441.     p.setCursorPos(26 - string.len(transAcs[1].location), 5)
  442.     p.write(transAcs[1].location)
  443.  
  444.     printTime(7, transAcs[1].sessionStart)
  445.     printDate(8, transAcs[1].sessionStart)
  446.  
  447.     lineBreak(9)
  448.  
  449.     local y = 10
  450.     local page = 1
  451.     for i = 2, table.maxn(transAcs) do
  452.         if (y > 19) then
  453.             page = page + 1
  454.             y = 4
  455.             sendToOutput()
  456.             local result, response = startPage(page)
  457.             if (not result) then
  458.                 return false, response
  459.             end
  460.         end
  461.  
  462.         p.setCursorPos(1, y)
  463.         if transAcs[i].type == 0 then
  464.             p.write("Deposit")
  465.         elseif transAcs[i].type == 1 then
  466.             p.write("Withdraw")
  467.         elseif transAcs[i].type == 2 then
  468.             p.write("Transfer")
  469.         elseif transAcs[i].type == 1 then
  470.             p.write("Item") --Write item title here
  471.         elseif transAcs[i].type == 1 then
  472.             p.write("Refund")
  473.         else
  474.             p.write("N/A")
  475.         end
  476.  
  477.         p.setCursorPos(12, y)
  478.         p.write("$".. transAcs[i].amount)
  479.  
  480.         p.setCursorPos(22, y)
  481.         if transAcs[i].success then
  482.             p.write("Pass")
  483.         else
  484.             p.write("Fail")
  485.         end
  486.  
  487.         p.setCursorPos(1, y + 1)
  488.         p.write(string.format("%02d/", transAcs[i].date.day))
  489.         p.write(string.format("%02d/", transAcs[i].date.month))
  490.         p.write(transAcs[i].date.year)
  491.  
  492.         printTime(y + 1, transAcs[i].date)
  493.  
  494.         if (transAcs[i].success) then
  495.             if (transAcs[i].fee > 0) then
  496.                 local temp = "Fee $".. tostring(transAcs[i].fee)
  497.                 p.setCursorPos(26 - string.len(temp), y + 2)
  498.                 p.write(temp)
  499.             end
  500.             p.setCursorPos(1, y + 2)
  501.             p.write("Bal $")
  502.         else
  503.             p.setCursorPos(1, y + 2)
  504.         end
  505.         p.write(transAcs[i].result)
  506.  
  507.         y = y + 4
  508.     end
  509.  
  510.     if y > 20 then
  511.         page = page + 1
  512.         y = 4
  513.         sendToOutput()
  514.         local result, response = startPage(page)
  515.         if (not result) then
  516.             return false, response
  517.         end
  518.     else
  519.         y = y - 1 --Remove the padding from for loop
  520.     end
  521.  
  522.     lineBreak(y)
  523.  
  524.     p.setCursorPos(1, y + 1)
  525.     p.write("Balance")
  526.     p.setCursorPos(1, y + 2)
  527.     p.write("$".. transAcs[1].finalBalance)
  528.  
  529.     local tempMsg = "Powered by MPN"
  530.     p.setCursorPos(26 - string.len(tempMsg), y + 1)
  531.     p.write(tempMsg)
  532.     printTime(y + 2, transAcs[1].sessionEnd)
  533.  
  534.     sendToOutput()
  535.  
  536.     return true, page
  537. end
  538.  
  539. --Normal--
  540.  
  541. function cleanUp()
  542.     if (transActionList[1] ~= nil) then
  543.         transActionList[1].sessionEnd = os.date("*t")
  544.         transActionList[1].receipt = false
  545.         if (enableLogging) then
  546.             local logLine = json.encode(transActionList)
  547.             local log = fs.open(logFile, "a")
  548.             log.writeLine(logLine)
  549.             log.close()
  550.         end
  551.         transActionList ={}
  552.     end
  553.  
  554.     pin = ""
  555.     padAmm = ""
  556.     padAcc = ""
  557.     afterFees = 0
  558.     tranFee = 0
  559.     newSession = true
  560.     drawScreen(0)
  561. end
  562.  
  563. function writeCenter(text, y)
  564.     term.setCursorPos(math.floor(26 - (string.len(text) / 2)), y)
  565.     term.write(text)
  566. end
  567.  
  568. function pinpad(key)
  569.     if (key == ".") then
  570.         return true, 10
  571.     else
  572.         if (tonumber(key)) then
  573.             if tonumber(key) == 259 then
  574.                 return true, 10
  575.             elseif (tonumber(key) == 257 or tonumber(key) == 335) then
  576.                 return true, 11
  577.             elseif tonumber(key) >= 0 and tonumber(key) <= 9 then
  578.                 return true, tonumber(key)
  579.             end
  580.         end
  581.     end
  582.     return false
  583. end
  584.  
  585. function drawButton(buttonArray)
  586.     term.setBackgroundColor(buttonArray[4])
  587.     term.setTextColor(buttonArray[4])
  588.     term.setCursorPos(buttonArray[2], buttonArray[3])
  589.     term.write("OO".. buttonArray[1])
  590.  
  591.     term.setCursorPos(buttonArray[2], buttonArray[3] + 1)
  592.     term.write("O")
  593.     term.setTextColor(buttonArray[5])
  594.     term.write(buttonArray[1])
  595.     term.setTextColor(buttonArray[4])
  596.     term.write("O")
  597.  
  598.     term.setCursorPos(buttonArray[2], buttonArray[3] + 2)
  599.     term.write("OO".. buttonArray[1])
  600. end
  601.  
  602. function checkButton(x, y, buttonArray)
  603.     if x >= buttonArray[2] and x < (buttonArray[2] + string.len(buttonArray[1]) + 2) and y >= buttonArray[3] and y < (buttonArray[3] + 3) then
  604.         return true
  605.     else
  606.         return false
  607.     end
  608. end
  609.  
  610. function drawScreen(scrn)
  611.     if ((scrn > 0 and (not disk.isPresent(drive))) and (not (scrn == 7))) then --Catch if disk was removed when sleeping or waiting for some code
  612.         scrn = 0
  613.     end
  614.  
  615.     if scrn == 0 then
  616.         screen = 0
  617.         term.setCursorBlink(false)
  618.         clear(backgroundColour, false, false, -1)
  619.         term.setBackgroundColor(backgroundColour)
  620.         term.setTextColor(1)
  621.         writeCenter("Please insert card", 13)
  622.         local pic = paintutils.loadImage("MPNLogo.nfp")
  623.         paintutils.drawImage(pic, 18, 3)
  624.         if (allowSignUp) then
  625.             drawButton(createButton)
  626.         end
  627.     elseif scrn == 1 then
  628.         screen = 1
  629.         clear(backgroundColour, true, true, -1)
  630.         term.setBackgroundColor(backgroundColour)
  631.         term.setTextColor(colours.lime)
  632.         writeCenter("ID: ".. acc, 5)
  633.         term.setCursorPos(20, 9)
  634.         term.setTextColor(1)
  635.         term.write("PIN: ")
  636.         term.setCursorBlink(true)
  637.         pin = ""
  638.     elseif scrn == 2 then
  639.         screen = 2
  640.         term.setCursorBlink(false)
  641.         local suc, res = balance(acc, atm, pin)
  642.         if (suc) then
  643.             if (newSession) then
  644.                 transActionList = {{ card = acc, sessionStart = os.date("*t"), location = atm, startingBalance = res, finalBalance = res}}
  645.                 newSession = false
  646.             else
  647.                 transActionList[1].finalBalance = res
  648.             end
  649.             disk.setLabel(drive, "ID:".. acc.." $".. tostring(res))
  650.             clear(backgroundColour, true, true, acc)
  651.             term.setBackgroundColor(backgroundColour)
  652.             term.setTextColor(colours.lime)
  653.             writeCenter("$".. res, 5)
  654.             if (coinValue ~= 1) then
  655.                 writeCenter("In coins(3dp): ".. (math.floor((tonumber(res) / coinValue) * 100) / 100), 6)
  656.             end
  657.             for _, v in pairs(mainButtons) do
  658.                 drawButton(v)
  659.             end
  660.             if (enableReceipt) then
  661.                 drawButton(receiptButton)
  662.             end
  663.         else
  664.             clear(backgroundColour, false, true, -1)
  665.             term.setBackgroundColor(backgroundColour)
  666.             term.setTextColor(1)
  667.             writeCenter("Retrieving balance ID: ".. acc, 9)
  668.             pin = ""
  669.             term.setBackgroundColor(backgroundColour)
  670.             term.setTextColor(colours.red)
  671.             writeCenter(res, 10)
  672.             sleep(3)
  673.  
  674.             cleanUp()
  675.             disk.eject(drive)
  676.         end
  677.     elseif scrn == 3 then
  678.         screen = 3
  679.         term.setCursorBlink(false)
  680.         clear(backgroundColour, true, true, acc)
  681.         term.setBackgroundColor(backgroundColour)
  682.         term.setTextColor(1)
  683.         writeCenter("Please insert coins into dropper", 5)
  684.         writeCenter("then click done", 6)
  685.         drawButton(doneButton)
  686.     elseif scrn == 4 then
  687.         screen = 4
  688.         clear(backgroundColour, true, true, acc)
  689.         term.setBackgroundColor(backgroundColour)
  690.         term.setTextColor(1)
  691.         writeCenter("Please enter the ammount of coins", 5)
  692.         writeCenter("you want to withdraw", 6)
  693.  
  694.         if withdrawFee > 0 then
  695.             term.setCursorPos(20, 10)
  696.             term.write("Fee: 0 (".. (100 * withdrawFee).. "%)")
  697.             term.setCursorPos(20, 11)
  698.             term.write("Res: 0")
  699.         end
  700.  
  701.         term.setCursorPos(20, 9)
  702.         term.setBackgroundColor(backgroundColour)
  703.         term.setTextColor(1)
  704.         term.write("Amm: ")
  705.        
  706.         term.setCursorBlink(true)
  707.         padAmm = ""
  708.     elseif scrn == 5 then
  709.         screen = 5
  710.         clear(backgroundColour, true, true, acc)
  711.         term.setBackgroundColor(backgroundColour)
  712.         term.setTextColor(1)
  713.         writeCenter("Please enter the ammount of currency", 5)
  714.         writeCenter("you want to transfer", 6)
  715.        
  716.         if transferFee > 0 then
  717.             term.setCursorPos(20, 10)
  718.             term.write("Fee $0 (".. (100 * transferFee).. "%)")
  719.             term.setCursorPos(20, 11)
  720.             term.write("Res $0")
  721.         end
  722.  
  723.         term.setCursorPos(20, 9)
  724.         term.setBackgroundColor(backgroundColour)
  725.         term.setTextColor(1)
  726.         term.write("Amm $")
  727.  
  728.         term.setCursorBlink(true)
  729.         padAmm = ""
  730.     elseif scrn == 6 then
  731.         screen = 6
  732.         clear(backgroundColour, true, true, acc)
  733.         term.setBackgroundColor(backgroundColour)
  734.         term.setTextColor(1)
  735.         writeCenter("Please enter the account number you", 5)
  736.         writeCenter("want to transfer to", 6)
  737.  
  738.         term.setCursorPos(20, 9)
  739.         term.setBackgroundColor(backgroundColour)
  740.         term.setTextColor(1)
  741.         term.write("Acc: ")
  742.  
  743.         term.setCursorBlink(true)
  744.         padAcc = ""
  745.     elseif scrn == 7 then
  746.         screen = 7
  747.         term.setCursorBlink(false)
  748.         clear(backgroundColour, true, true, -1)
  749.         term.setBackgroundColor(backgroundColour)
  750.         term.setTextColor(1)
  751.         writeCenter("Please insert card for new account", 9)
  752.     elseif scrn == 8 then
  753.         screen = 8
  754.         clear(backgroundColour, true, true, -1)
  755.         term.setBackgroundColor(backgroundColour)
  756.         term.setTextColor(colours.lime)
  757.         writeCenter("ID: ".. acc, 5)
  758.         term.setCursorPos(16, 9)
  759.         term.setTextColor(1)
  760.         term.write("New PIN: ")
  761.  
  762.         term.setCursorBlink(true)
  763.         pin = ""
  764.     elseif scrn == 9 then
  765.         screen = 9
  766.         term.setCursorBlink(false)
  767.         clear(backgroundColour, false, true, acc)
  768.         term.setBackgroundColor(backgroundColour)
  769.         term.setTextColor(1)
  770.         writeCenter("Printing receipt", 9)
  771.     end
  772. end
  773.  
  774. function checkX(bX, bY)
  775.     if (bX == 49 and bY == 17) then
  776.         return true
  777.     end
  778. end
  779.  
  780. --Setup--
  781. rednet.open(bankSide)
  782. drawScreen(0)
  783.  
  784. --MainLoop--
  785. while true do
  786.     event = {os.pullEvent()}
  787.     if (event[1] == "terminate") then
  788.         if (redstone.getInput("right")) then
  789.             return
  790.         end
  791.     elseif (event[1] == "disk") then
  792.         if (event[2] == drive) then --Only respond to messages from the configured disk drive
  793.             acc = disk.getID(drive)
  794.             if acc ~= nil then
  795.                 if (screen == 0) then
  796.                     drawScreen(1)
  797.                 elseif (screen == 7) then
  798.                     drawScreen(8)
  799.                 else --Something weird has happened
  800.                     cleanUp()
  801.                     disk.eject(drive)
  802.                 end
  803.             end
  804.         end
  805.     elseif (event[1] == "disk_eject") then
  806.         if (event[2] == drive) then --Only respond to messages from the configured disk drive
  807.             cleanUp()
  808.         end
  809.     elseif (event[1] == "mouse_click") then
  810.         if screen == 0 then
  811.             if (allowSignUp) then
  812.                 if checkButton(event[3], event[4], createButton) then
  813.                     drawScreen(7)
  814.                 end
  815.             end
  816.         elseif (screen == 1) then
  817.             if (checkX(event[3], event[4])) then
  818.                 cleanUp()
  819.                 disk.eject(drive)
  820.             end
  821.         elseif screen == 2 then
  822.             if (checkX(event[3], event[4])) then
  823.                 cleanUp()
  824.                 disk.eject(drive)
  825.             elseif checkButton(event[3], event[4], receiptButton) then
  826.                 if (enableReceipt) then
  827.                     disk.eject(drive)
  828.                     if (transActionList[1] ~= nil) then
  829.                         transActionList[1].sessionEnd = os.date("*t")
  830.                         local result, response = printReceipt(transActionList)
  831.                         if (not result) then
  832.                             term.setTextColor(colours.red)
  833.                             writeCenter(response, 10)
  834.                             sleep(3)
  835.                         end
  836.                         transActionList[1].receipt = true
  837.                         transActionList[1].receiptSuccess = result
  838.                         transActionList[1].receiptResult = response
  839.                         if (enableLogging) then
  840.                             local logLine = json.encode(transActionList)
  841.                             local log = fs.open(logFile, "a")
  842.                             log.writeLine(logLine)
  843.                             log.close()
  844.                         end
  845.                     end
  846.                     transActionList ={}
  847.  
  848.                     pin = ""
  849.                     padAmm = ""
  850.                     padAcc = ""
  851.                     afterFees = 0
  852.                     tranFee = 0
  853.                     newSession = true
  854.                     drawScreen(0)
  855.                 end
  856.             else
  857.                 for _, v in pairs(mainButtons) do
  858.                     if checkButton(event[3], event[4], v) then
  859.                         if v[1] == "Deposit" then
  860.                             drawScreen(3)
  861.                         elseif v[1] == "Withdraw" then
  862.                             drawScreen(4)
  863.                         elseif v[1] == "Transfer" then
  864.                             drawScreen(5)
  865.                         end
  866.                     end
  867.                 end
  868.             end
  869.         elseif screen == 3 then
  870.             if (checkX(event[3], event[4])) then
  871.                 drawScreen(2)
  872.             else
  873.                 if checkButton(event[3], event[4], doneButton) then
  874.                     isDep, dep = pullapideposit()
  875.                     clear(backgroundColour, false, true, acc)
  876.                     term.setBackgroundColor(backgroundColour)
  877.                     if (isDep) then
  878.                         term.setTextColor(1)
  879.                         writeCenter("Depositing $".. (dep * coinValue).. " into you account", 9)
  880.                         local isDep, dep2 = deposit(acc, (dep * coinValue), atm, pin)
  881.                         local temp = { type = 0, date = os.date("*t"), amount = (dep * coinValue), fee = 0, success = isDep, result = tostring(dep2)}
  882.                         table.insert(transActionList, temp)
  883.                         if (isDep) then
  884.                             disk.setLabel(drive, "$".. tostring(dep2))
  885.                             term.setTextColor(colours.green)
  886.                             writeCenter("Success", 10)
  887.                         else
  888.                             term.setTextColor(colours.red)
  889.                             writeCenter(dep2, 10)
  890.                             pullapiwithdraw(dep)
  891.                         end
  892.                     else
  893.                         term.setTextColor(colours.red)
  894.                         writeCenter(dep, 9)
  895.                     end
  896.                     sleep(3)
  897.                     drawScreen(2)
  898.                 end
  899.             end
  900.         elseif (screen == 4 or screen == 5 or screen == 6) then
  901.             if (checkX(event[3], event[4])) then
  902.                 drawScreen(2)
  903.             end
  904.         elseif (screen == 7 or screen == 8) then
  905.             if (checkX(event[3], event[4])) then
  906.                 cleanUp()
  907.                 disk.eject(drive)
  908.             end
  909.         end
  910.     elseif (event[1] == "char" or event[1] == "key") then
  911.         if screen == 1 then
  912.             local isKey, keyNum = pinpad(event[2])
  913.             if (isKey) then
  914.                 if keyNum == 10 then
  915.                     if string.len(pin) > 0 then
  916.                         pin = string.sub(pin, 1, string.len(pin) - 1)
  917.                         term.setBackgroundColor(backgroundColour)
  918.                         term.setTextColor(1)
  919.                         term.setCursorPos(20, 9)
  920.                         term.clearLine()
  921.                         term.write("PIN: ".. string.sub("****", 1, string.len(pin)))
  922.                     end
  923.                 elseif keyNum == 11 then
  924.                     if string.len(pin) == 5 then
  925.                         drawScreen(2)
  926.                     end
  927.                 elseif keyNum >= 0 and keyNum <= 9 then
  928.                     if string.len(pin) < 5 then
  929.                         pin = pin.. keyNum
  930.                         term.setBackgroundColor(backgroundColour)
  931.                         term.setTextColor(1)
  932.                         term.setCursorPos(24 + string.len(pin), 9)
  933.                         term.write("*")
  934.                     end
  935.                 end
  936.             end
  937.         elseif screen == 4 then
  938.             local isKey, keyNum = pinpad(event[2])
  939.             if (isKey) then
  940.                 if keyNum == 10 then
  941.                     if string.len(padAmm) > 0 then
  942.                         padAmm = string.sub(padAmm, 1, string.len(padAmm) - 1)
  943.                         term.setBackgroundColor(backgroundColour)
  944.                         term.setTextColor(1)
  945.  
  946.                         if withdrawFee > 0 then
  947.                             term.setCursorPos(20, 10)
  948.                             term.clearLine()
  949.                             if tonumber(padAmm) then
  950.                                 term.write("Fee: ".. math.floor((tonumber(padAmm) * withdrawFee) + 0.5).." (".. (100 * withdrawFee).. "%)")
  951.                                 term.setCursorPos(20, 11)
  952.                                 term.clearLine()
  953.                                 afterFees = (tonumber(padAmm) - math.floor((tonumber(padAmm) * withdrawFee) + 0.5))
  954.                                 term.write("Res: ".. afterFees)
  955.                             else
  956.                                 term.write("Fee: 0 (".. (100 * withdrawFee).. "%)")
  957.                                 term.setCursorPos(20, 11)
  958.                                 term.clearLine()
  959.                                 term.write("Res: 0")
  960.                                 afterFees = 0
  961.                             end
  962.                         end
  963.  
  964.                         term.setCursorPos(20, 9)
  965.                         term.clearLine()
  966.                         term.write("Amm: ".. padAmm)
  967.                     end
  968.                 elseif keyNum == 11 then
  969.                     if withdrawFee == 0 then
  970.                         afterFees = tonumber(padAmm)
  971.                     end
  972.                     if afterFees > 0 then
  973.                         term.setCursorBlink(false)
  974.                         local temp = { type = 1, date = os.date("*t"), amount = (tonumber(padAmm) * coinValue) }
  975.                         if withdrawFee > 0 then
  976.                             temp.fee = (math.floor((tonumber(padAmm) * withdrawFee) + 0.5) * coinValue)
  977.                         else
  978.                             temp.fee = 0
  979.                         end
  980.                         clear(backgroundColour, false, true, acc)
  981.                         term.setBackgroundColor(backgroundColour)
  982.                         if (afterFees == 0) then
  983.                             temp.success = false
  984.                             temp.result = "Withdraw more than 0"
  985.                             term.setTextColor(colours.red)
  986.                             writeCenter("Withdraw more than 0", 9)
  987.                         elseif (afterFees > 576) then
  988.                             temp.success = false
  989.                             temp.result = "Withdrawal maximum 576"
  990.                             term.setTextColor(colours.red)
  991.                             writeCenter("Withdrawal maximum 576", 9)
  992.                         elseif (getStored() < afterFees) then
  993.                             temp.success = false
  994.                             temp.result = "Not enough stored"
  995.                             term.setTextColor(colours.red)
  996.                             writeCenter("Not enough stored", 9)
  997.                         else
  998.                             term.setTextColor(1)
  999.                             writeCenter("Withdrawing $".. (tonumber(padAmm) * coinValue).. " from you account", 9)
  1000.                             local isWith, with = withdraw(acc, (tonumber(padAmm) * coinValue), atm, pin)
  1001.                             if (isWith) then
  1002.                                 disk.setLabel(drive, "$".. tostring(with))
  1003.                                 local isWith2, with2 = pullapiwithdraw(afterFees)
  1004.                                 if (isWith2) then
  1005.                                     temp.success = true
  1006.                                     temp.result = tostring(with)
  1007.                                     term.setTextColor(colours.green)
  1008.                                     writeCenter("Success", 10)
  1009.                                 else
  1010.                                     term.setTextColor(colours.red)
  1011.                                     writeCenter(with2.. "Returning money", 10)
  1012.                                     local isDep2, dep3 = deposit(acc, (tonumber(padAmm) * coinValue), atm, pin)
  1013.                                     if (isDep2) then
  1014.                                         temp.success = false
  1015.                                         temp.result = "Refund successful"
  1016.                                         disk.setLabel(drive, "$".. tostring(dep3))
  1017.                                         term.setTextColor(colours.green)
  1018.                                         writeCenter("Refund successful", 11)
  1019.                                     else
  1020.                                         temp.success = false
  1021.                                         temp.result = tostring(dep3)
  1022.                                         term.setTextColor(colours.red)
  1023.                                         writeCenter(dep3, 11)
  1024.                                     end
  1025.                                 end
  1026.                             else
  1027.                                 temp.success = false
  1028.                                 temp.result = tostring(with)
  1029.                                 term.setTextColor(colours.red)
  1030.                                 writeCenter(with, 10)
  1031.                             end
  1032.                         end
  1033.                         table.insert(transActionList, temp)
  1034.                         sleep(3)
  1035.                         drawScreen(2)
  1036.                     end
  1037.                 elseif keyNum >= 0 and keyNum <= 9 then
  1038.                     if string.len(padAmm) < 3 then --Max is 576 so max of 3 char
  1039.                         padAmm = padAmm.. keyNum
  1040.                         term.setBackgroundColor(backgroundColour)
  1041.                         term.setTextColor(1)
  1042.  
  1043.                         if withdrawFee > 0 then
  1044.                             term.setCursorPos(20, 10)
  1045.                             term.clearLine()
  1046.                             term.write("Fee: ".. math.floor((tonumber(padAmm) * withdrawFee) + 0.5).." (".. (100 * withdrawFee).. "%)")
  1047.                             term.setCursorPos(20, 11)
  1048.                             term.clearLine()
  1049.                             afterFees = (tonumber(padAmm) - math.floor((tonumber(padAmm) * withdrawFee) + 0.5))
  1050.                             term.write("Res: ".. afterFees)
  1051.                         end
  1052.  
  1053.                         term.setCursorPos(24 + string.len(padAmm), 9)
  1054.                         term.write(keyNum)
  1055.                     end
  1056.                 end
  1057.             end
  1058.         elseif screen == 5 then
  1059.             local isKey, keyNum = pinpad(event[2])
  1060.             if (isKey) then
  1061.                 if keyNum == 10 then
  1062.                     if string.len(padAmm) > 0 then
  1063.                         padAmm = string.sub(padAmm, 1, string.len(padAmm) - 1)
  1064.                         term.setBackgroundColor(backgroundColour)
  1065.                         term.setTextColor(1)
  1066.  
  1067.                         if transferFee > 0 then
  1068.                             term.setCursorPos(20, 10)
  1069.                             term.clearLine()
  1070.                             if tonumber(padAmm) then
  1071.                                 tranFee = (math.floor((tonumber(padAmm) * transferFee) + 0.5))
  1072.                                 term.write("Fee $".. tranFee.." (".. (100 * transferFee).. "%)")
  1073.                                 term.setCursorPos(20, 11)
  1074.                                 term.clearLine()
  1075.                                 afterFees = (tonumber(padAmm) - tranFee)
  1076.                                 term.write("Res $".. afterFees)
  1077.                             else
  1078.                                 tranFee = 0
  1079.                                 term.write("Fee $0 (".. (100 * transferFee).. "%)")
  1080.                                 term.setCursorPos(20, 11)
  1081.                                 term.clearLine()
  1082.                                 term.write("Res $0")
  1083.                                 afterFees = 0
  1084.                             end
  1085.                         end
  1086.  
  1087.                         term.setCursorPos(20, 9)
  1088.                         term.clearLine()
  1089.                         term.write("Amm $".. padAmm)
  1090.                     end
  1091.                 elseif keyNum == 11 then
  1092.                     if transferFee == 0 then
  1093.                         afterFees = tonumber(padAmm)
  1094.                     end
  1095.                     if afterFees > 0 then
  1096.                         term.setCursorBlink(false)
  1097.                         if (tonumber(padAmm) == 0) then
  1098.                             clear(backgroundColour, false, true, acc)
  1099.                             term.setBackgroundColor(backgroundColour)
  1100.                             term.setTextColor(colours.red)
  1101.                             writeCenter("Transfer must be greater than $0", 9)
  1102.                             sleep(3)
  1103.                             drawScreen(2)
  1104.                         elseif (tonumber(padAmm) > transferMax) then
  1105.                             clear(backgroundColour, false, true, acc)
  1106.                             term.setBackgroundColor(backgroundColour)
  1107.                             term.setTextColor(colours.red)
  1108.                             writeCenter("Transfer maximum is $".. transferMax, 9)
  1109.                             sleep(3)
  1110.                             drawScreen(2)
  1111.                         else
  1112.                             drawScreen(6)
  1113.                         end
  1114.                     end
  1115.                 elseif keyNum >= 0 and keyNum <= 9 then
  1116.                     if string.len(padAmm) < string.len(tostring(transferMax)) then
  1117.                         padAmm = padAmm.. keyNum
  1118.                         term.setBackgroundColor(backgroundColour)
  1119.                         term.setTextColor(1)
  1120.  
  1121.                         if transferFee > 0 then
  1122.                             term.setCursorPos(20, 10)
  1123.                             term.clearLine()
  1124.                             tranFee = (math.floor((tonumber(padAmm) * transferFee) + 0.5))
  1125.                             term.write("Fee $".. tranFee.." (".. (100 * transferFee).. "%)")
  1126.                             term.setCursorPos(20, 11)
  1127.                             term.clearLine()
  1128.                             afterFees = (tonumber(padAmm) - tranFee)
  1129.                             term.write("Res $".. afterFees)
  1130.                         end
  1131.  
  1132.                         term.setCursorPos(24 + string.len(padAmm), 9)
  1133.                         term.write(keyNum)
  1134.                     end
  1135.                 end
  1136.             end
  1137.         elseif screen == 6 then
  1138.             local isKey, keyNum = pinpad(event[2])
  1139.             if (isKey) then
  1140.                 if keyNum == 10 then
  1141.                     if string.len(padAcc) > 0 then
  1142.                         padAcc = string.sub(padAcc, 1, string.len(padAcc) - 1)
  1143.                         term.setBackgroundColor(backgroundColour)
  1144.                         term.setTextColor(1)
  1145.                         term.setCursorPos(20, 9)
  1146.                         term.clearLine()
  1147.                         term.write("Acc: ".. padAcc)
  1148.                     end
  1149.                 elseif keyNum == 11 then
  1150.                     if transferFee == 0 then
  1151.                         tranFee = 0
  1152.                     end
  1153.                     term.setCursorBlink(false)
  1154.                     clear(backgroundColour, false, true, acc)
  1155.                     term.setBackgroundColor(backgroundColour)
  1156.                     term.setTextColor(1)
  1157.                     writeCenter("Transfering $".. afterFees.. " from you account", 9)
  1158.                     local isTras, tras = transfer(acc, tonumber(padAcc), afterFees, atm, pin)
  1159.                     local temp = { type = 2, date = os.date("*t"), amount = tonumber(padAmm), fee = tranFee, payee = tonumber(padAcc) }
  1160.                     if (isTras) then
  1161.                         disk.setLabel(drive, "$".. tostring(tras))
  1162.                         term.setTextColor(colours.green)
  1163.                         writeCenter("Success", 10)
  1164.                         if (transferFee > 0) then
  1165.                             term.setTextColor(1)
  1166.                             if (tranFee > 0) then
  1167.                                 writeCenter("Withdrawing $"..tranFee .. " transfer fee (".. (100 * transferFee).. "%)", 11)
  1168.                                 local isTras2, tras2 = withdraw(acc, tranFee, atm, pin)
  1169.                                 if (isTras2) then
  1170.                                     temp.success = true
  1171.                                     temp.result = tostring(tras2)
  1172.                                     disk.setLabel(drive, "$".. tostring(tras2))
  1173.                                     term.setTextColor(colours.green)
  1174.                                     writeCenter("Success", 12)
  1175.                                 else
  1176.                                     temp.success = false
  1177.                                     temp.result = "Fee-".. tostring(tras2)
  1178.                                     term.setTextColor(colours.red)
  1179.                                     writeCenter(tras2, 12)
  1180.                                 end
  1181.                             else
  1182.                                 temp.success = true
  1183.                                 temp.result = tostring(tras)
  1184.                                 writeCenter("No transfer fee", 11)
  1185.                             end
  1186.                         else
  1187.                             temp.success = true
  1188.                             temp.result = tostring(tras)
  1189.                         end
  1190.                     else
  1191.                         temp.success = false
  1192.                         temp.result = tostring(tras)
  1193.                         term.setTextColor(colours.red)
  1194.                         writeCenter(tras, 10)
  1195.                     end
  1196.                     table.insert(transActionList, temp)
  1197.                     sleep(3)
  1198.                     drawScreen(2)
  1199.                 elseif keyNum >= 0 and keyNum <= 9 then
  1200.                     if string.len(padAcc) < 9 then --Gives a billion possilbe account numbers. More than you would ever need
  1201.                         padAcc = padAcc.. keyNum
  1202.                         term.setBackgroundColor(backgroundColour)
  1203.                         term.setTextColor(1)
  1204.                         term.setCursorPos(24 + string.len(padAcc), 9)
  1205.                         term.write(keyNum)
  1206.                     end
  1207.                 end
  1208.             end
  1209.         elseif screen == 8 then
  1210.             local isKey, keyNum = pinpad(event[2])
  1211.             if (isKey) then
  1212.                 if keyNum == 10 then
  1213.                     if string.len(pin) > 0 then
  1214.                         pin = string.sub(pin, 1, string.len(pin) - 1)
  1215.                         term.setBackgroundColor(backgroundColour)
  1216.                         term.setTextColor(1)
  1217.                         term.setCursorPos(16, 9)
  1218.                         term.clearLine()
  1219.                         term.write("New PIN: ".. string.sub("****", 1, string.len(pin)))
  1220.                     end
  1221.                 elseif keyNum == 11 then
  1222.                     if string.len(pin) == 5 then
  1223.                         term.setCursorBlink(false)
  1224.                         clear(backgroundColour, false, true, -1)
  1225.                         term.setBackgroundColor(backgroundColour)
  1226.                         term.setTextColor(1)
  1227.                         writeCenter("Creating account ID: ".. acc, 9)
  1228.                         local suc, res = create(acc, atm, pin)
  1229.                         if (suc) then
  1230.                             disk.setLabel(drive, "$0")
  1231.                             term.setBackgroundColor(backgroundColour)
  1232.                             term.setTextColor(colours.green)
  1233.                             writeCenter("Success", 10)
  1234.                             sleep(3)
  1235.                             drawScreen(2)
  1236.                         else
  1237.                             pin = ""
  1238.                             term.setBackgroundColor(backgroundColour)
  1239.                             term.setTextColor(colours.red)
  1240.                             writeCenter(res, 10)
  1241.                             sleep(3)
  1242.                             cleanUp()
  1243.                             disk.eject(drive)
  1244.                         end
  1245.                     end
  1246.                 elseif keyNum >= 0 and keyNum <= 9 then
  1247.                     if string.len(pin) < 5 then
  1248.                         pin = pin.. keyNum
  1249.                         term.setBackgroundColor(backgroundColour)
  1250.                         term.setTextColor(1)
  1251.                         term.setCursorPos(24 + string.len(pin), 9)
  1252.                         term.write("*")
  1253.                     end
  1254.                 end
  1255.             end
  1256.         end
  1257.     end
  1258. end
Advertisement
Add Comment
Please, Sign In to add comment