Packs added and some item codes updated.

This commit is contained in:
Chris Davoren 2023-07-01 06:54:15 +10:00
parent f6611a724a
commit 4ff78961ed
5 changed files with 42 additions and 22 deletions

View File

@ -183,6 +183,7 @@
981 Refinery Parts 981 Refinery Parts
982 Autopsy Table 982 Autopsy Table
984 Monster Meat 984 Monster Meat
985 Human Meat
991 Suit Locker Parts 991 Suit Locker Parts
992 Suit Locker Parts 992 Suit Locker Parts
993 Suit Locker Parts 993 Suit Locker Parts
@ -655,6 +656,10 @@
3025 Salvage Robot Station 3025 Salvage Robot Station
3029 Station Hull Window red 3 with asteroid 3029 Station Hull Window red 3 with asteroid
3044 floor 3044 floor
3069 Laser Pistol
3070 Laser Rifle
3366 Mild Alcohol 3366 Mild Alcohol
3378 Grains and Hops 3378 Grains and Hops
3383 Bulletproof Vest
3384 Armored Vest
3419 Augmentation Parts 3419 Augmentation Parts

3
pack_medical.txt Normal file
View File

@ -0,0 +1,3 @@
# Medical supplies pack
2053 30 # Medical supplies
2058 30 # IV fluids

View File

@ -3,4 +3,5 @@
1924 20 # Optronics components 1924 20 # Optronics components
173 20 # Electronic components 173 20 # Electronic components
3378 20 # Grains and hops 3378 20 # Grains and hops
1920 20 # Superblocks 1920 20 # Superblocks
3419 20 # Augmentation parts

3
pack_weapons_basic.txt Normal file
View File

@ -0,0 +1,3 @@
# Basic weapons pack
760 10 # Five-seven pistols
725 10 # Assault rifles

View File

@ -591,20 +591,26 @@ def main():
game_data = GameData(soup, item_code_database) game_data = GameData(soup, item_code_database)
game_data.populate() game_data.populate()
edits_made = False
if args.buff_chars: if args.buff_chars:
game_data.buff_characters() game_data.buff_characters()
edits_made = True
if args.add_item: if args.add_item:
game_data.add_item(args.add_item[0], args.add_item[1]) game_data.add_item(args.add_item[0], args.add_item[1])
edits_made = True
if args.money: if args.money:
game_data.add_currency(args.money[0]) game_data.add_currency(args.money[0])
edits_made = True
if args.list_ships: if args.list_ships:
game_data.print_summary() game_data.print_summary()
if args.clone_character: if args.clone_character:
game_data.clone_character(args.clone_character[0], args.clone_character[1]) game_data.clone_character(args.clone_character[0], args.clone_character[1])
edits_made = True
if args.add_item_set: if args.add_item_set:
item_list = parse_item_file(args.add_item_set[0]) item_list = parse_item_file(args.add_item_set[0])
@ -613,6 +619,7 @@ def main():
for (item_code, item_quantity) in item_list: for (item_code, item_quantity) in item_list:
print("{} : {}".format(item_code_database.get_name_from_code(item_code), item_quantity)) print("{} : {}".format(item_code_database.get_name_from_code(item_code), item_quantity))
game_data.add_item(item_code, item_quantity) game_data.add_item(item_code, item_quantity)
edits_made = True
if args.detailed_items: if args.detailed_items:
game_data.print_detailed_item_summary() game_data.print_detailed_item_summary()
@ -637,30 +644,31 @@ def main():
# game_data.print_detailed_character_summary() # game_data.print_detailed_character_summary()
game_data.writeback() game_data.writeback()
if args.replace_original: if edits_made:
print('Renaming original file') if args.replace_original:
datetime_suffix = datetime.datetime.now().strftime('%Y-%m-%d-%H%M_%S_%f') print('Renaming original file')
new_filename = args.filename + "-" + datetime_suffix datetime_suffix = datetime.datetime.now().strftime('%Y-%m-%d-%H%M_%S_%f')
# print(datetime_suffix) new_filename = args.filename + "-" + datetime_suffix
os.rename(args.filename, new_filename) # print(datetime_suffix)
os.rename(args.filename, new_filename)
print('Now rewriting game file with new information') print('Now rewriting game file with new information')
text = soup.prettify() text = soup.prettify()
# Delete XML header - game doesn't have it # Delete XML header - game doesn't have it
sansfirstline = '\n'.join(text.split('\n')[1:]) sansfirstline = '\n'.join(text.split('\n')[1:])
f = open(args.filename, 'w') f = open(args.filename, 'w')
f.write(sansfirstline) f.write(sansfirstline)
f.close() f.close()
print('Complete.') print('Complete.')
else: else:
text = soup.prettify() text = soup.prettify()
# Delete XML header - game doesn't have it # Delete XML header - game doesn't have it
sansfirstline = '\n'.join(text.split('\n')[1:]) sansfirstline = '\n'.join(text.split('\n')[1:])
f = open('game.xml', 'w') f = open('game.xml', 'w')
f.write(sansfirstline) f.write(sansfirstline)
f.close() f.close()
if __name__ == "__main__": if __name__ == "__main__":
main() main()