Fixed some ids and some packs.

This commit is contained in:
Chris Davoren 2023-07-01 08:52:44 +10:00
parent 4ff78961ed
commit 687e1002c6
4 changed files with 23 additions and 12 deletions

View File

@ -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
3419 Augmentation Parts
3512 Unknown
3513 Unknown

View File

@ -4,4 +4,5 @@
930 40 # Techblocks
1919 40 # Energy block
1921 40 # Soft blocks
1922 20 # Steel plates
1922 20 # Steel plates
175 20 # Plastics

View File

@ -1,3 +1,4 @@
# Basic weapons pack
760 10 # Five-seven pistols
725 10 # Assault rifles
3383 10 # Bulletproof vests

View File

@ -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')