:: city_hotel_scripts[script]
setup.houses ??= {};
setup.houses.city_hotel_room_1 = {
	name: 'Hotel Indigo Standard Room',
	ownership:'rent',
	rent: 0,
	connect:{
		HotelRoom_standard_city:{
			fromPassage: 'city_hotel',
			toPassage: 'HotelRoom_standard_city',
			label: 'Your Room',
			time: 3,
			image: 'locations/pavlovsk/hotel/hotel.room.normal.jpg',
			flags:{
				priority: 5000
			}
		}
	}
}

:: city_hotel[public indoors]
	<<ConnectedLocation 'Leave' 'city_center' '' 'locations/city/citycenter/down.jpg' 1>>
	/*<<setinit $nom_o[1] = 100>>
	<<setinit $nom_o[2] = 1000>>
	<<setinit $nom_o[3] = 10000>>
	<<setinit $nom_o[4] = 100000>>*/
	<h2>Hotel Indigo</h2>
	<<image "locations/city/citycenter/hotel/lobby.webp">>


/*
	<<if getvar("$tobiQW") < 2000>>
		The hotel lobby is deserted and you only notice an alone bored girl standing at the reception desk.

	<</if>>
	<<if getvar("$tobiQW") >= 2000 and getvar("$tobiQW") < 2100>>
		The hotel lobby is very crowded. You notice there's a swarm of comely old men dressed in scanty jackets with elbow patches.

	<</if>>


	<<if getvar("$tobiQW") == 2001>>
		One of the visitors of the hotel, grabs your attention as he's sitting in a chair, reading a book. It's written in squiggles, which reminds you to the scroll you read earlier.
		<<actCLA 'Excuse me'>>
			<<set $time.minutes += 5>>
			<<image "locations/city/industrial/casino/oldman.jpg">>
			<p>"I didn't mean to disturb you, but what language is the book written in?" you ask the man.</p>
			<p>The man stops, looks up to you and cheerfully answers, "This book right here is written in old Japanese language. Why do you ask?" the man asks curiously.</p>
			"Well, I was handed this book, in which the characters are very similarly written." you answer.
			<p>The man gasps, "By the gods! Can I take a look?"</p>
			"I don't really know if it's okay..." you hesitantly answer.
			<p>The man is taken aback a little by your answer, "Oh yes, it's no wonder you're being careful, where are my manners, I should introduce myself. My name is Plato Aristarkhovich, and you are?"</p>
			<p>"My name is $pc.name_first $pc.name_last." you answer.</p>
			<p>"I hope this doesn't sound too creepy but would you please follow me to my room?" Plato asks you.</p>
			<<actCLA 'Go with Plato'>>
				<<set $time.minutes += 1>> <<gt 'mqroom'>>
			<</actCLA>>
		<</actCLA>>
	<</if>>
	<<if getvar("$hotelRoom['city_hotel']") != 0>>
		<<actCLA 'Go to your room'>>
			<<set $hotel = 'city_hotel'>>
			<<if getvar("$hotelRoom['city_hotel']") == 1>>
				<<gt 'hotelroom' 'normal'>>

			<</if>>
			<<if getvar("$hotelRoom['city_hotel']") == 2>>
				<<gt 'hotelroom' 'better'>>

			<</if>>
			<<if getvar("$hotelRoom['city_hotel']") == 3>>
				<<gt 'hotelroom' 'best'>>

			<</if>>
		<</actCLA>>
	<</if>>*/
	<<act 'Go to the reception desk'>>
		<<addtime 1>>
		<<gt 'city_hotel_receptionist'>>
	<</act>>

:: city_hotel_receptionist[event]
	<<actCLA 'Go back to the foyer'>>
		<<addtime 1>>
		<<gt 'city_hotel'>>
	<</actCLA>>

	<<image "locations/city/citycenter/hotel/receptionist.jpg">>
	You walk up to the front reception and get greeted by a smiling young woman behind the counter.
	<p>"Welcome to Hotel Indigo. How can I help you?" she asks.</p>
	
	<<set _availableBookDurations = [1,2,3,5,7,14,28,56]>>

	<<if $housing.rentIsActive('city_hotel_room_1')>>
		<<set _roomCostPerNight = 500>>
		<<set _expirationTime = $housing.rentExpirationTime('city_hotel_room_1')>>
		<p>"I hope you are happy with your current room."</p>
		<p>You have payed the rent til <<datetime _expirationTime>>.</p>

		<<for _numberOfDays range _availableBookDurations>>
			<<actCLA `'Extend for '+_numberOfDays+' day'+(_numberOfDays > 1 ? 's' : '')` undefined `{cost:{bank:_roomCostPerNight*_numberOfDays},capture:['_numberOfDays']}`>>
				<<run _expirationTime.setUTCDate(_expirationTime.getUTCDate()+_numberOfDays)>>

				<<run $housing.startRent('city_hotel_room_1',0,_expirationTime)>>

				<<image "locations/city/citycenter/hotel/receptionist.jpg">>
				<p>
					"Thank you, your stay has been extended to<br/>
					<strong><<datetime _expirationTime>></strong>"
				</p>
				<<actCLA 'Return to the foyer'>>
					<<addtime 1>>
					<<gt 'city_hotel'>>
				<</actCLA>>
			<</actCLA>>
		<</for>>

	<<else>>
	
		<p>"Would you like to rent a room?" She continues to explain the difference between the available rooms:
			<ol>
				/*<li>Budget rooms, the most simple rooms for the ones that just want a bed to sleep the night. There's a public bathroom shared with the rest of the floor.</li>*/
				<li>Standard rooms, the reasonably priced rooms. Every room has a private bathroom and a TV. They cost <<money 500>> per night.</li>
				/*<li>Suites, the luxurious room. Beside a private bathroom there's also an extra livingroom.</li>*/
			</ol>
			One night always includes midnight and extends to 12:00. So if you rent a room for one night at 23:00, you can stay in it for 13 hours. And if you rent the same room at 01:00, you will have 35 hours.
		</p>	

		<<actCLA 'Standard Room'>>
			<<set _roomCostPerNight = 500>>
			<<image "locations/city/citycenter/hotel/receptionist.jpg">>
			<p>You tell the woman that you are interested in renting a standard room.</p>
			<p>"Great. We have several available right now. How many nights would you like to pay for? I'm afraid we can only accept up front bank payments."</p>
			<<act 'Nevermind'>><<gt 'city_hotel_receptionist'>><</act>>
			<<for _numberOfDays range _availableBookDurations>>
				<<actCLA `_numberOfDays+' day'+(_numberOfDays > 1 ? 's' : '')` undefined `{cost:{bank:_roomCostPerNight*_numberOfDays},capture:['_numberOfDays']}`>>
					<<set _rentEnds = $time.now>>
					<<run _rentEnds.setUTCDate(_rentEnds.getUTCDate()+_numberOfDays)>>
					<<run _rentEnds.setUTCHours(12,0,0,0)>>

					<<run $housing.startRent('city_hotel_room_1',0,_rentEnds)>>

					<<image "locations/city/citycenter/hotel/receptionist.jpg">>
					<p>
						You swipe your card and wait a moment for 'APPROVED' to appear on the tiny screen. As soon as the receipt is printed, she hands it to you with the key to your room. "Thank you, I hope you enjoy your stay!" she says with a smile.
					</p>
					<<actCLA 'Return to the foyer'>>
						<<addtime 1>>
						<<gt 'city_hotel'>>
					<</actCLA>>
				<</actCLA>>
			<</for>>
		<</actCLA>>

	<</if>>
		
	/*<<if getvar("$tobiQW") == 2000>>
		<<actCLA 'Why is the hotel so crowded?'>>
			<<set $tobiQW = 2001>>
			<<set $time.minutes += 1>>
			<p>"Why so the hotel so crowded today?" you ask.</p>
			"There's a conference on indigenous languages, they meet every year and complain about their disappearing languages." she says laughing.
			<<act 'Move away'>>
				<<gt 'city_hotel' 'start'>>
			<</act>>
		<</actCLA>>
	<</if>>
	<<actCLA 'Rent a room'>>
		<<set $menu_off = 1>>
		<<image "locations/city/citycenter/hotel/receptionist.jpg">>
		<p>The girl behind the desk smiles at you and asks: "Hello miss! Would you like to rent a room?"</p>
		<<if getvar("$hotelRoom['city_hotel']") > 0>>
			<<image "locations/city/citycenter/hotel/receptionist.jpg">>
			She looks in the computer: "I see you already have a room here. As it is already booked and paid for the only way to change it to a different room, would be to cancel your existing booking. To do so without notice would forfeit your payment, I would advise against this, but you may do so if you wish."
			<<actCLA 'Yes, cancel your booking'>>
				<<setinit $hotelRoom['city_hotel'] = 0>> <<gt 'city_hotel'>>
			<</actCLA>>
			<<act 'No'>>
				<<gt 'city_hotel'>>
			<</act>>
		<<elseif getvar("$hotelRoom['city_hotel']") == 0>>
			<<actCLA 'Yes'>>
				<<image "locations/city/citycenter/hotel/receptionist.jpg">>
				<p>She smiles at you happily: "Excellent! We have the following rooms available right now:"</p>
				<p>Standard room - 500 <b>₽</b> / night;</p>
				<p>Luxury room - 1500 <b>₽</b> / night;</p>
				<p>and the Royal Suite - 10000 <b>₽</b> / night.</p>
				<<actCLA 'Standard room'>>
					<<setinit $hotelRoomDays['city_hotel'] = input ("For how long would you like to stay?")>>
					<<if getvar("$hotelRoomDays['city_hotel']") > 0>>
						<<set $totalCost = $hotelRoomDays['city_hotel'] * 500>>
						<p>"A standard room for hotelRoomDays['city_hotel'] days, that will be totalCost<b>₽</b>" says the receptionist, "would you like to pay with cash or with card?"</p>
						<<gs 'city_hotel' 'pay_the_room' 1>>
					<<else>>
						<<gt 'city_hotel'>>
					<</if>>
				<</actCLA>>
				<<actCLA 'Luxury room'>>
					<<setinit $hotelRoomDays['city_hotel'] = input ("For how long would you like to stay?")>>
					<<if getvar("$hotelRoomDays['city_hotel']") > 0>>
						<<set $totalCost = $hotelRoomDays['city_hotel'] * 1500>>
						<p>"A luxury room for hotelRoomDays['city_hotel'] days, that would be totalCost<b>₽</b>" says the receptionist, "would you like to pay with cash or with card?"</p>
						<<set $temp_nomoney = '"You can`t afford to stay in a luxury room at this hotel for that long.'>>
						<<gs 'city_hotel' 'pay_the_room' 2>>
					<<else>>
						<<gt 'city_hotel'>>
					<</if>>
				<</actCLA>>
				<<actCLA 'Royal Suite'>>
					<<setinit $hotelRoomDays['city_hotel'] = input ("For how long would you like to stay?")>>
					<<if getvar("$hotelRoomDays['city_hotel']") > 0>>
						<<set $totalCost = $hotelRoomDays['city_hotel'] * 10000>>
						<p>"The royal suite for hotelRoomDays['city_hotel'] days, that would be totalCost<b>₽</b>" says the receptionist, "would you like to pay with cash or with card?"</p>
						<<gs 'city_hotel' 'pay_the_room' 3>>
					<<else>>
						<<gt 'city_hotel'>>
					<</if>>
				<</actCLA>>
				<<act 'Step away from the reception desk'>>
					<<gt 'city_hotel'>>
				<</act>>
			<</actCLA>>
			<<act 'No, thank you'>>
				<<gt 'city_hotel'>>
			<</act>>
		<</if>>
	<</actCLA>>*/
/*
<<if $location_var[$here][0] == 'pay_the_room'>>
	<<set $hotel_room_id = $ARGS[1]>>
	<<if $totalCost <= $finances.cash>>
		<<actCLA 'Pay with cash'>>
			<<set $finances.cash -= $totalCost>>
			<<setinit $hotelRoom['city_hotel'] = $hotel_room_id>>
			<<setinit $hotelRoomDays['city_hotel'] = $time.daystart + $hotelRoomDays['city_hotel']>>
			<<set 'You count the money and give it to her. She gives you the key to your room in return. She says happily: "Thank you ' + iif(pavHotelMaid = 0, 'miss', $pc.name_nick) + ', I hope you enjoy your stay!"'>>
			<<act 'Step away from the reception desk'>>
				<<gt 'city_hotel'>>
			<</act>>
			<<set $totalCost to null>>
			<<set $hotel_room_id to null>>
		<</actCLA>>
	<</if>>
	<<if $totalCost <= $finances.bankAvailable>>
		<<actCLA 'Pay with card'>>
			<<set $finances.bank -= $totalCost>>
			hotel_room_id: <<hotel_room_id>>
			<<setinit $hotelRoom['city_hotel'] = $hotel_room_id>>
			<<setinit $hotelRoomDays['city_hotel'] = $time.daystart + $hotelRoomDays['city_hotel']>>
			<<set 'You swipe your card and wait a moment for 'APPROVED' to appear on the tiny screen. As soon as the receipt is printed, she hands it to you with the key to your room. "Thank you ' + iif(pavHotelMaid = 0, 'miss', $pc.name_nick) + ', I hope you enjoy your stay!" she says with a smile.'>>
			<<act 'Step away from the reception desk'>>
				<<gt 'city_hotel'>>
			<</act>>
			<<set $totalCost to null>>
			<<set $hotel_room_id to null>>
		<</actCLA>>
	<</if>>
	<<if $totalCost > $finances.bankAvailable and $totalCost > $finances.cash>>
		<<if $location_var[$here][1] == 1>>
			<<act 'You can`t afford to stay in the hotel for that long.'>>
	<<gt 'city_hotel'>>
<</act>>

		<</if>>
		<<if $location_var[$here][1] == 2>>
			<<act 'You can`t afford to stay in a luxury room at this hotel for that long.'>>
	<<gt 'city_hotel'>>
<</act>>

		<</if>>
		<<if $location_var[$here][1] == 3>>
			<<act 'You can`t afford to stay in the Royal Suite at this hotel for that long.'>>
	<<gt 'city_hotel'>>
<</act>>

		<</if>>
		<<set $totalCost to null>>
		<<set $hotel_room_id to null>>
	<</if>>
	<<actCLA 'You change your mind'>>
		<<set $totalCost to null>>
		<<set $hotel_room_id to null>>
		<<gt 'city_hotel'>>
	<</actCLA>>
<</if>>
 */