Advertisement
JackCeparou

MonstersCountPlugin zjqyf1111

Mar 10th, 2017
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.81 KB | None | 0 0
  1. using System.Linq;
  2. using Turbo.Plugins.Default;
  3.  
  4. namespace Turbo.Plugins.glq
  5. {
  6.     using System.Text;
  7.  
  8.     // by 我想静静 黑白灰 Modifier zjqyf1111
  9.     public class MonstersCountPlugin : BasePlugin, IInGameTopPainter
  10.     {
  11.         public IFont TextFont { get; set; }
  12.         public int Yard { get; set; }
  13.         public bool ShowTotalProgression { get; set; }
  14.         public bool ShowLlocustCount { get; set; }
  15.         public bool ShowHauntedCount { get; set; }
  16.         public bool ShowPalmedCount { get; set; }
  17.         public bool ShowPhoenixedCount { get; set; }
  18.         public bool ShowStrongarmedCount { get; set; }
  19.  
  20.         private StringBuilder textBuilder;
  21.  
  22.         public MonstersCountPlugin()
  23.         {
  24.             Enabled = true;
  25.         }
  26.  
  27.         public override void Load(IController hud)
  28.         {
  29.             base.Load(hud);
  30.             TextFont = Hud.Render.CreateFont("tahoma", 11, 255, 180, 147, 109, false, false, true);
  31.             Yard = 40;
  32.             ShowTotalProgression = true;
  33.             ShowLlocustCount = true;
  34.             ShowHauntedCount = true;
  35.             ShowPalmedCount = true;
  36.             ShowPhoenixedCount = false;
  37.             ShowStrongarmedCount = true;
  38.  
  39.             textBuilder = new StringBuilder();
  40.         }
  41.  
  42.         public void PaintTopInGame(ClipState clipState)
  43.         {
  44.             var inRift = Hud.Game.SpecialArea == SpecialArea.Rift || Hud.Game.SpecialArea == SpecialArea.GreaterRift;
  45.             if (TextFont == null)
  46.             {
  47.                 return;
  48.             }
  49.  
  50.             double totalMonsterRiftProgression = 0;
  51.             int monstersCount = 0;
  52.             // locust
  53.             int locustCount = 0;
  54.             // haunted
  55.             int hauntedCount = 0;
  56.             //Palmed
  57.             int palmedCount = 0;
  58.             //Phoenixed BUG? http://turbohud.freeforums.net/thread/3945/monster-phoenixed
  59.             int phoenixedCount = 0;
  60.             //Strongarmed
  61.             int strongarmedCount = 0;
  62.  
  63.             var monsters = Hud.Game.AliveMonsters.Where(m => m.SummonerAcdDynamicId == 0 && m.IsElite || !m.IsElite);
  64.             foreach (var monster in monsters)
  65.             {
  66.                 if (monster.FloorCoordinate.XYDistanceTo(Hud.Game.Me.FloorCoordinate) > Yard) continue;
  67.  
  68.                 if (inRift && ShowTotalProgression) totalMonsterRiftProgression += monster.SnoMonster.RiftProgression * 100.0d / this.Hud.Game.MaxQuestProgress;
  69.  
  70.                 monstersCount++;
  71.                 if (monster.Locust && ShowLlocustCount)
  72.                 {
  73.                     locustCount++;
  74.                 }
  75.                 if (monster.Haunted && ShowHauntedCount)
  76.                 {
  77.                     hauntedCount++;
  78.                 }
  79.                 if (monster.Palmed && ShowPalmedCount)
  80.                 {
  81.                     palmedCount++;
  82.                 }
  83.                 if (monster.Phoenixed && ShowPhoenixedCount)
  84.                 {
  85.                     phoenixedCount++;
  86.                 }
  87.                 if (monster.Strongarmed && ShowStrongarmedCount)
  88.                 {
  89.                     strongarmedCount++;
  90.                 }
  91.             }
  92.  
  93.             if (monstersCount == 0)
  94.             {
  95.                 return;
  96.             }
  97.  
  98.             textBuilder.Clear();
  99.             textBuilder.AppendFormat("{0} yard Monster Count: {1}", Yard, monstersCount);
  100.             textBuilder.AppendLine();
  101.             textBuilder.AppendLine();
  102.  
  103.             if (inRift && ShowTotalProgression)
  104.             {
  105.                 textBuilder.AppendFormat("Total progress:{0}%", totalMonsterRiftProgression.ToString("f2"));
  106.                 textBuilder.AppendLine();
  107.             }
  108.             if (locustCount > 0)
  109.             {
  110.                 textBuilder.AppendFormat("Locust: {0}", locustCount);
  111.                 textBuilder.AppendLine();
  112.             }
  113.             if (hauntedCount > 0)
  114.             {
  115.                 textBuilder.AppendFormat("Haunted: {0}", hauntedCount);
  116.                 textBuilder.AppendLine();
  117.             }
  118.             if (palmedCount > 0)
  119.             {
  120.                 textBuilder.AppendFormat("Palmed: {0}", palmedCount);
  121.                 textBuilder.AppendLine();
  122.             }
  123.             if (phoenixedCount > 0)
  124.             {
  125.                 textBuilder.AppendFormat("Phoenixed: {0}", phoenixedCount);
  126.                 textBuilder.AppendLine();
  127.             }
  128.             if (strongarmedCount > 0)
  129.             {
  130.                 textBuilder.AppendFormat("Strongarmed: {0}", strongarmedCount);
  131.                 textBuilder.AppendLine();
  132.             }
  133.  
  134.             var layout = TextFont.GetTextLayout(textBuilder.ToString());
  135.             TextFont.DrawText(layout, Hud.Window.Size.Width - Hud.Window.Size.Width * 0.16f, Hud.Window.Size.Height / 2 + Hud.Window.Size.Height * 0.1f);
  136.         }
  137.  
  138.     }
  139.  
  140. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement