Beispiel #1
0
        public static Item ShowDialog(Window owner, ushort[] validItemIDs, ItemTypes[] pocketTypes, string windowName, string buttonName, bool pcDefault)
        {
            SelectItemWindow window = new SelectItemWindow(validItemIDs, pocketTypes, windowName, buttonName, pcDefault);

            window.Owner = owner;
            var result = window.ShowDialog();

            if (result != null && result.Value)
            {
                return(window.selectedItem);
            }
            return(null);
        }
Beispiel #2
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;
                    }
                }
            }
        }