Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // MonstersToHuntInGR.cs "$Revision: 863 $" "$Date: 2019-01-24 17:44:52 +0200 (to, 24 tammi 2019) $"
- using Turbo.Plugins;
- using Turbo.Plugins.Default;
- namespace Turbo.plugins.JarJar.DefaultUI
- {
- // Idea from: https://www.ownedcore.com/forums/diablo-3/turbohud/turbohud-plugin-review-zone/618264-v7-2-international-glq-zeicircleforboss.html
- // RiftProgression calculation:
- // See: http://www.warpath.eu/index.html
- public class MonstersToHuntInGR : BasePlugin, ICustomizer, IInGameWorldPainter
- {
- public bool ShowMonsterCount { get; set; }
- public class WorldDecorators
- {
- public GroundCircleDecorator GroundCircle;
- public MapShapeDecorator MapShape;
- };
- public GroundCircleDecorator PowerDecoratorBoss;
- public MapShapeDecorator EliteDecorator;
- public WorldDecorators GoodProgressDecorator;
- public WorldDecorators BestProgressKeepDecorator;
- public float RiftProgressionLimitGood;
- public float RiftProgressionLimitBest;
- public float RiftProgressionRange;
- public WorldDecoratorCollection DefaultDecorator { get; set; }
- float xRatio = 0.80f; // Minimap top left corner.
- float yRatio = 0.04f;
- SimpleLabel labelMonsterCount;
- 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
- labelMonsterCount = new SimpleLabel(font1).WithPosition(x, y);
- PowerDecoratorBoss = new GroundCircleDecorator(Hud)
- {
- Brush = Hud.Render.CreateBrush(255, 192, 96, 0, 1.5f),
- Radius = 50f,
- };
- IBrush shadowBrush = Hud.Render.CreateBrush(96, 0, 0, 0, 1);
- EliteDecorator = new MapShapeDecorator(Hud)
- {
- ShapePainter = new CircleShapePainter(Hud),
- Brush = Hud.Render.CreateBrush(255, 255, 200, 100, 2), // Dim yellow
- ShadowBrush = shadowBrush,
- Radius = 4,
- };
- GoodProgressDecorator = new WorldDecorators()
- {
- GroundCircle = new GroundCircleDecorator(Hud)
- {
- Brush = Hud.Render.CreateBrush(192, 60, 60, 255, -2), // Blue
- Radius = 1.25f,
- },
- MapShape = new MapShapeDecorator(Hud)
- {
- ShapePainter = new RotatingTriangleShapePainter(Hud),
- Brush = Hud.Render.CreateBrush(255, 60, 128, 255, 3), // Blue (dodger)
- ShadowBrush = shadowBrush,
- Radius = 6,
- },
- };
- BestProgressKeepDecorator = new WorldDecorators()
- {
- GroundCircle = new GroundCircleDecorator(Hud)
- {
- Brush = Hud.Render.CreateBrush(192, 85, 255, 85, -3), // Green (lighter)
- Radius = 1.25f,
- },
- MapShape = new MapShapeDecorator(Hud)
- {
- ShapePainter = new RotatingTriangleShapePainter(Hud),
- Brush = Hud.Render.CreateBrush(255, 128, 255, 0, 3), // Green
- ShadowBrush = shadowBrush,
- Radius = 6,
- }
- };
- DefaultDecorator = new WorldDecoratorCollection( // Small grey dot for minor monsters
- new MapShapeDecorator(Hud)
- {
- Brush = Hud.Render.CreateBrush(128, 200, 200, 200, 0),
- ShadowBrush = shadowBrush,
- ShapePainter = new CircleShapePainter(Hud),
- Radius = 2,
- }
- );
- }
- float helperRadius;
- public void PaintWorld(WorldLayer layer)
- {
- if (Hud.Game.IsInTown) return;
- if ((Hud.Game.MapMode == MapMode.WaypointMap) || (Hud.Game.MapMode == MapMode.ActMap)) return;
- int monsterCount = 0;
- bool inRift = Hud.Game.SpecialArea == SpecialArea.Rift || Hud.Game.SpecialArea == SpecialArea.GreaterRift;
- foreach (var monster in Hud.Game.AliveMonsters)
- {
- if (monster.SnoMonster.Priority >= MonsterPriority.high)
- {
- if (monster.SnoMonster.Priority == MonsterPriority.boss)
- {
- PowerDecoratorBoss.Paint(monster, monster.FloorCoordinate, null);
- monsterCount += 1;
- }
- }
- // Rift progress hunting.
- if (inRift)
- {
- if (monster.IsElite)
- {
- EliteDecorator.Paint(monster, monster.FloorCoordinate, "");
- monsterCount += 1;
- }
- else if (monster.SnoMonster.RiftProgression < RiftProgressionLimitGood)
- {
- DefaultDecorator.Paint(layer, monster, monster.FloorCoordinate, "");
- }
- else
- {
- monsterCount += 1;
- // GroundCircle for near monsters.
- if (monster.NormalizedXyDistanceToMe < RiftProgressionRange)
- {
- if (monster.SnoMonster.RiftProgression < RiftProgressionLimitBest)
- {
- GoodProgressDecorator.GroundCircle.Paint(monster, monster.FloorCoordinate, "");
- }
- else
- {
- BestProgressKeepDecorator.GroundCircle.Paint(monster, monster.FloorCoordinate, "");
- }
- }
- // MapShape for all monsters.
- if (monster.SnoMonster.RiftProgression < RiftProgressionLimitBest)
- {
- GoodProgressDecorator.MapShape.Paint(monster, monster.FloorCoordinate, "");
- }
- else
- {
- BestProgressKeepDecorator.MapShape.Paint(monster, monster.FloorCoordinate, "");
- }
- }
- }
- }
- if (ShowMonsterCount)
- {
- labelMonsterCount.PaintLeft(monsterCount.ToString());
- }
- }
- 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