View difference between Paste ID: gUSP8jae and BSbJprkC
SHOW: | | - or go back to the newest paste.
1-
local slot = 0
1+
2
while true do  -- 1
3
 znovu = 1
4-
while true do 
4+
 slot = 0
5-
 if fs.exists("currentoffer") then
5+
 if fs.exists("currentoffer") then  -- pokud jiz existuje ulozena objednavka, nacte se ze souboru currentoffer  2
6
   znovu = 0
7
   slot = 1
8
   fileCO = fs.open("currentoffer", "r")
9
   local line = fileCO.readAll()
10
   fileCO.close()
11
   offertable = textutils.unserialize(line)
12
   
13
   pocet = offertable[1]
14
   jidlo = offertable[2]
15
   cena = offertable[3]
16
      
17
   print("---------------------------")
18
   print("Objednavka: ", pocet, jidlo)
19-
    passwordD = "david"
19+
20-
 passwordF = "filip"
20+
   passwordD = "david"
21
   passwordF = "filip"
22-
 local heslonerozpoznano = true
22+
23-
 while heslonerozpoznano do  
23+
   local heslonerozpoznano = true
24-
   write("Heslo: ")
24+
   while heslonerozpoznano do    -- overeni heslem 3
25-
   local input = read("*")
25+
   	write("Heslo: ")
26-
   if input == passwordD
26+
   	local input = read("*")
27-
   then 
27+
   	if input == passwordD then   -- overeni hesla pro Davida 4
28
      heslonerozpoznano = false
29
      print ("Objednavka prijata. Na ucet David bylo pripsano " .. cena .. " kreditu.")
30
      rednet.open("top")
31
	  rednet.broadcast("poptavka", "ucel")
32
      rednet.broadcast("David","kdo")
33
      rednet.broadcast(cena,"kolik")
34-
      slot = slot - 1
34+
      slot = 0
35
      hotovot = {}
36-
 hotovot[4] = myID
36+
      hotovot[4] = myID
37-
 hotovot[5] = "F"
37+
 	  hotovot[5] = "F"
38-
 local msg = textutils.serialize(hotovot)
38+
      local msg = textutils.serialize(hotovot)
39-
 rednet.open("top")
39+
      rednet.broadcast(msg, "offer")
40-
 rednet.broadcast(msg, "offer")
40+
      fs.delete("currentoffer")
41-
 fs.delete("currentoffer")
41+
      sleep(3)
42-
 sleep(3)
42+
43
   elseif input == passwordF then  -- overeni hesla pro Filipa
44-
   elseif input == passwordF
44+
45-
   then
45+
46
      rednet.open("top")
47
	  rednet.broadcast("poptavka", "ucel")
48
      rednet.broadcast("Filip","kdo")
49
      rednet.broadcast(cena,"kolik")
50
      slot = 0
51
      hotovot = {}
52-
      slot = slot - 1
52+
      hotovot[4] = myID
53
      hotovot[5] = "F"
54-
 hotovot[4] = myID
54+
      local msg = textutils.serialize(hotovot)
55-
 hotovot[5] = "F"
55+
      rednet.broadcast(msg, "offer")
56-
 local msg = textutils.serialize(hotovot)
56+
      fs.delete("currentoffer")
57-
 rednet.open("top")
57+
      sleep(3)
58-
 rednet.broadcast(msg, "offer")
58+
59-
 fs.delete("currentoffer")
59+
   else print("Heslo nerozpoznano") -- pokud se neshoduje heslo
60-
 sleep(3)
60+
61
   end -- konec overeni inputu 4E
62-
   else print("Heslo nerozpoznano")
62+
  end  -- ukonceni while loopu pro overeni heslem 3E
63
 
64-
   end
64+
 else -- generace nove poptavky pokud neexistuje poptavka 2C
65-
  end
65+
   znovu = 1 
66
   rednet.open("top")
67-
 else
67+
   while znovu == 1 do       -- generuj, dokud se neuvolni slot 4,5
68-
   local vacancy = 1
68+
    while slot == 0 do       --generuj, dokud se to nepovede 5
69-
   while vacancy == 1 do
69+
    	slot = 1
70-
    rednet.open("top")
70+
    	sleep(180)
71-
    while slot == 0 do
71+
    	n = math.random(1,194)
72-
   slot = slot + 1
72+
    	pocet = math.random(32,65)
73-
   n = math.random(1,192)
73+
74-
   pocet = math.random(32,65)
74+
  		if pocet == 65 then -- 6
75
   		pocet = 128
76-
   if pocet == 65 then
76+
   		end -- 6E
77-
   pocet = 128
77+
78-
   end
78+
79
   		if n == 1 then -- 7
80
    	slot = 0
81-
   if n == 1 then
81+
82-
    slot = slot - 1
82+
   		elseif n == 2 then
83
    	 jidlo = "x PMP spenat"
84-
   elseif n == 2 then
84+
    	 cenajidla = 10
85-
    jidlo = "x PMP spenat"
85+
86-
    cenajidla = 10
86+
  		 elseif n == 3 then 
87
    	  jidlo = "x PMP okurka"
88-
   elseif n == 3 then 
88+
   		  cenajidla = 10
89-
    jidlo = "x PMP okurka"
89+
90-
    cenajidla = 10
90+
   		elseif n == 4 then
91
    	 jidlo = "x PMP zluta paprika" 
92-
   elseif n == 4 then
92+
   		 cenajidla = 10
93-
    jidlo = "x PMP zluta paprika" 
93+
94-
    cenajidla = 10
94+
   		elseif n == 5 then
95
    	 jidlo = "x PMP salat" 
96-
   elseif n == 5 then
96+
    	 cenajidla = 10
97-
    jidlo = "x PMP salat" 
97+
98-
    cenajidla = 10
98+
  		elseif n == 6 then
99
    	 jidlo = "x PMP kukurice"
100-
   elseif n == 6 then
100+
    	 cenajidla = 5
101-
    jidlo = "x PMP kukurice"
101+
102-
    cenajidla = 5
102+
  		elseif n == 7 then
103
    	 jidlo = "x obili"
104-
   elseif n == 7 then
104+
    	 cenajidla = 5
105-
    jidlo = "x obili"
105+
106-
    cenajidla = 5
106+
   		elseif n == 8 then
107
    	 jidlo = "x cervena repa"
108-
   elseif n == 8 then
108+
    	 cenajidla = 5
109-
    jidlo = "x cervena repa"
109+
110-
    cenajidla = 10
110+
   	 	elseif n == 9 then
111
    	 jidlo = "x meloun"
112-
   elseif n == 9 then
112+
    	 cenajidla = 5
113-
    jidlo = "x meloun"
113+
114-
    cenajidla = 5
114+
   		elseif n == 10 then
115
    	 jidlo = "x PMP divoka ryze"
116-
   elseif n == 10 then
116+
    	 cenajidla = 5
117-
    jidlo = "x PMP divoka ryze"
117+
118-
    cenajidla = 5
118+
   	 	elseif n == 11 then
119
    	 jidlo = "x jehneci"
120-
   elseif n == 11 then
120+
    	 cenajidla = 20
121-
    jidlo = "x jehneci"
121+
122-
    cenajidla = 50
122+
   	 	elseif n == 12 then
123
    	 jidlo = "x hovezi"
124-
   elseif n == 12 then
124+
    	 cenajidla = 15
125-
    jidlo = "x hovezi"
125+
126-
    cenajidla = 15
126+
   		elseif n >= 13 and n<= 18 then
127
		 cenajidla = 25
128-
   elseif n >= 13 and n<= 18 then
128+
		 local ryba = math.random(1, 17)
129-
	cenajidla = 25
129+
		 if ryba == 1  then jidlo = "x ryba"   -- 8
130-
	local ryba = math.random(1, 17)
130+
    	  elseif ryba == 2  then jidlo = "x HC raw bass"
131-
	if     ryba == 1  then jidlo = "x ryba"
131+
    	  elseif ryba == 3  then jidlo = "x HC raw carp" 
132-
    elseif ryba == 2  then jidlo = "x HC raw bass"
132+
    	  elseif ryba == 4  then jidlo = "x HC raw catfish" 
133-
    elseif ryba == 3  then jidlo = "x HC raw carp" 
133+
    	  elseif ryba == 5  then jidlo = "x HC raw grouper"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
134-
    elseif ryba == 4  then jidlo = "x HC raw catfish" 
134+
    	  elseif ryba == 6  then jidlo = "x HC raw herring"                    
135-
    elseif ryba == 5  then jidlo = "x HC raw grouper"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
135+
    	  elseif ryba == 7  then jidlo = "x HC raw tilapia"
136-
    elseif ryba == 6  then jidlo = "x HC raw herring"                    
136+
          elseif ryba == 8  then jidlo = "x HC raw tuna"
137-
    elseif ryba == 7  then jidlo = "x HC raw tilapia"
137+
    	  elseif ryba == 9  then jidlo = "x HC raw walleye"
138-
    elseif ryba == 8  then jidlo = "x HC raw tuna"
138+
    	  elseif ryba == 10 then jidlo = "x HC raw green heart fish"
139-
    elseif ryba == 9  then jidlo = "x HC raw walleye"
139+
		  elseif ryba == 11 then jidlo = "x HC raw charr"
140-
    elseif ryba == 10 then jidlo = "x HC raw green heart fish"
140+
		  elseif ryba == 12 then jidlo = "x HC raw mudfish"
141-
	elseif ryba == 11 then jidlo = "x HC raw charr"
141+
		  elseif ryba == 13 then jidlo = "x HC raw trout"
142-
	elseif ryba == 12 then jidlo = "x HC raw mudfish"
142+
		  elseif ryba == 14 then jidlo = "x HC raw anchovy"
143-
	elseif ryba == 13 then jidlo = "x HC raw trout"
143+
		  elseif ryba == 15 then jidlo = "x HC raw perch"
144-
	elseif ryba == 14 then jidlo = "x HC raw anchovy"
144+
		  elseif ryba == 16 then jidlo = "x HC raw snapper"
145-
	elseif ryba == 15 then jidlo = "x HC raw perch"
145+
		  elseif ryba == 17 then jidlo = "x HC raw eel"
146-
	elseif ryba == 16 then jidlo = "x HC raw snapper"
146+
		 end -- 8E
147-
	elseif ryba == 17 then jidlo = "x HC raw eel"
147+
148-
	end
148+
   		elseif n == 19 then
149
    	 jidlo = "x HC raw crab"
150-
   elseif n == 19 then
150+
    	 cenajidla = 25
151-
    jidlo = "x HC raw crab"
151+
152-
    cenajidla = 25
152+
   		elseif n == 20 then
153
    	 jidlo = "x HC raw crayfish"
154-
   elseif n == 20 then
154+
    	 cenajidla = 25
155-
    jidlo = "x HC raw crayfish"
155+
156-
    cenajidla = 25
156+
   		elseif n == 21 then
157
    	 jidlo = "x HC raw frog"
158-
   elseif n == 21 then
158+
    	 cenajidla = 25
159-
    jidlo = "x HC raw frog"
159+
160-
    cenajidla = 25
160+
   		elseif n == 22 then
161
    	 jidlo = "x HC raw octopus"
162-
   elseif n == 22 then
162+
    	 cenajidla = 25
163-
    jidlo = "x HC raw octopus"
163+
164-
    cenajidla = 25
164+
   		elseif n == 23 then 
165
    	 jidlo = "x HC raw scallop"
166-
   elseif n == 23 then 
166+
    	 cenajidla = 25
167-
    jidlo = "x HC raw scallop"
167+
168-
    cenajidla = 25
168+
   		elseif n == 24 then
169
    	 jidlo = "x HC raw shrimp"
170-
   elseif n == 24 then
170+
    	 cenajidla = 25
171-
    jidlo = "x HC raw shrimp"
171+
172-
    cenajidla = 25
172+
   		elseif n == 25 then
173
    	 jidlo = "x HC raw snail"
174-
   elseif n == 25 then
174+
    	 cenajidla = 25
175-
    jidlo = "x HC raw snail"
175+
176-
    cenajidla = 25
176+
   		elseif n == 26 then
177
    	 jidlo = "x HC raw turtle"
178-
   elseif n == 26 then
178+
    	 cenajidla = 25
179-
    jidlo = "x HC raw turtle"
179+
180-
    cenajidla = 25
180+
   		elseif n == 27 then
181
    	 jidlo = "x HC raw turkey"
182-
   elseif n == 27 then
182+
    	 cenajidla = 50
183-
    jidlo = "x HC raw turkey"
183+
184-
    cenajidla = 50
184+
   		elseif n == 28 then 
185
    	 jidlo = "x HC raw venison"
186-
   elseif n == 28 then 
186+
    	 cenajidla = 50
187-
    jidlo = "x HC raw venison"
187+
188-
    cenajidla = 50
188+
   		elseif n == 29 then
189
    	 jidlo = "x HC raw rabbit"
190-
   elseif n == 29 then
190+
    	 cenajidla = 50
191-
    jidlo = "x HC raw rabbit"
191+
192-
    cenajidla = 50
192+
   		elseif n == 30 then
193
    	 jidlo = "x HC raw calamari"
194-
   elseif n == 30 then
194+
   		 cenajidla = 25
195-
    jidlo = "x HC raw calamari"
195+
196-
    cenajidla = 25
196+
   		elseif n == 31 then
197
    	 jidlo = "x losos"			
198-
   elseif n == 31 then
198+
    	 cenajidla = 30                                                                   
199-
    jidlo = "x losos"			
199+
200-
    cenajidla = 30                                                                   
200+
   		elseif n == 32 then 
201
    	 jidlo = "x PMP rajce"
202-
   elseif n == 32 then 
202+
    	 cenajidla = 10
203-
    jidlo = "x PMP rajce"
203+
204-
    cenajidla = 10
204+
   		elseif n == 33 then
205
    	 jidlo = "x PMP cibule"
206-
   elseif n == 33 then
206+
    	 cenajidla = 10
207-
    jidlo = "x PMP cibule"
207+
208-
    cenajidla = 10
208+
   		elseif n == 34 then
209
    	 jidlo = "x mrkev"
210-
   elseif n == 34 then
210+
    	 cenajidla = 10
211-
    jidlo = "x mrkev"
211+
212-
    cenajidla = 10
212+
   		elseif n == 35 then 
213
    	 jidlo = "x PMP peanuts"
214-
   elseif n == 35 then 
214+
    	 cenajidla = 10     
215-
    jidlo = "x PMP peanuts"
215+
216-
    cenajidla = 10     
216+
   		elseif n == 36 then
217
    	 jidlo = "x kaktus"
218-
   elseif n == 36 then
218+
    	 cenajidla = 15
219-
    jidlo = "x kaktus"
219+
220-
    cenajidla = 15
220+
   		elseif n == 37 then
221
    	 jidlo = "x kure"
222-
   elseif n == 37 then
222+
    	 cenajidla = 10
223-
    jidlo = "x kure"
223+
224-
    cenajidla = 10
224+
   		elseif n == 38 then
225
    	 jidlo = "x veprove"
226-
   elseif n == 38 then
226+
    	 cenajidla = 20
227-
    jidlo = "x veprove"
227+
228-
    cenajidla = 20
228+
   		elseif n == 39 then
229
    	 jidlo = "x cukr"
230-
   elseif n == 39 then
230+
    	 cenajidla = 10
231-
    jidlo = "x cukr"
231+
232-
    cenajidla = 10
232+
   		elseif n == 40 then                
233
    	 jidlo = "x PMP blueberry"
234-
   elseif n == 40 then                
234+
    	 cenajidla = 5
235-
    jidlo = "x PMP blueberry"
235+
236-
    cenajidla = 5
236+
   		elseif n == 41 then
237
    	 jidlo = "x PMP strawberry"
238-
   elseif n == 41 then
238+
    	 cenajidla = 5
239-
    jidlo = "x PMP strawberry"
239+
240-
    cenajidla = 5
240+
   		elseif n == 42 then
241
    	 jidlo = "x PMP blackberry"
242-
   elseif n == 42 then
242+
    	 cenajidla = 5
243-
    jidlo = "x PMP blackberry"
243+
244-
    cenajidla = 5
244+
   		elseif n == 43 then
245
    	 jidlo = "x PMP whiteberry" 
246-
   elseif n == 43 then
246+
    	 cenajidla = 5
247-
    jidlo = "x PMP whiteberry" 
247+
248-
    cenajidla = 5
248+
   		elseif n == 44 then
249
    	 jidlo = "x PMP gooseberry"
250-
   elseif n == 44 then
250+
    	 cenajidla = 5
251-
    jidlo = "x PMP gooseberry"
251+
252-
    cenajidla = 5
252+
   		elseif n == 45 then
253
    	 jidlo = "x PMP beautyberry"
254-
   elseif n == 45 then
254+
    	 cenajidla = 5                                                                           
255-
    jidlo = "x PMP beautyberry"
255+
256-
    cenajidla = 5                                                                           
256+
   		elseif n == 46 then
257
    	 jidlo = "x PMP orangeberry"
258-
   elseif n == 46 then
258+
    	 cenajidla = 5
259-
    jidlo = "x PMP orangeberry"
259+
260-
    cenajidla = 5
260+
   		elseif n == 47 then
261
    	 jidlo = "x brambory"
262-
   elseif n == 47 then
262+
    	 cenajidla = 5
263-
    jidlo = "x brambory"
263+
264-
    cenajidla = 5
264+
  		elseif n == 48 then
265
    	 jidlo = "x HC avocado"
266-
  elseif n == 48 then
266+
    	 cenajidla = 5
267-
    jidlo = "x HC avocado"
267+
268-
    cenajidla = 5
268+
  	 	elseif n == 49 then
269
    	 jidlo = "x HC olive"
270-
  elseif n == 49 then
270+
    	 cenajidla = 5
271-
    jidlo = "x HC olive"
271+
272-
    cenajidla = 5
272+
  		elseif n == 50 then
273
    	 jidlo = "x HC pea"
274-
  elseif n == 50 then
274+
    	 cenajidla = 5
275-
    jidlo = "x HC pea"
275+
276-
    cenajidla = 5
276+
  		elseif n == 51 then
277
    	 jidlo = "x HC chilli"
278-
  elseif n == 51 then
278+
    	 cenajidla = 5
279-
    jidlo = "x HC chilli"
279+
280-
    cenajidla = 5
280+
  		elseif n == 52 then
281
    	 jidlo = "x HC plum"
282-
  elseif n == 52 then
282+
    	 cenajidla = 5
283-
    jidlo = "x HC plum"
283+
284-
    cenajidla = 5
284+
  		elseif n == 53 then
285
    	 jidlo = "x HC lemon"
286-
  elseif n == 53 then
286+
    	 cenajidla = 5
287-
    jidlo = "x HC lemon"
287+
288-
    cenajidla = 5
288+
  		elseif n == 54 then
289
    	 jidlo = "x HC tea leaf"
290-
  elseif n == 54 then
290+
    	 cenajidla = 5
291-
    jidlo = "x HC tea leaf"
291+
292-
    cenajidla = 5
292+
  		elseif n == 55 then
293
    	 jidlo = "x HC soybean"
294-
  elseif n == 55 then
294+
    	 cenajidla = 5
295-
    jidlo = "x HC soybean"
295+
296-
    cenajidla = 5
296+
  		elseif n == 56 then
297
    	 jidlo = "x HC asparagus"
298-
  elseif n == 56 then
298+
    	 cenajidla = 5
299-
    jidlo = "x HC asparagus"
299+
300-
    cenajidla = 5
300+
 		elseif n == 57 then
301
    	 jidlo = "x HC garlic"
302-
  elseif n == 57 then
302+
    	 cenajidla = 5
303-
    jidlo = "x HC garlic"
303+
304-
    cenajidla = 5
304+
  		elseif n == 58 then
305
    	 jidlo = "x HC rhubarb"
306-
  elseif n == 58 then
306+
    	 cenajidla = 5
307-
    jidlo = "x HC rhubarb"
307+
308-
    cenajidla = 5
308+
  		elseif n == 59 then
309
    	 jidlo = "x HC grape"
310-
  elseif n == 59 then
310+
    	 cenajidla = 5
311-
    jidlo = "x HC grape"
311+
312-
    cenajidla = 5
312+
  		elseif n == 60 then
313
    	 jidlo = "x HC mustard"
314-
  elseif n == 60 then
314+
    	 cenajidla = 5
315-
    jidlo = "x HC mustard"
315+
316-
    cenajidla = 5
316+
  		elseif n == 61 then
317
    	 jidlo = "x HC coconut"
318-
  elseif n == 61 then
318+
    	 cenajidla = 5
319-
    jidlo = "x HC coconut"
319+
320-
    cenajidla = 5
320+
  		elseif n == 62 then
321
    	 jidlo = "x HC maple syrup"
322-
  elseif n == 62 then
322+
    	 cenajidla = 10  
323-
    jidlo = "x HC maple syrup"
323+
324-
    cenajidla = 10  
324+
  		elseif n == 63 then
325
    	 jidlo = "x HC orange"
326-
  elseif n == 63 then
326+
    	 cenajidla = 5
327-
    jidlo = "x HC orange"
327+
328-
    cenajidla = 5
328+
  		elseif n == 64 then
329
    	 jidlo = "x HC chestnut"
330-
  elseif n == 64 then
330+
    	 cenajidla = 5
331-
    jidlo = "x HC chestnut"
331+
332-
    cenajidla = 5
332+
 		elseif n == 65 then
333
    	 jidlo = "x HC cherry"
334-
 elseif n == 65 then
334+
		 cenajidla = 5
335-
    jidlo = "x HC cherry"
335+
336-
	cenajidla = 5
336+
 		elseif n == 66 then
337
		 jidlo = "x HC banana"
338-
 elseif n == 66 then
338+
		 cenajidla = 5
339-
	jidlo = "HC banana"
339+
340-
	cenajidla = 5
340+
 		elseif n == 67 then
341
		 jidlo = "x HC cashew"
342-
 elseif n == 67 then
342+
		 cenajidla = 5
343-
	jidlo = "HC cashew"
343+
344-
	cenajidla = 5
344+
 		elseif n == 68 then
345
		 jidlo = "x HC grapefruit"
346-
 elseif n == 68 then
346+
		 cenajidla = 5
347-
	jidlo = "HC grapefruit"
347+
348-
	cenajidla = 5
348+
 		elseif n == 69 then
349
		 jidlo = "x HC cinnamon"
350-
 elseif n == 69 then
350+
		 cenajidla = 10
351-
	jidlo = "HC cinnamon"
351+
352-
	cenajidla = 10
352+
 		elseif n == 70 then
353
		 jidlo = "x HC vanilla bean"
354-
 elseif n == 70 then
354+
		 cenajidla = 5
355-
	jidlo = "HC vanilla bean"
355+
356-
	cenajidla = 5
356+
 		elseif n == 71 then
357
 		 jidlo = "x HC fig"
358-
 elseif n == 71 then
358+
		 cenajidla = 5
359-
 	jidlo = "HC fig"
359+
360-
	cenajidla = 5
360+
 		elseif n == 72 then
361
		 jidlo = "x HC almond"
362-
 elseif n == 72 then
362+
		 cenajidla = 5
363-
	jidlo = "HC almond"
363+
364-
	cenajidla = 5
364+
 		elseif n == 73 then
365
		 jidlo = "x HC pomegranate"
366-
 elseif n == 73 then
366+
		 cenajidla = 5
367-
	jidlo = "HC pomegranate"
367+
368-
	cenajidla = 5
368+
 		elseif n == 74 then
369
		 jidlo = "x HC pepper"
370-
 elseif n == 74 then
370+
		 cenajidla = 5
371-
	jidlo = "HC pepper"
371+
372-
	cenajidla = 5
372+
 		elseif n == 75 then
373
		 jidlo = "x HC broccoli"
374-
 elseif n == 75 then
374+
		 cenajidla = 5
375-
	jidlo = "HC broccoli"
375+
376-
	cenajidla = 5
376+
 		elseif n == 76 then
377
		 jidlo = "x HC coffee"
378-
 elseif n == 76 then
378+
		 cenajidla = 5
379-
	jidlo = "HC coffee"
379+
380-
	cenajidla = 5
380+
 		elseif n == 77 then
381
		 jidlo = "x HC lime"
382-
 elseif n == 77 then
382+
		 cenajidla = 5
383-
	jidlo = "HC lime"
383+
384-
	cenajidla = 5
384+
 		elseif n == 78 then
385
		 jidlo = "x HC date"
386-
 elseif n == 78 then
386+
		 cenajidla = 5
387-
	jidlo = "HC date"
387+
388-
	cenajidla = 5
388+
 		elseif n == 79 then
389
		 jidlo = "x HC ginger"
390-
 elseif n == 79 then
390+
		 cenajidla = 5
391-
	jidlo = "HC ginger"
391+
392-
	cenajidla = 5
392+
 		elseif n == 80 then
393
		 jidlo = "x HC zucchini"
394-
 elseif n == 80 then
394+
		 cenajidla = 5
395-
	jidlo = "HC zucchini"
395+
396-
	cenajidla = 5
396+
 		elseif n == 81 then
397
 		 jidlo = "x HC honey"
398-
 elseif n == 81 then
398+
		 cenajidla = 5
399-
 	jidlo = "HC honey"
399+
400-
	cenajidla = 5
400+
 		elseif n == 82 then
401
		 jidlo = "x PC wine grapes"
402-
 elseif n == 82 then
402+
		 cenajidla = 5
403-
	jidlo = "PC wine grapes"
403+
404-
	cenajidla = 5
404+
 		elseif n == 83 then
405
		 jidlo = "x eggs"
406-
  elseif n >= 83 and n<= 95 then
406+
		 cenajidla = 5
407-
    jidlo = "x jidlo"
407+
408-
    cenajidla = 10
408+
  		elseif n >= 84 and n<= 96 then
409
    	 jidlo = "x jidlo"
410-
   elseif n >= 96 and n<= 192 then
410+
    	 cenajidla = 10
411-
   slot = slot - 1 
411+
412-
               
412+
 		elseif n >= 97 and n <= 194 then
413-
  end
413+
   	 	 slot = 0 
414-
  end
414+
415
  		    
416-
    vacancy = vacancy - 1
416+
        end    -- konec rng jidla 7E
417-
     cena = cenajidla * pocet
417+
      end -- konec while loop pro generaci poptavky 5E
418-
 local t = {}
418+
419-
 t[1] = pocet
419+
420-
 t[2] = jidlo
420+
    cena = cenajidla * pocet
421-
 t[3] = cena
421+
 	local t = {}           
422-
 t[4] = myID
422+
 	t[1] = pocet
423-
 t[5] = "F"
423+
 	t[2] = jidlo
424-
 t[6] = "David's Corner"
424+
 	t[3] = cena
425-
 local msg = textutils.serialize(t)
425+
 	t[4] = myID
426-
 rednet.open("top")
426+
 	t[5] = "F"
427-
 rednet.broadcast(msg, "offer")
427+
 	t[6] = "David's Corner"
428
 	local msg = textutils.serialize(t)
429
 	
430-
 local id, msg = rednet.receive(2)
430+
  	rednet.open("top")
431-
 if msg == "full" then
431+
 	rednet.broadcast(msg, "offer")
432-
   sleep(3)
432+
 	local id, msg = rednet.receive(2)
433-
   slot = 0
433+
 	if msg == "full" then   -- overi dostupnost slotu - pokud neni volny, opakuj gen 9
434
   		sleep(3)
435-
 else
435+
   		znovu = 1
436-
   print("-----------------------------")
436+
437
 	else
438-
   print("Vyplata: ", cena," kreditu.")
438+
		znovu = 0
439
   		print("-----------------------------")  -- pokud je volny slot, vypis poptavku
440-
   local savetable = {}
440+
   		print("Objednavka: ", pocet, jidlo)
441-
   cena = cenajidla * pocet
441+
   		print("Vyplata: ", cena," kreditu.")
442-
   savetable[1] = pocet
442+
443-
   savetable[2] = jidlo
443+
   		local savetable = {}
444-
   savetable[3] = cena
444+
   		cena = cenajidla * pocet
445
   		savetable[1] = pocet
446-
   local fileWT = fs.open("currentoffer", "w")
446+
   		savetable[2] = jidlo
447-
   fileWT.write(textutils.serialize(savetable))
447+
   		savetable[3] = cena
448-
   fileWT.close()
448+
449
   		local fileWT = fs.open("currentoffer", "w")
450-
    passwordD = "david"
450+
   		fileWT.write(textutils.serialize(savetable))
451-
 passwordF = "filip"
451+
   		fileWT.close()
452
   
453-
 local heslonerozpoznano = true
453+
        passwordD = "david"
454-
 while heslonerozpoznano do  
454+
 		passwordF = "filip"
455-
   write("Heslo: ")
455+
456-
   local input = read("*")
456+
 		local heslonerozpoznano = true
457-
   if input == passwordD
457+
 		while heslonerozpoznano do   -- 10
458-
   then 
458+
   			write("Heslo: ")
459
   			local input = read("*")
460
   			if input == passwordD then -- 11
461
      			heslonerozpoznano = false
462
      			print ("Objednavka prijata. Na ucet David bylo pripsano " .. cena .. " kreditu.")
463
      			rednet.open("top")
464
	  			rednet.broadcast("poptavka", "ucel")
465-
      slot = slot - 1
465+
      			rednet.broadcast("David","kdo")
466
      			rednet.broadcast(cena,"kolik")
467-
 hotovot[4] = myID
467+
      			slot = 0
468-
 hotovot[5] = "F"
468+
      			hotovot = {}
469-
 local msg = textutils.serialize(hotovot)
469+
 				hotovot[4] = myID
470-
 rednet.open("top")
470+
 				hotovot[5] = "F"
471-
 rednet.broadcast(msg, "offer")
471+
 				local msg = textutils.serialize(hotovot)
472-
 fs.delete("currentoffer")
472+
 			 	rednet.broadcast(msg, "offer")
473-
 sleep(3)
473+
 				fs.delete("currentoffer")
474
 				sleep(3)
475-
   elseif input == passwordF
475+
476-
   then
476+
   			elseif input == passwordF then
477
      			heslonerozpoznano = false
478
      			print ("Objednavka prijata. Na ucet Filip bylo pripsano " .. cena .. " kreditu.")
479
      			rednet.open("top")
480
	  			rednet.broadcast("poptavka", "ucel")
481
      			rednet.broadcast("Filip","kdo")
482
      			rednet.broadcast(cena,"kolik")
483-
      slot = slot - 1
483+
      			slot = 0
484
      			hotovot = {}
485-
 hotovot[4] = myID
485+
 				hotovot[4] = myID
486-
 hotovot[5] = "F"
486+
 				hotovot[5] = "F"
487-
 local msg = textutils.serialize(hotovot)
487+
 				local msg = textutils.serialize(hotovot)
488-
 rednet.open("top")
488+
 				rednet.broadcast(msg, "offer")
489-
 rednet.broadcast(msg, "offer")
489+
 				fs.delete("currentoffer")
490-
 fs.delete("currentoffer")
490+
 				sleep(3)
491-
 sleep(3)
491+
492
   			else print("Heslo nerozpoznano")
493-
   else print("Heslo nerozpoznano")
493+
   			sleep(1)
494
   			end      -- konec overeni hesla 11E
495-
   end
495+
  		end  -- konec loopu pro heslo 10E
496-
  end
496+
  	end  -- konec overeni dostupnosti slotu 9E
497-
  end 
497+
    end -- konec znovu loopu 4,5E
498-
    vacancy = vacancy + 1 
498+
    znovu = 1
499-
   end
499+
   end -- konec while loopu pro gen poptavky 2E
500-
  end      
500+
  end -- konec if statement pro overeni existence currentoffer 1E