From 4ff78961eded0be8c8e607edfccc782e06c0121a Mon Sep 17 00:00:00 2001 From: Chris Davoren Date: Sat, 1 Jul 2023 06:54:15 +1000 Subject: [PATCH] Packs added and some item codes updated. --- item_ids.txt | 5 +++++ pack_medical.txt | 3 +++ pack_trade.txt | 3 ++- pack_weapons_basic.txt | 3 +++ sheditor.py | 50 ++++++++++++++++++++++++------------------ 5 files changed, 42 insertions(+), 22 deletions(-) create mode 100644 pack_medical.txt create mode 100644 pack_weapons_basic.txt diff --git a/item_ids.txt b/item_ids.txt index 7da4f4d..e22743c 100644 --- a/item_ids.txt +++ b/item_ids.txt @@ -183,6 +183,7 @@ 981 Refinery Parts 982 Autopsy Table 984 Monster Meat +985 Human Meat 991 Suit Locker Parts 992 Suit Locker Parts 993 Suit Locker Parts @@ -655,6 +656,10 @@ 3025 Salvage Robot Station 3029 Station Hull Window red 3 with asteroid 3044 floor +3069 Laser Pistol +3070 Laser Rifle 3366 Mild Alcohol 3378 Grains and Hops +3383 Bulletproof Vest +3384 Armored Vest 3419 Augmentation Parts \ No newline at end of file diff --git a/pack_medical.txt b/pack_medical.txt new file mode 100644 index 0000000..a98f739 --- /dev/null +++ b/pack_medical.txt @@ -0,0 +1,3 @@ +# Medical supplies pack +2053 30 # Medical supplies +2058 30 # IV fluids \ No newline at end of file diff --git a/pack_trade.txt b/pack_trade.txt index 48db9bb..d0e0f32 100644 --- a/pack_trade.txt +++ b/pack_trade.txt @@ -3,4 +3,5 @@ 1924 20 # Optronics components 173 20 # Electronic components 3378 20 # Grains and hops -1920 20 # Superblocks \ No newline at end of file +1920 20 # Superblocks +3419 20 # Augmentation parts \ No newline at end of file diff --git a/pack_weapons_basic.txt b/pack_weapons_basic.txt new file mode 100644 index 0000000..488b4a5 --- /dev/null +++ b/pack_weapons_basic.txt @@ -0,0 +1,3 @@ +# Basic weapons pack +760 10 # Five-seven pistols +725 10 # Assault rifles diff --git a/sheditor.py b/sheditor.py index 96059c9..613ee21 100644 --- a/sheditor.py +++ b/sheditor.py @@ -591,20 +591,26 @@ def main(): game_data = GameData(soup, item_code_database) game_data.populate() + edits_made = False + if args.buff_chars: game_data.buff_characters() + edits_made = True if args.add_item: game_data.add_item(args.add_item[0], args.add_item[1]) + edits_made = True if args.money: game_data.add_currency(args.money[0]) + edits_made = True if args.list_ships: game_data.print_summary() if args.clone_character: game_data.clone_character(args.clone_character[0], args.clone_character[1]) + edits_made = True if args.add_item_set: item_list = parse_item_file(args.add_item_set[0]) @@ -613,6 +619,7 @@ def main(): for (item_code, item_quantity) in item_list: print("{} : {}".format(item_code_database.get_name_from_code(item_code), item_quantity)) game_data.add_item(item_code, item_quantity) + edits_made = True if args.detailed_items: game_data.print_detailed_item_summary() @@ -637,30 +644,31 @@ def main(): # game_data.print_detailed_character_summary() game_data.writeback() - if args.replace_original: - print('Renaming original file') - datetime_suffix = datetime.datetime.now().strftime('%Y-%m-%d-%H%M_%S_%f') - new_filename = args.filename + "-" + datetime_suffix - # print(datetime_suffix) - os.rename(args.filename, new_filename) + if edits_made: + if args.replace_original: + print('Renaming original file') + datetime_suffix = datetime.datetime.now().strftime('%Y-%m-%d-%H%M_%S_%f') + new_filename = args.filename + "-" + datetime_suffix + # print(datetime_suffix) + os.rename(args.filename, new_filename) - print('Now rewriting game file with new information') - text = soup.prettify() - # Delete XML header - game doesn't have it - sansfirstline = '\n'.join(text.split('\n')[1:]) + print('Now rewriting game file with new information') + text = soup.prettify() + # Delete XML header - game doesn't have it + sansfirstline = '\n'.join(text.split('\n')[1:]) - f = open(args.filename, 'w') - f.write(sansfirstline) - f.close() - print('Complete.') - else: - text = soup.prettify() - # Delete XML header - game doesn't have it - sansfirstline = '\n'.join(text.split('\n')[1:]) + f = open(args.filename, 'w') + f.write(sansfirstline) + f.close() + print('Complete.') + else: + text = soup.prettify() + # Delete XML header - game doesn't have it + sansfirstline = '\n'.join(text.split('\n')[1:]) - f = open('game.xml', 'w') - f.write(sansfirstline) - f.close() + f = open('game.xml', 'w') + f.write(sansfirstline) + f.close() if __name__ == "__main__": main()