Advertisement
jarppaaja

PluginEnablerOrDisablerPlugin

Mar 16th, 2019
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 11.72 KB | None | 0 0
  1. // PluginEnablerOrDisablerPlugin.cs "$Revision: 1394 $" "$Date: 2019-03-16 12:39:39 +0200 (la, 16 maalis 2019) $"
  2. using SharpDX.Direct2D1;
  3. using System.Collections.Generic;
  4. using Turbo.Plugins.Default;
  5.  
  6. namespace Turbo.Plugins.User
  7. {
  8.     public class PluginEnablerOrDisablerPlugin : BasePlugin, ICustomizer
  9.     {
  10.         public PluginEnablerOrDisablerPlugin() { Enabled = true; Order = 100; }
  11.  
  12.         public void Customize()
  13.         {
  14.             // Bottom panel customization.
  15.  
  16.             // Hide DPS label that is over normal skill "key" label.
  17.             Hud.RunOnPlugin<Turbo.Plugins.Default.OriginalSkillBarPlugin>(plugin =>
  18.             {
  19.                 plugin.SkillPainter.EnableSkillDpsBar = false;
  20.                 plugin.SkillPainter.EnableDetailedDpsHint = false;
  21.             });
  22.  
  23.             // Inventory and Stash customization.
  24.  
  25.             // Disable item graying and cube animation.
  26.             Hud.RunOnPlugin<Turbo.Plugins.Default.InventoryAndStashPlugin>(plugin =>
  27.             {
  28.                 plugin.LooksGoodDisplayEnabled = false;
  29.                 plugin.NotGoodDisplayEnabled = false;
  30.                 plugin.DefinitelyBadDisplayEnabled = false;
  31.                 plugin.CanCubedEnabled = false;
  32.             });
  33.  
  34.             // Minimap customization.
  35.  
  36.             // Show only Normal and Resplendent chests.
  37.             Hud.RunOnPlugin<Turbo.Plugins.Default.ChestPlugin>(plugin =>
  38.             {
  39.                 plugin.LoreChestDecorator.Decorators.Clear();
  40.             });
  41.  
  42.             // Worldmap and Minimap customization.
  43.  
  44.             // Disable default Monster plugin - can be enabled and works with MyMonsterColoring.
  45.             Hud.TogglePlugin<Turbo.Plugins.Default.StandardMonsterPlugin>(false);
  46.             // Disable default MonsterRiftProgressionColoringPlugin.
  47.             Hud.TogglePlugin<Turbo.Plugins.Default.MonsterRiftProgressionColoringPlugin>(false);
  48.             // Enable "minimalistic" custom monster coloring scheme both in rifts and outside them.
  49.             Hud.TogglePlugin<Turbo.Plugins.User.MyMonsterColoring>(true);
  50.  
  51.             // Make Pickup Range indicator more "prominent" but disable it. Some builds might find this useful, though.
  52.             Hud.RunOnPlugin<Turbo.Plugins.Default.PickupRangePlugin>(plugin =>
  53.             {
  54.                 plugin.Enabled = false;
  55.                 plugin.FillBrush = Hud.Render.CreateBrush(6, 255, 255, 255, 0);
  56.                 plugin.OutlineBrush = Hud.Render.CreateBrush(24, 0, 0, 0, 3);
  57.  
  58.             });
  59.             // Show only ancient and primal data, hide item labels.
  60.             Hud.RunOnPlugin<Turbo.Plugins.Default.ItemsPlugin>(plugin =>
  61.             {
  62.                 plugin.EnableSpeakPrimal = true;
  63.                 plugin.EnableSpeakPrimalSet = true;
  64.  
  65.                 plugin.LegendaryDecorator.Enabled = false;
  66.                 plugin.SetDecorator.Enabled = false;
  67.                 plugin.InArmorySetDecorator.Enabled = false;
  68.  
  69.                 plugin.AncientDecorator.ToggleDecorators<GroundLabelDecorator>(false);
  70.                 plugin.AncientDecorator.Decorators.Add(new MapLabelDecorator(Hud)
  71.                 {
  72.                     LabelFont = Hud.Render.CreateFont("tahoma", 6, 255, 235, 120, 0, true, false, false),
  73.                     RadiusOffset = 14,
  74.                     Up = true,
  75.                 });
  76.                 plugin.AncientSetDecorator.ToggleDecorators<GroundLabelDecorator>(false);
  77.                 plugin.AncientSetDecorator.Decorators.Add(new MapLabelDecorator(Hud)
  78.                 {
  79.                     LabelFont = Hud.Render.CreateFont("tahoma", 6, 255, 0, 170, 0, true, false, false),
  80.                     RadiusOffset = 14,
  81.                     Up = true,
  82.                 });
  83.                 plugin.PrimalDecorator.ToggleDecorators<GroundLabelDecorator>(false);
  84.                 plugin.PrimalDecorator.Decorators.Add(new MapLabelDecorator(Hud)
  85.                 {
  86.                     LabelFont = Hud.Render.CreateFont("tahoma", 7, 255, 240, 20, 0, true, false, false),
  87.                     RadiusOffset = 14,
  88.                     Up = true,
  89.                 });
  90.                 plugin.PrimalSetDecorator.ToggleDecorators<GroundLabelDecorator>(false);
  91.                 plugin.PrimalSetDecorator.Decorators.Add(new MapLabelDecorator(Hud)
  92.                 {
  93.                     LabelFont = Hud.Render.CreateFont("tahoma", 7, 255, 240, 20, 0, true, false, false),
  94.                     RadiusOffset = 14,
  95.                     Up = true,
  96.                 });
  97.                 // Add ground circle for Death Breaths.
  98.                 plugin.DeathsBreathDecorator.Add(new GroundCircleDecorator(Hud)
  99.                 {
  100.                     Brush = Hud.Render.CreateBrush(192, 102, 202, 177, -2),
  101.                     Radius = 1.25f,
  102.                 });
  103.             });
  104.  
  105.             // Change Sentry minimap markers from orange triangle to white plus-sign.
  106.             Hud.RunOnPlugin<PlayerSkillPlugin>(plugin =>
  107.             {
  108.                 List<IWorldDecorator> decorators = new List<IWorldDecorator>();
  109.                 decorators.AddRange(plugin.SentryDecorator.Decorators);
  110.                 decorators.AddRange(plugin.SentryWithCustomEngineeringDecorator.Decorators);
  111.                 foreach (var decorator in decorators)
  112.                 {
  113.                     if (decorator is MapShapeDecorator)
  114.                     {
  115.                         ((MapShapeDecorator)decorator).Brush = Hud.Render.CreateBrush(255, 255, 255, 255, 2.5f);
  116.                         ((MapShapeDecorator)decorator).ShapePainter = new PlusShapePainter(Hud);
  117.                         ((MapShapeDecorator)decorator).Radius = 4.5f;
  118.                     }
  119.                 }
  120.             });
  121.         }
  122.     }
  123.  
  124.     public class MyMonsterColoring : BasePlugin, IInGameWorldPainter
  125.     {
  126.         public float TrashBreakpoint { get; set; } = 2.50f; // 33% of rift orb value breakpoint.
  127.         public float KillBreakpoint { get; set; } = 3.75f;  // 50% of rift orb value breakpoint.
  128.  
  129.         // Monster decorators by type.
  130.         public WorldDecoratorCollection EliteDecorator { get; set; }        // Supports GroundLabelDecorator, other decorators do not!
  131.         public WorldDecoratorCollection BlueDecorator { get; set; }
  132.         public WorldDecoratorCollection GreenDecorator { get; set; }
  133.         public WorldDecoratorCollection GreyDecorator { get; set; }
  134.  
  135.         // Special decorators.
  136.         public WorldDecoratorCollection BossDecorator { get; set; }         // Draws 50 yard circle around boss.
  137.         public WorldDecoratorCollection PlayerDecorator { get; set; }       // Draws player hitbox to show where player is during boss/elite fights.
  138.         public IBrush ShadowBrush { get; set; }
  139.  
  140.         public float RiftProgressionRange { get; set; } = 50f;
  141.         public float BossCirleRadius { get; set; } = 50f;
  142.  
  143.         public MyMonsterColoring() { Enabled = true; Order = 500; }
  144.  
  145.         public override void Load(IController hud)
  146.         {
  147.             base.Load(hud);
  148.  
  149.             ShadowBrush = Hud.Render.CreateBrush(96, 0, 0, 0, 1);
  150.  
  151.             BossDecorator = new WorldDecoratorCollection(
  152.                 new GroundCircleDecorator(Hud)
  153.                 {
  154.                     Brush = Hud.Render.CreateBrush(255, 192, 96, 0, 1.5f),  // Dim orange circle
  155.                     Radius = BossCirleRadius,
  156.                 }
  157.                 );
  158.             PlayerDecorator = new WorldDecoratorCollection(
  159.                 new GroundCircleDecorator(Hud)
  160.                 {
  161.                     Brush = Hud.Render.CreateBrush(255, 153, 204, 255, 3.5f, DashStyle.DashDot),    // Light blue dash-dotted circle
  162.                     Radius = -1,
  163.                 }
  164.                 );
  165.             EliteDecorator = new WorldDecoratorCollection(
  166.                 new MapShapeDecorator(Hud)
  167.                 {
  168.                     ShapePainter = new CircleShapePainter(Hud),
  169.                     Brush = Hud.Render.CreateBrush(255, 255, 200, 100, 2),  // Dim yellow circle
  170.                     ShadowBrush = ShadowBrush,
  171.                     Radius = 4f,
  172.                 },
  173.                 new GroundCircleDecorator(Hud)
  174.                 {
  175.                     Brush = Hud.Render.CreateBrush(255, 255, 0, 255, 2f),   // Violet circle for monster hitbox
  176.                     Radius = -1,    // Show monster hitbox
  177.                 }
  178.                 );
  179.             BlueDecorator = new WorldDecoratorCollection(
  180.                 new MapShapeDecorator(Hud)
  181.                 {
  182.                     ShapePainter = new CircleShapePainter(Hud),
  183.                     Brush = Hud.Render.CreateBrush(255, 60, 128, 255, 3),   // Dodger blue circle
  184.                     ShadowBrush = ShadowBrush,
  185.                     Radius = 3.5f,
  186.                 }
  187.                 );
  188.             GreenDecorator = new WorldDecoratorCollection(
  189.                 new MapShapeDecorator(Hud)
  190.                 {
  191.                     ShapePainter = new CircleShapePainter(Hud),
  192.                     Brush = Hud.Render.CreateBrush(255, 128, 255, 0, 3),    // Green circle
  193.                     ShadowBrush = ShadowBrush,
  194.                     Radius = 3f,
  195.                 }
  196.                 );
  197.             GreyDecorator = new WorldDecoratorCollection(
  198.                 new MapShapeDecorator(Hud)
  199.                 {
  200.                     Brush = Hud.Render.CreateBrush(128, 217, 217, 217, 0),  // Light grey dot
  201.                     ShadowBrush = ShadowBrush,
  202.                     ShapePainter = new CircleShapePainter(Hud),
  203.                     Radius = 2.5f,
  204.                 }
  205.                 );
  206.         }
  207.  
  208.         public void PaintWorld(WorldLayer layer)
  209.         {
  210.             if (Hud.Game.IsInTown) return;
  211.             if ((Hud.Game.MapMode == MapMode.WaypointMap) || (Hud.Game.MapMode == MapMode.ActMap) || (Hud.Game.MapMode == MapMode.Map)) return;
  212.  
  213.             bool inRift = Hud.Game.SpecialArea == SpecialArea.Rift || Hud.Game.SpecialArea == SpecialArea.GreaterRift;
  214.             int eliteCount = 0;
  215.             foreach (var monster in Hud.Game.AliveMonsters)
  216.             {
  217.                 if (monster.IsElite)
  218.                 {
  219.                     eliteCount += 1;
  220.                     EliteDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
  221.                     if (monster.SnoMonster.Priority == MonsterPriority.boss && BossDecorator != null)
  222.                     {
  223.                         BossDecorator.Paint(layer, monster, monster.FloorCoordinate, null);
  224.                     }
  225.                 }
  226.                 else if (inRift)
  227.                 {
  228.                     if (monster.NormalizedXyDistanceToMe < RiftProgressionRange && monster.SnoMonster.RiftProgression > 0)
  229.                     {
  230.                         if (monster.SnoMonster.RiftProgression < TrashBreakpoint)
  231.                         {
  232.                             GreyDecorator.Paint(layer, monster, monster.FloorCoordinate, null);     // Trash.
  233.                         }
  234.                         else if (monster.SnoMonster.RiftProgression < KillBreakpoint)
  235.                         {
  236.                             GreenDecorator.Paint(layer, monster, monster.FloorCoordinate, null);    // Some value.
  237.                         }
  238.                         else
  239.                         {
  240.                             BlueDecorator.Paint(layer, monster, monster.FloorCoordinate, null);     // Rest is best.
  241.                         }
  242.                     }
  243.                 }
  244.                 else
  245.                 {
  246.                     GreyDecorator.Paint(layer, monster, monster.FloorCoordinate, null);             // What ever.
  247.                 }
  248.             }
  249.             if (eliteCount > 0 && PlayerDecorator != null)
  250.             {
  251.                 PlayerDecorator.Paint(layer, Hud.Game.Me, Hud.Game.Me.FloorCoordinate, null);
  252.             }
  253.         }
  254.     }
  255. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement