Advertisement
RNNCode

TriunesWillPluginMOD

Feb 28th, 2023 (edited)
747
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 12.58 KB | None | 0 0
  1. // Mod TriunesWillPlugin (Added Oculus) , Original : https://www.ownedcore.com/forums/diablo-3/turbohud/turbohud-community-plugins/797748-int-extended-triuneswillplugin.html
  2. // Ground Decorators & Timers for Triune's Will circles from Season 18 buff.
  3.  
  4. using Turbo.Plugins.Default;
  5. using System.Linq;
  6.  
  7. namespace Turbo.Plugins.RNN
  8. {
  9.     public class TriunesWillPluginMOD : BasePlugin, IInGameWorldPainter
  10.     {
  11.         public WorldDecoratorCollection LoveDecorator { get; set; }
  12.         public WorldDecoratorCollection DeterminationDecorator { get; set; }
  13.         public WorldDecoratorCollection CreationDecorator { get; set; }
  14.         public WorldDecoratorCollection OculusDecorator { get; set; }
  15.        
  16.         public WorldDecoratorCollection LoveInsideDecorator { get; set; }
  17.         public WorldDecoratorCollection DeterminationInsideDecorator { get; set; }
  18.         public WorldDecoratorCollection CreationInsideDecorator { get; set; }
  19.         public WorldDecoratorCollection OculusInsideDecorator { get; set; }
  20.  
  21.         public bool EnableLove { get; set; }
  22.         public bool EnableDetermination { get; set; }
  23.         public bool EnableCreation { get; set; }
  24.         public bool EnableInsideMarker { get; set; }
  25.        
  26.         private float _CircleRadius { get; set; } = 0f;
  27.         private float _InsideRadius { get; set; } = 0f;
  28.        
  29.        
  30.         public IFont DescriptionText1 { get; set; }
  31.         public IFont DescriptionText2 { get; set; }
  32.         public bool EnableDescription { get; set; }
  33.        
  34.         public uint snoPower { get; set; } = 488071; // Generic_CommunityBuffDarkAlchemy  (Old = 483606)
  35.        
  36.         public float CircleRadius
  37.         {
  38.             get { return _CircleRadius; }  
  39.             set
  40.             {
  41.                 if (value == _CircleRadius || value < 9f)   // We will not do anything if the user assigns an invalid value, or if this value matches the current one
  42.                     return;
  43.  
  44.                 _CircleRadius = value;      // We update the value
  45.                 InitDecoratorsCircle();     // Redefine Decorators
  46.             }
  47.         }
  48.         public float InsideRadius
  49.         {
  50.             get { return _InsideRadius; }
  51.             set
  52.             {
  53.                 if (value == _InsideRadius || value < 1f)
  54.                     return;
  55.  
  56.                 _InsideRadius = value;
  57.                 InitDecoratorsInside();
  58.             }
  59.         }
  60.        
  61.         private bool _ReplaceOculusOriginal { get; set; } = false;
  62.         public bool ReplaceOculusOriginal
  63.         {
  64.             get { return _ReplaceOculusOriginal; }
  65.             set
  66.             {
  67.                 _ReplaceOculusOriginal = value;
  68.                 if (_ReplaceOculusOriginal) Hud.TogglePlugin<OculusPlugin>(false);
  69.             }
  70.         }
  71.  
  72.         public TriunesWillPluginMOD()
  73.         {
  74.             Enabled = true;        
  75.         }
  76.        
  77.         public override void Load(IController hud)
  78.         {
  79.             base.Load(hud);
  80.        
  81.             EnableLove = true;      // Damage Circle
  82.             EnableCreation = true;  // CDR Circle
  83.             EnableDetermination = true; // RCR Circle          
  84.             EnableInsideMarker = true;  // Additional Circle Decorator when you are in it
  85.  
  86.             CircleRadius = 10f; //minimum 9f
  87.             InsideRadius = 10f; //minimum 1f
  88.            
  89.             ReplaceOculusOriginal = false;
  90.            
  91.             EnableDescription = true;
  92.            
  93.             DescriptionText1 = Hud.Render.CreateFont("tahoma", 8f, 255,255,255,255, false, false, 128, 0, 0, 0, true) ;
  94.             DescriptionText2 = Hud.Render.CreateFont("tahoma", 7f, 255,255,255,255, true, false, 128, 0, 0, 0, true) ;
  95.         }
  96.                
  97.         private void InitDecoratorsCircle()
  98.         {
  99.             LoveDecorator = new WorldDecoratorCollection(
  100.                 new GroundCircleDecorator(Hud)
  101.                 {
  102.                     Brush = Hud.Render.CreateBrush(255, 255, 0, 128, -2),
  103.                     Radius = CircleRadius,
  104.                 },
  105.                 new GroundLabelDecorator(Hud)
  106.                 {
  107.                     CountDownFrom = 7,
  108.                     TextFont = Hud.Render.CreateFont("tahoma", 11, 255, 255, 96, 255, true, false, 128, 0, 0, 0, true),
  109.                 },
  110.                 new GroundTimerDecorator(Hud)
  111.                 {
  112.                     CountDownFrom = 7,
  113.                     BackgroundBrushEmpty = Hud.Render.CreateBrush(128, 0, 0, 0, 0),
  114.                     BackgroundBrushFill = Hud.Render.CreateBrush(164, 192, 0, 0, 0),
  115.                     Radius = 25,
  116.                 },
  117.                 new MapShapeDecorator(Hud)
  118.                 {
  119.                     ShapePainter = new CircleShapePainter(Hud),
  120.                     Brush = Hud.Render.CreateBrush(255, 255, 0, 128, -1f),
  121.                     ShadowBrush = Hud.Render.CreateBrush(48, 0, 0, 0, 1),
  122.                     Radius = CircleRadius - 1,
  123.                 }
  124.             );
  125.  
  126.             CreationDecorator = new WorldDecoratorCollection(
  127.                 new GroundCircleDecorator(Hud)
  128.                 {
  129.                     Brush = Hud.Render.CreateBrush(255, 64, 200, 144, -2),
  130.                     Radius = CircleRadius,
  131.                 },
  132.                 new GroundLabelDecorator(Hud)
  133.                 {
  134.                     CountDownFrom = 7,
  135.                     TextFont = Hud.Render.CreateFont("tahoma", 11, 255, 96, 230, 196, true, false, 128, 0, 0, 0, true),
  136.                 },
  137.                 new GroundTimerDecorator(Hud)
  138.                 {
  139.                     CountDownFrom = 7,
  140.                     BackgroundBrushEmpty = Hud.Render.CreateBrush(128, 0, 0, 0, 0),
  141.                     BackgroundBrushFill = Hud.Render.CreateBrush(164, 0, 192, 192, 0),
  142.                     Radius = 25,
  143.                 },
  144.                 new MapShapeDecorator(Hud)
  145.                 {
  146.                     ShapePainter = new CircleShapePainter(Hud),
  147.                     Brush = Hud.Render.CreateBrush(255, 64, 200, 144, -1f),
  148.                     ShadowBrush = Hud.Render.CreateBrush(48, 0, 0, 0, 1),
  149.                     Radius = CircleRadius - 1,
  150.                 }
  151.             );
  152.  
  153.             DeterminationDecorator = new WorldDecoratorCollection(
  154.                 new GroundCircleDecorator(Hud)
  155.                 {
  156.                     Brush = Hud.Render.CreateBrush(255, 164, 150, 32, -2), // Dark Blue 0, 64, 255
  157.                     Radius = CircleRadius,
  158.                 },
  159.                 new GroundLabelDecorator(Hud)
  160.                 {
  161.                     CountDownFrom = 7,
  162.                     TextFont = Hud.Render.CreateFont("tahoma", 11, 255, 200, 200, 96, true, false, 128, 0, 0, 0, true), // Dark Blue 96, 96, 255
  163.                 },
  164.                 new GroundTimerDecorator(Hud)
  165.                 {
  166.                     CountDownFrom = 7,
  167.                     BackgroundBrushEmpty = Hud.Render.CreateBrush(128, 0, 0, 0, 0),
  168.                     BackgroundBrushFill = Hud.Render.CreateBrush(164, 164, 164, 0, 0), // Dark Blue 0, 0, 192
  169.                     Radius = 25,
  170.                 },
  171.                 new MapShapeDecorator(Hud)
  172.                 {
  173.                     ShapePainter = new CircleShapePainter(Hud),
  174.                     Brush = Hud.Render.CreateBrush(255, 164, 150, 32, -1f),
  175.                     ShadowBrush = Hud.Render.CreateBrush(48, 0, 0, 0, 1),
  176.                     Radius = CircleRadius - 1,
  177.                 }
  178.             );
  179.             OculusDecorator = new WorldDecoratorCollection(
  180.                 new GroundCircleDecorator(Hud)
  181.                 {
  182.                     Brush = Hud.Render.CreateBrush(255, 128, 255, 0, -2),
  183.                     Radius = CircleRadius,
  184.                 },
  185.                 new GroundLabelDecorator(Hud)
  186.                 {
  187.                     CountDownFrom = 7,
  188.                     TextFont = Hud.Render.CreateFont("tahoma", 11, 255, 96, 255, 96, true, false, 128, 0, 0, 0, true),
  189.                 },
  190.                 new GroundTimerDecorator(Hud)
  191.                 {
  192.                     CountDownFrom = 7,
  193.                     BackgroundBrushEmpty = Hud.Render.CreateBrush(128, 0, 0, 0, 0),
  194.                     BackgroundBrushFill = Hud.Render.CreateBrush(200, 0, 192, 0, 0),
  195.                     Radius = 25,
  196.                 },
  197.                 new MapShapeDecorator(Hud)
  198.                 {
  199.                     ShapePainter = new CircleShapePainter(Hud),
  200.                     Brush = Hud.Render.CreateBrush(255, 128, 255, 0, -1f),
  201.                     ShadowBrush = Hud.Render.CreateBrush(48, 0, 0, 0, 1),
  202.                     Radius = CircleRadius - 1,
  203.                 }
  204.             );         
  205.         }
  206.         private void InitDecoratorsInside()
  207.         {
  208.             LoveInsideDecorator = new WorldDecoratorCollection(
  209.                 new GroundCircleDecorator(Hud)
  210.                 {
  211.                     Brush = Hud.Render.CreateBrush(255, 150, 0, 0, -2, SharpDX.Direct2D1.DashStyle.Dash),
  212.                     Radius = InsideRadius,
  213.                 }
  214.             );
  215.      
  216.             CreationInsideDecorator = new WorldDecoratorCollection(
  217.                 new GroundCircleDecorator(Hud)
  218.                 {
  219.                     Brush = Hud.Render.CreateBrush(255, 0, 80, 150, -2, SharpDX.Direct2D1.DashStyle.Dash),
  220.                     Radius = InsideRadius,
  221.                 }
  222.             );
  223.      
  224.             DeterminationInsideDecorator = new WorldDecoratorCollection(
  225.                 new GroundCircleDecorator(Hud)
  226.                 {
  227.                     Brush = Hud.Render.CreateBrush(255, 120, 80, 0, -2, SharpDX.Direct2D1.DashStyle.Dash), // Dark Blue 0, 64, 255
  228.                     Radius = InsideRadius,
  229.                 }
  230.             );
  231.             OculusInsideDecorator = new WorldDecoratorCollection(
  232.                 new GroundCircleDecorator(Hud)
  233.                 {
  234.                     Brush = Hud.Render.CreateBrush(255, 0, 140, 0, -2, SharpDX.Direct2D1.DashStyle.Dash),
  235.                     Radius = InsideRadius,
  236.                 }
  237.             );         
  238.         }  
  239.        
  240.         public void PaintWorld(WorldLayer layer)
  241.         {
  242.             if (layer != WorldLayer.Ground) return;
  243.             //if (Hud.Game.IsInTown) return;
  244.                
  245.             bool Inside = false;
  246.             float CoordX, CoordY;
  247.            
  248.             if (EnableLove)
  249.             {
  250.                 var love = Hud.Game.Actors.Where(x => x.SnoActor.Sno == ActorSnoEnum._generic_proxy && x.GetAttributeValueAsInt(Hud.Sno.Attributes.Power_Buff_1_Visual_Effect_None, snoPower) == 1).OrderBy(d => d.CentralXyDistanceToMe);
  251.                 if (EnableInsideMarker && Hud.Game.Me.Powers.BuffIsActive(snoPower, 2)) {   Inside = true;  }
  252.                 foreach (var actor in love)
  253.                 {
  254.                     LoveDecorator.Paint(layer, actor, actor.FloorCoordinate, null);
  255.                     LoveDecorator.Paint(WorldLayer.Map, actor, actor.FloorCoordinate, null);
  256.                     if (EnableDescription)
  257.                     {
  258.                         DescriptionText1.DrawText(DescriptionText1.GetTextLayout("DMG"),actor.FloorCoordinate.ToScreenCoordinate().X - 15 ,actor.FloorCoordinate.ToScreenCoordinate().Y + 30);
  259.                         Hud.Render.GetMinimapCoordinates(actor.FloorCoordinate.X, actor.FloorCoordinate.Y, out CoordX, out CoordY);
  260.                         DescriptionText2.DrawText(DescriptionText2.GetTextLayout("D"),CoordX - 5 , CoordY - 8);
  261.                     }                  
  262.                     if (Inside) { LoveInsideDecorator.Paint(layer, actor, actor.FloorCoordinate, null); Inside = false; }
  263.                 }
  264.             }
  265.  
  266.             if (EnableCreation)
  267.             {
  268.                 var creation = Hud.Game.Actors.Where(x => x.SnoActor.Sno == ActorSnoEnum._generic_proxy && x.GetAttributeValueAsInt(Hud.Sno.Attributes.Power_Buff_7_Visual_Effect_None, snoPower) == 1).OrderBy(d => d.CentralXyDistanceToMe);
  269.                 if (EnableInsideMarker && Hud.Game.Me.Powers.BuffIsActive(snoPower, 8)) {   Inside = true;  }
  270.                 foreach (var actor in creation)
  271.                 {
  272.                     CreationDecorator.Paint(layer, actor, actor.FloorCoordinate, null);
  273.                     CreationDecorator.Paint(WorldLayer.Map, actor, actor.FloorCoordinate, null);
  274.                     if (EnableDescription)
  275.                     {
  276.                         DescriptionText1.DrawText(DescriptionText1.GetTextLayout("CDR"),actor.FloorCoordinate.ToScreenCoordinate().X - 15 ,actor.FloorCoordinate.ToScreenCoordinate().Y + 30);
  277.                         Hud.Render.GetMinimapCoordinates(actor.FloorCoordinate.X, actor.FloorCoordinate.Y, out CoordX, out CoordY);
  278.                         DescriptionText2.DrawText(DescriptionText2.GetTextLayout("C"),CoordX  - 5 , CoordY - 8 );
  279.                     }                  
  280.                     if (Inside) { CreationInsideDecorator.Paint(layer, actor, actor.FloorCoordinate, null); Inside = false; }
  281.                 }
  282.             }
  283.  
  284.             if (EnableDetermination)
  285.             {
  286.                 var determination = Hud.Game.Actors.Where(x => x.SnoActor.Sno == ActorSnoEnum._generic_proxy && x.GetAttributeValueAsInt(Hud.Sno.Attributes.Power_Buff_6_Visual_Effect_None, snoPower) == 1).OrderBy(d => d.CentralXyDistanceToMe);
  287.                 if (EnableInsideMarker && Hud.Game.Me.Powers.BuffIsActive(snoPower, 5) )    {   Inside = true;  }
  288.                 foreach (var actor in determination)
  289.                 {
  290.                     DeterminationDecorator.Paint(layer, actor, actor.FloorCoordinate, null);
  291.                     DeterminationDecorator.Paint(WorldLayer.Map, actor, actor.FloorCoordinate, null);
  292.                     if (EnableDescription)
  293.                     {
  294.                         DescriptionText1.DrawText(DescriptionText1.GetTextLayout("RSR"),actor.FloorCoordinate.ToScreenCoordinate().X - 15 ,actor.FloorCoordinate.ToScreenCoordinate().Y + 30);
  295.                         Hud.Render.GetMinimapCoordinates(actor.FloorCoordinate.X, actor.FloorCoordinate.Y, out CoordX, out CoordY);
  296.                         DescriptionText2.DrawText(DescriptionText2.GetTextLayout("R"),CoordX - 5 , CoordY - 8 );
  297.                     }                  
  298.                     if (Inside) { DeterminationInsideDecorator.Paint(layer, actor, actor.FloorCoordinate, null); Inside = false; }         
  299.                 }
  300.             }
  301.             if (ReplaceOculusOriginal)
  302.             {
  303.                 var actors = Hud.Game.Actors.Where(x => x.SnoActor.Sno == ActorSnoEnum._generic_proxy && x.GetAttributeValueAsInt(Hud.Sno.Attributes.Power_Buff_1_Visual_Effect_None, 402461) == 1).OrderBy(d => d.CentralXyDistanceToMe);
  304.                 if (EnableInsideMarker && Hud.Game.Me.Powers.BuffIsActive(402461, 2))   {   Inside = true;  }
  305.                 foreach (var actor in actors)
  306.                 {
  307.                     OculusDecorator.Paint(layer, actor, actor.FloorCoordinate, null);
  308.                     OculusDecorator.Paint(WorldLayer.Map, actor, actor.FloorCoordinate, null);
  309.                     if (EnableDescription)
  310.                     {
  311.                         DescriptionText1.DrawText(DescriptionText1.GetTextLayout("OCU"),actor.FloorCoordinate.ToScreenCoordinate().X - 15 ,actor.FloorCoordinate.ToScreenCoordinate().Y + 30);
  312.                         Hud.Render.GetMinimapCoordinates(actor.FloorCoordinate.X, actor.FloorCoordinate.Y, out CoordX, out CoordY);
  313.                         DescriptionText2.DrawText(DescriptionText2.GetTextLayout("O"),CoordX  - 5 , CoordY - 8 );
  314.                     }                      
  315.                     if (Inside) { OculusInsideDecorator.Paint(layer, actor, actor.FloorCoordinate, null); Inside = false; }
  316.                 }
  317.             }
  318.         }
  319.     }
  320. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement