|
@@ -58,9 +58,9 @@ def main() -> None:
|
|
|
weight_used += amount * materials[mat]['Weight']
|
|
weight_used += amount * materials[mat]['Weight']
|
|
|
volume_used += amount * materials[mat]['Volume']
|
|
volume_used += amount * materials[mat]['Volume']
|
|
|
if weight_used > args.weight:
|
|
if weight_used > args.weight:
|
|
|
- print(f'\033[33mwarning:\033[0m need additional {weight_used - args.weight:.1f}t to pick up exports at {planet.name}')
|
|
|
|
|
|
|
+ print(yellow('warning'), f'need additional {weight_used - args.weight:.1f}t to pick up exports at {planet.name}')
|
|
|
if volume_used > args.volume:
|
|
if volume_used > args.volume:
|
|
|
- print(f'\033[33mwarning:\033[0m need additional {volume_used - args.volume:.1f}㎥ to pick up exports at {planet.name}')
|
|
|
|
|
|
|
+ print(yellow('warning'), f'need additional {volume_used - args.volume:.1f}㎥ to pick up exports at {planet.name}')
|
|
|
|
|
|
|
|
print(cyan('\nload at CX:\n') + json.dumps({
|
|
print(cyan('\nload at CX:\n') + json.dumps({
|
|
|
'actions': [
|
|
'actions': [
|
|
@@ -170,9 +170,12 @@ def calculate_optimal(planets: typing.Sequence[Planet], materials: typing.Mappin
|
|
|
need -= min(need, avail)
|
|
need -= min(need, avail)
|
|
|
warehouse[ticker] -= max(avail - need, 0)
|
|
warehouse[ticker] -= max(avail - need, 0)
|
|
|
sources.append(f'WH: {avail}')
|
|
sources.append(f'WH: {avail}')
|
|
|
- cost = raw_prices[ticker]['Ask'] * need
|
|
|
|
|
- print(f' (${cost:6.0f}) ' + ', '.join(sources))
|
|
|
|
|
- total_cost += cost
|
|
|
|
|
|
|
+ if (ppu := raw_prices[ticker]['Ask']) is not None:
|
|
|
|
|
+ cost = ppu * need
|
|
|
|
|
+ print(f' (${cost:6.0f}) ' + ', '.join(sources))
|
|
|
|
|
+ total_cost += cost
|
|
|
|
|
+ else:
|
|
|
|
|
+ print(yellow(' no supply ') + ', '.join(sources))
|
|
|
else:
|
|
else:
|
|
|
print()
|
|
print()
|
|
|
print(f'\ntotal cost: {total_cost:,}')
|
|
print(f'\ntotal cost: {total_cost:,}')
|
|
@@ -198,6 +201,9 @@ def warehouse_inventory() -> dict[str, int]:
|
|
|
return {item['MaterialTicker']: item['MaterialAmount'] for item in storage['StorageItems']}
|
|
return {item['MaterialTicker']: item['MaterialAmount'] for item in storage['StorageItems']}
|
|
|
raise Exception("couldn't find HRT warehouse")
|
|
raise Exception("couldn't find HRT warehouse")
|
|
|
|
|
|
|
|
|
|
+def yellow(text: str) -> str:
|
|
|
|
|
+ return '\033[33m' + text + '\033[0m'
|
|
|
|
|
+
|
|
|
def cyan(text: str) -> str:
|
|
def cyan(text: str) -> str:
|
|
|
return '\033[36m' + text + '\033[0m'
|
|
return '\033[36m' + text + '\033[0m'
|
|
|
|
|
|