This repository has been archived by the owner on Aug 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BetterSanctumPlugin.cs
53 lines (44 loc) · 1.62 KB
/
BetterSanctumPlugin.cs
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
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using ExileCore;
namespace BetterSanctum;
public class BetterSanctumPlugin : BaseSettingsPlugin<BetterSanctumSettings>
{
private readonly Stopwatch _sinceLastReloadStopwatch = Stopwatch.StartNew();
private bool dataCalculated;
private List<(int, int)> bestPath;
public override void Render()
{
var floorWindow = GameController.IngameState.IngameUi.SanctumFloorWindow;
if (!floorWindow.IsVisible)
{
dataCalculated = false;
return;
}
if (!GameController.Files.SanctumRooms.EntriesList.Any() && _sinceLastReloadStopwatch.Elapsed > TimeSpan.FromSeconds(5))
{
GameController.Files.LoadFiles();
_sinceLastReloadStopwatch.Restart();
}
var roomsByLayer = floorWindow.RoomsByLayer;
var pathFinder = new PathFinder(this);
pathFinder.CreateRoomWeightMap();
if (!this.dataCalculated)
{
dataCalculated = true;
pathFinder.CreateRoomWeightMap();
this.bestPath = pathFinder.FindBestPath();
}
else
{
foreach (var room in this.bestPath)
{
if (room.Item1 == pathFinder.playerLayerIndex && room.Item2 == pathFinder.playerRoomIndex) continue;
var sanctumRoom = roomsByLayer[room.Item1][room.Item2];
Graphics.DrawFrame(sanctumRoom.GetClientRectCache, Settings.BestPathColor, Settings.FrameThickness);
}
}
}
}