RNNCode

MonsterCirclePlugin_Mod

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