Advertisement
buttercheetah

Don Tablet OS

Aug 7th, 2021 (edited)
1,363
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 18.08 KB | None | 0 0
  1. local component = require("component")
  2. local computer = require("computer")
  3. local event = require("event")
  4. local inet = require("internet")
  5. local osv = "1.051"
  6. function prdon ()
  7.     print("           __n__n__\n    .------`-\00/-'\n   /  ##  ## (oo)\n  /  ## __   ./\n     |//YY  |/\n     |||   |||")
  8. end
  9. function prdontab ()
  10.     print("---------------------------------")
  11.     print("       Don Tablet OS             ")
  12.     print("---------------------------------")
  13. end
  14. function randomad ()
  15.   local adc = math.random(0, 5)
  16.   if (adc == 0) then
  17.     print("Want your ad here? Go to the Don Shack and ask us about our ad system!")
  18.   elseif (adc == 1) then
  19.     print("Have you ever needed an item but you cant spend the time to get it yourself?\nThen use The Don ordering system! select option 1 at your main menu today!")
  20.   elseif (adc == 2) then
  21.     print("Have you ever wants a computer program like your neighbor bob?\nThen order from Don Shack! select option 3 at your main menu today!")
  22.   elseif (adc == 3) then
  23.     print("go to the record store and buy songs please my family needs food!")
  24.   elseif (adc == 4) then
  25.     print("Want your own ordering app for your store?\nSelect Don shack under shops!")
  26.   elseif (adc == 5) then
  27.     print("Want some pizza? Order some now! Select Don Pizzeria under shops!")
  28.   end
  29.   print("---------------------------------")
  30. end
  31. function checkforupdate ()
  32.   local response = inet.request("http://secondary.infinity-servers.com:9000/version/get", "0")
  33.   local body = ""
  34.   for chunk in response do
  35.     body = body .. chunk
  36.   end
  37.   if (body == osv) then
  38.     print("OS is up to date")
  39.   else
  40.     print("Current OS:" .. osv .. " Available OS:" .. body)
  41.   end
  42. end
  43. function getnewannouncements ()
  44.   local response = inet.request("http://secondary.infinity-servers.com:9000/announcement/get", "0")
  45.   local body = ""
  46.   for chunk in response do
  47.     body = body .. chunk
  48.   end
  49.   if (body == "") then
  50.     io.write()
  51.   else
  52.     print(body)
  53.   end
  54. end
  55. function printexception ()
  56.   print("Current exemptions:")
  57.   print("No Pets from the mods inventory pets!")
  58.   print("No Red Matter or Dark Matter!")
  59.   print("Nothing from Mystical Agriculture")
  60.   print("Nothing from Evilcraft")
  61.   print("No Fluids")
  62.   print("")
  63. end
  64. function adminstuff ()
  65.   tmprun2 = "True"
  66.   while (tmprun2 == "True") do
  67.     os.execute("cls")
  68.     print("select and option")
  69.     print("1) Make new OS Current Version")
  70.     print("2) Make new OS an input version")
  71.     print("3) New Announcement")
  72.     print("4) back")
  73.     local choice = io.read()
  74.     if (choice == "1") then
  75.       local response = inet.request("http://secondary.infinity-servers.com:9000/version/set", tostring(osv))
  76.       local body = ""
  77.       for chunk in response do
  78.         body = body .. chunk
  79.       end
  80.       print(body)
  81.       os.sleep(5)
  82.     elseif (choice == "2") then
  83.       print("current OS version:" .. osv)
  84.       print("enter new OS version")
  85.       local temp = io.read()
  86.       local response = inet.request("http://secondary.infinity-servers.com:9000/version/set", tostring(temp))
  87.       local body = ""
  88.       for chunk in response do
  89.         body = body .. chunk
  90.       end
  91.     elseif (choice == "3") then
  92.       print("enter new Announcement")
  93.       local temp = io.read()
  94.       local response = inet.request("http://secondary.infinity-servers.com:9000/announcement/set", tostring(temp))
  95.       local body = ""
  96.       for chunk in response do
  97.         body = body .. chunk
  98.       end
  99.     elseif (choice == "4") then
  100.       tmprun2 = "False"
  101.     end
  102.   end
  103. end
  104.  
  105. local tname = ""
  106. runcheck = "True"
  107. while (runcheck == "True") do
  108.   os.execute("cls")
  109.   print("Welcome " .. tname)
  110.   prdontab()
  111.   prdon()
  112.   print("Please press enter to login.")
  113.   local e = {event.pull("key_down")}
  114.   for k, v in pairs(e) do
  115.     if (k == 5) then
  116.       tname = v
  117.     end
  118.   end
  119.   local response = inet.request("http://secondary.infinity-servers.com:9000/databaseget/" .. tname)
  120.   local body = ""
  121.   for chunk in response do
  122.     body = body .. chunk
  123.   end
  124.   if (body == "User not in system. Make sure it was spelled correctly") then
  125.     print("User not in system. Make contact buttercheetah!")
  126.     os.sleep(2)
  127.   else
  128.     print("Login Succsesfull")
  129.     os.sleep(1)
  130.     runcheck = "False"
  131.   end
  132. end
  133. while (1 == 1) do
  134.   os.execute("cls")
  135.   print("Welcome " .. tname)
  136.   checkforupdate()
  137.   getnewannouncements()
  138.   prdontab()
  139.   prdon()
  140.   randomad()
  141.   print("1) The Don Services")
  142.   print("2) Shops")
  143.   print("3) Mobile Banking")
  144.   print("4) settings")
  145.   local usersel = io.read()
  146.   if (usersel == "admin") then
  147.     adminstuff()
  148.   elseif (usersel == "1") then
  149.     local tmprun4 = "True"
  150.     while (tmprun4 == "True") do
  151.       os.execute("cls")
  152.       print("Welcome " .. tname)
  153.       prdontab()
  154.       prdon()
  155.       print("1) Order")
  156.       print("2) Message Don")
  157.       print("3) Message other player")
  158.       print("4) Read your messages")
  159.       print("5) back")
  160.       local choice = io.read()
  161.       if (choice == "1") then
  162.         os.execute("cls")
  163.         print("Thank you for your intrest in the Don Ordering System!\nWould you like to take a minute to read our item exemptions?")
  164.         print("Y/n")
  165.         local readsel = io.read()
  166.         if (readsel == n) then
  167.           os.execute("cls")
  168.         else
  169.           os.execute("cls")
  170.           printexception()
  171.           print("click enter to return")
  172.           io.read()
  173.           os.execute("cls")
  174.         end
  175.         print("Please input the item wanted! ex: apple")
  176.         local titem = io.read()
  177.         print("Please input the quantity wanted! ex: 10 stacks or 5 items")
  178.         local tquantity = io.read()
  179.         print("Please input delivery location! ex: My base or x=123 z=456")
  180.         local tloc = io.read()
  181.         print("Please input any notes. leave blank if none")
  182.         local tnote = io.read()
  183.         if (tnote == "") then
  184.           tnote = "none"
  185.         end
  186.         os.execute("cls")
  187.         prdontab()
  188.         print("Getting ready to order " .. tquantity .. " of " .. titem .. " at " .. tloc .. " With the note: " .. tnote)
  189.         print("please note you CANNOT cancel this order. would you like to continue?\nY/n")
  190.         local confirmitation = io.read()
  191.         if (confirmitation == "n") then
  192.           print("Canceling order")
  193.         else
  194.           local response = inet.request("http://secondary.infinity-servers.com:9000/webhook/mcorder", tostring(tname .. " ordered " .. tquantity .. " of " .. titem .. " at " .. tloc ..  " With the note: " .. tnote))
  195.           local body = ""
  196.           for chunk in response do
  197.             body = body .. chunk
  198.           end
  199.           print("Sent Order")
  200.         end
  201.       elseif (choice == "2") then
  202.         os.execute("cls")
  203.         print("Please input your message!")
  204.         local tmess = io.read()
  205.         os.execute("cls")
  206.         prdontab()
  207.         print("Getting to send: " .. tname .. ": " .. tmess)
  208.         print("please note you CANNOT unsend this message. would you like to continue?\nY/n")
  209.         local confirmitation = io.read()
  210.         if (confirmitation == "n") then
  211.           print("Canceling")
  212.         else
  213.           local response = inet.request("http://secondary.infinity-servers.com:9000/webhook/mcorder", tostring(tname .. ": " .. tmess))
  214.           local body = ""
  215.           for chunk in response do
  216.             body = body .. chunk
  217.           end
  218.           print("Sent Message!")
  219.         end
  220.       elseif (choice == "3") then
  221.         os.execute("cls")
  222.         print("Please input name of player you wish to send a message to")
  223.         local sname = io.read()
  224.         local response = inet.request("http://secondary.infinity-servers.com:9000/databaseget/" .. sname)
  225.         local body = ""
  226.         for chunk in response do
  227.           body = body .. chunk
  228.         end
  229.         if (body == "User not in system. Make sure it was spelled correctly") then
  230.           print(body)
  231.           os.sleep(2)
  232.         else
  233.           os.execute("cls")
  234.           print("Please input your message")
  235.           local smessage = io.read()
  236.           local response = inet.request("http://secondary.infinity-servers.com:9000/message/set", tostring(sname .. "|" .. tname .. ": " .. smessage))
  237.           local body = ""
  238.           for chunk in response do
  239.             body = body .. chunk
  240.           end
  241.         end
  242.       elseif (choice == "4") then
  243.         os.execute("cls")
  244.         print("Messages:")
  245.         local response = inet.request("http://secondary.infinity-servers.com:9000/message/get", tostring(tname))
  246.         local messages = ""
  247.         for chunk in response do
  248.           messages = messages .. chunk
  249.         end
  250.         for i=0,#messages,1 do
  251.           tmp = string.sub(messages,i,i)
  252.           if (tmp == "|") then
  253.             print("")
  254.           else
  255.             io.write(tmp)
  256.           end
  257.         end
  258.         print("To erase your messages enter [1] otherwise press enter")
  259.         local tsel = io.read()
  260.         if (tsel == "1") then
  261.           local response = inet.request("http://secondary.infinity-servers.com:9000/message/delete", tostring(tname))
  262.         end
  263.       elseif (choice == "5") then
  264.         tmprun4 = "False"
  265.       end
  266.     end
  267.   elseif (usersel == "2") then
  268.     local tmprun4 = "True"
  269.     while (tmprun4 == "True") do
  270.       os.execute("cls")
  271.       print("Welcome " .. tname)
  272.       prdontab()
  273.       prdon()
  274.       print("1) Don Shack")
  275.       print("2) PapaDons")
  276.       print("3) Dragons Record Store")
  277.       print("9) back")
  278.       local choice = io.read()
  279.       if (choice == "1") then
  280.         os.execute("cls")
  281.         print("Please input your order! \nex: a program to open and close a iron door witha password")
  282.         local tmess = io.read()
  283.         os.execute("cls")
  284.         prdontab()
  285.         print("Getting to order: " .. tname .. " wants a program to: " .. tmess)
  286.         print("please note you CANNOT unsend this order. would you like to continue?\nY/n")
  287.         local confirmitation = io.read()
  288.         if (confirmitation == "n") then
  289.           print("Canceling")
  290.         else
  291.           local response = inet.request("http://secondary.infinity-servers.com:9000/webhook/mcorder", tostring(tname .. " wants a program to: " .. tmess))
  292.           local body = ""
  293.           for chunk in response do
  294.             body = body .. chunk
  295.           end
  296.           print("Sent Message!")
  297.         end
  298.       elseif (choice == "2") then
  299.         local tmprun2 = "True"
  300.         local pizzas = ""
  301.         local totalcost = 0
  302.         while (tmprun2 == "True") do
  303.           os.execute("cls")
  304.           io.write("Your cart: ")
  305.           if (pizzas == "") then
  306.             print("Empty")
  307.           else
  308.             print(pizzas)
  309.           end
  310.           print("Please select an option!")
  311.           print("1) Add Pizza")
  312.           print("2) Checkout")
  313.           print("3) Quit")
  314.           local choice = io.read()
  315.           if (choice == "1") then
  316.             local tmprun3 = "True"
  317.             while (tmprun3 == "True") do
  318.               os.execute("cls")
  319.               io.write("Your cart: ")
  320.               if (pizzas == "") then
  321.                 print("Empty")
  322.               else
  323.                 print(pizzas)
  324.               end
  325.               print("Please select an option!\nPlease Note once you add a pizza you wont be able to remove it\n")
  326.               print("1) Add Cheese Pizza      - $2")
  327.               print("2) Add Supreme Pizza     - $3")
  328.               print("3) Add Meat Feast Pizza  - $4")
  329.               print("4) Go back")
  330.               local choice = io.read()
  331.               if (choice == "1") then
  332.                 print("\nHow many pizzas would you like")
  333.                 local count = io.read("*l")
  334.                 pizzas = pizzas .. "Cheese Pizza x" .. count .. "|"
  335.                 totalcost = totalcost + 2
  336.               elseif (choice == "2") then
  337.                 print("\nHow many pizzas would you like")
  338.                 local count = io.read("*l")
  339.                 pizzas = pizzas .. "Supreme Pizza x" .. count .. "|"
  340.                 totalcost = totalcost + (count * 3)
  341.               elseif (choice == "3") then
  342.                 print("\nHow many pizzas would you like")
  343.                 local count = io.read("*l")
  344.                 pizzas = pizzas .. "Meat Feast Pizza x" .. count .. "|"
  345.                 totalcost = totalcost + 4
  346.               elseif (choice == "4") then
  347.                 tmprun3 = "False"
  348.               end
  349.             end
  350.           elseif (choice == "2") then
  351.             io.write("Your cart: ")
  352.             if (pizzas == "") then
  353.               print("Empty")
  354.             else
  355.               print(pizzas)
  356.             end
  357.             print("Total cost: " .. totalcost)
  358.             print("Is the total ok?")
  359.             print("NOTE: pressing y will immediatly charge your account and place the order.\nPressing n will immediatly cancel this transaction and kick you to the main menu")
  360.             print("\nY/n")
  361.             local choice = io.read()
  362.             if (choice == "n" or choice == "N") then
  363.               print("Canceling order.")
  364.               os.sleep(5)
  365.               tmprun2 = "False"
  366.             else
  367.               local response = inet.request("http://secondary.infinity-servers.com:9000/databaseset", tostring(tname .. "|Pizza purchase" .. "|1|" .. totalcost))
  368.               local body = ""
  369.               for chunk in response do
  370.                   body = body .. chunk
  371.               end
  372.               local response = inet.request("http://secondary.infinity-servers.com:9000/databaseset", tostring("Don|Don Pizza Payment" .. "|1|" .. -totalcost))
  373.               local body = ""
  374.               for chunk in response do
  375.                   body = body .. chunk
  376.               end
  377.               local response = inet.request("http://secondary.infinity-servers.com:9000/webhook/mcorder", tostring(tname .. " ordered " .. pizzas .. " !Note this order has been paid for!"))
  378.               local body = ""
  379.               for chunk in response do
  380.                 body = body .. chunk
  381.               end
  382.               tmprun2 = "False"
  383.             end
  384.           elseif (choice == "3") then
  385.             tmprun2 = "False"
  386.           end
  387.         end
  388.       elseif (choice == "3") then
  389.         os.execute("cls")
  390.         print("Please input the name of your song. \nNOTE: This is the name that will appear on the disk!")
  391.         local tdiskname = io.read()
  392.         os.execute("cls")
  393.         print("Please input the youtube URL. \nNOTE: press the ins or insert key to paste")
  394.         local tURL = io.read()
  395.         os.execute("cls")
  396.         prdontab()
  397.         print("Getting to send: " .. tname .. " Ordered the song (" .. tdiskname .. ")\nURL: " .. tURL)
  398.         print("\nplease note you CANNOT unsend this order.\nThe Don and his associates can not garentee the timely delivery of this order\nas this shop is not controlled by the Don.\nWould you like to continue?\nY/n")
  399.         local confirmitation = io.read()
  400.         if (confirmitation == "n") then
  401.           print("Canceling")
  402.         else
  403.           local response = inet.request("http://secondary.infinity-servers.com:9000/dragonrecordorder", tostring(tname .. " Ordered the song (" .. tdiskname .. ") URL: " .. tURL))
  404.           local body = ""
  405.           for chunk in response do
  406.             body = body .. chunk
  407.           end
  408.           print("Sent Message!")
  409.         end
  410.       elseif (choice == "9") then
  411.         tmprun4 = "False"
  412.       end
  413.     end
  414.   elseif (usersel == "3") then
  415.     local function getuserbal ()
  416.       local response = inet.request("http://secondary.infinity-servers.com:9000/databaseget/" .. tname)
  417.       local body = ""
  418.       for chunk in response do
  419.         body = body .. chunk
  420.       end
  421.       local Value = tonumber(body)
  422.       if (Value > 0) then
  423.         Value = -Value
  424.       elseif (Value < 0) then
  425.         Value = Value * -1
  426.       end
  427.       return Value
  428.     end
  429.     local tmprun2 = "True"
  430.     while (tmprun2 == "True") do
  431.       local cbal = getuserbal()
  432.       os.execute("cls")
  433.       print("Current account balance: " .. tostring(cbal))
  434.       print("1) Send money to another account")
  435.       print("2) return")
  436.       local choice = io.read()
  437.       if (choice == "1") then
  438.         if (cbal > tonumber(0)) then
  439.           print("Please input name of other account!")
  440.           local oac = io.read()
  441.           print("Please Input amount to transfer!\nNOTE:ONLY ENTER NUMBERS! If letters are written, many things may break.")
  442.           local transfer = io.read()
  443.           local response = inet.request("http://secondary.infinity-servers.com:9000/databaseget/" .. oac)
  444.           local body = ""
  445.           for chunk in response do
  446.             body = body .. chunk
  447.           end
  448.           if (body == "User not in system. Make sure it was spelled correctly") then
  449.             print(body)
  450.             os.sleep(2)
  451.           else
  452.             local response = inet.request("http://secondary.infinity-servers.com:9000/databaseset", tostring(tname .. "|Balance Transfer to " .. oac .. "|1|" .. transfer))
  453.             local body = ""
  454.             for chunk in response do
  455.                 body = body .. chunk
  456.             end
  457.             local response = inet.request("http://secondary.infinity-servers.com:9000/databaseset", tostring(oac .. "|Balance Transfer from" .. tname .. "|1|" .. -tonumber(transfer)))
  458.             local body = ""
  459.             for chunk in response do
  460.                 body = body .. chunk
  461.             end
  462.           end
  463.         else
  464.           print("Your balance is in the negative!")
  465.           os.sleep(5)
  466.         end
  467.       elseif (choice == "2") then
  468.         tmprun2 = "False"
  469.       end
  470.     end
  471.   elseif (usersel == "4") then
  472.     os.execute("cls")
  473.     prdon()
  474.     prdontab()
  475.     print("OSV:" .. osv .. "\nUptime:" .. computer.uptime() .. "\nTotal Memory:" .. computer.totalMemory() .. "\nCPU:Don-APU-d7-1700m\n0)close\n1)update OS\n2)Reboot\n3)Shutdown")
  476.     local usersel2 = io.read()
  477.     if (usersel2 == "1") then
  478.         os.execute("pastebin get -f qkhT3vTk tabletos")
  479.         os.execute("reboot")
  480.     end
  481.     if (usersel2 == "2") then
  482.         os.execute("reboot")
  483.     end
  484.     if (usersel2 == "3") then
  485.         os.execute("shutdown")
  486.     end
  487.   end
  488. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement