SHOW:
|
|
- or go back to the newest paste.
1 | local slot = 0 | |
2 | local myID = os.getComputerID() | |
3 | ||
4 | function hotovo() | |
5 | hotovot = {} | |
6 | hotovot[4] = myID | |
7 | - | hotovot[5] = "F" |
7 | + | hotovot[5] = "M" |
8 | local msg = textutils.serialize(hotovot) | |
9 | rednet.open("top") | |
10 | rednet.broadcast(msg, "offer") | |
11 | fs.delete("currentoffer") | |
12 | - | sleep(180) |
12 | + | sleep(320) |
13 | end | |
14 | ||
15 | function password() | |
16 | passwordD = "david" | |
17 | passwordF = "filip" | |
18 | ||
19 | local heslonerozpoznano = true | |
20 | while heslonerozpoznano do | |
21 | write("Heslo: ") | |
22 | local input = read("*") | |
23 | if input == passwordD | |
24 | then | |
25 | heslonerozpoznano = false | |
26 | print ("Objednavka prijata. Na ucet David bylo pripsano " .. cena .. " kreditu.") | |
27 | rednet.open("top") | |
28 | rednet.broadcast("poptavka", "ucel") | |
29 | rednet.broadcast("David","kdo") | |
30 | rednet.broadcast(cena,"kolik") | |
31 | slot = slot - 1 | |
32 | hotovo() | |
33 | ||
34 | elseif input == passwordF | |
35 | then | |
36 | heslonerozpoznano = false | |
37 | print ("Objednavka prijata. Na ucet Filip bylo pripsano " .. cena .. " kreditu.") | |
38 | rednet.open("top") | |
39 | rednet.broadcast("poptavka", "ucel") | |
40 | rednet.broadcast("Filip","kdo") | |
41 | rednet.broadcast(cena,"kolik") | |
42 | slot = slot - 1 | |
43 | hotovo() | |
44 | ||
45 | else print("Heslo nerozpoznano") | |
46 | sleep(1) | |
47 | end | |
48 | end | |
49 | end | |
50 | ||
51 | function vyplata() | |
52 | sendtable() | |
53 | ||
54 | local id, msg = rednet.receive(2) | |
55 | if msg == "full" then | |
56 | - | sleep(180) |
56 | + | sleep(320) |
57 | slot = 0 | |
58 | ||
59 | else | |
60 | print("-----------------------------") | |
61 | print("Objednavka: ", pocet, jidlo) | |
62 | print("Vyplata: ", cena," kreditu.") | |
63 | ||
64 | local savetable = {} | |
65 | cena = cenajidla * pocet | |
66 | savetable[1] = pocet | |
67 | savetable[2] = jidlo | |
68 | savetable[3] = cena | |
69 | ||
70 | local fileWT = fs.open("currentoffer", "w") | |
71 | fileWT.write(textutils.serialize(savetable)) | |
72 | fileWT.close() | |
73 | ||
74 | password() | |
75 | end | |
76 | end | |
77 | ||
78 | function sendtable() | |
79 | cena = cenajidla * pocet | |
80 | local t = {} | |
81 | t[1] = pocet | |
82 | t[2] = jidlo | |
83 | t[3] = cena | |
84 | t[4] = myID | |
85 | - | t[5] = "F" |
85 | + | t[5] = "M" |
86 | - | t[6] = "Glucksgefuhlausloser" |
86 | + | t[6] = "Akka Constructions" |
87 | local msg = textutils.serialize(t) | |
88 | rednet.open("top") | |
89 | rednet.broadcast(msg, "offer") | |
90 | end | |
91 | ||
92 | ||
93 | function offergen() | |
94 | while slot == 0 do | |
95 | slot = slot + 1 | |
96 | - | n = math.random(1,152) |
96 | + | n = math.random(1,18) |
97 | - | pocet = math.random(32,65) |
97 | + | pocet = math.random(1, 4) |
98 | ||
99 | - | if pocet == 65 then |
99 | + | |
100 | - | pocet = 128 |
100 | + | |
101 | ||
102 | elseif n == 2 then | |
103 | jidlo = "stack(s) of strings" | |
104 | cenajidla = 320 | |
105 | ||
106 | elseif n == 3 then | |
107 | jidlo = "stack(s) of wool" | |
108 | - | jidlo = "x PMP spenat" |
108 | + | cenajidla = 320 |
109 | - | cenajidla = 10 |
109 | + | |
110 | elseif n == 4 then | |
111 | jidlo = "stack(s) of stone" | |
112 | - | jidlo = "x PMP okurka" |
112 | + | cenajidla = 640 |
113 | - | cenajidla = 10 |
113 | + | |
114 | elseif n == 5 then | |
115 | jidlo = "stack(s) of glass" | |
116 | - | jidlo = "x PMP zluta paprika" |
116 | + | cenajidla = 960 |
117 | - | cenajidla = 10 |
117 | + | |
118 | elseif n == 6 then | |
119 | jidlo = "stack(s) of sandstone" | |
120 | - | jidlo = "x PMP salat" |
120 | + | cenajidla = 960 |
121 | - | cenajidla = 10 |
121 | + | |
122 | elseif n == 7 then | |
123 | jidlo = "stack(s) of acacia wood planks" | |
124 | - | jidlo = "x PMP kukurice" |
124 | + | cenajidla = 320 |
125 | - | cenajidla = 5 |
125 | + | |
126 | elseif n == 8 then | |
127 | jidlo = "stack(s) of birch wood planks" | |
128 | - | jidlo = "x obili" |
128 | + | cenajidla = 320 |
129 | - | cenajidla = 5 |
129 | + | |
130 | elseif n >= 9 and n<= 18 then | |
131 | slot = slot - 1 | |
132 | - | jidlo = "x cervena repa" |
132 | + | |
133 | - | cenajidla = 10 |
133 | + | |
134 | end | |
135 | - | elseif n == 9 then |
135 | + | |
136 | - | jidlo = "x meloun" |
136 | + | |
137 | - | cenajidla = 5 |
137 | + | |
138 | while true do | |
139 | - | elseif n == 10 then |
139 | + | |
140 | - | jidlo = "x PMP divoka ryze" |
140 | + | |
141 | - | cenajidla = 5 |
141 | + | |
142 | local line = fileCO.readAll() | |
143 | - | elseif n == 11 then |
143 | + | |
144 | - | jidlo = "x jehneci" |
144 | + | |
145 | - | cenajidla = 50 |
145 | + | |
146 | - | |
146 | + | |
147 | - | elseif n == 12 then |
147 | + | |
148 | - | jidlo = "x hovezi" |
148 | + | |
149 | - | cenajidla = 15 |
149 | + | |
150 | - | |
150 | + | |
151 | - | elseif n >= 13 and n<= 18 then |
151 | + | |
152 | - | cenajidla = 25 |
152 | + | |
153 | - | local ryba = math.random(1, 17) |
153 | + | |
154 | - | if ryba == 1 then jidlo = "x ryba" |
154 | + | |
155 | - | elseif ryba == 2 then jidlo = "x HC raw bass" |
155 | + | |
156 | - | elseif ryba == 3 then jidlo = "x HC raw carp" |
156 | + | |
157 | - | elseif ryba == 4 then jidlo = "x HC raw catfish" |
157 | + | |
158 | - | elseif ryba == 5 then jidlo = "x HC raw grouper" |
158 | + | |
159 | - | elseif ryba == 6 then jidlo = "x HC raw herring" |
159 | + | |
160 | - | elseif ryba == 7 then jidlo = "x HC raw tilapia" |
160 | + | |
161 | - | elseif ryba == 8 then jidlo = "x HC raw tuna" |
161 | + | |
162 | - | elseif ryba == 9 then jidlo = "x HC raw walleye" |
162 | + | |
163 | - | elseif ryba == 10 then jidlo = "x HC raw green heart fish" |
163 | + | |
164 | - | elseif ryba == 11 then jidlo = "x HC raw charr" |
164 | + | |
165 | - | elseif ryba == 12 then jidlo = "x HC raw mudfish" |
165 | + | |
166 | - | elseif ryba == 13 then jidlo = "x HC raw trout" |
166 | + | |
167 | - | elseif ryba == 14 then jidlo = "x HC raw anchovy" |
167 | + | |
168 | - | elseif ryba == 15 then jidlo = "x HC raw perch" |
168 | + | |
169 | - | elseif ryba == 16 then jidlo = "x HC raw snapper" |
169 | + | |
170 | - | elseif ryba == 17 then jidlo = "x HC raw eel" |
170 | + | |
171 | - | end |
171 | + |