Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using SharpDX.DirectInput;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Linq;
- using System.Net.Sockets;
- using System.Net;
- using System.Text;
- using System;
- using Turbo.Plugins.Default;
- namespace Turbo.Plugins.Zy
- {
- public class OculusColor : BasePlugin, IInGameWorldPainter
- {
- public WorldDecoratorCollection DecoratorBase { get; set; }
- public WorldDecoratorCollection DecoratorClosest { get; set; }
- public WorldDecoratorCollection DecoratorInside { get; set; }
- public WorldDecoratorCollection DecoratorSanc { get; set; }
- private bool insanc;
- public OculusColor()
- {
- Enabled = true;
- }
- public override void Load(IController hud)
- {
- base.Load(hud);
- DecoratorBase = new WorldDecoratorCollection(
- new GroundCircleDecorator(Hud)
- {
- Brush = Hud.Render.CreateBrush(90, 200, 200, 200, -2),
- Radius = 10.0f,
- },
- new GroundLabelDecorator(Hud)
- {
- CountDownFrom = 7,
- TextFont = Hud.Render.CreateFont("tahoma", 9, 255, 96, 255, 96, true, false, 128, 0, 0, 0, true),
- },
- new GroundTimerDecorator(Hud)
- {
- CountDownFrom = 7,
- BackgroundBrushEmpty = Hud.Render.CreateBrush(60, 0, 0, 0, 0),
- BackgroundBrushFill = Hud.Render.CreateBrush(200, 0, 192, 0, 0),
- Radius = 30,
- }
- );
- DecoratorClosest = new WorldDecoratorCollection(
- new GroundCircleDecorator(Hud)
- {
- Brush = Hud.Render.CreateBrush(204, 255, 0, 255, -2),
- Radius = 10.0f,
- },
- new GroundLabelDecorator(Hud)
- {
- TextFont = Hud.Render.CreateFont("tahoma", 11, 255, 96, 255, 96, true, false, 128, 0, 0, 0, true),
- }
- );
- DecoratorInside = new WorldDecoratorCollection(
- new GroundCircleDecorator(Hud)
- {
- Brush = Hud.Render.CreateBrush(255, 20, 204, 20, -2),
- Radius = 10.0f,
- },
- new GroundLabelDecorator(Hud)
- {
- CountDownFrom = 7,
- TextFont = Hud.Render.CreateFont("tahoma", 11, 255, 96, 255, 96, true, false, 128, 0, 0, 0, true),
- },
- new GroundTimerDecorator(Hud)
- {
- CountDownFrom = 7,
- BackgroundBrushEmpty = Hud.Render.CreateBrush(128, 0, 0, 0, 0),
- BackgroundBrushFill = Hud.Render.CreateBrush(200, 0, 192, 0, 0),
- Radius = 30,
- }
- );
- DecoratorSanc = new WorldDecoratorCollection(
- new GroundCircleDecorator(Hud)
- {
- Brush = Hud.Render.CreateBrush(255, 20, 204, 20, -3),
- Radius = 10.0f,
- },
- new GroundCircleDecorator(Hud)
- {
- Brush = Hud.Render.CreateBrush(128, 20, 204, 20, 0),
- Radius = 10.0f,
- },
- new GroundLabelDecorator(Hud)
- {
- CountDownFrom = 7,
- TextFont = Hud.Render.CreateFont("tahoma", 11, 255, 96, 255, 96, true, false, 128, 0, 0, 0, true),
- },
- new GroundTimerDecorator(Hud)
- {
- CountDownFrom = 7,
- BackgroundBrushEmpty = Hud.Render.CreateBrush(128, 0, 0, 0, 0),
- BackgroundBrushFill = Hud.Render.CreateBrush(200, 0, 192, 0, 0),
- Radius = 30,
- }
- );
- }
- public void PaintWorld(WorldLayer layer)
- {
- if (Hud.Game.IsInTown) return;
- IWorldCoordinate WizPosition = Hud.Game.Players.First().FloorCoordinate;
- bool WizardIngame = false;
- var WNum = 0;
- foreach (var player in Hud.Game.Players)//others
- {
- if (player.HeroClassDefinition.HeroClass == HeroClass.Wizard)
- {
- insanc = false;
- if (player.Powers.BuffIsActive(317076)) insanc = true;
- WizPosition = player.FloorCoordinate;
- WizardIngame = true;
- WNum++;
- }
- }
- float mindist = float.MaxValue;
- 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);
- if (actors.Count() > 0)
- {
- var closest = actors.First();
- foreach (var actor in actors)
- {
- float dist = actor.FloorCoordinate.XYDistanceTo(WizPosition);
- if (dist < mindist)
- {
- closest = actor;
- mindist = dist;
- }
- }
- foreach (var actor in actors)
- {
- if (WizardIngame && WNum == 1)
- {
- if (actor == closest)
- {
- if (mindist < 13.3f)
- {
- if(insanc == true) {
- DecoratorSanc.Paint(layer, actor, actor.FloorCoordinate, null);
- }
- else
- {
- DecoratorInside.Paint(layer, actor, actor.FloorCoordinate, null);
- }
- }
- else
- {
- string displaydist = mindist.ToString();
- DecoratorClosest.Paint(layer, actor, actor.FloorCoordinate, string.Format("d: {0}", displaydist.Substring(0, Math.Min(2, displaydist.Length))));
- }
- }
- else
- {
- DecoratorBase.Paint(layer, actor, actor.FloorCoordinate, null);
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement