private void OnPurifierPreviousClicked(object sender, RoutedEventArgs e) { chamberIndex--; if (chamberIndex < 0) chamberIndex = 8; UnhighlightPokemon(); PokemonSelectedEventArgs args = new PokemonSelectedEventArgs(); args.Index = 0; args.PokeContainer = pokeContainer; args.Pokemon = pokeContainer[0]; OnPokemonSelected(args); RefreshUI(true); }
private void OnPokemonSelected(object sender, PokemonSelectedEventArgs e) { gotoPokemon = null; }
private void OnPokemonSelected(PokemonSelectedEventArgs e) { if (PokemonSelected != null) { PokemonSelected(this, e); } }
private void OnContextMenuSendToClicked(object sender, RoutedEventArgs e) { PokemonSelectedEventArgs args = new PokemonSelectedEventArgs(); if (master != null) master.OnPokemonSelected(args); if (pokeContainer[selectedIndex] != null && PokeManager.IsPokemonSelected(pokeContainer[selectedIndex])) { if (PokeManager.SelectionHasShadowPokemon) { TriggerMessageBox.Show(Window.GetWindow(this), "Cannot send Shadow Pokémon to other games", "Can't Send"); } else { SendPokemonToWindow.ShowSendMultiDialog(Window.GetWindow(this), pokeContainer.GameIndex); PokeManager.RefreshUI(); } } else if (pokeContainer[selectedIndex] != null) { if (PokeManager.CanPickupPokemon(pokeContainer[selectedIndex])) { SendPokemonToWindow.ShowSendToDialog(Window.GetWindow(this), pokeContainer.GameIndex, pokeContainer[selectedIndex]); PokeManager.RefreshUI(); } else if (PokeManager.IsPartyHoldingMail(pokeContainer)) { TriggerMessageBox.Show(Window.GetWindow(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(Window.GetWindow(this), "Cannot send that Pokémon. It is the last valid Pokémon in your party", "Can't Send"); } } else { SendPokemonToWindow.ShowSendFromDialog(Window.GetWindow(this), pokeContainer.GameIndex, pokeContainer, selectedIndex); PokeManager.RefreshUI(); } }
private void OnContextMenuSendBoxTo(object sender, RoutedEventArgs e) { PokemonSelectedEventArgs args = new PokemonSelectedEventArgs(); master.OnPokemonSelected(args); PokeManager.DropAll(); PokeManager.ClearSelectedPokemon(); ManagerPokePC pokePC = PokeManager.ManagerGameSave.PokePC as ManagerPokePC; for (int i = 0; i < pokePC.NumBoxes; i++) { if (pokePC[i].IsEmpty) { for (int j = 0; j < 30; j++) { pokePC[i][j] = pokeContainer[j]; pokeContainer[j] = null; } break; } } RefreshUI(); }
private void OnBoxSlotClicked(object sender, MouseButtonEventArgs e) { if (pokeContainer == null) return; if (master != null) { master.OnBoxSlotClicked(sender, e); return; } this.imageDaycareHighlighter.Visibility = Visibility.Hidden; this.imageBoxHighlighter.Visibility = Visibility.Hidden; this.imagePartyHighlighter.Visibility = Visibility.Hidden; this.imagePurifierHighlighter.Visibility = Visibility.Hidden; foreach (PokeBoxControl slave in slaves) { slave.imageDaycareHighlighter.Visibility = Visibility.Hidden; slave.imageBoxHighlighter.Visibility = Visibility.Hidden; slave.imagePartyHighlighter.Visibility = Visibility.Hidden; slave.imagePurifierHighlighter.Visibility = Visibility.Hidden; } Rectangle selector = sender as Rectangle; PokeBoxTagStructure tag = selector.Tag as PokeBoxTagStructure; IPokemon pkm = tag.Control.pokeContainer[tag.BoxIndex]; if (e.ChangedButton == MouseButton.Left) { if (pkm != null && pokemonViewer != null) pokemonViewer.LoadPokemon(pkm); PokemonSelectedEventArgs args = new PokemonSelectedEventArgs(); args.PokeContainer = tag.Control.pokeContainer; args.Index = tag.BoxIndex; args.Pokemon = pkm; OnPokemonSelected(args); if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)) { TrySelectPokemon(tag); } else { if (!PokeManager.IsHoldingPokemon && (pkm == null || !PokeManager.IsPokemonSelected(pkm) || !pickupMode)) { PokeManager.ClearSelectedPokemon(); RefreshUI(); } if (pickupMode) TryMovePokemon(tag); } } else if (e.ChangedButton == MouseButton.Middle) { if (canChangePickupMode) { IsPickupMode = !IsPickupMode; } } }
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; } }