Advertisement
RNNCode

ICount

Apr 9th, 2019 (edited)
1,171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 14.05 KB | None | 0 0
  1. using System.Linq;
  2. using Turbo.Plugins.Default;
  3. using SharpDX.DirectInput;
  4.  
  5. namespace Turbo.Plugins.RNN
  6. {
  7.     public class ICount : BasePlugin, IKeyEventHandler, INewAreaHandler, IInGameWorldPainter
  8.     {
  9.         private IFont AmarilloFontm { get; set; }
  10.         private IFont AmarilloFonth { get; set; }
  11.         private IFont VerdeFontm { get; set; }
  12.         private IFont VerdeFonth { get; set; }
  13.         private IFont RojoFontm { get; set; }
  14.         private IFont RojoFonth { get; set; }
  15.         private IFont OrangeFontm { get; set; }
  16.         private IFont ContadorFont { get; set; }
  17.  
  18.         private float currentYard { get; set; }
  19.         private IKeyEvent ToggleKeyEvent { get; set; }
  20.         private bool MapGR { get; set; } = false;
  21.  
  22.         private GroundLabelDecorator DecoratorMother { get; set; }
  23.         private GroundLabelDecorator DecoratorSummoner { get; set; }
  24.         private WorldDecoratorCollection CirclesMother { get; set; }
  25.         private WorldDecoratorCollection CirclesSumm { get; set; }
  26.         private WorldDecoratorCollection CirclesTr { get; set; }
  27.         private WorldDecoratorCollection CirclesTR { get; set; }
  28.  
  29.         public WorldDecoratorCollection CircleAnimatedGreen { get; set; }
  30.         public WorldDecoratorCollection CircleAnimatedRed { get; set; }
  31.         public WorldDecoratorCollection CircleAnimatedYellow { get; set; }
  32.  
  33.         public bool OnlyGR { get; set; }
  34.         public float XPor { get; set; }
  35.         public float YPor { get; set; }
  36.         public bool YardAll { get; set; }
  37.         public bool Circles { get; set; }
  38.         public bool Labels  { get; set; }
  39.         public bool ShowCounters { get; set; }
  40.  
  41.         public bool CircleAnimated { get; set; }
  42.         public bool CircleAnimatedOnlyNoElites { get; set; }
  43.  
  44.         public ICount()
  45.         {
  46.             Enabled = true;
  47.         }
  48.  
  49.         public override void Load(IController hud)
  50.         {
  51.             base.Load(hud);
  52.  
  53.             XPor = 0.860f;
  54.             YPor = 0.978f;
  55.             OnlyGR = false;  // Show only playing GR
  56.             YardAll = false; // If it is false, only those that are at 40y/120y will be counted. Press Control to change between 40 and 120
  57.             Circles = true;  // Show circles under the mothers and summoners creatures
  58.             Labels = true;   // Show the labels "mother" and "Summ"
  59.             CircleAnimated = true;  // Show animated circles about mothers, summoners and transformers (without transforming)
  60.             CircleAnimatedOnlyNoElites = false; // Don't show animated circles on elites
  61.             ShowCounters = true;
  62.  
  63.             currentYard = 40f;
  64.             ToggleKeyEvent = Hud.Input.CreateKeyEvent(true, Key.LeftControl, true, false, false);
  65.  
  66.             VerdeFontm = Hud.Render.CreateFont("tahoma", 8f, 255, 0, 250, 0, true, false, true);
  67.             VerdeFonth = Hud.Render.CreateFont("tahoma", 8f, 50, 0, 250, 0, false, false, false);
  68.             AmarilloFontm = Hud.Render.CreateFont("tahoma", 8f, 255, 255, 255, 0, true, false, true);
  69.             AmarilloFonth = Hud.Render.CreateFont("tahoma", 8f, 50, 255, 255, 0, false, false, false);
  70.             RojoFontm = Hud.Render.CreateFont("tahoma", 8f, 255, 255, 0, 0, true, false, true);
  71.             RojoFonth = Hud.Render.CreateFont("tahoma", 8f, 50, 255, 0, 0, false, false, false);
  72.             OrangeFontm = Hud.Render.CreateFont("tahoma", 8f, 250, 255, 150, 50, true, false, true);
  73.             ContadorFont = OrangeFontm;
  74.  
  75.             CircleAnimatedGreen = new WorldDecoratorCollection(
  76.                 new MapShapeDecorator(Hud)
  77.                 {
  78.                     Brush = Hud.Render.CreateBrush(255, 0, 155, 0, 2.5f),
  79.                     ShadowBrush = Hud.Render.CreateBrush(200, 0, 0, 0, 1),
  80.                     ShapePainter = new CircleShapePainter(Hud),
  81.                     Radius = 10f,
  82.                     RadiusTransformator = new StandardPingRadiusTransformator(Hud, 700)  {     RadiusMinimumMultiplier = 0.4f   }
  83.                 },
  84.                 new GroundCircleDecorator(Hud)
  85.                 {
  86.                     Brush = Hud.Render.CreateBrush(255, 0, 155, 0, 6, SharpDX.Direct2D1.DashStyle.Dash),
  87.                     Radius = -1,
  88.                     RadiusTransformator = new StandardPingRadiusTransformator(Hud, 700)  {      RadiusMinimumMultiplier = 0.5f  }
  89.                 }
  90.             );
  91.             CircleAnimatedRed = new WorldDecoratorCollection(
  92.                 new MapShapeDecorator(Hud)
  93.                 {
  94.                     Brush = Hud.Render.CreateBrush(140, 255, 0, 0, 2.5f),
  95.                     ShadowBrush = Hud.Render.CreateBrush(200, 0, 0, 0, 1),
  96.                     ShapePainter = new CircleShapePainter(Hud),
  97.                     Radius = 10f,
  98.                     RadiusTransformator = new StandardPingRadiusTransformator(Hud, 700)  {      RadiusMinimumMultiplier = 0.4f    }
  99.                 },
  100.                 new GroundCircleDecorator(Hud)
  101.                 {
  102.                     Brush = Hud.Render.CreateBrush(140, 255, 0, 0, 6, SharpDX.Direct2D1.DashStyle.Dash),
  103.                     Radius = -1,
  104.                     RadiusTransformator = new StandardPingRadiusTransformator(Hud, 700)  {      RadiusMinimumMultiplier = 0.5f  }
  105.                 }
  106.             );
  107.             CircleAnimatedYellow = new WorldDecoratorCollection(
  108.                 new MapShapeDecorator(Hud)
  109.                 {
  110.                     Brush = Hud.Render.CreateBrush(250, 255, 200, 0, 2.5f),
  111.                     ShadowBrush = Hud.Render.CreateBrush(200, 0, 0, 0, 1),
  112.                     ShapePainter = new CircleShapePainter(Hud),
  113.                     Radius = 6f,
  114.                     RadiusTransformator = new StandardPingRadiusTransformator(Hud, 700)  {      RadiusMinimumMultiplier = 0.4f      }
  115.                 },
  116.                 new GroundCircleDecorator(Hud)
  117.                 {
  118.                     Brush = Hud.Render.CreateBrush(250, 255, 200, 0, 5, SharpDX.Direct2D1.DashStyle.Dash),
  119.                     Radius = -1,
  120.                     RadiusTransformator = new StandardPingRadiusTransformator(Hud, 700)   {     RadiusMinimumMultiplier = 0.5f      }
  121.                 }
  122.             );
  123.  
  124.             DecoratorMother = new GroundLabelDecorator(Hud)
  125.             {
  126.                     BackgroundBrush = Hud.Render.CreateBrush(120, 255, 0, 0, 0),
  127.                     TextFont = Hud.Render.CreateFont("tahoma", 6.5f, 255, 255, 255, 255, false, false, false),
  128.                     OffsetY = 0f,
  129.             };
  130.  
  131.             DecoratorSummoner = new GroundLabelDecorator(Hud)
  132.             {
  133.                     BackgroundBrush = Hud.Render.CreateBrush(200, 0, 155, 0, 0),
  134.                     TextFont = Hud.Render.CreateFont("tahoma", 6.5f, 255, 255, 255, 255, false, false, false),
  135.                     OffsetY = 0f,
  136.             };
  137.  
  138.             CirclesMother = new WorldDecoratorCollection(
  139.                 new GroundCircleDecorator(Hud) {
  140.                     Brush = Hud.Render.CreateBrush(250, 150, 150, 150, 2f),
  141.                     Radius = 0.3f
  142.                 },
  143.                 new GroundCircleDecorator(Hud) {
  144.                     Brush = Hud.Render.CreateBrush(250, 250, 0, 0, 4f),
  145.                     Radius = 0.1f
  146.                 }
  147.             );
  148.  
  149.             CirclesSumm = new WorldDecoratorCollection(
  150.                 new GroundCircleDecorator(Hud) {
  151.                     Brush = Hud.Render.CreateBrush(250, 150, 150, 150, 2f),
  152.                     Radius = 0.3f
  153.                 },
  154.                 new GroundCircleDecorator(Hud) {
  155.                     Brush = Hud.Render.CreateBrush(255, 0, 255, 0, 4f),
  156.                     Radius = 0.1f
  157.                 }
  158.             );
  159.             CirclesTr = new WorldDecoratorCollection(
  160.                 new GroundCircleDecorator(Hud) {
  161.                     Brush = Hud.Render.CreateBrush(250, 150, 150, 150, 2f),
  162.                     Radius = 0.3f
  163.                 },
  164.                 new GroundCircleDecorator(Hud) {
  165.                     Brush = Hud.Render.CreateBrush(250, 250, 125, 0, 4f),
  166.                     Radius = 0.1f
  167.                 }
  168.             );
  169.             CirclesTR = new WorldDecoratorCollection(
  170.                 new GroundCircleDecorator(Hud) {
  171.                     Brush = Hud.Render.CreateBrush(250, 150, 150, 150, 2f),
  172.                     Radius = 0.3f
  173.                 },
  174.                 new GroundCircleDecorator(Hud) {
  175.                     Brush = Hud.Render.CreateBrush(255, 255, 255, 0, 4f),
  176.                     Radius = 0.1f
  177.                 }
  178.             );
  179.  
  180.         }
  181.  
  182.         public void OnKeyEvent(IKeyEvent keyEvent)
  183.         {
  184.             if (keyEvent.IsPressed && ToggleKeyEvent.Matches(keyEvent) )
  185.             {
  186.                 currentYard = (currentYard  != 40) ? 40 : 120;
  187.             }
  188.         }
  189.  
  190.         public void OnNewArea(bool newGame, ISnoArea area)
  191.         {
  192.             MapGR = ( Hud.Game.Me.InGreaterRift && (area.HostAreaSno == 288482 || area.Sno == 288482) ) ? true : false;
  193.         }
  194.  
  195.         public void PaintWorld(WorldLayer layer)
  196.         {
  197.             if ((Hud.Game.IsInGame) && (!Hud.Game.IsInTown)) {
  198.                 if ( !OnlyGR || MapGR )
  199.                 {
  200.                     var monsters = Hud.Game.AliveMonsters ;
  201.                     if (layer == WorldLayer.Ground)
  202.                     {
  203.                         var magos = 0; var esqu = 0; var madr = 0; var hijos = 0; var  trans = 0; var  Trans = 0;
  204.                         foreach (var monster in monsters)
  205.                         {
  206.                             switch (monster.SnoMonster.Sno) // monster sno , el actor sno está a la derecha precedido por A
  207.                             {
  208.                                 case 26421:  // A6638  , Deathspitter ,  ¿ saca 26427?
  209.                                 case 26423:  // A6639  , Retching Cadaver , saca 26427
  210.                                 case 116426: // A6640  , Spewing Horror, amarillo  , saca 202190
  211.                                 case 116427: // A6641  , Dust Retcher , amarillo  , saca 218796
  212.                                     if (YardAll || monster.FloorCoordinate.XYDistanceTo(Hud.Game.Me.FloorCoordinate) <= currentYard) { madr++; }
  213.                                     if (Labels && monster.IsOnScreen)
  214.                                     {
  215.                                         DecoratorMother.OffsetY = (monster.Rarity != ActorRarity.Normal)? -40f:0f;
  216.                                         DecoratorMother.Paint(monster, monster.FloorCoordinate,"Mother");
  217.                                     }
  218.                                     if ( CircleAnimated && (!CircleAnimatedOnlyNoElites || !monster.IsElite)) CircleAnimatedRed.Paint(layer, monster, monster.FloorCoordinate, "");
  219.                                     break;
  220.                                 case 26427:  // A6646    , zombies de azul (Retching Cadaver)
  221.                                 case 202190: // A6651    , zombies de amarillo
  222.                                 case 218796: // A218795  , zombies de amarillo
  223.                                     if ((monster.SummonerAcdDynamicId != 0) && (monster.Rarity == ActorRarity.Normal))
  224.                                     {
  225.                                         if (YardAll || monster.FloorCoordinate.XYDistanceTo(Hud.Game.Me.FloorCoordinate) <= currentYard) {  hijos++ ; }
  226.                                         if (Circles && monster.IsOnScreen)  CirclesMother.Paint(layer, monster, monster.FloorCoordinate, "" );
  227.                                     }
  228.                                     break;
  229.                                 case 26283:  // A5387     , Tomb Guardian     , amarillo y blanco
  230.                                 case 26284:  // A5388     , Returned Summoner , amarillo
  231.                                 case 94183:  // A5389     , Tortured Summoner , azul , saca 230836
  232.                                 case 144988: // A5390     , Vengeful Summoner
  233.                                     if (YardAll || monster.FloorCoordinate.XYDistanceTo(Hud.Game.Me.FloorCoordinate) <= currentYard) {  magos++; }
  234.                                     if (Labels && monster.IsOnScreen)
  235.                                     {
  236.                                         DecoratorSummoner.OffsetY = (monster.Rarity != ActorRarity.Normal)? -40f:0f; //DecoratorSummoner.OffsetY = ( (monster.Rarity == ActorRarity.Champion) || (monster.Rarity == ActorRarity.Rare))? -40f:0f;
  237.                                         DecoratorSummoner.Paint(monster, monster.FloorCoordinate,"Summ");
  238.                                     }
  239.                                     if ( CircleAnimated && (!CircleAnimatedOnlyNoElites || !monster.IsElite)) CircleAnimatedGreen.Paint(layer, monster, monster.FloorCoordinate, "");
  240.                                     break;
  241.                                 case 26285:  // A5393    , Creados por amarillo
  242.                                 case 26286:  // A5395    , Creados por blanco
  243.                                 case 230836: // A230834  , arqueros de azul (Tortured Summoner)
  244.                                 case 137005: // A_shield_skeleton_d
  245.                                     if ((monster.SummonerAcdDynamicId != 0) && (monster.Rarity == ActorRarity.Normal))
  246.                                     {
  247.                                         if (YardAll || monster.FloorCoordinate.XYDistanceTo(Hud.Game.Me.FloorCoordinate) <= currentYard) { esqu++;  }
  248.                                         if (Circles && monster.IsOnScreen) CirclesSumm.Paint(layer, monster, monster.FloorCoordinate, "" );
  249.                                     }
  250.                                     break;
  251.                                 case 26364:  // A6046
  252.                                 case 164138: // A6048
  253.                                     if (YardAll || monster.FloorCoordinate.XYDistanceTo(Hud.Game.Me.FloorCoordinate) <= currentYard) { trans++; }
  254.                                     if (Circles && monster.IsOnScreen) CirclesTr.Paint(layer, monster, monster.FloorCoordinate, "" );
  255.                                     if ( CircleAnimated && (!CircleAnimatedOnlyNoElites || !monster.IsElite)) CircleAnimatedYellow.Paint(layer, monster, monster.FloorCoordinate, "");
  256.                                     break;
  257.                                 case 26362:  // A6042
  258.                                 case 164146: // A6044
  259.                                     if (YardAll || monster.FloorCoordinate.XYDistanceTo(Hud.Game.Me.FloorCoordinate) <= currentYard) { Trans++; }
  260.                                     if (Circles && monster.IsOnScreen) CirclesTR.Paint(layer, monster, monster.FloorCoordinate, "" );
  261.                                     break;
  262.                                 default:
  263.                                     break;
  264.                             }
  265.                         }
  266.  
  267.                         if (ShowCounters)
  268.                         {
  269.                             var x = Hud.Window.Size.Width * XPor; var y = Hud.Window.Size.Height * YPor;
  270.                             var layout = OrangeFontm.GetTextLayout( (YardAll)? "All": (currentYard + "y"));
  271.                             OrangeFontm.DrawText(layout, x - layout.Metrics.Width - OrangeFontm.GetTextLayout("O").Metrics.Width, y);
  272.  
  273.                             ContadorFont = (madr + hijos > 0)? RojoFontm:RojoFonth;
  274.                             layout = ContadorFont.GetTextLayout("Mom: " + madr + " (" + hijos +")");
  275.                             ContadorFont.DrawText(layout, x, y);
  276.                             x += layout.Metrics.Width + ContadorFont.GetTextLayout("O").Metrics.Width * 1.5f;
  277.  
  278.                             ContadorFont = (magos + esqu > 0)? VerdeFontm:VerdeFonth;
  279.                             layout = ContadorFont.GetTextLayout("Sum: " + magos + " (" + esqu + ")");
  280.                             ContadorFont.DrawText(layout, x, y);
  281.                             x += layout.Metrics.Width + ContadorFont.GetTextLayout("O").Metrics.Width * 1.5f;
  282.  
  283.                             ContadorFont = (trans + Trans > 0)? AmarilloFontm:AmarilloFonth;
  284.                             layout = ContadorFont.GetTextLayout("Tr: " + Trans  + "/" + (Trans+trans));
  285.                             ContadorFont.DrawText(layout, x, y);
  286.                         }
  287.                     }
  288.                     else
  289.                     {
  290.                         if (CircleAnimated)
  291.                         {
  292.                             foreach (var monster in monsters)
  293.                             {
  294.                                 switch (monster.SnoMonster.Sno)
  295.                                 {
  296.                                     case 26421:
  297.                                     case 26423:
  298.                                     case 116426:
  299.                                     case 116427:
  300.                                         if (!CircleAnimatedOnlyNoElites || !monster.IsElite) CircleAnimatedRed.Paint(layer, monster, monster.FloorCoordinate, "");
  301.                                         break;
  302.                                     case 26283:
  303.                                     case 26284:
  304.                                     case 94183:
  305.                                     case 144988:
  306.                                         if (!CircleAnimatedOnlyNoElites || !monster.IsElite) CircleAnimatedGreen.Paint(layer, monster, monster.FloorCoordinate, "");
  307.                                         break;
  308.                                     case 26364:
  309.                                     case 164138:
  310.                                         if (!CircleAnimatedOnlyNoElites || !monster.IsElite) CircleAnimatedYellow.Paint(layer, monster, monster.FloorCoordinate, "");
  311.                                         break;
  312.                                 }
  313.                             }
  314.                         }
  315.                     }
  316.                 }
  317.             }
  318.         }
  319.    }
  320. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement