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

From Wildermyth Wiki
Line 54: Line 54:
names = []
names = []
tiers = []
tiers = []
classes = []
themes = []
themes = []
playables = []
playables = []
Line 62: Line 63:
   themes_ = []
   themes_ = []
   abilities_ = []
   abilities_ = []
  class_ = ''
   try:
   try:
     tier = int(entry['tier'])+1
     tier = int(entry['tier'])+1
Line 80: Line 82:
       continue
       continue
     for entry_ in entities[j][6]['aspects']['entries']:
     for entry_ in entities[j][6]['aspects']['entries']:
       if entry_[0].startswith('themePiece_') and entry_[1]['value'] == 1:
       if entry_[0] in ['hunter','warrior','mystic'] and entry_[1]['value'] == 1:
        class_ = entry_[0]
      elif entry_[0].startswith('themePiece_') and entry_[1]['value'] == 1:
         themes_ += [dictionary[entry_[0]]]
         themes_ += [dictionary[entry_[0]]]
       elif entry_[0].startswith('hookResolved_retirementAgeBoost') and entry_[1]['value'] == 1:
       elif entry_[0].startswith('hookResolved_retirementAgeBoost') and entry_[1]['value'] == 1:
Line 88: Line 92:
   names += [name]
   names += [name]
   tiers += [tier]
   tiers += [tier]
  classes += [class_]
   playables += [playable]
   playables += [playable]
   themes += [themes_]
   themes += [themes_]
Line 124: Line 129:


with open('legacy_table.txt', 'w') as f:
with open('legacy_table.txt', 'w') as f:
   f.write('Name\tPlayable\tTier\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%d\t'%(name,playables[i],tiers[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')</nowiki>
|}
|}


Line 137: Line 142:
* Playable (Y/N)
* Playable (Y/N)
* Legacy tier
* Legacy tier
* Class
* Number of hooks resolved
* Number of hooks resolved
* Themes
* Themes

Revision as of 08:56, 15 February 2022

This is a Python script to export a player's legacy into a spreadsheet.

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 items
  • Abilities

Example

Example image
Example legacy export, viewed in Microsoft Excel