SHARE
TWEET

NoGems

Arkahr Jul 25th, 2018 107 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using Turbo.Plugins.Default;
  2. using System.Linq;
  3. using Turbo.Plugins.Jack.Extensions;
  4.  
  5. namespace Turbo.Plugins.Arkahr
  6. {
  7.     public class NoGems : BasePlugin, IInGameTopPainter
  8.     {
  9.         public TopLabelWithTitleDecorator LabelDecorator { get; set; }
  10.  
  11.         public NoGems()
  12.         {
  13.             Enabled = true;
  14.         }
  15.  
  16.         public override void Load(IController hud)
  17.         {
  18.             base.Load(hud);
  19.             LabelDecorator = new TopLabelWithTitleDecorator(Hud)            
  20.             {
  21.                 BorderBrush = Hud.Render.CreateBrush(255, 230, 30, 30, -1),
  22.                 BackgroundBrush = Hud.Render.CreateBrush(190, 0, 0, 0, 0),
  23.                 TextFont = Hud.Render.CreateFont("tahoma", 8, 255,  230, 30, 30, false, false, false),
  24.                 TitleFont = Hud.Render.CreateFont("tahoma", 10, 255, 255, 0, 0, true, false, false),
  25.             };
  26.         }
  27.  
  28.         public void PaintTopInGame(ClipState clipState)
  29.         {
  30.             if (clipState != ClipState.BeforeClip) return;
  31.             var showWarning = false;
  32.             var popUpWidth =  300;
  33.             var popUpHeight =  50;
  34.             var popUpX =  Hud.Window.Size.Width/2 - popUpWidth/2;
  35.             var popUpY =  Hud.Window.Size.Height * 0.3f;
  36.             var text = "";
  37.             var gemCount = 666;
  38.             foreach (IPlayer player in Hud.Game.Players)
  39.             {
  40.                 var gemBuffs = player.Powers.UsedLegendaryGems.AllGemPrimaryBuffs().Where(b => b.Active);      
  41.                 gemCount = gemBuffs.Count();          
  42.                 if (gemCount<3)  {
  43.                     showWarning = true;
  44.                     text += string.Format("{0} ({1}) -> {2} missing\n", player.HeroName, player.HeroClassDefinition.HeroClass, 3 - gemCount);                        
  45.                     popUpHeight += 20;
  46.                 }
  47.             }
  48.             if (showWarning) LabelDecorator.Paint(popUpX, popUpY, popUpWidth, popUpHeight, text, "No Gems!");                        
  49.         }
  50.     }
  51. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top