Advertisement
jarppaaja

ZeiCircle

Aug 5th, 2019
446
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.69 KB | None | 0 0
  1. // ZeiCircle.cs "$Revision: 2440 $" "$Date: 2019-08-05 13:40:48 +0300 (ma, 05 elo 2019) $"
  2. // https://pastebin.com/eGUnK60J
  3. using SharpDX.Direct2D1;
  4. using SharpDX;
  5. using Turbo.Plugins.Default;
  6.  
  7. namespace Turbo.Plugins.JarJar.DefaultUI
  8. {
  9.     // Idea from: https://www.ownedcore.com/forums/diablo-3/turbohud/turbohud-plugin-review-zone/618264-v7-2-international-glq-zeicircleforboss.html
  10.  
  11.     public class ZeiCircle : BasePlugin, IInGameWorldPainter
  12.     {
  13.         public WorldDecoratorCollection ZeiDecorator { get; set; }
  14.         public WorldDecoratorCollection SteadyAimDecoratorOn { get; set; }
  15.         public WorldDecoratorCollection SteadyAimDecoratorOff { get; set; }
  16.  
  17.         private GroundCircleDecorator zeiGroundCircle;
  18.  
  19.         public ZeiCircle() { Enabled = true; }   // TODO: remember to check for ExplosiveMonsterPlugin
  20.  
  21.         public override void Load(IController hud)
  22.         {
  23.             base.Load(hud);
  24.  
  25.             var color = Color.Magenta;
  26.             zeiGroundCircle = new GroundCircleDecorator(Hud)
  27.             {
  28.                 Brush = Hud.Render.CreateBrush(255, color.R, color.G, color.B, 1.5f, DashStyle.Solid),
  29.                 Radius = 50f,
  30.             };
  31.             ZeiDecorator = new WorldDecoratorCollection(
  32.                 zeiGroundCircle,
  33.                 new GroundLabelDecorator(Hud)
  34.                 {
  35.                     BackgroundBrush = Hud.Render.CreateBrush(255, 255, 255, 64, 0),
  36.                     TextFont = Hud.Render.CreateFont("tahoma", 9f, 255, 0, 0, 0, false, false, false),
  37.                 }
  38.                 );
  39.             color = Color.HotPink;
  40.             SteadyAimDecoratorOn = new WorldDecoratorCollection(
  41.                 new GroundCircleDecorator(Hud)
  42.                 {
  43.                     Brush = Hud.Render.CreateBrush(255, color.R, color.G, color.B, 1.5f, DashStyle.Solid),
  44.                     Radius = 10f,
  45.                 },
  46.                 new GroundLabelDecorator(Hud)
  47.                 {
  48.                     BackgroundBrush = Hud.Render.CreateBrush(255, 255, 255, 64, 0),
  49.                     TextFont = Hud.Render.CreateFont("tahoma", 9f, 255, 0, 0, 0, false, false, false),
  50.                 }
  51.                 );
  52.             color = Color.DeepPink;
  53.             SteadyAimDecoratorOff = new WorldDecoratorCollection(
  54.                 new GroundCircleDecorator(Hud)
  55.                 {
  56.                     Brush = Hud.Render.CreateBrush(255, color.R, color.G, color.B, 2.5f, DashStyle.Dash),
  57.                     Radius = 10f,
  58.                 },
  59.                 new GroundLabelDecorator(Hud)
  60.                 {
  61.                     BackgroundBrush = Hud.Render.CreateBrush(255, 255, 255, 64, 0),
  62.                     TextFont = Hud.Render.CreateFont("tahoma", 9f, 255, 0, 0, 0, false, false, false),
  63.                 }
  64.                 );
  65.         }
  66.  
  67.         public void PaintWorld(WorldLayer layer)
  68.         {
  69.             if (Hud.Game.IsInTown)
  70.                 return;
  71.             if ((Hud.Game.MapMode == MapMode.WaypointMap) || (Hud.Game.MapMode == MapMode.ActMap) || (Hud.Game.MapMode == MapMode.Map))
  72.                 return;
  73.  
  74.             if (Hud.Game.Me.Powers.BuffIsActive(Hud.Sno.SnoPowers.ZeisStoneOfVengeancePrimary.Sno, iconIndex: 0))
  75.             {
  76.                 var helperRadius = double.MaxValue;
  77.                 foreach (var monster in Hud.Game.AliveMonsters)
  78.                 {
  79.                     var dist = (float)monster.NormalizedXyDistanceToMe;
  80.                     if (dist < helperRadius)
  81.                     {
  82.                         helperRadius = dist;
  83.                     }
  84.                 }
  85.                 if (helperRadius != double.MaxValue)    // Can see monsters!
  86.                 {
  87.                     if (helperRadius > 50)
  88.                     {
  89.                         helperRadius = 50;
  90.                     }
  91.                     zeiGroundCircle.Radius = (float)helperRadius;
  92.                     // Show zei radius only if less than 50 yards.
  93.                     ZeiDecorator.Paint(layer, Hud.Game.Me, Hud.Game.Me.FloorCoordinate, helperRadius < 50 ? string.Format("{0:0}", helperRadius) : null);
  94.                 }
  95.             }
  96.             if (Hud.Game.Me.Powers.BuffIsActive(Hud.Sno.SnoPowers.DemonHunter_Passive_SteadyAim.Sno, iconIndex: 0))
  97.             {
  98.                 if (Hud.Game.Me.Powers.BuffIsActive(Hud.Sno.SnoPowers.DemonHunter_Passive_SteadyAim.Sno, iconIndex: 1))
  99.                 {
  100.                     SteadyAimDecoratorOn.Paint(layer, Hud.Game.Me, Hud.Game.Me.FloorCoordinate, null);
  101.                 }
  102.                 else
  103.                 {
  104.                     SteadyAimDecoratorOff.Paint(layer, Hud.Game.Me, Hud.Game.Me.FloorCoordinate, null);
  105.                 }
  106.             }
  107.         }
  108.     }
  109. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement