Procházet zdrojové kódy

[added] ability to donate milk bottles as requested by Kevin Smarts. Also a small simplification of lact_bp by extracting a `empty_milk_bottle` function (which empties a single bottle) and renaming `empty_milk_bottles` (note the s) to `empty_all_milk_bottles`

anjuna krokus před 1 měsícem
rodič
revize
84d992dc0e
2 změnil soubory, kde provedl 148 přidání a 37 odebrání
  1. 127 6
      locations/city_clinic.qsrc
  2. 21 31
      locations/lact_bp.qsrc

+ 127 - 6
locations/city_clinic.qsrc

@@ -9,6 +9,8 @@ if $ARGS[0] = 'start':
 	$location_type = 'indoors'
 	$menu_loc = 'city_clinic'
 	$menu_arg = 'start'
+	killvar 'temp_small_mbottle_ids'
+	killvar 'temp_medium_mbottle_ids'
 	menu_off = 0
 	*clr & cla
 	hosprand = rand(0, 10)
@@ -1668,13 +1670,9 @@ if $ARGS[0] = 'milk_bank':
 		'<br>----------------------------------------'
 		if lact_ev['poli_totalmilkdonation_count'] > 0:
 			'Total breast milk donation statistics'
-			if lact_ev['poli_totalmilkdonated'] < 100:
-				'Donated milk volume in liter: <<lact_ev[''poli_totalmilkdonated'']/1000>>.0<<lact_ev[''poli_totalmilkdonated''] mod 1000>>l'
-			else
-				'Donated milk volume in liter: <<lact_ev[''poli_totalmilkdonated'']/1000>>.<<lact_ev[''poli_totalmilkdonated''] mod 1000>>l'
-			end
+			'Donated milk volume in liter: <<lact_ev[''poli_totalmilkdonated'']/1000>>.<<$mid(1000 + (lact_ev[''poli_totalmilkdonated''] mod 1000), 2, 3)>>l'
 			'Donation count: <<lact_ev[''poli_totalmilkdonation_count'']>>'
-			'Average milk volume per donation in ml: <<lact_ev[''poli_totalmilkdonated'']/lact_ev[''poli_totalmilkdonation_count'']>>'
+			'Average milk volume per donation in ml: <<lact_ev[''poli_totalmilkdonated'']/lact_ev[''poli_totalmilkdonation_count'']>>.<<$mid(100 + ((100 * lact_ev[''poli_totalmilkdonated''] / lact_ev[''poli_totalmilkdonation_count'']) mod 100), 2, 2)>>'
 			'Paid money: <<((lact_ev[''poli_totalmilkdonated'']/50)*100)>><b>₽</b>'
 			'<br>----------------------------------------'
 		end
@@ -1706,6 +1704,101 @@ if $ARGS[0] = 'milk_bank':
 			end
 		end
 	end
+
+	vmb_i = 0
+	:vmbloop
+	if vmb_i <= temp_var:
+		if mbarrloca[vmb_i] = 2 or mbarrloca[vmb_i] = 1:
+			gs 'lact_bp', 'update_mbottle', vmb_i
+			if $mbarrstat[vmb_i] = 'fresh' or $mbarrstat[vmb_i] = 'normal':
+				if mbarrfill[vmb_i] > 0:
+					if mbarrfill[vmb_i] <= 1500:
+						temp_small_mbottle_ids[] = vmb_i
+					else
+						temp_medium_mbottle_ids[] = vmb_i
+					end
+				end
+			end
+		end
+		vmb_i += 1
+		jump 'vmbloop'
+	end
+	killvar 'vmb_i'
+
+	if arrsize('temp_small_mbottle_ids') > 0:
+		act 'Donate a small bottle of milk':
+			*clr & cla
+			minut += 5
+			temp_pay = func('city_clinic', 'donate_milk_bottle', 'small')
+			money += temp_pay
+			gs 'stat'
+
+			!! IMAGE
+			!! TEXT
+			'You donated a small milk bottle and got paid <<temp_pay>> ₽.'
+
+			killvar 'temp_pay'
+			act 'Leave': minut += 5 & gt 'city_clinic', 'milk_donation_room'
+		end
+	end
+	if arrsize('temp_small_mbottle_ids') > 4:
+		act 'Donate 5 small bottles of milk':
+			*clr & cla
+			minut += 10
+			temp_pay = func('city_clinic', 'donate_milk_bottle', 'small')
+			temp_pay += func('city_clinic', 'donate_milk_bottle', 'small')
+			temp_pay += func('city_clinic', 'donate_milk_bottle', 'small')
+			temp_pay += func('city_clinic', 'donate_milk_bottle', 'small')
+			temp_pay += func('city_clinic', 'donate_milk_bottle', 'small')
+			money += temp_pay
+			gs 'stat'
+
+			!! IMAGE
+			!! TEXT
+			'You donated 5 small milk bottles and got paid <<temp_pay>> ₽.'
+
+			killvar 'temp_pay'
+			act 'Leave': minut += 5 & gt 'city_clinic', 'milk_donation_room'
+		end
+	end
+	if arrsize('temp_medium_mbottle_ids') > 0:
+		act 'Donate a medium bottle of milk':
+			*clr & cla
+			minut += 5
+			temp_pay = func('city_clinic', 'donate_milk_bottle', 'medium')
+			money += temp_pay
+			gs 'stat'
+
+			!! IMAGE
+			!! TEXT
+			'You donated a medium milk bottle and got paid <<temp_pay>> ₽.'
+
+			killvar 'temp_pay'
+			act 'Leave': minut += 5 & gt 'city_clinic', 'milk_donation_room'
+		end
+	end
+	if arrsize('temp_medium_mbottle_ids') > 4:
+		act 'Donate 5 medium bottles of milk':
+			*clr & cla
+			minut += 10
+			temp_pay = func('city_clinic', 'donate_milk_bottle', 'medium')
+			temp_pay += func('city_clinic', 'donate_milk_bottle', 'medium')
+			temp_pay += func('city_clinic', 'donate_milk_bottle', 'medium')
+			temp_pay += func('city_clinic', 'donate_milk_bottle', 'medium')
+			temp_pay += func('city_clinic', 'donate_milk_bottle', 'medium')
+			money += temp_pay
+			gs 'stat'
+
+			!! IMAGE
+			!! TEXT
+			'You donated 5 medium milk bottles and got paid <<temp_pay>> ₽.'
+
+			killvar 'temp_pay'
+			act 'Leave': minut += 5 & gt 'city_clinic', 'milk_donation_room'
+		end
+	end
+
+
 	act 'Leave': gt 'city_clinic','start'
 end
 
@@ -1799,5 +1892,33 @@ if $ARGS[0] = 'milk_donation':
 	end
 end
 
+if $ARGS[0] = 'donate_milk_bottle':
+	if $ARGS[1] = 'small':
+		temp_id = temp_small_mbottle_ids[0]
+	else
+		temp_id = temp_medium_mbottle_ids[0]
+	end
+
+	!! CHANGE PAY HERE
+	temp_pay = mbarrfill[temp_id] / 10			& !! Base pay = 1 rbl / ml for fresh milk
+	if $mbarrstat[temp_id] = 'normal': temp_pay = temp_pay / 2		& !! And 0.5 rbl / ml for normal milk
+	!!	if $mbarrtemp[temp_id] = 'hot' / 'warm' / 'lukewarm' / 'cold' / 'frozen':
+
+
+	gs 'lact_bp', 'empty_milk_bottle', temp_id
+	RESULT = temp_pay
+
+	killvar 'temp_pay'
+	killvar 'temp_id'
+
+	if $ARGS[1] = 'small':
+		killvar 'temp_small_mbottle_ids', 0
+	else
+		killvar 'temp_medium_mbottle_ids', 0
+	end
+end
+
+
+
 --- city_clinic ---------------------------------
 

+ 21 - 31
locations/lact_bp.qsrc

@@ -128,7 +128,7 @@ if $ARGS[0] = 'view_milk_bottles':
 		jump 'vmbloop'
 	end
 	if milkedvolume > 0:
-		'<br><a href="exec:gt''lact_bp'',''empty_milk_bottles''">Pour the milk into the sink</a>'
+		'<br><a href="exec:gt''lact_bp'',''empty_all_milk_bottles''">Pour the milk into the sink</a>'
 	end
 	act 'Back':gt 'lact_bp', 'bp_milking'
 end
@@ -145,30 +145,31 @@ if $ARGS[0] = 'drink_milk_bottles':
 	pcs_hydra += mbarrfill[ARGS[1]] / iif(pcs_hydra>=100,200,100)
 	minut += max(1,(mbarrfill[ARGS[1]]/1000) + 3)
 	act 'Finish':
-		mbarrfill[ARGS[1]] = 0
-		mbarrmage[ARGS[1]] = 0
-		mbarrcool[ARGS[1]] = 0
-		$mbarrstat[ARGS[1]] = 'none'
-		$mbarrtemp[ARGS[1]] = 'none'
+		gs 'lact_bp', 'empty_milk_bottle', ARGS[1]
 		gs 'stat'
 		menu_off = 0 & gs 'lact_bp', 'view_milk_bottles', 1
 	end
 end
 
+if $ARGS[0] = 'empty_milk_bottle':
+	mbarrfill[ARGS[1]] = 0
+	mbarrmage[ARGS[1]] = 0
+	mbarrcool[ARGS[1]] = 0
+	$mbarrstat[ARGS[1]] = 'none'
+	$mbarrtemp[ARGS[1]] = 'none'
+end
+
+
 !! empty bottle function
-if $ARGS[0] = 'empty_milk_bottles':
-	!! use gt 'lact_bp', 'empty_milk_bottles'
+if $ARGS[0] = 'empty_all_milk_bottles':
+	!! use gt 'lact_bp', 'empty_all_milk_bottles'
 	*clr
 	cla
 	temp_var = (mc_inventory['bottle_m'] + mc_inventory['bottle_s']) - 1
 	emb_i = 0
 	:emb_loop
 	if emb_i <= temp_var:
-		mbarrfill[emb_i] = 0
-		mbarrmage[emb_i] = 0
-		mbarrcool[emb_i] = 0
-		$mbarrstat[emb_i] = 'none'
-		$mbarrtemp[emb_i] = 'none'
+		gs 'lact_bp', 'empty_milk_bottle', emb_i
 		emb_i += 1
 		jump 'emb_loop'
 	end
@@ -239,7 +240,7 @@ if $ARGS[0] = 'update_mbottle':
 	!! mbarrmage: timestamp the milk was pumped.
 	!! mbarrcool: Is the milk cooled? 0 = no, 1 = normal cooler, 2 = deep freezer
 	!! $mbarrstat: State of the milk: fresh, normal, old, rancid
-	!! $mbarrtemp: Temperature of the milk: hot, warm, normal temparture, cold, frozen
+	!! $mbarrtemp: Temperature of the milk: hot, warm, lukewarm, cold, frozen
 	!! mbarrloca: Location of the bottle.
 	if mbarrfill[ARGS[1]] > 0:
 		if mbarrfill[ARGS[1]] > mbarrtype[ARGS[1]]: mbarrfill[ARGS[1]] = mbarrtype[ARGS[1]]
@@ -249,13 +250,13 @@ if $ARGS[0] = 'update_mbottle':
 				$mbarrtemp[ARGS[1]] = 'warm'
 				$mbarrstat[ARGS[1]] = 'fresh'
 			elseif (mbarrmage[ARGS[1]] + 60) < func('lact_bp','time_stamp') and (mbarrmage[ARGS[1]] + 360) >= func('lact_bp','time_stamp'):
-				$mbarrtemp[ARGS[1]] =  'normal temparture'
+				$mbarrtemp[ARGS[1]] =  'lukewarm'
 				$mbarrstat[ARGS[1]] = 'normal'
 			elseif (mbarrmage[ARGS[1]] + 360) < func('lact_bp','time_stamp') and (mbarrmage[ARGS[1]] + 1440) >= func('lact_bp','time_stamp'):
-				$mbarrtemp[ARGS[1]] = 'normal temparture'
+				$mbarrtemp[ARGS[1]] = 'lukewarm'
 				$mbarrstat[ARGS[1]] = 'old'
 			else
-				$mbarrtemp[ARGS[1]] = 'normal temparture'
+				$mbarrtemp[ARGS[1]] = 'lukewarm'
 				$mbarrstat[ARGS[1]] = 'rancid'
 			end
 		elseif mbarrcool[ARGS[1]] = 1:
@@ -291,10 +292,7 @@ if $ARGS[0] = 'update_mbottle':
 			$mbarrstat[ARGS[1]] = 'fresh'
 		end
 	else
-		$mbarrtemp[ARGS[1]] = 'none'
-		$mbarrstat[ARGS[1]] = 'none'
-		mbarrmage[ARGS[1]] = 0
-		mbarrfill[ARGS[1]] = 0
+		gs 'lact_bp', 'empty_milk_bottle', ARGS[1]
 	end
 end
 
@@ -751,11 +749,7 @@ if $ARGS[0] = 'reg_bottle_count':
 			reg_bottles_count += 1
 			rbc_index = (reg_bottlem_count + reg_bottles_count) - 1
 			mbarrtype[rbc_index] = 1500
-			mbarrfill[rbc_index] = 0
-			mbarrmage[rbc_index] = 0
-			mbarrcool[rbc_index] = 0
-			$mbarrstat[rbc_index] = 'none'
-			$mbarrtemp[rbc_index] = 'none'
+			gs 'lact_bp', 'empty_milk_bottle', rbc_index
 			mbarrloca[rbc_index] = 1
 			jump 'rbc_loop'
 		end
@@ -763,11 +757,7 @@ if $ARGS[0] = 'reg_bottle_count':
 			reg_bottlem_count += 1
 			rbc_index = (reg_bottlem_count + reg_bottles_count) - 1
 			mbarrtype[rbc_index] = 2500
-			mbarrfill[rbc_index] = 0
-			mbarrmage[rbc_index] = 0
-			mbarrcool[rbc_index] = 0
-			$mbarrstat[rbc_index] = 'none'
-			$mbarrtemp[rbc_index] = 'none'
+			gs 'lact_bp', 'empty_milk_bottle', rbc_index
 			mbarrloca[rbc_index] = 1
 			jump 'rbc_loop'
 		end