View difference between Paste ID: H4QLsDaW and NANYaugK
SHOW: | | - or go back to the newest paste.
1-
local jenisis = require("jenisis")
1+
local jenisis = require("jenisis")
2-
local component = require("component")
2+
local component = require("component")
3-
local textutils = require("serialization")
3+
local textutils = require("serialization")
4-
local modem = component.getPrimary("modem")
4+
local modem = component.getPrimary("modem")
5-
local event = require("event")
5+
local event = require("event")
6-
6+
7-
local static = {
7+
local static = {
8-
  "SRA Bank Admin Software",
8+
  "SRA Bank Admin Software",
9-
  "Property of Horyzon"
9+
  "Property of Horyzon"
10-
}
10+
}
11-
11+
12-
local menu = {
12+
local menu = {
13-
  "Do Order",
13+
  "Do Order",
14-
  "Flag Account",
14+
  "Flag Account",
15-
  "Exit"
15+
  "Exit"
16-
}
16+
}
17-
17+
18-
local function broadcast(packet)
18+
local function broadcast(packet)
19-
  modem.broadcast(1024, textutils.serialize(packet))
19+
  modem.broadcast(1024, textutils.serialize(packet))
20
end
21-
21+
22-
local function receive()
22+
local function receive()
23-
  event_ = {event.pull(5, "modem_message")}
23+
  event_ = {event.pull(5, "modem_message")}
24-
24+
25-
  return textutils.unserialize(event_[6])
25+
  return textutils.unserialize(event_[6])
26
end
27-
27+
28-
local function doOrder()
28+
local function doOrder()
29-
  target = jenisis.inputBar("Enter the target account:")
29+
  target = jenisis.inputBar("Enter the target account:")
30-
  amount = tonumber(jenisis.inputBar("Enter amount:"))
30+
  amount = tonumber(jenisis.inputBar("Enter amount:"))
31-
  pass = jenisis.inputBar("Master Password:", true)
31+
  pass = jenisis.inputBar("Master Password:", true)
32-
32+
33-
  local packet = {
33+
  local packet = {
34-
    type = "doorder",
34+
    type = "doorder",
35-
    target = target,
35+
    target = target,
36-
    amount = amount,
36+
    amount = amount,
37-
    masterpass = pass
37+
    masterpass = pass
38-
  }
38+
  }
39-
39+
40-
  broadcast(packet)
40+
  broadcast(packet)
41-
  local result = receive()
41+
  local result = receive()
42-
42+
43-
  if result then
43+
  if result then
44-
    jenisis.errorMes("Sucess", "green")
44+
    jenisis.errorMes("Sucess", "green")
45-
  else
45+
  else
46-
    jenisis.errorMes("Failure")
46+
    jenisis.errorMes("Failure")
47-
  end
47+
  end
48
end
49-
49+
50-
local function flag()
50+
local function flag()
51-
  local target = jenisis.inputBar("Enter target:")
51+
  local target = jenisis.inputBar("Enter target:")
52-
52+
53-
  local packet = {
53+
  local packet = {
54-
    type = "flag",
54+
    type = "flag",
55-
    target = target
55+
    target = target
56-
  }
56+
  }
57-
57+
58-
  broadcast(packet)
58+
  broadcast(packet)
59-
  local result = receive()
59+
  local result = receive()
60-
60+
61-
  if result then
61+
  if result then
62-
    jenisis.errorMes("Success", "green")
62+
    jenisis.errorMes("Success", "green")
63-
  else
63+
  else
64-
    jenisis.errorMes("Failure")
64+
    jenisis.errorMes("Failure")
65-
  end
65+
  end
66
end
67-
67+
68-
while true do 
68+
while true do 
69-
  local cselected = jenisis.drawScreen(static, menu)
69+
  local cselected = jenisis.drawScreen(static, menu)
70-
70+
71-
  if cselected == 1 then
71+
  if cselected == 1 then
72-
    doOrder()
72+
    doOrder()
73-
  elseif cselected == 2 then
73+
  elseif cselected == 2 then
74-
    flag()
74+
    flag()
75-
  else
75+
  else
76-
    break
76+
    break
77-
  end
77+
  end
78
end