protected override void Load(BinaryReader reader) { SpeciesID = reader.ReadUInt16(); HeldItemID = reader.ReadUInt16(); ushort[] moveset = new ushort[4]; for (int i = 0; i < 4; i++) { moveset[i] = reader.ReadUInt16(); } TrainerID = reader.ReadUInt32(); Personality = reader.ReadUInt32(); uint ivs = reader.ReadUInt32(); IVs = new IvStatValues((int)ivs & 0x3fffffff); IvFlags = ivs & 0xc0000000u; EVs = new ByteStatValues(reader.ReadBytes(6)); byte ppUps = reader.ReadByte(); GetMovesFromArray(Moves, m_pokedex, moveset, ppUps); Language = (Languages)reader.ReadByte(); AbilityID = reader.ReadByte(); Happiness = reader.ReadByte(); NicknameEncoded = new EncodedString5(reader.ReadBytes(22)); Unknown2 = reader.ReadUInt32(); // new to G5 }
public void Load(byte[] data, int start) { if (start + 0x3c > data.Length) { throw new ArgumentOutOfRangeException("start"); } Species = BitConverter.ToUInt16(data, 0x00 + start); HeldItem = BitConverter.ToUInt16(data, 0x02 + start); Moveset = new ushort[4]; for (int x = 0; x < 4; x++) { Moveset[x] = BitConverter.ToUInt16(data, 0x04 + x * 2 + start); } OT = BitConverter.ToUInt32(data, 0x0c + start); Personality = BitConverter.ToUInt32(data, 0x10 + start); IVs = BitConverter.ToUInt32(data, 0x14 + start); EVs = new byte[6]; for (int x = 0; x < 6; x++) { EVs[x] = data[0x18 + x + start]; } Unknown1 = data[0x1e + start]; Language = (Languages)data[0x1f + start]; Ability = data[0x20 + start]; Happiness = data[0x21 + start]; Nickname = new EncodedString5(data, 0x22 + start, 0x16); Unknown2 = BitConverter.ToUInt32(data, 0x38); }
protected override void Load(BinaryReader reader) { DataActual = reader.ReadBytes(0xEC); // 0000 Species = reader.ReadUInt16(); // 00EC Gender = (Genders)reader.ReadByte(); // 00EE Level = reader.ReadByte(); // 00EF RequestedSpecies = reader.ReadUInt16(); // 00F0 RequestedGender = (Genders)reader.ReadByte(); // 00F2 RequestedMinLevel = reader.ReadByte(); // 00F3 RequestedMaxLevel = reader.ReadByte(); // 00F4 Unknown1 = reader.ReadByte(); // 00F5 TrainerGender = (TrainerGenders)reader.ReadByte(); // 00F6 Unknown2 = reader.ReadByte(); // 00F7 TimeDeposited = TimestampToDate(reader.ReadUInt64()); // 00F8 TimeExchanged = TimestampToDate(reader.ReadUInt64()); // 0100 PID = reader.ReadInt32(); // 0108 TrainerOT = reader.ReadUInt32(); // 010C TrainerNameEncoded = new EncodedString5(reader.ReadBytes(0x10)); // 0110 TrainerCountry = reader.ReadByte(); // 0120 TrainerRegion = reader.ReadByte(); // 0121 TrainerClass = reader.ReadByte(); // 0122 IsExchanged = reader.ReadByte(); // 0123 TrainerVersion = reader.ReadByte(); // 0124 TrainerLanguage = reader.ReadByte(); // 0125 TrainerBadges = reader.ReadByte(); // 0126 TrainerUnityTower = reader.ReadByte(); // 0127 }
public void Load(byte[] data) { if (data.Length != 296) { throw new FormatException("GTS record length is incorrect."); } Data = new byte[0xDC]; Array.Copy(data, 0, Data, 0, 0xDC); Unknown0 = new byte[0x10]; Array.Copy(data, 0xDC, Unknown0, 0, 0x10); Species = BitConverter.ToUInt16(data, 0xEC); Gender = (Genders)data[0xEE]; Level = data[0xEF]; RequestedSpecies = BitConverter.ToUInt16(data, 0xF0); RequestedGender = (Genders)data[0xF2]; RequestedMinLevel = data[0xF3]; RequestedMaxLevel = data[0xF4]; Unknown1 = data[0xF5]; TrainerGender = (TrainerGenders)data[0xF6]; Unknown2 = data[0xF7]; TimeDeposited = GtsRecord4.TimestampToDate(BitConverter.ToUInt64(data, 0xF8)); TimeExchanged = GtsRecord4.TimestampToDate(BitConverter.ToUInt64(data, 0x100)); PID = BitConverter.ToInt32(data, 0x108); TrainerOT = BitConverter.ToUInt32(data, 0x10C); TrainerName = new EncodedString5(data, 0x110, 0x10); TrainerCountry = data[0x120]; TrainerRegion = data[0x121]; TrainerClass = data[0x122]; IsExchanged = data[0x123]; TrainerVersion = data[0x124]; TrainerLanguage = data[0x125]; TrainerBadges = data[0x126]; TrainerUnityTower = data[0x127]; }
public BattleSubwayProfile5(EncodedString5 name, Versions version, Languages language, byte country, byte region, uint ot, TrendyPhrase5 phrase_leader, byte gender, byte unknown) { if (name == null) { throw new ArgumentNullException("name"); } if (name.Size != 16) { throw new ArgumentException("name"); } if (phrase_leader == null) { throw new ArgumentNullException("phrase_leader"); } Name = name; // todo: clone Version = version; Language = language; Country = country; Region = region; OT = ot; PhraseLeader = phrase_leader; // todo: clone Gender = gender; Unknown = unknown; }
public BattleSubwayPokemon5(Pokedex.Pokedex pokedex, ushort species, ushort held_item, ushort move1, ushort move2, ushort move3, ushort move4, uint ot, uint personality, uint ivs, byte[] evs, byte pp_ups, Languages language, byte ability, byte happiness, EncodedString5 nickname, uint unknown2) : this(pokedex, species, held_item, new ushort[] { move1, move2, move3, move4 }, ot, personality, ivs, evs, pp_ups, language, ability, happiness, nickname, unknown2) { }
public void Load(byte[] data, int start) { if (start + 0x22 > data.Length) { throw new ArgumentOutOfRangeException("start"); } Name = new EncodedString5(data, start, 0x10); Version = (Versions)data[0x10 + start]; Language = (Languages)data[0x11 + start]; Country = data[0x12 + start]; Region = data[0x13 + start]; OT = BitConverter.ToUInt32(data, 0x14 + start); byte[] trendyPhrase = new byte[8]; Array.Copy(data, 0x18 + start, trendyPhrase, 0, 8); PhraseLeader = new TrendyPhrase5(trendyPhrase); Gender = data[0x20 + start]; Unknown = data[0x21 + start]; }
public BattleSubwayPokemon5(Pokedex.Pokedex pokedex, ushort species, ushort held_item, ushort[] moveset, uint ot, uint personality, uint ivs, byte[] evs, byte pp_ups, Languages language, byte ability, byte happiness, EncodedString5 nickname, uint unknown2) : base(pokedex) { if (moveset == null) { throw new ArgumentNullException("moveset"); } if (moveset.Length != 4) { throw new ArgumentException("moveset"); } if (evs == null) { throw new ArgumentNullException("evs"); } if (evs.Length != 6) { throw new ArgumentException("evs"); } if (nickname == null) { throw new ArgumentNullException("nickname"); } if (nickname.Size != 22) { throw new ArgumentException("nickname"); } SpeciesID = species; HeldItemID = held_item; GetMovesFromArray(Moves, pokedex, moveset, pp_ups); TrainerID = ot; Personality = personality; IVs = new IvStatValues((int)ivs & 0x3fffffff); IvFlags = ivs & 0xc0000000u; EVs = new ByteStatValues(evs); Language = language; AbilityID = ability; Happiness = happiness; NicknameEncoded = nickname; // todo: clone Unknown2 = unknown2; }
protected override void Load(BinaryReader reader) { // header (unencrypted) Personality = reader.ReadUInt32(); // 0000 ushort zero = reader.ReadUInt16(); // 0004 ushort checksum = reader.ReadUInt16(); // 0006 // read out the main payload, apply xor decryption byte[][] blocks = new byte[4][]; for (int x = 0; x < 4; x++) // 0008 { blocks[x] = reader.ReadBytes(32); } DecryptBlocks(blocks, checksum); ShuffleBlocks(blocks, Personality, true); IsBadEgg = ComputeChecksum(blocks) != checksum; int ribbons1, ribbons2, ribbons3; { byte[] block = blocks[0]; SpeciesID = BitConverter.ToUInt16(block, 0); HeldItemID = BitConverter.ToUInt16(block, 2); TrainerID = BitConverter.ToUInt32(block, 4); Experience = BitConverter.ToInt32(block, 8); Happiness = block[12]; AbilityID = block[13]; Markings = (Markings)block[14]; Language = (Languages)block[15]; EVs = new ByteStatValues(block[16], block[17], block[18], block[19], block[20], block[21]); ContestStats = new ConditionValues(block[22], block[23], block[24], block[25], block[26], block[27]); ribbons2 = BitConverter.ToInt32(block, 28); } { byte[] block = blocks[1]; Moves[0] = new MoveSlot(m_pokedex, BitConverter.ToUInt16(block, 0), block[12], block[8]); Moves[1] = new MoveSlot(m_pokedex, BitConverter.ToUInt16(block, 2), block[13], block[9]); Moves[2] = new MoveSlot(m_pokedex, BitConverter.ToUInt16(block, 4), block[14], block[10]); Moves[3] = new MoveSlot(m_pokedex, BitConverter.ToUInt16(block, 6), block[15], block[11]); int ivs = BitConverter.ToInt32(block, 16); IVs = new IvStatValues(ivs & 0x3fffffff); IsEgg = (ivs & 0x40000000) != 0; HasNickname = (ivs & 0x80000000) != 0; ribbons1 = BitConverter.ToInt32(block, 20); byte forme = block[24]; FatefulEncounter = (forme & 0x01) != 0; m_female = (forme & 0x02) != 0; m_genderless = (forme & 0x04) != 0; FormID = (byte)(forme >> 3); byte nature = block[25]; // todo: which nature is real? Do they both need to match? m_bw_flags = BitConverter.ToUInt16(block, 26); HiddenAbility = (m_bw_flags & 0x01) != 0; N = (m_bw_flags & 0x02) != 0; Unknown1 = BitConverter.ToUInt32(block, 28); EggLocationID_Plat = BitConverter.ToUInt16(block, 28); LocationID_Plat = BitConverter.ToUInt16(block, 30); } { byte[] block = blocks[2]; NicknameEncoded = new EncodedString5(block, 0, 22); Unknown2 = block[22]; Version = (Versions)block[23]; ribbons3 = BitConverter.ToInt32(block, 24); Unknown3 = BitConverter.ToUInt32(block, 28); } { byte[] block = blocks[3]; TrainerNameEncoded = new EncodedString5(block, 0, 16); EggDate = new byte[3]; Array.Copy(block, 16, EggDate, 0, 3); Date = new byte[3]; Array.Copy(block, 19, Date, 0, 3); EggLocationID = BitConverter.ToUInt16(block, 22); LocationID = BitConverter.ToUInt16(block, 24); byte pokerusStatus = block[26]; PokerusDaysLeft = (byte)(pokerusStatus & 0x0f); PokerusStrain = (byte)(pokerusStatus >> 4); PokeBallID = block[27]; byte encounter_level = block[28]; EncounterLevel = (byte)(encounter_level & 0x7f); bool trainerFemale = (encounter_level & 0x80) != 0; TrainerGender = trainerFemale ? TrainerGenders.Female : TrainerGenders.Male; EncounterType = block[29]; Unknown4 = BitConverter.ToUInt16(block, 30); } byte[] ribbons = new byte[12]; Array.Copy(BitConverter.GetBytes(ribbons1), 0, ribbons, 0, 4); Array.Copy(BitConverter.GetBytes(ribbons2), 0, ribbons, 4, 4); Array.Copy(BitConverter.GetBytes(ribbons3), 0, ribbons, 8, 4); Ribbons.Clear(); UnknownRibbons.Clear(); IDictionary <int, Ribbon> allRibbons = m_pokedex.Ribbons(Generations.Generation5); for (int x = 0; x < 96; x++) { if (PokemonPartyBase.HasRibbon(ribbons, x)) { if (allRibbons.ContainsKey(x)) { Ribbons.Add(allRibbons[x]); } else { UnknownRibbons.Add(x); } } } }