示例#1
0
        public DebuffDisplayInfo GetDebuffDisplayInfo(string name)
        {
            DebuffDisplayInfo debuffDisplayInfo = new DebuffDisplayInfo();

            try
            {
                DebuffEffect debuffEffect = this.DebuffEffects.Find((DebuffEffect f) => f.EffectDetails.Count <DebuffEffectDetails>() > 0 && (from w in f.EffectDetails
                                                                                                                                              where w.DisplayName.Trim().Equals(name.Trim(), StringComparison.CurrentCultureIgnoreCase)
                                                                                                                                              select w).Count <DebuffEffectDetails>() > 0);
                if (debuffEffect != null)
                {
                    debuffDisplayInfo.Icon = debuffEffect.Icon;
                    DebuffEffectDetails debuffEffectDetails = (from w in debuffEffect.EffectDetails
                                                               where w.DisplayName.Trim().Equals(name.Trim(), StringComparison.CurrentCultureIgnoreCase)
                                                               select w).First <DebuffEffectDetails>();
                    if (debuffEffectDetails != null)
                    {
                        debuffDisplayInfo.Icon = debuffEffectDetails.Icon;
                    }
                }
                else
                {
                    DebuffEffect debuffEffect2 = this.DebuffEffects.Find((DebuffEffect f) => f.DisplayName.Trim().Equals(name.Trim(), StringComparison.CurrentCultureIgnoreCase));
                    if (debuffEffect2 != null)
                    {
                        debuffDisplayInfo.Icon = debuffEffect2.Icon;
                    }
                }
            }
            catch (Exception ex) { Repo.RecordException(ex); }
            return(debuffDisplayInfo);
        }
示例#2
0
        private void MaintainDebuffIcons(int targetId)
        {
            if (this.TargetsWithDebuffIcons.ContainsKey(targetId))
            {
                Utils.ClearD3DObjects(this.TargetsWithDebuffIcons[targetId]);
                this.TargetsWithDebuffIcons.Remove(targetId);
            }
            this.TargetsWithDebuffIcons.Add(targetId, new List <TargetD3D>());
            WorldObject worldObject = lib.MyCore.WorldFilter[targetId];

            if (worldObject != null && worldObject.ObjectClass != ObjectClass.Player)
            {
                return;
            }
            List <Debuff> debuffs = this.TargetCache.GetDebuffs(targetId);
            List <int>    list    = new List <int>();

            if (debuffs.Count == 1)
            {
                DebuffDisplayInfo debuffDisplayInfo = this.DebuffDB.GetDebuffDisplayInfo(debuffs.FirstOrDefault <Debuff>().Name);
                this.TargetsWithDebuffIcons[targetId].Add(new TargetD3D
                {
                    Id        = worldObject.Id,
                    Icon      = debuffDisplayInfo.Icon,
                    D3DObject = Utils.CreateD3DObject(this, worldObject.Id, debuffDisplayInfo.Icon)
                });
                return;
            }
            if (debuffs.Count > 1)
            {
                IOrderedEnumerable <Debuff> orderedEnumerable = from o in debuffs
                                                                orderby o.TimeRemaining descending
                                                                select o;
                new Dictionary <int, TargetD3D>();
                foreach (Debuff debuff in orderedEnumerable)
                {
                    DebuffDisplayInfo debuffDisplayInfo2 = this.DebuffDB.GetDebuffDisplayInfo(debuff.Name);
                    if (debuffDisplayInfo2 != null && !list.Contains(debuffDisplayInfo2.Icon))
                    {
                        list.Add(debuffDisplayInfo2.Icon);
                    }
                }
                float num    = 4f;
                float num2   = num / (float)list.Count;
                float num3   = 0f;
                float scale  = this.CurrentProfile.FloatingDebuffSizeF / (float)Math.Pow((double)list.Count, 0.2);
                float radius = 0.1f + (float)Math.Pow((double)list.Count, 0.3) * 0.2f;
                foreach (int icon in list)
                {
                    this.TargetsWithDebuffIcons[targetId].Add(new TargetD3D
                    {
                        Id        = worldObject.Id,
                        Icon      = icon,
                        D3DObject = Utils.CreateD3DObject(this, worldObject.Id, icon, radius, num, scale, num3)
                    });
                    num3 += num2;
                }
            }
        }
示例#3
0
        public void TargetSurface_Draw(HudEmulator Caller, DxTexture Target, Rectangle TargetRegion, HudEmulator.delClearRegion dClearOp)
        {
            try
            {
                if (TargetHud != null)
                {
                    if (lib.MyCore.Actions.CurrentSelection != 0)
                    {
                        WorldObject worldObject = lib.MyCore.WorldFilter[lib.MyCore.Actions.CurrentSelection];
                        if (worldObject != null && worldObject.ObjectClass == ObjectClass.Player)
                        {
                            if (Target != null)
                            {
                                Color color = Color.Transparent;
                                Target.Fill(TargetRegion, color);
                                Target target = TargetCache.GetTarget(worldObject.Id);
                                if (target == null)
                                {
                                    TargetCache.AddOrUpdate(worldObject);
                                    target = TargetCache.GetTarget(worldObject.Id);
                                }
                                int num   = 0;
                                int num2  = 15;
                                int num3  = 285;
                                int num4  = 30;
                                Pen pen   = new Pen(ColorTranslator.FromHtml(CurrentProfile.ColorRed), 8f);
                                Pen pen2  = new Pen(ColorTranslator.FromHtml(CurrentProfile.ColorWhite), 8f);
                                Pen pen3  = new Pen(ColorTranslator.FromHtml(CurrentProfile.ColorGrey), 8f);
                                Pen pen4  = new Pen(ColorTranslator.FromHtml(CurrentProfile.ColorGreen), 8f);
                                Pen pen5  = new Pen(ColorTranslator.FromHtml(CurrentProfile.ColorPurple), 8f);
                                Pen pen6  = new Pen(ColorTranslator.FromHtml(CurrentProfile.ColorBlue), 8f);
                                Pen pen7  = new Pen(ColorTranslator.FromHtml(CurrentProfile.ColorYellow), 8f);
                                Pen pen8  = new Pen(ColorTranslator.FromHtml(CurrentProfile.ColorOrange), 8f);
                                Pen pen10 = new Pen(ColorTranslator.FromHtml(CurrentProfile.ColorOrange), 8f);

                                new Bitmap(50, 50);
                                Bitmap bitmap;
                                if (worldObject.Values(LongValueKey.Monarch) == lib.moncheck)
                                {
                                    pen10 = pen4;
                                }
                                else
                                {
                                    pen10 = pen;
                                }
                                Rectangle rectangle = Utils.DrawText(target.FullName, CurrentProfile.HudFont, pen10, out bitmap);

                                rectangle.Y = 10;
                                rectangle.X = 5;
                                num         = 0;
                                num2       += 10;
                                if (rectangle.Width > num3)
                                {
                                    num3 = rectangle.Width;
                                }
                                num4 += rectangle.Height;
                                Target.DrawImage(bitmap, rectangle, Color.Transparent);
                                rectangle = default(Rectangle);
                                num2     += 10;
                                Bitmap bitmap2 = null;

                                Rectangle rectangle2 = new Rectangle(0, 0, 230, 10);
                                rectangle   = Utils.DrawRectangle(rectangle2, pen, out bitmap2, false, 100, 2);
                                rectangle.Y = 25;
                                rectangle.X = 2;
                                int num5  = num;
                                int num6  = num2;
                                int width = rectangle.Width;
                                num2 += 7;
                                int num7;
                                num7 = target.CurrentHealthPercentage;

                                if (rectangle.Width > num3)
                                {
                                    num3 = rectangle.Width;
                                }
                                num4 += rectangle.Height;

                                Target.DrawImage(bitmap2, rectangle, Color.Transparent);
                                bitmap2     = null;
                                rectangle   = Utils.DrawRectangle(rectangle2, pen, out bitmap2, true, num7, 2);
                                rectangle.X = 2;
                                rectangle.Y = 25;
                                Target.DrawImage(bitmap2, rectangle, Color.Transparent);
                                if (target.MaxHealth > 0)
                                {
                                    string text;
                                    if (!target.HealthInFormat.Contains("-1"))
                                    {
                                        text = target.HealthInFormat;
                                    }
                                    else
                                    {
                                        text = (target.MaxHealth * num7 / 100).ToString() + "/" + target.MaxHealth.ToString();
                                    }
                                    Bitmap bitmap3 = null;
                                    Font   font    = new Font(CurrentProfile.HudFont.Name, 8f, FontStyle.Bold);
                                    rectangle   = Utils.DrawText(text, font, pen2, out bitmap3);
                                    rectangle.X = 0;
                                    rectangle.Y = 22;
                                    rectangle.X = 240;
                                    Target.DrawImage(bitmap3, rectangle, Color.Transparent);
                                    rectangle = default(Rectangle);
                                    num2     += 7;

                                    Bitmap bitmap4 = null;
                                    rectangle2  = new Rectangle(0, 0, 230, 10);
                                    rectangle   = Utils.DrawRectangle(rectangle2, pen7, out bitmap4, false, 100, 2);
                                    rectangle.Y = 37;
                                    rectangle.X = 2;
                                    num5        = num;
                                    num6        = num2;
                                    int width2 = rectangle.Width;
                                    num2 += 7;
                                    if (rectangle.Width > num3)
                                    {
                                        num3 = rectangle.Width;
                                    }
                                    num4 += rectangle.Height;
                                    Target.DrawImage(bitmap4, rectangle, Color.Transparent);
                                    rectangle   = Utils.DrawRectangle(rectangle2, pen7, out bitmap4, true, target.CurrentStaminaPercentage, 2);
                                    rectangle.X = 2;
                                    rectangle.Y = 37;
                                    Target.DrawImage(bitmap4, rectangle, Color.Transparent);
                                    if (!target.StaminaInFormat.Contains("-1"))
                                    {
                                        Bitmap bitmap5 = null;
                                        Font   font2   = new Font(CurrentProfile.HudFont.Name, 8f, FontStyle.Bold);
                                        rectangle   = Utils.DrawText(target.StaminaInFormat, font2, pen2, out bitmap5);
                                        rectangle.X = 0;
                                        rectangle.Y = 34;
                                        rectangle.X = 240;
                                        Target.DrawImage(bitmap5, rectangle, Color.Transparent);
                                    }
                                    rectangle = default(Rectangle);
                                    num2     += 5;

                                    Bitmap bitmap6 = null;
                                    rectangle2  = new Rectangle(0, 0, 230, 10);
                                    rectangle   = Utils.DrawRectangle(rectangle2, pen6, out bitmap6, false, 100, 2);
                                    rectangle.Y = 49;
                                    rectangle.X = 2;
                                    num5        = num;
                                    num6        = num2;
                                    int width3 = rectangle.Width;
                                    num2 += rectangle.Height;
                                    if (rectangle.Width > num3)
                                    {
                                        num3 = rectangle.Width;
                                    }
                                    num4 += rectangle.Height;
                                    Target.DrawImage(bitmap6, rectangle, Color.Transparent);
                                    rectangle   = Utils.DrawRectangle(rectangle2, pen6, out bitmap6, true, target.CurrentManaPercentage, 2);
                                    rectangle.X = 2;
                                    rectangle.Y = 49;
                                    Target.DrawImage(bitmap6, rectangle, Color.Transparent);
                                    if (!target.ManaInFormat.Contains("-1"))
                                    {
                                        Bitmap bitmap7 = null;
                                        Font   font3   = new Font(CurrentProfile.HudFont.Name, 8f, FontStyle.Bold);
                                        rectangle   = Utils.DrawText(target.ManaInFormat, font3, pen2, out bitmap7);
                                        rectangle.X = 0;
                                        rectangle.Y = 46;
                                        rectangle.X = 240;
                                        Target.DrawImage(bitmap7, rectangle, Color.Transparent);
                                    }
                                    int num8 = 0;
                                    int num9 = 0;
                                    num2 += 7;
                                    foreach (Debuff debuff in target.Debuffs)
                                    {
                                        rectangle  = default(Rectangle);
                                        rectangle2 = new Rectangle(0, 0, 22, 22);
                                        DebuffDisplayInfo debuffDisplayInfo = DebuffDB.GetDebuffDisplayInfo(debuff.Name);
                                        Pen pen9 = pen2;

                                        rectangle = new Rectangle(0, 0, 22, 22);

                                        rectangle.Y = 61;
                                        rectangle.X = 5 + num9;
                                        num9       += rectangle.Width + 7;
                                        Target.DrawPortalImage(debuffDisplayInfo.Icon, rectangle);
                                        num8++;
                                    }
                                    if (num9 > num3)
                                    {
                                        num3 = num9;
                                    }
                                }

                                TargetHud.Width  = num3 + (int)((double)0);
                                TargetHud.Height = num4;
                            }
                            else
                            {
                                TargetHud.Visible = false;
                            }
                        }
                    }
                }
            }
            catch { Utility.AddChatText("Error generating Defiance HUD, retrying...", 6); }
        }