Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from operator import itemgetter
- import struct
- def portMovepool(rom, pokemon, moves, text) :
- text = text.split(',')
- pkmnindex = pokemon.index(text[0])
- rom.seek(0xC70000 + (pkmnindex * 0x40), 0)
- skip = False
- for i in range(1, len(text)) :
- if text[i] != "" and not skip :
- print(text[i])
- moveindex = moves.index(text[i])
- level = int(text[i+1])
- entry = [moveindex%256, int(moveindex/256), level]
- rom.write(bytes(entry))
- skip = True
- elif skip:
- skip = False
- terminator = [0, 0, 255]
- rom.write(bytes(terminator))
- romname = "yafrh.gba"
- pokemon = []
- moves = []
- csv = []
- with open("pokemon.txt", 'r') as f :
- s = f.read()
- badpokemon = s.split("\n")
- for p in badpokemon :
- pokemon += [p.strip()]
- with open("moves.txt", 'r') as f :
- s = f.read()
- moves = s.split("\n")
- with open("Yafrh Data - Movepools.csv", 'r') as file :
- csv = file.read()
- csv = csv.split('\n')
- with open(romname, 'r+b') as file :
- for i in range(0,241) :
- print(i)
- line = csv[i]
- portMovepool(file, pokemon, moves, line)
Add Comment
Please, Sign In to add comment