Advertisement
Jembo33

MonkS27WaveOfLightSancPlugin

Dec 1st, 2022
579
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.42 KB | None | 0 0
  1. using Turbo.Plugins.Default;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4.  
  5. namespace Turbo.Plugins.User
  6. {
  7.  
  8.     public class MonkS27WaveOfLightSancPlugin : BasePlugin, IInGameWorldPainter, IInGameTopPainter
  9.     {
  10.     public WorldDecoratorCollection WaveOfLightDecorator;
  11.     public bool WaveOfLightEnabled;
  12.     public string WaveOfLightLabel;
  13.     private int WaveOfLightCount { get; set; } = 0;
  14.     public HashSet<ActorSnoEnum> WaveOfLightActorSNOs = new HashSet<ActorSnoEnum>
  15.     {
  16.         ActorSnoEnum._p74_monk_bell_waveoflight_runeb //487679
  17.     };
  18.  
  19.     public IFont TextFontCount { get; set; }
  20.    
  21.     public MonkS27WaveOfLightSancPlugin()
  22.     {
  23.         Enabled = true;
  24.  
  25.         WaveOfLightEnabled = true;
  26.         WaveOfLightLabel = "";
  27.     }
  28.  
  29.     public override void Load(IController hud)
  30.     {
  31.         base.Load(hud);
  32.         WaveOfLightDecorator = new WorldDecoratorCollection(new GroundCircleDecorator(Hud) {
  33.         Brush = Hud.Render.CreateBrush(0, 0, 0, 0, 0),
  34.         Radius = 0f });
  35.         TextFontCount = Hud.Render.CreateFont("tahoma", 8, 255, 255, 255, 0, true, false, 255, 0, 0, 0, true);
  36.     }
  37.  
  38.     public void PaintWorld(WorldLayer layer)
  39.     {
  40.         if (Hud.Game.Me.HeroClassDefinition.HeroClass != HeroClass.Monk) return;
  41.  
  42.         if (WaveOfLightEnabled && Hud.Game.Me.Powers.UsedMonkPowers.WaveOfLight != null)
  43.         {
  44.         var WaveOfLightActors = Hud.Game.Actors.Where(EachActor => WaveOfLightActorSNOs.Contains(EachActor.SnoActor.Sno));
  45.         WaveOfLightCount = WaveOfLightActors.Count();
  46.  
  47.         foreach (var EachActor in WaveOfLightActors)
  48.         {
  49.             var text = string.IsNullOrWhiteSpace(WaveOfLightLabel) ? EachActor.SnoActor.NameLocalized : WaveOfLightLabel;
  50.             WaveOfLightDecorator.Paint(layer, EachActor, EachActor.FloorCoordinate, text);
  51.         }
  52.         }
  53.         else
  54.         {
  55.         WaveOfLightCount = 0;
  56.         }
  57.     }
  58.  
  59.     public void PaintTopInGame(ClipState clipState)
  60.     {
  61.         if (Hud.Game.Me.HeroClassDefinition.HeroClass != HeroClass.Monk) return;
  62.         if (clipState != ClipState.BeforeClip) return;
  63.  
  64.         if (WaveOfLightEnabled && WaveOfLightCount != 0 && Hud.Game.Me.Powers.UsedMonkPowers.WaveOfLight != null)
  65.         {
  66.                 var rect = Hud.Render.GetPlayerSkillUiElement(Hud.Game.Me.Powers.UsedMonkPowers.WaveOfLight.Key).Rectangle;
  67.                 var textLayout = TextFontCount.GetTextLayout(WaveOfLightCount.ToString()) ;
  68.                 TextFontCount.DrawText(textLayout, rect.X + (rect.Width - textLayout.Metrics.Width) * 0.85f, rect.Y + (rect.Height - textLayout.Metrics.Height) * 0.05f);
  69.         }
  70.     }
  71.     }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement