# rinwork
if $ARGS[0] = 'start':
	$metkaM = $ARGS[0]
	$locM = $CURLOC
	$metka = $ARGS[0]
	$loc = $CURLOC

	$answerrin = {
		if tipred = pokti:
			if pokvnirand = 0:
				pokpay = rand(1000, 1200)
			elseif pokvnirand = 1:
				pokpay = rand(1200, 1500)
			elseif pokvnirand = 2:
				pokpay = rand(1500, 2000)
			end
		else
			$rinitog = '<<$poktip>> puts the item back and leaves.'
			pokupatel = 0
		end
	}

	$answerrin2 = {
		act 'Name the price':
			cla
			prodpay = input ("Enter the selling price")

			if prodpay < 1000:prodpay = prodpayum

			'You tell them <<prodpay>> <b>₽</b>'

			if prodpay <= pokpay:
				poknorand = rand(1, 100 + vnesh/4)

				if poknorand >= 10:
					rinmon += prodpay
					rinvesh += 1
					'The buyer takes the item and pays <<prodpay>> <b>₽</b>.'

					act 'Trading on':gt 'rinwork', 'start'
				else
					'The buyer twirls clothing in thier hands <<prodpay>> <b>₽</b> is too expensive.'
					dynamic $answerrin3

					act 'I can not take less (take the item)':gt 'rinwork', 'start'
				end
			elseif prodpay > pokpay and prodpay <= pokpay + 100:
				poknorand = rand(1, 100 + vnesh/4)

				if poknorand >= 10:
					'The buyer twirls clothing in thier hands <<prodpay>> <b>₽</b> is too expensive.'
					dynamic $answerrin3

					act 'I can not take less (take the item)':gt 'rinwork', 'start'
				else
					'Buyer puts thing into place and leaves'

					act 'Trading on':gt 'rinwork', 'start'
				end
			elseif prodpay > pokpay + 100:
				'The buyer puts the item back and leaves.'

				act 'Trading on':gt 'rinwork', 'start'
			end
		end
	}

	$answerrin3 = {
		if prodpay >= 1100:
			act 'Reduce the price by 100 <b>₽</b>':
				cla
				'You have reduced the price by 100 <b>₽</b>.'
				poknorand = rand(1, 100 + vnesh/4)

				if poknorand >= 10:
					rinmon += prodpay - 100
					rinvesh += 1
					'The buyer takes the item and pays <<prodpay - 100>> <b>₽</b>'

					act 'Trading on':gt 'rinwork', 'start'
				else
					'The buyer puts the item back and leaves.'

					act 'Trading on':gt 'rinwork', 'start'
				end
			end
		elseif prodpay >= 1050:
			act 'Reduce the price by 50 <b>₽</b>':
				cla
				'You have reduced the price by 50 <b>₽</b>.'
				poknorand = rand(1, 100 + vnesh/4)

				if poknorand >= 30:
					rinmon += prodpay - 50
					rinvesh += 1
					'The buyer takes the item and pays <<prodpay - 50>> <b>₽</b>'

					act 'Trading on':gt 'rinwork', 'start'
				else
					'The buyer puts the item back and leaves.'

					act 'Trading on':gt 'rinwork', 'start'
				end
			end
		end
	}

	cla
	*clr
	gs 'stat'
	'<center><b><font color="maroon">Marketplace</font></b></center>'
	'<center><img src="images/etogame/rinok.jpg"></center>'
	'You stand at your clothes stall waiting for buyers.'
	'Cash taken <<rinmon>> <b>₽</b>, You have sold <<rinvesh>> items.'
	'The average price on the market <<prodpayum>>'

	if hour = 14:
		'Arthur cames to you and you start to calculate how much you should give him.'

		act 'Give money to Arthur':
			cla
			*clr
			rinart = rinvesh * 1000
			rinmon -= rinart
			money += rinmon
			gs 'stat'
			'You gave Arthur <<rinart>> per sold <<rinvesh>> things.'
			'Today you have earned <<rinmon>> <b>₽</b>'

			if rinart < arturplan:
				arturnoo += 1
				'Uh, <<$name>>, this is bad, you haven''t made enough money. You will completely ruin me.'
			else
				arturyes += 1
				'Well done <<$name>>, good job.'
			end

			if arturnoo > arturyes:arturnoo = arturnoo - arturyes & arturyes = 0
			if arturyes > arturnoo:arturyes = arturyes - arturnoo & arturnoo = 0
			if arturnoo = arturyes:arturnoo = 0 & arturyes = 0

			rinmon = 0
			rinvesh = 0

			if arturnoo > 10:
				arturnoo = 0
				work = 0
				workrin = 0
				'Uh, you''re fucking useless. Here''s your papers. Hit the road, I do not want to see you ever again!'

				act 'Leave':gt 'street'

				exit
			end

			rinrand = rand(1, 400)

			if rinrand < vnesh and palevorin = 0 and rinhoz = 0:
				'"Hey <<$name>>, you and I have not even met properly. Come into the warehouse, eat barbecue, drink and get acquainted.'

				act 'Refuse':
					cla
					'You start making excuses. Arthur says to you, "Hey, don''t insult me, your stall have is dirty, it has dust and dirt all over it. I should fine you, but if you''re nice I let you off.'

					act 'Goto warehouse':gt 'RynokHoz', 'the_beginning'

					act 'No':
						cla
						arturplan += 1000

						if money >= 1000:
							money -= 1000
							'Hey, your stall is dirty, you owe a thousand <b>₽</b>, in fine. Arthur takes the money.'
						else
							'Go with him, before it gets worse'
						end

						act 'Leave.':gt 'street'
					end
				end

				act 'Goto warehouse':gt 'RynokHoz', 'the_beginning'

				exit
			elseif rinrand < vnesh and palevorin = 0 and rinhoz = 1:
				'"Hey <<$name>>. Come into the warehouse, eat barbecue, drink, rest." He walks right up to you and slaps you on the ass.'

				act 'Refuse':
					cla
					'You start making excuses. Arthur says to you, "Hey, don''t insult me, your stall have is dirty, it has dust and dirt all over it. I should fine you, but if you''re nice I let you off.'

					act 'Goto warehouse':gt 'RynokHoz', 'the_beginning'

					act 'No':
						cla
						arturplan += 1000

						if money >= 1000:
							money -= 1000
							'Hey, your stall is dirty, you owe a thousand <b>₽</b>, in fine. Arthur takes the money.'
						else
							'Go with him, before it gets worse'
						end

						act 'Leave.':gt 'street'
					end
				end

				act 'Come':gt 'RynokHoz', 'the_beginning'

				exit
			end

			act 'Leave work':gt 'street'
		end

		exit
	elseif hour < 14:
		pokrand = rand(0, 1)

		if pokrand = 0:
			$pokup = 'You have no customers.'
			pokupatel = 0
			''
			'Aunt Katya pushes her trolley through the market carrying cakes and coffee.'
		else
			pokupatel = 1
			poktiprand = rand(0, 7)

			if poktiprand = 0:$pokup = 'A middle-aged man approaches your stall.' & $poktip = 'Man' & pokti = 1
			if poktiprand = 1:$pokup = 'A young man approaches your stall.' & $poktip = 'Guy' & pokti = 2
			if poktiprand = 2:$pokup = 'A teenage boy approaches your stall.' & $poktip = 'Boy' & pokti = 3
			if poktiprand = 3:$pokup = 'A woman approaches your stall.' & $poktip = 'Woman' & pokti = 1
			if poktiprand = 4:$pokup = 'A girl approaches your stall.' & $poktip = 'Girl' & pokti = 2
			if poktiprand = 5:$pokup = 'A teen girl approaches your stall.' & $poktip = 'Girlfriend' & pokti = 3
			if poktiprand = 6:$pokup = 'An old man  approaches your stall.' & $poktip = 'Old man' & pokti = 0
			if poktiprand = 7:$pokup = 'A Grandma  approaches your stall.' & $poktip = 'Granny' & pokti = 0
		end

		'<b><<$pokup>></b>'

		if pokupatel = 1:
			act 'What do you want?':
				cla
				minut += 15
				pokvnirand = rand(0, 2)

				if pokvnirand = 0:
					'<<$poktip>> with little interest examines your wares.'
				elseif pokvnirand = 1:
					'<<$poktip>> with interest looks through the clothes for sale.'
				elseif pokvnirand = 2:
					'<<$poktip>> picks up the item.'
				end

				!!dynamic $answerrin
				act 'Now this is very fashionable':
					cla
					tipred = 3
					dynamic $answerrin
					'<<$rinitog>>'

					if pokupatel = 0:act 'Further':gt 'rinwork', 'start'

					if pokupatel = 1:
						'<<$poktip>> asks you for a price'
						dynamic $answerrin2
					end
				end

				act 'This item is very high quality and reliable':
					cla
					tipred = 1
					dynamic $answerrin
					'<<$rinitog>>'

					if pokupatel = 0:act 'Further':gt 'rinwork', 'start'

					if pokupatel = 1:
						'<<$poktip>> asks you for a price'
						dynamic $answerrin2
					end
				end

				act 'You''ll find this very reasonable':
					cla
					tipred = 0
					dynamic $answerrin
					'<<$rinitog>>'

					if pokupatel = 0:act 'Further':gt 'rinwork', 'start'

					if pokupatel = 1:
						'<<$poktip>> asks you for a price'
						dynamic $answerrin2
					end
				end

				act 'That is so you':
					cla
					tipred = 2
					dynamic $answerrin
					'<<$rinitog>>'

					if pokupatel = 0:act 'Further':gt 'rinwork', 'start'

					if pokupatel = 1:
						'<<$poktip>> asks you for a price'
						dynamic $answerrin2
					end
				end
			end
		end

		act 'Laze around (0:15)':
			minut += 15
			gt 'rinwork', 'start'
		end

		if hour = 9:
			rintakrand = rand(0, 5)

			if rintakrand = 0:
				$rintak = ' Hassan unloads clothes in front of saleswoman Nadias stall.'

				act 'See Hassan and Nadia':
					cla
					minut += 15
					talkrand = rand(0, 2)

					if talkrand = 0:'Hassan utters to Nadia. "Today you will sell more, and to the rich ladies, I need the money."'
					if talkrand = 1:'Hassan opens trunks and puts clothes on the counter.'
					if talkrand = 2:'Hassan drags trunks to his stall.'

					act 'Further':gt 'rinwork', 'start'
				end
			elseif rintakrand = 1:
				$rintak = 'On the next stall Abdul is talking loudly aand giving clothes to saleswoman Anna.'

				act 'Look at Abdul and Anna':
					cla
					minut += 15
					talkrand = rand(0, 2)

					if talkrand = 0:'Abdul swears. "We''re fucked, you can not sell anything!" Anna retorts, "You give me this rotten shit to sell, take it nobody wants it."'
					if talkrand = 1:'Abdul slaps Annas ass, she pretends that nothing happened.'
					if talkrand = 2:'Abdul drags trunks to his stall.'

					act 'Further':gt 'rinwork', 'start'
				end
			elseif rintakrand = 2:
				$rintak = 'Abdul and Hassan stand beside your stall and saying something guttural.'

				act 'View the Caucasians':
					cla
					minut += 15
					talkrand = rand(0, 2)

					if talkrand = 0:'Abdul and Hassan continue to talk about something, you do not know the language, and can not understand what they say.'
					if talkrand = 1:'Abdul and Hassan ignore you and discuss what sounds like clothes prices.'
					if talkrand = 2:'Abdul looks at you and says to Hassan, "Look at that a girl, good fuck, yeah."'

					act 'Further':gt 'rinwork', 'start'
				end
			elseif rintakrand = 3:
				$rintak = 'Anna hangs clothes on her stall shouting at Nadia.'

				act 'Chat with girls':
					cla
					annaQW += 1
					NadiaQW += 1
					minut += 15
					talkrand = rand(0, 2)

					if talkrand = 0:
						'Anna tells you that her skirt needed altering, there is a great Jewish tailor, his shop is nearby.'
					else
						'Nadia tells her how some pervert molested her on the subway rubbing his dick on her ass.'
					end

					act 'Further':gt 'rinwork', 'start'
				end
			elseif rintakrand = 4:
				$rintak = 'Arthur is talking about something with Abdullah.'

				act 'View the Caucasians':
					cla
					minut += 15
					talkrand = rand(0, 2)

					if talkrand = 0:'Abdul and Arthur continue to talk about something, you do not know the language, and can not understand what they say.'
					if talkrand = 1:'Abdul and Arthur ignore you and discuss what sounds like clothes prices.'
					if talkrand = 2:'Abdul looks at you and says to Arthur, "Nice girl you got there, you fucking her?."'

					act 'Further':gt 'rinwork', 'start'
				end
			elseif rintakrand = 5:
				$rintak = 'Arthur, Abdul Hassan are neighing loudly and talk about something in foreign language.'

				act 'View the Caucasians':
					cla
					minut += 15
					talkrand = rand(0, 2)

					if talkrand = 0:'Caucasians continue to talk about something, you do not know the language, and can not understand what they say.'
					if talkrand = 1:'Caucasians ignore you and discuss what sounds like clothes prices.'
					if talkrand = 2:'Abdul looks at you and says to the other Caucasians, "Pretty little girl, can i have her?"'

					act 'Further':gt 'rinwork', 'start'
				end
			end

			'<<$rintak>>'
		elseif hour = 10:
			rintakrand = rand(0, 5)

			if rintakrand = 0:
				$rintak = 'Hassan sits on a chair dejectedly chewing food and talking with his mouth full with saleswoman Nadia.'

				act 'Watch Hasan':
					cla
					minut += 15
					'Hassan says to Nadia "Nadia, why you refuse? Come here, have some wine."'

					act 'Further':gt 'rinwork', 'start'
				end
			elseif rintakrand = 1:
				$rintak = 'At the stall in front of you sits Nadia doing crossword puzzles.'

				act 'Chat with Nadia':
					cla
					!!annaQW += 1
					NadiaQW += 1
					minut += 15
					'Nadia leaves the crossword and willingly gossips with you.'
					act 'Further':gt 'rinwork', 'start'
				end
			elseif rintakrand = 2:
				$rintak = 'Nadias stall in front of you has many buyers and she fusses before them laying out goods.'

				act 'Chat with Nadia':
					cla
					!!annaQW += 1
					NadiaQW -= 1
					minut += 15
					'Nadia is not happy, "Shoo, no distractions, I have buyers."'

					act 'Further':gt 'rinwork', 'start'
				end
			elseif rintakrand = 3:
				$rintak = 'At the next stall Anna is drinking coffee.'

				act 'Chat with Anna':
					cla
					annaQW += 1
					!!NadiaQW -= 1
					minut += 15
					'Anna is happy to chat with you about any old nonsense.'

					act 'Further':gt 'rinwork', 'start'
				end
			elseif rintakrand = 4:
				$rintak = 'At the next stall Anna tries to interest buyers in her goods.'

				act 'Chat with Anna':
					cla
					annaQW -= 1
					!!NadiaQW -= 1
					minut += 15
					'Anya is not happy, "Shoo, no distractions, I have buyers."'

					act 'Further':gt 'rinwork', 'start'
				end
			elseif rintakrand = 5:
				$rintak = 'Anna is gossiping with Aunt Katya.'

				act 'Chat with Anna and Aunt Katya':
					cla
					annaQW += 1
					!!NadiaQW += 1
					tetaKataQW += 1
					minut += 15
					'Aunt Katya is talking about her pies and Anya complains that it because of her bloody pies that her ass is twice as big as it was...'

					act 'Further':gt 'rinwork', 'start'
				end
			end

			'<<$rintak>>'
		elseif hour = 11:
			rintakrand = rand(0, 5)

			if rintakrand = 0:
				$rintak = 'Nadia is approached by three Caucasian, Aslan, Camille and Mukhtar and they begin to molest her, she swears at them and tries to dodge.'

				act 'Look at Nadia and Caucasians.':
					cla
					!!annaQW += 1
					!!NadiaQW += 1
					!!tetaKataQW += 1
					minut += 15
					'The Caucasians seem to be trying to persude Nadia to have sex with them.'

					act 'Further':gt 'rinwork', 'start'
				end
			elseif rintakrand = 1:
				$rintak = 'At the stall in front of you sits Nadia eating cake.'

				act 'Chat with Nadia':
					cla
					!!annaQW += 1
					NadiaQW += 1
					minut += 15
					'Nadia finishes the cake and mubbles about the usual nonsense with you.'

					if clener = 0:
						clener = 1
						'Nadia tells you about an office building not too far away that is looking for a cleaner.'
					end

					act 'Further':gt 'rinwork', 'start'
				end
			elseif rintakrand = 2:
				$rintak = 'Nadias stall in front of you has many buyers and she fusses before them laying out goods.'

				act 'Chat with Nadia':
					cla
					!!annaQW += 1
					NadiaQW -= 1
					minut += 15
					'Nadia is not happy, "Shoo, no distractions, I have buyers."'

					act 'Further':gt 'rinwork', 'start'
				end
			elseif rintakrand = 3:
				$rintak = 'At the next stall Anna is reading a newspaper.'

				act 'Chat with Anna':
					cla
					annaQW += 1
					!!NadiaQW -= 1
					minut += 15
					'Anna is happy to chat with you about any old nonsense.'

					act 'Further':gt 'rinwork', 'start'
				end
			elseif rintakrand = 4:
				$rintak = 'At the next stall Anna tries to interest buyers in her goods.'

				act 'Chat with Anna':
					cla
					annaQW -= 1
					!!NadiaQW -= 1
					minut += 15
					'Anya is not happy, "Shoo, no distractions, I have buyers."'

					act 'Further':gt 'rinwork', 'start'
				end
			elseif rintakrand = 5:
				$rintak = 'Nadia is approached by three Caucasian, Aslan, Camille and Mukhtar and they begin to molest her, she swears at them and tries to dodge.'

				act 'Look at Nadia and Caucasians.':
					cla
					!!annaQW += 1
					!!NadiaQW += 1
					!!tetaKataQW += 1
					minut += 15
					'The Caucasians seem to be trying to persude Nadia to have sex with them.'

					act 'Further':gt 'rinwork', 'start'
				end
			end

			'<<$rintak>>'
		elseif hour = 12:
			rintakrand = rand(0, 5)

			if rintakrand = 0:
				$rintak = 'Hasan has bought chebureki and is eating it while sitting behind Nadia in the stall.'

				act 'Chat with Nadia':
					cla
					!!annaQW += 1
					NadiaQW -= 1
					minut += 15
					'Nadia shies away from talking in front of Hassan.'

					act 'Further':gt 'rinwork', 'start'
				end
			elseif rintakrand = 1:
				$rintak = 'Nadia is surrounded by customers.'

				act 'Chat with Nadia':
					cla
					!!annaQW += 1
					NadiaQW -= 1
					minut += 15
					'Nadia is not happy, "Shoo, no distractions, I have buyers."'

					act 'Further':gt 'rinwork', 'start'
				end
			elseif rintakrand = 2:
				$rintak = 'Nadia talks with Anna.'

				act 'Chat with girls':
					cla
					annaQW += 1
					NadiaQW += 1
					minut += 15
					talkrand = rand(0, 2)

					if talkrand = 0:
						'Anna tells you that her friend used to clean an office building not far from here, they are looking for a new cleaner if you need to make some extra cash.'

						if clener = 0:clener = 1

					elseif talkrand = 1:
						'Nadia tells her how some pervert molested her on the subway rubbing his dick on her ass.'
					end

					act 'Further':gt 'rinwork', 'start'
				end
			elseif rintakrand = 3:
				$rintak = 'Anna  is selling clothing to customers.'

				act 'Chat with Anna':
					cla
					annaQW -= 1
					!!NadiaQW -= 1
					minut += 15
					'Anna is not happy, "Shoo, no distractions, I have buyers."'

					act 'Further':gt 'rinwork', 'start'
				end
			elseif rintakrand = 4:
				$rintak = 'Anna is drinking coffee sitting at her stall.'

				act 'Chat with Anna':
					cla
					annaQW += 1
					!!NadiaQW -= 1
					minut += 15
					'Anna happily chats with you about nonsense.'

					act 'Further':gt 'rinwork', 'start'
				end
			elseif rintakrand = 5:
				$rintak = 'Nadia is idly trying to catch flies.'

				act 'Chat with Nadia':
					cla
					!!annaQW += 1
					NadiaQW += 2
					minut += 15
					'Nadia glad for the distraction and has fun chatting with you.'

					act 'Further':gt 'rinwork', 'start'
				end
			end

			'<<$rintak>>'
		elseif hour = 13:
			rintakrand = rand(0, 5)

			if rintakrand = 0:
				$rintak = 'Hassan begins to slowly collect goods from Nadia.'
			elseif rintakrand = 1:
				$rintak = 'Anya sits and calculates her profit for the day.'
			elseif rintakrand = 2:
				$rintak = 'Nadia calculates her days profit.'
			elseif rintakrand = 3:
				$rintak = 'Abdul begins collecting goods from Anna.'
			elseif rintakrand = 4:
				$rintak = 'Past your stall walks Arthur.'
			else
				$rintak = 'Aunt Katya stops trading pies and leaves.'
			end

			'<<$rintak>>'
		end

		if money >= 200:
			act 'Buy a snack (200 <b>₽</b>) (0:15)':
				tetaKataQW += 1
				money -= 200
				gs 'kit_din'
				dynamic $snack
			end
		end
	end
end

--- rinwork ---------------------------------

