Ver código fonte

[Refactored] Refactored renting a room feature at pav hotel so it can be reused

ADCSux 2 anos atrás
pai
commit
097c679a17

+ 15 - 21
locations/HotelRoom.qsrc

@@ -16,7 +16,7 @@ if $ARGS[0] = 'normal':
 	gs 'themes', 'indoors'
 	gs 'stat'
 	'<center><b><font color = maroon>Your normal hotel room</font></b></center>'
-	'<center>You have paid to stay for <<hotelroom1day - daystart>> more nights in the room.</center>'
+	'<center>You have paid to stay for <<hotelRoomDays[$hotel] - daystart>> more nights in the room.</center>'
 	'<center><img <<$set_imgh>> src="images/locations/pavlovsk/hotel/hotel.room.normal.jpg"></center>'
 	'Your hotel room is not very large, but it has everything you need and is quite stylish. The large <a href="exec:gt ''bed2''">double bed</a> takes up most of the room. A modern <a href="exec:gt ''wardrobe'', ''start''">wardrobe</a> (where you can choose outfits and organize your clothing) stands near the entrance of the room. Next to the door, you can find a <a href="exec:gt ''mirror'',''start''">mirror</a>. The door to the <a href="exec:gt ''hotelroom'',''shower1''">bathroom</a> is to the right.'
 	'Your hotel room also has a <a href="exec:gt ''HotelRoom'',''tv''">TV</a>'+iif(komp = 1, ' and your <a href="exec: gt ''Komp'',''start''">laptop</a> is on the desk. The hotel offers all guests free Wi-Fi.', '.')
@@ -24,7 +24,8 @@ if $ARGS[0] = 'normal':
 	act'Go to the hotel lobby':
 		if $clothingworntype ! 'nude':
 			hotelWiFi = 0
-			gt'pav_hotel'
+			gt $hotel
+			killvar '$hotel'
 		else
 			msg'<b><font color = red>You need to get dressed before leaving your hotel room.</font></b>'
 			gt'HotelRoom','normal'
@@ -35,9 +36,6 @@ if $ARGS[0] = 'normal':
 	dynamic $fatdel
 	dynamic $lekarstvo
 	dynamic $vitamin
-	if curr_home ! 6:
-		act 'Set this hotel room as your main home':gs 'set_home', 6 & gt 'HotelRoom', 'normal'
-	end
 end
 
 if $ARGS[0] = 'better':
@@ -55,14 +53,15 @@ if $ARGS[0] = 'better':
 	gs 'themes', 'indoors'
 	gs 'stat'	
 	'<center><b><font color = maroon>Your luxury room</font></b></center>'
-	'<center>You have paid to stay for <<hotelroom1day - daystart>> more nights in the room.</center>'
+	'<center>You have paid to stay for <<hotelRoomDays[$hotel] - daystart>> more nights in the room.</center>'
 	'<center><img <<$set_imgh>> src="images/locations/pavlovsk/hotel/hotel.room.better.jpg"></center>'
 	'Your hotel room is not very large, but it has everything you need and is quite stylish. The large <a href="exec:gt ''bed2''">double bed</a> takes up most of the room. A modern <a href="exec:gt ''wardrobe'', ''start''">wardrobe</a> (where you can choose outfits and organize your clothing) stands near the entrance of the room. Next to the door, you can find a <a href="exec:gt ''mirror'',''start''">mirror</a>. The door to the <a href="exec:gt ''hotelroom'',''shower1''">bathroom</a> is to the right.'
 	'Your hotel room also has a small flat-screen <a href="exec:gt ''HotelRoom'',''tv''">TV</a>'+iif(komp = 1, ' and your <a href="exec: gt ''Komp'',''start''">laptop</a> is on the desk. The hotel offers all guests free Wi-Fi.', '.')
 	act'Go to the hotel lobby':
 		if $clothingworntype ! 'nude':
 			hotelWiFi = 0
-			gt'pav_hotel'
+			gt $hotel
+			killvar '$hotel'
 		else
 			msg'<b><font color = red>You need to get dressed before leaving your hotel room.</font></b>'
 			gt'HotelRoom','better'
@@ -74,9 +73,6 @@ if $ARGS[0] = 'better':
 	dynamic $fatdel
 	dynamic $lekarstvo
 	dynamic $vitamin
-	if curr_home ! 6:
-		act 'Set this hotel room as your main home':gs 'set_home', 6 & gt 'HotelRoom', 'better'
-	end
 end
 
 if $ARGS[0] = 'best':
@@ -94,14 +90,15 @@ if $ARGS[0] = 'best':
 	gs 'themes', 'indoors'
 	gs 'stat'	
 	'<center><b><font color = maroon>Your royal suite</font></b></center>'
-	'<center>You have paid to stay for <<hotelroom1day - daystart>> more nights in the room.</center>'
+	'<center>You have paid to stay for <<hotelRoomDays[$hotel] - daystart>> more nights in the room.</center>'
 	'<center><img <<$set_imgh>> src="images/locations/pavlovsk/hotel/hotel.room.best.jpg"></center>'
 	'Your hotel room is quite spacious, and is beautifully furnished. For a second, you wonder why a hotel in a town like Pavlovsk even has such a luxurious suite. The room is filled with expensive appliances. The gorgeous <a href="exec:gt ''bed2''">double bed</a> takes up most of the room. A modern <a href="exec:gt ''wardrobe'', ''start''">wardrobe</a> (where you can choose outfits and organize your clothing) stands near the entrance of the room. Next to the door, you can find a <a href="exec:gt ''mirror'',''start''">mirror</a>. The door to the <a href="exec:gt ''hotelroom'',''shower1''">bathroom</a> is to the right.'
 	'Your hotel room also has a huge flat-screen <a href="exec:gt ''HotelRoom'',''tv''">TV</a>'+iif(komp = 1, ' and your <a href="exec: gt ''Komp'',''start''">laptop</a> is on the desk. The hotel offers all guests free Wi-Fi.', '.')
 	act'Go to the hotel lobby':
 		if $clothingworntype ! 'nude':
 			hotelWiFi = 0
-			gt'pav_hotel'
+			gt $hotel
+			killvar '$hotel'
 		else
 			msg'<b><font color = red>You need to get dressed before leaving your hotel room.</font></b>'
 			gt'HotelRoom','best'
@@ -114,9 +111,6 @@ if $ARGS[0] = 'best':
 	dynamic $fatdel
 	dynamic $lekarstvo
 	dynamic $vitamin
-	if curr_home ! 6:
-		act 'Set this hotel room as your main home':gs 'set_home', 6 & gt 'HotelRoom', 'best'
-	end
 end
 
 if $ARGS[0] = 'shower1':
@@ -132,21 +126,21 @@ if $ARGS[0] = 'shower1':
 	gs'stat'
 	
 	'<center><b><font color = maroon>The bathroom of your hotel room</font></b></center>'
-	if hotelroom = 1:
+	if hotelRoom[$hotel] = 1:
 		'<center><img <<$set_imgh>> src="images/locations/pavlovsk/hotel/hotel.room.normal1.jpg"></center>'&'A small and unpretentious bathroom, that is nevertheless quite stylish and has everything you need.'
-	elseif hotelroom = 2:
+	elseif hotelRoom[$hotel] = 2:
 		'<center><img <<$set_imgh>> src="images/locations/pavlovsk/hotel/hotel.room.better1.jpg"></center>'&'A nice looking and spacious bathroom, with separate bath tub.'
-	elseif hotelroom = 3:
+	elseif hotelRoom[$hotel] = 3:
 		'<center><img <<$set_imgh>> src="images/locations/pavlovsk/hotel/hotel.room.best1.jpg"></center>'&'A very luxurious and spacious bathroom, fit for a king.'
 	end
 	
 	act 'Return to your room':
 		hotelShampoo = 0
-		if hotelroom = 1:
+		if hotelRoom[$hotel] = 1:
 			gt'HotelRoom','normal'
-		elseif hotelroom = 2:
+		elseif hotelRoom[$hotel] = 2:
 			gt'HotelRoom','better'
-		elseif hotelroom = 3:
+		elseif hotelRoom[$hotel] = 3:
 			gt'HotelRoom','best'
 		end
 	end

+ 4 - 4
locations/pav_hotel.qsrc

@@ -182,11 +182,11 @@ if hour = 20 and IgorevnaBDSM >= 5 and IgorevnaBDSM < 9 and week < 3 and AnnaQW[
 	act 'Look for Anna':AnnaQW['daystart'] = daystart & gt 'hotel_anna', 'meeting'
 end
 
-if HotelRoom > 0:
+if hotelRoom['pav_hotel'] > 0:
 	act 'Go to your room':
-		if hotelroom = 1:gt'hotelroom','normal'
-		if hotelroom = 2:gt'hotelroom','better'
-		if hotelroom = 3:gt'hotelroom','best'
+		$hotel = 'pav_hotel'
+		if hotelRoom['pav_hotel'] = 1:gt'hotelroom','normal'
+		if hotelRoom['pav_hotel'] = 2:gt'hotelroom','better'
 	end
 end
 

+ 18 - 37
locations/pav_hotelReception.qsrc

@@ -117,13 +117,13 @@ if $ARGS[0] = '':
 		else
 			'<<$receptionName>> smiles at you and asks: "Hello <<$pcs_nickname>>! Would you like to rent a room?"'
 		end
-		if hotelroom > 0:
+		if hotelRoom['pav_hotel'] > 0:
 			*clr & cla
 			'<center><img <<$set_imgh>> src="images/locations/pavlovsk/hotel/resep.girl0,'+rand(0,10)+'.jpg"></center>'
 			'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."'
 			act'Yes, cancel your booking':hotelroom=0 & gt'pav_hotel'
 			act'No':gt'pav_hotel'
-		elseif hotelroom = 0:
+		elseif hotelRoom['pav_hotel'] = 0:
 			act 'Yes':
 				*clr & cla
 				'<center><img <<$set_imgh>> src="images/locations/pavlovsk/hotel/resep.girl0,'+rand(0,10)+'.jpg"></center>'
@@ -134,13 +134,13 @@ if $ARGS[0] = '':
 				act'Normal room':
 					*clr
 					cla
-					hotelroom1day=input ("For how long would you like to stay?")
-					if hotelroom1day<0:set hotelroom1day=0
-					if hotelroom1day*500>money:msg'You can''t afford to stay in the hotel for that long.'&gt'pav_hotel'
-					if hotelroom1day*500<=money and hotelroom1day ! 0:
-						money-=hotelroom1day*500
-						hotelroom=1
-						hotelroom1day = daystart + hotelroom1day
+					hotelRoomDays['pav_hotel']=input ("For how long would you like to stay?")
+					if hotelRoomDays['pav_hotel']<0:set hotelRoomDays['pav_hotel']=0
+					if hotelRoomDays['pav_hotel']*500>money:msg'You can''t afford to stay in the hotel for that long.'&gt'pav_hotel'
+					if hotelRoomDays['pav_hotel']*500<=money and hotelRoomDays['pav_hotel'] ! 0:
+						money-=hotelRoomDays['pav_hotel']*500
+						hotelRoom['pav_hotel']=1
+						hotelRoomDays['pav_hotel'] = daystart + hotelRoomDays['pav_hotel']
 						if pavHotelMaid = 0:
 							'You count the money and give it to her. She gives you the key to your room in return. She says happily: "Thank you miss, I hope you enjoy your stay!"'
 						else
@@ -148,19 +148,19 @@ if $ARGS[0] = '':
 						end
 						act'Step away from the reception desk':gt'pav_hotel'
 					end
-					if hotelroom1day = 0:gt'pav_hotel'
+					if hotelRoomDays['pav_hotel'] = 0:gt'pav_hotel'
 				end
 
 				act'Luxury room':
 					*clr
 					cla
-					hotelroom1day=input ("For how long would you like to stay?")
-					if hotelroom1day<0:set hotelroom1day=0
-					if hotelroom1day*1500>money:msg'You can''t afford to stay in the hotel for that long.'&gt'pav_hotel'
-					if hotelroom1day*1500<=money and hotelroom1day ! 0:
-						money-=hotelroom1day*1500
-						hotelroom=2
-						hotelroom1day = daystart + hotelroom1day
+					hotelRoomDays['pav_hotel']=input ("For how long would you like to stay?")
+					if hotelRoomDays['pav_hotel']<0:set hotelRoomDays['pav_hotel']=0
+					if hotelRoomDays['pav_hotel']*1500>money:msg'You can''t afford to stay in the hotel for that long.'&gt'pav_hotel'
+					if hotelRoomDays['pav_hotel']*1500<=money and hotelRoomDays['pav_hotel'] ! 0:
+						money-=hotelRoomDays['pav_hotel']*1500
+						hotelRoom['pav_hotel']=2
+						hotelRoomDays['pav_hotel'] = daystart + hotelRoomDays['pav_hotel']
 						if pavHotelMaid = 0:
 							'You count the money and give it to her. She gives you the key to your room in return. She says happily: "Thank you miss, I hope you enjoy your stay!"'
 						else
@@ -168,28 +168,9 @@ if $ARGS[0] = '':
 						end
 						act'Step away from the reception desk':gt'pav_hotel'
 					end
-					if hotelroom1day = 0:gt'pav_hotel'
+					if hotelRoomDays['pav_hotel'] = 0:gt'pav_hotel'
 				end
 
-				act'Royal suite':
-					*clr
-					cla
-					hotelroom1day=input ("For how long would you like to stay?")
-					if hotelroom1day<0:set hotelroom1day=0
-					if hotelroom1day*10000>money:msg'You can''t afford to stay in the hotel for that long.'&gt'pav_hotel'
-					if hotelroom1day*10000<=money and hotelroom1day ! 0:
-						money-=hotelroom1day*10000
-						hotelroom=3
-						hotelroom1day = daystart + hotelroom1day
-						if pavHotelMaid = 0:
-							'You count the money and give it to her. She gives you the key to your room in return. She says happily: "Thank you miss, I hope you enjoy your stay!"'
-						else
-							'You count the money and give it to her. She gives you the key to your room in return. She says happily: "Thank you <<$pcs_nickname>>, I hope you enjoy your stay!"'
-						end
-						act'Step away from the reception desk':gt'pav_hotel'
-					end
-					if hotelroom1day = 0:gt'pav_hotel'
-				end
 				act 'Step away from the reception desk':gt'pav_hotel'
 			end
 			act'No, thank you':gt'pav_hotel'

+ 3 - 0
locations/saveupdater.qsrc

@@ -1408,6 +1408,9 @@ if ((100*version_major +version_minor)*100+version_revision)*100+version_patch
 	end
 	i += 1
 	if i < 250: jump 'saveupdaterloop853_1'
+
+	hotelRoomDays['pav_hotel'] = hotelroom1day
+	hotelRoom['pav_hotel'] = hotelroom
 end
 
 

+ 4 - 4
locations/stat.qsrc

@@ -1144,10 +1144,10 @@ if workFabrika = 1 and week => 1 and week <= 5 and hour > 8 and age => 16 and ag
 	FabrikaProgulDay = day
 end
 
-if hotelroom > 0:
-	if hotelroom1day = daystart: $stat_msg += '<BR>You have 1 night left on your hotel booking.'
-	if hotelroom1day < daystart and hour <= 11: $stat_msg += '<BR>Your hotel booking has expired, and you cannot return to your room after 11:00'
-	if hotelroom1day < daystart and hour > 11: hotelroom = 0
+if hotelRoom['pav_hotel'] > 0:
+	if hotelRoomDays['pav_hotel'] = daystart: $stat_msg += '<BR>You have 1 night left on your hotel booking.'
+	if hotelRoomDays['pav_hotel'] < daystart and hour <= 11: $stat_msg += '<BR>Your hotel booking has expired, and you cannot return to your room after 11:00'
+	if hotelRoomDays['pav_hotel'] < daystart and hour > 11: hotelRoom['pav_hotel'] = 0
 end
 
 if hour >= 8 and hour < 14 and week < 6 and StoryLine > 0 and SchoolAtestat = 0 and kanikuli = 0 and schoolProgulDay ! daystart: