diff --git a/PokemonManager.v11.suo b/PokemonManager.v11.suo index faf79f7..474252b 100644 Binary files a/PokemonManager.v11.suo and b/PokemonManager.v11.suo differ diff --git a/PokemonManager/Items/MailBox.cs b/PokemonManager/Items/MailBox.cs index 2453964..689121c 100644 --- a/PokemonManager/Items/MailBox.cs +++ b/PokemonManager/Items/MailBox.cs @@ -146,8 +146,8 @@ public void Reset() { listViewItems.Clear(); Mail defaultMail = new Mail(); - defaultMail.TrainerName = "TRIGGER"; - defaultMail.SetTrainerIDs(60000, 0); + defaultMail.TrainerName = "Trigger"; + defaultMail.SetTrainerIDs(45465, 28557); defaultMail.MailItemID = 130; defaultMail.OriginalHolderDexID = 197; diff --git a/PokemonManager/PokeManager.cs b/PokemonManager/PokeManager.cs index c69b74b..49678e1 100644 --- a/PokemonManager/PokeManager.cs +++ b/PokemonManager/PokeManager.cs @@ -24,8 +24,10 @@ using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; +using System.Windows.Documents; using System.Windows.Media; using System.Windows.Media.Imaging; +using System.Windows.Navigation; using System.Xml; namespace PokemonManager { @@ -2315,6 +2317,15 @@ public static bool CanSwitchPokemon(IPokemon pokemon) { public static bool CanSwitchShadowPokemon(IPokemon pokemon) { if (IsHoldingPokemon) { bool needsNewLocation = pokemon.IsShadowPokemon && pokemon.GameSave != holdPokemon.Container.GameSave; + if (holdPokemon.Container.GameSave.GameType == GameTypes.XD) { + if (pokemon.IsShadowPokemon && holdPokemon.Container.Type == ContainerTypes.Daycare) + needsNewLocation = true; + else if (pokemon.IsShadowPokemon && holdPokemon.Container.Type == ContainerTypes.Purifier && holdPokemon.Index > 0) + needsNewLocation = true; + else if (!pokemon.IsShadowPokemon && holdPokemon.Container.Type == ContainerTypes.Purifier && holdPokemon.Index == 0) + needsNewLocation = true; + } + for (int i = 0; i < pokemon.PokePC.NumBoxes && needsNewLocation; i++) { for (int j = 0; j < 30 && needsNewLocation; j++) { if (pokemon.PokePC[i][j] == null) { @@ -2330,6 +2341,8 @@ public static bool CanSwitchShadowPokemon(IPokemon pokemon) { public static bool CanSwitchEgg(IPokemon pokemon) { if (IsHoldingPokemon) { bool needsNewLocation = pokemon.IsEgg && (holdPokemon.Container.GameType == GameTypes.Colosseum || holdPokemon.Container.GameType == GameTypes.XD); + if (pokemon.IsEgg && holdPokemon.Container.Type == ContainerTypes.Daycare) + needsNewLocation = true; for (int i = 0; i < pokemon.PokePC.NumBoxes && needsNewLocation; i++) { for (int j = 0; j < 30 && needsNewLocation; j++) { if (pokemon.PokePC[i][j] == null) { @@ -2365,6 +2378,16 @@ public static void SwitchPokemon(IPokemon pokemon) { // Try to make the pokemon drop in the current game. It's only required for shadow Pokemon though. bool needsNewLocation = (pokemon.IsShadowPokemon && pokemon.GameSave != holdPokemon.Container.GameSave) || (pokemon.IsEgg && (holdPokemon.Container.GameType == GameTypes.Colosseum || holdPokemon.Container.GameType == GameTypes.XD)); + if (holdPokemon.Container.GameSave.GameType == GameTypes.XD) { + if (pokemon.IsShadowPokemon && holdPokemon.Container.Type == ContainerTypes.Daycare) + needsNewLocation = true; + else if (pokemon.IsShadowPokemon && holdPokemon.Container.Type == ContainerTypes.Purifier && holdPokemon.Index > 0) + needsNewLocation = true; + else if (!pokemon.IsShadowPokemon && holdPokemon.Container.Type == ContainerTypes.Purifier && holdPokemon.Index == 0) + needsNewLocation = true; + } + if (pokemon.IsEgg && holdPokemon.Container.Type == ContainerTypes.Daycare) + needsNewLocation = true; for (int i = 0; i < pokemon.PokePC.NumBoxes && needsNewLocation; i++) { for (int j = 0; j < 30 && needsNewLocation; j++) { if (pokemon.PokePC[i][j] == null) { @@ -2400,6 +2423,8 @@ public static void DropPokemon() { holdPokemon.Pokemon.IsMoving = false; if (holdPokemon.Container.Type == ContainerTypes.Party) ((IPokeParty)holdPokemon.Container).AddPokemon(holdPokemon.Pokemon); + else if (holdPokemon.Container.Type == ContainerTypes.Daycare && holdPokemon.Index < 2) + ((IDaycare)holdPokemon.Container).AddPokemon(holdPokemon.Pokemon); else if (holdPokemon.Container.Type == ContainerTypes.Purifier && holdPokemon.Index > 0) ((XDPurificationChamber)holdPokemon.Container).AddPokemon(holdPokemon.Pokemon); else diff --git a/PokemonManager/PokemonDatabase.db b/PokemonManager/PokemonDatabase.db index b0b96f5..0c286a0 100644 Binary files a/PokemonManager/PokemonDatabase.db and b/PokemonManager/PokemonDatabase.db differ diff --git a/PokemonManager/PokemonManager.csproj b/PokemonManager/PokemonManager.csproj index 4433d8b..2274b96 100644 --- a/PokemonManager/PokemonManager.csproj +++ b/PokemonManager/PokemonManager.csproj @@ -1421,6 +1421,7 @@ Always + diff --git a/PokemonManager/PokemonStructures/BoxPokemon.cs b/PokemonManager/PokemonStructures/BoxPokemon.cs index 0032e26..a116465 100644 --- a/PokemonManager/PokemonStructures/BoxPokemon.cs +++ b/PokemonManager/PokemonStructures/BoxPokemon.cs @@ -190,6 +190,8 @@ public BitmapSource Sprite { get { if (IsEgg) return PokemonDatabase.GetPokemonImageFromDexID(387, false); + if (DexID == 327) + return PokemonDatabase.GetSpindaSprite(Personality, IsShiny); return PokemonDatabase.GetPokemonImageFromDexID(DexID, IsShiny, FormID); } } diff --git a/PokemonManager/PokemonStructures/ColosseumDaycare.cs b/PokemonManager/PokemonStructures/ColosseumDaycare.cs index 7e6b2ed..316d767 100644 --- a/PokemonManager/PokemonStructures/ColosseumDaycare.cs +++ b/PokemonManager/PokemonStructures/ColosseumDaycare.cs @@ -85,6 +85,19 @@ public IPokemon this[int index] { throw new ArgumentOutOfRangeException("Index outside of bounds for Daycare", new Exception()); } } + public void AddPokemon(IPokemon pokemon) { + pokePC.GameSave.IsChanged = true; + IPokemon pkm = (pokemon != null ? (pokemon is ColosseumPokemon ? pokemon : pokemon.CreateColosseumPokemon(((GCGameSave)GameSave).CurrentRegion)): null); + pkm.GameType = GameType; + pkm.PokeContainer = this; + if (pokePC.GameSave != null) + pokePC.GameSave.OwnPokemon(pkm); + depositedPokemon = pkm as ColosseumPokemon; + depositedPokemon = pkm as ColosseumPokemon; + DaycareStatus = 1; + InitialLevel = 0; + InitialPurification = 0; + } public int IndexOf(IPokemon pokemon) { if (pokemon == depositedPokemon) return 0; diff --git a/PokemonManager/PokemonStructures/ColosseumPokemon.cs b/PokemonManager/PokemonStructures/ColosseumPokemon.cs index a887fa9..1ed8207 100644 --- a/PokemonManager/PokemonStructures/ColosseumPokemon.cs +++ b/PokemonManager/PokemonStructures/ColosseumPokemon.cs @@ -166,6 +166,8 @@ public BitmapSource Sprite { get { if (IsEgg) return PokemonDatabase.GetPokemonImageFromDexID(387, false); + if (DexID == 327) + return PokemonDatabase.GetSpindaSprite(Personality, IsShiny); return PokemonDatabase.GetPokemonImageFromDexID(DexID, IsShiny, FormID); } } diff --git a/PokemonManager/PokemonStructures/Events/PokemonEventDistribution.cs b/PokemonManager/PokemonStructures/Events/PokemonEventDistribution.cs index 312c359..8e702ec 100644 --- a/PokemonManager/PokemonStructures/Events/PokemonEventDistribution.cs +++ b/PokemonManager/PokemonStructures/Events/PokemonEventDistribution.cs @@ -60,7 +60,7 @@ public override void GenerateReward(IGameSave gameSave) { pkm.DexID = DexID; pkm.Personality = (Personality.HasValue ? Personality.Value : (uint)random.Next()); pkm.Experience = PokemonDatabase.GetExperienceFromLevel(pokemonData.ExperienceGroup, (IsEgg ? (byte)5 : Level)); - pkm.IsSecondAbility2 = (IsSecondAbility.HasValue ? IsSecondAbility.Value : (pokemonData.HasTwoAbilities && random.Next(2) == 1)); // TODO: TESTING + pkm.IsSecondAbility2 = (IsSecondAbility.HasValue ? IsSecondAbility.Value : (!pokemonData.CanOnlyHaveFirstAbility && random.Next(2) == 1)); pkm.Nickname = (Nickname != null ? Nickname : pokemonData.Name.ToUpper()); pkm.BallCaughtID = 4; pkm.MetLocationID = 255; diff --git a/PokemonManager/PokemonStructures/GBADaycare.cs b/PokemonManager/PokemonStructures/GBADaycare.cs index 708b603..122e872 100644 --- a/PokemonManager/PokemonStructures/GBADaycare.cs +++ b/PokemonManager/PokemonStructures/GBADaycare.cs @@ -163,6 +163,22 @@ public IPokemon this[int index] { } } } + public void AddPokemon(IPokemon pokemon) { + pokePC.GameSave.IsChanged = true; + IPokemon pkm = (pokemon != null ? (pokemon is GBAPokemon ? pokemon : pokemon.CreateGBAPokemon(GameType)): null); + int index = 0; + for (index = 0; index < 3; index++) { + if (originalPokemon[index] == null) + break; + } + pkm.GameType = GameType; + pkm.PokeContainer = this; + if (pokePC.GameSave != null) + pokePC.GameSave.SetPokemonOwned(pkm.DexID, true); + finalPokemon[index] = pkm as GBAPokemon; + originalPokemon[index] = pkm as GBAPokemon; + SetGainedExperience(index, 0); + } public int IndexOf(IPokemon pokemon) { for (int i = 0; i < finalPokemon.Length; i++) { if (finalPokemon[i] == pokemon) diff --git a/PokemonManager/PokemonStructures/GBAPokemon.cs b/PokemonManager/PokemonStructures/GBAPokemon.cs index 5295ec7..992333e 100644 --- a/PokemonManager/PokemonStructures/GBAPokemon.cs +++ b/PokemonManager/PokemonStructures/GBAPokemon.cs @@ -89,9 +89,10 @@ public GBAPokemon(byte[] data, bool decrypted = false) { else OpenEncryptedData(data); + // A pretty old bug, we don't really need this anymore. // Fix Colosseum Game Origin being incorrect. (Support for users of previous versions) - if ((byte)GameOrigin == 11) - GameOrigin = GameOrigins.ColosseumXD; + //if ((byte)GameOrigin == 11) + // GameOrigin = GameOrigins.ColosseumXD; } #region Basic Info diff --git a/PokemonManager/PokemonStructures/IDaycare.cs b/PokemonManager/PokemonStructures/IDaycare.cs index e7d5882..6c26caf 100644 --- a/PokemonManager/PokemonStructures/IDaycare.cs +++ b/PokemonManager/PokemonStructures/IDaycare.cs @@ -10,5 +10,6 @@ namespace PokemonManager.PokemonStructures { public interface IDaycare : IPokeContainer { uint GetWithdrawCost(int index); + void AddPokemon(IPokemon pokemon); } } diff --git a/PokemonManager/PokemonStructures/PokemonData.cs b/PokemonManager/PokemonStructures/PokemonData.cs index de0649b..fb9a46b 100644 --- a/PokemonManager/PokemonStructures/PokemonData.cs +++ b/PokemonManager/PokemonStructures/PokemonData.cs @@ -44,7 +44,8 @@ public PokemonData(DataRow row) { this.type2 = (row["Type2"] as string == null ? this.type1 : GetPokemonTypeFromString(row["Type2"] as string)); this.ability1ID = PokemonDatabase.GetAbilityIDFromString(row["Ability1"] as string); - this.ability2ID = (row["Ability2"] as string == null ? this.ability1ID : PokemonDatabase.GetAbilityIDFromString(row["Ability2"] as string)); + this.ability2ID = (row["Ability2"] as string == null ? (byte)0 : PokemonDatabase.GetAbilityIDFromString(row["Ability2"] as string)); + //this.ability2ID = (row["Ability2"] as string == null ? this.ability1ID : PokemonDatabase.GetAbilityIDFromString(row["Ability2"] as string)); this.eggGroup1 = GetEggGroupFromString(row["EggGroup1"] as string); this.eggGroup2 = GetEggGroupFromString(row["EggGroup2"] as string); @@ -132,6 +133,9 @@ public byte Ability2ID { public bool HasTwoAbilities { get { return ability1ID != ability2ID; } } + public bool CanOnlyHaveFirstAbility { + get { return ability2ID == 0; } + } public EggGroups EggGroup1 { get { return eggGroup1; } } diff --git a/PokemonManager/PokemonStructures/XDDaycare.cs b/PokemonManager/PokemonStructures/XDDaycare.cs index 2dd98b6..6685c13 100644 --- a/PokemonManager/PokemonStructures/XDDaycare.cs +++ b/PokemonManager/PokemonStructures/XDDaycare.cs @@ -85,6 +85,19 @@ public IPokemon this[int index] { throw new ArgumentOutOfRangeException("Index outside of bounds for Daycare", new Exception()); } } + public void AddPokemon(IPokemon pokemon) { + pokePC.GameSave.IsChanged = true; + IPokemon pkm = (pokemon != null ? (pokemon is XDPokemon ? pokemon : pokemon.CreateXDPokemon(((GCGameSave)GameSave).CurrentRegion)): null); + pkm.GameType = GameType; + pkm.PokeContainer = this; + if (pokePC.GameSave != null) + pokePC.GameSave.OwnPokemon(pkm); + depositedPokemon = pkm as XDPokemon; + depositedPokemon = pkm as XDPokemon; + DaycareStatus = 1; + InitialLevel = 0; + InitialPurification = 0; + } public int IndexOf(IPokemon pokemon) { if (pokemon == depositedPokemon) return 0; diff --git a/PokemonManager/PokemonStructures/XDPokemon.cs b/PokemonManager/PokemonStructures/XDPokemon.cs index 1325651..f429712 100644 --- a/PokemonManager/PokemonStructures/XDPokemon.cs +++ b/PokemonManager/PokemonStructures/XDPokemon.cs @@ -167,6 +167,8 @@ public BitmapSource Sprite { return ResourceDatabase.GetImageFromName("XD001FrontSprite"); if (IsEgg) return PokemonDatabase.GetPokemonImageFromDexID(387, false); + if (DexID == 327) + return PokemonDatabase.GetSpindaSprite(Personality, IsShiny); return PokemonDatabase.GetPokemonImageFromDexID(DexID, IsShiny, FormID); } } diff --git a/PokemonManager/Properties/AssemblyInfo.cs b/PokemonManager/Properties/AssemblyInfo.cs index b8893a2..325e48c 100644 --- a/PokemonManager/Properties/AssemblyInfo.cs +++ b/PokemonManager/Properties/AssemblyInfo.cs @@ -51,7 +51,7 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.4.5.5")] -[assembly: AssemblyFileVersion("1.4.5.5")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: GuidAttribute("d527114e-3888-417f-807f-e08fef41029c")] [assembly: NeutralResourcesLanguageAttribute("en")] diff --git a/PokemonManager/Properties/Resources.Designer.cs b/PokemonManager/Properties/Resources.Designer.cs index b300501..c702261 100644 --- a/PokemonManager/Properties/Resources.Designer.cs +++ b/PokemonManager/Properties/Resources.Designer.cs @@ -180,6 +180,16 @@ internal static System.Drawing.Bitmap BoxSelectorSummaryHover { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap BulbapediaIcon { + get { + object obj = ResourceManager.GetObject("BulbapediaIcon", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/PokemonManager/Properties/Resources.resx b/PokemonManager/Properties/Resources.resx index e0afd5e..96fc408 100644 --- a/PokemonManager/Properties/Resources.resx +++ b/PokemonManager/Properties/Resources.resx @@ -1270,4 +1270,7 @@ ..\Resources\Trainers\YoungsterMale.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\UI\Pokemon\BulbapediaIcon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/PokemonManager/Resources/UI/Pokemon/BulbapediaIcon.png b/PokemonManager/Resources/UI/Pokemon/BulbapediaIcon.png new file mode 100644 index 0000000..ee62135 Binary files /dev/null and b/PokemonManager/Resources/UI/Pokemon/BulbapediaIcon.png differ diff --git a/PokemonManager/Windows/AboutWindow.xaml b/PokemonManager/Windows/AboutWindow.xaml index e5c212d..a4e3a84 100644 --- a/PokemonManager/Windows/AboutWindow.xaml +++ b/PokemonManager/Windows/AboutWindow.xaml @@ -36,9 +36,16 @@