Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
8525f06
Change compile path
Mar 22, 2020
8f99790
Format numbers in HealthBars, Add setting for Energy Shield text
Mar 26, 2020
98902b1
Merge HealthBars of https://github.com/IlliumIv/ExileApiPlugins ; fix…
IlliumIv Apr 6, 2020
73bbec3
Refactor and Fix crash when HealthBar does not exist on entity
Apr 7, 2020
df7fc89
Fix output path and target x64
Apr 22, 2020
e31ddcb
Merge branch 'master' of https://github.com/Queuete/HealthBars
IlliumIv Jun 25, 2020
10e4eab
Added checkbox to allow hide max HP an ES.
IlliumIv Jun 25, 2020
37f7d80
Merge branch 'master' of https://github.com/IlliumIv/HealthBars
IlliumIv Jun 25, 2020
ba0433f
Added Crusaders and Basilisks runes to ignore.
IlliumIv Jun 29, 2020
11a0e67
Sync with public ExileApi repo.
IlliumIv Jun 29, 2020
dd5b3f1
Activate on startup
Jul 10, 2020
de8f5a0
Fix output path, show legion rares
Jul 10, 2020
535f6da
Show all legion healthBars
Jul 10, 2020
1f44db5
Fix null exception
Jul 10, 2020
9b14a30
Fix data type
Jul 10, 2020
8e8d956
Expanded ignores list.
IlliumIv Jul 16, 2020
18c95bb
Merge branch 'master' of https://github.com/TehCheat/HealthBars
IlliumIv Jul 16, 2020
8a2a8ad
Expanded ignores list.
IlliumIv Jul 23, 2020
ed39d4f
Some code's rewriting.
IlliumIv Aug 28, 2020
f469a5f
Merge pull request #1 from TehCheat/master
Arecurius0 Sep 27, 2020
9b7c1b1
fixed Ignoring of entities
Arecurius0 Sep 27, 2020
53dbfb8
Merge remote-tracking branch 'Craere/master'
IlliumIv Sep 27, 2020
3b277ee
Component Null Reference fix #1
Arecurius0 Oct 28, 2020
568cdfa
Merge remote-tracking branch 'Craere/master' into master
IlliumIv Oct 31, 2020
3330fde
Fixed reference
IlliumIv Oct 31, 2020
fac4d53
Fix bars uncontrol increasing
IlliumIv Jan 17, 2021
e783a16
Little rework HP\ES text logic
IlliumIv Jan 20, 2021
896bb02
Merge remote-tracking branch 'TehCheat/master' into master
IlliumIv Jan 21, 2021
f74168c
Expand list of ignore
IlliumIv Jan 25, 2021
3076c78
Move all ignores to ignore file, update it
Jan 26, 2021
7e541c6
Change default settings for bar graphics
Jan 26, 2021
a7a312d
Merge remote-tracking branch 'TehCheat/master'
IlliumIv Jan 30, 2021
1f3e787
Fix rare increasing health bar error on start
IlliumIv Feb 8, 2021
3f73825
Fix some null ref exeptions
IlliumIv Feb 10, 2021
02a1fd6
Expand list of ignores
IlliumIv Feb 14, 2021
1fb8d62
Merge pull request #2 from IlliumIv/master
Arecurius0 Apr 1, 2021
c8f7fb2
Update HealthBars.cs
snowhawk04 May 22, 2021
c04999f
Update HealthBars.cs
snowhawk04 May 24, 2021
a02fac3
Clean up HealthBar, Add DebuffPanel
Jul 31, 2021
f7f7caf
Remove unused settings
Jul 31, 2021
2aad204
Display Debuff panel simple, depending on enemy type
Jul 31, 2021
fcf9cf6
Update ignored entities
Jul 31, 2021
47b6435
Add more experimental debuffs
Aug 2, 2021
38391c2
Merge branch 'Queuete:master' into master
snowhawk04 Aug 9, 2021
f272e41
Project cleanup.
snowhawk04 Nov 3, 2021
3f00490
Use Standard Output Paths
snowhawk04 Nov 15, 2021
71907a8
Merge pull request #2 from snowhawk04/master
Nov 22, 2021
768f6da
Update from PR
Arecurius0 Mar 1, 2022
3073a23
Added hidden legion monsters show/hide setting
Arecurius0 Mar 2, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -337,4 +337,7 @@ ASALocalRun/
.localhistory/

# BeatPulse healthcheck temp database
healthchecksdb
healthchecksdb

# KDiff3
*.orig
27 changes: 27 additions & 0 deletions DebuffPanel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using ExileCore.PoEMemory.Components;
using ExileCore.PoEMemory.MemoryObjects;
using ExileCore.Shared.Cache;
using ExileCore.Shared.Enums;
using SharpDX;

namespace HealthBars
{
public class DebuffPanel
{
public DebuffPanel(Entity entity)
{
_Entity = entity ?? throw new ArgumentNullException(nameof(entity));
}

private Entity _Entity { get; }

public List<Buff> Bleed => _Entity.Buffs.Where(b => b.Name == "bleeding_stack").ToList();
public List<Buff> CorruptedBlood => _Entity.Buffs.Where(b => b.Name == "corrupted_blood").ToList();
public Buff CurseVulnerability => _Entity.Buffs.FirstOrDefault(b => b.Name == "curse_vulnerability");
public Buff AuraPride => _Entity.Buffs.FirstOrDefault(b => b.Name == "player_physical_damage_aura");
}
}
157 changes: 47 additions & 110 deletions HealthBar.cs
Original file line number Diff line number Diff line change
@@ -1,72 +1,47 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using ExileCore.PoEMemory.Components;
using ExileCore.PoEMemory.MemoryObjects;
using ExileCore.Shared.Cache;
using ExileCore.Shared.Enums;
using SharpDX;
using System;

namespace HealthBars
{
public class DebuffPanelConfig
{
public Dictionary<string, int> Bleeding { get; set; }
public Dictionary<string, int> Corruption { get; set; }
public Dictionary<string, int> Poisoned { get; set; }
public Dictionary<string, int> Frozen { get; set; }
public Dictionary<string, int> Chilled { get; set; }
public Dictionary<string, int> Burning { get; set; }
public Dictionary<string, int> Shocked { get; set; }
public Dictionary<string, int> WeakenedSlowed { get; set; }
}

public class HealthBar
{
private const int DPS_CHECK_TIME = 1000;
private const int DPS_FAST_CHECK_TIME = 200;
private const int DPS_POP_TIME = 2000;
private static readonly List<string> IgnoreEntitiesList = new List<string> {"MonsterFireTrap2", "MonsterBlastRainTrap", "VolatileDeadCore"};
private readonly Stopwatch dpsStopwatch = Stopwatch.StartNew();
private readonly TimeCache<float> _distance;
private bool _init;
private int _lastHp;
public RectangleF BackGround;
public bool CanNotDie;
public double DiedFrames = 0;
public Func<bool> IsHidden;
private bool isHostile;
public bool Skip { get; set; } = false;
public UnitSettings Settings { get; private set; }
public RectangleF BackGround { get; set; }
public DebuffPanel DebuffPanel { get; set; }
private TimeCache<float> _DistanceCache { get; set; }
public float Distance => _DistanceCache.Value;
public Entity Entity { get; }
public CreatureType Type { get; private set; }
public Life Life => Entity.GetComponent<Life>();
public float HpPercent => Life?.HPPercentage ?? 100;
public float HpWidth { get; set; }
public float EsWidth { get; set; }
private readonly Action OnHostileChange = delegate { };
public bool Skip = false;

private bool isHostile;
public bool CanNotDie;
private bool _init;
public HealthBar(Entity entity, HealthBarsSettings settings)
{
Entity = entity;
_distance = new TimeCache<float>(() => entity.DistancePlayer, 200);

IsHidden = () => entity.IsHidden;

// If ignored entity found, skip
foreach (var _entity in IgnoreEntitiesList)
{
if (entity.Path.Contains(_entity))
return;
}

_DistanceCache = new TimeCache<float>(() => entity.DistancePlayer, 200);
DebuffPanel = new DebuffPanel(entity);
Update(entity, settings);

//CanNotDie = entity.GetComponent<Stats>().StatDictionary.ContainsKey(GameStat.CannotDie);
CanNotDie = entity.Path.StartsWith("Metadata/Monsters/Totems/Labyrinth");

if (entity.HasComponent<ObjectMagicProperties>() && entity.GetComponent<ObjectMagicProperties>().Mods.Contains("MonsterConvertsOnDeath_"))
var mods = entity?.GetComponent<ObjectMagicProperties>()?.Mods;
if (mods != null && mods.Contains("MonsterConvertsOnDeath_"))
{
OnHostileChange = () =>
{
if (_init) Update(Entity, settings);
};
}
}

public bool IsHostile
{
get
Expand All @@ -83,20 +58,11 @@ public bool IsHostile
}
}

public int MaxHp { get; private set; }
public float HpPercent { get; set; }
public float Distance => _distance.Value;
public Life Life => Entity.GetComponent<Life>();
public Entity Entity { get; }
public UnitSettings Settings { get; private set; }
public CreatureType Type { get; private set; }
public LinkedList<int> DpsQueue { get; } = new LinkedList<int>();

public Color Color
{
get
{
if (IsHidden())
if (IsHidden(Entity))
return Color.LightGray;

if (HpPercent <= 0.1f)
Expand All @@ -106,8 +72,24 @@ public Color Color
}
}

public float HpWidth { get; set; }
public float EsWidth { get; set; }
private bool IsHidden(Entity entity)
{
try
{
return entity.IsHidden;
}
catch
{
return false;
}
}
public bool IsShow(bool showEnemy)
{
if (Settings == null)
return false;

return !IsHostile ? Settings.Enable.Value : Settings.Enable.Value && showEnemy && IsHostile;
}

public void Update(Entity entity, HealthBarsSettings settings)
{
Expand All @@ -120,11 +102,15 @@ public void Update(Entity entity, HealthBarsSettings settings)
{
if (entity.IsHostile)
{
var objectMagicProperties = entity.GetComponent<ObjectMagicProperties>();

if (objectMagicProperties != null)
var rarity = entity.GetComponent<ObjectMagicProperties>();
if(rarity == null)
{
switch (objectMagicProperties.Rarity)
Type = CreatureType.Minion;
Settings = settings.Minions;
}
else
{
switch (rarity.Rarity)
{
case MonsterRarity.White:
Type = CreatureType.Normal;
Expand Down Expand Up @@ -158,55 +144,6 @@ public void Update(Entity entity, HealthBarsSettings settings)
Settings = settings.Minions;
}
}

_lastHp = GetFullHp();
MaxHp = Life.MaxHP;
_init = true;
}

public bool IsShow(bool showEnemy)
{
if (Settings == null)
return false;

return !IsHostile ? Settings.Enable.Value : Settings.Enable.Value && showEnemy && IsHostile;
}

public void DpsRefresh()
{
var checkTime = DpsQueue.Count > 0 ? DPS_CHECK_TIME : DPS_FAST_CHECK_TIME;

if (dpsStopwatch.ElapsedMilliseconds >= checkTime)
{
var hp = GetFullHp();

if (hp > -1000000 && hp < 10000000 && _lastHp != hp)
{
DpsQueue.AddFirst(-(_lastHp - hp));

if (DpsQueue.Count > Settings.FloatingCombatStackSize)
{
DpsQueue.RemoveLast();
dpsStopwatch.Restart();
}

_lastHp = hp;
}
}
}

public void DpsDequeue()
{
if (dpsStopwatch.ElapsedMilliseconds >= DPS_POP_TIME)
{
if (DpsQueue.Count > 0) DpsQueue.RemoveLast();
dpsStopwatch.Restart();
}
}

private int GetFullHp()
{
return Life.CurHP + Life.CurES;
}
}
}
Loading