diff --git a/.gitignore b/.gitignore index 4ce6fdd..1638988 100644 --- a/.gitignore +++ b/.gitignore @@ -337,4 +337,7 @@ ASALocalRun/ .localhistory/ # BeatPulse healthcheck temp database -healthchecksdb \ No newline at end of file +healthchecksdb + +# KDiff3 +*.orig \ No newline at end of file diff --git a/DebuffPanel.cs b/DebuffPanel.cs new file mode 100644 index 0000000..18f7365 --- /dev/null +++ b/DebuffPanel.cs @@ -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 Bleed => _Entity.Buffs.Where(b => b.Name == "bleeding_stack").ToList(); + public List 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"); + } +} diff --git a/HealthBar.cs b/HealthBar.cs index a2f9323..9f677ab 100644 --- a/HealthBar.cs +++ b/HealthBar.cs @@ -1,64 +1,40 @@ -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 Bleeding { get; set; } - public Dictionary Corruption { get; set; } - public Dictionary Poisoned { get; set; } - public Dictionary Frozen { get; set; } - public Dictionary Chilled { get; set; } - public Dictionary Burning { get; set; } - public Dictionary Shocked { get; set; } - public Dictionary 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 IgnoreEntitiesList = new List {"MonsterFireTrap2", "MonsterBlastRainTrap", "VolatileDeadCore"}; - private readonly Stopwatch dpsStopwatch = Stopwatch.StartNew(); - private readonly TimeCache _distance; - private bool _init; - private int _lastHp; - public RectangleF BackGround; - public bool CanNotDie; - public double DiedFrames = 0; - public Func 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 _DistanceCache { get; set; } + public float Distance => _DistanceCache.Value; + public Entity Entity { get; } + public CreatureType Type { get; private set; } + public Life Life => Entity.GetComponent(); + 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(() => 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(() => entity.DistancePlayer, 200); + DebuffPanel = new DebuffPanel(entity); Update(entity, settings); - - //CanNotDie = entity.GetComponent().StatDictionary.ContainsKey(GameStat.CannotDie); CanNotDie = entity.Path.StartsWith("Metadata/Monsters/Totems/Labyrinth"); - if (entity.HasComponent() && entity.GetComponent().Mods.Contains("MonsterConvertsOnDeath_")) + var mods = entity?.GetComponent()?.Mods; + if (mods != null && mods.Contains("MonsterConvertsOnDeath_")) { OnHostileChange = () => { @@ -66,7 +42,6 @@ public HealthBar(Entity entity, HealthBarsSettings settings) }; } } - public bool IsHostile { get @@ -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(); - public Entity Entity { get; } - public UnitSettings Settings { get; private set; } - public CreatureType Type { get; private set; } - public LinkedList DpsQueue { get; } = new LinkedList(); - public Color Color { get { - if (IsHidden()) + if (IsHidden(Entity)) return Color.LightGray; if (HpPercent <= 0.1f) @@ -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) { @@ -120,11 +102,15 @@ public void Update(Entity entity, HealthBarsSettings settings) { if (entity.IsHostile) { - var objectMagicProperties = entity.GetComponent(); - - if (objectMagicProperties != null) + var rarity = entity.GetComponent(); + if(rarity == null) { - switch (objectMagicProperties.Rarity) + Type = CreatureType.Minion; + Settings = settings.Minions; + } + else + { + switch (rarity.Rarity) { case MonsterRarity.White: Type = CreatureType.Normal; @@ -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; } } } diff --git a/HealthBars.cs b/HealthBars.cs index 26fec25..5075c0c 100644 --- a/HealthBars.cs +++ b/HealthBars.cs @@ -18,43 +18,14 @@ public class HealthBars : BaseSettingsPlugin private Camera camera; private bool CanTick = true; private readonly List ElementForSkip = new List(); - private const string IGNORE_FILE = "IgnoredEntities.txt"; - private List IgnoredSum; - - private List Ignored = new List - { - "Metadata/Monsters/Daemon/SilverPoolChillDaemon", - "Metadata/Monsters/Daemon", - "Metadata/Monsters/Frog/FrogGod/SilverOrb", - "Metadata/Monsters/Frog/FrogGod/SilverPool", - "Metadata/Monsters/Labyrinth/GoddessOfJusticeMapBoss@7", - "Metadata/Monsters/Labyrinth/GoddessOfJustice@", - "Metadata/Monsters/LeagueBetrayal/MasterNinjaCop", - //Delirium Ignores - "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonEyes1", - "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonEyes2", - "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonEyes3", - "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonSpikes", - "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonSpikes2", - "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonSpikes3", - "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonPimple1", - "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonPimple2", - "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonPimple3", - "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonGoatFillet1Vanish", - "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonGoatFillet2Vanish", - "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonGoatRhoa1Vanish", - "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonGoatRhoa2Vanish", - "Metadata/Monsters/InvisibleFire/InvisibleFireAfflictionCorpseDegen", - "Metadata/Monsters/InvisibleFire/InvisibleFireAfflictionDemonColdDegenUnique", - "Metadata/Monsters/VolatileCore/VolatileDeadCore", - }; + private string IGNORE_FILE { get; } = Path.Combine("config", "ignored_entities.txt"); + private List IgnoredEntities { get; set; } private IngameUIElements ingameUI; private CachedValue ingameUICheckVisible; private Vector2 oldplayerCord; private Entity Player; private HealthBar PlayerBar; - private double time; private RectangleF windowRectangle; private Size2F windowSize; @@ -82,63 +53,28 @@ public override bool Initialise() windowRectangle = GameController.Window.GetWindowRectangleReal(); windowSize = new Size2F(windowRectangle.Width / 2560, windowRectangle.Height / 1600); camera = GameController.Game.IngameState.Camera; - - return ingameUI.BetrayalWindow.IsVisibleLocal || ingameUI.SellWindow.IsVisibleLocal || + + return ingameUI.SyndicatePanel.IsVisibleLocal || ingameUI.SellWindow.IsVisibleLocal || ingameUI.DelveWindow.IsVisibleLocal || ingameUI.IncursionWindow.IsVisibleLocal || - ingameUI.UnveilWindow.IsVisibleLocal || ingameUI.TreePanel.IsVisibleLocal || ingameUI.AtlasPanel.IsVisibleLocal || - ingameUI.CraftBench.IsVisibleLocal; + ingameUI.UnveilWindow.IsVisibleLocal || ingameUI.TreePanel.IsVisibleLocal || ingameUI.Atlas.IsVisibleLocal || + ingameUI.CraftBench.IsVisibleLocal || ingameUI.UltimatumPanel.IsVisibleLocal; }, 250); ReadIgnoreFile(); return true; } - private void CreateIgnoreFile() - { - var path = $"{DirectoryFullName}\\{IGNORE_FILE}"; - - var defaultConfig = - #region default Config - "#default ignores\n" + - "Metadata/Monsters/Daemon/SilverPoolChillDaemon\n" + - "Metadata/Monsters/Daemon\n" + - "Metadata/Monsters/Frog/FrogGod/SilverOrb\n" + - "Metadata/Monsters/Frog/FrogGod/SilverPool\n" + - "Metadata/Monsters/Labyrinth/GoddessOfJusticeMapBoss@7\n" + - "Metadata/Monsters/Labyrinth/GoddessOfJustice@\n" + - "Metadata/Monsters/LeagueBetrayal/MasterNinjaCop\n" + - "#Delirium Ignores\n" + - "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonEyes1\n" + - "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonEyes2\n" + - "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonEyes3\n" + - "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonSpikes\n" + - "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonSpikes2\n" + - "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonSpikes3\n" + - "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonPimple1\n" + - "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonPimple2\n" + - "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonPimple3\n" + - "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonGoatFillet1Vanish\n" + - "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonGoatFillet2Vanish\n" + - "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonGoatRhoa1Vanish\n" + - "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonGoatRhoa2Vanish\n" + - "Metadata/Monsters/InvisibleFire/InvisibleFireAfflictionCorpseDegen\n" + - "Metadata/Monsters/InvisibleFire/InvisibleFireAfflictionDemonColdDegenUnique\n"; - #endregion - if (File.Exists(path)) return; - using (var streamWriter = new StreamWriter(path, true)) - { - streamWriter.Write(defaultConfig); - streamWriter.Close(); - } - } + private void ReadIgnoreFile() { - var path = $"{DirectoryFullName}\\{IGNORE_FILE}"; - if (File.Exists(path)) + var path = Path.Combine(DirectoryFullName, IGNORE_FILE); + if (File.Exists(path)) { - var text = File.ReadAllLines(path).Where(line => !string.IsNullOrWhiteSpace(line) && !line.StartsWith("#")).ToList(); - IgnoredSum = Ignored.Concat(text).ToList(); - } else - CreateIgnoreFile(); + IgnoredEntities = File.ReadAllLines(path).Where(line => !string.IsNullOrWhiteSpace(line) && !line.StartsWith("#")).ToList(); + } + else + { + LogError($"Ignored entities file does not exist. Path: {path}"); + } } public override void AreaChange(AreaInstance area) @@ -147,54 +83,35 @@ public override void AreaChange(AreaInstance area) ReadIgnoreFile(); } - public void HpBarWork(HealthBar healthBar) + private bool SkipHealthBar(HealthBar healthBar) { - if (healthBar.Life == null || healthBar.Settings == null || !healthBar.Settings.Enable) - { - healthBar.Skip = true; - return; - } + if (healthBar == null) return true; + if (healthBar.Settings == null) return true; + if (!healthBar.Settings.Enable) return true; + if (!healthBar.Entity.IsAlive) return true; + if (healthBar.HpPercent < 0.001f) return true; + if (healthBar.Type == CreatureType.Minion && healthBar.HpPercent * 100 > Settings.ShowMinionOnlyBelowHp) return true; + if (healthBar.Entity.League == LeagueType.Legion && healthBar.Entity.IsHidden + && healthBar.Entity.Rarity != MonsterRarity.Unique + && healthBar.Entity.Rarity != MonsterRarity.Rare + && Settings.HideHiddenLegionMonsters) return true; + + return false; + } - if (!healthBar.Entity.IsAlive) - { - healthBar.Skip = true; - return; - } + public void HpBarWork(HealthBar healthBar) + { + if (healthBar == null) return; + healthBar.Skip = SkipHealthBar(healthBar); + if (healthBar.Skip) return; var healthBarDistance = healthBar.Distance; - if (healthBarDistance > Settings.LimitDrawDistance) { healthBar.Skip = true; return; } - healthBar.HpPercent = healthBar.Life.HPPercentage; - - if (healthBar.HpPercent < 0.001f) - { - healthBar.Skip = true; - return; - } - - if (healthBar.Type == CreatureType.Minion && healthBar.HpPercent * 100 > Settings.ShowMinionOnlyBelowHp) - { - healthBar.Skip = true; - return; - } - - if (healthBar.Entity.League == LeagueType.Legion && healthBar.Entity.IsHidden && healthBar.Entity.Rarity != MonsterRarity.Unique) - { - healthBar.Skip = true; - return; - } - - if (healthBar.Settings.ShowFloatingCombatDamage) - { - healthBar.DpsRefresh(); - } - - var _ = healthBar.IsHostile; var worldCoords = healthBar.Entity.Pos; worldCoords.Z += Settings.GlobalZ; var mobScreenCoords = camera.WorldToScreen(worldCoords); @@ -241,30 +158,26 @@ private void TickLogic() { CanTick = true; - if (ingameUICheckVisible.Value) - { - CanTick = false; - return; - } - - if (camera == null) + if (ingameUICheckVisible.Value + || camera == null + || GameController.Area.CurrentArea.IsTown && !Settings.ShowInTown) { CanTick = false; return; } - if (GameController.Area.CurrentArea.IsTown && !Settings.ShowInTown) - { - CanTick = false; - return; - } - - foreach (var validEntity in GameController.EntityListWrapper.ValidEntitiesByType[EntityType.Monster]) + var monster = GameController.EntityListWrapper.ValidEntitiesByType[EntityType.Monster]; + foreach (var validEntity in monster) { var healthBar = validEntity.GetHudComponent(); - - if (healthBar != null) + try + { HpBarWork(healthBar); + } + catch (Exception e) + { + DebugWindow.LogError(e.Message); + } } foreach (var validEntity in GameController.EntityListWrapper.ValidEntitiesByType[EntityType.Player]) @@ -278,8 +191,7 @@ private void TickLogic() public override void Render() { - if (!CanTick) - return; + if (!CanTick) return; foreach (var entity in GameController.EntityListWrapper.ValidEntitiesByType[EntityType.Monster]) { @@ -326,7 +238,6 @@ public override void Render() PlayerBar.BackGround = new RectangleF(result.X - scaledWidth / 2f, result.Y - scaledHeight / 2f, scaledWidth, scaledHeight); - PlayerBar.HpPercent = PlayerBar.Life.HPPercentage; PlayerBar.HpWidth = PlayerBar.HpPercent * scaledWidth; PlayerBar.EsWidth = PlayerBar.Life.ESPercentage * scaledWidth; DrawBar(PlayerBar); @@ -352,71 +263,92 @@ public void DrawBar(HealthBar bar) bar.BackGround.Inflate(1, 1); Graphics.DrawFrame(bar.BackGround, bar.Settings.Outline, 1); - if (bar.Settings.ShowPercents) - { - Graphics.DrawText($"{Math.Floor(bar.HpPercent * 100).ToString(CultureInfo.InvariantCulture)}", - new Vector2(bar.BackGround.Right, bar.BackGround.Center.Y - Graphics.Font.Size / 2f), - bar.Settings.PercentTextColor); - } + ShowPercents(bar); + ShowNumbersInHealthbar(bar); + ShowDebuffPanel(bar); + } + + private void ShowNumbersInHealthbar(HealthBar bar) + { + if (!bar.Settings.ShowHealthText && !bar.Settings.ShowEnergyShieldText) return; + string healthBarText = ""; if (bar.Settings.ShowHealthText) { - var formattableString = $"{bar.Life.CurHP}/{bar.MaxHp}"; - - Graphics.DrawText(formattableString, - new Vector2(bar.BackGround.Center.X, bar.BackGround.Center.Y - Graphics.Font.Size / 2f), - bar.Settings.HealthTextColor, FontAlign.Center); + healthBarText = $"{bar.Life.CurHP.ToString("N0")}/{bar.Life.MaxHP.ToString("N0")}"; + } + else if (bar.Settings.ShowEnergyShieldText) + { + healthBarText = $"{bar.Life.CurES.ToString("N0")}/{bar.Life.MaxES.ToString("N0")}"; } - if (bar.Settings.ShowFloatingCombatDamage) + Graphics.DrawText(healthBarText, + new Vector2(bar.BackGround.Center.X, bar.BackGround.Center.Y - Graphics.Font.Size / 2f), + bar.Settings.HealthTextColor, + FontAlign.Center); + } + + private void ShowPercents(HealthBar bar) + { + if (!bar.Settings.ShowHealthPercents && !bar.Settings.ShowEnergyShieldPercents) return; + + float percents = 0; + if (bar.Settings.ShowHealthPercents) + { + percents = bar.Life.HPPercentage; + } + else if (bar.Settings.ShowEnergyShieldPercents) { - ShowDps(bar, new Vector2(bar.BackGround.Center.X, bar.BackGround.Y)); + percents = bar.Life.ESPercentage; } + + Graphics.DrawText(FloatToPercentString(percents), + new Vector2(bar.BackGround.Right, bar.BackGround.Center.Y - Graphics.Font.Size / 2f), + bar.Settings.PercentTextColor); } - private void ShowDps(HealthBar healthBar, Vector2 point) + private void ShowDebuffPanel(HealthBar bar) { - const int MARGIN_TOP = 2; - const int LAST_DAMAGE_ADD_SIZE = 7; - var fontSize = healthBar.Settings.FloatingCombatTextSize + LAST_DAMAGE_ADD_SIZE; - var textHeight = Graphics.MeasureText("100500", fontSize).Y; - - point.Y -= (textHeight + MARGIN_TOP); - int i = 0; - foreach (var dps in healthBar.DpsQueue) + if (!bar.Settings.ShowDebuffPanel) return; + + Graphics.DrawText(bar.DebuffPanel.Bleed.Count.ToString(), + new Vector2(bar.BackGround.Left, bar.BackGround.Top - Graphics.Font.Size), + bar.DebuffPanel.Bleed.Count == 8 ? Color.Green : Color.Red); + + Graphics.DrawText(bar.DebuffPanel.CorruptedBlood.Count.ToString(), + new Vector2(bar.BackGround.Left + 20, bar.BackGround.Top - Graphics.Font.Size), + bar.DebuffPanel.CorruptedBlood.Count == 10 ? Color.Green : Color.Red); + + if (bar.DebuffPanel.CurseVulnerability != null) { - i++; - var damageColor = healthBar.Settings.FloatingCombatDamageColor; - var sign = string.Empty; - if (dps > 0) - { - damageColor = healthBar.Settings.FloatingCombatHealColor; - sign = "+"; - } + Graphics.DrawText($"{Convert.ToInt32(bar.DebuffPanel.CurseVulnerability.Timer).ToString()}", + new Vector2(bar.BackGround.Left + 40, bar.BackGround.Top - Graphics.Font.Size), + bar.DebuffPanel.CurseVulnerability.Timer > 2 ? Color.Green : Color.Red); + } - string dpsText = $"{sign}{dps}"; - Graphics.DrawText(dpsText, point, Color.Black, fontSize, FontAlign.Center); - point.Y -= (Graphics.DrawText(dpsText, point, damageColor, fontSize, FontAlign.Center).Y + MARGIN_TOP); - if (i == 1) - { - fontSize -= LAST_DAMAGE_ADD_SIZE; - } + if (bar.DebuffPanel.AuraPride != null) + { + Graphics.DrawText("P", + new Vector2(bar.BackGround.Left + 60, bar.BackGround.Top - Graphics.Font.Size), + Color.Green); } - healthBar.DpsDequeue(); + } + + private string FloatToPercentString (float number) + { + return $"{Math.Floor(number * 100).ToString(CultureInfo.InvariantCulture)}"; } public override void EntityAdded(Entity Entity) { - if (Entity.Type != EntityType.Monster && Entity.Type != EntityType.Player || Entity.Address == GameController.Player.Address || - Entity.Type == EntityType.Daemon) return; + if (Entity == null) return; + if (Entity.Type != EntityType.Monster && Entity.Type != EntityType.Player + || Entity.Address == GameController.Player.Address + || Entity.Type == EntityType.Daemon) return; if (Entity.GetComponent() != null && !Entity.IsAlive) return; - if (IgnoredSum.Any(x => Entity.Path.StartsWith(x))) return; + if (IgnoredEntities.Any(x => Entity.Path.StartsWith(x))) return; Entity.SetHudComponent(new HealthBar(Entity, Settings)); } - - public override void EntityRemoved(Entity Entity) - { - } } } diff --git a/HealthBars.csproj b/HealthBars.csproj index ff67275..d4faa10 100644 --- a/HealthBars.csproj +++ b/HealthBars.csproj @@ -21,18 +21,20 @@ DEBUG;TRACE prompt 4 + x64 pdbonly true - ..\..\..\..\PoeHelper\Plugins\Compiled\HealthBars\ + ..\..\PoeHelper\PrivateHud\Plugins\Compiled\HealthBars\ TRACE prompt 4 + x64 true - ..\..\..\..\PoeHelper\Plugins\Compiled\DevTree\ + ..\..\..\..\PoeHelper\Plugins\Compiled\HealthBars\ DEBUG;TRACE full x64 @@ -40,7 +42,7 @@ MinimumRecommendedRules.ruleset - bin\x64\Release\ + ..\..\..\..\PoeHelper\Plugins\Compiled\HealthBars\ TRACE true pdbonly @@ -50,11 +52,11 @@ - ..\..\..\packages\SharpDX.4.2.0\lib\net45\SharpDX.dll + ..\..\PoeHelper\PrivateHud\SharpDX.dll False - ..\..\..\packages\SharpDX.Mathematics.4.2.0\lib\net45\SharpDX.Mathematics.dll + ..\..\PoeHelper\PrivateHud\SharpDX.Mathematics.dll False @@ -68,13 +70,14 @@ + - + {5539d732-34a7-44ab-9e28-116c3429b12a} Core False @@ -83,5 +86,10 @@ + + + PreserveNewest + + \ No newline at end of file diff --git a/HealthBarsSettings.cs b/HealthBarsSettings.cs index 06006e7..037d819 100644 --- a/HealthBarsSettings.cs +++ b/HealthBarsSettings.cs @@ -14,11 +14,10 @@ public HealthBarsSettings() ShowEnemies = new ToggleNode(true); Players = new UnitSettings(0x008000ff, 0); Minions = new UnitSettings(0x90ee90ff, 0); - NormalEnemy = new UnitSettings(0xff0000ff, 0, 0x66ff66ff, false); - MagicEnemy = new UnitSettings(0xff0000ff, 0x8888ffff, 0x66ff99ff, false); - RareEnemy = new UnitSettings(0xff0000ff, 0xffff77ff, 0x66ff99ff, false); - UniqueEnemy = new UnitSettings(0xff0000ff, 0xffa500ff, 0x66ff99ff, false); - ShowDebuffPanel = new ToggleNode(false); + NormalEnemy = new UnitSettings(0xff0000ff, 0, 0x66ff66ff, false, 75, 10); + MagicEnemy = new UnitSettings(0x8888ffff, 0x8888ffff, 0x66ff99ff, false, 100, 15); + RareEnemy = new UnitSettings(0xf4ff19ff, 0xf4ff19ff, 0x66ff99ff, false, 125, 20); + UniqueEnemy = new UnitSettings(0xffa500ff, 0xffa500ff, 0x66ff99ff, true, 200, 25); DebuffPanelIconSize = new RangeNode(20, 15, 40); GlobalZ = new RangeNode(-100, -300, 300); PlayerZ = new RangeNode(-100, -300, 300); @@ -43,8 +42,6 @@ public HealthBarsSettings() public UnitSettings RareEnemy { get; set; } [Menu("Unique enemy", 6)] public UnitSettings UniqueEnemy { get; set; } - [Menu("Show Debuff Panel")] - public ToggleNode ShowDebuffPanel { get; set; } [Menu("Size debuff icon")] public RangeNode DebuffPanelIconSize { get; set; } [Menu("Z")] @@ -56,15 +53,15 @@ public HealthBarsSettings() [Menu("Hide Over UI")] public ToggleNode HideOverUi { get; set; } = new ToggleNode(true); [Menu("Using ImGui for render")] - public ToggleNode ImGuiRender { get; set; } = new ToggleNode(false); + public ToggleNode ImGuiRender { get; set; } = new ToggleNode(true); public RangeNode LimitDrawDistance { get; set; } = new RangeNode(133, 0, 1000); [Menu("Rounding")] - public RangeNode Rounding { get; set; } = new RangeNode(0, 0, 64); public ToggleNode MultiThreading { get; set; } = new ToggleNode(false); public RangeNode MultiThreadingCountEntities { get; set; } = new RangeNode(10, 1, 200); public RangeNode ShowMinionOnlyBelowHp { get; set; } = new RangeNode(50, 1, 100); public ToggleNode SelfHealthBarShow { get; set; } = new ToggleNode(true); + public ToggleNode HideHiddenLegionMonsters { get; set; } = new ToggleNode(true); public ToggleNode Enable { get; set; } } @@ -74,6 +71,7 @@ public class UnitSettings : ISettings public UnitSettings(uint color, uint outline) { Enable = new ToggleNode(true); + ShowDebuffPanel = new ToggleNode(false); Width = new RangeNode(100, 20, 250); Height = new RangeNode(20, 5, 150); Color = color; @@ -82,24 +80,23 @@ public UnitSettings(uint color, uint outline) PercentTextColor = 0xffffffff; HealthTextColor = 0xffffffff; HealthTextColorUnder10Percent = 0xffff00ff; - ShowPercents = new ToggleNode(false); + ShowHealthPercents = new ToggleNode(false); + ShowEnergyShieldPercents = new ToggleNode(false); ShowHealthText = new ToggleNode(false); - ShowFloatingCombatDamage = new ToggleNode(false); - FloatingCombatTextSize = new RangeNode(15, 10, 30); - FloatingCombatDamageColor = SharpDX.Color.Yellow; - FloatingCombatHealColor = SharpDX.Color.Lime; + ShowEnergyShieldText = new ToggleNode(false); BackGround = SharpDX.Color.Black; - TextSize = new RangeNode(15, 10, 50); - FloatingCombatStackSize = new RangeNode(1, 1, 10); } - public UnitSettings(uint color, uint outline, uint percentTextColor, bool showText) : this(color, outline) + public UnitSettings(uint color, uint outline, uint percentTextColor, bool showHealthText, int width, int height) : this(color, outline) { PercentTextColor = percentTextColor; - ShowPercents.Value = showText; - ShowHealthText.Value = showText; + ShowHealthText.Value = showHealthText; + Width = new RangeNode(width, 20, 250); + Height = new RangeNode(height, 5, 150); } + public ToggleNode Enable { get; set; } + public ToggleNode ShowDebuffPanel { get; set; } public RangeNode Width { get; set; } public RangeNode Height { get; set; } public ColorNode Color { get; set; } @@ -109,20 +106,9 @@ public UnitSettings(uint color, uint outline, uint percentTextColor, bool showTe public ColorNode PercentTextColor { get; set; } public ColorNode HealthTextColor { get; set; } public ColorNode HealthTextColorUnder10Percent { get; set; } - public ToggleNode ShowPercents { get; set; } + public ToggleNode ShowHealthPercents { get; set; } + public ToggleNode ShowEnergyShieldPercents { get; set; } public ToggleNode ShowHealthText { get; set; } - public RangeNode TextSize { get; set; } - [Menu("Floating Combat Text")] - public ToggleNode ShowFloatingCombatDamage { get; set; } - [Menu("Damage Color")] - public ColorNode FloatingCombatDamageColor { get; set; } - [Menu("Heal Color")] - public ColorNode FloatingCombatHealColor { get; set; } - [Menu("Text Size")] - public RangeNode FloatingCombatTextSize { get; set; } - [Menu("Number of Lines")] - public RangeNode FloatingCombatStackSize { get; set; } - [Menu("Enable")] - public ToggleNode Enable { get; set; } + public ToggleNode ShowEnergyShieldText { get; set; } } } diff --git a/config/ignored_entities.txt b/config/ignored_entities.txt new file mode 100644 index 0000000..2a08e68 --- /dev/null +++ b/config/ignored_entities.txt @@ -0,0 +1,107 @@ +# General +Metadata/Monsters/Labyrinth/GoddessOfJustice +Metadata/Monsters/traps/MonsterFireTrap2 +Metadata/Monsters/traps/MonsterBlastRainTrap + +# Delirium Ignores +Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonEyes1 +Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonEyes2 +Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonEyes3 +Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonSpikes +Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonSpikes2 +Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonSpikes3 +Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonPimple1 +Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonPimple2 +Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonPimple3 +Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonGoatFillet1Vanish +Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonGoatFillet2Vanish +Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonGoatRhoa1Vanish +Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonGoatRhoa2Vanish + +# Conquerors Ignores +Metadata/Monsters/AtlasExiles/AtlasExile1@ +Metadata/Monsters/AtlasExiles/CrusaderInfluenceMonsters/CrusaderArcaneRune +Metadata/Monsters/AtlasExiles/AtlasExile2_ +Metadata/Monsters/AtlasExiles/EyrieInfluenceMonsters/EyrieFrostnadoDaemon +Metadata/Monsters/AtlasExiles/AtlasExile3@ +Metadata/Monsters/AtlasExiles/AtlasExile3AcidPitDaemon +Metadata/Monsters/AtlasExiles/AtlasExile3BurrowingViperMelee +Metadata/Monsters/AtlasExiles/AtlasExile3BurrowingViperRanged +Metadata/Monsters/AtlasExiles/AtlasExile4@ +Metadata/Monsters/AtlasExiles/AtlasExile4ApparitionCascade +Metadata/Monsters/AtlasExiles/AtlasExile5Apparition +Metadata/Monsters/AtlasExiles/AtlasExile5Throne + +# Incursion Ignores +Metadata/Monsters/LeagueIncursion/VaalSaucerRoomTurret +Metadata/Monsters/LeagueIncursion/VaalSaucerTurret +Metadata/Monsters/LeagueIncursion/VaalSaucerTurret + +# Betrayal Ignores +Metadata/Monsters/LeagueBetrayal/BetrayalTaserNet +Metadata/Monsters/LeagueBetrayal/FortTurret/FortTurret1Safehouse +Metadata/Monsters/LeagueBetrayal/FortTurret/FortTurret1 +Metadata/Monsters/LeagueBetrayal/MasterNinjaCop + +# Legion Ignores +Metadata/Monsters/LegionLeague/LegionVaalGeneralProjectileDaemon +Metadata/Monsters/LegionLeague/LegionSergeantStampedeDaemon +Metadata/Monsters/LegionLeague/LegionSandTornadoDaemon + +# Random Ignores +Metadata/Monsters/InvisibleFire/InvisibleSandstorm_ +Metadata/Monsters/InvisibleFire/InvisibleFrostnado +Metadata/Monsters/InvisibleFire/InvisibleFireAfflictionDemonColdDegen +Metadata/Monsters/InvisibleFire/InvisibleFireAfflictionDemonColdDegenUnique +Metadata/Monsters/InvisibleFire/InvisibleFireAfflictionCorpseDegen +Metadata/Monsters/InvisibleFire/InvisibleFireEyrieHurricane +Metadata/Monsters/InvisibleFire/InvisibleIonCannonFrost +Metadata/Monsters/InvisibleFire/AfflictionBossFinalDeathZone +Metadata/Monsters/InvisibleFire/InvisibleFireDoedreSewers +Metadata/Monsters/InvisibleFire/InvisibleFireDelveFlameTornadoSpiked +Metadata/Monsters/InvisibleFire/InvisibleHolyCannon + +Metadata/Monsters/InvisibleCurse/InvisibleFrostbiteStationary +Metadata/Monsters/InvisibleCurse/InvisibleConductivityStationary +Metadata/Monsters/InvisibleCurse/InvisibleEnfeeble + +Metadata/Monsters/InvisibleAura/InvisibleWrathStationary + +# Metadata/Monsters/Labyrinth/GoddessOfJustice +# Metadata/Monsters/Labyrinth/GoddessOfJusticeMapBoss +Metadata/Monsters/Frog/FrogGod/SilverOrb +Metadata/Monsters/Frog/FrogGod/SilverPool +Metadata/Monsters/LunarisSolaris/SolarisCelestialFormAmbushUniqueMap +Metadata/Monsters/Invisible/MaligaroSoulInvisibleBladeVortex +Metadata/Monsters/Daemon +Metadata/Monsters/Daemon/MaligaroBladeVortexDaemon +Metadata/Monsters/Daemon/SilverPoolChillDaemon +Metadata/Monsters/AvariusCasticus/AvariusCasticusStatue +Metadata/Monsters/Maligaro/MaligaroDesecrate + +# Synthesis +Metadata/Monsters/LeagueSynthesis/SynthesisDroneBossTurret1 +Metadata/Monsters/LeagueSynthesis/SynthesisDroneBossTurret2 +Metadata/Monsters/LeagueSynthesis/SynthesisDroneBossTurret3 +Metadata/Monsters/LeagueSynthesis/SynthesisDroneBossTurret4 +Metadata/Monsters/LeagueSynthesis/SynthesisWalkerSpawned_ + +# Ritual +Metadata/Monsters/LeagueRitual/FireMeteorDaemon +Metadata/Monsters/LeagueRitual/GenericSpeedDaemon +Metadata/Monsters/LeagueRitual/ColdRotatingBeamDaemon +Metadata/Monsters/LeagueRitual/ColdRotatingBeamDaemonUber +Metadata/Monsters/LeagueRitual/GenericEnergyShieldDaemon +Metadata/Monsters/LeagueRitual/GenericMassiveDaemon +Metadata/Monsters/LeagueRitual/ChaosGreenVinesDaemon_ +Metadata/Monsters/LeagueRitual/ChaosSoulrendPortalDaemon +Metadata/Monsters/LeagueRitual/VaalAtziriDaemon +Metadata/Monsters/LeagueRitual/LightningPylonDaemon + +# Bestiary +Metadata/Monsters/LeagueBestiary/RootSpiderBestiaryAmbush +Metadata/Monsters/LeagueBestiary/BlackScorpionBestiaryBurrowTornado +Metadata/Monsters/LeagueBestiary/ModDaemonCorpseEruption +Metadata/Monsters/LeagueBestiary/ModDaemonSandLeaperExplode1 +Metadata/Monsters/LeagueBestiary/ModDaemonStampede1 +Metadata/Monsters/LeagueBestiary/ModDaemonGraspingPincers1 \ No newline at end of file diff --git a/packages.config b/packages.config index 7eaa735..7225e91 100644 --- a/packages.config +++ b/packages.config @@ -1,6 +1,5 @@  - - - + + \ No newline at end of file