Exemplo n.º 1
0
 private void OnMonsterAilmentsCreate(object source, EventArgs args)
 {
     Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Render, new Action(() =>
     {
         // Ailments
         int index = 0;
         MonsterAilmentsContainer.Children.Clear();
         while (index < Context.Ailments.Count)
         {
             Ailment ailment = Context.Ailments[index];
             Monster_Widget.Parts.MonsterAilment AilmentDisplay = new Monster_Widget.Parts.MonsterAilment()
             {
                 Style = FindResource("OVERLAY_MONSTER_SUB_AILMENT_STYLE") as Style
             };
             AilmentDisplay.SetContext(ailment, MonsterAilmentsContainer.ItemWidth);
             MonsterAilmentsContainer.Children.Add(AilmentDisplay);
             index++;
         }
     }));
 }
Exemplo n.º 2
0
        private void UpdateMonsterInfo(Monster Monster)
        {
            // Used when starting HunterPie for the first time, since the events won't be triggered
            this.Visibility       = Visibility.Visible;
            this.MonsterName.Text = Monster.Name;
            // Update monster health
            MonsterHealthBar.MaxSize = this.Width * 0.7833333333333333;
            MonsterHealthBar.UpdateBar(Monster.CurrentHP, Monster.TotalHP);
            SetMonsterHealthBarText(Monster.CurrentHP, Monster.TotalHP);

            if ((Monster.CurrentHP / Monster.TotalHP * 100) < Monster.CaptureThreshold)
            {
                this.CapturableIcon.Visibility = Visibility.Visible;
            }

            // Monster stamina
            MonsterStaminaBar.MaxSize = this.Width - 72;
            MonsterStaminaBar.UpdateBar(Monster.Stamina, Monster.MaxStamina);
            SetMonsterStaminaText(Monster.Stamina, Monster.MaxStamina);

            // Gets monster icon
            MonsterIcon.Source = GetMonsterIcon(Monster.ID);

            SwitchSizeBasedOnTarget();

            // Parts
            this.MonsterPartsContainer.Children.Clear();
            foreach (Part mPart in Monster.Parts)
            {
                Monster_Widget.Parts.MonsterPart PartDisplay = new Monster_Widget.Parts.MonsterPart()
                {
                    Style = FindResource("OVERLAY_MONSTER_PART_BAR_STYLE") as Style
                };
                PartDisplay.SetContext(mPart, this.MonsterPartsContainer.ItemWidth);
                this.MonsterPartsContainer.Children.Add(PartDisplay);
            }

            // Ailments
            this.MonsterAilmentsContainer.Children.Clear();
            foreach (Ailment ailment in Monster.Ailments)
            {
                Monster_Widget.Parts.MonsterAilment AilmentDisplay = new Monster_Widget.Parts.MonsterAilment()
                {
                    Style = FindResource("OVERLAY_MONSTER_AILMENT_BAR_STYLE") as Style
                };
                AilmentDisplay.SetContext(ailment, this.MonsterAilmentsContainer.ItemWidth);
                MonsterAilmentsContainer.Children.Add(AilmentDisplay);
            }

            // Enrage
            if (Monster.IsEnraged)
            {
                ANIM_ENRAGEDICON.Begin(this.MonsterHealthBar, true);
                ANIM_ENRAGEDICON.Begin(this.HealthBossIcon, true);
                EnrageTimerText.Visibility = Visibility.Visible;
                EnrageTimerText.Text       = $"{Monster.EnrageTimerStatic - Monster.EnrageTimer:0}s";
            }

            // Set monster crown
            this.MonsterCrown.Source     = Monster.Crown == null ? null : (ImageSource)FindResource(Monster.Crown);
            this.MonsterCrown.Visibility = Monster.Crown == null ? Visibility.Collapsed : Visibility.Visible;
            Weaknesses.Children.Clear(); // Removes every weakness icon
            if (Monster.Weaknesses == null)
            {
                return;
            }
            foreach (string Weakness in Monster.Weaknesses.Keys)
            {
                ImageSource img = this.Resources[Weakness] as ImageSource;
                img.Freeze();
                WeaknessDisplay MonsterWeaknessDisplay = new WeaknessDisplay {
                    Icon   = img,
                    Width  = 20,
                    Height = 20
                };
                Weaknesses.Children.Add(MonsterWeaknessDisplay);
            }
        }
Exemplo n.º 3
0
        private void UpdateMonsterInfo(Monster Monster)
        {
            Visibility                = Visibility.Visible;
            MonsterName.Text          = Monster.Name;
            MonsterHealthBar.MaxSize  = Width * 0.7833333333333333;
            MonsterStaminaBar.MaxSize = Width - 72;

            // Update monster health and stamina
            UpdateHealthBar(MonsterHealthBar, Monster.Health, Monster.MaxHealth);
            UpdateHealthBar(MonsterStaminaBar, Monster.Stamina, Monster.MaxStamina);
            SetMonsterHealthBarText(Monster.Health, Monster.MaxHealth);
            SetMonsterStaminaText(Monster.Stamina, Monster.MaxStamina);
            DisplayCapturableIcon(Monster.Health, Monster.MaxHealth, Monster.CaptureThreshold);

            // Gets monster icon
            MonsterIcon.Source = GetMonsterIcon(Monster.Id);

            SwitchSizeBasedOnTarget();

            // Parts
            int index = 0;

            MonsterPartsContainer.Children.Clear();
            while (index < Monster.Parts.Count)
            {
                Part mPart = Monster.Parts[index];
                Monster_Widget.Parts.MonsterPart PartDisplay = new Monster_Widget.Parts.MonsterPart()
                {
                    Style = FindResource("OVERLAY_MONSTER_SUB_PART_STYLE") as Style
                };
                PartDisplay.SetContext(mPart, MonsterPartsContainer.ItemWidth);
                MonsterPartsContainer.Children.Add(PartDisplay);
                index++;
            }

            // Ailments
            index = 0;
            MonsterAilmentsContainer.Children.Clear();
            while (index < Monster.Ailments.Count)
            {
                Ailment ailment = Monster.Ailments[index];
                Monster_Widget.Parts.MonsterAilment AilmentDisplay = new Monster_Widget.Parts.MonsterAilment()
                {
                    Style = FindResource("OVERLAY_MONSTER_SUB_AILMENT_STYLE") as Style
                };
                AilmentDisplay.SetContext(ailment, MonsterAilmentsContainer.ItemWidth);
                MonsterAilmentsContainer.Children.Add(AilmentDisplay);
                index++;
            }

            // Enrage
            if (Monster.IsEnraged && !UserSettings.PlayerConfig.Overlay.MonstersComponent.HideHealthInformation)
            {
                ANIM_ENRAGEDICON.Begin(MonsterHealthBar, true);
                ANIM_ENRAGEDICON.Begin(HealthBossIcon, true);
                EnrageTimerText.Visibility = Visibility.Visible;
                EnrageTimerText.Text       = $"{Monster.EnrageTimerStatic - Monster.EnrageTimer:0}s";
            }

            // Set monster crown
            MonsterCrown.Source     = Monster.Crown == null ? null : (ImageSource)FindResource(Monster.Crown);
            MonsterCrown.Visibility = Monster.Crown == null ? Visibility.Collapsed : Visibility.Visible;
            Weaknesses.Children.Clear(); // Removes every weakness icon
            if (Monster.Weaknesses == null)
            {
                return;
            }
            index = 0;
            while (index < Monster.Weaknesses.Keys.Count)
            {
                string      Weakness = Monster.Weaknesses.Keys.ElementAt(index);
                ImageSource img      = FindResource(Weakness) as ImageSource;
                img?.Freeze();
                WeaknessDisplay MonsterWeaknessDisplay = new WeaknessDisplay
                {
                    Icon   = img,
                    Width  = 20,
                    Height = 20
                };
                Weaknesses.Children.Add(MonsterWeaknessDisplay);
                index++;
            }
            // Sometimes Alatreon's state changes before OnMonsterSpawn is dispatched
            if (Monster.GameId == 87)
            {
                OnAlatreonElementShift(this, EventArgs.Empty);
            }
        }
Exemplo n.º 4
0
        private void UpdateMonsterInfo(Monster Monster)
        {
            Visibility       = Visibility.Visible;
            MonsterName.Text = Monster.Name;
            // Update monster health
            MonsterHealthBar.MaxSize = Width * 0.7833333333333333;
            MonsterHealthBar.UpdateBar(Monster.Health, Monster.MaxHealth);
            SetMonsterHealthBarText(Monster.Health, Monster.MaxHealth);

            if ((Monster.Health / Monster.MaxHealth * 100) < Monster.CaptureThreshold)
            {
                CapturableIcon.Visibility = Visibility.Visible;
            }

            // Monster stamina
            MonsterStaminaBar.MaxSize = Width - 72;
            MonsterStaminaBar.UpdateBar(Monster.Stamina, Monster.MaxStamina);
            SetMonsterStaminaText(Monster.Stamina, Monster.MaxStamina);

            // Gets monster icon
            MonsterIcon.Source = GetMonsterIcon(Monster.Id);

            SwitchSizeBasedOnTarget();

            // Parts
            int index = 0;

            MonsterPartsContainer.Children.Clear();
            while (index < Monster.Parts.Count)
            {
                Part mPart = Monster.Parts[index];
                Monster_Widget.Parts.MonsterPart PartDisplay = new Monster_Widget.Parts.MonsterPart()
                {
                    Style = FindResource("OVERLAY_MONSTER_PART_BAR_STYLE") as Style
                };
                PartDisplay.SetContext(mPart, MonsterPartsContainer.ItemWidth);
                MonsterPartsContainer.Children.Add(PartDisplay);
                index++;
            }

            // Ailments
            index = 0;
            MonsterAilmentsContainer.Children.Clear();
            while (index < Monster.Ailments.Count)
            {
                Ailment ailment = Monster.Ailments[index];
                Monster_Widget.Parts.MonsterAilment AilmentDisplay = new Monster_Widget.Parts.MonsterAilment()
                {
                    Style = FindResource("OVERLAY_MONSTER_AILMENT_BAR_STYLE") as Style
                };
                AilmentDisplay.SetContext(ailment, MonsterAilmentsContainer.ItemWidth);
                MonsterAilmentsContainer.Children.Add(AilmentDisplay);
                index++;
            }

            // Enrage
            if (Monster.IsEnraged)
            {
                ANIM_ENRAGEDICON.Begin(MonsterHealthBar, true);
                ANIM_ENRAGEDICON.Begin(HealthBossIcon, true);
                EnrageTimerText.Visibility = Visibility.Visible;
                EnrageTimerText.Text       = $"{Monster.EnrageTimerStatic - Monster.EnrageTimer:0}s";
            }

            // Set monster crown
            MonsterCrown.Source     = Monster.Crown == null ? null : (ImageSource)FindResource(Monster.Crown);
            MonsterCrown.Visibility = Monster.Crown == null ? Visibility.Collapsed : Visibility.Visible;
            Weaknesses.Children.Clear(); // Removes every weakness icon
            if (Monster.Weaknesses == null)
            {
                return;
            }
            index = 0;
            while (index < Monster.Weaknesses.Keys.Count)
            {
                string      Weakness = Monster.Weaknesses.Keys.ElementAt(index);
                ImageSource img      = FindResource(Weakness) as ImageSource;
                img?.Freeze();
                WeaknessDisplay MonsterWeaknessDisplay = new WeaknessDisplay
                {
                    Icon   = img,
                    Width  = 20,
                    Height = 20
                };
                Weaknesses.Children.Add(MonsterWeaknessDisplay);
                index++;
            }
        }