s4000

DAV_UrshiPlugin

Jan 14th, 2020
2,081
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Linq;
  3. using Turbo.Plugins.Default;
  4.  
  5. namespace Turbo.Plugins.DAV
  6. {
  7.     public class DAV_UrshiPlugin : BasePlugin, IInGameTopPainter {
  8.         public float xPos { get; set; }
  9.         public float yPos { get; set; }
  10.         public float iconSize { get; set; }
  11.         public bool showCount { get; set; }
  12.         public IFont textFont { get; set; }
  13.         public ITexture gemIcon { get; set; }
  14.  
  15.         public DAV_UrshiPlugin() {
  16.             Enabled = true;
  17.         }
  18.  
  19.         public override void Load(IController hud) {
  20.             base.Load(hud);
  21.  
  22.             xPos = Hud.Window.Size.Width * 0.5f;
  23.             yPos = Hud.Window.Size.Height * 160 / 1080;
  24.             iconSize = 60;
  25.             showCount = true;
  26.             textFont = Hud.Render.CreateFont("arial", 9, 255, 255, 51, 51, true, true, true);
  27.             gemIcon = Hud.Texture.GetTexture(3435159457);
  28.         }
  29.  
  30.         public void PaintTopInGame(ClipState clipState) {
  31.             if (clipState != ClipState.BeforeClip) return;
  32.             if (!Hud.Game.Quests.Any(q => q.SnoQuest.Sno == 337492 && q.QuestStepId == 34)) return;
  33.  
  34.             var outMSG = "";
  35.             foreach (var player in Hud.Game.Players) {
  36.                 var reminder = player.GetAttributeValueAsInt(Hud.Sno.Attributes.Jewel_Upgrades_Bonus, 2147483647, 0) + player.GetAttributeValueAsInt(Hud.Sno.Attributes.Jewel_Upgrades_Max, 2147483647, 0) - player.GetAttributeValueAsInt(Hud.Sno.Attributes.Jewel_Upgrades_Used, 2147483647, 0);
  37.                 if (reminder > 0)
  38.                     outMSG += (showCount ? (reminder.ToString() + " x ") : "") + player.BattleTagAbovePortrait + "\n";
  39.             }
  40.  
  41.             gemIcon?.Draw(xPos, yPos, iconSize, iconSize);
  42.             textFont.DrawText(outMSG, xPos + iconSize, yPos);
  43.         }
  44.     }
  45. }
RAW Paste Data