RNNCode

SyphonBloodTarget

Dec 22nd, 2024 (edited)
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.15 KB | None | 0 0
  1. using Turbo.Plugins.Default;
  2. using System.Linq;
  3.  
  4. namespace Turbo.Plugins.RNN
  5. {
  6.     public class SyphonBloodTarget : BasePlugin, IInGameTopPainter
  7.     {
  8.         public IFont TextFontRed { get; set; }
  9.         public IFont TextFontGreen { get; set; }
  10.  
  11.         private SharpDX.DirectWrite.TextLayout layout { get; set; } = null;
  12.         private string monsterText { get; set; } = null;
  13.         private IFont monsterFont { get; set; } = null;
  14.  
  15.         public bool OnlyElites { get; set; }
  16.         public int OffsetY { get; set; }
  17.  
  18.         public SyphonBloodTarget()
  19.         {
  20.             Enabled = true;
  21.         }
  22.  
  23.         public override void Load(IController hud)
  24.         {
  25.             base.Load(hud);
  26.             OnlyElites = true;
  27.             OffsetY = -72 ;
  28.  
  29.             TextFontRed = Hud.Render.CreateFont("tahoma", 10, 255, 255, 255, 255, false, false, 255, 255, 0, 0, true);
  30.             TextFontGreen = Hud.Render.CreateFont("tahoma", 10, 255, 255, 255, 255, false, false, 255, 0, 120, 0, true);
  31.         }
  32.  
  33.         public void PaintTopInGame(ClipState clipState)
  34.         {
  35.             if (clipState != ClipState.BeforeClip)  return;
  36.             if (!Hud.Game.IsInGame || Hud.Game.IsInTown)  return;
  37.             if (Hud.Game.Players.Any(p => p.HeroClassDefinition.HeroClass == HeroClass.Necromancer /*&& p.Powers.UsedNecromancerPowers.SiphonBlood != null*/ && p.Powers.BuffIsActive(487651))) // Funerary pick
  38.             {
  39.                 var monsters = Hud.Game.AliveMonsters.Where(m => (!OnlyElites || m.IsElite) && m.GetAttributeValue(Hud.Sno.Attributes.Power_Buff_9_Visual_Effect_D, 453563) == 1);
  40.                 foreach (var monster in monsters)
  41.                 {
  42.                     if (monster.GetAttributeValue(Hud.Sno.Attributes.Power_Buff_11_Visual_Effect_D, 453563) == 1)
  43.                     {
  44.                         monsterText = "600";
  45.                         monsterFont = TextFontGreen;
  46.                     }
  47.                     else
  48.                     {
  49.                         monsterText = "300";
  50.                         monsterFont = TextFontRed;
  51.                     }
  52.                     layout = (monster.IsSelected && Hud.Game.Me.Powers.BuffIsActive(453563))? monsterFont.GetTextLayout("[" + monsterText + "]") : monsterFont.GetTextLayout(monsterText);  // monster selected && using yphon
  53.                     monsterFont.DrawText(layout, monster.FloorCoordinate.ToScreenCoordinate().X - layout.Metrics.Width/2.0f , monster.FloorCoordinate.ToScreenCoordinate().Y + OffsetY - layout.Metrics.Height/2.0f);
  54.                 }
  55.             }
  56.         }
  57.     }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment