Guest User

Nayuta Item Dump v1

a guest
Oct 25th, 2014
459
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Dump Nayuta no Kiseki item.tbl
  2. # 1. Put this script and item.orig (renamed item.tbl) in same folder
  3. # 2. Run script
  4. # Output is itemdata.csv (tab-separated)
  5. import os
  6.  
  7. def get_data(filename):
  8.     totalbytes = os.path.getsize(filename)
  9.     infile = open(filename, 'rb')
  10.     totalfiledata = infile.read(totalbytes)
  11.     infile.close()
  12.     return totalfiledata
  13.  
  14. filedata = get_data('item.orig')
  15.  
  16. pos = 0x10
  17. output = ""
  18. while pos < len(filedata):
  19.     if filedata[pos] != '\x00' or filedata[pos + 0x18] != '\x00':
  20.         text = filedata[pos:filedata.find('\x00',pos)]
  21.         output += hex(pos) + '\t' + text + '\n'
  22.         pos += 0x18
  23.         text = filedata[pos:filedata.find('\x00',pos)]
  24.         output += '\t' + text + '\n'
  25.         pos += 0x74
  26.     else:
  27.         pos += 0x8C
  28.  
  29. outfile = open('itemdata.csv','wb')
  30. outfile.write(output)
  31. outfile.close()
RAW Paste Data