public static string GetTradeOtName(int index) { string getTradeOtNameRet = default; int offvar; var stringvar = ""; offvar = int.Parse(Ini.GetString(Conversions.ToString(MMainFunctions.GetIniFileLocation()), MainObject.Header, "TradeData", ""), System.Globalization.NumberStyles.HexNumber); if (MainObject.Header3 == "J") { } else { offvar = offvar + 43 + index * 60; MainObject.FileNum = FileSystem.FreeFile(); FileSystem.FileOpen(MainObject.FileNum, MainObject.LoadedRom, OpenMode.Binary); var labelName = "xxxxxxxx"; FileSystem.FileGet(MainObject.FileNum, ref labelName, offvar + 1); stringvar = modTextSapp.Sapp2Asc(labelName, false); //while (Strings.InStr(1, stringvar, @"\x")) // stringvar = Strings.LSet(stringvar, Strings.Len(stringvar) - 1); //stringvar = Strings.LSet(stringvar, Strings.Len(stringvar) - 1); } FileSystem.FileClose(MainObject.FileNum); getTradeOtNameRet = stringvar; return(getTradeOtNameRet); }
public static object GetTrainerName(int index) { object getTrainerNameRet = default; int offvar; var b = ""; offvar = int.Parse(Ini.GetString(Conversions.ToString(MMainFunctions.GetIniFileLocation()), MainObject.Header, "TrainerTable", ""), System.Globalization.NumberStyles.HexNumber); if (MainObject.Header3 == "J") { } else { MainObject.FileNum = FileSystem.FreeFile(); FileSystem.FileOpen(MainObject.FileNum, MainObject.LoadedRom, OpenMode.Binary); var name = "xxxxxxxxxxx"; FileSystem.FileGet(MainObject.FileNum, ref name, offvar + 1 + 4 + 40 * index); b = modTextSapp.Sapp2Asc(name, false); //while (Strings.InStr(1, b, @"\x")) // b = Strings.LSet(b, Strings.Len(b) - 1); //b = Strings.LSet(b, Strings.Len(b) - 1); } FileSystem.FileClose(MainObject.FileNum); getTrainerNameRet = b; return(getTrainerNameRet); }
public static Bitmap GetAndDrawTrainerSpriteToBitmap(int index, bool showBackColor = false) { Bitmap getAndDrawTrainerSpriteToBitmapRet = default; var sOffset = int.Parse(Ini.GetString(Conversions.ToString(MMainFunctions.GetIniFileLocation()), MainObject.Header, "TrainerImageTable", ""), System.Globalization.NumberStyles.HexNumber) + index * 8; var pOffset = int.Parse(Ini.GetString(Conversions.ToString(MMainFunctions.GetIniFileLocation()), MainObject.Header, "TrainerPaletteTable", ""), System.Globalization.NumberStyles.HexNumber) + index * 8; var temp = new byte[4096]; var image = new byte[65536]; var palette15 = new byte[4096]; Color[] palette32; Bitmap bSprite; using (var fs = new FileStream(MainObject.LoadedRom, FileMode.Open, FileAccess.Read)) { using var r = new BinaryReader(fs); fs.Position = sOffset; sOffset = r.ReadInt32() - 0x8000000; fs.Position = sOffset; r.Read(temp, 0, 0xFFF); Lz77.Lz77UnComp(temp, image); temp = new byte[4096]; fs.Position = pOffset; pOffset = r.ReadInt32() - 0x8000000; fs.Position = pOffset; r.Read(temp, 0, 0xFFF); Lz77.Lz77UnComp(temp, palette15); palette32 = LoadPalette(palette15); } bSprite = LoadSprite(ref image, palette32, 64, 64, showBackColor); getAndDrawTrainerSpriteToBitmapRet = bSprite; return(getAndDrawTrainerSpriteToBitmapRet); }
public static string GetAttackName(int index) { string getAttackNameRet = default; var b = string.Empty; var offSet = int.Parse(Ini.GetString(Conversions.ToString(MMainFunctions.GetIniFileLocation()), MainObject.Header, "AttackNames", "1"), System.Globalization.NumberStyles.HexNumber); if (MainObject.Header3 == "J") { } else { MainObject.FileNum = FileSystem.FreeFile(); FileSystem.FileOpen(MainObject.FileNum, MainObject.LoadedRom, OpenMode.Binary); var attackName = "xxxxxxxxxxxxx"; FileSystem.FileGet(MainObject.FileNum, ref attackName, offSet + 1 + 13 * index); b = modTextSapp.Sapp2Asc(attackName, false); while (Strings.InStr(1, b, @"\x") != 0) { b = Strings.LSet(b, Strings.Len(b) - 1); } b = Strings.LSet(b, Strings.Len(b) - 1); } FileSystem.FileClose(MainObject.FileNum); getAttackNameRet = b; return(getAttackNameRet); }
public static Bitmap GetPokemonFootPrintToBitmap(int index) { Bitmap getPokemonFootPrintToBitmapRet = default; var sOffset = int.Parse(Ini.GetString(Conversions.ToString(MMainFunctions.GetIniFileLocation()), MainObject.Header, "FootPrintTable", ""), System.Globalization.NumberStyles.HexNumber) + index * 4; var temp = new byte[256]; var image = new byte[256]; var palette32 = new Color[2]; Bitmap bSprite; using (var fs = new FileStream(MainObject.LoadedRom, FileMode.Open, FileAccess.Read)) { using var r = new BinaryReader(fs); fs.Position = sOffset; sOffset = r.ReadInt32() - 0x8000000; fs.Position = sOffset; r.Read(temp, 0, 0xFF); image = temp; } palette32[0] = Color.Transparent; palette32[1] = Color.Black; bSprite = Load2BpSprite16By16(ref image, palette32); getPokemonFootPrintToBitmapRet = bSprite; return(getPokemonFootPrintToBitmapRet); }
// NEEDS TO BE MOVED TO THE FORMS SIDE public static Bitmap GetAndDrawPokemonIconToBitmap(int index, int palindex, bool showBackColor = false) { Bitmap getAndDrawPokemonIconToBitmapRet = default; var sOffset = int.Parse(Ini.GetString(Conversions.ToString(MMainFunctions.GetIniFileLocation()), MainObject.Header, "IconPointerTable", ""), System.Globalization.NumberStyles.HexNumber) + index * 4; var pOffset = int.Parse(Ini.GetString(Conversions.ToString(MMainFunctions.GetIniFileLocation()), MainObject.Header, "IconPals", ""), System.Globalization.NumberStyles.HexNumber) + palindex * 32; var temp = new byte[4096]; var image = new byte[65536]; var palette15 = new byte[4096]; Color[] palette32; Bitmap bSprite; using (var fs = new FileStream(MainObject.LoadedRom, FileMode.Open, FileAccess.Read)) { using var r = new BinaryReader(fs); fs.Position = sOffset; sOffset = r.ReadInt32() - 0x8000000; fs.Position = sOffset; r.Read(temp, 0, 0xFFF); // LZ77UnComp(Temp, Image) image = temp; temp = new byte[4096]; // fs.Position = pOffset // pOffset = r.ReadInt32 - &H8000000 fs.Position = pOffset; r.Read(temp, 0, 0xFFF); // LZ77UnComp(Temp, Palette15) palette32 = LoadPalette(temp); } bSprite = LoadSprite(ref image, palette32, 32, 64, showBackColor); getAndDrawPokemonIconToBitmapRet = bSprite; return(getAndDrawPokemonIconToBitmapRet); }
public static byte[] GetAnimationPicToByteArray(int index) { byte[] getAnimationPicToByteArrayRet = default; var sOffset = int.Parse(Ini.GetString(Conversions.ToString(MMainFunctions.GetIniFileLocation()), MainObject.Header, "PokemonAnimations", ""), System.Globalization.NumberStyles.HexNumber) + index * 8; // Pointer to Pokemon front sprites, + 8 = Bulbasaur. var pOffset = int.Parse(Ini.GetString(Conversions.ToString(MMainFunctions.GetIniFileLocation()), MainObject.Header, "PokemonNormalPal", ""), System.Globalization.NumberStyles.HexNumber) + index * 8; // Pointer to Pokemon normal palettes, + 8 = Bulbasaur. var temp = new byte[4096]; var image = new byte[65536]; var palette15 = new byte[4096]; Color[] palette32; Bitmap bSprite; using (var fs = new FileStream(MainObject.LoadedRom, FileMode.Open, FileAccess.Read)) { using var r = new BinaryReader(fs); fs.Position = sOffset; sOffset = r.ReadInt32() - 0x8000000; fs.Position = sOffset; r.Read(temp, 0, 0xFFF); Lz77.Lz77UnComp(temp, image); temp = new byte[4096]; fs.Position = pOffset; pOffset = r.ReadInt32() - 0x8000000; fs.Position = pOffset; r.Read(temp, 0, 0xFFF); Lz77.Lz77UnComp(temp, palette15); palette32 = LoadPalette(palette15); } bSprite = LoadSprite(ref image, palette32, 64, 128, Conversions.ToBoolean(0)); WichuSpriteFunctions.LoadBitmapFromArray(ref image, ref palette32, ref bSprite, 64, 128); // bSprite = LoadSprite(Image, Palette32, 64, 64, 0) getAnimationPicToByteArrayRet = (byte[])WichuSpriteFunctions.SaveBitmapToArray(ref bSprite, ref palette32); return(getAnimationPicToByteArrayRet); }
public static Bitmap GetShinyAnimationPokemonPicToBitmap(int index, bool showBackColor = true) { Bitmap getShinyAnimationPokemonPicToBitmapRet = default; var sOffset = int.Parse(Ini.GetString(Conversions.ToString(MMainFunctions.GetIniFileLocation()), MainObject.Header, "PokemonAnimations", ""), System.Globalization.NumberStyles.HexNumber) + index * 8; // Pointer to Pokemon front sprites, + 8 = Bulbasaur. var pOffset = int.Parse(Ini.GetString(Conversions.ToString(MMainFunctions.GetIniFileLocation()), MainObject.Header, "PokemonShinyPal", ""), System.Globalization.NumberStyles.HexNumber) + index * 8; // Pointer to Pokemon normal palettes, + 8 = Bulbasaur. var temp = new byte[4096]; var image = new byte[65536]; var palette15 = new byte[4096]; Color[] palette32; Bitmap bSprite; using (var fs = new FileStream(MainObject.LoadedRom, FileMode.Open, FileAccess.Read)) { using var r = new BinaryReader(fs); fs.Position = sOffset; sOffset = r.ReadInt32() - 0x8000000; fs.Position = sOffset; r.Read(temp, 0, 0xFFF); Lz77.Lz77UnComp(temp, image); temp = new byte[4096]; fs.Position = pOffset; pOffset = r.ReadInt32() - 0x8000000; fs.Position = pOffset; r.Read(temp, 0, 0xFFF); Lz77.Lz77UnComp(temp, palette15); palette32 = LoadPalette(palette15); } bSprite = LoadSprite(ref image, palette32, 64, 128, showBackColor); getShinyAnimationPokemonPicToBitmapRet = bSprite; return(getShinyAnimationPokemonPicToBitmapRet); }
public static string GetMapLabelName(int index) { string getMapLabelNameRet = default; int offvar; string stringvar; offvar = int.Parse(Ini.GetString(Conversions.ToString(MMainFunctions.GetIniFileLocation()), MainObject.Header, "MapLabelData", ""), System.Globalization.NumberStyles.HexNumber); if (MainObject.Header2 == "BPR" | MainObject.Header2 == "BPG") { string LocalReadHex() { var argStart2 = offvar + 4 * index; var argLength = 4; var ret = HexFunctions.ReadHex(ref MainObject.LoadedRom, ref argStart2, ref argLength); return(ret); } string LocalReverseHex() { var argHexData = "hs91275ee8794e4b13b198f9814e57c9f0()"; var ret = HexFunctions.ReverseHex(ref argHexData); return(ret); } offvar = Conversions.ToInteger("&H" + Conversion.Hex(Conversion.Val("&H" + LocalReverseHex()) - 134217728d)); } else { string LocalReadHex1() { var argStart2 = offvar + 8 * index; var argLength = 4; var ret = HexFunctions.ReadHex(ref MainObject.LoadedRom, ref argStart2, ref argLength); return(ret); } string LocalReverseHex1() { var argHexData = "hsdd4462e8698b411ca6a645b09164c60b()"; var ret = HexFunctions.ReverseHex(ref argHexData); return(ret); } offvar = Conversions.ToInteger("&H" + Conversion.Hex(Conversion.Val("&H" + LocalReverseHex1()) - 134217728d)); } if (MainObject.Header3 == "J") { stringvar = "not supported"; } else { MainObject.FileNum = FileSystem.FreeFile(); FileSystem.FileOpen(MainObject.FileNum, MainObject.LoadedRom, OpenMode.Binary); var labelName = "xxxxxxxxxxxxxxxxxxxxxx"; FileSystem.FileGet(MainObject.FileNum, ref labelName, offvar + 1); stringvar = modTextSapp.Sapp2Asc(labelName, false); while (Strings.InStr(1, stringvar, @"\x") != 0) { stringvar = Strings.LSet(stringvar, Strings.Len(stringvar) - 1); } stringvar = Strings.LSet(stringvar, Strings.Len(stringvar) - 1); } FileSystem.FileClose(MainObject.FileNum); getMapLabelNameRet = stringvar; return(getMapLabelNameRet); }
public static object GetPokedexTypeName(int index) { object getPokedexTypeNameRet = default; int offvar; var b = ""; offvar = int.Parse(Ini.GetString(Conversions.ToString(MMainFunctions.GetIniFileLocation()), MainObject.Header, "PokedexData", ""), System.Globalization.NumberStyles.HexNumber); if (MainObject.Header3 == "J") { if (MainObject.Header2 == "AXP" | MainObject.Header2 == "AXV") { MainObject.SkipVar = Conversions.ToInteger("36"); } else if (MainObject.Header2 == "BPR" | MainObject.Header2 == "BPG") { MainObject.SkipVar = Conversions.ToInteger("36"); } else if (MainObject.Header2 == "BPE") { MainObject.SkipVar = Conversions.ToInteger("32"); } } else if (MainObject.Header2 == "AXP" | MainObject.Header2 == "AXV") { MainObject.SkipVar = Conversions.ToInteger("36"); } else if (MainObject.Header2 == "BPR" | MainObject.Header2 == "BPG") { MainObject.SkipVar = Conversions.ToInteger("36"); } else if (MainObject.Header2 == "BPE") { MainObject.SkipVar = Conversions.ToInteger("32"); } if (MainObject.Header3 == "J") { } else { MainObject.FileNum = FileSystem.FreeFile(); FileSystem.FileOpen(MainObject.FileNum, MainObject.LoadedRom, OpenMode.Binary); var pokeType = "xxxxxxxxxxxx"; FileSystem.FileGet(MainObject.FileNum, ref pokeType, offvar + 1 + MainObject.SkipVar * index); b = modTextSapp.Sapp2Asc(pokeType, false); //while (Strings.InStr(1, b, @"\x")) // b = Strings.LSet(b, Strings.Len(b) - 1); //b = Strings.LSet(b, Strings.Len(b) - 1); } FileSystem.FileClose(MainObject.FileNum); getPokedexTypeNameRet = b; return(getPokedexTypeNameRet); }
public static object GetPokemonName(int index) { object getPokemonNameRet = default; int offvar; string b = default; offvar = int.Parse(Ini.GetString(Conversions.ToString(MMainFunctions.GetIniFileLocation()), MainObject.Header, "PokemonNames", ""), System.Globalization.NumberStyles.HexNumber); if (MainObject.Header3 == "J") { MainObject.FileNum = FileSystem.FreeFile(); FileSystem.FileOpen(MainObject.FileNum, MainObject.LoadedRom, OpenMode.Binary); var japPokeName = "xxxxxx"; FileSystem.FileGet(MainObject.FileNum, ref japPokeName, offvar + 1 + 6 * index); b = modTextSapp.Sapp2Asc(japPokeName, true); while (Strings.InStr(1, b, @"\x") != 0) { b = Strings.LSet(b, Strings.Len(b) - 1); } b = Strings.LSet(b, Strings.Len(b) - 1); } else { MainObject.FileNum = FileSystem.FreeFile(); FileSystem.FileOpen(MainObject.FileNum, MainObject.LoadedRom, OpenMode.Binary); var pokeName = "xxxxxxxxxxx"; FileSystem.FileGet(MainObject.FileNum, ref pokeName, offvar + 1 + 11 * index); b = modTextSapp.Sapp2Asc(pokeName, false); while (Strings.InStr(1, b, @"\x") != 0) { b = Strings.LSet(b, Strings.Len(b) - 1); } b = Strings.LSet(b, Strings.Len(b) - 1); } FileSystem.FileClose(MainObject.FileNum); getPokemonNameRet = b; return(getPokemonNameRet); }
public static string GetBattleFrontierTrainerName(int index) { string getBattleFrontierTrainerNameRet = default; var stringvar = string.Empty; var offvar = int.Parse(Ini.GetString(Conversions.ToString(MMainFunctions.GetIniFileLocation()), MainObject.Header, "BattleFrontierTrainers", ""), System.Globalization.NumberStyles.HexNumber); if (MainObject.Header2 == "BPE") { if (MainObject.Header3 == "J") { } else { offvar = offvar + 4 + index * 52; MainObject.FileNum = FileSystem.FreeFile(); FileSystem.FileOpen(MainObject.FileNum, MainObject.LoadedRom, OpenMode.Binary); var labelName = "xxxxxxxx"; FileSystem.FileGet(MainObject.FileNum, ref labelName, offvar + 1); stringvar = modTextSapp.Sapp2Asc(labelName, false); while (Strings.InStr(1, stringvar, @"\x") != 0) { stringvar = Strings.LSet(stringvar, Strings.Len(stringvar) - 1); } stringvar = Strings.LSet(stringvar, Strings.Len(stringvar) - 1); } FileSystem.FileClose(MainObject.FileNum); } else { ////Interaction.MsgBox("What did you do?"); Environment.Exit(0); } getBattleFrontierTrainerNameRet = stringvar; return(getBattleFrontierTrainerNameRet); }