|
|
@@ -64,8 +64,8 @@ def main() -> None:
|
|
|
buys: dict[str, dict[str, int]] = {}
|
|
|
iteration_weight = iteration_volume = 0
|
|
|
for planet in planets:
|
|
|
- buy = planet.buy_for_target(target_days)
|
|
|
- weight_used, volume_used = shipping_used(materials, buy)
|
|
|
+ buy = planet.supply_for_days(target_days)
|
|
|
+ weight_used, volume_used = shipping_used(materials, config.supply_config(planet.name).ignore_materials, buy)
|
|
|
iteration_weight += weight_used
|
|
|
iteration_volume += volume_used
|
|
|
if iteration_weight > args.weight or iteration_volume > args.volume:
|
|
|
@@ -148,9 +148,11 @@ def get_fio_burn(planet_names: typing.Sequence[str]) -> typing.Iterator[FIOBurn]
|
|
|
else:
|
|
|
raise ValueError(name + ' not found')
|
|
|
|
|
|
-def shipping_used(materials: dict[str, Material], buy: dict[str, int]) -> tuple[float, float]:
|
|
|
+def shipping_used(materials: dict[str, Material], ignore: typing.Collection[str], counts: dict[str, int]) -> tuple[float, float]:
|
|
|
weight = volume = 0
|
|
|
- for ticker, amount in buy.items():
|
|
|
+ for ticker, amount in counts.items():
|
|
|
+ if ticker in ignore:
|
|
|
+ continue
|
|
|
weight += amount * materials[ticker]['Weight']
|
|
|
volume += amount * materials[ticker]['Volume']
|
|
|
return weight, volume
|
|
|
@@ -187,7 +189,7 @@ class Planet:
|
|
|
c['net_consumption'] = net
|
|
|
self.net_consumption.append(c)
|
|
|
|
|
|
- def buy_for_target(self, target_days: float) -> dict[str, int]:
|
|
|
+ def supply_for_days(self, target_days: float) -> dict[str, int]:
|
|
|
buy: dict[str, int] = {}
|
|
|
for consumption in self.net_consumption:
|
|
|
ticker = consumption['MaterialTicker']
|