コード例 #1
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");
            }
        }
コード例 #2
0
 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;
     }
 }