Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // MonstersToHuntInGR.cs "$Revision: 971 $" "$Date: 2019-02-10 13:12:39 +0200 (su, 10 helmi 2019) $"
- using SharpDX.Direct2D1;
- using Turbo.Plugins;
- using Turbo.Plugins.Default;
- namespace Turbo.plugins.JarJar.DefaultUI
- {
- // RiftProgression calculation:
- // See: http://www.warpath.eu/index.html
- public class MonstersToHuntInGR : BasePlugin, ICustomizer, IInGameWorldPainter
- {
- // Monster decorators by type.
- public WorldDecoratorCollection EliteDecorator { get; set; }
- public WorldDecoratorCollection BlueDecorator { get; set; }
- public WorldDecoratorCollection GreenDecorator { get; set; }
- public WorldDecoratorCollection GreyDecorator { get; set; }
- // Special decorators.
- public bool ShowMonsterCount { get; set; } = true;
- public float BossCirleRadius { get; set; } = 50f;
- public WorldDecoratorCollection BossDecorator { get; set; } // Draws 50 yeard circle around boss.
- public WorldDecoratorCollection PlayerDecorator { get; set; } // Draws player hitbox to show where player is during boss/elite fights.
- public float RiftProgressionLimitGood { get; set; } = 2.50f; // 33% of rift orb value
- public float RiftProgressionLimitBest { get; set; } = 3.75f; // 50% of rift orb value
- public float RiftProgressionRange { get; set; } = 50f;
- public float xRatio = 0.80f; // Minimap top left corner for ShowMonsterCount: EliteCountLabel.
- public float yRatio = 0.04f;
- SimpleLabel EliteCountLabel;
- public MonstersToHuntInGR()
- {
- Enabled = true;
- ShowMonsterCount = true;
- // Progression Orb = 7.5f
- RiftProgressionLimitBest = 3.75f; // 7.5 / 2
- RiftProgressionLimitGood = 2.5f; // 7.5 / 3
- RiftProgressionRange = 50f; // Almost whole screen.
- }
- public void Customize()
- {
- // Disable default coloring plugin.
- Hud.TogglePlugin<Turbo.Plugins.Default.MonsterRiftProgressionColoringPlugin>(false);
- }
- public override void Load(IController hud)
- {
- base.Load(hud);
- float x = Hud.Window.Size.Width * xRatio;
- float y = Hud.Window.Size.Height * yRatio;
- var font1 = Hud.Render.CreateFont("tahoma", 12, 255, 255, 51, 0, true, false, 255, 0, 0, 0, true); // red #ff3300
- EliteCountLabel = new SimpleLabel(font1).WithPosition(x, y);
- IBrush shadowBrush = Hud.Render.CreateBrush(96, 0, 0, 0, 1);
- BossDecorator = new WorldDecoratorCollection(
- new GroundCircleDecorator(Hud)
- {
- Brush = Hud.Render.CreateBrush(255, 192, 96, 0, 1.5f), // Dim orange
- Radius = BossCirleRadius,
- }
- );
- PlayerDecorator = new WorldDecoratorCollection(
- new GroundCircleDecorator(Hud)
- {
- Brush = Hud.Render.CreateBrush(255, 153, 204, 255, 3.5f, DashStyle.DashDot), // Light blue
- Radius = -1,
- }
- );
- EliteDecorator = new WorldDecoratorCollection(
- new MapShapeDecorator(Hud)
- {
- ShapePainter = new CircleShapePainter(Hud),
- Brush = Hud.Render.CreateBrush(255, 255, 200, 100, 2), // Dim yellow
- ShadowBrush = shadowBrush,
- Radius = 4f,
- },
- new GroundCircleDecorator(Hud)
- {
- Brush = Hud.Render.CreateBrush(255, 255, 0, 255, 2f), // Violet
- Radius = -1, // Show monster hitbox
- }
- );
- BlueDecorator = new WorldDecoratorCollection(
- new MapShapeDecorator(Hud)
- {
- ShapePainter = new CircleShapePainter(Hud),
- Brush = Hud.Render.CreateBrush(255, 60, 128, 255, 3), // Blue (dodger)
- ShadowBrush = shadowBrush,
- Radius = 3.5f,
- }
- );
- GreenDecorator = new WorldDecoratorCollection(
- new MapShapeDecorator(Hud)
- {
- ShapePainter = new CircleShapePainter(Hud),
- Brush = Hud.Render.CreateBrush(255, 128, 255, 0, 3), // Green
- ShadowBrush = shadowBrush,
- Radius = 3f,
- }
- );
- GreyDecorator = new WorldDecoratorCollection(
- new MapShapeDecorator(Hud)
- {
- Brush = Hud.Render.CreateBrush(128, 200, 200, 200, 0), // Grey
- ShadowBrush = shadowBrush,
- ShapePainter = new CircleShapePainter(Hud),
- Radius = 2f,
- }
- );
- }
- float helperRadius;
- public void PaintWorld(WorldLayer layer)
- {
- if (Hud.Game.IsInTown) return;
- if ((Hud.Game.MapMode == MapMode.WaypointMap) || (Hud.Game.MapMode == MapMode.ActMap)) return;
- bool inRift = Hud.Game.SpecialArea == SpecialArea.Rift || Hud.Game.SpecialArea == SpecialArea.GreaterRift;
- int eliteCount = 0;
- foreach (var monster in Hud.Game.AliveMonsters)
- {
- if (monster.IsElite)
- {
- // Boss fight for Nephalem rift happens outside "SpecialArea.Rift" so we check these regardless of the area.
- eliteCount += 1;
- EliteDecorator.Paint(layer, monster, monster.FloorCoordinate, null);
- if (monster.SnoMonster.Priority == MonsterPriority.boss)
- {
- BossDecorator.Paint(layer, monster, monster.FloorCoordinate, null);
- }
- continue;
- }
- if (inRift)
- {
- // Decorators for near monsters that can advance progression.
- // - there is few monster with zero progression we ignore.
- if (monster.NormalizedXyDistanceToMe < RiftProgressionRange && monster.SnoMonster.RiftProgression > 0)
- {
- if (monster.SnoMonster.RiftProgression < RiftProgressionLimitGood)
- {
- GreyDecorator.Paint(layer, monster, monster.FloorCoordinate, null); // Trash.
- }
- else if (monster.SnoMonster.RiftProgression < RiftProgressionLimitBest)
- {
- GreenDecorator.Paint(layer, monster, monster.FloorCoordinate, null); // Some value.
- }
- else
- {
- BlueDecorator.Paint(layer, monster, monster.FloorCoordinate, null); // Rest is best.
- }
- }
- }
- }
- if (eliteCount > 0)
- {
- if (ShowMonsterCount)
- {
- EliteCountLabel.PaintLeft(eliteCount.ToString());
- }
- PlayerDecorator.Paint(layer, Hud.Game.Me, Hud.Game.Me.FloorCoordinate, null);
- }
- }
- class SimpleLabel
- {
- public IFont TextFont;
- public float X;
- public float Y;
- public SimpleLabel(IController hud, string fontFamily, float size, SharpDX.Color textColor, bool bold = false)
- :
- this(hud.Render.CreateFont(fontFamily, size, textColor.A, textColor.R, textColor.G, textColor.B, bold, false, true))
- { }
- public SimpleLabel(IFont font)
- {
- TextFont = font;
- }
- public SimpleLabel WithPosition(float x, float y)
- {
- this.X = x;
- this.Y = y;
- return this;
- }
- public SharpDX.DirectWrite.TextMetrics GetTextMetrics(string text)
- {
- return TextFont.GetTextLayout(text).Metrics;
- }
- public float PaintLeft(string text)
- {
- return PaintLeft(X, Y, text);
- }
- public float PaintLeft(float x, float y, string text)
- {
- var layout = TextFont.GetTextLayout(text);
- TextFont.DrawText(layout, x, y);
- return layout.Metrics.Height;
- }
- public float PaintRight(string text)
- {
- return PaintRight(X, Y, text);
- }
- public float PaintRight(float x, float y, string text)
- {
- var layout = TextFont.GetTextLayout(text);
- TextFont.DrawText(layout, x - layout.Metrics.Width, y - layout.Metrics.Height);
- return layout.Metrics.Height;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement