|
|
@@ -18,15 +18,9 @@ def main() -> None:
|
|
|
print(planet['PlanetName'], cogc, sep='\t\t')
|
|
|
if cogc is not None:
|
|
|
cogc_planets[cogc].append(planet['PlanetName'])
|
|
|
-
|
|
|
- buildings: typing.Sequence[Building] = cache.get('https://rest.fnar.net/building/allbuildings', expiry=cache.ONE_DAY)
|
|
|
- experts: dict[str, str] = {}
|
|
|
- for building in buildings:
|
|
|
- for recipe in building['Recipes']:
|
|
|
- for output in recipe['Outputs']:
|
|
|
- experts[output['CommodityTicker']] = building['Expertise']
|
|
|
print()
|
|
|
|
|
|
+ experts = mat_expertise()
|
|
|
company_report = integration.pmmg_monthly_report()[company['CompanyId']]
|
|
|
report_by_expertise: dict[str | None, dict[str, int]] = collections.defaultdict(dict)
|
|
|
for mat, production in company_report.items():
|
|
|
@@ -53,6 +47,26 @@ def iter_planet_cogc() -> typing.Iterator[tuple[Planet, Expertise | None]]:
|
|
|
cogc = cogc.removeprefix('ADVERTISING_')
|
|
|
yield planet, typing.cast(Expertise | None, cogc)
|
|
|
|
|
|
+def mat_expertise() -> dict[str, Expertise]:
|
|
|
+ expertise: dict[str, Expertise] = {
|
|
|
+ 'AL': 'METALLURGY',
|
|
|
+ 'DRF': 'ELECTRONICS',
|
|
|
+ 'FE': 'METALLURGY',
|
|
|
+ }
|
|
|
+
|
|
|
+ materials: typing.Sequence[Material] = cache.get('https://rest.fnar.net/material/allmaterials', expiry=cache.ONE_DAY)
|
|
|
+ for material in materials:
|
|
|
+ if material['CategoryName'] in ('ores', 'minerals', 'liquids', 'gases'):
|
|
|
+ expertise[material['Ticker']] = 'RESOURCE_EXTRACTION'
|
|
|
+
|
|
|
+ buildings: typing.Sequence[Building] = cache.get('https://rest.fnar.net/building/allbuildings', expiry=cache.ONE_DAY)
|
|
|
+ for building in buildings:
|
|
|
+ for recipe in building['Recipes']:
|
|
|
+ for output in recipe['Outputs']:
|
|
|
+ expertise.setdefault(output['CommodityTicker'], building['Expertise'])
|
|
|
+
|
|
|
+ return expertise
|
|
|
+
|
|
|
Expertise = typing.Literal['AGRICULTURE', 'CHEMISTRY', 'CONSTRUCTION', 'ELECTRONICS', 'FOOD_INDUSTRIES',
|
|
|
'FUEL_REFINING', 'MANUFACTURING', 'METALLURGY', 'RESOURCE_EXTRACTION']
|
|
|
|
|
|
@@ -84,5 +98,9 @@ class BuildingMat(typing.TypedDict):
|
|
|
CommodityTicker: str
|
|
|
Amount: int
|
|
|
|
|
|
+class Material(typing.TypedDict):
|
|
|
+ Ticker: str
|
|
|
+ CategoryName: str
|
|
|
+
|
|
|
if __name__ == '__main__':
|
|
|
main()
|