Advertisement
HaKache

BoneSpiritPlugin

Oct 4th, 2019
681
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.82 KB | None | 0 0
  1. // BoneSpiritPlugin by HaKache
  2. // Draw a line on minimap & world screen and a label showing the distance between Bosses and Bone Spirit Necromancer.
  3.  
  4. using SharpDX.DirectInput;
  5. using System.Linq;
  6. using System;
  7. using System.Collections.Generic;
  8. using Turbo.Plugins.Default;
  9. using System.Text;
  10.  
  11. namespace Turbo.Plugins.Extended.Widgets
  12. {
  13.     public class BoneSpiritPlugin : BasePlugin, IInGameWorldPainter
  14.     {
  15.     public WorldDecoratorCollection YardIndicator { get; set; }
  16.     public WorldDecoratorCollection LineIndicator { get; set; }
  17.     private IBrush OrangeLineDrawing { get; set; }
  18.     public bool OnlyGR { get; set; }
  19.  
  20.     public BoneSpiritPlugin()
  21.     {
  22.         Enabled = true;
  23.         OnlyGR = true;
  24.     }
  25.  
  26.     public override void Load(IController hud)
  27.     {
  28.         base.Load(hud);
  29.  
  30.         YardIndicator = new WorldDecoratorCollection(
  31.         new GroundLabelDecorator(Hud) {
  32.                     BackgroundBrush = Hud.Render.CreateBrush(200, 0, 0, 0, 0),
  33.                     BorderBrush = Hud.Render.CreateBrush(128, 90, 75, 60, 2),
  34.             TextFont = Hud.Render.CreateFont("tahoma", 8f, 255, 255, 50, 50, true, false, false),
  35.         });
  36.  
  37.         LineIndicator = new WorldDecoratorCollection(
  38.         new MapShapeDecorator(Hud) {
  39.                     Brush = Hud.Render.CreateBrush(192, 255, 50, 50, -1),
  40.                     ShapePainter = new LineFromMeShapePainter(Hud),
  41.         });
  42.  
  43.         OrangeLineDrawing = Hud.Render.CreateBrush(225, 242, 40, 40, 4, SharpDX.Direct2D1.DashStyle.Dash);
  44.     }
  45.  
  46.     public void PaintWorld(WorldLayer layer)
  47.     {
  48.         if ((OnlyGR) && (Hud.Game.Me.InGreaterRiftRank == 0)) return;
  49.  
  50.     // Yards Indicator if there is a necromancer w/ Stricken Gem and Bone Spirit Skill equipped
  51.     var SpiritNecroIG = Hud.Game.Players.FirstOrDefault(p => (p.HasValidActor && p.Powers.BuffIsActive(428348, 0) && p.Powers.UsedSkills.Any(s => s.SnoPower.Sno == Hud.Sno.SnoPowers.Necromancer_BoneSpirit.Sno)));
  52.  
  53.     if (SpiritNecroIG != null && SpiritNecroIG == Hud.Game.Me) {
  54.             var markers = Hud.Game.Markers.OrderBy(i => Hud.Game.Me.FloorCoordinate.XYDistanceTo(i.FloorCoordinate));
  55.             if (markers != null)
  56.             {
  57.                 foreach (var marker in markers)
  58.                 {
  59.                         if (marker.SnoActor != null && marker.SnoActor.Code.Contains("_Boss_")) {
  60.             var DistYards = (int)(marker.FloorCoordinate.XYDistanceTo(Hud.Game.Me.FloorCoordinate));
  61.                 if (DistYards > 40) {
  62.                 YardIndicator.Paint(layer, null, Hud.Game.Me.FloorCoordinate.Offset(0, 0, 10f), DistYards.ToString());  // We draw a label w/ the yards on us
  63.                 LineIndicator.Paint(layer, null, marker.FloorCoordinate, null);                     // We draw a minimap line to the boss
  64.                 OrangeLineDrawing.DrawLineWorld(Hud.Game.Me.FloorCoordinate, marker.FloorCoordinate.Offset(0, 0, -8f)); // We draw a world line to the boss
  65.                 }
  66.             }
  67.         }
  68.         }
  69.     }
  70.  
  71.  
  72.     }
  73.  
  74.     }
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement