Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMapModHighlight.cs
More file actions
Latest commit
94 lines (81 loc) · 2.98 KB
/
Copy pathMapModHighlight.cs
File metadata and controls
94 lines (81 loc) · 2.98 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
usingSystem;
usingSystem.Collections.Generic;
usingSystem.Linq;
usingExileCore;
usingExileCore.PoEMemory;
usingExileCore.PoEMemory.Elements;
usingExileCore.Shared.Helpers;
usingVector2=System.Numerics.Vector2;
namespaceMapModHighlight;
publicclassMapModHighlight:BaseSettingsPlugin<MapModHighlightSettings>
{
publicoverrideboolInitialise()
{
returntrue;
}
publicoverrideJobTick()
{
returnnull;
}
internalElementFindRegularModElement(ElementhoveredItem)
{
vartooltip=hoveredItem?.AsObject<HoverItemIcon>().ItemFrame;
if(tooltipis not {IsValid:true,IsVisible:true})
{
returnnull;
}
varmodsRoot=tooltip.GetChildAtIndex(1);
if(modsRoot==null)
returnnull;
for(vari=modsRoot.Children.Count-1;i>=1;i--)
{
varelement=modsRoot.Children[i];
if(element.ChildCountis0)
{
continue;
}
vartextElements=GetExtendedModsTextElements(element);
varelementText=textElements.FirstOrDefault()?.Text;
if(!string.IsNullOrEmpty(elementText)&&
(elementText.StartsWith("<smaller>",StringComparison.Ordinal)||
elementText.StartsWith("<fractured>{<smaller>",StringComparison.Ordinal))&&
element.TextNoTags?.StartsWith("Allocated Crucible",StringComparison.Ordinal)!=true)
{
returnmodsRoot.Children[i-1]?[0];
}
}
returnnull;
}
privatestaticList<Element>GetExtendedModsTextElements(Elementelement)
{
returnelement.Children.Where(x =>x.ChildCount==1).Select(x =>x[0]).Where(x =>x!=null).ToList();
}
publicoverridevoidRender()
{
varhover=GameController.IngameState.UIHover;
if(hoveris not {Address: not 0,IsValid:true,IsVisible:true})
{
return;
}
if(FindRegularModElement(hover)is{}modElement)
{
varlines=modElement.GetText(2500).Split("\n",StringSplitOptions.TrimEntries);
if(!lines.Any())
{
return;
}
varelementRect=modElement.GetClientRectCache;
varlineHeight=elementRect.Height/lines.Length;
for(inti=0;i<lines.Length;i++)
{
varline=lines[i];
if(Settings.Crafts.Content.Where(x =>!string.IsNullOrWhiteSpace(x.Input.Text)).FirstOrDefault(x =>x.Input.LoadFilter().IsMatch(line))is{}mod)
{
vartopLeft=elementRect.TopLeft.ToVector2Num()+newVector2(0,lineHeight*i);
varbottomRight=elementRect.TopRight.ToVector2Num()+newVector2(0,lineHeight*(i+1));
Graphics.DrawFrame(topLeft,bottomRight,mod.Color,2);
}
}
}
}
}