private void OnWindowClosing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     PokeManager.ManagerGameSave.TrainerGender = trainerGender;
     byte[] trainerNameBytes = GBACharacterEncoding.GetBytes(trainerName, 7);
     PokeManager.ManagerGameSave.TrainerName = GBACharacterEncoding.GetString(trainerNameBytes);
     PokeManager.RefreshUI();
 }
Exemple #2
0
 public override void GiveReward(IGameSave gameSave)
 {
     gameSave.Money -= Cost;
     gameSave.PokePC.PlacePokemonInNextAvailableSlot(0, 0, reward);
     PokeManager.ManagerWindow.GotoPokemon(reward);
     PokeManager.RefreshUI();
 }
        private void OKClicked(object sender, RoutedEventArgs e)
        {
            amount = Math.Min(amount, Math.Min((int)GetCurrency(SendFromGameIndex), (int)GetMaxCurrency(SendToGameIndex) - (int)GetCurrency(SendToGameIndex)));
            ChangeCurrency(SendFromGameIndex, -amount);
            ChangeCurrency(SendToGameIndex, amount);

            PokeManager.RefreshUI();

            DialogResult = true;
        }
Exemple #4
0
        private void OKClicked(object sender, RoutedEventArgs e)
        {
            Move move = new Move(newMoveID);

            if (selectedIndex >= 0 && selectedIndex < 4)
            {
                pokemon.SetMoveAt(selectedIndex, move);
            }

            PokeManager.RefreshUI();
            DialogResult = true;
        }
Exemple #5
0
        public void OnRowSwitch(PokemonBoxViewer caller)
        {
            if (PokeManager.IsHoldingPokemon || PokeManager.HasSelection)
            {
                PokeManager.DropAll();
                PokeManager.ClearSelectedPokemon();
                PokeManager.RefreshUI();
            }

            if (!PokeManager.Settings.AllowDoubleBoxRows)
            {
                int callerIndex = GetIndex(caller);
                PokemonBoxViewer[] priorities = new PokemonBoxViewer[3];
                boxViewer1.SupressIndexChanged = true;
                boxViewer2.SupressIndexChanged = true;
                boxViewer3.SupressIndexChanged = true;

                priorities[0] = caller;
                if (callerIndex == 1)
                {
                    if (IsValid(boxViewer2, caller) || !IsValid(boxViewer3, caller))
                    {
                        priorities[1] = boxViewer2;
                        priorities[2] = boxViewer3;
                    }
                    else
                    {
                        priorities[1] = boxViewer3;
                        priorities[2] = boxViewer2;
                    }
                }
                else if (callerIndex == 2)
                {
                    priorities[1] = boxViewer1;
                    priorities[2] = boxViewer3;
                }
                else
                {
                    priorities[1] = boxViewer1;
                    priorities[2] = boxViewer2;
                }

                MakeValid(priorities[1], priorities[0]);
                MakeValid(priorities[2], priorities[0], priorities[1]);

                boxViewer1.SupressIndexChanged = false;
                boxViewer2.SupressIndexChanged = false;
                boxViewer3.SupressIndexChanged = false;
            }
            else
            {
            }
        }
 private void OKClicked(object sender, RoutedEventArgs e)
 {
     pokeBox.Name      = newName;
     pokeBox.Wallpaper = (PokeBoxWallpapers)newWallpaper;
     if (pokeBox is ManagerPokeBox)
     {
         ManagerPokeBox.UsingCustomWallpaper = newUsingCustomWallpaper;
         ManagerPokeBox.WallpaperName        = newWallpaperName;
     }
     if (!silentEdit)
     {
         PokeManager.RefreshUI();
     }
     DialogResult = true;
 }
Exemple #7
0
        private void FinishEvolution()
        {
            evolved = true;

            storyboard.Stop(this);
            if (playerCry != null)
            {
                playerCry.Stop();
            }
            playerMusic.Stop();
            evolutionState = 4;

            // Make sure everything looks correct
            imagePrevolution.Visibility    = Visibility.Hidden;
            rectMaskPrevolution.Visibility = Visibility.Hidden;
            rectMaskEvolution.Visibility   = Visibility.Hidden;
            rectGlow.Visibility            = Visibility.Hidden;
            rectBlackCover.Visibility      = Visibility.Hidden;
            ((imageEvolution.RenderTransform as TransformGroup).Children[1] as ScaleTransform).ScaleX = 1;
            ((imageEvolution.RenderTransform as TransformGroup).Children[1] as ScaleTransform).ScaleY = 1;

            // Setup correct controls
            this.textBlockMessage.Text         = "Congratulations!\nYour " + pokemon.Nickname + " evolved into " + EvolutionData.Name + "!";
            this.gridControlButtons.Visibility = Visibility.Hidden;
            this.buttonClose.Visibility        = Visibility.Visible;
            if (!pokemon.HasNickname)
            {
                pokemon.Nickname = EvolutionData.Name.ToUpper();
            }
            pokemon.DexID = evolutionDexID;
            pokemon.RecalculateStats();

            if (evolutionDexID == 291)
            {
                IPokemon shedinja = pokemon.Clone();
                shedinja.DexID = 292;
                shedinja.RemoveNickname();
                shedinja.RecalculateStats();
                if (pokemon.PokePC.HasRoomForPokemon(1))
                {
                    shedinjaAdded = true;
                    pokemon.PokePC.PlacePokemonInNextAvailableSlot(pokemon.PokeContainer is IPokeBox ? (int)(pokemon.PokeContainer as IPokeBox).BoxNumber : -1, pokemon.ContainerIndex, shedinja);
                }
            }
            pokemon.GameSave.IsChanged = true;
            PokeManager.RefreshUI();
        }
        private void OKClicked(object sender, RoutedEventArgs e)
        {
            for (int i = 0; i < 4; i++)
            {
                if (i < moves.Count)
                {
                    pokemon.SetMoveAt(i, (Move)moves[i].Tag);
                }
                else
                {
                    pokemon.SetMoveAt(i, new Move());
                }
            }

            PokeManager.RefreshUI();
            DialogResult = true;
        }
 private void OnEnterPressed(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         DialogResult      = true;
         newName           = textBoxName.Text;
         pokeBox.Name      = newName;
         pokeBox.Wallpaper = (PokeBoxWallpapers)newWallpaper;
         if (pokeBox is ManagerPokeBox)
         {
             ManagerPokeBox.UsingCustomWallpaper = newUsingCustomWallpaper;
             ManagerPokeBox.WallpaperName        = newWallpaperName;
         }
         PokeManager.RefreshUI();
         Close();
     }
 }
Exemple #10
0
        private void OnSendToClicked(object sender, RoutedEventArgs e)
        {
            IPokemon pokemon = clickSelection.Tag as IPokemon;

            if (pokemon.ContainerIndex == -1)
            {
                pokemon            = pokemon.PokemonFinder.Pokemon;
                clickSelection.Tag = pokemon;
            }
            if (pokemon.IsReleased)
            {
                TriggerMessageBox.Show(this, "Cannot send this Pokémon, it has been released", "Released Pokémon");
            }
            else if (pokemon.IsMoving)
            {
                TriggerMessageBox.Show(this, "Cannot send a Pokémon while it is being moved", "Moving Pokémon");
            }
            else if (pokemon.ContainerIndex == -1)
            {
                TriggerMessageBox.Show(this, "The Search Results have lost track of " + pokemon.Nickname + " because it has been moved to a different game. This should not happen. Let me know if it does.", "Can't Find Pokémon");
            }

            /*else if (pokemon.PokeContainer.Type == ContainerTypes.Purifier) {
             *      TriggerMessageBox.Show(this, "Cannot send Pokémon in the Purifier", "Can't Send");
             * }*/
            else if (pokemon.IsShadowPokemon)
            {
                TriggerMessageBox.Show(this, "Cannot send Shadow Pokémon to other games", "Can't Send");
            }
            else if (PokeManager.CanPickupPokemon(pokemon))
            {
                SendPokemonToWindow.ShowSendToDialog(PokeManager.ManagerWindow, pokemon.PokePC.GameIndex, pokemon);
                PokeManager.RefreshUI();
            }
            else if (PokeManager.IsPartyHoldingMail(pokemon.PokeContainer))
            {
                TriggerMessageBox.Show(this, "Cannot send that Pokémon. One of the Pokémon in your party is holding mail. To remove the mail goto the mailbox tab and click Take Mail From Party", "Can't Send");
            }
            else
            {
                TriggerMessageBox.Show(this, "Cannot send that Pokémon. It is the last valid Pokémon in your party", "Can't Send");
            }
        }
Exemple #11
0
        private void OnWindowClosing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (playerCry != null)
            {
                playerCry.Close();
            }
            if (playerEvolutionCry != null)
            {
                playerEvolutionCry.Close();
            }
            playerMusic.Close();

            ushort[] moves = PokemonDatabase.GetMovesLearnedAtLevel(pokemon);
            foreach (ushort moveID in moves)
            {
                Move move = new Move(moveID);
                if (pokemon.NumMoves == 4)
                {
                    var result = LearnMoveWindow.ShowDialog(Window.GetWindow(this), pokemon, move.ID);
                    if (result.HasValue && result.Value)
                    {
                        TriggerMessageBox.Show(this, pokemon.Nickname + " learned " + move.MoveData.Name + "!", "Move Learned");
                        PokeManager.RefreshUI();
                    }
                }
                else
                {
                    pokemon.SetMoveAt(pokemon.NumMoves, move);
                    TriggerMessageBox.Show(this, pokemon.Nickname + " learned " + move.MoveData.Name + "!", "Move Learned");
                    PokeManager.RefreshUI();
                }
            }

            if (shedinjaAdded)
            {
                TriggerMessageBox.Show(PokeManager.ManagerWindow, "A Shedinja has appeared from the shed exoskeleton of " + pokemon.Nickname, "New Pokémon");
            }
        }
Exemple #12
0
        private void OKClicked(object sender, RoutedEventArgs e)
        {
            ushort[] validItemIDs = new ushort[] { 103, 104, 111 };

            Item item = SelectItemWindow.ShowDialog(this, validItemIDs, new ItemTypes[] { ItemTypes.Items }, "Hand Over Valuable", "Hand Over", true);

            if (item != null)
            {
                if (item.ID == 103 && item.Count < 2)
                {
                    TriggerMessageBox.Show(this, "2 " + item.ItemData.Name + "s are needed to learn a move. You don't have enough", "Not Enough");
                }
                else
                {
                    if (pokemon.NumMoves == 4)
                    {
                        var result = LearnMoveWindow.ShowDialog(this, pokemon, selectedMove.ID);
                        if (result.HasValue && result.Value)
                        {
                            item.Pocket.TossItemAt(item.Pocket.IndexOf(item), (uint)(item.ID == 103 ? 2 : 1));
                            TriggerMessageBox.Show(this, pokemon.Nickname + " learned " + selectedMove.MoveData.Name + "!", "Move Learned");
                            PokeManager.RefreshUI();
                            DialogResult = true;
                        }
                    }
                    else
                    {
                        pokemon.SetMoveAt(pokemon.NumMoves, selectedMove);
                        item.Pocket.TossItemAt(item.Pocket.IndexOf(item), (uint)(item.ID == 103 ? 2 : 1));
                        TriggerMessageBox.Show(this, pokemon.Nickname + " learned " + selectedMove.MoveData.Name + "!", "Move Learned");
                        PokeManager.RefreshUI();
                        DialogResult = true;
                    }
                }
            }
        }
 private void OnPokemonSelected(object sender, PokemonSelectedEventArgs e)
 {
     if (mode == SendPokemonModes.GiveItem && ((PokeBoxControl)sender).IsPickupMode && e.Pokemon != null)
     {
         if (e.Pokemon.IsEgg)
         {
             TriggerMessageBox.Show(this, "Cannot give items to Eggs", "Can't Hold");
         }
         else if (e.Pokemon.HeldItemID != 0 && e.Pokemon.HeldItemData.ID == 0)
         {
             TriggerMessageBox.Show(this, "Cannot switch " + e.Pokemon.Nickname + "'s item because it is an Unknown Item", "Unknown Item");
         }
         else if (e.Pokemon.HeldItemID == giveItem.ID)
         {
             TriggerMessageBox.Show(this, e.Pokemon.Nickname + " is already holding " + e.Pokemon.HeldItemData.Name, "Already Holding");
         }
         else
         {
             MessageBoxResult result = MessageBoxResult.Yes;
             if (e.Pokemon.IsHoldingMail)
             {
                 result = MessageBoxResult.No;
                 TriggerMessageBox.Show(this, "Cannot give " + giveItem.ItemData.Name + " to this Pokémon because it is holding mail. To remove the mail goto the mailbox tab and click Take Mail From Party", "Can't Give Item");
             }
             else if (e.Pokemon.IsHoldingItem)
             {
                 result = TriggerMessageBox.Show(this, e.Pokemon.Nickname + " is already holding " + e.Pokemon.HeldItemData.Name + ", would you like to switch it with " + giveItem.ItemData.Name + "?", "Switch Items", MessageBoxButton.YesNo);
                 if (result == MessageBoxResult.Yes)
                 {
                     PokeManager.ManagerGameSave.Inventory.Items[e.Pokemon.HeldItemData.PocketType].AddItem(e.Pokemon.HeldItemID, 1);
                 }
             }
             if (result == MessageBoxResult.Yes)
             {
                 e.Pokemon.HeldItemID = giveItem.ID;
                 giveItem.Pocket.TossItemAt(giveItem.Pocket.IndexOf(giveItem), 1);
                 TriggerMessageBox.Show(Window.GetWindow(this), "Gave " + giveItem.ItemData.Name + " to " + e.Pokemon.Nickname, "Gave Item");
                 PokeManager.RefreshUI();
                 PokeManager.LastGameInDialogIndex = gameIndex;
                 DialogResult = true;
             }
         }
     }
     else if (mode == SendPokemonModes.SendTo && e.Pokemon == null)
     {
         if (!PokeManager.CanSafelyPlaceHeldUnknownItem(e.PokeContainer))
         {
             MessageBoxResult unknownItemResult = TriggerMessageBox.Show(Window.GetWindow(this), "The Pokémon that you are trying to send is holding an Unknown Item. Sending it to a different game may cause problems. Are you sure you want to send it?", "Unknown Item", MessageBoxButton.YesNo);
             if (unknownItemResult == MessageBoxResult.No)
             {
                 return;
             }
         }
         PokeManager.PlacePokemon(e.PokeContainer, e.Index);
         PokeManager.LastGameInDialogIndex = gameIndex;
         DialogResult = true;
     }
     else if (mode == SendPokemonModes.SendFrom && e.Pokemon != null)
     {
         if (e.Pokemon.HeldItemID != 0 && e.Pokemon.HeldItemData.ID == 0 && e.Pokemon.GameSave != container.GameSave)
         {
             MessageBoxResult unknownItemResult = TriggerMessageBox.Show(Window.GetWindow(this), "That Pokémon is holding an Unknown Item. Sending it to a different game may cause problems. Are you sure you want to send it?", "Unknown Item", MessageBoxButton.YesNo);
             if (unknownItemResult == MessageBoxResult.No)
             {
                 return;
             }
         }
         if (PokeManager.CanPickupPokemon(e.Pokemon))
         {
             PokeManager.PickupPokemon(e.Pokemon, null);
             PokeManager.PlacePokemon(container, containerIndex);
             PokeManager.LastGameInDialogIndex = gameIndex;
             DialogResult = true;
         }
         else if (PokeManager.IsPartyHoldingMail(e.PokeContainer))
         {
             TriggerMessageBox.Show(Window.GetWindow(this), "Cannot send that Pokémon. A Pokémon in your party is holding mail. To remove the mail goto the mailbox tab and click Take Mail From Party", "Can't Send");
         }
         else
         {
             TriggerMessageBox.Show(Window.GetWindow(this), "Cannot send that Pokémon. It is the last valid Pokémon in your party", "Can't Send");
         }
     }
     else if (mode == SendPokemonModes.SendMulti && e.Pokemon == null)
     {
         if (!PokeManager.CanSafelyPlaceHeldUnknownItem(e.PokeContainer))
         {
             MessageBoxResult unknownItemResult = TriggerMessageBox.Show(Window.GetWindow(this), "A Pokémon that you are trying to send is holding an Unknown Item. Sending it to a different game may cause problems. Are you sure you want to send it?", "Unknown Item", MessageBoxButton.YesNo);
             if (unknownItemResult == MessageBoxResult.No)
             {
                 return;
             }
         }
         if (e.PokeContainer.PokePC.HasRoomForPokemon(PokeManager.NumSelectedPokemon))
         {
             PokeManager.PlaceSelection(e.PokeContainer, e.Index);
             PokeManager.ClearSelectedPokemon();
             PokeManager.LastGameInDialogIndex = gameIndex;
             DialogResult = true;
         }
         else
         {
             TriggerMessageBox.Show(Window.GetWindow(this), "Not enough room in game to store all selected Pokémon", "No Room");
         }
     }
     else if (mode == SendPokemonModes.SelectPokemon && e.Pokemon != null && ((PokeBoxControl)sender).IsPickupMode && (!e.Pokemon.IsEgg || !noEggs) && !e.Pokemon.IsShadowPokemon)
     {
         pokemon      = e.Pokemon;
         DialogResult = true;
     }
 }
Exemple #14
0
 private void OnWindowClosing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     PokeManager.SaveSettings();
     PokeManager.RefreshUI();
 }
Exemple #15
0
 private void OKClicked(object sender, RoutedEventArgs e)
 {
     deoxys.DeoxysForm = form;
     PokeManager.RefreshUI();
     DialogResult = true;
 }
        private void OnSaveClicked(object sender, RoutedEventArgs e)
        {
            byte[] trainerNameBytes = GBACharacterEncoding.GetBytes(trainerName, 7);
            string newTrainerName   = GBACharacterEncoding.GetString(trainerNameBytes);
            bool   setName          = newTrainerName != gameSave.TrainerName;
            bool   setGender        = trainerGender != gameSave.TrainerGender;

            if (setName || setGender)
            {
                MessageBoxResult result = TriggerMessageBox.Show(this, "Warning: Renaming a trainer or changing their gender will also change the OT Trainer of every Pokémon caught by this trainer in all saves. Are you sure you want to continue?", "Warning", MessageBoxButton.YesNo);
                //if (result == MessageBoxResult.Yes && (gameSave.GameType == GameTypes.Ruby || gameSave.GameType == GameTypes.Sapphire || gameSave.GameType == GameTypes.Emerald))
                //	result = TriggerMessageBox.Show(this, "Warning: Certain scripts may act incorrectly if you change your gender. This includes after you beat the Elite Four where you will get stuck in a wall. Are you sure you want to continue?", "Warning", MessageBoxButton.YesNo);

                if (result == MessageBoxResult.Yes)
                {
                    if (setName)
                    {
                        gameSave.TrainerName = GBACharacterEncoding.CheckString(newTrainerName, gameSave.IsJapanese ? Languages.Japanese : Languages.English);
                    }
                    if (setGender)
                    {
                        gameSave.TrainerGender = trainerGender;
                    }

                    for (int i = -1; i < PokeManager.NumGameSaves; i++)
                    {
                        IGameSave newGameSave = PokeManager.GetGameSaveAt(i);
                        if (newGameSave is ManagerGameSave)
                        {
                            for (int j = 0; j < (newGameSave as ManagerGameSave).NumPokePCRows; j++)
                            {
                                foreach (IPokemon pokemon in (newGameSave as ManagerGameSave).GetPokePCRow(j))
                                {
                                    if (pokemon.TrainerID == gameSave.TrainerID && pokemon.SecretID == gameSave.SecretID)
                                    {
                                        if (setName)
                                        {
                                            pokemon.TrainerName = newTrainerName;
                                        }
                                        if (setGender)
                                        {
                                            pokemon.TrainerGender = trainerGender;
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            foreach (IPokemon pokemon in newGameSave.PokePC)
                            {
                                if (pokemon.TrainerID == gameSave.TrainerID && pokemon.SecretID == gameSave.SecretID)
                                {
                                    if (setName)
                                    {
                                        pokemon.TrainerName = newTrainerName;
                                    }
                                    if (setGender)
                                    {
                                        pokemon.TrainerGender = trainerGender;
                                    }
                                }
                            }
                        }
                    }
                    gameSave.IsChanged = true;
                    PokeManager.RefreshUI();
                }
            }
            DialogResult = true;
        }
Exemple #17
0
 private void OKClicked(object sender, RoutedEventArgs e)
 {
     pokemon.Markings = markings;
     PokeManager.RefreshUI();
     DialogResult = true;
 }
Exemple #18
0
        public void OnGameSwitch(PokemonBoxViewer caller = null)
        {
            if (PokeManager.IsHoldingPokemon || PokeManager.HasSelection)
            {
                PokeManager.DropAll();
                PokeManager.ClearSelectedPokemon();
                PokeManager.RefreshUI();
            }

            if (!PokeManager.Settings.AllowDoubleBoxRows)
            {
                if (caller == null)
                {
                    caller = boxViewer1;
                }
                int callerIndex = GetIndex(caller);
                PokemonBoxViewer[] priorities = new PokemonBoxViewer[3];
                boxViewer1.SupressIndexChanged = true;
                boxViewer2.SupressIndexChanged = true;
                boxViewer3.SupressIndexChanged = true;

                priorities[0] = boxViewer1;
                if (callerIndex == 1)
                {
                    if (IsValid(boxViewer2, caller) || !IsValid(boxViewer3, caller))
                    {
                        priorities[1] = boxViewer2;
                        priorities[2] = boxViewer3;
                    }
                    else
                    {
                        priorities[1] = boxViewer3;
                        priorities[2] = boxViewer2;
                    }

                    boxViewer2.ComboBoxGames.ResetGameSaveVisibility();
                    boxViewer3.ComboBoxGames.ResetGameSaveVisibility();
                    if (GetNumRows(caller) == 1)
                    {
                        boxViewer2.ComboBoxGames.SetGameSaveVisible(GameIndex, false);
                        boxViewer3.ComboBoxGames.SetGameSaveVisible(GameIndex, false);
                    }
                }
                else if (callerIndex == 2)
                {
                    if (GetNumRows(caller) > 2)
                    {
                        priorities[1] = boxViewer3;
                        priorities[2] = boxViewer2;
                    }
                    else
                    {
                        priorities[1] = boxViewer2;
                        priorities[2] = boxViewer3;
                    }
                    //FindAvailableRow(priorities[1], priorities[1]);
                }
                else
                {
                    if (GetNumRows(caller) > 2)
                    {
                        priorities[1] = boxViewer2;
                        priorities[2] = boxViewer3;
                    }
                    else
                    {
                        priorities[1] = boxViewer3;
                        priorities[2] = boxViewer2;
                    }
                    //FindAvailableRow(priorities[1], priorities[1]);
                }

                MakeValid(priorities[1], priorities[0]);
                MakeValid(priorities[2], priorities[0], priorities[1]);

                boxViewer1.SupressIndexChanged = false;
                boxViewer2.SupressIndexChanged = false;
                boxViewer3.SupressIndexChanged = false;
            }
            else
            {
                boxViewer2.ComboBoxGames.ResetGameSaveVisibility();
                boxViewer3.ComboBoxGames.ResetGameSaveVisibility();
            }
        }