-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMercScanner.cs
More file actions
78 lines (70 loc) · 3 KB
/
Copy pathMercScanner.cs
File metadata and controls
78 lines (70 loc) · 3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using System;
using System.Linq;
using ExileCore;
using ExileCore.PoEMemory.Components;
using ExileCore.PoEMemory.MemoryObjects;
using ExileCore.Shared.Enums;
using ExileCore.Shared.Helpers;
using ImGuiNET;
using SharpDX;
using Color = System.Drawing.Color;
using Vector2 = System.Numerics.Vector2;
namespace MercScanner;
public class MercScanner : BaseSettingsPlugin<MercScannerSettings>
{
public override bool Initialise()
{
return true;
}
public override Job Tick()
{
return null;
}
public override void Render()
{
if (!Settings.IgnoreLargePanels && GameController.IngameState.IngameUi.LargePanels.Any(x => x.IsVisible) ||
!Settings.IgnoreFullscreenPanels && GameController.IngameState.IngameUi.FullscreenPanels.Any(x => x.IsVisible))
{
return;
}
foreach (var idleMerc in GameController.EntityListWrapper.ValidEntitiesByType[EntityType.Monster]
.Where(x => x.Metadata.StartsWith("Metadata/Monsters/Mercenaries/", StringComparison.Ordinal) &&
!x.IsHostile &&
x.TryGetComponent<Positioned>(out var positioned) &&
positioned.Reaction == 70))
{
if (idleMerc.TryGetComponent<Actor>(out var actor))
{
var line = 0;
var merScreenPos = GameController.IngameState.Camera.WorldToScreen(idleMerc.PosNum);
var lineHeight = ImGui.GetTextLineHeight();
foreach (var skill in actor.ActorSkills.Where(x => !string.IsNullOrWhiteSpace(x.Name)))
{
var fullSkillName = skill.Name;
if (fullSkillName == "Move" || fullSkillName == "EASMercenaryPortalOut")
{
continue;
}
var skillName = fullSkillName;
if (skillName.EndsWith("Mercenary"))
{
skillName = skillName[..^"Mercenary".Length];
}
var isHighlighted = Settings.Auras.Content.Any(x => !string.IsNullOrWhiteSpace(x.Value) &&
(skillName.Contains(x.Value, StringComparison.InvariantCultureIgnoreCase) ||
fullSkillName.Contains(x.Value, StringComparison.InvariantCultureIgnoreCase)));
if (!isHighlighted && !Settings.ShowAllSkills)
{
continue;
}
Graphics.DrawTextWithBackground(skillName,
merScreenPos + new Vector2(0, lineHeight * line),
isHighlighted
? Settings.HighlightSkillColor
: Settings.DefaultSkillColor, Settings.BackgroundColor);
line++;
}
}
}
}
}