Doesnt

moveporter.py

May 12th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. from operator import itemgetter
  2. import struct
  3.  
  4. def portMovepool(rom, pokemon, moves, text) :
  5. text = text.split(',')
  6. pkmnindex = pokemon.index(text[0])
  7. rom.seek(0xC70000 + (pkmnindex * 0x40), 0)
  8.  
  9. skip = False
  10.  
  11. for i in range(1, len(text)) :
  12. if text[i] != "" and not skip :
  13. print(text[i])
  14. moveindex = moves.index(text[i])
  15. level = int(text[i+1])
  16. entry = [moveindex%256, int(moveindex/256), level]
  17. rom.write(bytes(entry))
  18. skip = True
  19. elif skip:
  20. skip = False
  21.  
  22. terminator = [0, 0, 255]
  23. rom.write(bytes(terminator))
  24.  
  25.  
  26.  
  27. romname = "yafrh.gba"
  28.  
  29. pokemon = []
  30. moves = []
  31. csv = []
  32.  
  33. with open("pokemon.txt", 'r') as f :
  34. s = f.read()
  35.  
  36. badpokemon = s.split("\n")
  37. for p in badpokemon :
  38. pokemon += [p.strip()]
  39.  
  40.  
  41. with open("moves.txt", 'r') as f :
  42. s = f.read()
  43. moves = s.split("\n")
  44.  
  45.  
  46.  
  47. with open("Yafrh Data - Movepools.csv", 'r') as file :
  48. csv = file.read()
  49.  
  50. csv = csv.split('\n')
  51.  
  52. with open(romname, 'r+b') as file :
  53. for i in range(0,241) :
  54. print(i)
  55. line = csv[i]
  56. portMovepool(file, pokemon, moves, line)
Add Comment
Please, Sign In to add comment