Advertisement
JackCeparou

LegendaryCountPlugin (Csavo)

Apr 7th, 2017
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.80 KB | None | 0 0
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using System.Text;
  4. using Turbo.Plugins.Default;
  5.  
  6. namespace Turbo.Plugins.Csavo // Plugin for counting legendary drops
  7. {
  8.     public class LegendaryCountPlugin : BasePlugin, IInGameTopPainter, ILootGeneratedHandler // beta 1.0
  9.     {
  10.         public bool ShowPerHour { get; set; }
  11.         public int LegendaryCount { get; private set; }
  12.         public int AncientCount { get; private set; }
  13.         public int PrimalCount { get; private set; }
  14.         public IFont TextFont { get; set; }
  15.  
  16.         public LegendaryCountPlugin()
  17.         {
  18.             Enabled = true;
  19.         }
  20.  
  21.         public override void Load(IController hud)
  22.         {
  23.             base.Load(hud);
  24.  
  25.             ShowPerHour = false;
  26.  
  27.             LegendaryCount = 0;
  28.             AncientCount = 0;
  29.             PrimalCount = 0;
  30.  
  31.             TextFont = Hud.Render.CreateFont("tahoma", 7, 255, 255, 235, 170, false, false, true);
  32.         }
  33.  
  34.         public void OnLootGenerated(IItem item, bool gambled)
  35.         {
  36.             if (item.IsLegendary && item.SetSno != uint.MaxValue)
  37.             {
  38.                 if (item.AncientRank >= 0) LegendaryCount++;
  39.                 if (item.AncientRank == 1) AncientCount++;
  40.                 if (item.AncientRank == 2) PrimalCount++;
  41.             }
  42.         }
  43.  
  44.         public void PaintTopInGame(ClipState clipState)
  45.         {
  46.             if (clipState != ClipState.BeforeClip) return;
  47.             if (TextFont == null) return;
  48.  
  49.             var text = string.Format("Legs: {0} / {1} / {2}", LegendaryCount, AncientCount, PrimalCount);
  50.  
  51.             var layout = TextFont.GetTextLayout(text);
  52.             var uiMinimap = Hud.Render.MinimapUiElement.Rectangle;
  53.             TextFont.DrawText(layout, uiMinimap.Left, uiMinimap.Top);
  54.         }
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement