Skip to content

Commit

Permalink
Fix Issue: prop lists are causing any following sheets to be missed
Browse files Browse the repository at this point in the history
  • Loading branch information
Minoqi committed Jan 30, 2025
1 parent da7f61d commit 0e1a416
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 7 deletions.
5 changes: 5 additions & 0 deletions ConvertCastleDBToJson.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@

# Convert each sheet
for sheet in originalData["sheets"]:
# Make sure there are lines, otherwise skip sheet (used to skip sheets made from list column types)
if not sheet["lines"]:
print(f"Skipping sheet used for column list type... {sheet["name"]}")
continue

# Make sure ID exists, otherwise skip sheet
if idString not in sheet["lines"][0]:
print(f"ERROR: ID not found in file, skipping sheet {sheet["name"]}... (Given ID: {idString})")
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ Included is some demo files to mess with. There's a *CastleDB* file with 2 sheet
# Technical Details
This script uses pythons built-in `os` and `json` libraries.

You can keep up-to-date with bugs and future features in the `issues` tab.

> [!WARNING]
> This has not been tested with CastleDBs tilemap, although I would assume it would work.
> This has not been tested with CastleDBs tilemap system.
# Extra
- You can get it on [itchio](https://minoqi/itchi.io/castledb-cleaner) as well
Expand Down
21 changes: 18 additions & 3 deletions example/ExampleSheet02.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
{
"sword": {
"Weapon Name": "Basic Sword"
"Weapon Name": "Basic Sword",
"Effects": [
{
"Effect": 0
}
]
},
"bow": {
"Weapon Name": "Bow and Arrow"
"Weapon Name": "Bow and Arrow",
"Effects": [
{
"Effect": 3
}
]
},
"bomb": {
"Weapon Name": "Bomb"
"Weapon Name": "Bomb",
"Effects": [
{
"Effect": 1
}
]
}
}
11 changes: 11 additions & 0 deletions example/ExampleSheet03.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"healing_potion": {
"Skill Name": "Healing Potion"
},
"attack_potion": {
"Skill Name": "Attack Potion"
},
"magic_potion": {
"Skill Name": "Magic Potion"
}
}
72 changes: 69 additions & 3 deletions example/exmapleCastleDBFile.cdb
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,86 @@
"typeStr": "1",
"name": "Weapon Name",
"display": null
},
{
"typeStr": "8",
"name": "Effects",
"display": null
}
],
"lines": [
{
"ID": "sword",
"Weapon Name": "Basic Sword"
"Weapon Name": "Basic Sword",
"Effects": [
{
"Effect": 0
}
]
},
{
"ID": "bow",
"Weapon Name": "Bow and Arrow"
"Weapon Name": "Bow and Arrow",
"Effects": [
{
"Effect": 3
}
]
},
{
"ID": "bomb",
"Weapon Name": "Bomb"
"Weapon Name": "Bomb",
"Effects": [
{
"Effect": 1
}
]
}
],
"separators": [],
"props": {}
},
{
"name": "ExampleSheet02@Effects",
"props": {
"hide": true
},
"separators": [],
"lines": [],
"columns": [
{
"typeStr": "5:nothing,burn,freeze,bleed",
"name": "Effect",
"display": null
}
]
},
{
"name": "ExampleSheet03",
"columns": [
{
"typeStr": "0",
"name": "ID",
"display": null
},
{
"typeStr": "1",
"name": "Skill Name",
"display": null
}
],
"lines": [
{
"ID": "healing_potion",
"Skill Name": "Healing Potion"
},
{
"ID": "attack_potion",
"Skill Name": "Attack Potion"
},
{
"ID": "magic_potion",
"Skill Name": "Magic Potion"
}
],
"separators": [],
Expand Down

0 comments on commit 0e1a416

Please sign in to comment.