-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathCore.cs
More file actions
123 lines (105 loc) · 4.55 KB
/
Copy pathCore.cs
File metadata and controls
123 lines (105 loc) · 4.55 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
using System;
using System.Linq;
using ExileCore;
using ExileCore.PoEMemory.Components;
using ExileCore.PoEMemory.MemoryObjects;
using ExileCore.Shared.Enums;
using SharpDX;
namespace MineDetonator
{
public class Core : BaseSettingsPlugin<Settings>
{
private static readonly string[] IgnoreMonsters = new[]
{
"Metadata/Monsters/LeagueBetrayal/BetrayalTaserNet",
"Metadata/Monsters/LeagueBetrayal/BetrayalUpgrades/UnholyRelic",
"Metadata/Monsters/LeagueBetrayal/BetrayalUpgrades/BetrayalDaemonSummonUnholyRelic"
};
private static readonly string[] IgnoreBuffs = new[]
{ "hidden_monster", "avarius_statue_buff", "hidden_monster_disable_minions" };
private DateTime LastDetonationTime;
public override void Render()
{
if (!GameController.InGame)
return;
var actor = GameController.Player.GetComponent<Actor>();
var deployedObjects = actor.DeployedObjects.Where(x =>
x.Entity != null && x.Entity.Path.Contains("Metadata/MiscellaneousObjects/RemoteMine")).ToList();
if (deployedObjects.Count == 0)
return;
var realRange = Settings.DetonateDist.Value;
var mineSkill = actor.ActorSkills.Find(x => x.Name.ToLower().Contains("mine"));
if (mineSkill != null)
{
if (mineSkill.Stats.TryGetValue(GameStat.TotalSkillAreaOfEffectPctIncludingFinal, out var areaPct))
{
realRange += realRange * areaPct / 100f;
Settings.CurrentAreaPct.Value = realRange;
}
else
{
Settings.CurrentAreaPct.Value = 100;
}
}
else
{
Settings.CurrentAreaPct.Value = 0;
}
bool IsValidMonster(Entity entity)
{
if (entity == null) return false;
if (Vector2.Distance(GameController.Player.GridPos, entity.GridPos) >= Settings.DetonateDist.Value)
return false;
if (!entity.HasComponent<Monster>()) return false;
if (!entity.IsHostile || !entity.IsAlive) return false;
if (IgnoreMonsters.Any(m => entity.Path.StartsWith(m))) return false;
if (entity.HasComponent<Buffs>())
{
var buffs = entity.GetComponent<Buffs>();
if (buffs != null)
{
var buffsList = buffs.BuffsList;
if (buffsList != null && buffsList.Count > 0 && IgnoreBuffs.Any(b1 =>
buffsList.Any(b2 => string.Equals(b1, b2.Name, StringComparison.OrdinalIgnoreCase))))
return false;
}
}
if (!entity.HasComponent<Actor>()) return false;
var actor = entity.GetComponent<Actor>();
if (!FilterNullAction(actor)) return false;
var currentActorSkill = actor.CurrentAction?.Skill;
if (currentActorSkill != null)
{
if (currentActorSkill.Name.Equals("AtziriSummonDemons", StringComparison.OrdinalIgnoreCase))
return false;
if (currentActorSkill.Id == 728) return false;
}
return true;
}
var nearMonsters = GameController.Entities.Where(IsValidMonster).ToList();
if (nearMonsters.Count == 0)
return;
Settings.TriggerReason = "Path: " + nearMonsters[0].Path;
if (Settings.Debug.Value)
LogMessage($"Ents: {nearMonsters.Count}. Last: {nearMonsters[0].Path}", 2);
if ((DateTime.Now - LastDetonationTime).TotalMilliseconds > Settings.DetonateDelay.Value)
{
if (deployedObjects.Any(x =>
x.Entity != null && x.Entity.IsValid &&
x.Entity.GetComponent<Stats>().StatDictionary[GameStat.CannotDie] == 0))
{
LastDetonationTime = DateTime.Now;
Keyboard.KeyPress(Settings.DetonateKey.Value);
}
}
}
#region Overrides of BasePlugin
private bool FilterNullAction(Actor actor)
{
if (Settings.FilterNullAction.Value)
return actor.CurrentAction != null;
return true;
}
#endregion
}
}