Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ItemList = {}
- SellablesList = {}
- AddItem = function(ID, Name, EMC)
- Info = {}
- Info["ID"] = ID
- Info["Name"] = Name
- Info["EMC"] = EMC
- Info["$"] = EMC/100
- table.insert(ItemList, Info)
- end
- AddItem(264, "Diamond", 8192)
- AddItem(351.4, "Lapis Lazuli", 864)
- AddItem(265, "Iron Ingot", 256)
- AddItem(266, "Gold Ingot", 2048)
- AddItem(369, "Blaze Rod", 1536)
- AddItem(4696.2, "Tin Ingot", 256)
- AddItem(4362, "Copper Ingot", 256)
- AddItem(331, "Redstone", 64)
- AddItem(57, "Diamond Block", 73728)
- AddItem(4336, "Coal Dust", 64)
- AddItem(4271, "IC2 Electronic Circuit", 1344)
- AddItem(4270, "IC2 Advanced Circuit", 4096)
- AddItem(225.3, "IC2 Solar Panel", 6155)
- AddItem(225, "IC2 Generator", 3238)
- AddItem(566, "EE3 Energy Condenser", 40000)
- GetInfoItem = function(ID)
- for key, value in ipairs(ItemList) do
- if value["ID"] == ID then
- return value
- end
- end
- end
- NumFormat = function(num)
- if(num > 1000000) then
- return tostring(math.floor(num/10000)/100).."M"
- end
- if(num > 1000) then
- return tostring(math.floor(num/100)/10).."K"
- end
- return tostring(num).."U"
- end
- r = peripheral.wrap("back")
- MakeRequest = function(ID, amnt)
- local result = r.getLP().getItemIdentifierBuilder()
- result.setItemID(ID)
- ID2 = result.build()
- r.makeRequest(ID2, amnt)
- print("Requested "..tostring(amnt).." of ID"..tostring(ID).." from logi network")
- end
- GetEMC = function(ID)
- return r.getItemAmount(ID)*73728
- end
- GetItems = function(NumID)
- local result = r.getLP().getItemIdentifierBuilder()
- result.setItemID(NumID)
- ID2 = result.build()
- return r.getItemAmount(ID2)
- end
- ItemAmountList = {}
- tosay = "Items for sale: . indicates decimal \n"
- for key, value in ipairs(ItemList) do
- amnt = GetItems(value["ID"])
- if amnt > 0 then
- tosay = tosay.."|"..value["Name"].."(ID"..value["ID"]..")($"..value["$"].." each)"
- end
- if ItemList[10000] ~= nil then
- SellableItem = {}
- SellableItem["Name"] = ItemList[i]["name"]
- SellableItem["ID"] = ItemList[i]["ID"]
- SellableItem["EMC"] = ItemList[i]["EMC"]
- SellableItem["Amount"] = amnt
- table.insert(SellablesList, SellableItem)
- end
- end
- print("MINIMUM ORDER $100")
- cart = {}
- done = false
- subtotal = 0
- while done == false do
- print(tosay)
- os.sleep(2)
- print()
- print("Cart: ")
- subtotal = 0
- for key, value in ipairs(cart) do
- print("ID: "..value["ID"].." Amnt: "..value["Amnt"].." Price $"..value["$"])
- subtotal = subtotal + value["$"]
- end
- print("Subtotal: "..subtotal)
- print()
- print("What item ID would you like to order? (Enter r to restart, c for checkout)")
- cmd = read()
- if cmd == "r" then
- os.reboot()
- end
- if cmd == "c" then
- done = true
- else
- ID = tonumber(cmd)
- if GetItems(ID) ~= 0 then
- print("You can order up to "..tostring(GetItems(ID))..". How many do you want?")
- amnt = tonumber(read())
- itemtoadd = {}
- itemtoadd["ID"] = ID
- itemtoadd["Amnt"] = amnt
- itemtoadd["$"] = GetInfoItem(ID)["$"]*amnt
- table.insert(cart, itemtoadd)
- else
- print("Sorry, none in stock")
- end
- end
- end
- total = math.ceil(subtotal/100)*100
- dirtinchest = GetItems(3)
- print("You must now pay $"..tostring(total))
- print("Buy "..tostring(total/100).." dirt from the chest (This is just the method of payment, don't worry you'll receive your items in the cart once you've paid)")
- targetdirtinchest = dirtinchest-(total/100)
- print(dirtinchest)
- print(targetdirtinchest)
- while GetItems(3) ~= targetdirtinchest do
- dirtinchest = GetItems(3)
- print(tostring(dirtinchest-targetdirtinchest).." more...")
- os.sleep(2)
- end
- print("Payment complete! Requesting order from logi system...")
- for key, value in ipairs(cart) do
- MakeRequest(value["ID"], value["Amnt"])
- end
- print("Your items should arrive in a few moments. Thanks for shopping at MatthewGB's!")
Add Comment
Please, Sign In to add comment