فهرست منبع

Merge remote-tracking branch 'Felix/master'

Kevin_Smarts 9 ماه پیش
والد
کامیت
62d93118ac
4فایلهای تغییر یافته به همراه52 افزوده شده و 20 حذف شده
  1. 40 19
      locations/autotraidF.qsrc
  2. 9 0
      locations/avt.qsrc
  3. 1 1
      locations/avtonorm.qsrc
  4. 2 0
      locations/cikl.qsrc

+ 40 - 19
locations/autotraidF.qsrc

@@ -100,6 +100,12 @@ if $ARGS[0] = 'car':
 	act 'Return': killvar 'carT' & killvar 'bupay' & gt 'autotraidF', 'start'
 	
 	if hour <= 17:
+		if car = 0 or car > 199:
+			!! this is a VERY crude fix for when car[] was created before car
+			!! if we ever add cars with indices past 199 its gonna break
+			killvar 'car'
+			car = 0
+		end
 		act 'Inspect a 2107':gt 'autotraidF', 'inspect', '2107', 1, 200, 1, 3
 
 		act 'Inspect another 2107 (Broken Engine)':
@@ -108,26 +114,31 @@ if $ARGS[0] = 'car':
 			menu_off = 1
 			'<center><b>2107 (Broken engine)</b></center>'
 			'<center><img <<$set_imgh>> src="images/pc/items/accessories/car/car.jpg"></center>'
-			bupay = rand(10000, 50000)
-			'The car is basically a wreck. It doesn''t even start. When you ask the salesman how much it costs, he tells you "<<bupay>> <b>₽</b>" without hesitation.'
+			!! caching offers, resets on monday (via cikl)
+			if used_car['wrek_condition'] = 0 and used_car['wrek_price'] = 0:
+				used_car['wrek_condition'] = rand(10, 200)
+				used_car['wrek_price'] = rand(10000, 50000)
+			end
+			'The car is basically a wreck. It doesn''t even start. When you ask the salesman how much it costs, he tells you "<<used_car[''wrek_price'']>> <b>₽</b>" without hesitation.'
 
 			act 'Look around some more':gt 'autotraidf', 'car'
 
-			if car = 0 and prava = 1 and money >= bupay:
-				act 'Buy it for <<bupay>><b>₽</b>':
+			if car = 0 and prava = 1 and money >= used_car['wrek_price']:
+				act 'Buy it for <<used_car[''wrek_price'']>><b>₽</b>':
 					cla
-					money -= bupay
+					money -= used_car['wrek_price']
 					$car = '2107'
 					car = 1
 					benz = 3
 					cardrive = 9
 					car['new_condition'] = 200
-					car['current_condition'] = rand(10, car['new_condition'])
+					car['current_condition'] = used_car['wrek_condition']
 					wrek = 1
-					'You agree and before you know it, the car salesman and you have signed all the necessary documents. You hand over the <<bupay>> <b>₽</b> in cash, and the car is yours.' 
+					'You agree and before you know it, the car salesman and you have signed all the necessary documents. You hand over the <<used_car[''wrek_price'']>> <b>₽</b> in cash, and the car is yours.' 
 					'Since it''s crammed in between about a million other vehicles, the car salesman moves it outside near the yard''s entrance for you... and that''s it.' 
 					'If you want to get the car to a garage, you''ll have to go there and have it towed.'
-					killvar 'bupay'
+					gs 'shortgs', 'remove_array_element', 'used_car', 'wrek_condition'
+					gs 'shortgs', 'remove_array_element', 'used_car', 'wrek_price'
 					act 'Leave': minut += 5 & gt 'city_industrial'
 				end
 			end
@@ -148,42 +159,52 @@ if $ARGS[0] = 'inspect':
 	menu_off = 1
 	$autotraidF_carname = $ARGS[1]
 	autotraidF_carnum = ARGS[2]
+	!! max potential condition, used in 'avt' to generate actual condition and price
 	car['potential_new_condition'] = ARGS[3]
-	carT = ARGS[4]
 	autotraidF_benz = ARGS[5]
 
 	'<center><b><<$autotraidF_carname>></b></center>'
+	!! currently theres no car1.jpg, only car.jpg, either we need logic (which was removed btw)
+	!! or we need an actual car1.jpg image
 	'<center><img <<$set_imgh>> src="images/pc/items/accessories/car/car<<autotraidF_carnum>>.jpg"></center>'
 
-	gs 'avt'
-	'<<$car[''potential_current_condition'']>> The car salesman wants <<bupay>> <b>₽</b> for it.'
+	!! caching offers, resets on monday (via cikl)
+	if used_car['<<autotraidF_carnum>>_condition'] = 0 and used_car['<<autotraidF_carnum>>_price'] = 0:
+		!! used in 'avt' as branching selector, affects price
+		carT = ARGS[4]
+		!! generates condition and price for the car
+		gs 'avt'
+	end
+	'<<$car[''potential_current_condition'']>> The car salesman wants <<used_car[''<<autotraidF_carnum>>_price'']>> <b>₽</b> for it.'
 
 	act 'Look around some more':
-		killvar 'bupay'
 		killvar '$autotraidF_carname'
 		killvar 'autotraidF_carnum'
 		killvar 'autotraidF_benz'
 		gt 'autotraidF', 'car'
 	end
 
-	if car = 0 and prava = 1 and money >= bupay:
-		act 'Buy (<<bupay>> <b>₽</b>)':
+	if car = 0 and prava = 1 and money >= used_car['<<autotraidF_carnum>>_price']:
+		act 'Buy (<<used_car[''<<autotraidF_carnum>>_price'']>> <b>₽</b>)':
 			cla
-			money -= bupay
+			money -= used_car['<<autotraidF_carnum>>_price']
 			$car = $autotraidF_carname
 			car = autotraidF_carnum
-			!!benz = fuel
+			!!benz means fuel
 			benz = autotraidF_benz
 			cardrive = 9
-			car['current_condition'] = car['potential_current_condition']
+			car['current_condition'] = used_car['<<autotraidF_carnum>>_condition']
+			!! sets condition when new (ie max possible condition)
 			car['new_condition'] = car['potential_new_condition']
 			wrek = 0
-			'You agree and before you know it, the car salesman and you have signed all the necessary documents. You hand over the <<bupay>> <b>₽</b> in cash, and the car is yours.' 
+			'You agree and before you know it, the car salesman and you have signed all the necessary documents. You hand over the <<used_car[''<<autotraidF_carnum>>_price'']>> <b>₽</b> in cash, and the car is yours.' 
 			'Since it''s crammed in between about a million other vehicles, the car salesman moves it outside near the yard''s entrance for you and warns you that there is very little gas in the tank.'
-			killvar 'bupay'
 			killvar '$autotraidF_carname'
 			killvar 'autotraidF_carnum'
 			killvar 'autotraidF_benz'
+			gs 'shortgs', 'remove_array_element', 'car', 'potential_new_condition'
+			gs 'shortgs', 'remove_array_element', 'used_car', '<<autotraidF_carnum>>_condition'
+			gs 'shortgs', 'remove_array_element', 'used_car', '<<autotraidF_carnum>>_price'
 			act 'Leave': minut += 5 & gt 'city_industrial'
 		end
 	end

+ 9 - 0
locations/avt.qsrc

@@ -1,7 +1,9 @@
 # avt
+tehNT = car['potential_new_condition']
 if tehNT = 0: tehNT = 200
 tehT = rand(10, tehNT)
 
+!! i could replace all tehT and tehNT with appropriate car[] variables but then the code gets even less readable
 if tehT >= tehNT * 75 / 100:$tehT = 'The car looks like it''s in excellent condition.'
 if tehT < tehNT * 75 / 100 and tehT >= tehNT * 50 / 100:$tehT = 'When you turn on the car, the engine makes some noise.'
 if tehT < tehNT * 50 / 100 and tehT >= tehNT * 25 / 100:$tehT = 'When you turn on the car, the engine rumbles and smokes.'
@@ -18,6 +20,13 @@ elseif carT = 2:
 	if tehT < tehNT * 50 / 100 and tehT >= tehNT * 25 / 100:bupay = rand(30000, 60000)
 	if tehT < tehNT * 25 / 100:bupay = rand(15000, 40000)
 end
+
+used_car['<<autotraidF_carnum>>_condition'] = tehT
+used_car['<<autotraidF_carnum>>_price'] = bupay
+
+killvar 'bupay'
+killvar 'tehNT'
+killvar 'tehT'
 killvar 'carT'
 
 --- avt ---------------------------------

+ 1 - 1
locations/avtonorm.qsrc

@@ -18,7 +18,7 @@ if wrek = 0:
 	normrem = normneed * normhour
 elseif wrek = 1:
 	normneed = 0 - (car['current_condition'] - car['new_condition'])
-	normremK = (normneed * normhour) * 8
+	normrem = (normneed * normhour) * 8
 end
 
 --- avtonorm ---------------------------------

+ 2 - 0
locations/cikl.qsrc

@@ -1206,6 +1206,8 @@ gs 'homes_properties', 'progress_property_rent_time'
 !!------------- Check for Daily Events for event generator, sets evt_chk variable  ------------------------------------------
 gs 'emp_functions', 'evt_day_chk'
 
+!!------------- Reset used car dealership offers  ------------------------------------------
+if week = 1 and used_car ! 0: killvar 'used_car'
 
 --- cikl ---------------------------------