aorecomp

Anarchy Online classic in the browser

git clone https://aorecomp.ubeagle.com/code/aorecomp.git


tools/client/playfield_catalog.py (1477B)


      1 """Release-backed playfield catalog shared by the native and browser sweeps."""
      2 import ruamel.yaml
      3 
      4 import tools.data.ao_database
      5 
      6 
      7 def read(root, assets):
      8     # Reconcile the server catalog with actual release definitions, including exclusions.
      9     database = tools.data.ao_database.Database(assets)
     10     catalog = []
     11     definitions = ruamel.yaml.YAML(typ='safe').load((root / 'server/gamedata/playfields.yaml').read_text())
     12     for identity, definition in definitions.items():
     13         row = {'id': identity, 'name': definition['name']}
     14         if (1000001, identity) not in database.records:
     15             row['skip'] = 'no playfield definition in 14.9.1'
     16         elif definition.get('unavailable'):
     17             row['skip'] = 'dependency-only entry in server catalog'
     18         catalog.append(row)
     19     known = {row['id'] for row in catalog}
     20     for kind, identity in database.records:
     21         if kind == 1000001 and identity not in known:
     22             row = {'id': identity, 'name': database.read(kind, identity)[8:40].split(b'\0')[0].decode('ascii').strip()}
     23             if identity in [101, 105]:
     24                 row['skip'] = 'door-link dependency or developer graphics test area'
     25             elif identity == 1673:
     26                 row['skip'] = 'empty definition: zero zones, zero districts, no outdoor ground'
     27             else:
     28                 row['skip'] = 'not in server catalog; investigate arrival'
     29             catalog.append(row)
     30     database.close()
     31     return catalog