Advertisement
RNNCode

ICount

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