Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PyPoE.poe.constants import SOCKET_COLOUR
- from PyPoE.poe.file.dat import RelationalReader
- # I have the content.ggpk extracted to C:/Temp
- r = RelationalReader(path_or_ggpk='C:/Temp/', read_options={'use_dat_value': False})
- def stuff():
- print('<table class="wikitable sortable">')
- headers = ['Char', 'Item', 'Sockets', 'Links', 'Skill Gems', 'Mods', 'Inventory', 'Stack Size']
- print('<tr><th>' + '</th><th>'.join(headers) + '</th></tr>')
- for row in r['CharacterStartItems.dat']:
- if row['CharacterStartStatesKey'].rowid < 21:
- continue
- cells = []
- cells.append(row['CharacterStartStatesKey']['Id'])
- # {{il|item name}} is a wiki template to link to items
- cells.append('{{il|%s}}' % row['BaseItemTypesKey']['Name'])
- if row['Sockets']:
- sockets = []
- for socketid in row['Sockets']:
- for socket in SOCKET_COLOUR:
- if socket.id == socketid:
- sockets.append(socket.char)
- break
- cells.append('-'.join(sockets))
- else:
- cells.append('N/A')
- if row['Links']:
- cells.append(', '.join([str(x) for x in row['Links']]))
- else:
- cells.append('N/A')
- if row['Socketed_SkillGemsKeys']:
- gems = []
- for i, skill_gem in enumerate(row['Socketed_SkillGemsKeys']):
- # {{sl|skill name}} is a wiki template to link to skills
- gems.append('{{sl|%s}} (Lv: %s)' % (skill_gem['BaseItemTypesKey']['Name'], row['SkillGemLevels'][i]))
- cells.append('<br>'.join(gems))
- else:
- cells.append('N/A')
- if row['ModsKeys']:
- # [[modid|modname]] is basically linking to wikipage of name modid using the name of the mod, since there may be multiple mods with the same name
- cells.append(', '.join(['[[%s|%s]]' % (mod['Id'], mod['Name']) for mod in row['ModsKeys']]))
- else:
- cells.append('N/A')
- cells.append(row['InventoryIndex'])
- if row['StackSize']:
- cells.append(str(row['StackSize']))
- else:
- cells.append('N/A')
- print ('<tr><td>' + '</td><td>'.join(cells) + '</td></tr>')
- print('</table>')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement