Difference between revisions of "User:Sten/Legacy to spreadsheet"

From Wildermyth Wiki
Line 13: Line 13:
from glob import glob
from glob import glob


mod_paths = ['../..'] + glob('../../mods/builtIn/*')
mod_paths = ['../..'] + glob('../../mods/builtIn/*') + glob('../../mods/user/*') + glob('../../../../workshop/content/763890/*')


dictionary = {}
dictionary = {}
Line 92: Line 92:
               class_ = entry_[0]
               class_ = entry_[0]
             elif entry_[0].startswith('themePiece_') and entry_[1]['value'] == 1:
             elif entry_[0].startswith('themePiece_') and entry_[1]['value'] == 1:
               themes_ += [dictionary[entry_[0]]]
               try:
                theme = dictionary[entry_[0]]
              except:
                theme = entry_[0]
              themes_ += [theme]
             elif entry_[0].startswith('hookResolved_retirementAgeBoost') and entry_[1]['value'] == 1:
             elif entry_[0].startswith('hookResolved_retirementAgeBoost') and entry_[1]['value'] == 1:
               hook += 1
               hook += 1
             elif test_ability(entry_[0]) and entry_[1]['value'] == 1:
             elif test_ability(entry_[0]) and entry_[1]['value'] == 1:
               abilities_ += [dictionary[entry_[0]]]
               try:
                ability = dictionary[entry_[0]]
              except:
                ability = entry_[0]
              abilities_ += [ability]
     elif 'item' in entities[j]:
     elif 'item' in entities[j]:
       for i in range(len(entities[j])):
       for i in range(len(entities[j])):
Line 127: Line 135:
   f.write('Name\tPlayable\tTier\tClass\tHooks\tThemes\tWeapons\tOffhand\tAbilities\n')
   f.write('Name\tPlayable\tTier\tClass\tHooks\tThemes\tWeapons\tOffhand\tAbilities\n')
   for i,name in enumerate(names):
   for i,name in enumerate(names):
     f.write('%s\t%s\t%d\t%s\t%d\t'%(name,playables[i],tiers[i],classes[i],hooks[i]) + ', '.join(themes[i]) + '\t' + ', '.join(weapons[i]) + '\t' + offhands[i] + '\t' + ', '.join(abilities[i]) + '\n')</nowiki>
     f.write('%s\t%s\t%d\t%s\t%d\t'%(name,playables[i],tiers[i],classes[i],hooks[i]) + ', '.join(themes[i]) + '\t' + ', '.join(weapons[i]) + '\t' + offhands[i] + '\t' + ', '.join(abilities[i]) + '\n')
 
print('Done. Press ENTER to close.\n')
input()</nowiki>
|}
|}



Revision as of 14:54, 21 February 2022

This is a Python script to export a player's legacy into a spreadsheet. You need a Python installation to run it.

Usage

Copy the code in the box below into a text file named legacy_table.py (or whatever you want) inside the Wildermyth/Players/<player ID> directory. Then run it by calling python legacy_table.py from the command line. It will create a text file called legacy_table.txt, which is tab-delimited and can be loaded by any spreadsheet software or viewed in a text editor.

Output

This script does not make any changes to the legacy.

The following fields appear in the output table (legacy_table.txt):

  • Name
  • Playable (Y/N)
  • Legacy tier
  • Class
  • Number of hooks resolved
  • Themes
  • Weapons
  • Offhand item
  • Abilities

Example

Example image
Example legacy export, viewed in Microsoft Excel