Application used to parse in-game information in generation IV/V Pokemon games.
- Pokemon Platinum
- Pokemon HeartGold/SoulSilver
- Read/update party pokemon stats, including:
- level
- name
- EVs/IVs
- held item
- nature
- battle stats
- checksum validations, safe from memory corruptions!
go get github.com/dingdongg/pkmn-rom-parser/v7
Reading from a savefile:
// imports omitted
savefile, err := os.ReadFile("path/to/savefile")
if err != nil {
log.Fatal(err)
}
// read from a savefile
partyPokemon, err := parser.Parse(savefile)
if err != nil {
log.Fatal(err)
}
fmt.Printf("% #v\n", partyPokemon)
Updating a savefile
// imports omitted
savefile, err := os.ReadFile("path/to/savefile")
if err != nil {
panic("um")
}
reqs := make([]req.WriteRequest, 0)
// for every pokemon to be updated, create a new WriteRequest object,
// indicating the party pokemon's index in the party
writeReq := req.NewWriteRequest(0) // index 0
writeReq.WriteNickname("ABCDE")
writeReq.WriteIV(uint(0b00_11111_11111_11111_11111_11111_11111))
writeReq.WriteEV(uint(0xFFFFFFFFFFFF))
writeReq.WriteItem(5)
writeReq.WriteLevel(100)
writeReq.WriteBattleStats(123, 456, 789, 999, 111, 101)
secondWrite := req.NewWriteRequest(1) // index 1
secondWrite.WriteNickname("birdo")
secondWrite.WriteEV(uint(0x0600FC00FC00))
secondWrite.WriteLevel(1)
// add the above WriteRequest structs to a slice
reqs = append(reqs, writeReq, secondWrite)
// pass the request slice into the Write method
newSavefile, err := parser.Write(savefile, reqs)
if err != nil {
log.Fatal(err)
}
- extend support for other gen. 4/5 games
- Read/update PC system pokemon too
The information in char_encoder/char_encoder.go
was extracted from this Bulbapedia article using a custom script.
The tableValues
information in shuffler/shuffler.go
was extracted from Project Pokemon using a custom HTML parsing script.