Advertisement
RNNCode

ICount

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