mirror of
https://github.com/Gurkengewuerz/nitro-docker.git
synced 2024-11-26 17:50:52 +01:00
fix: translate also walltypes
This commit is contained in:
parent
212606febd
commit
e31e09d589
@ -1,27 +1,33 @@
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
|
todo_types = ["roomitemtypes", "wallitemtypes"]
|
||||||
|
|
||||||
# Create a dictionary mapping classname to name and description
|
# Create a dictionary mapping classname to name and description
|
||||||
furniture_dict = {}
|
furniture_dict = {}
|
||||||
with open('gamedata/furnidata.json', 'r', encoding='utf-8') as f:
|
with open('gamedata/furnidata.json', 'r', encoding='utf-8') as f:
|
||||||
furniture_data = json.load(f)
|
furniture_data = json.load(f)
|
||||||
for furnitype in furniture_data['roomitemtypes']['furnitype']:
|
for todo_type in todo_types:
|
||||||
classname = furnitype['classname']
|
for furnitype in furniture_data[todo_type]["furnitype"]:
|
||||||
furniture_dict[classname] = {
|
classname = furnitype['classname']
|
||||||
"name": furnitype['name'],
|
furniture_dict[classname] = {
|
||||||
"description": furnitype['description'],
|
"name": furnitype['name'],
|
||||||
}
|
"description": furnitype['description'],
|
||||||
|
}
|
||||||
|
|
||||||
|
orig_furniture_data = {}
|
||||||
# Load the JSON file
|
# Load the JSON file
|
||||||
with open('../assets/gamedata/FurnitureData.json', 'r', encoding='utf-8') as f:
|
with open('../assets/gamedata/FurnitureData.json', 'r', encoding='utf-8') as f:
|
||||||
furniture_data = json.load(f)
|
orig_furniture_data = json.load(f)
|
||||||
|
|
||||||
# Replace the name and description values with values from the XML file
|
# Replace the name and description values with values from the XML file
|
||||||
for furnitype in furniture_data['roomitemtypes']['furnitype']:
|
for todo_type in todo_types:
|
||||||
classname = furnitype['classname']
|
for furnitype in orig_furniture_data[todo_type]["furnitype"]:
|
||||||
if classname in furniture_dict:
|
classname = furnitype['classname']
|
||||||
furnitype['name'] = furniture_dict[classname]['name']
|
if classname in furniture_dict:
|
||||||
furnitype['description'] = furniture_dict[classname]['description']
|
furnitype['name'] = furniture_dict[classname]['name']
|
||||||
|
furnitype['description'] = furniture_dict[classname]['description']
|
||||||
|
|
||||||
|
|
||||||
# Save the updated JSON file
|
# Save the updated JSON file
|
||||||
with open('../assets/gamedata/FurnitureData.json', 'w') as f:
|
with open('../assets/gamedata/FurnitureData.json', 'w') as f:
|
||||||
json.dump(furniture_data, f, separators=(',', ':'))
|
json.dump(orig_furniture_data, f, separators=(',', ':'))
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
# Habbo Furni Translator by giu888
|
todo_types = ["roomitemtypes", "wallitemtypes"]
|
||||||
|
|
||||||
# Load the JSON data from the file
|
# Load the JSON data from the file
|
||||||
with open("../assets/gamedata/FurnitureData.json", encoding='utf-8') as f:
|
with open("../assets/gamedata/FurnitureData.json", encoding='utf-8') as f:
|
||||||
data = json.load(f)
|
data = json.load(f)
|
||||||
|
|
||||||
with open("catalog_items.sql", "w", encoding='utf-8') as f:
|
with open("catalog_items.sql", "w", encoding='utf-8') as f:
|
||||||
for furni in data["roomitemtypes"]["furnitype"]:
|
for todo_type in todo_types:
|
||||||
furni_id = furni["id"]
|
for furni in data[todo_type]["furnitype"]:
|
||||||
if furni["name"]:
|
furni_id = furni["id"]
|
||||||
furni_name = furni["name"].replace("'", "''").strip()[:55]
|
if furni["name"]:
|
||||||
f.write(f"UPDATE catalog_items SET catalog_name = '{furni_name}' WHERE item_ids = '{furni_id}';\n")
|
furni_name = furni["name"].replace("'", "''").strip()[:55]
|
||||||
#f.write(f"UPDATE items_base SET public_name = '{furni_name}' WHERE id = '{furni_id}';\n")
|
f.write(f"UPDATE catalog_items SET catalog_name = '{furni_name}' WHERE item_ids = '{furni_id}';\n")
|
||||||
|
#f.write(f"UPDATE items_base SET public_name = '{furni_name}' WHERE id = '{furni_id}';\n")
|
||||||
|
Loading…
Reference in New Issue
Block a user