public void Paint(float x, float y)
        {
            if (!Enabled)
            {
                return;
            }
            if (BarBrush == null)
            {
                return;
            }
            if (data.Count == 0)
            {
                return;
            }

            using (var pg = Hud.Render.CreateGeometry())
            {
                using (var gs = pg.Open())
                {
                    BackgroundBrush.DrawRectangle(x, y, Width, Height);

                    var max        = Equals(ForcedMax, 0) ? data.Max() : ForcedMax;
                    var startPoint = new Vector2(x, y);
                    gs.BeginFigure(startPoint, FigureBegin.Filled);

                    var vect = new Vector2(x, y + Height);
                    gs.AddLine(vect);

                    for (var xx = 0; xx < data.Count; xx++)
                    {
                        var yy = Height * GetHeight(data[xx], max);

                        if (yy < 0)
                        {
                            yy = 0;
                        }

                        vect = new Vector2(x + xx, y + Height - yy);
                        gs.AddLine(vect);
                    }

                    gs.AddLine(new Vector2(x + data.Count - 1, y + Height));
                    gs.AddLine(new Vector2(x, y + Height));

                    gs.EndFigure(FigureEnd.Closed);
                    gs.Close();
                }
                BarBrush.DrawGeometry(pg);
            }
        }
Пример #2
0
        public void PaintTopInGame(ClipState clipState)
        {
            if (Hud.Render.UiHidden)
            {
                return;
            }
            if (Hud.Game.SpecialArea != SpecialArea.GreaterRift)
            {
                return;
            }
            var  bosses      = Hud.Game.AliveMonsters.Where(m => m.Rarity == ActorRarity.Boss);
            bool BossSpawned = false;

            foreach (IMonster m in bosses)
            {
                BossSpawned = true;
                foreach (var bosstimer in BossTimers)
                {
                    if (m.SnoMonster.NameEnglish == "Ember")
                    {
                        var healthpercent = (m.CurHealth / m.MaxHealth);
                        if (healthpercent > 0.5)
                        {
                            bosstimer.Duration = 7.5;
                        }
                        else
                        {
                            bosstimer.Duration = 4.0;
                        }
                    }
                    else if (m.SnoMonster.NameEnglish == "Stonesinger")
                    {
                        if (bosstimer.Animation == AnimSnoEnum._sandmonsterblack_attack_03_sandwall)
                        {
                            var healthpercent = (m.CurHealth / m.MaxHealth);
                            bosstimer.Duration = 12.0 * healthpercent + 5.5 * (1 - healthpercent);
                        }
                    }
                    else if (m.SnoMonster.NameEnglish == "Bone Warlock")
                    {
                        if (bosstimer.Name == "Wormhole")
                        {
                            bosstimer.Duration = 16.0;
                            var wormhole = Hud.Game.Actors.Where(x => x.SnoActor.Sno == ActorSnoEnum._x1_monsteraffix_teleportmines); // 337109
                            if (wormhole.Count() > 0)
                            {
                                var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d;
                                if (TimeElapsed > 7)
                                {
                                    //DebugtextBuilder.Append(bosstimer.Name);
                                    //DebugtextBuilder.Append(" ");
                                    //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d);
                                    //DebugtextBuilder.AppendLine();
                                    bosstimer.Timer = Hud.Game.CurrentGameTick;
                                }
                            }
                        }
                    }
                    else if (m.SnoMonster.NameEnglish == "Orlash")
                    {
                        if (m.Animation == AnimSnoEnum._terrordemon_generic_cast && bosstimer.Name == "Orlash Summon")
                        {
                            var Clones = Hud.Game.Actors.Where(x => x.SnoActor.Sno == ActorSnoEnum._x1_lr_boss_terrordemon_a_breathminion); // 337109
                            if (Clones.Count() <= 1)
                            {
                                var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d;
                                if (TimeElapsed > 8)
                                {
                                    //DebugtextBuilder.Append(bosstimer.Name);
                                    //DebugtextBuilder.Append(" ");
                                    //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d);
                                    //DebugtextBuilder.AppendLine();
                                    bosstimer.Timer = Hud.Game.CurrentGameTick;
                                }
                            }
                        }
                        else if (m.Animation == AnimSnoEnum._terrordemon_attack_firebreath && bosstimer.Name == "Lightning Breath")
                        {
                            var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d;
                            if (TimeElapsed > 6)
                            {
                                //DebugtextBuilder.Append(bosstimer.Name);
                                //DebugtextBuilder.Append(" ");
                                //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d);
                                //DebugtextBuilder.AppendLine();
                                bosstimer.Timer = Hud.Game.CurrentGameTick;
                            }
                        }
                    }
                    else if (m.SnoMonster.NameEnglish == "Bloodmaw")
                    {
                        if (m.Animation == bosstimer.Animation && bosstimer.Animation == AnimSnoEnum._x1_westmarchbrute_attack_02_out)
                        {
                            var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d;
                            if (TimeElapsed > 7)
                            {
                                //DebugtextBuilder.Append(bosstimer.Name);
                                //DebugtextBuilder.Append(" ");
                                //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d);
                                //DebugtextBuilder.AppendLine();
                                //DebugtextBuilder.AppendLine();
                            }
                            bosstimer.Timer = Hud.Game.CurrentGameTick;
                        }
                        if (m.Animation == AnimSnoEnum._x1_westmarchbrute_taunt && bosstimer.Animation == AnimSnoEnum._x1_westmarchbrute_attack_02_out)
                        {
                            var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d;
                            if (TimeElapsed > 7)
                            {
                                //DebugtextBuilder.Append(bosstimer.Name);
                                //DebugtextBuilder.Append(" ");
                                //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d);
                                //DebugtextBuilder.AppendLine();
                                //DebugtextBuilder.AppendLine();
                            }
                            bosstimer.Timer = Hud.Game.CurrentGameTick;
                        }

                        /*if (m.Animation == bosstimer.Animation && bosstimer.Animation == AnimSnoEnum._x1_westmarchbrute_taunt)
                         * {
                         *  var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d;
                         *  if (TimeElapsed > 4)
                         *  {
                         *      DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d);
                         *      DebugtextBuilder.AppendLine();
                         *      bosstimer.LastTimer = bosstimer.Timer;
                         *      bosstimer.Timer = Hud.Game.CurrentGameTick;
                         *  }
                         * }*/
                    }
                    else if (m.SnoMonster.NameEnglish == "Rime")
                    {
                        if (bosstimer.Name == "Small Fields")
                        {
                            var Circles = Hud.Game.Actors.Where(x => x.SnoActor.Sno == ActorSnoEnum._x1_unique_monster_generic_aoe_dot_cold_10foot); // 337109
                            if (Circles.Count() > 0)
                            {
                                var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d;
                                if (TimeElapsed > 7)
                                {
                                    //DebugtextBuilder.Append(bosstimer.Name);
                                    //DebugtextBuilder.Append(" ");
                                    //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d);
                                    //DebugtextBuilder.AppendLine();
                                    bosstimer.Timer = Hud.Game.CurrentGameTick;
                                }
                            }
                        }
                    }
                    else if (m.SnoMonster.NameEnglish == "Perendi")
                    {
                        if (bosstimer.Animation == 0 && bosstimer.Name == "Cave In")
                        {
                            var Circles = Hud.Game.Actors.Where(x => x.SnoActor.Sno == ActorSnoEnum._x1_lr_boss_malletdemon_fallingrocks);
                            if (Circles.Count() > 0)
                            {
                                var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d;
                                if (TimeElapsed > 5)
                                {
                                    //DebugtextBuilder.Append(bosstimer.Name);
                                    //DebugtextBuilder.Append(" ");
                                    //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d);
                                    //DebugtextBuilder.AppendLine();
                                    bosstimer.Timer = Hud.Game.CurrentGameTick;
                                }
                            }
                        }
                    }
                    else if (m.SnoMonster.NameEnglish == "Blighter")
                    {
                        if (bosstimer.Animation == 0 && bosstimer.Name == "Good Attack")
                        {
                            var Attack = m.GetAttributeValue(Hud.Sno.Attributes.Power_Buff_5_Visual_Effect_None, 429291);
                            if (Attack > 0)
                            {
                                var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d;
                                if (TimeElapsed > 10)
                                {
                                    //DebugtextBuilder.Append(bosstimer.Name);
                                    //DebugtextBuilder.Append(" ");
                                    //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d);
                                    //DebugtextBuilder.AppendLine();
                                    bosstimer.Timer = Hud.Game.CurrentGameTick;
                                }
                            }
                        }
                        else if (bosstimer.Animation == 0 && bosstimer.Name == "Bad Attack")
                        {
                            var Attack = m.GetAttributeValue(Hud.Sno.Attributes.Power_Buff_5_Visual_Effect_None, 309921);
                            if (Attack > 0)
                            {
                                var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d;
                                if (TimeElapsed > 10)
                                {
                                    //DebugtextBuilder.Append(bosstimer.Name);
                                    //DebugtextBuilder.Append(" ");
                                    //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d);
                                    //DebugtextBuilder.AppendLine();
                                    bosstimer.Timer = Hud.Game.CurrentGameTick;
                                }
                            }
                        }
                        else if (bosstimer.Animation == 0 && bosstimer.Name == "Line Attack")
                        {
                            var Attack = m.GetAttributeValue(Hud.Sno.Attributes.Power_Buff_5_Visual_Effect_None, 429077);
                            if (Attack > 0)
                            {
                                var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d;
                                if (TimeElapsed > 10)
                                {
                                    //DebugtextBuilder.Append(bosstimer.Name);
                                    //DebugtextBuilder.Append(" ");
                                    //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d);
                                    //DebugtextBuilder.AppendLine();
                                    bosstimer.Timer = Hud.Game.CurrentGameTick;
                                }
                            }
                        }
                    }
                    else if (m.SnoMonster.NameEnglish == "Man Carver")
                    {
                        if (bosstimer.Name == "Ground Effect")
                        {
                            var Circles = Hud.Game.Actors.Where(x => x.SnoActor.Sno == ActorSnoEnum._x1_unique_monster_generic_aoe_dot_fire_10foot);
                            if (Circles.Count() > 0)
                            {
                                var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d;
                                if (TimeElapsed > 15)
                                {
                                    //DebugtextBuilder.Append(bosstimer.Name);
                                    //DebugtextBuilder.Append(" ");
                                    //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d);
                                    //DebugtextBuilder.AppendLine();
                                    bosstimer.Timer = Hud.Game.CurrentGameTick;
                                }
                            }
                        }
                        else if (bosstimer.Name == "Heavy Smash")
                        {
                            if (m.Animation == AnimSnoEnum._butcher_attack_05_telegraph)
                            {
                                var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d;
                                if (TimeElapsed > 6)
                                {
                                    //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d);
                                    //DebugtextBuilder.AppendLine();
                                    bosstimer.LastTimer = bosstimer.Timer;
                                    bosstimer.Timer     = Hud.Game.CurrentGameTick;
                                }
                            }
                        }
                    }
                    else if (m.SnoMonster.NameEnglish == "Erethon")
                    {
                        if (bosstimer.Name == "Poison Circle")
                        {
                            var Circles = Hud.Game.Actors.Where(x => x.SnoActor.Sno == ActorSnoEnum._generic_proxy);
                            if (Circles.Count() > 0)
                            {
                                var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d;
                                if (TimeElapsed > 7)
                                {
                                    //DebugtextBuilder.Append(bosstimer.Name);
                                    //DebugtextBuilder.Append(" ");
                                    //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d);
                                    //DebugtextBuilder.AppendLine();
                                    bosstimer.Timer = Hud.Game.CurrentGameTick;
                                }
                            }
                        }
                    }
                    else if (m.SnoMonster.NameEnglish == "Raiziel")
                    {
                        if (m.Animation == AnimSnoEnum._x1_sniperangel_firebomb_01)
                        {
                            var healthpercent = (m.CurHealth / m.MaxHealth);
                            if (healthpercent > 0.75)
                            {
                                bosstimer.Duration = 7.5;
                            }
                            else
                            {
                                bosstimer.Duration = 4.0;
                            }
                        }
                    }

                    if (m.Animation == bosstimer.Animation && bosstimer.Animation != 0)
                    {
                        var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d;
                        if (TimeElapsed > 4)
                        {
                            //DebugtextBuilder.Append(bosstimer.Name);
                            //DebugtextBuilder.Append(" ");
                            //DebugtextBuilder.Append((Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d);
                            //DebugtextBuilder.AppendLine();
                            bosstimer.LastTimer = bosstimer.Timer;
                            bosstimer.Timer     = Hud.Game.CurrentGameTick;
                        }
                    }
                }
            }
            if (!BossSpawned)
            {
                return;
            }
            float ydelta = Hud.Window.Size.Height * 0.03f;
            int   i      = 0;

            foreach (var bosstimer in BossTimers)
            {
                var TimeElapsed = (Hud.Game.CurrentGameTick - bosstimer.Timer) / 60.0d;
                if (TimeElapsed > 0 && TimeElapsed < 120.0d)
                {
                    textBuilder.Clear();
                    textBuilder.AppendFormat("{0:0}", TimeElapsed);

                    if (TimeElapsed > bosstimer.Duration)
                    {
                        TimeElapsed = bosstimer.Duration;
                    }

                    float x     = Hud.Window.Size.Width * 0.14f;
                    float y     = Hud.Window.Size.Height * 0.05f;
                    float sizex = Hud.Window.Size.Width * 0.16f;
                    float sizey = Hud.Window.Size.Height * 0.02f;
                    float textx = Hud.Window.Size.Width * (0.14f + 0.498f - 0.42f);
                    float texty = Hud.Window.Size.Height * (0.05f + 0.111f - 0.11f);

                    y     += i * ydelta;
                    texty += i * ydelta;

                    BackgroundBrush.DrawRectangle(x, y, sizex, sizey);
                    BarBrush.DrawRectangle(x, y, sizex * (float)(TimeElapsed / bosstimer.Duration), sizey);
                    //BorderBrush.DrawLine(x, y, x + sizex, y, 0.6f);
                    BorderBrush.DrawLine(x + sizex, y, x + sizex, y + sizey, BorderSize);
                    //BorderBrush.DrawLine(x, y + sizey, x + sizex, y + sizey, BorderSize);
                    //BorderBrush.DrawLine(x, y, x, y + sizey, 0.6f);

                    var layout = GreenFont.GetTextLayout(textBuilder.ToString());
                    GreenFont.DrawText(layout, textx, texty);

                    textBuilder.Clear();
                    textBuilder.Append(bosstimer.Name);

                    var layout2 = GreenFont.GetTextLayout(textBuilder.ToString());
                    GreenFont.DrawText(layout2, x, texty);


                    //var layout3 = GreenFont.GetTextLayout(DebugtextBuilder.ToString());
                    //GreenFont.DrawText(layout3, Hud.Window.Size.Width * 0.35f, Hud.Window.Size.Height * (0.05f + 0.111f - 0.11f));
                    i++;
                }
            }
        }