SHOW:
|
|
- or go back to the newest paste.
1 | function welcomescreen() | |
2 | term.clear() | |
3 | term.setCursorPos(1,1) | |
4 | print("-----------------------------") -- pokud je volny slot, vypis poptavku | |
5 | print("Objednavka: ", pocet, "x ", jidlo) | |
6 | print("Vyplata: ", cena," kreditu.") | |
7 | ||
8 | print("Pro splneni objednavky zadejte O, pro vareni jidla zadejte J") | |
9 | end | |
10 | ||
11 | function fcscreen() | |
12 | loop1 = true | |
13 | while loop1 == true do -- loop na cykleni vareni/zakazek 1.1.2.2.1.0.0 | |
14 | welcomescreen() | |
15 | ||
16 | local prikaz = read() | |
17 | if prikaz == "J" then -- vareni jidla 1.1.2.2.1.1.0 | |
18 | print("Kolik jste uvarili jidla?") | |
19 | local uvareno = tonumber(read()) | |
20 | ||
21 | print("Pouzili jste nadobi? (y/n)") | |
22 | local nadobi = read() | |
23 | if nadobi == "y" then -- pouziti nadobi 1.1.2.2.1.1.1 | |
24 | mod1 = 5 | |
25 | else mod1 = 0 | |
26 | end -- 1.1.2.2.1.1.1E | |
27 | ||
28 | print("Pouzili jste pri vareni pristroj? (y/n)") | |
29 | local pristroj = read() | |
30 | if pristroj == "y" then -- pouziti pristroje 1.1.2.2.1.1.2 | |
31 | mod2 = 5 | |
32 | else mod2 = 0 | |
33 | end -- 1.1.2.2.1.1.2E | |
34 | ||
35 | print("Byl potreba pri vareni craftici mezikrok? (y/n)") | |
36 | local mezikrok = read() | |
37 | if mezikrok == "y" then -- pouziti mezikroku 1.1.2.2.1.1.3 | |
38 | mod3 = 5 | |
39 | else mod3 = 0 | |
40 | end -- 1.1.2.2.1.1.3E | |
41 | ||
42 | mzda = uvareno * ( 5 + mod1 + mod2 + mod3) | |
43 | ||
44 | passwordD = "david" | |
45 | passwordF = "filip" | |
46 | ||
47 | local heslonerozpoznano = true | |
48 | while heslonerozpoznano do -- 1.1.2.2.1.1.4.0 | |
49 | print("Pokud chcete stornovat prikaz, misto hesla zadejte STORNO") | |
50 | write("Heslo: ") | |
51 | local input = read("*") | |
52 | if input == passwordD then -- 1.1.2.2.1.1.4.1 | |
53 | heslonerozpoznano = false | |
54 | print ("Mzda vyplacena. Na ucet David bylo pripsano " .. mzda .. " kreditu.") | |
55 | rednet.open("top") | |
56 | rednet.broadcast("poptavka", "ucel") | |
57 | rednet.broadcast("David","kdo") | |
58 | rednet.broadcast(mzda,"kolik") | |
59 | sleep(2,5) | |
60 | ||
61 | elseif input == passwordF then | |
62 | heslonerozpoznano = false | |
63 | print ("Mzda vyplacena. Na ucet Filip bylo pripsano " .. mzda .. " kreditu.") | |
64 | rednet.open("top") | |
65 | rednet.broadcast("poptavka", "ucel") | |
66 | rednet.broadcast("Filip","kdo") | |
67 | rednet.broadcast(mzda,"kolik") | |
68 | sleep(2,5) | |
69 | ||
70 | elseif input == "STORNO" then | |
71 | heslonerozpoznano = false | |
72 | print("Prikaz stornovan") | |
73 | sleep(1) | |
74 | ||
75 | else print("Heslo nerozpoznano") | |
76 | ||
77 | end -- konec overeni hesla 1.1.2.2.1.1.4.1E | |
78 | end -- 1.1.2.2.1.1.4.0E | |
79 | ||
80 | elseif prikaz == "O" then -- objednavka jidla 1.1.2.2.1.1.0 Cont | |
81 | ||
82 | passwordD = "david" | |
83 | passwordF = "filip" | |
84 | ||
85 | local heslonerozpoznano = true | |
86 | while heslonerozpoznano do -- 1.1.2.2.1.1.5.0 | |
87 | print(myID) | |
88 | write("Heslo: ") | |
89 | local input = read("*") | |
90 | if input == passwordD then -- 1.1.2.2.1.1.5.1 | |
91 | heslonerozpoznano = false | |
92 | print ("Objednavka prijata. Na ucet David bylo pripsano " .. cena .. " kreditu.") | |
93 | rednet.open("top") | |
94 | rednet.broadcast("poptavka", "ucel") | |
95 | rednet.broadcast("David","kdo") | |
96 | rednet.broadcast(cena,"kolik") | |
97 | slot = 0 | |
98 | hotovot = {} | |
99 | hotovot[4] = myID | |
100 | hotovot[5] = "F" | |
101 | local msg = textutils.serialize(hotovot) | |
102 | rednet.broadcast(msg, "offer") | |
103 | fs.delete("currentoffer") | |
104 | loop1 = false | |
105 | sleep(3) | |
106 | ||
107 | elseif input == passwordF then | |
108 | heslonerozpoznano = false | |
109 | print ("Objednavka prijata. Na ucet Filip bylo pripsano " .. cena .. " kreditu.") | |
110 | rednet.open("top") | |
111 | rednet.broadcast("poptavka", "ucel") | |
112 | rednet.broadcast("Filip","kdo") | |
113 | rednet.broadcast(cena,"kolik") | |
114 | slot = 0 | |
115 | hotovot = {} | |
116 | hotovot[4] = myID | |
117 | hotovot[5] = "F" | |
118 | local msg = textutils.serialize(hotovot) | |
119 | rednet.broadcast(msg, "offer") | |
120 | fs.delete("currentoffer") | |
121 | loop1 = false | |
122 | sleep(3) | |
123 | ||
124 | else print("Heslo nerozpoznano") | |
125 | sleep(1) | |
126 | end -- konec overeni hesla 1.1.2.2.1.1.5.1E | |
127 | end -- konec loopu pro heslo 1.1.2.2.1.1.5.0E | |
128 | end -- konec loopu pro vyber J/O 1.1.2.2.1.1.0E | |
129 | end -- konec while loopu pro cykleni mezi J/O 1.1.2.2.1.0.0E | |
130 | end | |
131 | ||
132 | --- ZACATEK PROGRAMU --- | |
133 | ||
134 | myID = os.getComputerID() | |
135 | while true do -- 1.0.0.0.0.0.0 | |
136 | znovu = 1 | |
137 | slot = 0 | |
138 | if fs.exists("currentoffer") then -- pokud jiz existuje ulozena objednavka, nacte se ze souboru currentoffer 1.1.0.0.0.0.0 | |
139 | znovu = 0 | |
140 | slot = 1 | |
141 | fileCO = fs.open("currentoffer", "r") | |
142 | local line = fileCO.readAll() | |
143 | fileCO.close() | |
144 | offertable = textutils.unserialize(line) | |
145 | ||
146 | pocet = offertable[1] | |
147 | jidlo = offertable[2] | |
148 | cena = offertable[3] | |
149 | ||
150 | fcscreen() | |
151 | ||
152 | else -- generace nove poptavky pokud neexistuje poptavka 1.1.0.0.0.0Cont | |
153 | znovu = 1 | |
154 | rednet.open("top") | |
155 | while znovu == 1 do -- generuj, dokud se neuvolni slot 1.1.2.0.0.0 | |
156 | while slot == 0 do --generuj, dokud se to nepovede 1.1.2.1.0.0 | |
157 | slot = 1 | |
158 | sleep(180) | |
159 | n = math.random(1,200) | |
160 | pocet = math.random(32,65) | |
161 | ||
162 | if pocet == 65 then -- 1.1.2.1.1.0 | |
163 | pocet = 128 | |
164 | end -- 1.1.2.1.1E | |
165 | ||
166 | - | if n >= 1 and n <= 19 then -- VEGGIES |
166 | + | if n >= 1 and n <= 18 then -- VEGGIES |
167 | local veggies = math.random(1,33) | |
168 | ||
169 | - | if veggies >= 1 and veggies <= 9 then -- veggies1 |
169 | + | if veggies >= 1 and veggies <= 8 then -- veggies2 |
170 | - | cenajidla = 10 |
170 | + | |
171 | - | local veggies1 = math.random(1,9) |
171 | + | local veggies2 = math.random(1,8) |
172 | - | if veggies1 == 1 then jidlo = "PMP spinach" |
172 | + | if veggies2 == 1 then jidlo = "avocado" |
173 | - | elseif veggies1 == 2 then jidlo = "PMP cucumber" |
173 | + | |
174 | - | elseif veggies1 == 3 then jidlo = "PMP bell pepper" |
174 | + | |
175 | - | elseif veggies1 == 4 then jidlo = "PMP lettuce" |
175 | + | |
176 | - | elseif veggies1 == 5 then jidlo = "PMP beet" |
176 | + | elseif veggies2 == 3 then jidlo = "olive" |
177 | - | elseif veggies1 == 6 then jidlo = "PMP tomato" |
177 | + | |
178 | - | elseif veggies1 == 7 then jidlo = "PMP onion" |
178 | + | elseif veggies2 == 4 then jidlo = "bamboo shoot" |
179 | - | elseif veggies1 == 8 then jidlo = "carrot" |
179 | + | |
180 | - | elseif veggies1 == 9 then jidlo = "PMP celery" |
180 | + | elseif veggies2 == 5 then jidlo = "carrot" |
181 | - | end |
181 | + | |
182 | elseif veggies2 == 6 then jidlo = "sweet potato" | |
183 | - | elseif veggies >= 10 and veggies <= 13 then -- veggies2 |
183 | + | |
184 | elseif veggies2 == 7 then jidlo = "artichoke" | |
185 | - | local veggies2 = math.random(1,4) |
185 | + | |
186 | - | if veggies2 == 1 then jidlo = "HC avocado" |
186 | + | elseif veggies2 == 8 then jidlo = "pumpkin" |
187 | cenajidla = 15 | |
188 | - | elseif veggies2 == 3 then jidlo = "olive" |
188 | + | |
189 | - | elseif veggies2 == 4 then jidlo = "HC bamboo shoot" |
189 | + | |
190 | elseif veggies >= 9 and veggies <= 33 then -- veggies3 | |
191 | cenajidla = 5 | |
192 | - | elseif veggies >= 14 and veggies <= 33 then -- veggies3 |
192 | + | local veggies3 = math.random(1,24) |
193 | if veggies3 == 1 then jidlo = "pea" | |
194 | - | local veggies3 = math.random(1,20) |
194 | + | elseif veggies3 == 2 then jidlo = "brussel sprout" |
195 | - | if veggies3 == 1 then jidlo = "HC pea" |
195 | + | elseif veggies3 == 3 then jidlo = "soybean" |
196 | - | elseif veggies3 == 2 then jidlo = "cactus" |
196 | + | elseif veggies3 == 4 then jidlo = "asparagus" |
197 | - | elseif veggies3 == 3 then jidlo = "HC olive" |
197 | + | elseif veggies3 == 5 then jidlo = "broccoli" |
198 | - | elseif veggies3 == 4 then jidlo = "HC soybean" |
198 | + | elseif veggies3 == 6 then jidlo = "zucchini" |
199 | - | elseif veggies3 == 5 then jidlo = "HC asparagus" |
199 | + | elseif veggies3 == 7 then jidlo = "celery" |
200 | - | elseif veggies3 == 6 then jidlo = "HC broccoli" |
200 | + | elseif veggies3 == 8 then jidlo = "onion" |
201 | - | elseif veggies3 == 7 then jidlo = "HC zucchini" |
201 | + | elseif veggies3 == 9 then jidlo = "sea weed" |
202 | - | elseif veggies3 == 8 then jidlo = "HC celery" |
202 | + | elseif veggies3 == 10 then jidlo = "mushrooms" |
203 | - | elseif veggies3 == 9 then jidlo = "HC onion" |
203 | + | elseif veggies3 == 11 then jidlo = "eggplant" |
204 | - | elseif veggies3 == 10 then jidlo = "HC sea weed" |
204 | + | elseif veggies3 == 12 then jidlo = "leek" |
205 | - | elseif veggies3 == 11 then jidlo = "HC mushrooms" |
205 | + | elseif veggies3 == 13 then jidlo = "bean" |
206 | - | elseif veggies3 == 12 then jidlo = "HC eggplant" |
206 | + | elseif veggies3 == 14 then jidlo = "tomato" |
207 | - | elseif veggies3 == 13 then jidlo = "HC leek" |
207 | + | elseif veggies3 == 15 then jidlo = "lettuce" |
208 | - | elseif veggies3 == 14 then jidlo = "HC bean" |
208 | + | elseif veggies3 == 16 then jidlo = "beet" |
209 | - | elseif veggies3 == 15 then jidlo = "HC tomato" |
209 | + | elseif veggies3 == 17 then jidlo = "bellpepper" |
210 | - | elseif veggies3 == 16 then jidlo = "HC lettuce" |
210 | + | elseif veggies3 == 18 then jidlo = "cucumber" |
211 | - | elseif veggies3 == 17 then jidlo = "HC beet" |
211 | + | elseif veggies3 == 19 then jidlo = "spinach" |
212 | - | elseif veggies3 == 18 then jidlo = "HC bellpepper" |
212 | + | elseif veggies3 == 20 then jidlo = "cabbage" |
213 | - | elseif veggies3 == 19 then jidlo = "HC cucumber" |
213 | + | elseif veggies3 == 21 then jidlo = "scallion" |
214 | - | elseif veggies3 == 20 then jidlo = "HC spinach" |
214 | + | elseif veggies3 == 22 then jidlo = "parsnip" |
215 | elseif veggies3 == 23 then jidlo = "cauliflower" | |
216 | elseif veggies3 == 24 then jidlo = "radish" | |
217 | end | |
218 | end | |
219 | - | elseif n >= 20 and n <= 36 then -- FRUITS |
219 | + | |
220 | - | local fruits = math.random(1,27) |
220 | + | |
221 | - | if fruits >= 1 and fruits <= 16 then |
221 | + | elseif n >= 19 and n <= 34 then -- FRUITS |
222 | local fruits = math.random(1,26) | |
223 | - | local fruits1 = math.random(1,16) -- fruits1 |
223 | + | if fruits >= 1 and fruits <= 12 then |
224 | cenajidla = 5 | |
225 | - | elseif fruits1 == 2 then jidlo = "PMP blueberry" |
225 | + | local fruits1 = math.random(1,12) -- fruits1 |
226 | - | elseif fruits1 == 3 then jidlo = "PMP strawberry" |
226 | + | |
227 | - | elseif fruits1 == 4 then jidlo = "PMP blackberry" |
227 | + | elseif fruits1 == 2 then jidlo = "plum" |
228 | - | elseif fruits1 == 5 then jidlo = "PMP whiteberry" |
228 | + | elseif fruits1 == 3 then jidlo = "rhubarb" |
229 | - | elseif fruits1 == 6 then jidlo = "PMP gooseberry" |
229 | + | elseif fruits1 == 4 then jidlo = "grape" |
230 | - | elseif fruits1 == 7 then jidlo = "PMP beautyberry" |
230 | + | elseif fruits1 == 5 then jidlo = "cherry" |
231 | - | elseif fruits1 == 8 then jidlo = "PMP orangeberry" |
231 | + | elseif fruits1 == 6 then jidlo = "peach" |
232 | - | elseif fruits1 == 9 then jidlo = "HC plum" |
232 | + | elseif fruits1 == 7 then jidlo = "apricot" |
233 | - | elseif fruits1 == 10 then jidlo = "HC rhubarb" |
233 | + | elseif fruits1 == 8 then jidlo = "blueberry" |
234 | - | elseif fruits1 == 11 then jidlo = "HC grape" |
234 | + | elseif fruits1 == 9 then jidlo = "blackberry" |
235 | - | elseif fruits1 == 12 then jidlo = "HC cherry" |
235 | + | elseif fruits1 == 10 then jidlo = "strawberry" |
236 | - | elseif fruits1 == 13 then jidlo = "HC peach" |
236 | + | elseif fruits1 == 11 then jidlo = "apple" |
237 | - | elseif fruits1 == 14 then jidlo = "HC apricot" |
237 | + | elseif fruits1 == 12 then jidlo = "gooseberry" |
238 | - | elseif fruits1 == 15 then jidlo = "HC blueberry" |
238 | + | |
239 | - | elseif fruits1 == 16 then jidlo = "HC blackberry" |
239 | + | |
240 | elseif fruits >= 13 and fruits <= 26 then -- fruits2 | |
241 | cenajidla = 15 | |
242 | - | elseif fruits >= 17 and fruits <= 27 then -- fruits2 |
242 | + | local fruits2 = math.random(1,14) |
243 | if fruits2 == 1 then jidlo = "lemon" | |
244 | - | local fruits2 = math.random(1,11) |
244 | + | elseif fruits2 == 2 then jidlo = "coconut" |
245 | - | if fruits2 == 1 then jidlo = "HC lemon" |
245 | + | elseif fruits2 == 3 then jidlo = "orange" |
246 | - | elseif fruits2 == 2 then jidlo = "HC coconut" |
246 | + | elseif fruits2 == 4 then jidlo = "banana" |
247 | - | elseif fruits2 == 3 then jidlo = "HC orange" |
247 | + | elseif fruits2 == 5 then jidlo = "grapefruit" |
248 | - | elseif fruits2 == 4 then jidlo = "HC banana" |
248 | + | elseif fruits2 == 6 then jidlo = "fig" |
249 | - | elseif fruits2 == 5 then jidlo = "HC grapefruit" |
249 | + | elseif fruits2 == 7 then jidlo = "pomegranate" |
250 | - | elseif fruits2 == 6 then jidlo = "HC fig" |
250 | + | elseif fruits2 == 8 then jidlo = "lime" |
251 | - | elseif fruits2 == 7 then jidlo = "HC pomegranate" |
251 | + | elseif fruits2 == 9 then jidlo = "date" |
252 | - | elseif fruits2 == 8 then jidlo = "HC lime" |
252 | + | elseif fruits2 == 10 then jidlo = "cantaloupe" |
253 | - | elseif fruits2 == 9 then jidlo = "HC date" |
253 | + | elseif fruits2 == 11 then jidlo = "mango" |
254 | - | elseif fruits2 == 10 then jidlo = "HC cantaloupe" |
254 | + | elseif fruits2 == 12 then jidlo = "pineapple" |
255 | - | elseif fruits2 == 11 then jidlo = "HC mango" |
255 | + | elseif fruits2 == 13 then jidlo = "dragonfruit" |
256 | elseif fruits2 == 14 then jidlo = "papaya" | |
257 | end | |
258 | end | |
259 | ||
260 | - | elseif n >= 37 and n <= 52 then -- CARBS |
260 | + | |
261 | - | local carbs = math.random(1,9) |
261 | + | elseif n >= 35 and n <= 54 then -- CARBS |
262 | - | if carbs >= 1 and carbs <= 5 then -- carbs1 |
262 | + | local carbs = math.random(1,7) |
263 | if carbs == 1 then jidlo = "corn" | |
264 | - | local carbs1 = math.random(1,5) |
264 | + | |
265 | - | if carbs1 == 1 then jidlo = "PMP corn" |
265 | + | elseif carbs == 2 then jidlo = "wheat" |
266 | - | elseif carbs1 == 2 then jidlo = "wheat" |
266 | + | |
267 | - | elseif carbs1 == 3 then jidlo = "potato" |
267 | + | elseif carbs == 3 then jidlo = "potato" |
268 | - | elseif carbs1 == 4 then jidlo = "HC barley" |
268 | + | |
269 | - | elseif carbs1 == 5 then jidlo = "HC rye" |
269 | + | elseif carbs == 4 then jidlo = "barley" |
270 | cenajidla = 5 | |
271 | elseif carbs == 5 then jidlo = "rye" | |
272 | - | elseif carbs >= 6 and n <= 9 then -- carbs2 |
272 | + | |
273 | - | local carbs2 = math.random(1,4) |
273 | + | elseif carbs == 6 then jidlo = "rice" |
274 | - | if carbs2 == 1 then jidlo = "PMP wild rice" |
274 | + | |
275 | elseif carbs == 7 then jidlo = "oats" | |
276 | - | elseif carbs2 == 2 then jidlo = "HC rice" |
276 | + | |
277 | end | |
278 | - | elseif carbs2 == 3 then jidlo = "PMP asian rice" |
278 | + | |
279 | ||
280 | - | elseif carbs2 == 4 then jidlo = "PMP corn" |
280 | + | elseif n >= 55 and n <= 68 then -- PROTEIN |
281 | local protein = math.random(1,8) | |
282 | if protein == 1 then jidlo = "raw mutton" | |
283 | cenajidla = 20 | |
284 | elseif protein == 2 then jidlo = "raw beef" | |
285 | - | elseif n >= 53 and n <= 66 then -- PROTEIN |
285 | + | |
286 | elseif protein == 3 then jidlo = "raw turkey" | |
287 | cenajidla = 50 | |
288 | elseif protein == 4 then jidlo = "raw venison" | |
289 | cenajidla = 50 | |
290 | elseif protein == 5 then jidlo = "raw rabbit" | |
291 | - | elseif protein == 3 then jidlo = "HC raw turkey" |
291 | + | |
292 | elseif protein == 6 then jidlo = "raw chicken" | |
293 | - | elseif protein == 4 then jidlo = "HC raw venison" |
293 | + | |
294 | elseif protein == 7 then jidlo = "raw pork" | |
295 | - | elseif protein == 5 then jidlo = "HC raw rabbit" |
295 | + | |
296 | elseif protein == 8 then jidlo = "eggs" | |
297 | cenajidla = 5 | |
298 | end | |
299 | ||
300 | elseif n >= 69 and n <= 78 then -- SPICES | |
301 | local spices = math.random(1,14) | |
302 | if spices == 1 then jidlo = "sugar" | |
303 | cenajidla = 5 | |
304 | elseif spices == 2 then jidlo = "chilli" | |
305 | - | elseif n >= 67 and n <= 76 then -- SPICES |
305 | + | |
306 | - | local spices = math.random(1,13) |
306 | + | elseif spices == 3 then jidlo = "garlic" |
307 | cenajidla = 5 | |
308 | elseif spices == 4 then jidlo = "mustard" | |
309 | - | elseif spices == 2 then jidlo = "HC chilli" |
309 | + | |
310 | elseif spices == 5 then jidlo = "maple syrup" | |
311 | - | elseif spices == 3 then jidlo = "HC garlic" |
311 | + | |
312 | elseif spices == 6 then jidlo = "cinnamon" | |
313 | - | elseif spices == 4 then jidlo = "HC mustard" |
313 | + | |
314 | elseif spices == 7 then jidlo = "vanilla bean" | |
315 | - | elseif spices == 5 then jidlo = "HC maple syrup" |
315 | + | |
316 | elseif spices == 8 then jidlo = "black pepper" | |
317 | - | elseif spices == 6 then jidlo = "HC cinnamon" |
317 | + | |
318 | elseif spices == 9 then jidlo = "ginger" | |
319 | - | elseif spices == 7 then jidlo = "HC vanilla bean" |
319 | + | |
320 | elseif spices == 10 then jidlo = "honey" | |
321 | - | elseif spices == 8 then jidlo = "HC black pepper" |
321 | + | |
322 | elseif spices == 11 then jidlo = "sesame" | |
323 | - | elseif spices == 9 then jidlo = "HC ginger" |
323 | + | |
324 | elseif spices == 12 then jidlo = "curry leaves" | |
325 | - | elseif spices == 10 then jidlo = "HC honey" |
325 | + | |
326 | elseif spices == 13 then jidlo = "salt" | |
327 | - | elseif spices == 11 then jidlo = "HC sesame" |
327 | + | |
328 | elseif spices == 14 then jidlo = "spice leaf" | |
329 | - | elseif spices == 12 then jidlo = "HC curry leaves" |
329 | + | |
330 | end | |
331 | ||
332 | elseif n >= 79 and n <= 90 then -- FISH | |
333 | local fish = math.random(1,27) | |
334 | if fish >= 1 and fish <= 17 then -- fish1 | |
335 | - | elseif n >= 77 and n<= 90 then -- FISH |
335 | + | |
336 | - | local fish = math.random(1,28) |
336 | + | |
337 | if fish1 == 1 then jidlo = "raw fish" -- 1.1.2.1.2.1 | |
338 | elseif fish1 == 2 then jidlo = "raw bass" | |
339 | elseif fish1 == 3 then jidlo = "raw carp" | |
340 | - | if fish1 == 1 then jidlo = "ryba" -- 1.1.2.1.2.1 |
340 | + | elseif fish1 == 4 then jidlo = "raw catfish" |
341 | - | elseif fish1 == 2 then jidlo = "HC raw bass" |
341 | + | elseif fish1 == 5 then jidlo = "raw grouper" |
342 | - | elseif fish1 == 3 then jidlo = "HC raw carp" |
342 | + | elseif fish1 == 6 then jidlo = "raw herring" |
343 | - | elseif fish1 == 4 then jidlo = "HC raw catfish" |
343 | + | elseif fish1 == 7 then jidlo = "raw tilapia" |
344 | - | elseif fish1 == 5 then jidlo = "HC raw grouper" |
344 | + | elseif fish1 == 8 then jidlo = "raw tuna" |
345 | - | elseif fish1 == 6 then jidlo = "HC raw herring" |
345 | + | elseif fish1 == 9 then jidlo = "raw walleye" |
346 | - | elseif fish1 == 7 then jidlo = "HC raw tilapia" |
346 | + | elseif fish1 == 10 then jidlo = "raw green heart fish" |
347 | - | elseif fish1 == 8 then jidlo = "HC raw tuna" |
347 | + | elseif fish1 == 11 then jidlo = "raw charr" |
348 | - | elseif fish1 == 9 then jidlo = "HC raw walleye" |
348 | + | elseif fish1 == 12 then jidlo = "raw mudfish" |
349 | - | elseif fish1 == 10 then jidlo = "HC raw green heart fish" |
349 | + | elseif fish1 == 13 then jidlo = "raw trout" |
350 | - | elseif fish1 == 11 then jidlo = "HC raw charr" |
350 | + | elseif fish1 == 14 then jidlo = "raw anchovy" |
351 | - | elseif fish1 == 12 then jidlo = "HC raw mudfish" |
351 | + | elseif fish1 == 15 then jidlo = "raw perch" |
352 | - | elseif fish1 == 13 then jidlo = "HC raw trout" |
352 | + | elseif fish1 == 16 then jidlo = "raw snapper" |
353 | - | elseif fish1 == 14 then jidlo = "HC raw anchovy" |
353 | + | elseif fish1 == 17 then jidlo = "raw eel" |
354 | - | elseif fish1 == 15 then jidlo = "HC raw perch" |
354 | + | |
355 | - | elseif fish1 == 16 then jidlo = "HC raw snapper" |
355 | + | |
356 | - | elseif fish1 == 17 then jidlo = "HC raw eel" |
356 | + | elseif fish >= 18 and fish <= 27 then -- fish2 |
357 | cenajidla = 25 | |
358 | local fish2 = math.random(18,27) | |
359 | - | elseif fish >= 18 and fish <= 28 then -- fish2 |
359 | + | if fish2 == 1 then jidlo = "raw crab" |
360 | elseif fish2 == 2 then jidlo = "raw crayfish" | |
361 | - | local fish2 = math.random(18,28) |
361 | + | elseif fish2 == 3 then jidlo = "raw frog" |
362 | - | if fish2 == 1 then jidlo = "HC raw crab" |
362 | + | elseif fish2 == 4 then jidlo = "raw octopus" |
363 | - | elseif fish2 == 2 then jidlo = "HC raw crayfish" |
363 | + | elseif fish2 == 5 then jidlo = "raw scallop" |
364 | - | elseif fish2 == 4 then jidlo = "HC raw frog" |
364 | + | elseif fish2 == 6 then jidlo = "raw shrimp" |
365 | - | elseif fish2 == 5 then jidlo = "HC raw octopus" |
365 | + | elseif fish2 == 7 then jidlo = "raw snail" |
366 | - | elseif fish2 == 6 then jidlo = "HC raw scallop" |
366 | + | elseif fish2 == 8 then jidlo = "raw turtle" |
367 | - | elseif fish2 == 7 then jidlo = "HC raw shrimp" |
367 | + | elseif fish2 == 9 then jidlo = "raw calamari" |
368 | - | elseif fish2 == 8 then jidlo = "HC raw snail" |
368 | + | elseif fish2 == 10 then jidlo = "raw salmon" |
369 | - | elseif fish2 == 9 then jidlo = "HC raw turtle" |
369 | + | |
370 | - | elseif fish2 == 10 then jidlo = "HC raw calamari" |
370 | + | |
371 | - | elseif fish2 == 11 then jidlo = "salmon" |
371 | + | |
372 | elseif n >= 91 and n <= 100 then -- DRY PRODUCTS | |
373 | local dries = math.random(1,11) | |
374 | if dries == 1 then jidlo = "pecan" | |
375 | cenajidla = 30 | |
376 | elseif dries == 2 then jidlo = "tea leaf" | |
377 | - | if dries == 1 then jidlo = "PMP peanuts" |
377 | + | |
378 | elseif dries == 3 then jidlo = "chestnut" | |
379 | - | elseif dries == 2 then jidlo = "HC tea leaf" |
379 | + | |
380 | elseif dries == 4 then jidlo = "cashew" | |
381 | - | elseif dries == 3 then jidlo = "HC chestnut" |
381 | + | |
382 | elseif dries == 5 then jidlo = "almond" | |
383 | - | elseif dries == 4 then jidlo = "HC cashew" |
383 | + | |
384 | elseif dries == 6 then jidlo = "coffee" | |
385 | - | elseif dries == 5 then jidlo = "HC almond" |
385 | + | |
386 | elseif dries == 7 then jidlo = "pistachio" | |
387 | - | elseif dries == 6 then jidlo = "HC coffee" |
387 | + | |
388 | elseif dries == 8 then jidlo = "peanut" | |
389 | - | elseif dries == 7 then jidlo = "HC pistachio" |
389 | + | |
390 | elseif dries == 9 then jidlo = "walnut" | |
391 | - | elseif dries == 8 then jidlo = "HC peanut" |
391 | + | |
392 | elseif dries == 10 then jidlo = "cocoa" | |
393 | - | elseif dries == 9 then jidlo = "HC walnut" |
393 | + | |
394 | elseif dries == 11 then jidlo = "water chestnut" | |
395 | cenajidla = 15 | |
396 | end | |
397 | - | elseif dries == 11 then jidlo = "HC pecan" |
397 | + | |
398 | elseif n >= 101 and n <= 200 then | |
399 | slot = 0 | |
400 | ||
401 | ||
402 | end -- konec rng jidla 1.1.2.1.2.0E | |
403 | end -- konec while loop pro generaci poptavky 1.1.2.1.0.0E | |
404 | ||
405 | ||
406 | cena = cenajidla * pocet | |
407 | local t = {} | |
408 | t[1] = pocet | |
409 | t[2] = jidlo | |
410 | t[3] = cena | |
411 | t[4] = myID | |
412 | t[5] = "F" | |
413 | t[6] = "Glucksgefuhlsausloser" | |
414 | local msg = textutils.serialize(t) | |
415 | ||
416 | - | t[6] = "Dave's Corner" |
416 | + | |
417 | rednet.broadcast(msg, "offer") | |
418 | local id, msg = rednet.receive(2) | |
419 | if msg == "full" then -- overi dostupnost slotu - pokud neni volny, opakuj gen 1.1.2.2.0.0 | |
420 | sleep(3) | |
421 | znovu = 1 | |
422 | ||
423 | else | |
424 | znovu = 0 | |
425 | ||
426 | local savetable = {} | |
427 | cena = cenajidla * pocet | |
428 | savetable[1] = pocet | |
429 | savetable[2] = jidlo | |
430 | savetable[3] = cena | |
431 | ||
432 | local fileWT = fs.open("currentoffer", "w") | |
433 | fileWT.write(textutils.serialize(savetable)) | |
434 | fileWT.close() | |
435 | ||
436 | fcscreen() | |
437 | end -- konec overeni dostupnosti slotu 1.1.2.2.0.0E | |
438 | end -- konec znovu loopu 1.1.1.0.0.0.0E | |
439 | znovu = 1 | |
440 | end -- konec while loopu pro gen poptavky 1.1.0.0.0.0.0E | |
441 | end -- konec if statement pro overeni existence currentoffer 1.0.0.0.0.0.0E |