From 8525f06af48f641fb1ca8877932f7fe4761f3300 Mon Sep 17 00:00:00 2001 From: Queuete <-> Date: Sun, 22 Mar 2020 18:35:04 +0100 Subject: [PATCH 01/38] Change compile path --- HealthBars.csproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/HealthBars.csproj b/HealthBars.csproj index 03457be..5bef0e9 100644 --- a/HealthBars.csproj +++ b/HealthBars.csproj @@ -17,7 +17,7 @@ true full false - ..\0Compiles\HealthBars\ + ..\..\..\PoeHelper\Plugins\Compiled\HealthBars\ DEBUG;TRACE prompt 4 @@ -50,15 +50,15 @@ - ..\..\PoEHelper\ExileCore.dll + ..\..\..\PoeHelper\ExileCore.dll False - ..\..\ExileApi\packages\SharpDX.4.2.0\lib\net45\SharpDX.dll + ..\..\..\PoeHelper\SharpDX.dll False - ..\..\ExileApi\packages\SharpDX.Mathematics.4.2.0\lib\net45\SharpDX.Mathematics.dll + ..\..\..\PoeHelper\SharpDX.Mathematics.dll False From 8f99790cbfaf22c6b84b438ad26c21f9049f4203 Mon Sep 17 00:00:00 2001 From: Queuete <-> Date: Thu, 26 Mar 2020 12:39:01 +0100 Subject: [PATCH 02/38] Format numbers in HealthBars, Add setting for Energy Shield text --- HealthBar.cs | 2 -- HealthBars.cs | 51 ++++++++++++++++++++++++++++++++++--------- HealthBarsSettings.cs | 12 +++++++--- 3 files changed, 50 insertions(+), 15 deletions(-) diff --git a/HealthBar.cs b/HealthBar.cs index f8872f1..9668b30 100644 --- a/HealthBar.cs +++ b/HealthBar.cs @@ -83,7 +83,6 @@ public bool IsHostile } } - public int MaxHp { get; private set; } public float HpPercent { get; set; } public float Distance => _distance.Value; public Life Life => Entity.GetComponent(); @@ -155,7 +154,6 @@ public void Update(Entity entity, HealthBarsSettings settings) } _lastHp = GetFullHp(); - MaxHp = Life.MaxHP; _init = true; } diff --git a/HealthBars.cs b/HealthBars.cs index 6821b7e..b594ed9 100644 --- a/HealthBars.cs +++ b/HealthBars.cs @@ -346,21 +346,52 @@ 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); + } + + 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}"; + 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")}"; + } + + Graphics.DrawText(healthBarText, + new Vector2(bar.BackGround.Center.X, bar.BackGround.Center.Y - Graphics.Font.Size / 2f), + bar.Settings.HealthTextColor, + FontAlign.Center); + } - Graphics.DrawText(formattableString, - 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) + { + 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 string FloatToPercentString (float number) + { + return $"{Math.Floor(number * 100).ToString(CultureInfo.InvariantCulture)}"; } public override void EntityAdded(Entity Entity) diff --git a/HealthBarsSettings.cs b/HealthBarsSettings.cs index cd5e029..696840b 100644 --- a/HealthBarsSettings.cs +++ b/HealthBarsSettings.cs @@ -82,8 +82,10 @@ 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); + ShowEnergyShieldText = new ToggleNode(false); ShowFloatingCombatDamage = new ToggleNode(false); FloatingCombatTextSize = new RangeNode(15, 10, 30); FloatingCombatDamageColor = SharpDX.Color.Yellow; @@ -96,8 +98,10 @@ public UnitSettings(uint color, uint outline) public UnitSettings(uint color, uint outline, uint percentTextColor, bool showText) : this(color, outline) { PercentTextColor = percentTextColor; - ShowPercents.Value = showText; + ShowHealthPercents.Value = showText; + ShowEnergyShieldPercents.Value = showText; ShowHealthText.Value = showText; + ShowEnergyShieldText.Value = showText; } public RangeNode Width { get; set; } @@ -109,8 +113,10 @@ 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 ToggleNode ShowEnergyShieldText { get; set; } public RangeNode TextSize { get; set; } [Menu("Floating Combat Text")] public ToggleNode ShowFloatingCombatDamage { get; set; } From 98902b1dc4d75584373bd0f88843a8c466a1dc52 Mon Sep 17 00:00:00 2001 From: IlliumIv Date: Mon, 6 Apr 2020 15:23:45 +0500 Subject: [PATCH 03/38] Merge HealthBars of https://github.com/IlliumIv/ExileApiPlugins ; fixed output path and references --- HealthBars.cs | 2 +- HealthBars.csproj | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/HealthBars.cs b/HealthBars.cs index 650cf46..bf6db5f 100644 --- a/HealthBars.cs +++ b/HealthBars.cs @@ -360,7 +360,7 @@ public void DrawBar(HealthBar bar) if (bar.Settings.ShowHealthText) { - var formattableString = $"{bar.Life.CurHP}/{bar.MaxHp}"; + var formattableString = $"{bar.Life.CurHP}"; Graphics.DrawText(formattableString, new Vector2(bar.BackGround.Center.X, bar.BackGround.Center.Y - Graphics.Font.Size / 2f), diff --git a/HealthBars.csproj b/HealthBars.csproj index ce01e21..0cbb822 100644 --- a/HealthBars.csproj +++ b/HealthBars.csproj @@ -17,7 +17,7 @@ true full false - ..\..\..\..\PoEHelper\Plugins\Compiled\HealthBars\ + ..\..\PoeHelper\Plugins\Compiled\HealthBars\ DEBUG;TRACE prompt 4 @@ -50,15 +50,15 @@ - ..\..\..\..\PoeHelper\ExileCore.dll + ..\..\TehCheat\PoEHelper\ExileCore.dll False - - ..\..\..\..\PoeHelper\SharpDX.dll + + ..\..\TehCheat\PoEHelper\SharpDX.dll False - - ..\..\..\..\PoeHelper\SharpDX.Mathematics.dll + + ..\..\TehCheat\PoEHelper\SharpDX.Mathematics.dll False From 73bbec326b27fa21fd5421cd39014332cc7e61e8 Mon Sep 17 00:00:00 2001 From: Queuete <-> Date: Tue, 7 Apr 2020 23:28:50 +0200 Subject: [PATCH 04/38] Refactor and Fix crash when HealthBar does not exist on entity --- HealthBar.cs | 21 +++++++++--- HealthBars.cs | 90 ++++++++++++++++++--------------------------------- 2 files changed, 48 insertions(+), 63 deletions(-) diff --git a/HealthBar.cs b/HealthBar.cs index 9668b30..0e3322e 100644 --- a/HealthBar.cs +++ b/HealthBar.cs @@ -34,7 +34,6 @@ public class HealthBar public RectangleF BackGround; public bool CanNotDie; public double DiedFrames = 0; - public Func IsHidden; private bool isHostile; private readonly Action OnHostileChange; public bool Skip = false; @@ -44,8 +43,6 @@ 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) { @@ -83,7 +80,7 @@ public bool IsHostile } } - public float HpPercent { get; set; } + public float HpPercent => Life.HPPercentage; public float Distance => _distance.Value; public Life Life => Entity.GetComponent(); public Entity Entity { get; } @@ -95,7 +92,7 @@ public Color Color { get { - if (IsHidden()) + if (IsHidden(Entity)) return Color.LightGray; if (HpPercent <= 0.1f) @@ -105,6 +102,20 @@ public Color Color } } + private bool IsHidden(Entity entity) + { + try + { + return entity.IsHidden; + } + catch + { + return false; + } + } + + + public float HpWidth { get; set; } public float EsWidth { get; set; } diff --git a/HealthBars.cs b/HealthBars.cs index b594ed9..3e77e61 100644 --- a/HealthBars.cs +++ b/HealthBars.cs @@ -146,49 +146,32 @@ public override void AreaChange(AreaInstance area) ReadIgnoreFile(); } - public void HpBarWork(HealthBar healthBar) + private bool SkipHealthBar(HealthBar healthBar) { - if (!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) 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; - } - - var _ = healthBar.IsHostile; var worldCoords = healthBar.Entity.Pos; worldCoords.Z += Settings.GlobalZ; var mobScreenCoords = camera.WorldToScreen(worldCoords); @@ -235,30 +218,26 @@ private void TickLogic() { CanTick = true; - if (ingameUICheckVisible.Value) - { - CanTick = false; - return; - } - - if (camera == null) - { - CanTick = false; - return; - } - - if (GameController.Area.CurrentArea.IsTown && !Settings.ShowInTown) + if (ingameUICheckVisible.Value + || camera == null + || 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]) @@ -272,8 +251,7 @@ private void TickLogic() public override void Render() { - if (!CanTick) - return; + if (!CanTick) return; foreach (var entity in GameController.EntityListWrapper.ValidEntitiesByType[EntityType.Monster]) { @@ -320,7 +298,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); @@ -396,16 +373,13 @@ private string FloatToPercentString (float number) 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.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; Entity.SetHudComponent(new HealthBar(Entity, Settings)); } - - public override void EntityRemoved(Entity Entity) - { - } } } From df7fc89e474db26ac05cdd25e363e9de89663e71 Mon Sep 17 00:00:00 2001 From: Queuete <-> Date: Wed, 22 Apr 2020 14:07:45 +0200 Subject: [PATCH 05/38] Fix output path and target x64 --- HealthBars.cs | 1 - HealthBars.csproj | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/HealthBars.cs b/HealthBars.cs index 3e77e61..240df7b 100644 --- a/HealthBars.cs +++ b/HealthBars.cs @@ -53,7 +53,6 @@ public class HealthBars : BaseSettingsPlugin private Vector2 oldplayerCord; private Entity Player; private HealthBar PlayerBar; - private double time; private RectangleF windowRectangle; private Size2F windowSize; diff --git a/HealthBars.csproj b/HealthBars.csproj index 5bef0e9..169fdcd 100644 --- a/HealthBars.csproj +++ b/HealthBars.csproj @@ -21,14 +21,16 @@ DEBUG;TRACE prompt 4 + x64 pdbonly true - ..\0Compiles\HealthBars\ + ..\..\..\PoeHelper\Plugins\Compiled\HealthBars\ TRACE prompt 4 + x64 true From e31ddcb3b61bbea130dea6ab4e9d7b15bb8cb934 Mon Sep 17 00:00:00 2001 From: IlliumIv Date: Thu, 25 Jun 2020 10:09:30 +0500 Subject: [PATCH 06/38] Merge branch 'master' of https://github.com/Queuete/HealthBars --- .gitignore | 5 +- HealthBar.cs | 23 ++++-- HealthBars.cs | 173 +++++++++++++++++------------------------- HealthBars.csproj | 10 ++- HealthBarsSettings.cs | 12 ++- 5 files changed, 103 insertions(+), 120 deletions(-) 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/HealthBar.cs b/HealthBar.cs index 9e0f22b..eb14090 100644 --- a/HealthBar.cs +++ b/HealthBar.cs @@ -34,7 +34,6 @@ public class HealthBar public RectangleF BackGround; public bool CanNotDie; public double DiedFrames = 0; - public Func IsHidden; private bool isHostile; private readonly Action OnHostileChange; public bool Skip = false; @@ -44,8 +43,6 @@ 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) { @@ -83,8 +80,7 @@ public bool IsHostile } } - public int MaxHp { get; private set; } - public float HpPercent { get; set; } + public float HpPercent => Life.HPPercentage; public float Distance => _distance.Value; public Life Life => Entity.GetComponent(); public Entity Entity { get; } @@ -96,7 +92,7 @@ public Color Color { get { - if (IsHidden()) + if (IsHidden(Entity)) return Color.LightGray; if (HpPercent <= 0.1f) @@ -106,6 +102,20 @@ public Color Color } } + private bool IsHidden(Entity entity) + { + try + { + return entity.IsHidden; + } + catch + { + return false; + } + } + + + public float HpWidth { get; set; } public float EsWidth { get; set; } @@ -155,7 +165,6 @@ public void Update(Entity entity, HealthBarsSettings settings) } _lastHp = GetFullHp(); - MaxHp = Life.MaxHP; _init = true; } diff --git a/HealthBars.cs b/HealthBars.cs index bf6db5f..240df7b 100644 --- a/HealthBars.cs +++ b/HealthBars.cs @@ -53,7 +53,6 @@ public class HealthBars : BaseSettingsPlugin private Vector2 oldplayerCord; private Entity Player; private HealthBar PlayerBar; - private double time; private RectangleF windowRectangle; private Size2F windowSize; @@ -146,54 +145,32 @@ public override void AreaChange(AreaInstance area) ReadIgnoreFile(); } - public void HpBarWork(HealthBar healthBar) + private bool SkipHealthBar(HealthBar healthBar) { - if (!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) 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); @@ -240,30 +217,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]) @@ -277,8 +250,7 @@ private void TickLogic() public override void Render() { - if (!CanTick) - return; + if (!CanTick) return; foreach (var entity in GameController.EntityListWrapper.ValidEntitiesByType[EntityType.Monster]) { @@ -325,7 +297,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); @@ -351,71 +322,63 @@ 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); + } + + private void ShowNumbersInHealthbar(HealthBar bar) + { + if (!bar.Settings.ShowHealthText && !bar.Settings.ShowEnergyShieldText) return; + string healthBarText = ""; if (bar.Settings.ShowHealthText) { - var formattableString = $"{bar.Life.CurHP}"; - - Graphics.DrawText(formattableString, - new Vector2(bar.BackGround.Center.X, bar.BackGround.Center.Y - Graphics.Font.Size / 2f), - bar.Settings.HealthTextColor, FontAlign.Center); - } - - if (bar.Settings.ShowFloatingCombatDamage) + healthBarText = $"{bar.Life.CurHP.ToString("N0")}/{bar.Life.MaxHP.ToString("N0")}"; + } + else if (bar.Settings.ShowEnergyShieldText) { - ShowDps(bar, new Vector2(bar.BackGround.Center.X, bar.BackGround.Y)); + healthBarText = $"{bar.Life.CurES.ToString("N0")}/{bar.Life.MaxES.ToString("N0")}"; } + + Graphics.DrawText(healthBarText, + new Vector2(bar.BackGround.Center.X, bar.BackGround.Center.Y - Graphics.Font.Size / 2f), + bar.Settings.HealthTextColor, + FontAlign.Center); } - private void ShowDps(HealthBar healthBar, Vector2 point) + private void ShowPercents(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) - { - i++; - var damageColor = healthBar.Settings.FloatingCombatDamageColor; - var sign = string.Empty; - if (dps > 0) - { - damageColor = healthBar.Settings.FloatingCombatHealColor; - sign = "+"; - } + if (!bar.Settings.ShowHealthPercents && !bar.Settings.ShowEnergyShieldPercents) return; - 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; - } + float percents = 0; + if (bar.Settings.ShowHealthPercents) + { + percents = bar.Life.HPPercentage; } - healthBar.DpsDequeue(); + else if (bar.Settings.ShowEnergyShieldPercents) + { + 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 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.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; Entity.SetHudComponent(new HealthBar(Entity, Settings)); } - - public override void EntityRemoved(Entity Entity) - { - } } } diff --git a/HealthBars.csproj b/HealthBars.csproj index 0cbb822..4ccfbb5 100644 --- a/HealthBars.csproj +++ b/HealthBars.csproj @@ -21,14 +21,16 @@ DEBUG;TRACE prompt 4 + x64 pdbonly true - ..\..\..\..\PoEHelper\Plugins\Compiled\HealthBars\ + ..\..\PoeHelper\Plugins\Compiled\HealthBars\ TRACE prompt 4 + x64 true @@ -50,15 +52,15 @@ - ..\..\TehCheat\PoEHelper\ExileCore.dll + ..\..\PoeHelper\ExileCore.dll False - ..\..\TehCheat\PoEHelper\SharpDX.dll + ..\..\PoEHelper\SharpDX.dll False - ..\..\TehCheat\PoEHelper\SharpDX.Mathematics.dll + ..\..\PoEHelper\SharpDX.Mathematics.dll False diff --git a/HealthBarsSettings.cs b/HealthBarsSettings.cs index cd5e029..696840b 100644 --- a/HealthBarsSettings.cs +++ b/HealthBarsSettings.cs @@ -82,8 +82,10 @@ 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); + ShowEnergyShieldText = new ToggleNode(false); ShowFloatingCombatDamage = new ToggleNode(false); FloatingCombatTextSize = new RangeNode(15, 10, 30); FloatingCombatDamageColor = SharpDX.Color.Yellow; @@ -96,8 +98,10 @@ public UnitSettings(uint color, uint outline) public UnitSettings(uint color, uint outline, uint percentTextColor, bool showText) : this(color, outline) { PercentTextColor = percentTextColor; - ShowPercents.Value = showText; + ShowHealthPercents.Value = showText; + ShowEnergyShieldPercents.Value = showText; ShowHealthText.Value = showText; + ShowEnergyShieldText.Value = showText; } public RangeNode Width { get; set; } @@ -109,8 +113,10 @@ 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 ToggleNode ShowEnergyShieldText { get; set; } public RangeNode TextSize { get; set; } [Menu("Floating Combat Text")] public ToggleNode ShowFloatingCombatDamage { get; set; } From 10e4eab3cd5e7a851212ddefe0327830de840ad3 Mon Sep 17 00:00:00 2001 From: IlliumIv Date: Thu, 25 Jun 2020 15:42:25 +0500 Subject: [PATCH 07/38] Added checkbox to allow hide max HP an ES. --- .gitignore | 5 +- HealthBar.cs | 23 ++++-- HealthBars.cs | 177 +++++++++++++++++------------------------- HealthBars.csproj | 10 ++- HealthBarsSettings.cs | 28 +++++-- 5 files changed, 118 insertions(+), 125 deletions(-) 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/HealthBar.cs b/HealthBar.cs index 9e0f22b..eb14090 100644 --- a/HealthBar.cs +++ b/HealthBar.cs @@ -34,7 +34,6 @@ public class HealthBar public RectangleF BackGround; public bool CanNotDie; public double DiedFrames = 0; - public Func IsHidden; private bool isHostile; private readonly Action OnHostileChange; public bool Skip = false; @@ -44,8 +43,6 @@ 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) { @@ -83,8 +80,7 @@ public bool IsHostile } } - public int MaxHp { get; private set; } - public float HpPercent { get; set; } + public float HpPercent => Life.HPPercentage; public float Distance => _distance.Value; public Life Life => Entity.GetComponent(); public Entity Entity { get; } @@ -96,7 +92,7 @@ public Color Color { get { - if (IsHidden()) + if (IsHidden(Entity)) return Color.LightGray; if (HpPercent <= 0.1f) @@ -106,6 +102,20 @@ public Color Color } } + private bool IsHidden(Entity entity) + { + try + { + return entity.IsHidden; + } + catch + { + return false; + } + } + + + public float HpWidth { get; set; } public float EsWidth { get; set; } @@ -155,7 +165,6 @@ public void Update(Entity entity, HealthBarsSettings settings) } _lastHp = GetFullHp(); - MaxHp = Life.MaxHP; _init = true; } diff --git a/HealthBars.cs b/HealthBars.cs index bf6db5f..97f0baf 100644 --- a/HealthBars.cs +++ b/HealthBars.cs @@ -53,7 +53,6 @@ public class HealthBars : BaseSettingsPlugin private Vector2 oldplayerCord; private Entity Player; private HealthBar PlayerBar; - private double time; private RectangleF windowRectangle; private Size2F windowSize; @@ -146,54 +145,32 @@ public override void AreaChange(AreaInstance area) ReadIgnoreFile(); } - public void HpBarWork(HealthBar healthBar) + private bool SkipHealthBar(HealthBar healthBar) { - if (!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) 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); @@ -240,30 +217,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]) @@ -277,8 +250,7 @@ private void TickLogic() public override void Render() { - if (!CanTick) - return; + if (!CanTick) return; foreach (var entity in GameController.EntityListWrapper.ValidEntitiesByType[EntityType.Monster]) { @@ -325,7 +297,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); @@ -351,71 +322,67 @@ 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); + } + + private void ShowNumbersInHealthbar(HealthBar bar) + { + if (!bar.Settings.ShowHealthText && !bar.Settings.ShowEnergyShieldText) return; + string healthBarText = ""; if (bar.Settings.ShowHealthText) { - var formattableString = $"{bar.Life.CurHP}"; - - Graphics.DrawText(formattableString, - new Vector2(bar.BackGround.Center.X, bar.BackGround.Center.Y - Graphics.Font.Size / 2f), - bar.Settings.HealthTextColor, FontAlign.Center); - } - - if (bar.Settings.ShowFloatingCombatDamage) + healthBarText = $"{bar.Life.CurHP.ToString("N0")}"; + if (bar.Settings.ShowMaxHealthText) + healthBarText += $"/{bar.Life.MaxHP.ToString("N0")}"; + } + else if (bar.Settings.ShowEnergyShieldText) { - ShowDps(bar, new Vector2(bar.BackGround.Center.X, bar.BackGround.Y)); + healthBarText = $"{bar.Life.CurES.ToString("N0")}"; + if (bar.Settings.ShowMaxEnergyShieldText) + healthBarText += $"/{bar.Life.MaxES.ToString("N0")}"; } + + Graphics.DrawText(healthBarText, + new Vector2(bar.BackGround.Center.X, bar.BackGround.Center.Y - Graphics.Font.Size / 2f), + bar.Settings.HealthTextColor, + FontAlign.Center); } - private void ShowDps(HealthBar healthBar, Vector2 point) + private void ShowPercents(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) - { - i++; - var damageColor = healthBar.Settings.FloatingCombatDamageColor; - var sign = string.Empty; - if (dps > 0) - { - damageColor = healthBar.Settings.FloatingCombatHealColor; - sign = "+"; - } + if (!bar.Settings.ShowHealthPercents && !bar.Settings.ShowEnergyShieldPercents) return; - 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; - } + float percents = 0; + if (bar.Settings.ShowHealthPercents) + { + percents = bar.Life.HPPercentage; } - healthBar.DpsDequeue(); + else if (bar.Settings.ShowEnergyShieldPercents) + { + 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 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.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; Entity.SetHudComponent(new HealthBar(Entity, Settings)); } - - public override void EntityRemoved(Entity Entity) - { - } } } diff --git a/HealthBars.csproj b/HealthBars.csproj index 0cbb822..4ccfbb5 100644 --- a/HealthBars.csproj +++ b/HealthBars.csproj @@ -21,14 +21,16 @@ DEBUG;TRACE prompt 4 + x64 pdbonly true - ..\..\..\..\PoEHelper\Plugins\Compiled\HealthBars\ + ..\..\PoeHelper\Plugins\Compiled\HealthBars\ TRACE prompt 4 + x64 true @@ -50,15 +52,15 @@ - ..\..\TehCheat\PoEHelper\ExileCore.dll + ..\..\PoeHelper\ExileCore.dll False - ..\..\TehCheat\PoEHelper\SharpDX.dll + ..\..\PoEHelper\SharpDX.dll False - ..\..\TehCheat\PoEHelper\SharpDX.Mathematics.dll + ..\..\PoEHelper\SharpDX.Mathematics.dll False diff --git a/HealthBarsSettings.cs b/HealthBarsSettings.cs index cd5e029..b9defeb 100644 --- a/HealthBarsSettings.cs +++ b/HealthBarsSettings.cs @@ -14,10 +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); + NormalEnemy = new UnitSettings(0xff0000ff, 0, 0x66ff66ff, false, false); + MagicEnemy = new UnitSettings(0xff0000ff, 0x8888ffff, 0x66ff99ff, false, false); + RareEnemy = new UnitSettings(0xff0000ff, 0xffff77ff, 0x66ff99ff, false, false); + UniqueEnemy = new UnitSettings(0xff0000ff, 0xffa500ff, 0x66ff99ff, false, false); ShowDebuffPanel = new ToggleNode(false); DebuffPanelIconSize = new RangeNode(20, 15, 40); GlobalZ = new RangeNode(-100, -300, 300); @@ -82,8 +82,12 @@ 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); + ShowMaxHealthText = new ToggleNode(false); + ShowEnergyShieldText = new ToggleNode(false); + ShowMaxEnergyShieldText = new ToggleNode(false); ShowFloatingCombatDamage = new ToggleNode(false); FloatingCombatTextSize = new RangeNode(15, 10, 30); FloatingCombatDamageColor = SharpDX.Color.Yellow; @@ -93,11 +97,15 @@ public UnitSettings(uint color, uint outline) 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 showText, bool showMaxText) : this(color, outline) { PercentTextColor = percentTextColor; - ShowPercents.Value = showText; + ShowHealthPercents.Value = showText; + ShowEnergyShieldPercents.Value = showText; ShowHealthText.Value = showText; + ShowMaxHealthText.Value = showMaxText; + ShowEnergyShieldText.Value = showText; + ShowMaxEnergyShieldText.Value = showMaxText; } public RangeNode Width { get; set; } @@ -109,8 +117,12 @@ 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 ToggleNode ShowMaxHealthText { get; set; } + public ToggleNode ShowEnergyShieldText { get; set; } + public ToggleNode ShowMaxEnergyShieldText { get; set; } public RangeNode TextSize { get; set; } [Menu("Floating Combat Text")] public ToggleNode ShowFloatingCombatDamage { get; set; } From ba0433fd725ebe9c8b5baa5bed0ddb44fe0ac801 Mon Sep 17 00:00:00 2001 From: IlliumIv Date: Mon, 29 Jun 2020 11:16:19 +0500 Subject: [PATCH 08/38] Added Crusaders and Basilisks runes to ignore. --- HealthBars.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/HealthBars.cs b/HealthBars.cs index 97f0baf..7b34e1f 100644 --- a/HealthBars.cs +++ b/HealthBars.cs @@ -45,7 +45,10 @@ public class HealthBars : BaseSettingsPlugin "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonGoatRhoa1Vanish", "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonGoatRhoa2Vanish", "Metadata/Monsters/InvisibleFire/InvisibleFireAfflictionCorpseDegen", - "Metadata/Monsters/InvisibleFire/InvisibleFireAfflictionDemonColdDegenUnique" + "Metadata/Monsters/InvisibleFire/InvisibleFireAfflictionDemonColdDegenUnique", + // Conquerors Runes Ignores + "Metadata/Monsters/AtlasExiles/CrusaderInfluenceMonsters/CrusaderArcaneRune", + // "Metadata/Monsters/AtlasExiles/BasiliskInfluenceMonsters/BasiliskBurrowingViper" }; private IngameUIElements ingameUI; @@ -346,7 +349,7 @@ private void ShowNumbersInHealthbar(HealthBar bar) Graphics.DrawText(healthBarText, new Vector2(bar.BackGround.Center.X, bar.BackGround.Center.Y - Graphics.Font.Size / 2f), - bar.Settings.HealthTextColor, + bar.Settings.HealthTextColor, FontAlign.Center); } @@ -382,6 +385,7 @@ public override void EntityAdded(Entity Entity) if (Entity.GetComponent() != null && !Entity.IsAlive) return; if (IgnoredSum.Any(x => Entity.Path.StartsWith(x))) return; + if (Entity.Path.StartsWith("Metadata/Monsters/AtlasExiles/BasiliskInfluenceMonsters/BasiliskBurrowingViper") && (Entity.Rarity != MonsterRarity.Unique)) return; Entity.SetHudComponent(new HealthBar(Entity, Settings)); } } From 11a0e67e52fa36a804ba4b4bdaa7967ce0f05f11 Mon Sep 17 00:00:00 2001 From: IlliumIv Date: Mon, 29 Jun 2020 16:08:54 +0500 Subject: [PATCH 09/38] Sync with public ExileApi repo. --- HealthBars.csproj | 21 ++++++++++++--------- packages.config | 5 ++--- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/HealthBars.csproj b/HealthBars.csproj index 4ccfbb5..275d48c 100644 --- a/HealthBars.csproj +++ b/HealthBars.csproj @@ -17,7 +17,7 @@ true full false - ..\..\PoeHelper\Plugins\Compiled\HealthBars\ + ..\..\..\..\PoeHelper\Plugins\Compiled\HealthBars\ DEBUG;TRACE prompt 4 @@ -51,16 +51,12 @@ MinimumRecommendedRules.ruleset - - ..\..\PoeHelper\ExileCore.dll - False - - - ..\..\PoEHelper\SharpDX.dll + + ..\..\..\packages\SharpDX.4.2.0\lib\net45\SharpDX.dll False - - ..\..\PoEHelper\SharpDX.Mathematics.dll + + ..\..\..\packages\SharpDX.Mathematics.4.2.0\lib\net45\SharpDX.Mathematics.dll False @@ -79,6 +75,13 @@ + + + {5539d732-34a7-44ab-9e28-116c3429b12a} + Core + False + + 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 From dd5b3f1a5c030ff9dbadda721b195216afef56a4 Mon Sep 17 00:00:00 2001 From: Queuete <-> Date: Fri, 10 Jul 2020 09:12:14 +0200 Subject: [PATCH 10/38] Activate on startup --- HealthBarsSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HealthBarsSettings.cs b/HealthBarsSettings.cs index 696840b..cbbf6ef 100644 --- a/HealthBarsSettings.cs +++ b/HealthBarsSettings.cs @@ -8,7 +8,7 @@ public class HealthBarsSettings : ISettings { public HealthBarsSettings() { - Enable = new ToggleNode(false); + Enable = new ToggleNode(true); ShowInTown = new ToggleNode(false); ShowES = new ToggleNode(true); ShowEnemies = new ToggleNode(true); From de8f5a0ff56e4f4fbfe57c1ef424a7512edfd434 Mon Sep 17 00:00:00 2001 From: Queuete <-> Date: Fri, 10 Jul 2020 11:43:38 +0200 Subject: [PATCH 11/38] Fix output path, show legion rares --- HealthBars.cs | 4 +++- HealthBars.csproj | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/HealthBars.cs b/HealthBars.cs index 240df7b..18bff0e 100644 --- a/HealthBars.cs +++ b/HealthBars.cs @@ -153,7 +153,9 @@ private bool SkipHealthBar(HealthBar healthBar) 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) return true; + if (healthBar.Entity.League == LeagueType.Legion && healthBar.Entity.IsHidden + && healthBar.Entity.Rarity != MonsterRarity.Unique + && healthBar.Entity.Rarity != MonsterRarity.Rare) return true; return false; } diff --git a/HealthBars.csproj b/HealthBars.csproj index 169fdcd..8069f47 100644 --- a/HealthBars.csproj +++ b/HealthBars.csproj @@ -34,7 +34,7 @@ true - ..\..\..\..\PoeHelper\Plugins\Compiled\DevTree\ + ..\..\..\PoeHelper\Plugins\Compiled\HealthBars\ DEBUG;TRACE full x64 From 535f6dace0fb6d437d37629f59a05915d3f06e04 Mon Sep 17 00:00:00 2001 From: Queuete <-> Date: Fri, 10 Jul 2020 11:50:25 +0200 Subject: [PATCH 12/38] Show all legion healthBars --- HealthBars.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/HealthBars.cs b/HealthBars.cs index 18bff0e..0057c1c 100644 --- a/HealthBars.cs +++ b/HealthBars.cs @@ -153,9 +153,9 @@ private bool SkipHealthBar(HealthBar healthBar) 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 +/* if (healthBar.Entity.League == LeagueType.Legion && healthBar.Entity.IsHidden && healthBar.Entity.Rarity != MonsterRarity.Unique - && healthBar.Entity.Rarity != MonsterRarity.Rare) return true; + && healthBar.Entity.Rarity != MonsterRarity.Rare) return true;*/ return false; } From 1f44db5fa7ef5922d24567ec72f03c8eefb8030c Mon Sep 17 00:00:00 2001 From: Queuete <-> Date: Fri, 10 Jul 2020 14:53:03 +0200 Subject: [PATCH 13/38] Fix null exception --- HealthBar.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HealthBar.cs b/HealthBar.cs index 0e3322e..f1568e2 100644 --- a/HealthBar.cs +++ b/HealthBar.cs @@ -80,7 +80,7 @@ public bool IsHostile } } - public float HpPercent => Life.HPPercentage; + public float HpPercent => Life?.HPPercentage ?? 100.0; public float Distance => _distance.Value; public Life Life => Entity.GetComponent(); public Entity Entity { get; } From 9b14a30a8316c5399ffa0447dc16f67c8a533024 Mon Sep 17 00:00:00 2001 From: Queuete <-> Date: Fri, 10 Jul 2020 14:54:38 +0200 Subject: [PATCH 14/38] Fix data type --- HealthBar.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HealthBar.cs b/HealthBar.cs index f1568e2..87590dd 100644 --- a/HealthBar.cs +++ b/HealthBar.cs @@ -80,7 +80,7 @@ public bool IsHostile } } - public float HpPercent => Life?.HPPercentage ?? 100.0; + public float HpPercent => Life?.HPPercentage ?? 100; public float Distance => _distance.Value; public Life Life => Entity.GetComponent(); public Entity Entity { get; } From 8e8d956901f4cf81cf5d2bfe3602659396700e56 Mon Sep 17 00:00:00 2001 From: IlliumIv Date: Thu, 16 Jul 2020 22:38:23 +0500 Subject: [PATCH 15/38] Expanded ignores list. --- HealthBars.cs | 72 ++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 60 insertions(+), 12 deletions(-) diff --git a/HealthBars.cs b/HealthBars.cs index 7b34e1f..6fac567 100644 --- a/HealthBars.cs +++ b/HealthBars.cs @@ -23,14 +23,7 @@ public class HealthBars : BaseSettingsPlugin 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 + // Delirium Ignores "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonEyes1", "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonEyes2", "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonEyes3", @@ -44,11 +37,66 @@ public class HealthBars : BaseSettingsPlugin "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonGoatFillet2Vanish", "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonGoatRhoa1Vanish", "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonGoatRhoa2Vanish", - "Metadata/Monsters/InvisibleFire/InvisibleFireAfflictionCorpseDegen", - "Metadata/Monsters/InvisibleFire/InvisibleFireAfflictionDemonColdDegenUnique", - // Conquerors Runes Ignores + + // Conquerors Ignores + "Metadata/Monsters/AtlasExiles/AtlasExile1@", "Metadata/Monsters/AtlasExiles/CrusaderInfluenceMonsters/CrusaderArcaneRune", - // "Metadata/Monsters/AtlasExiles/BasiliskInfluenceMonsters/BasiliskBurrowingViper" + "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", + + // 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/InvisibleCurse/InvisibleFrostbiteStationary", + "Metadata/Monsters/InvisibleCurse/InvisibleConductivityStationary", + + "Metadata/Monsters/InvisibleAura/InvisibleWrathStationary", + + "Metadata/Monsters/LeagueSynthesis/SynthesisDroneBossTurret1", + "Metadata/Monsters/LeagueSynthesis/SynthesisDroneBossTurret2", + "Metadata/Monsters/LeagueSynthesis/SynthesisDroneBossTurret3", + "Metadata/Monsters/LeagueSynthesis/SynthesisDroneBossTurret4", + + "Metadata/Monsters/LeagueBestiary/RootSpiderBestiaryAmbush", + + // "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", }; private IngameUIElements ingameUI; From 8a2a8adfc33f03d1639c76af777f1969e663ef1c Mon Sep 17 00:00:00 2001 From: IlliumIv Date: Thu, 23 Jul 2020 11:36:05 +0500 Subject: [PATCH 16/38] Expanded ignores list. --- HealthBars.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/HealthBars.cs b/HealthBars.cs index 6fac567..5bccde0 100644 --- a/HealthBars.cs +++ b/HealthBars.cs @@ -62,10 +62,11 @@ public class HealthBars : BaseSettingsPlugin "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_", @@ -74,9 +75,12 @@ public class HealthBars : BaseSettingsPlugin "Metadata/Monsters/InvisibleFire/InvisibleFireAfflictionDemonColdDegenUnique", "Metadata/Monsters/InvisibleFire/InvisibleFireAfflictionCorpseDegen", "Metadata/Monsters/InvisibleFire/InvisibleFireEyrieHurricane", + "Metadata/Monsters/InvisibleFire/InvisibleIonCannonFrost", + "Metadata/Monsters/InvisibleFire/AfflictionBossFinalDeathZone", "Metadata/Monsters/InvisibleCurse/InvisibleFrostbiteStationary", "Metadata/Monsters/InvisibleCurse/InvisibleConductivityStationary", + "Metadata/Monsters/InvisibleCurse/InvisibleEnfeeble", "Metadata/Monsters/InvisibleAura/InvisibleWrathStationary", @@ -86,6 +90,7 @@ public class HealthBars : BaseSettingsPlugin "Metadata/Monsters/LeagueSynthesis/SynthesisDroneBossTurret4", "Metadata/Monsters/LeagueBestiary/RootSpiderBestiaryAmbush", + "Metadata/Monsters/LeagueBestiary/BlackScorpionBestiaryBurrowTornado", // "Metadata/Monsters/Labyrinth/GoddessOfJustice", // "Metadata/Monsters/Labyrinth/GoddessOfJusticeMapBoss", From ed39d4f891decdaaf8551f6b2d8a029194baf27e Mon Sep 17 00:00:00 2001 From: IlliumIv Date: Fri, 28 Aug 2020 15:13:29 +0500 Subject: [PATCH 17/38] Some code's rewriting. --- HealthBars.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/HealthBars.cs b/HealthBars.cs index 5bccde0..c0e201d 100644 --- a/HealthBars.cs +++ b/HealthBars.cs @@ -21,7 +21,7 @@ public class HealthBars : BaseSettingsPlugin private const string IGNORE_FILE = "IgnoredEntities.txt"; private List IgnoredSum; - private List Ignored = new List + private readonly List Ignored = new List { // Delirium Ignores "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonEyes1", @@ -139,7 +139,7 @@ public override bool Initialise() return ingameUI.BetrayalWindow.IsVisibleLocal || ingameUI.SellWindow.IsVisibleLocal || ingameUI.DelveWindow.IsVisibleLocal || ingameUI.IncursionWindow.IsVisibleLocal || - ingameUI.UnveilWindow.IsVisibleLocal || ingameUI.TreePanel.IsVisibleLocal || ingameUI.AtlasPanel.IsVisibleLocal || + ingameUI.UnveilWindow.IsVisibleLocal || ingameUI.TreePanel.IsVisibleLocal || ingameUI.Atlas.IsVisibleLocal || ingameUI.CraftBench.IsVisibleLocal; }, 250); ReadIgnoreFile(); @@ -389,15 +389,15 @@ private void ShowNumbersInHealthbar(HealthBar bar) string healthBarText = ""; if (bar.Settings.ShowHealthText) { - healthBarText = $"{bar.Life.CurHP.ToString("N0")}"; + healthBarText = $"{bar.Life.CurHP:N0}"; if (bar.Settings.ShowMaxHealthText) - healthBarText += $"/{bar.Life.MaxHP.ToString("N0")}"; + healthBarText += $"/{bar.Life.MaxHP:N0}"; } else if (bar.Settings.ShowEnergyShieldText) { - healthBarText = $"{bar.Life.CurES.ToString("N0")}"; + healthBarText = $"{bar.Life.CurES:N0}"; if (bar.Settings.ShowMaxEnergyShieldText) - healthBarText += $"/{bar.Life.MaxES.ToString("N0")}"; + healthBarText += $"/{bar.Life.MaxES:N0}"; } Graphics.DrawText(healthBarText, From 9b7c1b160067e6aca82066dfa3039f4803d21744 Mon Sep 17 00:00:00 2001 From: Arecurius Date: Sun, 27 Sep 2020 11:28:26 +0200 Subject: [PATCH 18/38] fixed Ignoring of entities --- HealthBars.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HealthBars.cs b/HealthBars.cs index 5df4825..280cf39 100644 --- a/HealthBars.cs +++ b/HealthBars.cs @@ -46,7 +46,7 @@ public class HealthBars : BaseSettingsPlugin "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemonGoatRhoa2Vanish", "Metadata/Monsters/InvisibleFire/InvisibleFireAfflictionCorpseDegen", "Metadata/Monsters/InvisibleFire/InvisibleFireAfflictionDemonColdDegenUnique", - "Metadata/Monsters/VolatileCore/VolatileDeadCore", + "Metadata/Monsters/VolatileCore/VolatileDeadCore" }; private IngameUIElements ingameUI; From 3b277ee20c45f9d1efd1c97da7aaff45fb2b3f23 Mon Sep 17 00:00:00 2001 From: Arecurius Date: Wed, 28 Oct 2020 21:18:34 +0100 Subject: [PATCH 19/38] Component Null Reference fix #1 --- HealthBar.cs | 5 +++-- HealthBars.cs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/HealthBar.cs b/HealthBar.cs index a23b0b5..d46122b 100644 --- a/HealthBar.cs +++ b/HealthBar.cs @@ -86,7 +86,7 @@ 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 Life Life => Entity.HasComponent() ? Entity.GetComponent() : null; public Entity Entity { get; } public UnitSettings Settings { get; private set; } public CreatureType Type { get; private set; } @@ -118,7 +118,7 @@ public void Update(Entity entity, HealthBarsSettings settings) } else if (entity.HasComponent()) { - if (entity.IsHostile) + if (entity.IsHostile && entity.HasComponent()) { switch (entity.GetComponent().Rarity) { @@ -201,6 +201,7 @@ public void DpsDequeue() private int GetFullHp() { + if (Life == null) return 0; return Life.CurHP + Life.CurES; } } diff --git a/HealthBars.cs b/HealthBars.cs index 280cf39..671fc43 100644 --- a/HealthBars.cs +++ b/HealthBars.cs @@ -410,7 +410,7 @@ 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.GetComponent() != null && !Entity.IsAlive) return; + if (Entity.HasComponent() && Entity.GetComponent() != null && !Entity.IsAlive) return; if (IgnoredSum.Any(x => Entity.Path.StartsWith(x))) return; Entity.SetHudComponent(new HealthBar(Entity, Settings)); } From 3330fde11e5afc141526c2aec6d44f6d1a61c001 Mon Sep 17 00:00:00 2001 From: IlliumIv Date: Sun, 1 Nov 2020 04:47:46 +0500 Subject: [PATCH 20/38] Fixed reference --- HealthBars.csproj | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/HealthBars.csproj b/HealthBars.csproj index 6aab9e3..e217294 100644 --- a/HealthBars.csproj +++ b/HealthBars.csproj @@ -51,6 +51,10 @@ MinimumRecommendedRules.ruleset + + ..\..\..\..\PoeHelper\ExileCore.dll + False + ..\..\..\packages\SharpDX.4.2.0\lib\net45\SharpDX.dll False @@ -75,13 +79,6 @@ - - - {5539d732-34a7-44ab-9e28-116c3429b12a} - Core - False - - From fac4d535301159d06e02bad11fe11fcd04cd162d Mon Sep 17 00:00:00 2001 From: IlliumIv Date: Sun, 17 Jan 2021 17:29:31 +0500 Subject: [PATCH 21/38] Fix bars uncontrol increasing --- HealthBar.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/HealthBar.cs b/HealthBar.cs index cba8518..7362b55 100644 --- a/HealthBar.cs +++ b/HealthBar.cs @@ -79,8 +79,7 @@ public bool IsHostile return entityIsHostile; } } - - public float HpPercent => Life.HPPercentage; + public float HpPercent => Life != null ? Life.HPPercentage : 0; public float Distance => _distance.Value; public Life Life => Entity.HasComponent() ? Entity.GetComponent() : null; public Entity Entity { get; } @@ -128,9 +127,10 @@ public void Update(Entity entity, HealthBarsSettings settings) } else if (entity.HasComponent()) { - if (entity.IsHostile && entity.HasComponent()) + var objectMagicProperties = entity.GetComponent(); + if (entity.IsHostile && objectMagicProperties != null) { - switch (entity.GetComponent().Rarity) + switch (objectMagicProperties.Rarity) { case MonsterRarity.White: Type = CreatureType.Normal; From e783a1670968e2bda176147d8606d77e603194ee Mon Sep 17 00:00:00 2001 From: IlliumIv Date: Thu, 21 Jan 2021 01:43:35 +0500 Subject: [PATCH 22/38] Little rework HP\ES text logic Now if both texts enabled ES will be displayed only while it more than 0. --- HealthBars.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/HealthBars.cs b/HealthBars.cs index a8067c8..47d6e2d 100644 --- a/HealthBars.cs +++ b/HealthBars.cs @@ -387,17 +387,17 @@ private void ShowNumbersInHealthbar(HealthBar bar) if (!bar.Settings.ShowHealthText && !bar.Settings.ShowEnergyShieldText) return; string healthBarText = ""; - if (bar.Settings.ShowHealthText) - { - healthBarText = $"{bar.Life.CurHP:N0}"; - if (bar.Settings.ShowMaxHealthText) - healthBarText += $"/{bar.Life.MaxHP:N0}"; - } - else if (bar.Settings.ShowEnergyShieldText) + if (bar.Settings.ShowEnergyShieldText && bar.Life.CurES > 0) { healthBarText = $"{bar.Life.CurES:N0}"; if (bar.Settings.ShowMaxEnergyShieldText) healthBarText += $"/{bar.Life.MaxES:N0}"; + } + else if (bar.Settings.ShowHealthText) + { + healthBarText = $"{bar.Life.CurHP:N0}"; + if (bar.Settings.ShowMaxHealthText) + healthBarText += $"/{bar.Life.MaxHP:N0}"; } Graphics.DrawText(healthBarText, From f74168c0e66dcc23c61e2bfe524cfb5d8dfe0dd6 Mon Sep 17 00:00:00 2001 From: IlliumIv Date: Tue, 26 Jan 2021 01:26:16 +0500 Subject: [PATCH 23/38] Expand list of ignore --- HealthBars.cs | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/HealthBars.cs b/HealthBars.cs index 47d6e2d..b9323f0 100644 --- a/HealthBars.cs +++ b/HealthBars.cs @@ -77,6 +77,9 @@ public class HealthBars : BaseSettingsPlugin "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", @@ -84,14 +87,6 @@ public class HealthBars : BaseSettingsPlugin "Metadata/Monsters/InvisibleAura/InvisibleWrathStationary", - "Metadata/Monsters/LeagueSynthesis/SynthesisDroneBossTurret1", - "Metadata/Monsters/LeagueSynthesis/SynthesisDroneBossTurret2", - "Metadata/Monsters/LeagueSynthesis/SynthesisDroneBossTurret3", - "Metadata/Monsters/LeagueSynthesis/SynthesisDroneBossTurret4", - - "Metadata/Monsters/LeagueBestiary/RootSpiderBestiaryAmbush", - "Metadata/Monsters/LeagueBestiary/BlackScorpionBestiaryBurrowTornado", - // "Metadata/Monsters/Labyrinth/GoddessOfJustice", // "Metadata/Monsters/Labyrinth/GoddessOfJusticeMapBoss", "Metadata/Monsters/Frog/FrogGod/SilverOrb", @@ -102,6 +97,34 @@ public class HealthBars : BaseSettingsPlugin "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", }; private IngameUIElements ingameUI; From 3076c78b40824e68c4aa8a48e47d79433673f35a Mon Sep 17 00:00:00 2001 From: Queuete <-> Date: Tue, 26 Jan 2021 12:33:40 +0100 Subject: [PATCH 24/38] Move all ignores to ignore file, update it --- HealthBars.cs | 86 +++++------------------------- HealthBars.csproj | 6 +++ config/ignored_entities.txt | 102 ++++++++++++++++++++++++++++++++++++ 3 files changed, 120 insertions(+), 74 deletions(-) create mode 100644 config/ignored_entities.txt diff --git a/HealthBars.cs b/HealthBars.cs index 0057c1c..8d2d144 100644 --- a/HealthBars.cs +++ b/HealthBars.cs @@ -18,35 +18,8 @@ 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" - }; + private string IGNORE_FILE { get; } = Path.Combine("config", "ignored_entities.txt"); + private List IgnoredEntities { get; set; } private IngameUIElements ingameUI; private CachedValue ingameUICheckVisible; @@ -90,53 +63,18 @@ public override bool Initialise() 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) @@ -379,7 +317,7 @@ public override void EntityAdded(Entity Entity) || 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)); } } diff --git a/HealthBars.csproj b/HealthBars.csproj index 8069f47..f568e09 100644 --- a/HealthBars.csproj +++ b/HealthBars.csproj @@ -82,5 +82,11 @@ + + + + Always + + \ No newline at end of file diff --git a/config/ignored_entities.txt b/config/ignored_entities.txt new file mode 100644 index 0000000..ab7b2de --- /dev/null +++ b/config/ignored_entities.txt @@ -0,0 +1,102 @@ +# 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 From 7e541c62965a630edc2d201f57d2917105cdaf59 Mon Sep 17 00:00:00 2001 From: Queuete <-> Date: Tue, 26 Jan 2021 12:44:31 +0100 Subject: [PATCH 25/38] Change default settings for bar graphics --- HealthBarsSettings.cs | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/HealthBarsSettings.cs b/HealthBarsSettings.cs index cbbf6ef..153f0e1 100644 --- a/HealthBarsSettings.cs +++ b/HealthBarsSettings.cs @@ -14,10 +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); + 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); ShowDebuffPanel = new ToggleNode(false); DebuffPanelIconSize = new RangeNode(20, 15, 40); GlobalZ = new RangeNode(-100, -300, 300); @@ -56,7 +56,7 @@ 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")] @@ -91,17 +91,16 @@ public UnitSettings(uint color, uint outline) FloatingCombatDamageColor = SharpDX.Color.Yellow; FloatingCombatHealColor = SharpDX.Color.Lime; BackGround = SharpDX.Color.Black; - TextSize = new RangeNode(15, 10, 50); + TextSize = new RangeNode(10, 5, 25); 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; - ShowHealthPercents.Value = showText; - ShowEnergyShieldPercents.Value = showText; - ShowHealthText.Value = showText; - ShowEnergyShieldText.Value = showText; + ShowHealthText.Value = showHealthText; + Width = new RangeNode(width, 20, 250); + Height = new RangeNode(height, 5, 150); } public RangeNode Width { get; set; } From 1f3e787c9bdcb3cd1c4cefafd70d8f0bf54af6be Mon Sep 17 00:00:00 2001 From: IlliumIv Date: Tue, 9 Feb 2021 02:43:21 +0500 Subject: [PATCH 26/38] Fix rare increasing health bar error on start --- HealthBars.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/HealthBars.cs b/HealthBars.cs index b9323f0..dd1da30 100644 --- a/HealthBars.cs +++ b/HealthBars.cs @@ -296,7 +296,8 @@ private void TickLogic() { CanTick = true; - if (ingameUICheckVisible.Value + if (ingameUICheckVisible == null + || ingameUICheckVisible.Value || camera == null || GameController.Area.CurrentArea.IsTown && !Settings.ShowInTown) { From 3f738252a38146b71770dab7808c7bbf9d6cebb6 Mon Sep 17 00:00:00 2001 From: IlliumIv Date: Thu, 11 Feb 2021 01:49:44 +0500 Subject: [PATCH 27/38] Fix some null ref exeptions --- HealthBar.cs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/HealthBar.cs b/HealthBar.cs index 52cbe4f..c7d12e9 100644 --- a/HealthBar.cs +++ b/HealthBar.cs @@ -40,6 +40,8 @@ public class HealthBar public HealthBar(Entity entity, HealthBarsSettings settings) { + if (entity == null) return; + Entity = entity; _distance = new TimeCache(() => entity.DistancePlayer, 200); @@ -55,12 +57,22 @@ public HealthBar(Entity entity, HealthBarsSettings settings) //CanNotDie = entity.GetComponent().StatDictionary.ContainsKey(GameStat.CannotDie); CanNotDie = entity.Path.StartsWith("Metadata/Monsters/Totems/Labyrinth"); - if (entity.HasComponent() && entity.GetComponent().Mods.Contains("MonsterConvertsOnDeath_")) + if (entity.HasComponent()) { - OnHostileChange = () => + var magicProperties = entity.GetComponent(); + + if (magicProperties != null) { - if (_init) Update(Entity, settings); - }; + var mods = magicProperties.Mods; + + if (mods != null && mods.Contains("MonsterConvertsOnDeath_")) + { + OnHostileChange = () => + { + if (_init) Update(Entity, settings); + }; + } + } } } From 02a1fd606980e7ca3b86da917255fa8ba67add95 Mon Sep 17 00:00:00 2001 From: IlliumIv Date: Sun, 14 Feb 2021 23:36:05 +0500 Subject: [PATCH 28/38] Expand list of ignores --- HealthBars.cs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/HealthBars.cs b/HealthBars.cs index dd1da30..fbcdbe6 100644 --- a/HealthBars.cs +++ b/HealthBars.cs @@ -62,6 +62,10 @@ public class HealthBars : BaseSettingsPlugin "Metadata/Monsters/LeagueBetrayal/FortTurret/FortTurret1Safehouse", "Metadata/Monsters/LeagueBetrayal/FortTurret/FortTurret1", "Metadata/Monsters/LeagueBetrayal/MasterNinjaCop", + "Metadata/Monsters/LeagueBetrayal/BetrayalRikerMortarDaemon", + "Metadata/Monsters/LeagueBetrayal/BetrayalBoneNovaDaemon", + "Metadata/Monsters/LeagueBetrayal/BetrayalCatarinaPillarDaemon_", + "Metadata/Monsters/LeagueBetrayal/BetrayalUpgrades/BetrayalDaemonCorpseConsume", // Legion Ignores "Metadata/Monsters/LegionLeague/LegionVaalGeneralProjectileDaemon", @@ -80,6 +84,7 @@ public class HealthBars : BaseSettingsPlugin "Metadata/Monsters/InvisibleFire/InvisibleFireDoedreSewers", "Metadata/Monsters/InvisibleFire/InvisibleFireDelveFlameTornadoSpiked", "Metadata/Monsters/InvisibleFire/InvisibleHolyCannon", + "Metadata/Monsters/InvisibleFire/DelveVaalBossInvisibleLight", "Metadata/Monsters/InvisibleCurse/InvisibleFrostbiteStationary", "Metadata/Monsters/InvisibleCurse/InvisibleConductivityStationary", @@ -98,6 +103,12 @@ public class HealthBars : BaseSettingsPlugin "Metadata/Monsters/Daemon/SilverPoolChillDaemon", "Metadata/Monsters/AvariusCasticus/AvariusCasticusStatue", "Metadata/Monsters/Maligaro/MaligaroDesecrate", + + "Metadata/Monsters/Avatar/AvatarMagmaOrbDaemon", + "Metadata/Monsters/Monkeys/FlameBearerTalismanT2Ghost", + "Metadata/Monsters/Totems/TalismanTotem/TalismanTotemDeathscape", + "Metadata/Monsters/BeehiveBehemoth/BeehiveBehemothSwampDaemon", + "Metadata/Monsters/VaalWraith/VaalWraithChampionMinion", // Synthesis "Metadata/Monsters/LeagueSynthesis/SynthesisDroneBossTurret1", @@ -125,6 +136,23 @@ public class HealthBars : BaseSettingsPlugin "Metadata/Monsters/LeagueBestiary/ModDaemonSandLeaperExplode1", "Metadata/Monsters/LeagueBestiary/ModDaemonStampede1", "Metadata/Monsters/LeagueBestiary/ModDaemonGraspingPincers1", + "Metadata/Monsters/LeagueBestiary/ModDaemonPouncingShade1", + "Metadata/Monsters/LeagueBestiary/ModDaemonPouncingShadeQuickHit", + "Metadata/Monsters/LeagueBestiary/ModDaemonFire1", + "Metadata/Monsters/LeagueBestiary/ModDaemonVultureBomb1", + "Metadata/Monsters/LeagueBestiary/ModDaemonVultureBombCast1", + "Metadata/Monsters/LeagueBestiary/ModDaemonParasiticSquid1", + "Metadata/Monsters/LeagueBestiary/ModDaemonBloodRaven1", + "Metadata/Monsters/LeagueBestiary/SandLeaperBestiaryClone", + "Metadata/Monsters/LeagueBestiary/SpiderPlagueBestiaryExplode", + "Metadata/Monsters/LeagueBestiary/ParasiticSquidBestiaryClone", + "Metadata/Monsters/LeagueBestiary/HellionBestiaryClone", + "Metadata/Monsters/LeagueBestiary/BestiarySpiderCocoon", + + // Ritual + "Metadata/Monsters/LeagueRitual/GoldenCoinDaemon", + "Metadata/Monsters/LeagueRitual/GenericLifeDaemon", + "Metadata/Monsters/LeagueRitual/GenericChargesDaemon", }; private IngameUIElements ingameUI; From c8f7fb2b7d6392677e7509d2b42aec02b5bc0f79 Mon Sep 17 00:00:00 2001 From: snowhawk04 <6187693+snowhawk04@users.noreply.github.com> Date: Fri, 21 May 2021 21:19:10 -0700 Subject: [PATCH 29/38] Update HealthBars.cs --- HealthBars.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/HealthBars.cs b/HealthBars.cs index 8d2d144..718797a 100644 --- a/HealthBars.cs +++ b/HealthBars.cs @@ -53,11 +53,13 @@ public override bool Initialise() windowRectangle = GameController.Window.GetWindowRectangleReal(); windowSize = new Size2F(windowRectangle.Width / 2560, windowRectangle.Height / 1600); camera = GameController.Game.IngameState.Camera; + var ultimatumIsVisibleLocal = typeof(IngameUIElements).GetProperty("UltimatumProgressWindow") != null + && ingameUI.UltimatumProgressWindow.IsVisibleLocal; return ingameUI.BetrayalWindow.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 || ultimatumIsVisibleLocal; }, 250); ReadIgnoreFile(); From c04999fd850cd099a4de2ac6d4950b05c24120b6 Mon Sep 17 00:00:00 2001 From: snowhawk04 <6187693+snowhawk04@users.noreply.github.com> Date: Mon, 24 May 2021 12:53:09 -0700 Subject: [PATCH 30/38] Update HealthBars.cs No longer need to check if attribute exists. --- HealthBars.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/HealthBars.cs b/HealthBars.cs index 718797a..c518c1d 100644 --- a/HealthBars.cs +++ b/HealthBars.cs @@ -53,13 +53,11 @@ public override bool Initialise() windowRectangle = GameController.Window.GetWindowRectangleReal(); windowSize = new Size2F(windowRectangle.Width / 2560, windowRectangle.Height / 1600); camera = GameController.Game.IngameState.Camera; - var ultimatumIsVisibleLocal = typeof(IngameUIElements).GetProperty("UltimatumProgressWindow") != null - && ingameUI.UltimatumProgressWindow.IsVisibleLocal; - + return ingameUI.BetrayalWindow.IsVisibleLocal || ingameUI.SellWindow.IsVisibleLocal || ingameUI.DelveWindow.IsVisibleLocal || ingameUI.IncursionWindow.IsVisibleLocal || ingameUI.UnveilWindow.IsVisibleLocal || ingameUI.TreePanel.IsVisibleLocal || ingameUI.Atlas.IsVisibleLocal || - ingameUI.CraftBench.IsVisibleLocal || ultimatumIsVisibleLocal; + ingameUI.CraftBench.IsVisibleLocal || ingameUI.UltimatumProgressWindow.IsVisibleLocal; }, 250); ReadIgnoreFile(); From a02fac3c33fb9ff496ed9c3b1d4dee21a52198e2 Mon Sep 17 00:00:00 2001 From: Queuete <62324681+Queuete@users.noreply.github.com> Date: Sat, 31 Jul 2021 13:22:22 +0200 Subject: [PATCH 31/38] Clean up HealthBar, Add DebuffPanel --- DebuffPanel.cs | 25 +++++++ HealthBar.cs | 133 ++++-------------------------------- HealthBars.csproj | 1 + config/ignored_entities.txt | 6 +- 4 files changed, 43 insertions(+), 122 deletions(-) create mode 100644 DebuffPanel.cs diff --git a/DebuffPanel.cs b/DebuffPanel.cs new file mode 100644 index 0000000..8649752 --- /dev/null +++ b/DebuffPanel.cs @@ -0,0 +1,25 @@ +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(); + } +} diff --git a/HealthBar.cs b/HealthBar.cs index 87590dd..9a1876e 100644 --- a/HealthBar.cs +++ b/HealthBar.cs @@ -9,84 +9,28 @@ 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"}; - 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; - private bool isHostile; - private readonly Action OnHostileChange; - public bool Skip = false; - public HealthBar(Entity entity, HealthBarsSettings settings) { Entity = entity; - _distance = new TimeCache(() => entity.DistancePlayer, 200); - - // 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_")) - { - OnHostileChange = () => - { - if (_init) Update(Entity, settings); - }; - } - } - - public bool IsHostile - { - get - { - var entityIsHostile = Entity.IsHostile; - - if (isHostile != entityIsHostile) - { - isHostile = entityIsHostile; - OnHostileChange?.Invoke(); - } - - return entityIsHostile; - } } - - public float HpPercent => Life?.HPPercentage ?? 100; - public float Distance => _distance.Value; - public Life Life => Entity.GetComponent(); - public Entity Entity { get; } + 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 LinkedList DpsQueue { get; } = new LinkedList(); + public Life Life => Entity.GetComponent(); + public float HpPercent => Life?.HPPercentage ?? 100; + public float HpWidth { get; set; } + public float EsWidth { get; set; } public Color Color { @@ -114,11 +58,6 @@ private bool IsHidden(Entity entity) } } - - - public float HpWidth { get; set; } - public float EsWidth { get; set; } - public void Update(Entity entity, HealthBarsSettings settings) { if (entity.HasComponent()) @@ -163,54 +102,6 @@ public void Update(Entity entity, HealthBarsSettings settings) Settings = settings.Minions; } } - - _lastHp = GetFullHp(); - _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 chechTime = DpsQueue.Count > 0 ? DPS_CHECK_TIME : DPS_FAST_CHECK_TIME; - - if (dpsStopwatch.ElapsedMilliseconds >= chechTime) - { - 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.csproj b/HealthBars.csproj index f568e09..0b5d85f 100644 --- a/HealthBars.csproj +++ b/HealthBars.csproj @@ -74,6 +74,7 @@ + diff --git a/config/ignored_entities.txt b/config/ignored_entities.txt index ab7b2de..d60acab 100644 --- a/config/ignored_entities.txt +++ b/config/ignored_entities.txt @@ -99,4 +99,8 @@ 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 +Metadata/Monsters/LeagueBestiary/ModDaemonGraspingPincers1 + +# Traps +Metadata/Monsters/traps/MonsterFireTrap2 +Metadata/Monsters/traps/MonsterBlastRainTrap \ No newline at end of file From f7f7caf8d9d84631f8b73067c5139b75fb74d368 Mon Sep 17 00:00:00 2001 From: Queuete <62324681+Queuete@users.noreply.github.com> Date: Sat, 31 Jul 2021 13:27:34 +0200 Subject: [PATCH 32/38] Remove unused settings --- HealthBarsSettings.cs | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/HealthBarsSettings.cs b/HealthBarsSettings.cs index 153f0e1..e9fb3cd 100644 --- a/HealthBarsSettings.cs +++ b/HealthBarsSettings.cs @@ -86,13 +86,7 @@ public UnitSettings(uint color, uint outline) ShowEnergyShieldPercents = new ToggleNode(false); ShowHealthText = new ToggleNode(false); ShowEnergyShieldText = new ToggleNode(false); - ShowFloatingCombatDamage = new ToggleNode(false); - FloatingCombatTextSize = new RangeNode(15, 10, 30); - FloatingCombatDamageColor = SharpDX.Color.Yellow; - FloatingCombatHealColor = SharpDX.Color.Lime; BackGround = SharpDX.Color.Black; - TextSize = new RangeNode(10, 5, 25); - FloatingCombatStackSize = new RangeNode(1, 1, 10); } public UnitSettings(uint color, uint outline, uint percentTextColor, bool showHealthText, int width, int height) : this(color, outline) @@ -116,18 +110,6 @@ public UnitSettings(uint color, uint outline, uint percentTextColor, bool showHe public ToggleNode ShowEnergyShieldPercents { get; set; } public ToggleNode ShowHealthText { get; set; } public ToggleNode ShowEnergyShieldText { 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; } } } From 2aad2040b1cc3e6eb3aeac030eb9ff7cd8be80e8 Mon Sep 17 00:00:00 2001 From: Queuete <62324681+Queuete@users.noreply.github.com> Date: Sat, 31 Jul 2021 13:35:55 +0200 Subject: [PATCH 33/38] Display Debuff panel simple, depending on enemy type --- HealthBars.cs | 14 ++++++++++++++ HealthBarsSettings.cs | 7 +++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/HealthBars.cs b/HealthBars.cs index 8d2d144..0bec75d 100644 --- a/HealthBars.cs +++ b/HealthBars.cs @@ -264,6 +264,7 @@ public void DrawBar(HealthBar bar) ShowPercents(bar); ShowNumbersInHealthbar(bar); + ShowDebuffPanel(bar); } private void ShowNumbersInHealthbar(HealthBar bar) @@ -305,6 +306,19 @@ private void ShowPercents(HealthBar bar) bar.Settings.PercentTextColor); } + private void ShowDebuffPanel(HealthBar bar) + { + if (!bar.Settings.ShowDebuffPanel) return; + + Graphics.DrawText(bar.DebuffPanel.Bleed.Count.ToString(), + new Vector2(bar.BackGround.Left, bar.BackGround.Top - Graphics.Font.Size), + Color.Red); + + Graphics.DrawText(bar.DebuffPanel.CorruptedBlood.Count.ToString(), + new Vector2(bar.BackGround.Left + 10, bar.BackGround.Top - Graphics.Font.Size), + Color.Red); + } + private string FloatToPercentString (float number) { return $"{Math.Floor(number * 100).ToString(CultureInfo.InvariantCulture)}"; diff --git a/HealthBarsSettings.cs b/HealthBarsSettings.cs index e9fb3cd..36cd578 100644 --- a/HealthBarsSettings.cs +++ b/HealthBarsSettings.cs @@ -18,7 +18,6 @@ public HealthBarsSettings() 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); - ShowDebuffPanel = new ToggleNode(false); 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")] @@ -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; @@ -97,6 +95,8 @@ public UnitSettings(uint color, uint outline, uint percentTextColor, bool showHe 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; } @@ -110,6 +110,5 @@ public UnitSettings(uint color, uint outline, uint percentTextColor, bool showHe public ToggleNode ShowEnergyShieldPercents { get; set; } public ToggleNode ShowHealthText { get; set; } public ToggleNode ShowEnergyShieldText { get; set; } - public ToggleNode Enable { get; set; } } } From fcf9cf62a2cb5419a2c94a0b09692b21b75691fb Mon Sep 17 00:00:00 2001 From: Queuete <62324681+Queuete@users.noreply.github.com> Date: Sat, 31 Jul 2021 13:54:02 +0200 Subject: [PATCH 34/38] Update ignored entities --- config/ignored_entities.txt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/config/ignored_entities.txt b/config/ignored_entities.txt index d60acab..2a08e68 100644 --- a/config/ignored_entities.txt +++ b/config/ignored_entities.txt @@ -1,3 +1,8 @@ +# 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 @@ -99,8 +104,4 @@ Metadata/Monsters/LeagueBestiary/BlackScorpionBestiaryBurrowTornado Metadata/Monsters/LeagueBestiary/ModDaemonCorpseEruption Metadata/Monsters/LeagueBestiary/ModDaemonSandLeaperExplode1 Metadata/Monsters/LeagueBestiary/ModDaemonStampede1 -Metadata/Monsters/LeagueBestiary/ModDaemonGraspingPincers1 - -# Traps -Metadata/Monsters/traps/MonsterFireTrap2 -Metadata/Monsters/traps/MonsterBlastRainTrap \ No newline at end of file +Metadata/Monsters/LeagueBestiary/ModDaemonGraspingPincers1 \ No newline at end of file From 47b6435d699da7046e560db2218de4df05cc7237 Mon Sep 17 00:00:00 2001 From: Queuete <62324681+Queuete@users.noreply.github.com> Date: Mon, 2 Aug 2021 13:38:59 +0200 Subject: [PATCH 35/38] Add more experimental debuffs --- DebuffPanel.cs | 2 ++ HealthBars.cs | 20 +++++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/DebuffPanel.cs b/DebuffPanel.cs index 8649752..18f7365 100644 --- a/DebuffPanel.cs +++ b/DebuffPanel.cs @@ -21,5 +21,7 @@ public DebuffPanel(Entity entity) 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/HealthBars.cs b/HealthBars.cs index 0bec75d..1c8f362 100644 --- a/HealthBars.cs +++ b/HealthBars.cs @@ -312,11 +312,25 @@ private void ShowDebuffPanel(HealthBar bar) Graphics.DrawText(bar.DebuffPanel.Bleed.Count.ToString(), new Vector2(bar.BackGround.Left, bar.BackGround.Top - Graphics.Font.Size), - Color.Red); + bar.DebuffPanel.Bleed.Count == 8 ? Color.Green : Color.Red); Graphics.DrawText(bar.DebuffPanel.CorruptedBlood.Count.ToString(), - new Vector2(bar.BackGround.Left + 10, bar.BackGround.Top - Graphics.Font.Size), - Color.Red); + 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) + { + 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); + } + + if (bar.DebuffPanel.AuraPride != null) + { + Graphics.DrawText("P", + new Vector2(bar.BackGround.Left + 60, bar.BackGround.Top - Graphics.Font.Size), + Color.Green); + } } private string FloatToPercentString (float number) From f272e4117136ac20f377e1c890ba21e22c6d815c Mon Sep 17 00:00:00 2001 From: Snowhawk04 <6187693+snowhawk04@users.noreply.github.com> Date: Wed, 3 Nov 2021 00:06:40 -0700 Subject: [PATCH 36/38] Project cleanup. --- HealthBar.cs | 3 --- HealthBars.csproj | 26 ++++++++++++++------------ packages.config | 5 ++--- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/HealthBar.cs b/HealthBar.cs index 9a1876e..548c8ec 100644 --- a/HealthBar.cs +++ b/HealthBar.cs @@ -1,6 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; using ExileCore.PoEMemory.Components; using ExileCore.PoEMemory.MemoryObjects; using ExileCore.Shared.Cache; diff --git a/HealthBars.csproj b/HealthBars.csproj index 0b5d85f..248a5f1 100644 --- a/HealthBars.csproj +++ b/HealthBars.csproj @@ -17,7 +17,7 @@ true full false - ..\..\..\PoeHelper\Plugins\Compiled\HealthBars\ + ..\..\Compiled\HealthBars\ DEBUG;TRACE prompt 4 @@ -26,7 +26,7 @@ pdbonly true - ..\..\..\PoeHelper\Plugins\Compiled\HealthBars\ + ..\..\Compiled\HealthBars\ TRACE prompt 4 @@ -34,7 +34,7 @@ true - ..\..\..\PoeHelper\Plugins\Compiled\HealthBars\ + ..\..\Compiled\HealthBars\ DEBUG;TRACE full x64 @@ -42,7 +42,7 @@ MinimumRecommendedRules.ruleset - bin\x64\Release\ + ..\..\Compiled\HealthBars\ TRACE true pdbonly @@ -51,16 +51,12 @@ MinimumRecommendedRules.ruleset - - ..\..\..\PoeHelper\ExileCore.dll - False - - ..\..\..\PoeHelper\SharpDX.dll + ..\..\..\SharpDX.dll False - ..\..\..\PoeHelper\SharpDX.Mathematics.dll + ..\..\..\SharpDX.Mathematics.dll False @@ -80,13 +76,19 @@ + + + {5539d732-34a7-44ab-9e28-116c3429b12a} + Core + false + + - - Always + PreserveNewest 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 From 3f00490ab6e38a0441d830e1088d9634b0da9925 Mon Sep 17 00:00:00 2001 From: Snowhawk04 <6187693+snowhawk04@users.noreply.github.com> Date: Sun, 14 Nov 2021 19:34:39 -0800 Subject: [PATCH 37/38] Use Standard Output Paths --- HealthBars.csproj | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/HealthBars.csproj b/HealthBars.csproj index 248a5f1..9503a06 100644 --- a/HealthBars.csproj +++ b/HealthBars.csproj @@ -17,7 +17,7 @@ true full false - ..\..\Compiled\HealthBars\ + ..\..\..\..\PoeHelper\Plugins\Compiled\HealthBars\ DEBUG;TRACE prompt 4 @@ -26,7 +26,7 @@ pdbonly true - ..\..\Compiled\HealthBars\ + ..\..\..\..\PoeHelper\Plugins\Compiled\HealthBars\ TRACE prompt 4 @@ -34,7 +34,7 @@ true - ..\..\Compiled\HealthBars\ + ..\..\..\..\PoeHelper\Plugins\Compiled\HealthBars\ DEBUG;TRACE full x64 @@ -42,7 +42,7 @@ MinimumRecommendedRules.ruleset - ..\..\Compiled\HealthBars\ + ..\..\..\..\PoeHelper\Plugins\Compiled\HealthBars\ TRACE true pdbonly @@ -52,11 +52,11 @@ - ..\..\..\SharpDX.dll + ..\..\..\..\PoeHelper\SharpDX.dll False - ..\..\..\SharpDX.Mathematics.dll + ..\..\..\..\PoeHelper\SharpDX.Mathematics.dll False @@ -80,7 +80,7 @@ {5539d732-34a7-44ab-9e28-116c3429b12a} Core - false + False From 3073a233f0bfff8b63a730337252294203204ddc Mon Sep 17 00:00:00 2001 From: Arecurius Date: Wed, 2 Mar 2022 16:37:35 +0100 Subject: [PATCH 38/38] Added hidden legion monsters show/hide setting adjusted to own fork of ExileApi --- HealthBar.cs | 103 ++++++++++++++++++++++++++++++------------ HealthBars.cs | 10 ++-- HealthBars.csproj | 8 ++-- HealthBarsSettings.cs | 2 +- 4 files changed, 85 insertions(+), 38 deletions(-) diff --git a/HealthBar.cs b/HealthBar.cs index 548c8ec..9f677ab 100644 --- a/HealthBar.cs +++ b/HealthBar.cs @@ -3,19 +3,12 @@ using ExileCore.Shared.Cache; using ExileCore.Shared.Enums; using SharpDX; +using System; namespace HealthBars { public class HealthBar { - public HealthBar(Entity entity, HealthBarsSettings settings) - { - Entity = entity; - _DistanceCache = new TimeCache(() => entity.DistancePlayer, 200); - DebuffPanel = new DebuffPanel(entity); - - Update(entity, settings); - } public bool Skip { get; set; } = false; public UnitSettings Settings { get; private set; } public RectangleF BackGround { get; set; } @@ -28,6 +21,42 @@ public HealthBar(Entity entity, HealthBarsSettings settings) public float HpPercent => Life?.HPPercentage ?? 100; public float HpWidth { get; set; } public float EsWidth { get; set; } + private readonly Action OnHostileChange = delegate { }; + private bool isHostile; + public bool CanNotDie; + private bool _init; + public HealthBar(Entity entity, HealthBarsSettings settings) + { + Entity = entity; + _DistanceCache = new TimeCache(() => entity.DistancePlayer, 200); + DebuffPanel = new DebuffPanel(entity); + Update(entity, settings); + CanNotDie = entity.Path.StartsWith("Metadata/Monsters/Totems/Labyrinth"); + + var mods = entity?.GetComponent()?.Mods; + if (mods != null && mods.Contains("MonsterConvertsOnDeath_")) + { + OnHostileChange = () => + { + if (_init) Update(Entity, settings); + }; + } + } + public bool IsHostile + { + get + { + var entityIsHostile = Entity.IsHostile; + + if (isHostile != entityIsHostile) + { + isHostile = entityIsHostile; + OnHostileChange?.Invoke(); + } + + return entityIsHostile; + } + } public Color Color { @@ -54,6 +83,13 @@ private bool IsHidden(Entity entity) 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) { @@ -66,31 +102,40 @@ public void Update(Entity entity, HealthBarsSettings settings) { if (entity.IsHostile) { - switch (entity.GetComponent().Rarity) + var rarity = entity.GetComponent(); + if(rarity == null) + { + Type = CreatureType.Minion; + Settings = settings.Minions; + } + else { - case MonsterRarity.White: - Type = CreatureType.Normal; - Settings = settings.NormalEnemy; - break; + switch (rarity.Rarity) + { + case MonsterRarity.White: + Type = CreatureType.Normal; + Settings = settings.NormalEnemy; + break; - case MonsterRarity.Magic: - Type = CreatureType.Magic; - Settings = settings.MagicEnemy; - break; + case MonsterRarity.Magic: + Type = CreatureType.Magic; + Settings = settings.MagicEnemy; + break; - case MonsterRarity.Rare: - Settings = settings.RareEnemy; - Type = CreatureType.Rare; - break; + case MonsterRarity.Rare: + Settings = settings.RareEnemy; + Type = CreatureType.Rare; + break; - case MonsterRarity.Unique: - Settings = settings.UniqueEnemy; - Type = CreatureType.Unique; - break; - default: - Settings = settings.Minions; - Type = CreatureType.Minion; - break; + case MonsterRarity.Unique: + Settings = settings.UniqueEnemy; + Type = CreatureType.Unique; + break; + default: + Settings = settings.Minions; + Type = CreatureType.Minion; + break; + } } } else diff --git a/HealthBars.cs b/HealthBars.cs index 5ad20de..5075c0c 100644 --- a/HealthBars.cs +++ b/HealthBars.cs @@ -54,10 +54,10 @@ public override bool Initialise() 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.Atlas.IsVisibleLocal || - ingameUI.CraftBench.IsVisibleLocal || ingameUI.UltimatumProgressWindow.IsVisibleLocal; + ingameUI.CraftBench.IsVisibleLocal || ingameUI.UltimatumPanel.IsVisibleLocal; }, 250); ReadIgnoreFile(); @@ -91,9 +91,10 @@ private bool SkipHealthBar(HealthBar healthBar) 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 + if (healthBar.Entity.League == LeagueType.Legion && healthBar.Entity.IsHidden && healthBar.Entity.Rarity != MonsterRarity.Unique - && healthBar.Entity.Rarity != MonsterRarity.Rare) return true;*/ + && healthBar.Entity.Rarity != MonsterRarity.Rare + && Settings.HideHiddenLegionMonsters) return true; return false; } @@ -340,6 +341,7 @@ private string FloatToPercentString (float number) public override void EntityAdded(Entity Entity) { + if (Entity == null) return; if (Entity.Type != EntityType.Monster && Entity.Type != EntityType.Player || Entity.Address == GameController.Player.Address || Entity.Type == EntityType.Daemon) return; diff --git a/HealthBars.csproj b/HealthBars.csproj index 9503a06..d4faa10 100644 --- a/HealthBars.csproj +++ b/HealthBars.csproj @@ -26,7 +26,7 @@ pdbonly true - ..\..\..\..\PoeHelper\Plugins\Compiled\HealthBars\ + ..\..\PoeHelper\PrivateHud\Plugins\Compiled\HealthBars\ TRACE prompt 4 @@ -52,11 +52,11 @@ - ..\..\..\..\PoeHelper\SharpDX.dll + ..\..\PoeHelper\PrivateHud\SharpDX.dll False - ..\..\..\..\PoeHelper\SharpDX.Mathematics.dll + ..\..\PoeHelper\PrivateHud\SharpDX.Mathematics.dll False @@ -77,7 +77,7 @@ - + {5539d732-34a7-44ab-9e28-116c3429b12a} Core False diff --git a/HealthBarsSettings.cs b/HealthBarsSettings.cs index 36cd578..037d819 100644 --- a/HealthBarsSettings.cs +++ b/HealthBarsSettings.cs @@ -56,12 +56,12 @@ public HealthBarsSettings() 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; } }