Browse Source

roi: draw lines between recipes

raylu 3 days ago
parent
commit
d3e0524f77
1 changed files with 11 additions and 6 deletions
  1. 11 6
      roi.py

+ 11 - 6
roi.py

@@ -21,16 +21,21 @@ def main() -> None:
 			profits.append(profit)
 	profits.sort(reverse=True)
 	print('\033[1mwrought    \033[0;32mdaily profit/area\033[31m')
-	print('\033[30mrecipe                         \033[0mexpertise            \033[33mcapex  \033[35mdaily opex\033[0m')
+	print('\033[30mrecipe                         \033[0mexpertise            \033[33mcapex \033[35mdaily opex\033[0m')
 	for p in profits:
-		print(f'\033[1m{p.output:5} \033[0;32m{p.profit_per_area: 10,.0f}\033[31m', end='')
+		print(f'\033[53;1m{p.output:5} \033[53;32m{p.profit_per_area: 10,.0f} ', end='')
+		warnings = []
 		if p.low_volume:
-			print(' low volume', end='')
+			warnings.append('low volume')
 		if p.heavy_logistics:
-			print(' heavy logistics', end='')
+			warnings.append('heavy logistics')
 		if p.high_opex:
-			print(' high opex', end='')
-		print(f'\n\033[30m{p.recipe:30} \033[0m{p.expertise:19} \033[33m{p.capex:7,.0f} \033[35m{p.cost_per_day:7,.0f}\033[0m')
+			warnings.append('high opex')
+		if len(warnings) > 0:
+			print('               \033[31m' + ' '.join(warnings).rjust(36), end='')
+		else:
+			print(' ' * 14 + '\033[0;53m' + ' ' * 37, end='')
+		print(f'\n\033[0;30m{p.recipe:30} \033[0m{p.expertise:19} \033[33m{p.capex:7,.0f} \033[35m{p.cost_per_day:9,.0f}\033[0m')
 
 def calc_profit(recipe: Recipe, buildings: typing.Mapping[str, Building], materials: typing.Mapping[str, Material],
 		prices: typing.Mapping[str, Price]) -> Profit | None: