Advertisement
RNNCode

MonsterCirclePlugin_Mod

May 16th, 2019 (edited)
2,069
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 16.04 KB | None | 0 0
  1. // Mod of the plugin MonsterCirclePlugin by CB. The original can be found:
  2. // https://www.ownedcore.com/forums/diablo-3/turbohud/turbohud-community-plugins/612786-international-cb-monstercircleplugin.html
  3. // Changes: Draw different circles to indicate that the elites have certain abilities. Disable EliteMonsterAffixPlugin automatically if DisableEMAffix = true
  4.  
  5. using System.Collections.Generic;
  6. using Turbo.Plugins.Default;
  7. using System.Linq;
  8. using System;
  9.  
  10. namespace Turbo.Plugins.CB
  11. {
  12.     public class MonsterCirclePlugin_Mod : BasePlugin, IInGameWorldPainter, ICustomizer
  13.     {
  14.         public WorldDecoratorCollection RareDecorator { get; set; }
  15.  
  16.         public WorldDecoratorCollection ShieldDecorator { get; set; }
  17.         public WorldDecoratorCollection IlusDecorator { get; set; }
  18.         public WorldDecoratorCollection ChainsDecorator { get; set; }
  19.         public WorldDecoratorCollection WormDecorator { get; set; }
  20.         public WorldDecoratorCollection MortarDecorator { get; set; }
  21.         public WorldDecoratorCollection TeleportDecorator { get; set; }
  22.         public WorldDecoratorCollection WallerDecorator { get; set; }
  23.         public WorldDecoratorCollection InvisDecorator { get; set; }
  24.  
  25.         public WorldDecoratorCollection ChampionDecorator { get; set; }
  26.         public WorldDecoratorCollection ChampionDecoratorH { get; set; }
  27.         public WorldDecoratorCollection JuggernautDecorator { get; set; }
  28.         public WorldDecoratorCollection GoblinDecorator { get; set; } // Goblin
  29.         public WorldDecoratorCollection RareMinionDecorator { get; set; }   // Elite Minion
  30.         public WorldDecoratorCollection UniqueDecorator { get; set; }   //Purple
  31.         public WorldDecoratorCollection BossDecorator { get; set; }   //Boss
  32.  
  33.         public WorldDecoratorCollection HitBoxEliteDecorator { get; set; }
  34.         public WorldDecoratorCollection EliteIluAcdDecorator { get; set; }
  35.  
  36.         public bool ShowHitBox { get; set; }
  37.         public bool ShowWaller { get; set; }
  38.         public bool ShowMortar { get; set; }
  39.         public bool ShowTeleport { get; set; }
  40.  
  41.         public bool DisableEMAffix { get; set; }
  42.  
  43.         public MonsterCirclePlugin_Mod ()
  44.         {
  45.             Enabled = true;
  46.         }
  47.  
  48.         public override void Load(IController hud)
  49.         {
  50.             base.Load(hud);
  51.             ShowHitBox = true;      //Show HitBox of monster
  52.             ShowWaller = false;     //Show circle for Waller
  53.             ShowMortar = false;     //Show circle for Mortar
  54.             ShowTeleport = false;   //Show circle for Teleport
  55.  
  56.             DisableEMAffix = true;  // Disable default plugin EliteMonsterAffixPlugin
  57.  
  58.             var shadowBrush = Hud.Render.CreateBrush(96, 0, 0, 0, 1);
  59.  
  60.             HitBoxEliteDecorator = new WorldDecoratorCollection(
  61.                 new GroundCircleDecorator(Hud) {
  62.                     Brush = Hud.Render.CreateBrush(20, 200, 250, 250, 0),
  63.                     Radius = -1
  64.                 },
  65.                 new GroundCircleDecorator(Hud) {
  66.                     Brush = Hud.Render.CreateBrush(220, 0, 0, 0, 0.1f),
  67.                     Radius = -1
  68.                 }
  69.             );
  70.             EliteIluAcdDecorator = new WorldDecoratorCollection(
  71.                 new GroundCircleDecorator(Hud) {
  72.                     Brush = Hud.Render.CreateBrush(10, 200, 250, 250, 0),
  73.                     Radius = -1
  74.                 },
  75.                 new GroundCircleDecorator(Hud) {
  76.                     Brush = Hud.Render.CreateBrush(100,220, 220, 220, 0.7f),
  77.                     Radius = -1
  78.                 }
  79.             );
  80.  
  81.             GoblinDecorator = new WorldDecoratorCollection(
  82.                 new GroundCircleDecorator(Hud) {
  83.                     Brush = Hud.Render.CreateBrush(255, 57, 194, 29, 3),
  84.                     Radius = 3
  85.                 },
  86.                 new GroundCircleDecorator(Hud) {
  87.                     Brush = Hud.Render.CreateBrush(255, 240, 213, 10, 5),
  88.                     Radius = 2
  89.                 },
  90.                 new GroundCircleDecorator(Hud) {
  91.                     Brush = Hud.Render.CreateBrush(180, 255, 0, 0, 6),
  92.                     Radius = 0.3f
  93.                 }
  94.             );
  95.             RareDecorator = new WorldDecoratorCollection(
  96.                 new GroundCircleDecorator(Hud) {
  97.                     Brush = Hud.Render.CreateBrush(255, 255, 148, 20, 3),
  98.                     Radius = 3f
  99.                 },
  100.                 new GroundCircleDecorator(Hud) {
  101.                     Brush = Hud.Render.CreateBrush(255, 255, 148, 20, 5),
  102.                     Radius = 2f
  103.                 },
  104.                 new GroundCircleDecorator(Hud) {
  105.                     Brush = Hud.Render.CreateBrush(180, 255, 0, 0, 6),
  106.                     Radius = 0.3f
  107.                 },
  108.  
  109.                 new MapShapeDecorator(Hud) {
  110.                     Brush = Hud.Render.CreateBrush(255, 255, 148, 20, 0),
  111.                     Radius = 6,
  112.                     ShapePainter = new CircleShapePainter(Hud)
  113.                 }
  114.             );
  115.             ChampionDecorator = new WorldDecoratorCollection(
  116.                 new GroundCircleDecorator(Hud) {
  117.                     Brush = Hud.Render.CreateBrush(255, 64, 128, 255, 3),
  118.                     Radius = 3f
  119.                 },
  120.                 new GroundCircleDecorator(Hud) {
  121.                     Brush = Hud.Render.CreateBrush(255, 64, 128, 255, 5),
  122.                     Radius = 2f
  123.                 },
  124.                 new GroundCircleDecorator(Hud) {
  125.                     Brush = Hud.Render.CreateBrush(180, 255, 0, 0, 6),
  126.                     Radius = 0.3f
  127.                 },
  128.                 new MapShapeDecorator(Hud) {
  129.                     Brush = Hud.Render.CreateBrush(255, 64, 128, 255, 0),
  130.                    Radius = 6,
  131.                     ShapePainter = new CircleShapePainter(Hud)
  132.                 }
  133.             );
  134.             ChampionDecoratorH = new WorldDecoratorCollection(
  135.                 new GroundCircleDecorator(Hud) {
  136.                     Brush = Hud.Render.CreateBrush(255, 64, 128, 255, 3, SharpDX.Direct2D1.DashStyle.Dash),
  137.                     Radius = 3f
  138.                 },
  139.                 new GroundCircleDecorator(Hud) {
  140.                     Brush = Hud.Render.CreateBrush(255, 64, 128, 255, 5),
  141.                     Radius = 2f
  142.                 },
  143.                 new GroundCircleDecorator(Hud) {
  144.                     Brush = Hud.Render.CreateBrush(180, 255, 0, 0, 6),
  145.                     Radius = 0.3f
  146.                 },
  147.                 new MapShapeDecorator(Hud) {
  148.                     Brush = Hud.Render.CreateBrush(255, 64, 128, 255, 0),
  149.                     Radius = 6,
  150.                     ShapePainter = new CircleShapePainter(Hud)
  151.                 }
  152.             );
  153.  
  154.             JuggernautDecorator = new WorldDecoratorCollection(
  155.                 new GroundCircleDecorator(Hud)
  156.                 {
  157.                     Brush = Hud.Render.CreateBrush(255, 255, 50, 0, 3),
  158.                     Radius = 3f,
  159.                 },
  160.                 new GroundCircleDecorator(Hud) {
  161.                     Brush = Hud.Render.CreateBrush(255, 255, 148, 20, 5),
  162.                     Radius = 2
  163.                 },
  164.                 new GroundCircleDecorator(Hud) {
  165.                     Brush = Hud.Render.CreateBrush(180, 255, 0, 0, 6),
  166.                     Radius = 0.3f
  167.                 },
  168.  
  169.                 new MapShapeDecorator(Hud)
  170.                 {
  171.                     Brush = Hud.Render.CreateBrush(255, 255, 50, 0, 0),
  172.                     ShadowBrush = shadowBrush,
  173.                     Radius = 6,
  174.                     ShapePainter = new CircleShapePainter(Hud),
  175.                 }
  176.              );
  177.  
  178.             MortarDecorator = new WorldDecoratorCollection(
  179.                 new GroundCircleDecorator(Hud) {
  180.                     Brush = Hud.Render.CreateBrush(255, 180, 180, 180, 3, SharpDX.Direct2D1.DashStyle.Dash),
  181.                     Radius = 1.75f
  182.                 }
  183.             );
  184.  
  185.             TeleportDecorator = new WorldDecoratorCollection(
  186.                 new GroundCircleDecorator(Hud) {
  187.                     //Brush = Hud.Render.CreateBrush(255, 200, 200, 200, 3),
  188.                     Brush = Hud.Render.CreateBrush(220, 100, 250, 250, 3),
  189.                     Radius = 1.55f
  190.                 }
  191.             );
  192.  
  193.             WallerDecorator = new WorldDecoratorCollection(
  194.                 new GroundCircleDecorator(Hud) {
  195.                     Brush = Hud.Render.CreateBrush(255, 190, 95, 0, 4),
  196.                     Radius = 1.25f
  197.                 }
  198.             );
  199.  
  200.             IlusDecorator = new WorldDecoratorCollection(
  201.                 new GroundCircleDecorator(Hud) {
  202.                     Brush = Hud.Render.CreateBrush(255, 57, 194, 29, 4),
  203.                     Radius = 2.25f
  204.                 }
  205.             );
  206.             ChainsDecorator = new WorldDecoratorCollection(
  207.                 new GroundCircleDecorator(Hud) {
  208.                     Brush = Hud.Render.CreateBrush(255, 255, 20, 0, 3, SharpDX.Direct2D1.DashStyle.Dash),
  209.                     Radius = 2.5f
  210.                 }
  211.             );
  212.             WormDecorator = new WorldDecoratorCollection(
  213.                 new GroundCircleDecorator(Hud) {
  214.                     Brush = Hud.Render.CreateBrush(255, 255, 170, 0, 3, SharpDX.Direct2D1.DashStyle.Dash),
  215.                     Radius = 2.5f
  216.                 }
  217.             );
  218.  
  219.             ShieldDecorator = new WorldDecoratorCollection(
  220.                 new GroundCircleDecorator(Hud) {
  221.                     Brush = Hud.Render.CreateBrush(255, 255, 255, 0, 3),
  222.                     Radius = 2.75f
  223.                 }
  224.             );
  225.  
  226.  
  227.             InvisDecorator = new WorldDecoratorCollection(
  228.                 new GroundCircleDecorator(Hud) {
  229.                     Brush = Hud.Render.CreateBrush(255, 255, 255, 255, 6),
  230.                     Radius = 3.40f
  231.                 }
  232.             );
  233.  
  234.         RareMinionDecorator = new WorldDecoratorCollection(
  235.                 new GroundCircleDecorator(Hud) {
  236.                     Brush = Hud.Render.CreateBrush(255, 255, 148, 20, 3, SharpDX.Direct2D1.DashStyle.Dash),
  237.                     Radius = 3
  238.                 },
  239.                 new GroundCircleDecorator(Hud) {
  240.                     Brush = Hud.Render.CreateBrush(180, 255, 0, 0, 6, SharpDX.Direct2D1.DashStyle.Dash),
  241.                     Radius = 0
  242.                 },
  243.                 new MapShapeDecorator(Hud) {
  244.                     Brush = Hud.Render.CreateBrush(255, 192, 92, 20, 2.0f),
  245.                     Radius = 4,
  246.                     ShapePainter = new CircleShapePainter(Hud)
  247.                 }
  248.         );
  249.  
  250.         UniqueDecorator = new WorldDecoratorCollection(
  251.                 new GroundCircleDecorator(Hud) {
  252.                     Brush = Hud.Render.CreateBrush(255,255,140,255, 3),
  253.                     Radius = 3
  254.                 },
  255.                 new GroundCircleDecorator(Hud) {
  256.                     Brush = Hud.Render.CreateBrush(255,255,140,255, 5),
  257.                     Radius = 2
  258.                 },
  259.                 new GroundCircleDecorator(Hud) {
  260.                     Brush = Hud.Render.CreateBrush(180, 255, 0, 0, 6),
  261.                     Radius = 0.3f
  262.                 },
  263.                 new MapShapeDecorator(Hud) {
  264.                     Brush = Hud.Render.CreateBrush(255,255,140,255, 0),
  265.                     Radius = 6,
  266.                     ShapePainter = new CircleShapePainter(Hud)
  267.                 }
  268.             );
  269.  
  270.         BossDecorator = new WorldDecoratorCollection(
  271.                 new GroundCircleDecorator(Hud) {
  272.                     Brush = Hud.Render.CreateBrush(255, 255, 96, 0, 4),
  273.                     Radius = 4
  274.                 },
  275.                 new GroundCircleDecorator(Hud) {
  276.                     Brush = Hud.Render.CreateBrush(255, 255, 96, 0, 5),
  277.                     Radius = 2
  278.                 },
  279.                 new GroundCircleDecorator(Hud) {
  280.                     Brush = Hud.Render.CreateBrush(180, 255, 0, 0, 6),
  281.                     Radius = 0.3f
  282.                 },
  283.                 new MapShapeDecorator(Hud) {
  284.                     Brush = Hud.Render.CreateBrush(255, 255, 96, 0, 0),
  285.                     Radius = 6,
  286.                     ShapePainter = new CircleShapePainter(Hud)
  287.                 }
  288.             );
  289.         }
  290.  
  291.         public void Customize()
  292.         {
  293.             if (DisableEMAffix) { Hud.TogglePlugin<EliteMonsterAffixPlugin>(false); }
  294.         }
  295.  
  296.         private bool HasAffix(IMonster m, MonsterAffix afx)
  297.         {
  298.             return m.AffixSnoList.Any(a => a.Affix == afx);
  299.         }
  300.  
  301.         public void PaintWorld(WorldLayer layer)
  302.         {
  303.             if (!Hud.Game.IsInGame || Hud.Game.Me.IsInTown) return;
  304.             var monsters = Hud.Game.AliveMonsters;
  305.             var goblins = Hud.Game.AliveMonsters.Where(x => x.SnoMonster.Priority == MonsterPriority.goblin);
  306.             foreach (var monster in goblins)
  307.             {
  308.                 GoblinDecorator.Paint(layer, monster, monster.FloorCoordinate, null);
  309.             }
  310.  
  311.             List<IMonster> monstersElite = new List<IMonster>();
  312.             foreach (var monster in monsters)
  313.             {
  314.  
  315.                 if (monster.Rarity == ActorRarity.Champion || monster.Rarity == ActorRarity.Rare)
  316.                 {
  317.                    monstersElite.Add(monster);
  318.                 }
  319.  
  320.                 else if (monster.Rarity == ActorRarity.RareMinion) {
  321.                     if (monster.SummonerAcdDynamicId != 0) EliteIluAcdDecorator.Paint(layer, monster, monster.FloorCoordinate, string.Empty);
  322.                     else RareMinionDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
  323.                 }
  324.  
  325.                 else if (monster.Rarity == ActorRarity.Unique) {
  326.                     UniqueDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
  327.                     if (ShowHitBox) EliteIluAcdDecorator.Paint(layer, monster, monster.FloorCoordinate, string.Empty);
  328.                 }
  329.  
  330.                 else if (monster.Rarity == ActorRarity.Boss) {
  331.                     if (monster.SummonerAcdDynamicId != 0) EliteIluAcdDecorator.Paint(layer, monster, monster.FloorCoordinate, string.Empty);
  332.                     else {
  333.                         BossDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
  334.                         if (ShowHitBox) HitBoxEliteDecorator.Paint(layer, monster, monster.FloorCoordinate, string.Empty);
  335.                     }
  336.                 }
  337.             }
  338.  
  339.             foreach (var monster in monstersElite)
  340.             {
  341.                 if (monster.SummonerAcdDynamicId == 0)
  342.                 {
  343.                     if (monster.Rarity == ActorRarity.Rare)
  344.                     {
  345.                         if (HasAffix(monster,MonsterAffix.Juggernaut))  JuggernautDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
  346.                         else RareDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
  347.                         if (HasAffix(monster,MonsterAffix.Wormhole)) WormDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
  348.                     }
  349.                     else if (monster.Rarity == ActorRarity.Champion)
  350.                     {
  351.                         if (HasAffix(monster,MonsterAffix.HealthLink))  ChampionDecoratorH.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
  352.                         else ChampionDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
  353.                         if (HasAffix(monster,MonsterAffix.FireChains)) ChainsDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
  354.                     }
  355.  
  356.                     if (HasAffix(monster,MonsterAffix.Shielding)) ShieldDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
  357.                     if (HasAffix(monster,MonsterAffix.Illusionist)) IlusDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
  358.  
  359.                     if (monster.Invisible) InvisDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
  360.  
  361.                     if ( ShowWaller && HasAffix(monster,MonsterAffix.Waller) ) WallerDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
  362.                     if ( ShowMortar && HasAffix(monster,MonsterAffix.Mortar) ) MortarDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
  363.                     if ( ShowTeleport && HasAffix(monster,MonsterAffix.Teleporter) ) TeleportDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
  364.  
  365.                     if (ShowHitBox) HitBoxEliteDecorator.Paint(layer, monster, monster.FloorCoordinate, string.Empty);
  366.                 }
  367.                 else EliteIluAcdDecorator.Paint(layer, monster, monster.FloorCoordinate, string.Empty);
  368.             }
  369.             monstersElite.Clear();
  370.         }
  371.     }
  372. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement