From c35e7a5d5a07d593ab2ae7fa10c6034ab09df063 Mon Sep 17 00:00:00 2001
From: Jones <Jones>
Date: Sun, 28 Oct 2018 09:34:20 +0100
Subject: [PATCH] New merge attempt.

Changed the color coding. green means higher prices, red lower, yellow neutral.
Added some colors for the economy tab to boot.
---
 src/events/intro/introSummary.tw  |  8 ---
 src/pregmod/manageEconomy.tw      | 36 +++++++-------
 src/uncategorized/nextWeek.tw     | 70 --------------------------
 src/uncategorized/persBusiness.tw | 81 ++++++++++++++++---------------
 4 files changed, 59 insertions(+), 136 deletions(-)

diff --git a/src/events/intro/introSummary.tw b/src/events/intro/introSummary.tw
index e5953451b27..0953db6ad6d 100644
--- a/src/events/intro/introSummary.tw
+++ b/src/events/intro/introSummary.tw
@@ -79,14 +79,6 @@ __''World Settings''__
 <<set $modCost = Math.trunc(5000/$economy)>>
 <<set $surgeryCost = Math.trunc(30000/$economy)>>
 
-/* Setup for supply and demand for slaves */
-<<set $menialSupplyFactor = 0>>
-<<set $demandTimer = 0>>
-<<set $supplyTimer = 0>>
-<<set $elapsedDemandTimer = 0>>
-<<set $elapsedSupplyTimer = 0>>
-<<set $slaveCostRandom = 0>>
-
 <br>
 
 <<if ndef $customVariety>>
diff --git a/src/pregmod/manageEconomy.tw b/src/pregmod/manageEconomy.tw
index b7a5ccb3f86..33d545bb893 100644
--- a/src/pregmod/manageEconomy.tw
+++ b/src/pregmod/manageEconomy.tw
@@ -37,34 +37,34 @@
 	<br> The current score is 
 	<<if $localEcon > 100>>
 		<<set _econPercent = Math.trunc(1000-100000/$localEcon)/10>>
-		reducing prices by ''<<print _econPercent>> %.''
+		reducing prices by @@.green;''<<print _econPercent>> %.''@@
 	<<elseif $localEcon == 100>>
 		equal to the base score. There are no price modifications.
 	<<else>>
 		<<set _econPercent = Math.trunc(100000/$localEcon-1000)/10>>
-		increasing prices by ''<<print _econPercent>> %.''
+		increasing prices by @@.red;''<<print _econPercent>> %.''@@
 	<</if>>
 <br><br>	
 <</if>>
 
 Slave demand is 
 <<if $menialDemandFactor <= -35000>>
-	''extremely low''
+	@@.red;''extremely low''@@
 <<elseif $menialDemandFactor <= -20000>>
-	''very low''
+	@@.red;''very low''@@
 <<elseif $menialDemandFactor <= 0>>
-	''weak''
+	@@.yellow;''weak''@@
 <<elseif $menialDemandFactor >= 35000>>
-	''extremely high''
+	@@.green;''extremely high''@@
 <<elseif $menialDemandFactor >= 20000>>
-	''very high''
+	@@.green;''very high''@@
 <<else>>
-	''strong''
+	@@.yellow;''strong''@@
 <</if>>
 <<if $deltaDemand > 0>> 
-	 and ''improving''
+	 and @@.green;''improving''@@
 <<elseif $deltaDemand < 0>> 
-	 and ''decreasing''
+	 and @@.red;''decreasing''@@
 <</if>>
 <<if $deltaDemand != 0>>
 	<<if $demandTimer - $elapsedDemandTimer < 3>> 
@@ -89,22 +89,22 @@ Slave demand is
 <br>
 Slave supply is 
 <<if $menialSupplyFactor <= -35000>>
-	''extremely low''
+	@@.green;''extremely low''@@
 <<elseif $menialSupplyFactor <= -20000>>
-	''very low''
+	@@.green;''very low''@@
 <<elseif $menialSupplyFactor <= 0>>
-	''weak''
+	@@.yellow;''weak''@@
 <<elseif $menialSupplyFactor >= 35000>>
-	''extremely high''
+	@@.red;''extremely high''@@
 <<elseif $menialSupplyFactor >= 20000>>
-	''very high''
+	@@.red;''very high''@@
 <<else>>
-	''strong''
+	@@.yellow;''strong''@@
 <</if>>
 <<if $deltaSupply > 0>>
-	 and ''improving''
+	 and @@.red;''improving''@@
 <<elseif $deltaSupply < 0>>
-	 and ''decreasing''
+	 and @@.green;''decreasing''@@
 <</if>>
 <<if $deltaSupply != 0>> 
 	<<if $supplyTimer - $elapsedDemandTimer < 3>> 
diff --git a/src/uncategorized/nextWeek.tw b/src/uncategorized/nextWeek.tw
index 689267c0f8e..392a25d4e9d 100644
--- a/src/uncategorized/nextWeek.tw
+++ b/src/uncategorized/nextWeek.tw
@@ -77,76 +77,6 @@
 	<<set $surgeryCost = Math.trunc(30000/$localEcon)>>
 <</if>>
 
-/*Adding random changes to slave demand and supply*/
-/*Without events triggering and a relatively average supply/demand situation, the best case scenario is an increase/decrease in the price of slaves of 10 in one week. Chance of these conditions happening are 1/25. For demand or supply to go from average to their maximum will take 25 weeks if rolling highest growth each time a roll is made and all other luck is average. Because of the properties of the market and how it develops the likely prices one will encounter are distributed in a bellshaped fashion, centered around 1000. Minimum possible price is 750, maximum 1250. At +/- 35000 chances of supply or demand getting even more extreme are reduced.*/
-<<set _demandSlaveVar = random(-10,10)*10>>
-<<set _supplySlaveVar = random(-10,10)*10>>
-<<set _randomSlaveCost = random(-3,3)>>
-<<set $slaveCostRandom = _randomSlaveCost>>
-<<if $menialDemandFactor <= -50000>>
-	<<set _demandDelta = random(1,3)>>
-	<<set $deltaDemand = _demandDelta * 1000>>
-	<<set _timerDemand = random(7,12)>>
-	<<set $demandTimer = _timerDemand>>
-	<<set $elapsedDemandTimer = 1>>
-	<<set $menialDemandFactor += $deltaDemand + _demandSlaveVar>>
-<<elseif $menialDemandFactor >= 50000>>
-	<<set _demandDelta = random(-3,-1)>>
-	<<set $deltaDemand = _demandDelta * 1000>>
-	<<set _timerDemand = random(7,12)>>
-	<<set $demandTimer = _timerDemand>>
-	<<set $elapsedDemandTimer = 1>>
-	<<set $menialDemandFactor += $deltaDemand + _demandSlaveVar>>
-<<elseif $demandTimer - $elapsedDemandTimer <= 0>>
-	<<set _timerDemand = random(7,12)>>
-	<<set $demandTimer = _timerDemand>>
-	<<set $elapsedDemandTimer = 1>>
-	<<if $menialDemandFactor > 35000>>
-		<<set _demandDelta = random(-3,1)>>
-	<<elseif $menialDemandFactor < -35000>>
-		<<set _demandDelta = random(-1,3)>>
-	<<else>>
-		<<set _demandDelta = random(-2,2)>>
-	<</if>>
-	<<set $deltaDemand = _demandDelta * 1000>>
-	<<set $menialDemandFactor += $deltaDemand + _demandSlaveVar>>
-<<else>>
-	<<set $elapsedDemandTimer += 1>>
-	<<set $menialDemandFactor += $deltaDemand + _demandSlaveVar>>
-	<<set $menialDemandFactor = Math.clamp($menialDemandFactor,-50000,50000)>>
-<</if>>
-
-<<if $menialSupplyFactor <= -50000>>
-	<<set _supplyDelta = random(1,3)>>
-	<<set $deltaSupply = _supplyDelta * 1000>>
-	<<set _timerSupply = random(7,12)>>
-	<<set $supplyTimer = _timerSupply>>
-	<<set $elapsedSupplyTimer = 1>>
-	<<set $menialSupplyFactor += $deltaSupply + _demandSlaveVar>>
-<<elseif $menialSupplyFactor >= 50000>>
-	<<set _supplyDelta = random(-3,-1)>>
-	<<set $deltaSupply = _supplyDelta * 1000>>
-	<<set _timerSupply = random(7,12)>>
-	<<set $supplyTimer = _timerSupply>>
-	<<set $elapsedSupplyTimer = 1>>
-	<<set $menialSupplyFactor += $deltaSupply + _demandSlaveVar>>
-<<elseif $supplyTimer - $elapsedSupplyTimer <= 0>>
-	<<set _timerSupply = random(7,12)>>
-	<<set $supplyTimer = _timerSupply>>
-	<<set $elapsedSupplyTimer = 1>>
-	<<if $menialSupplyFactor > 35000>>
-		<<set _supplyDelta = random(-3,1)>>
-	<<elseif $menialSupplyFactor < -35000>>
-		<<set _supplyDelta = random(-1,3)>>
-	<<else>>
-		<<set _supplyDelta = random(-2,2)>>
-	<</if>>
-	<<set $deltaSupply = _supplyDelta * 1000>>
-	<<set $menialSupplyFactor += $deltaSupply + _supplySlaveVar>>
-<<else>>
-	<<set $elapsedSupplyTimer += 1>>
-	<<set $menialSupplyFactor += $deltaSupply + _supplySlaveVar>>
-	<<set $menialSupplyFactor = Math.clamp($menialSupplyFactor,-50000,50000)>>
 /*Adding random changes to the economy*/
 <<if $difficultySwitch == 1>>
 	<<set _globalEconSeed = random(1,100)>>
diff --git a/src/uncategorized/persBusiness.tw b/src/uncategorized/persBusiness.tw
index 64c4585f73c..9b502de8e47 100644
--- a/src/uncategorized/persBusiness.tw
+++ b/src/uncategorized/persBusiness.tw
@@ -889,49 +889,49 @@ Routine upkeep of your demesne costs @@.yellow;<<print cashFormat($costs)>>.@@
 	<<set $deltaDemand = _demandDelta * 1000>>
 	<<set $menialDemandFactor += $deltaDemand + _demandSlaveVar>>
 	<<if $menialDemandFactor <= -35000>>
-		<br>@@.yellowgreen;Demand for slaves is approaching a ''historic low'', forecasts predict@@
+		<br>Demand for slaves is approaching a @@.red;''historic low'',@@ forecasts predict
 		<<if $deltaDemand > 0>>
-			@@.yellowgreen;the market will turn and ''demand will rise''.@@
+			the market will turn and @@.green;''demand will rise''.@@
 		<<elseif $deltaDemand < 0>>
-			@@.yellowgreen;''demand will continue to weaken'', but warn the bottom is in sight.@@
+			@@.red;''demand will continue to weaken'',@@ but warn the bottom is in sight.
 		<<else>>
-			@@.yellowgreen;the current demand will ''remain stable'' for the coming months.@@
+			the current demand will @@.yellow;''remain stable''@@ for the coming months.
 		<</if>>
 	<<elseif $menialDemandFactor <= 20000>>
-		<br>@@.yellowgreen;Demand for slaves is ''very low'', forecasts predict@@
+		<br>Demand for slaves is @@.red;''very low'',@@ forecasts predict
 		<<if $deltaDemand > 0>>
-			@@.yellowgreen;the market will turn and ''demand will rise''.@@
+			the market will turn and @@.green;''demand will rise''.@@
 		<<elseif $deltaDemand < 0>>
-			@@.yellowgreen;''demand will continue to weaken''.@@
+			@@.red;''demand will continue to weaken''.@@
 		<<else>>
-			@@.yellowgreen;the current demand will ''remain stable'' for the coming months.@@
+			the current demand will @@.yellow''remain stable''@@ for the coming months.
 		<</if>>	
 	<<elseif $menialDemandFactor >= 35000>>
-		<br>@@.yellowgreen;Demand for slaves is approaching a ''historic high'', forecasts predict@@
+		<br>Demand for slaves is approaching a @@.green;''historic high''@@, forecasts predict
 		<<if $deltaDemand > 0>>
-			@@.yellowgreen;''demand will continue to rise'', but warn the peak is in sight.@@
+			@@.green;''demand will continue to rise'',@@ but warn the peak is in sight.
 		<<elseif $deltaDemand < 0>>
-			@@.yellowgreen;the market will turn and ''demand will weaken''.@@
+			the market will turn and @@.red;''demand will weaken''.@@
 		<<else>>
-			@@.yellowgreen;the current demand will ''remain stable'' for the coming months.@@
+			the current demand will @@.yellow;''remain stable''@@ for the coming months.
 		<</if>>
 	<<elseif $menialDemandFactor >= 20000>>
-		<br>@@.yellowgreen;Demand for slaves is ''very high'', forecasts predict@@
+		<br>Demand for slaves is @@.green;''very high'',@@ forecasts predict
 		<<if $deltaDemand > 0>>
-			@@.yellowgreen;''demand will continue to rise''.@@
+			@@.green;''demand will continue to rise''.@@
 		<<elseif $deltaDemand < 0>>
-			@@.yellowgreen;the market will turn and ''demand will weaken''.@@
+			the market will turn and @@.red;''demand will weaken''.@@
 		<<else>>
-			@@.yellowgreen;the current demand will ''remain stable'' for the coming months.@@
+			the current demand will @@.yellow;''remain stable''@@ for the coming months.
 		<</if>>
 	<<else>>
-		<br>@@.yellowgreen;Demand for slaves is ''average'', forecasts predict@@
+		<br>Demand for slaves is @@.yellow;''average'',@@ forecasts predict
 		<<if $deltaDemand > 0>>
-			@@.yellowgreen;the market will see ''rising demand''.@@
+			the market will see @@.green;''rising demand''.@@
 		<<elseif $deltaDemand < 0>>
-			@@.yellowgreen;the market will see ''weakening demand''.@@
+			the market will see @@.red;''weakening demand''.@@
 		<<else>>
-			@@.yellowgreen;''no change'' for the coming months.@@
+			@@.yellow''no change''@@ for the coming months.
 		<</if>>
 	<</if>>
 <<else>>
@@ -939,6 +939,7 @@ Routine upkeep of your demesne costs @@.yellow;<<print cashFormat($costs)>>.@@
 	<<set $menialDemandFactor += $deltaDemand + _demandSlaveVar>>
 	<<set $menialDemandFactor = Math.clamp($menialDemandFactor,-50000,50000)>>
 <</if>>
+
 <<if $menialSupplyFactor <= -50000>>
 	<<set _supplyDelta = random(1,3)>>
 	<<set $deltaSupply = _supplyDelta * 1000>>
@@ -967,49 +968,49 @@ Routine upkeep of your demesne costs @@.yellow;<<print cashFormat($costs)>>.@@
 	<<set $deltaSupply = _supplyDelta * 1000>>
 	<<set $menialSupplyFactor += $deltaSupply + _supplySlaveVar>>
 	<<if $menialSupplyFactor <= -35000>>
-		<br>@@.yellowgreen;Supply of slaves is approaching a ''historic low'', forecasts predict@@
+		<br>Supply of slaves is approaching a @@.green;''historic low'',@@ forecasts predict
 		<<if $deltaSupply > 0>>
-			@@.yellowgreen;the market will turn and ''supply will rise''.@@
+			the market will turn and @@.red;''supply will rise''.@@
 		<<elseif $deltaSupply < 0>>
-			@@.yellowgreen;''supply will continue to weaken'', but warn the bottom is in sight.@@
+			@@.green;''supply will continue to weaken'',@@ but warn the bottom is in sight.
 		<<else>>
-			@@.yellowgreen;the current supply will ''remain stable'' for the coming months.@@
+			the current supply will @@.yellow;''remain stable''@@ for the coming months.
 		<</if>>
 	<<elseif $menialSupplyFactor <= 20000>>
-		<br>@@.yellowgreen;Supply for slaves is ''very low'', forecasts predict@@
+		<br>Supply for slaves is @@.green;''very low'',@@ forecasts predict
 		<<if $deltaSupply > 0>>
-			@@.yellowgreen;the market will turn and ''supply will rise''.@@
+			the market will turn and @@.red;''supply will rise''.@@
 		<<elseif $deltaSupply < 0>>
-			@@.yellowgreen;''supply will continue to weaken''.@@
+			@@.green;''supply will continue to weaken''.@@
 		<<else>>
-			@@.yellowgreen;the current supply will ''remain stable'' for the coming months.@@
+			the current supply will @@.yellow;''remain stable''@@ for the coming months.
 		<</if>>	
 	<<elseif $menialSupplyFactor >= 35000>>
-		<br>@@.yellowgreen;Supply for slaves is approaching a ''historic high'', forecasts predict@@
+		<br>Supply for slaves is approaching a @@.red;''historic high'',@@ forecasts predict
 		<<if $deltaSupply > 0>>
-			@@.yellowgreen;''supply will continue to rise'', but warn the peak is in sight.@@
+			@@.red;''supply will continue to rise'',@@ but warn the peak is in sight.
 		<<elseif $deltaSupply < 0>>
-			@@.yellowgreen;the market will turn and ''supply will weaken''.@@
+			the market will turn and @@.green;''supply will weaken''.@@
 		<<else>>
-			@@.yellowgreen;the current supply will ''remain stable'' for the coming months.@@
+			the current supply will @@.yellow;''remain stable''@@ for the coming months.
 		<</if>>
 	<<elseif $menialSupplyFactor >= 20000>>
-		<br>@@.yellowgreen;Supply for slaves is ''very high'', forecasts predict@@
+		<br>Supply for slaves is @@.red;''very high''@@, forecasts predict
 		<<if $deltaSupply > 0>>
-			@@.yellowgreen;''supply will continue to rise''.@@
+			@@.red;''supply will continue to rise''.@@
 		<<elseif $deltaSupply < 0>>
-			@@.yellowgreen;the market will turn and ''supply will weaken''.@@
+			the market will turn and @@.green;''supply will weaken''.@@
 		<<else>>
-			@@.yellowgreen;the current supply will ''remain stable'' for the coming months.@@
+			the current supply will @@.yellow;''remain stable''@@ for the coming months.
 		<</if>>
 	<<else>>
-		<br>@@.yellowgreen;Supply for slaves is ''average'', forecasts predict@@
+		<br>Supply for slaves is @@.yellow;''average'',@@ forecasts predict
 		<<if $deltaSupply > 0>>
-			@@.yellowgreen;the market will see ''rising supply''.@@
+			the market will see @@.red;''rising supply''.@@
 		<<elseif $deltaSupply < 0>>
-			@@.yellowgreen;the market will see ''weakening supply''.@@
+			the market will see @@.green;''weakening supply''.@@
 		<<else>>
-			@@.yellowgreen;''no change'' for the coming months.@@
+			@@.yellow;''no change''@@ for the coming months.
 		<</if>>
 	<</if>>
 <<else>>
-- 
GitLab