input_file.init(os.path.join(conf.path, filename), 0) output_trainers = "" output_trainers += ".include \"source/macros_asm.s\"\n\n" if format == 1: output_trainers += "@ Pkmn, Move1, Move2, Move3, Move4, EVs, Nature, Item, ?, ?\n" elif format == 3: output_trainers += "@ BTrainer\n" else: output_trainers += "@ ?, ?, Level, ?, Pkmn, ?, ?\n" if format == 0: # normal trainer pkmn i = 0 while i < (input_file.GetFileSize() / 8): unknown1 = input_file.ReadByte(0 + i * 8) unknown2 = input_file.ReadByte(1 + i * 8) level = input_file.ReadByte(2 + i * 8) unknown3 = input_file.ReadByte(3 + i * 8) species = input_file.ReadHWord(4 + i * 8) unknown4 = input_file.ReadByte(6 + i * 8) unknown5 = input_file.ReadByte(7 + i * 8) output_trainers += "trainerpoke " + str(unknown1) + ", " + str( unknown2) + ", " + str( level) + ", " + str(unknown3) + ", " + str( GetPokemonName(species)) + ", " + str( unknown4) + ", " + str(unknown5) + "\n" i += 1 elif format == 1: # battle tower pkmn species = input_file.ReadHWord(0)
input_file = FileHandler() if __name__ == "__main__": conf = configuration.Config() filename = sys.argv[1] output_folder = sys.argv[2] input_file.init(os.path.join(conf.path, filename), 0) output_trainers = "" output_trainers += ".include \"source/macros_asm.s\"\n\n" output_trainers += "@ Flag, Class, Battletype, #Pkmn, item1, item2, item3, item4, ai, Battletype2, ?, ?, ?\n" flag = input_file.ReadByte(0) class_ = input_file.ReadByte(1) battletype = input_file.ReadByte(2) numpokemon = input_file.ReadByte(3) item1 = input_file.ReadHWord(4) item2 = input_file.ReadHWord(6) item3 = input_file.ReadHWord(8) item4 = input_file.ReadHWord(10) ai = input_file.ReadWord(12) battletype2 = input_file.ReadByte(16) unknown1 = input_file.ReadByte(17) unknown2 = input_file.ReadByte(18) unknown3 = input_file.ReadByte(19) output_trainers += "trainer " + str(flag) + ", " + str( class_) + ", " + str(battletype) + ", " + str(numpokemon) + ", " + str(
return str(pocket) if __name__ == "__main__": conf = configuration.Config() filename = sys.argv[1] output_folder = sys.argv[2] input_file.init(os.path.join(conf.path, filename), 0) output_item = "" output_item += ".include \"source/macros_asm.s\"\n\n" price = input_file.ReadHWord(0) battleeffect = input_file.ReadByte(2) gain = input_file.ReadByte(3) berrytag = input_file.ReadByte(4) flingeffect = input_file.ReadByte(5) flingpower = input_file.ReadByte(6) naturalpower = input_file.ReadByte(7) Unknown8 = input_file.ReadHWord(8) Unknown8_1 = (Unknown8 >> 0) & 0x1f Unknown8_2 = (Unknown8 >> 5) & 0x1 Unknown8_3 = (Unknown8 >> 6) & 0x1 pocket = (Unknown8 >> 8) & 0xf Unknown8_4 = (Unknown8 >> 11) & 0x1f Unknowna = input_file.ReadByte(0xa) Unknownb = input_file.ReadByte(0xb) Unknownc = input_file.ReadByte(0xc) Unknowne = input_file.ReadByte(0xe) # statboosts
output_folder_pkmns = sys.argv[4] format = 0 file_trainer.init(os.path.join(conf.path, filename_trainer), 0) file_pkmns.init(os.path.join(conf.path, filename_pkmns), 0) ############################## # Interprete the Trainer output_trainer = "" output_trainer += ".include \"source/macros_asm.s\"\n\n" output_trainer += "@ Flag, Class, Battletype, #Pkmn, item1, item2, item3, item4, ai, Battletype2, ?, ?, ?\n" flag = file_trainer.ReadByte(0) format = flag if format > 1: print("format of '" + str(filename_trainer) + "' is: " + str(format)) #exit() class_ = file_trainer.ReadByte(1) battletype = file_trainer.ReadByte(2) numpokemon = file_trainer.ReadByte(3) item1 = file_trainer.ReadHWord(4) item2 = file_trainer.ReadHWord(6) item3 = file_trainer.ReadHWord(8) item4 = file_trainer.ReadHWord(10) ai = file_trainer.ReadWord(12) battletype2 = file_trainer.ReadByte(16) unknown1 = file_trainer.ReadByte(17) unknown2 = file_trainer.ReadByte(18)
if __name__ == "__main__": conf = configuration.Config() filename = sys.argv[1] output_folder = sys.argv[2] input_file.init(os.path.join(conf.path, filename), 0) output_trainers = "" output_trainers += ".include \"source/macros_asm.s\"\n\n" output_trainers += "@ Effect, Category, Power, Type, Accuracy, PP, EffectChance, Flag1, Priority, Flag2, ContestEffect, ContestType\n" effect = input_file.ReadHWord(0) category = input_file.ReadByte(2) power = input_file.ReadByte(3) type = input_file.ReadByte(4) accuracy = input_file.ReadByte(5) pp = input_file.ReadByte(6) effectchance = input_file.ReadByte(7) flag1 = input_file.ReadHWord(8) priority = input_file.ReadByte(0xa) flag2 = input_file.ReadByte(0xb) contesteffect = input_file.ReadByte(0xc) contesttype = input_file.ReadByte(0xd) output_trainers += "move " + str(effect) + ", " + GetCategoryName( category) + ", " + str(power) + ", " + GetTypeName(type) + ", " + str( accuracy) + ", " + str(pp) + ", " + str(effectchance) + ", " + str( flag1) + ", " + str(priority) + ", " + str(flag2) + ", " + str(
return str(group) if __name__ == "__main__": conf = configuration.Config() filename = sys.argv[1] output_folder = sys.argv[2] input_file.init(os.path.join(conf.path, filename), 0) output_item = "" output_item += ".include \"source/macros_asm.s\"\n\n" output_item += "@ HP, Atk, Def, Spe, SpA, SpD, Type1, Type2, CatchRate, BaseExp, EV ((EV_HP)|(EV_Atk<<2)|(EV_Def<<4)|(EV_Spe<<6)|(EV_SpA<<8)|(EV_SpD<<10)), Item1, Item2, Gender, HatchCycle, BaseHappiness, ExpRate, EggGroup1, EggGroup2, Ability1, Ability2, Flee, unknown, unknown, unknown, unknown, unknown, unknown\n" HP = input_file.ReadByte(0) Atk = input_file.ReadByte(1) Def = input_file.ReadByte(2) Spe = input_file.ReadByte(3) SpA = input_file.ReadByte(4) SpD = input_file.ReadByte(5) Type1 = input_file.ReadByte(6) Type2 = input_file.ReadByte(7) CatchRate = input_file.ReadByte(8) BaseExp = input_file.ReadByte(9) EV = input_file.ReadHWord(0xa) EV_HP = (EV >> 0) & 0x3 EV_Atk = (EV >> 2) & 0x3 EV_Def = (EV >> 4) & 0x3 EV_Spe = (EV >> 6) & 0x3 EV_SpA = (EV >> 8) & 0x3
elif sys.argv[i] == "-h": size = 2 elif sys.argv[i] == "-b": size = 1 i += 1 input_file.init(os.path.join(conf.path, filename), 0) output = "" if size == 4: output = ".word " elif size == 2: output = ".hword " elif size == 1: output = ".byte " i = start_adr while i < end_adr: if size == 4: word = input_file.ReadWord(i + 0) elif size == 2: word = input_file.ReadHWord(i + 0) elif size == 1: word = input_file.ReadByte(i + 0) #X1 = input_file.ReadHWord(i+4) output += hex(word) i += size if i < end_adr: output += ", " print output
"FireRed 4%", "LeafGreen 4%", "LeafGreen 4%" ] i = 0 while i < 26: output_encdata += ".word " + GetPokemonName( EncData2[i]).ljust(12) + " @ " + comments[i] + "\n" i += 1 comments = ["60%", "30%", "5%", "4%", "1%"] offset = 4 + 12 * 8 + 26 * 4 Rate = input_file.ReadWord(offset) EncData = [] i = 0 while i < 5: unk = input_file.ReadByte(offset + 4 + i * 8) unk2 = input_file.ReadByte(offset + 5 + i * 8) unk3 = input_file.ReadHWord(offset + 6 + i * 8) Pkmn = input_file.ReadWord(offset + 8 + i * 8) EncData += [(unk, unk2, unk3, Pkmn)] i += 1 output_encdata += "\n" output_encdata += "@ Water:\n" output_encdata += "@ Surfing:\n" output_encdata += ".word " + str(Rate) + " @ Rate\n" i = 0 while i < 5: output_encdata += "WaterEncounter " + ( str(EncData[i][0]) + ", ").ljust(4) + ( str(EncData[i][1]) + ", ").ljust(4) + GetPokemonName(