feat: also publish GroupIDs as datafile (#19)

This commit is contained in:
Patric Stout
2023-11-26 20:21:57 +01:00
committed by GitHub
parent db023c1c33
commit 2f87ec486f
5 changed files with 41 additions and 2 deletions

5
.gitignore vendored
View File

@@ -1,5 +1,8 @@
/__pycache__/
/.env/
/dist/
/sde/
/esf_pb2.js
/esf_pb2.py
/node_modules/
/package-lock.json
/sde/

View File

@@ -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

View File

@@ -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)

View File

@@ -38,6 +38,16 @@ message TypeIDs {
map<int32, TypeID> entries = 1;
}
message GroupIDs {
message GroupID {
required string name = 1;
required int32 categoryID = 2;
required bool published = 3;
}
map<int32, GroupID> entries = 1;
}
message DogmaAttributes {
message DogmaAttribute {
required string name = 1;

5
package.json Normal file
View File

@@ -0,0 +1,5 @@
{
"dependencies": {
"protobufjs-cli": "^1.1.2"
}
}