Skip to content

Commit

Permalink
Merge pull request #1 from 0xE0D59/master
Browse files Browse the repository at this point in the history
3.15 update
  • Loading branch information
vadash authored Aug 23, 2021
2 parents 05712ae + 4dfe20c commit bddfce3
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 27 deletions.
51 changes: 28 additions & 23 deletions EssenceDrainContagion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,34 +23,35 @@ public class EssenceDrainContagion : BaseSettingsPlugin<EssenceDrainContagionSet
private Tuple<float, Entity> _currentTarget;
private Stopwatch _lastTargetSwap = new Stopwatch();

private readonly string[] _ignoredBuffs = {
private readonly string[] _ignoredBuffs =
{
"capture_monster_captured",
"capture_monster_disappearing"
};

private readonly string[] _lightLessGrub =
{
"Metadata/Monsters/HuhuGrub/AbyssGrubMobile",
"Metadata/Monsters/HuhuGrub/AbyssGrubMobileMinion"
{
"Metadata/Monsters/HuhuGrub/AbyssGrubMobile",
"Metadata/Monsters/HuhuGrub/AbyssGrubMobileMinion"
};

private readonly string[] _raisedZombie =
{
"Metadata/Monsters/RaisedZombies/RaisedZombieStandard",
"Metadata/Monsters/RaisedZombies/RaisedZombieMummy",
"Metadata/Monsters/RaisedZombies/NecromancerRaisedZombieStandard"
"Metadata/Monsters/RaisedZombies/RaisedZombieStandard",
"Metadata/Monsters/RaisedZombies/RaisedZombieMummy",
"Metadata/Monsters/RaisedZombies/NecromancerRaisedZombieStandard"
};

private readonly string[] _summonedSkeleton =
{
"Metadata/Monsters/RaisedSkeletons/RaisedSkeletonStandard",
"Metadata/Monsters/RaisedSkeletons/RaisedSkeletonStatue",
"Metadata/Monsters/RaisedSkeletons/RaisedSkeletonMannequin",
"Metadata/Monsters/RaisedSkeletons/RaisedSkeletonStatueMale",
"Metadata/Monsters/RaisedSkeletons/RaisedSkeletonStatueGold",
"Metadata/Monsters/RaisedSkeletons/RaisedSkeletonStatueGoldMale",
"Metadata/Monsters/RaisedSkeletons/NecromancerRaisedSkeletonStandard",
"Metadata/Monsters/RaisedSkeletons/TalismanRaisedSkeletonStandard"
"Metadata/Monsters/RaisedSkeletons/RaisedSkeletonStandard",
"Metadata/Monsters/RaisedSkeletons/RaisedSkeletonStatue",
"Metadata/Monsters/RaisedSkeletons/RaisedSkeletonMannequin",
"Metadata/Monsters/RaisedSkeletons/RaisedSkeletonStatueMale",
"Metadata/Monsters/RaisedSkeletons/RaisedSkeletonStatueGold",
"Metadata/Monsters/RaisedSkeletons/RaisedSkeletonStatueGoldMale",
"Metadata/Monsters/RaisedSkeletons/NecromancerRaisedSkeletonStandard",
"Metadata/Monsters/RaisedSkeletons/TalismanRaisedSkeletonStandard"
};

public override bool Initialise()
Expand Down Expand Up @@ -89,7 +90,7 @@ private IEnumerator MainCoroutine()
// ignored
}

if (!Input.IsKeyDown(Settings.AimKey))
if (!Input.IsKeyDown(Settings.AimKey))
_oldMousePos = Input.MousePosition;
if (Input.IsKeyDown(Settings.AimKey)
&& !GameController.Game.IngameState.IngameUi.InventoryPanel.IsVisible
Expand Down Expand Up @@ -140,6 +141,7 @@ public override void Render()
var position = GameController.Game.IngameState.Camera.WorldToScreen(_currentTarget.Item2.Pos);
Graphics.DrawFrame(position, position.Translate(20, 20), Color.Chocolate, 3);
}

base.Render();
}

Expand All @@ -162,7 +164,9 @@ private IEnumerator Attack()
if (_currentTarget == null) yield break;
var position = GameController.Game.IngameState.Camera.WorldToScreen(_currentTarget.Item2.Pos);
Input.SetCursorPos(position);
yield return Input.KeyPress(_currentTarget.Item2.HasBuff("contagion", true) ? Settings.EssenceDrainKey.Value : Settings.ContagionKey.Value);
yield return Input.KeyPress(_currentTarget.Item2.HasBuff("contagion", true)
? Settings.EssenceDrainKey.Value
: Settings.ContagionKey.Value);
}

private IEnumerable<Tuple<float, Entity>> ScanValidMonsters()
Expand Down Expand Up @@ -197,10 +201,12 @@ private float ComputeWeight(Entity entity)
weight -= (int) (p1.Distance(p2) / 10f);
}

if (entity.GetComponent<Life>().HasBuff("contagion")) weight += Settings.HasContagionWeight;
if (entity.GetComponent<Life>().HasBuff("capture_monster_trapped")) weight += Settings.capture_monster_trapped;
if (entity.GetComponent<Life>().HasBuff("harbinger_minion_new")) weight += Settings.HarbingerMinionWeight;
if (entity.GetComponent<Life>().HasBuff("capture_monster_enraged")) weight += Settings.capture_monster_enraged;
if (entity.GetComponent<Buffs>().HasBuff("contagion")) weight += Settings.HasContagionWeight;
if (entity.GetComponent<Buffs>().HasBuff("capture_monster_trapped"))
weight += Settings.capture_monster_trapped;
if (entity.GetComponent<Buffs>().HasBuff("harbinger_minion_new")) weight += Settings.HarbingerMinionWeight;
if (entity.GetComponent<Buffs>().HasBuff("capture_monster_enraged"))
weight += Settings.capture_monster_enraged;
if (entity.Path.Contains("/BeastHeart")) weight += Settings.BeastHearts;
if (entity.Path == "Metadata/Monsters/Tukohama/TukohamaShieldTotem") weight += Settings.TukohamaShieldTotem;

Expand Down Expand Up @@ -232,5 +238,4 @@ private float ComputeWeight(Entity entity)
return weight;
}
}

}
7 changes: 3 additions & 4 deletions Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
using ExileCore.PoEMemory.Components;
using ExileCore.PoEMemory.MemoryObjects;
using ExileCore.Shared.Enums;
using SharpDX;

namespace EssenceDrainContagion
{
public static class Extensions
{
public static bool HasBuff(this Entity entity, string buff, bool contains = false)
{
return entity.HasComponent<Life>() &&
entity.GetComponent<Life>().Buffs.Any(b => contains ? b.Name.Contains(buff) : b.Name == buff);
return entity.HasComponent<Buffs>() &&
entity.GetComponent<Buffs>().BuffsList.Any(b => contains ? b.Name.Contains(buff) : b.Name == buff);
}

public static bool HaveStat(Entity entity, GameStat stat)
Expand All @@ -28,4 +27,4 @@ public static bool HaveStat(Entity entity, GameStat stat)
}
}
}
}
}

0 comments on commit bddfce3

Please sign in to comment.