Advertisement
RNNCode

ICount

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