Code:
using System;
using System.Linq;
using System.Collections.Generic;
using Turbo.Plugins.Default;
namespace Turbo.Plugins.User
{
using System.Text;
public class WDskills1 : BasePlugin, IInGameWorldPainter, IInGameTopPainter
{
//public WorldDecoratorCollection PhantomCountDecorator { get; set; }
//public WorldDecoratorCollection PhantomDecorator { get; set; }
public bool Phantom { get; set; }
public IFont TextFont { get; set; }
public int yard { get; set; }
public float XWidth { get; set; }
public float YHeight { get; set; }
public TopLabelWithTitleDecorator PhantomCountDecorator { get; set; }
public WorldDecoratorCollection PhantomDecorator { get; set; }
public static HashSet<ActorSnoEnum> wdskills = new HashSet<ActorSnoEnum>(new List<uint>
{
181880 //wd_spiritbarragerune_aoe_ghostmodel
}.Select(x => (ActorSnoEnum)x));
public WDskills1()
{
Enabled = true;
}
public override void Load(IController hud)
{
base.Load(hud);
PhantomCountDecorator = new TopLabelWithTitleDecorator(Hud)
{
BackgroundBrush = Hud.Render.CreateBrush(80, 134, 238, 240, 0),
BorderBrush = Hud.Render.CreateBrush(255, 0, 0, 0, -1),
TextFont = Hud.Render.CreateFont("tahoma", 8, 255, 255, 0, 0, true, false, true),
};
PhantomDecorator = new WorldDecoratorCollection(
new GroundCircleDecorator(Hud)
{
Brush = Hud.Render.CreateBrush(255, 204, 0, 204, 3, SharpDX.Direct2D1.DashStyle.Dash),
Radius = 5f,
},
new GroundLabelDecorator(Hud)
{
CountDownFrom = 10,
BackgroundBrush = Hud.Render.CreateBrush(255, 200, 50, 50, 0),
TextFont = Hud.Render.CreateFont("tahoma", 9.5f, 255, 255, 255, 255, false, false, false),
},
new GroundTimerDecorator(Hud)
{
CountDownFrom = 10,
BackgroundBrushEmpty = Hud.Render.CreateBrush(128, 0, 0, 0, 0),
BackgroundBrushFill = Hud.Render.CreateBrush(200, 255, 32, 255, 0),
Radius = 30,
}
);
}
public void PaintWorld(WorldLayer layer)
{
if (!isHeroInGame(HeroClass.WitchDoctor)) return;
//PhantomDecorator
foreach (var actor in Hud.Game.Actors.Where(x => wdskills.Contains(x.SnoActor.Sno)))
{
if (actor.SnoActor.Sno == ActorSnoEnum._wd_spiritbarragerune_aoe_ghostmodel)
PhantomDecorator.Paint(layer, actor, actor.FloorCoordinate, "");
}
}
public void PaintTopInGame(ClipState clipState)
{
if (clipState != ClipState.BeforeClip) return;
int Count = 0;
//Count++;
var uiRect = Hud.Render.GetUiElement("Root.NormalLayer.game_dialog_backgroundScreenPC.game_progressBar_manaBall").Rectangle;
var w = uiRect.Width / 1.6f;
var h = uiRect.Height * 0.15f;
var x = uiRect.Left + w * 0.28f;
var y = uiRect.Top - uiRect.Height * 0.17f;
foreach (var actor in Hud.Game.Actors.Where(d => wdskills.Contains(d.SnoActor.Sno) && d.IsOnScreen))
{
Count++;
}
if (Count > 0)
{
switch (Hud.Game.Me.HeroClassDefinition.HeroClass)
{
case HeroClass.WitchDoctor:
PhantomCountDecorator.Paint(x, y, w, h, "Phantom:" + Count);
break;
}
}
}
private bool isHeroInGame(HeroClass HClass)
{
bool ClassInGame = false;
foreach (var p in Hud.Game.Players)
{
ClassInGame = ( (ClassInGame || (!ClassInGame && p.HeroClassDefinition.HeroClass == HClass) ) ? true : false);
}
return ClassInGame;
}
}
}