From e2242c477e5663aa8a9813ca58e5c3704c57de23 Mon Sep 17 00:00:00 2001 From: Maikel Wever Date: Mon, 22 Jun 2020 18:02:37 +0200 Subject: [PATCH] Move item data to JSON files (#1) * Move game items to json files for live editing * Attempt to fix specfile for json data * Remove conversion script * Try to fix replacement file loading for frozen bundles --- .gitignore | 2 + MANIFEST.in | 2 + readme.md | 17 ++ setup.py | 1 + slimseditor/game/__init__.py | 64 ++++-- slimseditor/game/acit.json | 3 + slimseditor/game/acit.py | 10 - slimseditor/game/dl.json | 3 + slimseditor/game/dl.py | 10 - slimseditor/game/gc.json | 361 ++++++++++++++++++++++++++++++++++ slimseditor/game/gc.py | 83 -------- slimseditor/game/nexus.json | 14 ++ slimseditor/game/nexus.py | 12 -- slimseditor/game/qfb.json | 9 + slimseditor/game/qfb.py | 11 -- slimseditor/game/rac.json | 295 ++++++++++++++++++++++++++++ slimseditor/game/rac.py | 77 -------- slimseditor/game/tod.json | 14 ++ slimseditor/game/tod.py | 12 -- slimseditor/game/uya.json | 369 +++++++++++++++++++++++++++++++++++ slimseditor/game/uya.py | 92 --------- slimseditor/saveentry.py | 6 +- win.spec | 2 +- 23 files changed, 1141 insertions(+), 328 deletions(-) create mode 100644 MANIFEST.in create mode 100644 slimseditor/game/acit.json delete mode 100644 slimseditor/game/acit.py create mode 100644 slimseditor/game/dl.json delete mode 100644 slimseditor/game/dl.py create mode 100644 slimseditor/game/gc.json delete mode 100644 slimseditor/game/gc.py create mode 100644 slimseditor/game/nexus.json delete mode 100644 slimseditor/game/nexus.py create mode 100644 slimseditor/game/qfb.json delete mode 100644 slimseditor/game/qfb.py create mode 100644 slimseditor/game/rac.json delete mode 100644 slimseditor/game/rac.py create mode 100644 slimseditor/game/tod.json delete mode 100644 slimseditor/game/tod.py create mode 100644 slimseditor/game/uya.json delete mode 100644 slimseditor/game/uya.py diff --git a/.gitignore b/.gitignore index 0c13768..725c07d 100644 --- a/.gitignore +++ b/.gitignore @@ -179,3 +179,5 @@ tags .vscode .venv imgui.ini + +/game/*.json diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..8591016 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,2 @@ +include slimseditor/game/*.json + diff --git a/readme.md b/readme.md index d8f2b26..d6b8ae0 100644 --- a/readme.md +++ b/readme.md @@ -69,3 +69,20 @@ env/bin/pip install -r requirements.txt env/bin/python setup.py develop env/bin/python -m slimseditor ``` + + +Adding savegame items +--------------------- + +Savegame item positions are defined by `.json` files in `slimseditor/game`. +For prebuilt editions, these files are bundled with the application data. + +To submit new items, or change existing item definitions, +simply edit the appropriate lines in the `.json` files. +The editor will re-read the `.json` files every time you open a savegame or click a `refresh` button. + +If you are working with a prebuilt edition, +you can create a folder called `game` in the directory `slimseditor.exe` is in. +The editor will then search for game files in this directory instead. +To get started with this, download the `.json` file for the game you're editing from GitHub, +and put it in your new `game` folder. diff --git a/setup.py b/setup.py index 2c06273..616d3f2 100755 --- a/setup.py +++ b/setup.py @@ -18,4 +18,5 @@ url='https://github.com/maikelwever/slimseditor/', packages=['slimseditor'], ext_modules=[slimscbindings], + include_package_data=True, ) diff --git a/slimseditor/game/__init__.py b/slimseditor/game/__init__.py index 56ebf84..8dcc414 100644 --- a/slimseditor/game/__init__.py +++ b/slimseditor/game/__init__.py @@ -1,13 +1,23 @@ +import json +import os +import pkgutil +import sys + from enum import Enum -from slimseditor.game.acit import get_acit_items -from slimseditor.game.dl import get_dl_items -from slimseditor.game.gc import get_gc_items -from slimseditor.game.nexus import get_nexus_items -from slimseditor.game.qfb import get_qfb_items -from slimseditor.game.rac import get_rac_items -from slimseditor.game.tod import get_tod_items -from slimseditor.game.uya import get_uya_items +from slimseditor.saveentry import RangedInteger, Integer, Boolean + + +ITEM_CLASSES = { + 'RangedInteger': RangedInteger, + 'Integer': Integer, + 'Boolean': Boolean, +} + +if getattr(sys, 'frozen', False): + APP_PATH = sys._MEIPASS +else: + APP_PATH = os.path.dirname(os.path.abspath(__file__)) class Game(Enum): @@ -22,12 +32,32 @@ class Game(Enum): NEXUS = "Ratchet and Clank : Into the Nexus" def get_items(self): - if self == Game.RAC: return get_rac_items() - if self == Game.GC: return get_gc_items() - if self == Game.UYA: return get_uya_items() - if self == Game.DL: return get_dl_items() - if self == Game.TOD: return get_tod_items() - if self == Game.QFB: return get_qfb_items() - if self == Game.ACIT: return get_acit_items() - if self == Game.NEXUS: return get_nexus_items() - return dict() + return get_game_items(self) + + +def get_game_file(game: Game): + game_filename = '{0}.json'.format(str(game.name).lower()) + possible_game_folder = os.path.join(APP_PATH, 'game') + if os.path.exists(possible_game_folder) and os.path.isdir(possible_game_folder): + possible_filename = os.path.join(possible_game_folder, game_filename) + if os.path.exists(possible_filename): + with open(possible_filename, 'r') as f: + return f.read() + + return pkgutil.get_data('slimseditor.game', game_filename).decode('utf-8') + + +def get_game_items(game: Game): + json_data = get_game_file(game) + parsed_data = json.loads(json_data) + items = dict() + for key, value in parsed_data.items(): + item_list = [] + for item in value: + copied_item = item + item_type = copied_item.pop('type') + item_list.append(ITEM_CLASSES[item_type](**copied_item)) + + items[key] = item_list + + return items diff --git a/slimseditor/game/acit.json b/slimseditor/game/acit.json new file mode 100644 index 0000000..28c8b43 --- /dev/null +++ b/slimseditor/game/acit.json @@ -0,0 +1,3 @@ +{ + "Bolt counts": [] +} \ No newline at end of file diff --git a/slimseditor/game/acit.py b/slimseditor/game/acit.py deleted file mode 100644 index ad49dfe..0000000 --- a/slimseditor/game/acit.py +++ /dev/null @@ -1,10 +0,0 @@ -from slimseditor.reloadmagic import autoreload -from slimseditor.saveentry import Boolean, Integer - - -@autoreload -def get_acit_items(): - return { - "Bolt counts": [ - ], - } diff --git a/slimseditor/game/dl.json b/slimseditor/game/dl.json new file mode 100644 index 0000000..28c8b43 --- /dev/null +++ b/slimseditor/game/dl.json @@ -0,0 +1,3 @@ +{ + "Bolt counts": [] +} \ No newline at end of file diff --git a/slimseditor/game/dl.py b/slimseditor/game/dl.py deleted file mode 100644 index 954c5a2..0000000 --- a/slimseditor/game/dl.py +++ /dev/null @@ -1,10 +0,0 @@ -from slimseditor.reloadmagic import autoreload -from slimseditor.saveentry import Boolean, Integer - - -@autoreload -def get_dl_items(): - return { - "Bolt counts": [ - ], - } diff --git a/slimseditor/game/gc.json b/slimseditor/game/gc.json new file mode 100644 index 0000000..8438538 --- /dev/null +++ b/slimseditor/game/gc.json @@ -0,0 +1,361 @@ +{ + "Bolt counts": [ + { + "name": "Number of Bolts", + "pos": 36, + "type": "Integer" + }, + { + "name": "Number of Raritanium", + "pos": 40, + "type": "Integer" + }, + { + "name": "Total Bolts Collected", + "pos": 72, + "type": "Integer" + } + ], + "Item Unlocks": [ + { + "name": "Heli-Pack", + "pos": 658, + "type": "Boolean" + }, + { + "name": "Thruster-Pack", + "pos": 659, + "type": "Boolean" + }, + { + "name": "Hydro-Pack", + "pos": 660, + "type": "Boolean" + }, + { + "name": "Mapper", + "pos": 661, + "type": "Boolean" + }, + { + "name": "Levitator", + "pos": 664, + "type": "Boolean" + }, + { + "name": "Swingshot", + "pos": 669, + "type": "Boolean" + }, + { + "name": "Gravity Boots", + "pos": 675, + "type": "Boolean" + }, + { + "name": "Grindboots", + "pos": 676, + "type": "Boolean" + }, + { + "name": "Glider", + "pos": 677, + "type": "Boolean" + }, + { + "name": "Dynamo", + "pos": 692, + "type": "Boolean" + }, + { + "name": "Electrolyzer", + "pos": 694, + "type": "Boolean" + }, + { + "name": "Thermanator", + "pos": 695, + "type": "Boolean" + }, + { + "name": "Tractor Beam", + "pos": 702, + "type": "Boolean" + }, + { + "name": "Biker Helmet", + "pos": 704, + "type": "Boolean" + }, + { + "name": "Quark Statuette", + "pos": 705, + "type": "Boolean" + }, + { + "name": "Box Breaker", + "pos": 706, + "type": "Boolean" + }, + { + "name": "Infiltrator", + "pos": 708, + "type": "Boolean" + }, + { + "name": "Charge Boots", + "pos": 710, + "type": "Boolean" + }, + { + "name": "Hypnomatic", + "pos": 711, + "type": "Boolean" + } + ], + "Weapon Ammo": [ + { + "name": "Clank Zapper", + "max": 30, + "pos": 456, + "type": "RangedInteger" + }, + { + "name": "Bomb Glove", + "max": 40, + "pos": 456, + "type": "RangedInteger" + }, + { + "name": "Visibomb Gun", + "max": 20, + "pos": 472, + "type": "RangedInteger" + }, + { + "name": "Decoy Glove", + "max": 20, + "pos": 488, + "type": "RangedInteger" + }, + { + "name": "Tesla Claw", + "max": 300, + "pos": 496, + "type": "RangedInteger" + }, + { + "name": "Chopper", + "max": 35, + "pos": 512, + "type": "RangedInteger" + }, + { + "name": "Pulse Rifle", + "max": 8, + "pos": 516, + "type": "RangedInteger" + }, + { + "name": "Seeker Gun", + "max": 25, + "pos": 520, + "type": "RangedInteger" + }, + { + "name": "Hoverbomb Gun", + "max": 10, + "pos": 524, + "type": "RangedInteger" + }, + { + "name": "Blitz Gun", + "max": 40, + "pos": 528, + "type": "RangedInteger" + }, + { + "name": "Minirocket Tube", + "max": 25, + "pos": 532, + "type": "RangedInteger" + }, + { + "name": "Plasma Coil", + "max": 15, + "pos": 536, + "type": "RangedInteger" + }, + { + "name": "Lava Gun", + "max": 200, + "pos": 540, + "type": "RangedInteger" + }, + { + "name": "Lancer", + "max": 200, + "pos": 544, + "type": "RangedInteger" + }, + { + "name": "Synthenoid", + "max": 12, + "pos": 548, + "type": "RangedInteger" + }, + { + "name": "Spiderbot Glove", + "max": 8, + "pos": 552, + "type": "RangedInteger" + }, + { + "name": "Bouncer", + "max": 25, + "pos": 572, + "type": "RangedInteger" + }, + { + "name": "Miniturret Glove", + "max": 20, + "pos": 588, + "type": "RangedInteger" + }, + { + "name": "Zodiac", + "max": 4, + "pos": 596, + "type": "RangedInteger" + }, + { + "name": "RYNO II", + "max": 100, + "pos": 600, + "type": "RangedInteger" + }, + { + "name": "Shield Charger", + "max": 5, + "pos": 604, + "type": "RangedInteger" + } + ], + "Weapon Unlocks": [ + { + "name": "Clank Zapper", + "pos": 665, + "type": "Boolean" + }, + { + "name": "Bomb Glove", + "pos": 668, + "type": "Boolean" + }, + { + "name": "Visibomb Gun", + "pos": 670, + "type": "Boolean" + }, + { + "name": "Sheepinator", + "pos": 672, + "type": "Boolean" + }, + { + "name": "Decoy Glove", + "pos": 673, + "type": "Boolean" + }, + { + "name": "Tesla Claw", + "pos": 674, + "type": "Boolean" + }, + { + "name": "Chopper", + "pos": 677, + "type": "Boolean" + }, + { + "name": "Pulse Rifle", + "pos": 679, + "type": "Boolean" + }, + { + "name": "Seeker Gun", + "pos": 680, + "type": "Boolean" + }, + { + "name": "Hoverbomb Gun", + "pos": 681, + "type": "Boolean" + }, + { + "name": "Blitz Gun", + "pos": 682, + "type": "Boolean" + }, + { + "name": "Minirocket Tube", + "pos": 683, + "type": "Boolean" + }, + { + "name": "Plasma Coil", + "pos": 684, + "type": "Boolean" + }, + { + "name": "Lava Gun", + "pos": 685, + "type": "Boolean" + }, + { + "name": "Lancer", + "pos": 686, + "type": "Boolean" + }, + { + "name": "Synthenoid", + "pos": 687, + "type": "Boolean" + }, + { + "name": "Spiderbot Glove", + "pos": 688, + "type": "Boolean" + }, + { + "name": "Bouncer", + "pos": 693, + "type": "Boolean" + }, + { + "name": "Miniturret Glove", + "pos": 697, + "type": "Boolean" + }, + { + "name": "Zodiac", + "pos": 699, + "type": "Boolean" + }, + { + "name": "RYNO II", + "pos": 700, + "type": "Boolean" + }, + { + "name": "Shield Charger", + "pos": 701, + "type": "Boolean" + }, + { + "name": "Walloper", + "pos": 709, + "type": "Boolean" + } + ] +} diff --git a/slimseditor/game/gc.py b/slimseditor/game/gc.py deleted file mode 100644 index 0a77254..0000000 --- a/slimseditor/game/gc.py +++ /dev/null @@ -1,83 +0,0 @@ -from slimseditor.reloadmagic import autoreload -from slimseditor.saveentry import Boolean, Integer, RangedInteger - - -@autoreload -def get_gc_items(): - return { - "Bolt counts": [ - Integer("Number of Bolts", 0x24), - Integer("Number of Raritanium", 0x28), - Integer("Total Bolts Collected", 0x48), - ], - "Item Unlocks": [ - Boolean("Heli-Pack", 0x292), - Boolean("Thruster-Pack", 0x293), - Boolean("Hydro-Pack", 0x294), - Boolean("Mapper", 0x295), - Boolean("Levitator", 0x298), - Boolean("Swingshot", 0x29d), - Boolean("Gravity Boots", 0x2a3), - Boolean("Grindboots", 0x2a4), - Boolean("Glider", 0x2a5), - Boolean("Dynamo", 0x2b4), - Boolean("Electrolyzer", 0x2b6), - Boolean("Thermanator", 0x2b7), - Boolean("Tractor Beam", 0x2be), - Boolean("Biker Helmet", 0x2c0), - Boolean("Quark Statuette", 0x2c1), - Boolean("Box Breaker", 0x2c2), - Boolean("Infiltrator", 0x2c4), - Boolean("Charge Boots", 0x2c6), - Boolean("Hypnomatic", 0x2c7), - ], - "Weapon Ammo": [ - RangedInteger("Clank Zapper", 0x1c8, 30), - RangedInteger("Bomb Glove", 0x1c8, 40), - RangedInteger("Visibomb Gun", 0x1d8, 20), - RangedInteger("Decoy Glove", 0x1e8, 20), - RangedInteger("Tesla Claw", 0x1f0, 300), - RangedInteger("Chopper", 0x200, 35), - RangedInteger("Pulse Rifle", 0x204, 8), - RangedInteger("Seeker Gun", 0x208, 25), - RangedInteger("Hoverbomb Gun", 0x20c, 10), - RangedInteger("Blitz Gun", 0x210, 40), - RangedInteger("Minirocket Tube", 0x214, 25), - RangedInteger("Plasma Coil", 0x218, 15), - RangedInteger("Lava Gun", 0x21c, 200), - RangedInteger("Lancer", 0x220, 200), - RangedInteger("Synthenoid", 0x224, 12), - RangedInteger("Spiderbot Glove", 0x228, 8), - RangedInteger("Bouncer", 0x23c, 25), - RangedInteger("Miniturret Glove", 0x24c, 20), - RangedInteger("Zodiac", 0x254, 4), - RangedInteger("RYNO II", 0x258, 100), - RangedInteger("Shield Charger", 0x25c, 5), - ], - "Weapon Unlocks": [ - Boolean("Clank Zapper", 0x299), - Boolean("Bomb Glove", 0x29c), - Boolean("Visibomb Gun", 0x29e), - Boolean("Sheepinator", 0x2a0), - Boolean("Decoy Glove", 0x2a1), - Boolean("Tesla Claw", 0x2a2), - Boolean("Chopper", 0x2a5), - Boolean("Pulse Rifle", 0x2a7), - Boolean("Seeker Gun", 0x2a8), - Boolean("Hoverbomb Gun", 0x2a9), - Boolean("Blitz Gun", 0x2aa), - Boolean("Minirocket Tube", 0x2ab), - Boolean("Plasma Coil", 0x2ac), - Boolean("Lava Gun", 0x2ad), - Boolean("Lancer", 0x2ae), - Boolean("Synthenoid", 0x2af), - Boolean("Spiderbot Glove", 0x2b0), - Boolean("Bouncer", 0x2b5), - Boolean("Miniturret Glove", 0x2b9), - Boolean("Zodiac", 0x2bb), - Boolean("RYNO II", 0x2bc), - Boolean("Shield Charger", 0x2bd), - Boolean("Walloper", 0x2c5), - ], - } - diff --git a/slimseditor/game/nexus.json b/slimseditor/game/nexus.json new file mode 100644 index 0000000..f1b4448 --- /dev/null +++ b/slimseditor/game/nexus.json @@ -0,0 +1,14 @@ +{ + "Bolt counts": [ + { + "name": "Number of Bolts", + "pos": 4188, + "type": "Integer" + }, + { + "name": "Number of Raritanium", + "pos": 4192, + "type": "Integer" + } + ] +} \ No newline at end of file diff --git a/slimseditor/game/nexus.py b/slimseditor/game/nexus.py deleted file mode 100644 index c80521f..0000000 --- a/slimseditor/game/nexus.py +++ /dev/null @@ -1,12 +0,0 @@ -from slimseditor.reloadmagic import autoreload -from slimseditor.saveentry import Boolean, Integer - - -@autoreload -def get_nexus_items(): - return { - "Bolt counts": [ - Integer("Number of Bolts", 0x105c), - Integer("Number of Raritanium", 0x1060), - ], - } diff --git a/slimseditor/game/qfb.json b/slimseditor/game/qfb.json new file mode 100644 index 0000000..41c562c --- /dev/null +++ b/slimseditor/game/qfb.json @@ -0,0 +1,9 @@ +{ + "Bolt counts": [ + { + "name": "Number of Bolts", + "pos": 583, + "type": "Integer" + } + ] +} \ No newline at end of file diff --git a/slimseditor/game/qfb.py b/slimseditor/game/qfb.py deleted file mode 100644 index 61c4425..0000000 --- a/slimseditor/game/qfb.py +++ /dev/null @@ -1,11 +0,0 @@ -from slimseditor.reloadmagic import autoreload -from slimseditor.saveentry import Boolean, Integer - - -@autoreload -def get_qfb_items(): - return { - "Bolt counts": [ - Integer("Number of Bolts", 0x247), - ], - } diff --git a/slimseditor/game/rac.json b/slimseditor/game/rac.json new file mode 100644 index 0000000..1c99e2c --- /dev/null +++ b/slimseditor/game/rac.json @@ -0,0 +1,295 @@ +{ + "Bolt counts": [ + { + "name": "Number of Bolts", + "pos": 36, + "type": "Integer" + }, + { + "name": "Total Bolts Collected", + "pos": 72, + "type": "Integer" + } + ], + "Gadget unlocks": [ + { + "name": "Trespasser", + "pos": 466, + "type": "Boolean" + }, + { + "name": "Hydrodisplacer", + "pos": 462, + "type": "Boolean" + }, + { + "name": "Swingshot", + "pos": 452, + "type": "Boolean" + }, + { + "name": "Gadgetron PDA", + "pos": 472, + "type": "Boolean" + }, + { + "name": "Metal Detector", + "pos": 467, + "type": "Boolean" + }, + { + "name": "Hologuise", + "pos": 471, + "type": "Boolean" + }, + { + "name": "Heli-Pack", + "pos": 442, + "type": "Boolean" + }, + { + "name": "Thruster-Pack", + "pos": 443, + "type": "Boolean" + }, + { + "name": "Hydro-Pack", + "pos": 444, + "type": "Boolean" + }, + { + "name": "O2 Mask", + "pos": 446, + "type": "Boolean" + }, + { + "name": "Sonic Summoner", + "pos": 445, + "type": "Boolean" + }, + { + "name": "Pilot's Helmet", + "pos": 447, + "type": "Boolean" + }, + { + "name": "Grindboots", + "pos": 469, + "type": "Boolean" + }, + { + "name": "Magneboots", + "pos": 468, + "type": "Boolean" + } + ], + "Item unlocks": [ + { + "name": "Hoverboard", + "pos": 470, + "type": "Boolean" + }, + { + "name": "Persuader", + "pos": 475, + "type": "Boolean" + }, + { + "name": "Bolt Grabber", + "pos": 474, + "type": "Boolean" + }, + { + "name": "Map-o-matic", + "pos": 473, + "type": "Boolean" + } + ], + "Quick Select": [ + { + "name": "Slot 1", + "pos": 556, + "type": "Integer" + }, + { + "name": "Slot 2", + "pos": 560, + "type": "Integer" + }, + { + "name": "Slot 3", + "pos": 564, + "type": "Integer" + }, + { + "name": "Slot 4", + "pos": 568, + "type": "Integer" + }, + { + "name": "Slot 5", + "pos": 572, + "type": "Integer" + }, + { + "name": "Slot 6", + "pos": 576, + "type": "Integer" + }, + { + "name": "Slot 7", + "pos": 580, + "type": "Integer" + }, + { + "name": "Slot 8", + "pos": 584, + "type": "Integer" + } + ], + "Weapon Ammo": [ + { + "name": "Bomb Glove", + "max": 40, + "pos": 324, + "type": "RangedInteger" + }, + { + "name": "Blaster", + "max": 200, + "pos": 344, + "type": "RangedInteger" + }, + { + "name": "Visibomb", + "max": 20, + "pos": 336, + "type": "RangedInteger" + }, + { + "name": "Devastator", + "max": 20, + "pos": 328, + "type": "RangedInteger" + }, + { + "name": "Gold Glove of Doom", + "max": 10, + "pos": 364, + "type": "RangedInteger" + }, + { + "name": "R.Y.N.O.", + "max": 50, + "pos": 376, + "type": "RangedInteger" + }, + { + "name": "Drone", + "max": 10, + "pos": 380, + "type": "RangedInteger" + }, + { + "name": "Pyrociter", + "max": 240, + "pos": 348, + "type": "RangedInteger" + }, + { + "name": "Mine Glove", + "max": 50, + "pos": 352, + "type": "RangedInteger" + }, + { + "name": "Tesla Claw", + "max": 240, + "pos": 360, + "type": "RangedInteger" + }, + { + "name": "Decoy Glove", + "max": 20, + "pos": 384, + "type": "RangedInteger" + } + ], + "Weapon Unlocks": [ + { + "name": "Bomb Glove", + "pos": 450, + "type": "Boolean" + }, + { + "name": "Pyrocitor", + "pos": 456, + "type": "Boolean" + }, + { + "name": "Blaster", + "pos": 455, + "type": "Boolean" + }, + { + "name": "Glove of Doom", + "pos": 460, + "type": "Boolean" + }, + { + "name": "Mine Glove", + "pos": 457, + "type": "Boolean" + }, + { + "name": "Taunter", + "pos": 454, + "type": "Boolean" + }, + { + "name": "Suck Cannon", + "pos": 449, + "type": "Boolean" + }, + { + "name": "Devastator", + "pos": 451, + "type": "Boolean" + }, + { + "name": "Walloper", + "pos": 458, + "type": "Boolean" + }, + { + "name": "Visibomb Gun", + "pos": 453, + "type": "Boolean" + }, + { + "name": "Decoy Glove", + "pos": 465, + "type": "Boolean" + }, + { + "name": "Drone Device", + "pos": 464, + "type": "Boolean" + }, + { + "name": "Tesla Claw", + "pos": 459, + "type": "Boolean" + }, + { + "name": "Morph-o-ray", + "pos": 461, + "type": "Boolean" + }, + { + "name": "R.Y.N.O.", + "pos": 463, + "type": "Boolean" + } + ] +} diff --git a/slimseditor/game/rac.py b/slimseditor/game/rac.py deleted file mode 100644 index 06dc066..0000000 --- a/slimseditor/game/rac.py +++ /dev/null @@ -1,77 +0,0 @@ -from slimseditor.reloadmagic import autoreload -from slimseditor.saveentry import RangedInteger, Boolean, Integer - - -@autoreload -def get_rac_items(): - return { - "Weapon Ammo": [ - RangedInteger("Bomb Glove", 0x144, 40), - RangedInteger("Blaster", 0x158, 200), - RangedInteger("Visibomb", 0x150, 20), - RangedInteger("Devastator", 0x148, 20), - RangedInteger("Gold Glove of Doom", 0x16c, 10), - RangedInteger("R.Y.N.O.", 0x178, 50), - RangedInteger("Drone", 0x17c, 10), - RangedInteger("Pyrociter", 0x15c, 240), - RangedInteger("Mine Glove", 0x160, 50), - RangedInteger("Tesla Claw", 0x168, 240), - RangedInteger("Decoy Glove", 0x180, 20), - ], - "Weapon Unlocks": [ - Boolean("Bomb Glove", 0x1c2), - Boolean("Pyrocitor", 0x1c8), - Boolean("Blaster", 0x1c7), - Boolean("Glove of Doom", 0x1cc), - Boolean("Mine Glove", 0x1c9), - Boolean("Taunter", 0x1c6), - Boolean("Suck Cannon", 0x1c1), - Boolean("Devastator", 0x1c3), - Boolean("Walloper", 0x1ca), - Boolean("Visibomb Gun", 0x1c5), - Boolean("Decoy Glove", 0x1d1), - Boolean("Drone Device", 0x1d0), - Boolean("Tesla Claw", 0x1cb), - Boolean("Morph-o-ray", 0x1cd), - Boolean("R.Y.N.O.", 0x1cf), - ], - "Gadget unlocks": [ - Boolean("Trespasser", 0x1d2), - Boolean("Hydrodisplacer", 0x1ce), - Boolean("Swingshot", 0x1c4), - Boolean("Gadgetron PDA", 0x1d8), - Boolean("Metal Detector", 0x1d3), - Boolean("Hologuise", 0x1d7), - - Boolean("Heli-Pack", 0x1ba), - Boolean("Thruster-Pack", 0x1bb), - Boolean("Hydro-Pack", 0x1bc), - - Boolean("O2 Mask", 0x1be), - Boolean("Sonic Summoner", 0x1bd), - Boolean("Pilot's Helmet", 0x1bf), - - Boolean("Grindboots", 0x1d5), - Boolean("Magneboots", 0x1d4), - ], - "Item unlocks": [ - Boolean("Hoverboard", 0x1d6), - Boolean("Persuader", 0x1db), - Boolean("Bolt Grabber", 0x1da), - Boolean("Map-o-matic", 0x1d9), - ], - "Bolt counts": [ - Integer("Number of Bolts", 0x24), - Integer("Total Bolts Collected", 0x48), - ], - "Quick Select": [ - Integer("Slot 1", 0x22c), - Integer("Slot 2", 0x230), - Integer("Slot 3", 0x234), - Integer("Slot 4", 0x238), - Integer("Slot 5", 0x23c), - Integer("Slot 6", 0x240), - Integer("Slot 7", 0x244), - Integer("Slot 8", 0x248), - ] - } diff --git a/slimseditor/game/tod.json b/slimseditor/game/tod.json new file mode 100644 index 0000000..92f2cf7 --- /dev/null +++ b/slimseditor/game/tod.json @@ -0,0 +1,14 @@ +{ + "Bolt counts": [ + { + "name": "Number of Bolts", + "pos": 1052, + "type": "Integer" + }, + { + "name": "Number of Raritanium", + "pos": 1056, + "type": "Integer" + } + ] +} \ No newline at end of file diff --git a/slimseditor/game/tod.py b/slimseditor/game/tod.py deleted file mode 100644 index 5fd1d45..0000000 --- a/slimseditor/game/tod.py +++ /dev/null @@ -1,12 +0,0 @@ -from slimseditor.reloadmagic import autoreload -from slimseditor.saveentry import Boolean, Integer - - -@autoreload -def get_tod_items(): - return { - "Bolt counts": [ - Integer("Number of Bolts", 0x41c), - Integer("Number of Raritanium", 0x420), - ], - } diff --git a/slimseditor/game/uya.json b/slimseditor/game/uya.json new file mode 100644 index 0000000..eaa88a8 --- /dev/null +++ b/slimseditor/game/uya.json @@ -0,0 +1,369 @@ +{ + "Bolt counts": [ + { + "name": "Number of Bolts", + "pos": 36, + "type": "Integer" + } + ], + "Item Unlocks": [ + { + "name": "Heli Pack", + "pos": 1194, + "type": "Boolean" + }, + { + "name": "Thruster Pack", + "pos": 1195, + "type": "Boolean" + }, + { + "name": "Hydro Pack", + "pos": 1196, + "type": "Boolean" + }, + { + "name": "Map-o-matic", + "pos": 1197, + "type": "Boolean" + }, + { + "name": "Commando Suit", + "pos": 1198, + "type": "Boolean" + }, + { + "name": "Bolt Grabber v2", + "pos": 1199, + "type": "Boolean" + }, + { + "name": "Levitator", + "pos": 1200, + "type": "Boolean" + }, + { + "name": "Omniwrench", + "pos": 1201, + "type": "Boolean" + }, + { + "name": "Hypershot", + "pos": 1203, + "type": "Boolean" + }, + { + "name": "Gravity Boots", + "pos": 1205, + "type": "Boolean" + }, + { + "name": "Plasma Coil", + "pos": 1208, + "type": "Boolean" + }, + { + "name": "Lava Gun", + "pos": 1209, + "type": "Boolean" + }, + { + "name": "Refractor", + "pos": 1210, + "type": "Boolean" + }, + { + "name": "Bouncer", + "pos": 1211, + "type": "Boolean" + }, + { + "name": "The Hacker", + "pos": 1212, + "type": "Boolean" + }, + { + "name": "Miniturret", + "pos": 1213, + "type": "Boolean" + }, + { + "name": "Shield Charger", + "pos": 1214, + "type": "Boolean" + }, + { + "name": "Charge Boots", + "pos": 1221, + "type": "Boolean" + }, + { + "name": "Thyrra Guise", + "pos": 1222, + "type": "Boolean" + }, + { + "name": "Warp Pad", + "pos": 1223, + "type": "Boolean" + }, + { + "name": "Nano Pak", + "pos": 1224, + "type": "Boolean" + }, + { + "name": "Star Map", + "pos": 1226, + "type": "Boolean" + }, + { + "name": "Master Plan", + "pos": 1227, + "type": "Boolean" + }, + { + "name": "PDA", + "pos": 1228, + "type": "Boolean" + }, + { + "name": "Third Person Mode", + "pos": 1228, + "type": "Boolean" + }, + { + "name": "First Person Mode", + "pos": 1229, + "type": "Boolean" + }, + { + "name": "Lock-Strafe Mode", + "pos": 1230, + "type": "Boolean" + } + ], + "Misc": [ + { + "name": "Enable Quick Select Pause", + "pos": 11302, + "type": "Boolean" + } + ], + "Weapon Ammo": [ + { + "name": "Shock Blaster", + "pos": 716, + "type": "Integer" + }, + { + "name": "N60 Storm", + "pos": 748, + "type": "Integer" + }, + { + "name": "Infector", + "pos": 780, + "type": "Integer" + }, + { + "name": "Annihilator", + "pos": 812, + "type": "Integer" + }, + { + "name": "Spitting Hydra", + "pos": 844, + "type": "Integer" + }, + { + "name": "Disc Blade Gun", + "pos": 876, + "type": "Integer" + }, + { + "name": "Agents of Doom", + "pos": 908, + "type": "Integer" + }, + { + "name": "Rift Inducer", + "pos": 940, + "type": "Integer" + }, + { + "name": "Holoshield", + "pos": 972, + "type": "Integer" + }, + { + "name": "Flux Rifle", + "pos": 1004, + "type": "Integer" + }, + { + "name": "Nitro Launcher", + "pos": 1036, + "type": "Integer" + }, + { + "name": "Plasma Whip", + "pos": 1068, + "type": "Integer" + }, + { + "name": "Quack-O-Ray", + "pos": 1132, + "type": "Integer" + }, + { + "name": "R3YNO", + "pos": 1164, + "type": "Integer" + } + ], + "Weapon EXP": [ + { + "name": "Shock Blaster", + "pos": 1676, + "type": "Integer" + }, + { + "name": "N60 Storm", + "pos": 1708, + "type": "Integer" + }, + { + "name": "Infector", + "pos": 1740, + "type": "Integer" + }, + { + "name": "Annihilator", + "pos": 1772, + "type": "Integer" + }, + { + "name": "Spitting Hydra", + "pos": 1804, + "type": "Integer" + }, + { + "name": "Disc Blade Gun", + "pos": 1836, + "type": "Integer" + }, + { + "name": "Agents of Doom", + "pos": 1868, + "type": "Integer" + }, + { + "name": "Rift Inducer", + "pos": 1900, + "type": "Integer" + }, + { + "name": "Holoshield", + "pos": 1932, + "type": "Integer" + }, + { + "name": "Flux Rifle", + "pos": 1964, + "type": "Integer" + }, + { + "name": "Nitro Launcher", + "pos": 1996, + "type": "Integer" + }, + { + "name": "Plasma Whip", + "pos": 2028, + "type": "Integer" + }, + { + "name": "Quack-O-Ray", + "pos": 2060, + "type": "Integer" + }, + { + "name": "R3YNO", + "pos": 2124, + "type": "Integer" + } + ], + "Weapon Unlocks": [ + { + "name": "Shock Blaster V1", + "pos": 1231, + "type": "Boolean" + }, + { + "name": "N60 Storm V1", + "pos": 1239, + "type": "Boolean" + }, + { + "name": "Infector V1", + "pos": 1247, + "type": "Boolean" + }, + { + "name": "Annihilator V1", + "pos": 1255, + "type": "Boolean" + }, + { + "name": "Spitting Hydra V1", + "pos": 1263, + "type": "Boolean" + }, + { + "name": "Disc Blade Gun V1", + "pos": 1271, + "type": "Boolean" + }, + { + "name": "Agents of Doom V1", + "pos": 1279, + "type": "Boolean" + }, + { + "name": "Rift Inducer V1", + "pos": 1287, + "type": "Boolean" + }, + { + "name": "Holoshield V1", + "pos": 1295, + "type": "Boolean" + }, + { + "name": "Flux Rifle V1", + "pos": 1303, + "type": "Boolean" + }, + { + "name": "Nitro Launcher V1", + "pos": 1311, + "type": "Boolean" + }, + { + "name": "Plasma Whip V1", + "pos": 1319, + "type": "Boolean" + }, + { + "name": "Quack-O-Ray V1", + "pos": 1327, + "type": "Boolean" + }, + { + "name": "R3YNO V1", + "pos": 1343, + "type": "Boolean" + } + ] +} \ No newline at end of file diff --git a/slimseditor/game/uya.py b/slimseditor/game/uya.py deleted file mode 100644 index aa2242e..0000000 --- a/slimseditor/game/uya.py +++ /dev/null @@ -1,92 +0,0 @@ -from slimseditor.reloadmagic import autoreload -from slimseditor.saveentry import Boolean, Integer - - -@autoreload -def get_uya_items(): - return { - "Bolt counts": [ - Integer("Number of Bolts", 0x24), - ], - "Item Unlocks": [ - Boolean("Heli Pack", 0x4aa), - Boolean("Thruster Pack", 0x4ab), - Boolean("Hydro Pack", 0x4ac), - Boolean("Map-o-matic", 0x4ad), - Boolean("Commando Suit", 0x4ae), - Boolean("Bolt Grabber v2", 0x4af), - Boolean("Levitator", 0x4b0), - Boolean("Omniwrench", 0x4b1), - Boolean("Hypershot", 0x4b3), - Boolean("Gravity Boots", 0x4b5), - Boolean("Plasma Coil", 0x4b8), - Boolean("Lava Gun", 0x4b9), - Boolean("Refractor", 0x4ba), - Boolean("Bouncer", 0x4bb), - Boolean("The Hacker", 0x4bc), - Boolean("Miniturret", 0x4bd), - Boolean("Shield Charger", 0x4be), - Boolean("Charge Boots", 0x4c5), - Boolean("Thyrra Guise", 0x4c6), - Boolean("Warp Pad", 0x4c7), - Boolean("Nano Pak", 0x4c8), - Boolean("Star Map", 0x4ca), - Boolean("Master Plan", 0x4cb), - Boolean("PDA", 0x4cc), - Boolean("Third Person Mode", 0x4cc), - Boolean("First Person Mode", 0x4cd), - Boolean("Lock-Strafe Mode", 0x4ce), - ], - "Weapon Ammo": [ - Integer("Shock Blaster", 0x2cc), - Integer("N60 Storm", 0x2ec), - Integer("Infector", 0x30c), - Integer("Annihilator", 0x32c), - Integer("Spitting Hydra", 0x34c), - Integer("Disc Blade Gun", 0x36c), - Integer("Agents of Doom", 0x38c), - Integer("Rift Inducer", 0x3ac), - Integer("Holoshield", 0x3cc), - Integer("Flux Rifle", 0x3ec), - Integer("Nitro Launcher", 0x40c), - Integer("Plasma Whip", 0x42c), - Integer("Quack-O-Ray", 0x46c), - Integer("R3YNO", 0x48c), - ], - "Weapon EXP": [ - Integer("Shock Blaster", 0x68c), - Integer("N60 Storm", 0x6ac), - Integer("Infector", 0x6cc), - Integer("Annihilator", 0x6ec), - Integer("Spitting Hydra", 0x70c), - Integer("Disc Blade Gun", 0x72c), - Integer("Agents of Doom", 0x74c), - Integer("Rift Inducer", 0x76c), - Integer("Holoshield", 0x78c), - Integer("Flux Rifle", 0x7ac), - Integer("Nitro Launcher", 0x7cc), - Integer("Plasma Whip", 0x7ec), - Integer("Quack-O-Ray", 0x80c), - Integer("R3YNO", 0x84c), - ], - "Weapon Unlocks": [ - Boolean("Shock Blaster V1", 0x4cf), - Boolean("N60 Storm V1", 0x4d7), - Boolean("Infector V1", 0x4df), - Boolean("Annihilator V1", 0x4e7), - Boolean("Spitting Hydra V1", 0x4ef), - Boolean("Disc Blade Gun V1", 0x4f7), - Boolean("Agents of Doom V1", 0x4ff), - Boolean("Rift Inducer V1", 0x507), - Boolean("Holoshield V1", 0x50f), - Boolean("Flux Rifle V1", 0x517), - Boolean("Nitro Launcher V1", 0x51f), - Boolean("Plasma Whip V1", 0x527), - Boolean("Quack-O-Ray V1", 0x52f), - Boolean("R3YNO V1", 0x53f), - ], - "Misc": [ - Boolean("Enable Quick Select Pause", 0x2c26), - ], - } - diff --git a/slimseditor/saveentry.py b/slimseditor/saveentry.py index 6cb7758..156c179 100644 --- a/slimseditor/saveentry.py +++ b/slimseditor/saveentry.py @@ -6,7 +6,7 @@ class AbstractSaveEntry: python_type = int bimpy_type = bimpy.Int - def __init__(self, name, pos): + def __init__(self, name='', pos=0): self.name = name self.pos = pos self.bimpy_name = '{0}##{1}'.format(name, pos) @@ -31,8 +31,8 @@ class RangedInteger(AbstractSaveEntry): python_type = int bimpy_type = bimpy.Int - def __init__(self, name, pos, max=100, min=0): - super(RangedInteger, self).__init__(name, pos) + def __init__(self, name='', pos=0, max=100, min=0): + super(RangedInteger, self).__init__(name=name, pos=pos) self.min = min self.max = max diff --git a/win.spec b/win.spec index a39173b..5eeac74 100644 --- a/win.spec +++ b/win.spec @@ -6,7 +6,7 @@ block_cipher = None a = Analysis(['slimseditor\\win.pyw'], pathex=['C:\\Users\\Johannes\\source\\repos\\slimseditor'], binaries=[], - datas=[], + datas=[('slimseditor/game/*.json', 'slimseditor/game')], hiddenimports=[], hookspath=[], runtime_hooks=[],