diff --git a/sheditor.py b/sheditor.py index 7219de7..344fdbb 100644 --- a/sheditor.py +++ b/sheditor.py @@ -452,131 +452,6 @@ class GameData: # char.print_summary() -def characters(soup): - for character in soup.find_all('characters'): - c_elems = character.find_all('c') - if len(c_elems) > 0: - console.print('Found some appropriate c-tags') - for char_c in c_elems: - # console.print(char_c['name']) - if 'name' in char_c.attrs: - console.print(char_c['name']) - # We have found a character tag! - - # ---- SKILL UPRGRADING - skill_tag = char_c.find('skills') - console.print(skill_tag) - # Experimental changing - for sk_tag in skill_tag.find_all('s'): - sk_tag['level'] = '5' - sk_tag['mxn'] = '8' - if 'mxp' in sk_tag.attrs: - sk_tag['mxp'] = '8' - console.print(skill_tag) - - # ---- ATTRIBUTE UPGRADING - attribute_tag = char_c.find('attr') - console.print(attribute_tag) - for a_tag in attribute_tag.find_all('a'): - a_tag['points'] = '6' - console.print(attribute_tag) - - -def inventory(soup, add_code, add_quantity): - # Load tag names first: - id_dict = {} - - filename = "item_ids.tsv" - for line in open(filename): - result = line.split() - code = int(result[0]) - name = ' '.join(result[1:]) - # console.print(code, name) - id_dict[code] = name - - # console.print(id_dict) - - console.print("You have requested that {} unit(s) of {} be added to existing storage of this item (storage site will be selected at random)".format(add_quantity, id_dict[add_code])) - - item_tracking = {} - - console.print('-----') - - storage_space_counter = 1 - - # This line is a hack to prevent finding alien ship inventories - # Unfortunately at the moment it will only likely work if the player has only one ship - # I do not yet know how to fix this problem if the player has a fleet - ship_tag = soup.find('ship') - - added_quantity = False - - for inv_tag in ship_tag.find_all('inv'): - if inv_tag.parent.name != 'feat': - continue - console.print('Storage space {}'.format(storage_space_counter)) - console.print() - quantity_total = 0 - for s_tag in inv_tag.find_all('s'): - item_code = int(s_tag['elementaryId']) - item_quantity = int(s_tag['inStorage']) - item_name = id_dict[item_code] - console.print("{:4}: {} - {}".format(item_code, item_name, item_quantity)) - if item_code == add_code and not added_quantity: - console.print(" Updating quantity with requested amount...") - item_quantity += add_quantity - s_tag['inStorage'] = item_quantity - added_quantity = True - console.print(" Item quantity is now {}".format(s_tag['inStorage'])) - quantity_total += item_quantity - - if item_code not in item_tracking: - item_tracking[item_code] = item_quantity - else: - item_tracking[item_code] = item_tracking[item_code] + item_quantity - - console.print() - console.print('Total use of storage space {}: {}'.format(storage_space_counter, quantity_total)) - storage_space_counter += 1 - console.print('-----') - - console.print('Item total summary:') - console.print() - for item in item_tracking.items(): - item_code = item[0] - item_name = id_dict[item_code] - item_quantity = item[1] - console.print('{:4} - {} - {}'.format(item_code, item_name, item_quantity)) - - -def give_money(soup, amount): - - bank_tag = soup.find('playerBank') - bank_tag['ca'] = amount - - -def list_ships(soup): - - ship_tags = soup.find_all('ship') - - for ship_tag in ship_tags: - ship_name = ship_tag['sname'] - - """ - settings_nodes = ship_tag.find_all('settings') - for settings_node in settings_nodes: - if settings_node.has_attr('owner'): - ship_owner = settings_node['owner'] - else: - continue - """ - owner_node = ship_tag.find('settings', owner=True) - ship_owner = owner_node['owner'] - ship_state = owner_node['state'] - console.print('Ship found: {} owned by {} (state: {})'.format(ship_name, ship_owner, ship_state)) - # console.print(settings_node) - - def parse_item_file(filename): results = []