Esempio n. 1
0
        private void OnReplaceBallClick(object sender, RoutedEventArgs e)
        {
            if (pokemon.BallCaughtID == 1 || pokemon.BallCaughtID == 5 || pokemon.BallCaughtID == 11)
            {
                MessageBoxResult boxResult = TriggerMessageBox.Show(Window.GetWindow(this), pokemon.Nickname + " is caught in a rare ball, are you sure you want to replace it?", "Replace Ball", MessageBoxButton.YesNo);
                if (boxResult == MessageBoxResult.No)
                {
                    return;
                }
            }
            byte?result = ReplaceBallWindow.ShowDialog(Window.GetWindow(this), pokemon);

            if (result.HasValue)
            {
                if (result.Value == 1 || result.Value == 11)
                {
                    MessageBoxResult boxResult = TriggerMessageBox.Show(Window.GetWindow(this), ItemDatabase.GetItemFromID(result.Value).Name + " is a rare ball, are you sure you want to use it?", "Replace Ball", MessageBoxButton.YesNo);
                    if (boxResult == MessageBoxResult.No)
                    {
                        return;
                    }
                }
                pokemon.BallCaughtID         = result.Value;
                this.imageBallCaught.Source  = PokemonDatabase.GetBallCaughtImageFromID(pokemon.BallCaughtID);
                this.imageBallCaught2.Source = PokemonDatabase.GetBallCaughtImageFromID(pokemon.BallCaughtID);
            }
        }
        public void LoadPokemon(IPokemon pokemon)
        {
            this.pokemon = pokemon;
            if (PokeManager.IsAprilFoolsMode && !pokemon.IsEgg)
            {
                this.imagePokemon.Source = PokemonDatabase.GetPokemonImageFromDexID(41, pokemon.IsShiny);
            }
            else
            {
                this.imagePokemon.Source = pokemon.Sprite;
            }
            if (pokemon.IsShadowPokemon)
            {
                this.rectShadowMask.OpacityMask = new ImageBrush(this.imagePokemon.Source);
                this.rectShadowMask.Visibility  = Visibility.Visible;
                this.imageShadowAura.Visibility = Visibility.Visible;
            }
            else
            {
                this.rectShadowMask.Visibility  = Visibility.Hidden;
                this.imageShadowAura.Visibility = Visibility.Hidden;
            }
            this.imageShinyStar.Visibility = (pokemon.IsShiny && (!pokemon.IsEgg || !PokeManager.Settings.MysteryEggs) ? Visibility.Visible : Visibility.Hidden);
            this.imageBallCaught.Source    = (!pokemon.IsEgg ? PokemonDatabase.GetBallCaughtImageFromID(pokemon.BallCaughtID) : null);

            if (pokemon.IsEgg)
            {
                this.labelNickname.Content = "EGG";
            }
            else
            {
                this.labelNickname.Content = pokemon.Nickname;
            }
            if (pokemon.HasForm)
            {
                this.labelSpecies.Content = pokemon.PokemonFormData.Name;
            }
            else
            {
                this.labelSpecies.Content = pokemon.PokemonData.Name;
            }
            if (pokemon.DexID == 265 && (!pokemon.IsEgg || !PokeManager.Settings.MysteryEggs))
            {
                this.labelSpecies.Content += " " + (pokemon.WurpleIsCascoon ? "(Cas)" : "(Sil)");
            }

            this.labelLevel.Content = "Lv " + pokemon.Level.ToString();
            if (pokemon.IsEgg && PokeManager.Settings.MysteryEggs)
            {
                this.labelGender.Content = "";
            }
            else if (pokemon.Gender == Genders.Male)
            {
                this.labelGender.Content    = "♂";
                this.labelGender.Foreground = new SolidColorBrush(Color.FromRgb(0, 136, 184));
            }
            else if (pokemon.Gender == Genders.Female)
            {
                this.labelGender.Content    = "♀";
                this.labelGender.Foreground = new SolidColorBrush(Color.FromRgb(184, 88, 80));
            }
            else
            {
                this.labelGender.Content = "";
            }

            Brush unmarkedBrush = new SolidColorBrush(Color.FromRgb(200, 200, 200));
            Brush markedBrush   = new SolidColorBrush(Color.FromRgb(0, 0, 0));

            markCircle.Foreground   = (pokemon.IsCircleMarked ? markedBrush : unmarkedBrush);
            markSquare.Foreground   = (pokemon.IsSquareMarked ? markedBrush : unmarkedBrush);
            markTriangle.Foreground = (pokemon.IsTriangleMarked ? markedBrush : unmarkedBrush);
            markHeart.Foreground    = (pokemon.IsHeartMarked ? markedBrush : unmarkedBrush);

            if (pokemon.IsHoldingItem)
            {
                imageHeldItem.Source = ItemDatabase.GetItemImageFromID(pokemon.HeldItemID);
            }
            else
            {
                imageHeldItem.Source = null;
            }
        }
Esempio n. 3
0
        public void LoadPokemon(IPokemon pokemon)
        {
            this.gameIndex            = PokeManager.GetIndexOfGame(pokemon.GameSave);
            this.currentMoveIndex     = -1;
            this.pokemon              = pokemon;
            this.imagePokemon.Source  = pokemon.Sprite;
            this.imagePokemon2.Source = pokemon.Sprite;
            if (pokemon.IsShadowPokemon)
            {
                this.rectShadowMask.OpacityMask  = new ImageBrush(this.imagePokemon.Source);
                this.rectShadowMask2.OpacityMask = new ImageBrush(this.imagePokemon.Source);
                this.rectShadowMask.Visibility   = Visibility.Visible;
                this.rectShadowMask2.Visibility  = Visibility.Visible;
                this.imageShadowAura.Visibility  = Visibility.Visible;
                this.imageShadowAura2.Visibility = Visibility.Visible;
            }
            else
            {
                this.rectShadowMask.Visibility   = Visibility.Hidden;
                this.rectShadowMask2.Visibility  = Visibility.Hidden;
                this.imageShadowAura.Visibility  = Visibility.Hidden;
                this.imageShadowAura2.Visibility = Visibility.Hidden;
            }
            this.imageShinyStar.Visibility  = (pokemon.IsShiny ? Visibility.Visible : Visibility.Hidden);
            this.imageShinyStar2.Visibility = (pokemon.IsShiny ? Visibility.Visible : Visibility.Hidden);
            this.imageBallCaught.Source     = PokemonDatabase.GetBallCaughtImageFromID(pokemon.BallCaughtID);
            this.imageBallCaught2.Source    = PokemonDatabase.GetBallCaughtImageFromID(pokemon.BallCaughtID);


            if (pokemon.IsEgg)
            {
                this.labelNickname.Content = "EGG";
            }
            else
            {
                this.labelNickname.Content = pokemon.Nickname;
            }
            this.labelLevel.Content = "Lv " + pokemon.Level.ToString();
            if (pokemon.Gender == Genders.Male)
            {
                this.labelGender.Content    = "♂";
                this.labelGender.Foreground = new SolidColorBrush(Color.FromRgb(0, 136, 184));
            }
            else if (pokemon.Gender == Genders.Female)
            {
                this.labelGender.Content    = "♀";
                this.labelGender.Foreground = new SolidColorBrush(Color.FromRgb(184, 88, 80));
            }
            else
            {
                this.labelGender.Content = "";
            }

            if (pokemon.IsEgg)
            {
                this.labelOTName.Content    = "?????";
                this.labelOTName.Foreground = new SolidColorBrush(Color.FromRgb(0, 0, 0));
                this.labelOTID.Content      = "?????";
                this.labelSecretID.Content  = "?????";
            }
            else
            {
                this.labelOTName.Content = pokemon.TrainerName;
                if (pokemon.TrainerGender == Genders.Male)
                {
                    this.labelOTName.Foreground = new SolidColorBrush(Color.FromRgb(0, 136, 184));
                }
                else if (pokemon.TrainerGender == Genders.Female)
                {
                    this.labelOTName.Foreground = new SolidColorBrush(Color.FromRgb(184, 88, 80));
                }
                this.labelOTID.Content     = pokemon.TrainerID.ToString("00000");
                this.labelSecretID.Content = pokemon.SecretID.ToString("00000");
            }

            if (pokemon.HasForm)
            {
                this.labelSpeciesName.Content = pokemon.PokemonFormData.Name;
            }
            else
            {
                this.labelSpeciesName.Content = pokemon.PokemonData.Name;
            }
            this.labelSpeciesNumber.Content = "No. " + pokemon.DexID.ToString("000");

            this.labelHPIV.Content        = pokemon.HPIV.ToString();
            this.labelAttackIV.Content    = pokemon.AttackIV.ToString();
            this.labelDefenseIV.Content   = pokemon.DefenseIV.ToString();
            this.labelSpAttackIV.Content  = pokemon.SpAttackIV.ToString();
            this.labelSpDefenseIV.Content = pokemon.SpDefenseIV.ToString();
            this.labelSpeedIV.Content     = pokemon.SpeedIV.ToString();

            this.labelHPEV.Content        = pokemon.HPEV.ToString();
            this.labelAttackEV.Content    = pokemon.AttackEV.ToString();
            this.labelDefenseEV.Content   = pokemon.DefenseEV.ToString();
            this.labelSpAttackEV.Content  = pokemon.SpAttackEV.ToString();
            this.labelSpDefenseEV.Content = pokemon.SpDefenseEV.ToString();
            this.labelSpeedEV.Content     = pokemon.SpeedEV.ToString();

            this.labelHPStat.Content        = pokemon.HP.ToString();
            this.labelAttackStat.Content    = pokemon.Attack.ToString();
            this.labelDefenseStat.Content   = pokemon.Defense.ToString();
            this.labelSpAttackStat.Content  = pokemon.SpAttack.ToString();
            this.labelSpDefenseStat.Content = pokemon.SpDefense.ToString();
            this.labelSpeedStat.Content     = pokemon.Speed.ToString();

            this.labelCool.Content   = pokemon.Coolness.ToString();
            this.labelBeauty.Content = pokemon.Beauty.ToString();
            this.labelCute.Content   = pokemon.Cuteness.ToString();
            this.labelSmart.Content  = pokemon.Smartness.ToString();
            this.labelTough.Content  = pokemon.Toughness.ToString();
            this.labelFeel.Content   = pokemon.Feel.ToString();

            if (pokemon.Move1ID != 0)
            {
                this.labelMove1Name.Content        = PokemonDatabase.GetMoveFromID(pokemon.Move1ID).Name;
                this.labelMove1PP.Content          = pokemon.Move1TotalPP.ToString();
                this.typeMove1.Type                = PokemonDatabase.GetMoveFromID(pokemon.Move1ID).Type;
                this.typeMove1.Visibility          = Visibility.Visible;
                this.labelContestMove1Name.Content = PokemonDatabase.GetMoveFromID(pokemon.Move1ID).Name;
                this.labelContestMove1PP.Content   = (pokemon.Move1Data.PP == 0 ? "--" : pokemon.Move1TotalPP.ToString());
                this.conditionMove1.Type           = PokemonDatabase.GetMoveFromID(pokemon.Move1ID).ConditionType;
                this.conditionMove1.Visibility     = Visibility.Visible;
            }
            else
            {
                this.labelMove1Name.Content        = "-";
                this.labelMove1PP.Content          = "--";
                this.typeMove1.Visibility          = Visibility.Hidden;
                this.labelContestMove1Name.Content = "-";
                this.labelContestMove1PP.Content   = "--";
                this.conditionMove1.Visibility     = Visibility.Hidden;
            }
            if (pokemon.Move2ID != 0)
            {
                this.labelMove2Name.Content        = PokemonDatabase.GetMoveFromID(pokemon.Move2ID).Name;
                this.labelMove2PP.Content          = pokemon.Move2TotalPP.ToString();
                this.typeMove2.Type                = PokemonDatabase.GetMoveFromID(pokemon.Move2ID).Type;
                this.typeMove2.Visibility          = Visibility.Visible;
                this.labelContestMove2Name.Content = PokemonDatabase.GetMoveFromID(pokemon.Move2ID).Name;
                this.labelContestMove2PP.Content   = (pokemon.Move2Data.PP == 0 ? "--" : pokemon.Move2TotalPP.ToString());
                this.conditionMove2.Type           = PokemonDatabase.GetMoveFromID(pokemon.Move2ID).ConditionType;
                this.conditionMove2.Visibility     = Visibility.Visible;
            }
            else
            {
                this.labelMove2Name.Content        = "-";
                this.labelMove2PP.Content          = "--";
                this.typeMove2.Visibility          = Visibility.Hidden;
                this.labelContestMove2Name.Content = "-";
                this.labelContestMove2PP.Content   = "--";
                this.conditionMove2.Visibility     = Visibility.Hidden;
            }
            if (pokemon.Move3ID != 0)
            {
                this.labelMove3Name.Content        = PokemonDatabase.GetMoveFromID(pokemon.Move3ID).Name;
                this.labelMove3PP.Content          = pokemon.Move3TotalPP.ToString();
                this.typeMove3.Type                = PokemonDatabase.GetMoveFromID(pokemon.Move3ID).Type;
                this.typeMove3.Visibility          = Visibility.Visible;
                this.labelContestMove3Name.Content = PokemonDatabase.GetMoveFromID(pokemon.Move3ID).Name;
                this.labelContestMove3PP.Content   = (pokemon.Move3Data.PP == 0 ? "--" : pokemon.Move3TotalPP.ToString());
                this.conditionMove3.Type           = PokemonDatabase.GetMoveFromID(pokemon.Move3ID).ConditionType;
                this.conditionMove3.Visibility     = Visibility.Visible;
            }
            else
            {
                this.labelMove3Name.Content        = "-";
                this.labelMove3PP.Content          = "--";
                this.typeMove3.Visibility          = Visibility.Hidden;
                this.labelContestMove3Name.Content = "-";
                this.labelContestMove3PP.Content   = "--";
                this.conditionMove3.Visibility     = Visibility.Hidden;
            }
            if (pokemon.Move4ID != 0)
            {
                this.labelMove4Name.Content        = PokemonDatabase.GetMoveFromID(pokemon.Move4ID).Name;
                this.labelMove4PP.Content          = pokemon.Move4TotalPP.ToString();
                this.typeMove4.Type                = PokemonDatabase.GetMoveFromID(pokemon.Move4ID).Type;
                this.typeMove4.Visibility          = Visibility.Visible;
                this.labelContestMove4Name.Content = PokemonDatabase.GetMoveFromID(pokemon.Move4ID).Name;
                this.labelContestMove4PP.Content   = (pokemon.Move4Data.PP == 0 ? "--" : pokemon.Move4TotalPP.ToString());
                this.conditionMove4.Type           = PokemonDatabase.GetMoveFromID(pokemon.Move4ID).ConditionType;
                this.conditionMove4.Visibility     = Visibility.Visible;
            }
            else
            {
                this.labelMove4Name.Content        = "-";
                this.labelMove4PP.Content          = "--";
                this.typeMove4.Visibility          = Visibility.Hidden;
                this.labelContestMove4Name.Content = "-";
                this.labelContestMove4PP.Content   = "--";
                this.conditionMove4.Visibility     = Visibility.Hidden;
            }

            if (pokemon.IsHoldingItem)
            {
                this.imageHeldItem.Source  = ItemDatabase.GetItemImageFromID(pokemon.HeldItemID);
                this.labelHeldItem.Content = ItemDatabase.GetItemFromID(pokemon.HeldItemID).Name;
            }
            else
            {
                this.imageHeldItem.Source  = null;
                this.labelHeldItem.Content = "None";
            }
            if (pokemon.IsEgg)
            {
                this.labelFriendshipText.Content = "Hatch Counter";
                this.labelFriendship.Content     = pokemon.Friendship.ToString() + " Cycles";
            }
            else
            {
                this.labelFriendshipText.Content = "Friendship";
                this.labelFriendship.Content     = pokemon.Friendship.ToString();
            }


            this.labelNature.Content        = pokemon.NatureData.Name;
            this.labelNatureRaised.Content  = "+" + pokemon.NatureData.RaisedStat.ToString();
            this.labelNatureLowered.Content = "-" + pokemon.NatureData.LoweredStat.ToString();

            this.labelAbility.Content             = pokemon.AbilityData.Name;
            this.textBlockAbilityDescription.Text = pokemon.AbilityData.Description;

            if (pokemon.IsShadowPokemon)
            {
                uint totalPurification = pokemon.HeartGauge;
                uint levelStartExp     = PokemonDatabase.GetExperienceFromLevel(pokemon.PokemonData.ExperienceGroup, pokemon.Level);
                this.labelNextLevelText.Content    = "Exp Stored";
                this.labelNextLevel.Content        = pokemon.ExperienceStored.ToString() + " (+" + (PokemonDatabase.GetLevelFromExperience(pokemon.PokemonData.ExperienceGroup, pokemon.Experience + pokemon.ExperienceStored) - pokemon.Level).ToString() + ")";
                this.labelTotalExperience.Content  = pokemon.Experience.ToString();
                this.labelExperienceText2.Content  = "Heart Gauge";
                this.labelTotalExperience2.Content = pokemon.Purification.ToString();

                double ratio = (double)Math.Max(0, pokemon.Purification) / (double)totalPurification;
                LinearGradientBrush purBrush = new LinearGradientBrush();
                purBrush.GradientStops.Add(new GradientStop(Color.FromRgb(160, 72, 220), 0));
                purBrush.GradientStops.Add(new GradientStop(Color.FromRgb(160, 72, 220), ratio));
                purBrush.GradientStops.Add(new GradientStop(Color.FromRgb(225, 235, 250), ratio));
                purBrush.GradientStops.Add(new GradientStop(Color.FromRgb(225, 235, 250), 1));
                this.rectExperienceBar.Fill = purBrush;

                this.rectPurificationBorder1.Visibility = Visibility.Visible;
                this.rectPurificationBorder2.Visibility = Visibility.Visible;
            }
            else
            {
                this.labelExperienceText.Content   = "Experience";
                this.labelNextLevelText.Content    = "Next Level";
                this.labelExperienceText2.Content  = "";
                this.labelTotalExperience2.Content = "";
                uint levelStartExp = PokemonDatabase.GetExperienceFromLevel(pokemon.PokemonData.ExperienceGroup, pokemon.Level);
                uint levelNextExp  = PokemonDatabase.GetExperienceFromLevel(pokemon.PokemonData.ExperienceGroup, (byte)Math.Min(100, (int)pokemon.Level + 1));
                this.labelTotalExperience.Content = pokemon.Experience.ToString();
                this.labelNextLevel.Content       = (levelNextExp - levelStartExp).ToString();

                double ratio = (double)(pokemon.Experience - levelStartExp) / (double)(levelNextExp - levelStartExp);
                LinearGradientBrush expBrush = new LinearGradientBrush();
                expBrush.GradientStops.Add(new GradientStop(Color.FromRgb(0, 160, 220), 0));
                expBrush.GradientStops.Add(new GradientStop(Color.FromRgb(0, 160, 220), ratio));
                expBrush.GradientStops.Add(new GradientStop(Color.FromRgb(100, 100, 100), ratio));
                expBrush.GradientStops.Add(new GradientStop(Color.FromRgb(100, 100, 100), 1));
                this.rectExperienceBar.Fill = expBrush;

                this.rectPurificationBorder1.Visibility = Visibility.Hidden;
                this.rectPurificationBorder2.Visibility = Visibility.Hidden;
            }

            this.labelPokerus.Content = pokemon.PokerusStatus.ToString();

            if (pokemon.IsEgg)
            {
                this.labelMetAtText.Content     = "Waiting to Hatch";
                this.labelMetAtLevel.Content    = "";
                this.labelMetAtLocation.Content = "";
                this.labelGame.Content          = "";
            }
            else
            {
                if (pokemon.LevelMet == 0)
                {
                    this.labelMetAtText.Content  = "Hatched At";
                    this.labelMetAtLevel.Content = "Lv 5";
                }
                else
                {
                    this.labelMetAtText.Content  = (pokemon.IsFatefulEncounter ? "Fateful Encounter At" : "Met At");
                    this.labelMetAtLevel.Content = "Lv " + pokemon.LevelMet.ToString();
                }
                this.labelMetAtLocation.Content = (pokemon.GameOrigin == GameOrigins.ColosseumXD ? "Orre Region" : PokemonDatabase.GetMetLocationFromID(pokemon.MetLocationID));
                this.labelGame.Content          = pokemon.GameOrigin.ToString() + " (" + pokemon.Language.ToString() + ")";
            }

            this.type1Pokemon.Type = pokemon.PokemonData.Type1;
            if (pokemon.PokemonData.HasTwoTypes)
            {
                this.type2Pokemon.Type       = pokemon.PokemonData.Type2;
                this.type2Pokemon.Visibility = Visibility.Visible;
            }
            else
            {
                this.type2Pokemon.Visibility = Visibility.Hidden;
            }

            Brush unmarkedBrush = new SolidColorBrush(Color.FromRgb(200, 200, 200));
            Brush markedBrush   = new SolidColorBrush(Color.FromRgb(0, 0, 0));

            markCircle.Foreground   = (pokemon.IsCircleMarked ? markedBrush : unmarkedBrush);
            markSquare.Foreground   = (pokemon.IsSquareMarked ? markedBrush : unmarkedBrush);
            markTriangle.Foreground = (pokemon.IsTriangleMarked ? markedBrush : unmarkedBrush);
            markHeart.Foreground    = (pokemon.IsHeartMarked ? markedBrush : unmarkedBrush);

            stackPanelRibbons.Children.Clear();
            for (int i = 0; i < pokemon.CoolRibbonCount; i++)
            {
                AddRibbon("COOL-" + (i + 1).ToString());
            }
            for (int i = 0; i < pokemon.BeautyRibbonCount; i++)
            {
                AddRibbon("BEAUTY-" + (i + 1).ToString());
            }
            for (int i = 0; i < pokemon.CuteRibbonCount; i++)
            {
                AddRibbon("CUTE-" + (i + 1).ToString());
            }
            for (int i = 0; i < pokemon.SmartRibbonCount; i++)
            {
                AddRibbon("SMART-" + (i + 1).ToString());
            }
            for (int i = 0; i < pokemon.ToughRibbonCount; i++)
            {
                AddRibbon("TOUGH-" + (i + 1).ToString());
            }

            /*for (int i = 0; i < 4; i++)
             *      AddRibbon("COOL-" + (i + 1).ToString());
             * for (int i = 0; i < 4; i++)
             *      AddRibbon("BEAUTY-" + (i + 1).ToString());
             * for (int i = 0; i < 4; i++)
             *      AddRibbon("CUTE-" + (i + 1).ToString());
             * for (int i = 0; i < 4; i++)
             *      AddRibbon("SMART-" + (i + 1).ToString());
             * for (int i = 0; i < 4; i++)
             *      AddRibbon("TOUGH-" + (i + 1).ToString());*/
            /*AddRibbon("CHAMPION");
             * AddRibbon("WINNING");
             * AddRibbon("VICTORY");
             * AddRibbon("ARTIST");
             * AddRibbon("EFFORT");
             * AddRibbon("MARINE");
             * AddRibbon("LAND");
             * AddRibbon("SKY");
             * AddRibbon("COUNTRY");
             * AddRibbon("NATIONAL");
             * AddRibbon("EARTH");
             * AddRibbon("WORLD");*/
            if (pokemon.HasChampionRibbon)
            {
                AddRibbon("CHAMPION");
            }
            if (pokemon.HasWinningRibbon)
            {
                AddRibbon("WINNING");
            }
            if (pokemon.HasVictoryRibbon)
            {
                AddRibbon("VICTORY");
            }
            if (pokemon.HasArtistRibbon)
            {
                AddRibbon("ARTIST");
            }
            if (pokemon.HasEffortRibbon)
            {
                AddRibbon("EFFORT");
            }
            if (pokemon.HasMarineRibbon)
            {
                AddRibbon("MARINE");
            }
            if (pokemon.HasLandRibbon)
            {
                AddRibbon("LAND");
            }
            if (pokemon.HasSkyRibbon)
            {
                AddRibbon("SKY");
            }
            if (pokemon.HasCountryRibbon)
            {
                AddRibbon("COUNTRY");
            }
            if (pokemon.HasNationalRibbon)
            {
                AddRibbon("NATIONAL");
            }
            if (pokemon.HasEarthRibbon)
            {
                AddRibbon("EARTH");
            }
            if (pokemon.HasWorldRibbon)
            {
                AddRibbon("WORLD");
            }

            buttonBall.IsEnabled     = !pokemon.IsEgg;
            buttonNickname.IsEnabled = !pokemon.IsEgg && !pokemon.IsShadowPokemon;
            buttonDeoxys.IsEnabled   = pokemon.DexID == 386;
            ButtonEVs.IsEnabled      = !pokemon.IsEgg && !pokemon.IsShadowPokemon;

            buttonMarkings.IsEnabled = true;
            buttonMoves.IsEnabled    = !pokemon.IsEgg && !pokemon.IsShadowPokemon;
            buttonGive.IsEnabled     = !pokemon.IsEgg;
            buttonTake.IsEnabled     = pokemon.IsHoldingItem;

            SetCurrentMove(-1);
        }
Esempio n. 4
0
        private void OnGameSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (!loaded)
            {
                return;
            }
            gameIndex = comboBoxGame.SelectedGameIndex;

            ItemPocket pocket = PokeManager.GetGameSaveAt(gameIndex).Inventory.Items[ItemTypes.PokeBalls];

            listViewBalls.Items.Clear();
            selectedIndex = -1;
            selectedItem  = null;

            for (int i = 0; i < pocket.SlotsUsed; i++)
            {
                Item         item         = pocket[i];
                ListViewItem listViewItem = new ListViewItem();
                listViewItem.SnapsToDevicePixels = true;
                listViewItem.UseLayoutRounding   = true;
                DockPanel dockPanel = new DockPanel();
                dockPanel.Width = 170;

                Image image = new Image();
                image.Source              = PokemonDatabase.GetBallCaughtImageFromID((byte)item.ID);
                image.Stretch             = Stretch.None;
                image.SnapsToDevicePixels = true;
                image.UseLayoutRounding   = true;
                image.HorizontalAlignment = HorizontalAlignment.Center;
                image.VerticalAlignment   = VerticalAlignment.Center;

                TextBlock itemName = new TextBlock();
                itemName.VerticalAlignment = VerticalAlignment.Center;
                itemName.Text         = ItemDatabase.GetItemFromID(item.ID).Name;
                itemName.TextTrimming = TextTrimming.CharacterEllipsis;
                itemName.Margin       = new Thickness(4, 0, 0, 0);

                TextBlock itemX = new TextBlock();
                itemX.VerticalAlignment   = VerticalAlignment.Center;
                itemX.HorizontalAlignment = HorizontalAlignment.Right;
                itemX.TextAlignment       = TextAlignment.Right;
                itemX.Text     = "x";
                itemX.Width    = Double.NaN;
                itemX.MinWidth = 10;

                TextBlock itemCount = new TextBlock();
                itemCount.VerticalAlignment   = VerticalAlignment.Center;
                itemCount.HorizontalAlignment = HorizontalAlignment.Right;
                itemCount.TextAlignment       = TextAlignment.Right;
                itemCount.Width = 30;
                itemCount.Text  = item.Count.ToString();

                listViewItem.Content = dockPanel;
                listViewBalls.Items.Add(listViewItem);
                dockPanel.Children.Add(image);
                dockPanel.Children.Add(itemName);
                dockPanel.Children.Add(itemCount);
                dockPanel.Children.Add(itemX);

                DockPanel.SetDock(image, Dock.Left);
                DockPanel.SetDock(itemCount, Dock.Right);
            }
        }