From 687e1002c6541a942ac27049ea6d5eccd73e5a2d Mon Sep 17 00:00:00 2001 From: Chris Davoren Date: Sat, 1 Jul 2023 08:52:44 +1000 Subject: [PATCH] Fixed some ids and some packs. --- item_ids.txt | 10 +++++++--- pack_blocks.txt => pack_building.txt | 3 ++- pack_weapons_basic.txt | 1 + sheditor.py | 21 +++++++++++++-------- 4 files changed, 23 insertions(+), 12 deletions(-) rename pack_blocks.txt => pack_building.txt (72%) diff --git a/item_ids.txt b/item_ids.txt index e22743c..53d9346 100644 --- a/item_ids.txt +++ b/item_ids.txt @@ -656,10 +656,14 @@ 3025 Salvage Robot Station 3029 Station Hull Window red 3 with asteroid 3044 floor -3069 Laser Pistol -3070 Laser Rifle +3069 Laser Rifle +3070 Laser Pistol +3071 Plasma Clustergun +3072 Plasma Rifle 3366 Mild Alcohol 3378 Grains and Hops 3383 Bulletproof Vest 3384 Armored Vest -3419 Augmentation Parts \ No newline at end of file +3419 Augmentation Parts +3512 Unknown +3513 Unknown \ No newline at end of file diff --git a/pack_blocks.txt b/pack_building.txt similarity index 72% rename from pack_blocks.txt rename to pack_building.txt index c21125c..4a7f9aa 100644 --- a/pack_blocks.txt +++ b/pack_building.txt @@ -4,4 +4,5 @@ 930 40 # Techblocks 1919 40 # Energy block 1921 40 # Soft blocks -1922 20 # Steel plates \ No newline at end of file +1922 20 # Steel plates +175 20 # Plastics \ No newline at end of file diff --git a/pack_weapons_basic.txt b/pack_weapons_basic.txt index 488b4a5..1682639 100644 --- a/pack_weapons_basic.txt +++ b/pack_weapons_basic.txt @@ -1,3 +1,4 @@ # Basic weapons pack 760 10 # Five-seven pistols 725 10 # Assault rifles +3383 10 # Bulletproof vests \ No newline at end of file diff --git a/sheditor.py b/sheditor.py index 613ee21..59ef560 100644 --- a/sheditor.py +++ b/sheditor.py @@ -89,6 +89,7 @@ class StorageArea: def __init__(self, tag): self.tag = tag self.items = [] + self.is_abnormal_storage = False def add_item(self, item): self.items.append(item) @@ -179,9 +180,10 @@ class Ship: self.characters.append(character) def add_item(self, item): - min_storage_area = self.storage_areas[0] + normal_storage_areas = [sa for sa in self.storage_areas if not sa.is_abnormal_storage] + min_storage_area = normal_storage_areas[0] min_occupancy = min_storage_area.get_total_occupancy() - for storage_area in self.storage_areas: + for storage_area in normal_storage_areas: if storage_area.get_total_occupancy() < min_occupancy: min_storage_area = storage_area min_occupancy = min_storage_area.get_total_occupancy() @@ -231,6 +233,9 @@ class GameData: # Step 3 - Storage area data for inv_tag in ship_tag.find_all('feat', eatAllowed=True): storage_area = StorageArea(inv_tag.find('inv')) + # This is a GUESS + if inv_tag.find('env'): + storage_area.is_abnormal_storage = True ship.add_storage_area(storage_area) # Items within storage area for s_tag in inv_tag.find_all('s'): @@ -387,7 +392,7 @@ class GameData: print(" Storage area {} is empty.".format(index)) continue - print(" Storage area {}:".format(index)) + print(" Storage area {} (abnormal storage: {}):".format(index, storage_area.is_abnormal_storage)) for item in storage_area.items: print(" {:4}: {} - {}".format(item.code, item.name, item.quantity)) @@ -555,14 +560,14 @@ def parse_item_file(filename): def main(): parser = argparse.ArgumentParser(prog="Space Haven Saved Game Inspector", description="As above.") - parser.add_argument('filename') - parser.add_argument('--add_item', required=False, metavar='N', type=int, nargs=2, help="Add more of an existing item to storage by CODE - refer to accompanying data file reference for codes. First number is the code, second is the desired quantity.") + parser.add_argument('filename', metavar='SAVEGAME_GAME_FILE') + parser.add_argument('--add_item', required=False, metavar=('ITEM_CODE', 'ITEM_QUANTITY'), type=int, nargs=2, help="Add more of an existing item to storage by CODE - refer to accompanying data file reference for codes. First number is the code, second is the desired quantity.") parser.add_argument('--buff_chars', required=False, action='store_true', help="For all characters, increases all skills and attributes to maximum. Use wisely.") - parser.add_argument('--money', required=False, type=int, nargs=1, help="Give the player credits of the specified amount") + parser.add_argument('--money', required=False, type=int, nargs=1, metavar='AMOUNT', help="Give the player credits of the specified amount") parser.add_argument('--list_ships', required=False, action='store_true', help="List all ships with names and their respective owners") parser.add_argument('--test_gamedata', required=False, action='store_true', help="Test of new class-based system of storing game information") - parser.add_argument('--clone_character', required=False, type=str, nargs=2, help="Clones a character of one name into another") - parser.add_argument('--add_item_set', required=False, type=str, nargs=1, help="Takes a file containing a list of item codes and quantities (whitespace separated) and adds all of these to player storage") + parser.add_argument('--clone_character', required=False, type=str, nargs=2, metavar=('OLD_NAME', 'NEW_NAME'), help="Clones a character of one name into another") + parser.add_argument('--add_item_set', required=False, type=str, nargs=1, metavar='PACK_FILENAME', help="Takes a file containing a list of item codes and quantities (whitespace separated) and adds all of these to player storage") parser.add_argument('--detailed_items', required=False, action='store_true', help='Print a detailed item listing from player inventory') parser.add_argument('--detailed_chars', required=False, action='store_true', help='Print a comprehensive listing of player character details') parser.add_argument('--replace_original', required=False, action='store_true', help='Replace original file instead of creating edited alternative. Renames original for backup, but USE WITH CAUTION')