From a49b764bc0a34a35726c8ea92656b141c7dd4a70 Mon Sep 17 00:00:00 2001 From: Greg Edwards Date: Mon, 20 Apr 2015 21:11:56 -0400 Subject: [PATCH] Moved a bunch of common fields over to GtsRecordBase. --- library/Structures/GtsRecord4.cs | 42 -------------------------- library/Structures/GtsRecord5.cs | 46 +---------------------------- library/Structures/GtsRecordBase.cs | 44 +++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 87 deletions(-) diff --git a/library/Structures/GtsRecord4.cs b/library/Structures/GtsRecord4.cs index 94526fbd..6e03530f 100644 --- a/library/Structures/GtsRecord4.cs +++ b/library/Structures/GtsRecord4.cs @@ -52,42 +52,9 @@ namespace PkmnFoundations.Structures /// public byte[] Data; - /// - /// National Dex species number - /// - public ushort Species; - - /// - /// Pokémon gender - /// - public Genders Gender; - - /// - /// Pokémon level - /// - public byte Level; - - /// - /// Requested National Dex species number - /// - public ushort RequestedSpecies; - - public Genders RequestedGender; - - public byte RequestedMinLevel; - public byte RequestedMaxLevel; public byte Unknown1; - public TrainerGenders TrainerGender; public byte Unknown2; - public DateTime ? TimeDeposited; - public DateTime ? TimeExchanged; - - /// - /// User ID of the player (not Personality Value) - /// - public int PID; - /// /// 16 bytes /// @@ -95,15 +62,6 @@ namespace PkmnFoundations.Structures public ushort TrainerOT; - public byte TrainerCountry; - public byte TrainerRegion; - public byte TrainerClass; - - public byte IsExchanged; - - public byte TrainerVersion; - public byte TrainerLanguage; - protected override void Save(BinaryWriter writer) { // todo: enclose in properties and validate these when assigning. diff --git a/library/Structures/GtsRecord5.cs b/library/Structures/GtsRecord5.cs index 51ed5100..79b7e077 100644 --- a/library/Structures/GtsRecord5.cs +++ b/library/Structures/GtsRecord5.cs @@ -47,49 +47,14 @@ namespace PkmnFoundations.Structures } - // xxx: Data and Unknown0 should be one field. - /// - /// Obfuscated Pokémon (pkm) data. 220 bytes + /// Obfuscated Pokémon (pkm) data. 236 bytes /// public byte[] Data; - /// - /// National Dex species number - /// - public ushort Species; - - /// - /// Pokémon gender - /// - public Genders Gender; - - /// - /// Pokémon level - /// - public byte Level; - - /// - /// Requested National Dex species number - /// - public ushort RequestedSpecies; - - public Genders RequestedGender; - - public byte RequestedMinLevel; - public byte RequestedMaxLevel; public byte Unknown1; - public TrainerGenders TrainerGender; public byte Unknown2; - public DateTime ? TimeDeposited; - public DateTime ? TimeExchanged; - - /// - /// User ID of the player (not Personality Value) - /// - public int PID; - public uint TrainerOT; /// @@ -97,15 +62,6 @@ namespace PkmnFoundations.Structures /// public EncodedString5 TrainerName; - public byte TrainerCountry; - public byte TrainerRegion; - public byte TrainerClass; - - public byte IsExchanged; - - public byte TrainerVersion; - public byte TrainerLanguage; - public byte TrainerBadges; // speculative. Usually 8. public byte TrainerUnityTower; diff --git a/library/Structures/GtsRecordBase.cs b/library/Structures/GtsRecordBase.cs index a2928b66..1f0bb665 100644 --- a/library/Structures/GtsRecordBase.cs +++ b/library/Structures/GtsRecordBase.cs @@ -25,6 +25,50 @@ namespace PkmnFoundations.Structures } } + /// + /// National Dex species number + /// + public ushort Species; + + /// + /// Pokémon gender + /// + public Genders Gender; + + /// + /// Pokémon level + /// + public byte Level; + + /// + /// Requested National Dex species number + /// + public ushort RequestedSpecies; + + public Genders RequestedGender; + + public byte RequestedMinLevel; + public byte RequestedMaxLevel; + + public TrainerGenders TrainerGender; + + public DateTime? TimeDeposited; + public DateTime? TimeExchanged; + + /// + /// User ID of the player (not Personality Value) + /// + public int PID; + + public byte TrainerCountry; + public byte TrainerRegion; + public byte TrainerClass; + + public byte IsExchanged; + + public byte TrainerVersion; + public byte TrainerLanguage; + public static bool CheckLevels(byte min, byte max, byte other) { if (max == 0) max = 255;