Skip to content

Commit 82496d3

Browse files
fix: season reward names
1 parent c724955 commit 82496d3

File tree

3 files changed

+37
-29
lines changed

3 files changed

+37
-29
lines changed

scripts/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ translations.json:
3232

3333
item_to_name_mappings.json: translations.json
3434
curl -sSL "https://github.com/NMSCD/nms-archive/raw/refs/heads/main/$(VERSION)/METADATA/REALITY/TABLES/NMS_REALITY_GCPRODUCTTABLE.MXML" -o ./NMS_REALITY_GCPRODUCTTABLE.MXML
35+
curl -sSL "https://github.com/NMSCD/nms-archive/raw/refs/heads/main/$(VERSION)/METADATA/REALITY/TABLES/NMS_BASEPARTPRODUCTS.MXML" -o ./NMS_BASEPARTPRODUCTS.MXML
3536
python ./extract_item_names.py
3637

3738
season_rewards.json: item_to_name_mappings.json

scripts/extract_item_names.py

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,43 @@
11
import xml.etree.ElementTree as ET
22
import json
33

4-
xml_path = "./NMS_REALITY_GCPRODUCTTABLE.MXML"
4+
xml_paths = [
5+
"./NMS_REALITY_GCPRODUCTTABLE.MXML",
6+
"./NMS_BASEPARTPRODUCTS.MXML"
7+
]
58
translations_path = "./translations.json"
69
output_json = "item_to_name_mappings.json"
710

811
# Load translation strings
912
with open(translations_path, "r", encoding="utf-8") as f:
1013
translations = json.load(f)
1114

12-
tree = ET.parse(xml_path)
13-
root = tree.getroot()
14-
1515
mapping = {}
1616

17-
# Find all product entries
18-
for product in root.findall(".//Property[@name='Table'][@value='GcProductData']"):
19-
prod_id = None
20-
name_lower_key = None
17+
def process_xml(xml_path):
18+
tree = ET.parse(xml_path)
19+
root = tree.getroot()
20+
21+
# Find all product entries
22+
for product in root.findall(".//Property[@name='Table'][@value='GcProductData']"):
23+
prod_id = None
24+
name_lower_key = None
2125

22-
for prop in product.findall("Property"):
23-
if prop.get("name") == "ID":
24-
prod_id = prop.get("value")
25-
if prop.get("name") == "NameLower":
26-
name_lower_key = prop.get("value")
26+
for prop in product.findall("Property"):
27+
if prop.get("name") == "ID":
28+
prod_id = prop.get("value")
29+
if prop.get("name") == "NameLower":
30+
name_lower_key = prop.get("value")
2731

28-
if prod_id and name_lower_key:
29-
translated_value = translations.get(name_lower_key, name_lower_key)
30-
mapping[prod_id] = translated_value
32+
if prod_id and name_lower_key:
33+
translated_value = translations.get(name_lower_key, name_lower_key)
34+
mapping[prod_id] = translated_value
35+
36+
# Process both XMLs
37+
for path in xml_paths:
38+
process_xml(path)
3139

3240
with open(output_json, "w", encoding="utf-8") as f:
3341
json.dump(mapping, f, indent=4, ensure_ascii=False)
3442

35-
print(f"Saved {len(mapping)} entries to {output_json}")
36-
43+
print(f"Saved {len(mapping)} combined entries to {output_json}")

src/data/rewards/season.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
[
22
{
3-
"name": "B_WNG_P",
3+
"name": "Aeron Drive",
44
"id": "^B_WNG_P",
55
"expedition": 20
66
},
77
{
8-
"name": "B_WNG_R",
8+
"name": "Aeron Blade",
99
"id": "^B_WNG_R",
1010
"expedition": 20
1111
},
1212
{
13-
"name": "B_STR_AA_N",
13+
"name": "Aeron Winglet",
1414
"id": "^B_STR_AA_N",
1515
"expedition": 20
1616
},
@@ -30,32 +30,32 @@
3030
"expedition": 20
3131
},
3232
{
33-
"name": "B_WNG_Q",
33+
"name": "Wings of Aeron",
3434
"id": "^B_WNG_Q",
3535
"expedition": 20
3636
},
3737
{
38-
"name": "B_DECO_S",
38+
"name": "Aeron Pillar",
3939
"id": "^B_DECO_S",
4040
"expedition": 20
4141
},
4242
{
43-
"name": "B_DECO_T",
43+
"name": "Aeron Pyramid",
4444
"id": "^B_DECO_T",
4545
"expedition": 20
4646
},
4747
{
48-
"name": "B_SHL_E",
48+
"name": "Aeron Powershield",
4949
"id": "^B_SHL_E",
5050
"expedition": 20
5151
},
5252
{
53-
"name": "B_DECO_R",
53+
"name": "Aeron Cowling",
5454
"id": "^B_DECO_R",
5555
"expedition": 20
5656
},
5757
{
58-
"name": "B_DECO_Q_0",
58+
"name": "Aeron Diffuser",
5959
"id": "^B_DECO_Q_0",
6060
"expedition": 20
6161
},
@@ -100,7 +100,7 @@
100100
"expedition": 19
101101
},
102102
{
103-
"name": "B_TUR_B",
103+
"name": "Deadeye Cannon",
104104
"id": "^B_TUR_B",
105105
"expedition": 19
106106
},
@@ -1184,4 +1184,4 @@
11841184
"id": "^EXPD_FIREPACK01",
11851185
"expedition": 1
11861186
}
1187-
]
1187+
]

0 commit comments

Comments
 (0)