# uni_shop
!2021/10/27

if $ARGS[0] = 'start' or $ARGS[0] = '':
	*clr & cla
	$loc = 'uni_shop'
	$loc_arg = 'start'
	$menu_loc = 'uni_shop'
	$menu_arg = 'start'
	$location_type = 'public_indoors'
	killvar '$locclass'
	killvar '$shoplocation'
	menu_off = 0
	gs 'themes', 'indoors'
	if sound = 0:PLAY 'sound/shop.mp3',30
	gs 'stat' 
	*clr & cla


	if hour < 8 or hour >= 23:
		'The store is currently closed.'
		act 'Leave':minut += 2 & gt 'city_island'
		exit
	end

	'In the store is an <a href="exec: gt ''uni_shop'', ''atm''">ATM</a>, from which you can withdraw money and deposit money into your bank account.'

	act 'Browse the aisles': gt 'uni_shop', 'cart'
	

	act 'Leave the store':minut += 2 & gt 'city_island'
end

if $ARGS[0] = 'atm':
	'<center><b><font color="maroon">ATM</font></b></center>'
	'<center><img <<$set_imgh>> src="images/locations/shared/store/atm.jpg"></center>'

	if bankAccount = 1:
		if karta >= 0:
			'You have <<karta>> <b>₽</b> in your account.'
			'You have an overdraft limit of <font color="blue"><<bankDebtLimit>></font>!'
		else
			'You are overdrawn by <font color="red"><<-1 * karta>> <b>₽</b></font>.'
			'You have a remaining credit limit of <font color="blue"><<bankDebtLimit + karta>></font>!'
		end

		'<br>ATM Deposit Fee: 100 <b>₽</b>'

		if atmDeposit = 0:
			act 'Deposit money':
				cla
				minut += 5

				kartaINATM = input ("How much money do you want to deposit into the account? Note: A service charge of 100 <b>₽</b> will be deducted from the amount deposited.")
				if kartaINATM < 100 or kartaINATM > money:
					'This is not a valid input.'
				else
					atmDeposit += kartaINATM - 100
					atmDepositDate = daystart + 2
					money -= kartaINATM
					'<br>You deposit <<kartaINATM>> <b>₽</b> into your account.'
					'It will take 2 days for funds to be available. Your new balance will be <<karta+atmDeposit>> <b>₽</b>.'
				end

				gs 'stat'
				act 'Move away': gt 'uni_shop', 'start'
			end
		else
			'<br>★ Processing deposit of <<atmDeposit>> <b>₽</b> in <<atmDepositDate - daystart>> days.'
		end

		if karta + bankDebtLimit > 0:
			act 'Withdraw money from the ATM':
				cla
				minut += 5

				kartaOUT = input ("How much money do you want to withdraw?")
				if kartaOUT <= 0 or kartaOUT > karta + bankDebtLimit:
					'<br>Invalid operation.'
				else
					karta -= kartaOUT
					money += kartaOUT
					if karta > 0:
						'<br>You withdraw <<kartaOUT>> <b>₽</b>. You have <<karta>> <b>₽</b> left in your bank account.'
					elseif karta = 0:
						'<br>You withdraw <<kartaOUT>> <b>₽</b>. You have no money left in your bank account.'
					else
						'<br>You withdraw <<kartaOUT>> <b>₽</b>. <font color="red">Your bank account is overdrawn by <b><<karta>> ₽</b>.</font>'
					end
				end

				gs 'stat'
				act 'Move away': gt 'uni_shop', 'start'
			end
		else
			'You have maxed out your overdraft.'
		end
	else
		'You don''t have a bank account yet!'
	end

	act 'Move away':gt 'uni_shop', 'start'
end

if $ARGS[0] = 'cart':
	*clr & cla
	$loc_s = 'uni_shop'
	$args_s = 'cart'
	menu_off = 0
	gs 'themes', 'indoors'

	gs 'item_cart', 'shoppping_aisle', 'uni'
	gs 'stat'
	gs 'themes', 'indoors'
	$backimage= 'images/locations/city/island/unimarket.jpg'

	act 'Exit shopping cart':gt 'uni_shop', 'start'
end












--- uni_shop ---------------------------------

