Advertisement
iThinkiWin

OculusColor

Mar 22nd, 2019
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 6.68 KB | None | 0 0
  1. using SharpDX.DirectInput;
  2. using System.Collections.Generic;
  3. using System.Globalization;
  4. using System.Linq;
  5. using System.Net.Sockets;
  6. using System.Net;
  7. using System.Text;
  8. using System;
  9. using Turbo.Plugins.Default;
  10.  
  11. namespace Turbo.Plugins.Zy
  12. {
  13.     public class OculusColor : BasePlugin, IInGameWorldPainter
  14.     {
  15.         public WorldDecoratorCollection DecoratorBase { get; set; }
  16.         public WorldDecoratorCollection DecoratorClosest { get; set; }
  17.         public WorldDecoratorCollection DecoratorInside { get; set; }
  18.         public WorldDecoratorCollection DecoratorSanc { get; set; }
  19.         private bool insanc;
  20.  
  21.         public OculusColor()
  22.         {
  23.             Enabled = true;
  24.         }
  25.  
  26.         public override void Load(IController hud)
  27.         {
  28.             base.Load(hud);
  29.  
  30.             DecoratorBase = new WorldDecoratorCollection(
  31.                 new GroundCircleDecorator(Hud)
  32.                 {
  33.                     Brush = Hud.Render.CreateBrush(90, 200, 200, 200, -2),
  34.                     Radius = 10.0f,
  35.                 },
  36.                 new GroundLabelDecorator(Hud)
  37.                 {
  38.                     CountDownFrom = 7,
  39.                     TextFont = Hud.Render.CreateFont("tahoma", 9, 255, 96, 255, 96, true, false, 128, 0, 0, 0, true),
  40.                 },
  41.                 new GroundTimerDecorator(Hud)
  42.                 {
  43.                     CountDownFrom = 7,
  44.                     BackgroundBrushEmpty = Hud.Render.CreateBrush(60, 0, 0, 0, 0),
  45.                     BackgroundBrushFill = Hud.Render.CreateBrush(200, 0, 192, 0, 0),
  46.                     Radius = 30,
  47.                 }
  48.             );
  49.  
  50.             DecoratorClosest = new WorldDecoratorCollection(
  51.                 new GroundCircleDecorator(Hud)
  52.                 {
  53.                     Brush = Hud.Render.CreateBrush(204, 255, 0, 255, -2),
  54.                     Radius = 10.0f,
  55.                 },
  56.                 new GroundLabelDecorator(Hud)
  57.                 {
  58.                     TextFont = Hud.Render.CreateFont("tahoma", 11, 255, 96, 255, 96, true, false, 128, 0, 0, 0, true),
  59.                 }
  60.             );
  61.  
  62.             DecoratorInside = new WorldDecoratorCollection(
  63.                 new GroundCircleDecorator(Hud)
  64.                 {
  65.                     Brush = Hud.Render.CreateBrush(255, 20, 204, 20, -2),
  66.                     Radius = 10.0f,
  67.                 },
  68.                 new GroundLabelDecorator(Hud)
  69.                 {
  70.                     CountDownFrom = 7,
  71.                     TextFont = Hud.Render.CreateFont("tahoma", 11, 255, 96, 255, 96, true, false, 128, 0, 0, 0, true),
  72.                 },
  73.                 new GroundTimerDecorator(Hud)
  74.                 {
  75.                     CountDownFrom = 7,
  76.                     BackgroundBrushEmpty = Hud.Render.CreateBrush(128, 0, 0, 0, 0),
  77.                     BackgroundBrushFill = Hud.Render.CreateBrush(200, 0, 192, 0, 0),
  78.                     Radius = 30,
  79.                 }
  80.             );
  81.  
  82.             DecoratorSanc = new WorldDecoratorCollection(
  83.                 new GroundCircleDecorator(Hud)
  84.                 {
  85.                     Brush = Hud.Render.CreateBrush(255, 20, 204, 20, -3),
  86.                     Radius = 10.0f,
  87.                 },
  88.                 new GroundCircleDecorator(Hud)
  89.                 {
  90.                     Brush = Hud.Render.CreateBrush(128, 20, 204, 20, 0),
  91.                     Radius = 10.0f,
  92.                 },
  93.                 new GroundLabelDecorator(Hud)
  94.                 {
  95.                     CountDownFrom = 7,
  96.                     TextFont = Hud.Render.CreateFont("tahoma", 11, 255, 96, 255, 96, true, false, 128, 0, 0, 0, true),
  97.                 },
  98.                 new GroundTimerDecorator(Hud)
  99.                 {
  100.                     CountDownFrom = 7,
  101.                     BackgroundBrushEmpty = Hud.Render.CreateBrush(128, 0, 0, 0, 0),
  102.                     BackgroundBrushFill = Hud.Render.CreateBrush(200, 0, 192, 0, 0),
  103.                     Radius = 30,
  104.                 }
  105.             );
  106.         }
  107.  
  108.         public void PaintWorld(WorldLayer layer)
  109.         {
  110.             if (Hud.Game.IsInTown) return;
  111.  
  112.             IWorldCoordinate WizPosition = Hud.Game.Players.First().FloorCoordinate;
  113.             bool WizardIngame = false;
  114.             var WNum = 0;
  115.             foreach (var player in Hud.Game.Players)//others
  116.             {
  117.                 if (player.HeroClassDefinition.HeroClass == HeroClass.Wizard)
  118.                 {
  119.                     insanc = false;
  120.                     if (player.Powers.BuffIsActive(317076)) insanc = true;
  121.                     WizPosition = player.FloorCoordinate;
  122.                     WizardIngame = true;
  123.                     WNum++;
  124.                 }
  125.             }
  126.  
  127.             float mindist = float.MaxValue;
  128.             var actors = Hud.Game.Actors.Where(x => x.SnoActor.Sno == ActorSnoEnum._generic_proxy && x.GetAttributeValueAsInt(Hud.Sno.Attributes.Power_Buff_1_Visual_Effect_None, Hud.Sno.SnoPowers.OculusRing.Sno) == 1);
  129.             if (actors.Count() > 0)
  130.             {
  131.                 var closest = actors.First();
  132.  
  133.                 foreach (var actor in actors)
  134.                 {
  135.                     float dist = actor.FloorCoordinate.XYDistanceTo(WizPosition);
  136.                     if (dist < mindist)
  137.                     {
  138.                         closest = actor;
  139.                         mindist = dist;
  140.                     }
  141.                 }
  142.                 foreach (var actor in actors)
  143.                 {
  144.                     if (WizardIngame && WNum == 1)
  145.                     {
  146.                         if (actor == closest)
  147.                         {
  148.                             if (mindist < 13.3f)
  149.                             {
  150.                                 if(insanc == true) {
  151.                                     DecoratorSanc.Paint(layer, actor, actor.FloorCoordinate, null);
  152.                                 }
  153.                                 else
  154.                                 {
  155.                                     DecoratorInside.Paint(layer, actor, actor.FloorCoordinate, null);
  156.                                 }
  157.                             }
  158.                             else
  159.                             {
  160.                                 string displaydist = mindist.ToString();
  161.                                 DecoratorClosest.Paint(layer, actor, actor.FloorCoordinate, string.Format("d: {0}", displaydist.Substring(0, Math.Min(2, displaydist.Length))));
  162.                             }
  163.                         }
  164.                         else
  165.                         {
  166.                             DecoratorBase.Paint(layer, actor, actor.FloorCoordinate, null);
  167.                         }
  168.                     }
  169.                 }
  170.             }
  171.         }
  172.     }
  173. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement