diff --git a/.gitignore b/.gitignore index 60edfa7..029d9ba 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,8 @@ /__pycache__/ /.env/ /dist/ -/sde/ +/esf_pb2.js /esf_pb2.py +/node_modules/ +/package-lock.json +/sde/ diff --git a/README.md b/README.md index f38ed44..0441f75 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ This is exported to Python and Javascript with the following commands: ```bash protoc --python_out=. esf.proto -web/node_modules/.bin/pbjs -t static-module -w es6 -o esf_pb2.js esf.proto --no-create --no-encode --no-verify --no-convert --no-delimited --no-typeurl --no-beautify --no-comments --no-service +npx pbjs -t static-module -w es6 -o esf_pb2.js esf.proto --no-create --no-encode --no-verify --no-convert --no-delimited --no-typeurl --no-beautify --no-comments --no-service ``` ## Converting diff --git a/convert.py b/convert.py index 4302192..ce36939 100644 --- a/convert.py +++ b/convert.py @@ -79,6 +79,26 @@ def convert_type_ids(path): return ships +def convert_group_ids(path): + print("Converting groupIDs ...") + + with open(f"{path}/groupIDs.yaml") as fp: + groupIDs = yaml.load(fp, Loader=yaml.CSafeLoader) + + pb2 = esf_pb2.GroupIDs() + ships = [] + + for id, entry in groupIDs.items(): + pb2.entries[id].name = entry["name"]["en"] + pb2.entries[id].categoryID = entry["categoryID"] + pb2.entries[id].published = entry["published"] + + with open("dist/sde/groupIDs.pb2", "wb") as fp: + fp.write(pb2.SerializeToString()) + + return ships + + def convert_dogma_attributes(path): print("Converting dogmaAttributes ...") @@ -267,6 +287,7 @@ def convert_dogma_effects(path): fp.write(pb2.SerializeToString()) +convert_group_ids(path) ships = convert_type_ids(path) convert_type_dogma(path, ships) convert_dogma_attributes(path) diff --git a/esf.proto b/esf.proto index b9657f0..7391acf 100644 --- a/esf.proto +++ b/esf.proto @@ -38,6 +38,16 @@ message TypeIDs { map entries = 1; } +message GroupIDs { + message GroupID { + required string name = 1; + required int32 categoryID = 2; + required bool published = 3; + } + + map entries = 1; +} + message DogmaAttributes { message DogmaAttribute { required string name = 1; diff --git a/package.json b/package.json new file mode 100644 index 0000000..b3a9cb9 --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "protobufjs-cli": "^1.1.2" + } +}