nkzou / tera-cli

Terminal Interface for the MMORPG TERA Online.
https://nkzou.github.io/tera-cli/
MIT License
6 stars 4 forks source link

Add inventory parsing and display items with human-readable names #5

Open nkzou opened 6 years ago

nkzou commented 6 years ago

use a datacenter unpacker to parse IDs into names

nkzou commented 6 years ago

parse this datacenter into some kinda map like id:{name, tooltip, gender, race} format of tsv datacenter: id \t name \t category \t icon \t tooltip \t requiredGender \t requiredRace without spaces ofc

ealejand commented 6 years ago

save this as a .py in the folder and run it. As best as I can tell there's no field for required race

#!/usr/bin/env python 
with open('output.txt', 'w+') as out_fd, open('fullitems-NA.tsv', 'r') as in_fd:
    for line in in_fd:
        line_list = line.split('\t')
        out_fd.write(line_list[0]+':{'+','.join(line_list[1:-1])+'}\n')

Sample:

1:{Velika Midnight Oil,combat,Icon_Items.Artisan_Potion_Tex,Increases equipment crafting speed by 20% for 1 hour.,}
2:{Bound Scroll of Full Resurrection,magical,Icon_Items.Perfect_Revival_Tex,Resurrects the closest ally within a 4m range in front of you. Restores 100% of HP and MP.,}
3:{Kaia's Bound Mead,combat,Icon_Items.HP_Recovery_Potion_Tex,Fully recovers your HP.,}
4:{Seren's Bound Perfume,combat,Icon_Items.MP_Recovery_Potion_Tex,Fully replenishes your MP.,}
5:{Lelyn's Bound Bandage,combat,Icon_Items.Perfect_Bandage_Tex,This item is no longer usable.,}
...
222624:{,style_hair,Icon_Equipments.Acc_333_Tex,,female}
222625:{,skillbook,Icon_Items.SkillBook_Lion1_Tex,,}
222626:{,style_hair,Icon_Equipments.Acc_279_Tex,,}
222627:{,style_back,Icon_Equipments.Acc_383_Tex,,}
222628:{,magical,Icon_Items.Icon_JangGoe_item_Tex,,}
222629:{,style_body,Icon_Equipments.PC_Event_21_04_Tex,,male}
222630:{,style_body,Icon_Equipments.PC_Event_21_04_Tex,,female}
nkzou commented 6 years ago

wasn't quite the format I needed. Needed it in JSON, which was similar but not quite what you gave. My example was definitely misleading though soz. I did it myself with hardcoded keys (there was a reqRace, but not all the entries had one and it was hidden really far down.

f = open('fullitems-NA.tsv', 'r', encoding='utf8')
o = open('fullitems-NA.json', 'w', encoding='utf8')
o.write('{\n')
for line in f:
    x = line.split('\t')
    l = list(map((lambda x: x.strip()) , x))
    o.write(str(l[0])+": {name: \""+l[1]+"\", type: \""+l[2]+"\", icon: \""+l[3]+"\", tooltip: \""+l[4]+"\", requiredGender: \""+l[5]+"\", requiredRace: \""+l[6]+"\"},\n")
o.write('}\n')