|
|
@@ -18,7 +18,7 @@ def main() -> None:
|
|
|
executor.submit(get_raw_prices),
|
|
|
executor.submit(get_total_buy), # what we need to buy
|
|
|
executor.submit(supply.warehouse_inventory), # what we have
|
|
|
- executor.submit(get_planet_exports),
|
|
|
+ executor.submit(get_planet_exports_and_ship_storage),
|
|
|
executor.submit(get_bids), # what we already are bidding for
|
|
|
]
|
|
|
raw_prices, buy, warehouse, exports, (bids, orders) = (f.result() for f in futures)
|
|
|
@@ -65,14 +65,25 @@ def get_total_buy() -> typing.Mapping[str, int]:
|
|
|
buy[mat] += amount
|
|
|
return buy
|
|
|
|
|
|
-def get_planet_exports() -> typing.Mapping[str, int]:
|
|
|
+def get_planet_exports_and_ship_storage() -> typing.Mapping[str, int]:
|
|
|
+ '''materials in base storage that aren't being consumed and materials in ship storage'''
|
|
|
+ avail = collections.defaultdict(int)
|
|
|
+
|
|
|
fio_burn: typing.Sequence[supply.FIOBurn] = cache.get('https://rest.fnar.net/fioweb/burn/user/' + config.username,
|
|
|
headers={'Authorization': config.fio_api_key})
|
|
|
- avail = collections.defaultdict(int)
|
|
|
for burn in fio_burn:
|
|
|
planet = supply.Planet(burn)
|
|
|
for mat in planet.exporting:
|
|
|
avail[mat] += planet.inventory.get(mat, 0)
|
|
|
+
|
|
|
+ stores: typing.Sequence[market.Storage] = cache.get('https://rest.fnar.net/storage/' + config.username,
|
|
|
+ headers={'Authorization': config.fio_api_key})
|
|
|
+ for store in stores:
|
|
|
+ if store['Type'] != 'SHIP_STORE':
|
|
|
+ continue
|
|
|
+ for item in store['StorageItems']:
|
|
|
+ avail[item['MaterialTicker']] += item['MaterialAmount']
|
|
|
+
|
|
|
return avail
|
|
|
|
|
|
def get_bids() -> tuple[typing.Mapping[str, int], list[market.ExchangeOrder]]:
|
|
|
@@ -98,6 +109,5 @@ class Material:
|
|
|
def __lt__(self, o: Material) -> bool:
|
|
|
return self.savings< o.savings
|
|
|
|
|
|
-
|
|
|
if __name__ == '__main__':
|
|
|
main()
|