- What it is: A stable, diff-friendly, Python-like text representation of the LoL meta schema (classes, inheritance, and properties) generated from a meta JSON dump.
- What it is not: Valid/executable Python. It is intentionally a simple text format that looks like Python so it’s easy to read and diff in Git.
- Via
scripts/db_import.py, which:- Loads the latest (or provided)
dumps/*.jsonand normalizes old/new meta formats. - Resolves known type and field hashes using
hashes/hashes.bintypes.txtandhashes/hashes.binfields.txt. - Merges classes, bases, and fields into a persistent database and writes
db/database.pydeterministically.
- Loads the latest (or provided)
- CI: The
Sync LoL Meta Classesworkflow regenerates and commitsdb/database.pywhendumps/changes.
- Header line:
#!python(for editor hinting only). - For each class:
- Class line:
class <TypeName>(<Base1, Base2, ...>):<TypeName>is the resolved type name if known, otherwise the raw hex hash (e.g.0xe75aad84).- Base list contains the resolved primary base and any secondary bases (if any). - inheritance
- Field lines (indented 4 spaces):
FieldName: (ft, kt, vt, kh)optionally followed by= <json-default>- FieldName: resolved field name if known, otherwise the raw hex hash.
- ft (field type): one of scalar or composite types, e.g.
Bool,I32,U32,F32,String,Hash,File,Flag, or composite typesList,List2,Pointer,Embed,Link,Option,Map. - kt and vt (auxiliary type parameters):
- For
List/List2/Option(container):ktis the fixed-size as hex (e.g.0x0if dynamic);vtis the container value type (e.g.U32). - For
Map:ktis the map key type (e.g.String);vtis the map value type (e.g.U32). - For scalars and non-container composites: both are
0x0.
- For
- kh (other-class/type reference):
- For
Pointer/Embed/Linkand some composites, this is the referenced class. It is resolved to a known type name when available; otherwise it remains the raw hex hash. For non-referential types it is0x0.
- For
- Default value (optional):
- If a property has a default in the dump, it is appended using
=followed by a compact JSON literal (e.g.null,false,0,"text",[],{}or nested objects). Keys are written with stable ordering.
- If a property has a default in the dump, it is appended using
- Terminator:
pass
- Class line:
Example:
class ExampleClass(BaseType):
ExampleList: (List2, 0x0, U32, 0x0) = []
PointerToOther: (Pointer, 0x0, 0x0, OtherType) = null
NameToCount: (Map, String, U32, 0x0) = {}
ScalarValue: (I32, 0x0, 0x0, 0x0) = 0
pass
- Type and field hashes are mapped using the files in
hashes/. - If a hash is unknown, it is left as its raw hex form in the output (no prefixing). This applies to both class names and field names, and to the
khreferenced type.
- Classes are written in alphabetical order by their display name (resolved type name if known, otherwise the raw hex). Ties are broken by class hash to ensure stability.
- Each class’s
basesare sorted before printing. - Each class’s
fieldsare sorted before printing. Sorting uses(FieldName, (ft, kt, vt, kh))only; any default value does not affect ordering.
- Running
db_import.pyrepeatedly merges in additional classes/fields from new dumps into the existingdb/database.pyrepresentation. - Duplicate classes/fields are de-duplicated; conflicts (e.g., same field with different type tuple) will raise errors during import.
python3 scripts/db_import.py db/database.py dumps/<version>.json
git diff -- db/database.py | cat- Readable, compact, and Git-diff–friendly.
- Strictly line-oriented and regex-parseable (
db_import.pyuses regex to read it back), so it’s easy to review and stable across runs.