Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix: changed heal ratio display.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Jun 26, 2023
1 parent 7a39853 commit c7764be
Show file tree
Hide file tree
Showing 8 changed files with 226 additions and 83 deletions.
3 changes: 1 addition & 2 deletions RotationSolver.Basic/Actions/HealPotionItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ public override bool CanUse(out IAction item)
item = null;
if (!Player.Available) return false;
var job = (Job)Player.Object.ClassJob.Id;
if (Player.Object.GetHealthRatio() > job.GetHealSingleAbility() -
job.GetHealingOfTimeSubtractSingle()) return false;
if (Player.Object.GetHealthRatio() > job.GetHealthSingleAbilityHot()) return false;
if (Player.Object.MaxHp - Player.Object.CurrentHp < MaxHealHp) return false;
return base.CanUse(out item);
}
Expand Down
14 changes: 12 additions & 2 deletions RotationSolver.Basic/Configuration/PluginConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,25 @@ public class PluginConfiguration : IPluginConfiguration
public float HealWhenNothingTodoBelow = 0.8f;
public float TargetIconSize = 0.6f;

public Dictionary<Job, float> HealingOfTimeSubtractSingles { get; set; } = new Dictionary<Job, float>();

public Dictionary<Job, float> HealingOfTimeSubtractAreas { get; set; } = new Dictionary<Job, float>();
public Dictionary<Job, float> HealthAreaAbilitiesHot { get; set; } = new Dictionary<Job, float>();
public float HealthAreaAbilityHot = 0.55f;

public Dictionary<Job, float> HealthAreaSpellsHot { get; set; } = new Dictionary<Job, float>();
public float HealthAreaSpellHot = 0.55f;

public Dictionary<Job, float> HealthAreaAbilities { get; set; } = new Dictionary<Job, float>();
public float HealthAreaAbility = 0.75f;

public Dictionary<Job, float> HealthAreaSpells { get; set; } = new Dictionary<Job, float>();
public float HealthAreaSpell = 0.65f;

public Dictionary<Job, float> HealthSingleAbilitiesHot { get; set; } = new Dictionary<Job, float>();
public float HealthSingleAbilityHot = 0.6f;

public Dictionary<Job, float> HealthSingleSpellsHot { get; set; } = new Dictionary<Job, float>();
public float HealthSingleSpellHot = 0.45f;

public Dictionary<Job, float> HealthSingleAbilities { get; set; } = new Dictionary<Job, float>();
public float HealthSingleAbility = 0.7f;

Expand Down
25 changes: 15 additions & 10 deletions RotationSolver.Basic/Helpers/ConfigurationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,33 @@ public static class ConfigurationHelper

public static readonly VirtualKey[] Keys = new VirtualKey[] { VirtualKey.CONTROL, VirtualKey.SHIFT, VirtualKey.MENU };

public static float GetHealAreaAbility(this Job job)
public static float GetHealthAreaAbility(this Job job)
=> Service.Config.HealthAreaAbilities.TryGetValue(job, out var value) ? value : Service.Config.HealthAreaAbility;

public static float GetHealAreaSpell(this Job job)
public static float GetHealthAreaSpell(this Job job)
=> Service.Config.HealthAreaSpells.TryGetValue(job, out var value) ? value : Service.Config.HealthAreaSpell;

public static float GetHealingOfTimeSubtractArea(this Job job)
=> Service.Config.HealingOfTimeSubtractAreas.TryGetValue(job, out var value) ? value : HealingOfTimeSubtractAreasDefault;
public static float GetHealthAreaAbilityHot(this Job job)
=> Service.Config.HealthAreaAbilitiesHot.TryGetValue(job, out var value) ? value : Service.Config.HealthAreaAbilityHot;

public static float GetHealSingleAbility(this Job job)
public static float GetHealthAreaSpellHot(this Job job)
=> Service.Config.HealthAreaSpellsHot.TryGetValue(job, out var value) ? value : Service.Config.HealthAreaSpellHot;

public static float GetHealthSingleAbility(this Job job)
=> Service.Config.HealthSingleAbilities.TryGetValue(job, out var value) ? value : Service.Config.HealthSingleAbility;

public static float GetHealSingleSpell(this Job job)
public static float GetHealthSingleSpell(this Job job)
=> Service.Config.HealthSingleSpells.TryGetValue(job, out var value) ? value : Service.Config.HealthSingleSpell;

public static float GetHealingOfTimeSubtractSingle(this Job job)
=> Service.Config.HealingOfTimeSubtractSingles.TryGetValue(job, out var value) ? value : HealingOfTimeSubtractSinglesDefault;
public static float GetHealthSingleAbilityHot(this Job job)
=> Service.Config.HealthSingleAbilitiesHot.TryGetValue(job, out var value) ? value : Service.Config.HealthSingleAbilityHot;

public static float GetHealthSingleSpellHot(this Job job)
=> Service.Config.HealthSingleSpellsHot.TryGetValue(job, out var value) ? value : Service.Config.HealthSingleSpellHot;


public static float GetHealthForDyingTank(this Job job)
=> Service.Config.HealthForDyingTanks.TryGetValue(job, out var value) ? value : HealthForDyingTanksDefault;

public const float HealingOfTimeSubtractAreasDefault = 0.2f;
public const float HealingOfTimeSubtractSinglesDefault = 0.2f;
public const float HealthForDyingTanksDefault = 0.15f;
}
17 changes: 9 additions & 8 deletions RotationSolver/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,15 @@
"ConfigWindow_Param_HealOutOfCombat": "Heal party members outside of combat.",
"ConfigWindow_Param_OnlyHotOnTanks": "Use single target healing over time actions only on tanks",
"ConfigWindow_Param_BeneficialAreaOnTarget": "Use Beneficial Area abilities on target.",
"ConfigWindow_Param_HealthDifference": "Set the HP standard deviation threshold for using AOE heal (ability & spell)",
"ConfigWindow_Param_HealthAreaAbility": "Set the HP threshold for using AOE healing ability",
"ConfigWindow_Param_HealthAreaSpell": "Set the HP threshold for using AOE healing spell",
"ConfigWindow_Param_HealingOfTimeSubtractArea": "Set the HP threshold reduce with hot effect(AOE)",
"ConfigWindow_Param_HealthSingleAbility": "Set the HP threshold for using single healing ability",
"ConfigWindow_Param_HealthSingleSpell": "Set the HP threshold for using single healing spell",
"ConfigWindow_Param_HealthHealerRatio": "Heal healer first if its HP threshold is lower than this.",
"ConfigWindow_Param_HealthTankRatio": "Heal tank first if its HP threshold is lower than this.",
"ConfigWindow_Param_HealthDifference": "HP ratio for standard deviation for using AOE heal.",
"ConfigWindow_Param_HealthAreaAbility": "HP ratio for AOE healing OGCDs",
"ConfigWindow_Param_HealthAreaSpell": "HP ratio for AOE healing GCDs",
"ConfigWindow_Param_Normal": "Normal",
"ConfigWindow_Param_Hot": "Hot",
"ConfigWindow_Param_HealthSingleAbility": "HP ratio for ST healing OGCDs",
"ConfigWindow_Param_HealthSingleSpell": "HP ratio for ST healing GCDs",
"ConfigWindow_Param_HealthHealerRatio": "Heal healer first if its HP ratio is lower than this.",
"ConfigWindow_Param_HealthTankRatio": "Heal tank first if its HP ratio is lower than this.",
"ConfigWindow_Param_DistanceForMoving": "If the distance between Melee or Tank to target is less than this, using moving ability as attack ability.",
"ConfigWindow_Param_HealWhenNothingTodoBelow": "Healing the members with GCD if there is nothing to do in combat and their min HP ratio is lower than this.",
"ConfigWindow_Param_HealingOfTimeSubtractSingle": "Set the HP threshold reduce with hot effect(single)",
Expand Down
21 changes: 13 additions & 8 deletions RotationSolver/Localization/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,16 +199,21 @@ internal partial class Strings

public string ConfigWindow_Param_BeneficialAreaOnTarget { get; set; } = "Use Beneficial Area abilities on target.";

public string ConfigWindow_Param_HealthDifference { get; set; } = "Set the HP standard deviation threshold for using AOE heal (ability & spell)";
public string ConfigWindow_Param_HealthAreaAbility { get; set; } = "Set the HP threshold for using AOE healing ability";
public string ConfigWindow_Param_HealthAreaSpell { get; set; } = "Set the HP threshold for using AOE healing spell";
public string ConfigWindow_Param_HealingOfTimeSubtractArea { get; set; } = "Set the HP threshold reduce with hot effect(AOE)";
public string ConfigWindow_Param_HealthSingleAbility { get; set; } = "Set the HP threshold for using single healing ability";
public string ConfigWindow_Param_HealthSingleSpell { get; set; } = "Set the HP threshold for using single healing spell";
public string ConfigWindow_Param_HealthDifference { get; set; } = "HP ratio for standard deviation for using AOE heal.";
public string ConfigWindow_Param_HealthAreaAbility { get; set; } = "HP ratio for AOE healing OGCDs";

public string ConfigWindow_Param_HealthHealerRatio { get; set; } = "Heal healer first if its HP threshold is lower than this.";
public string ConfigWindow_Param_HealthAreaSpell { get; set; } = "HP ratio for AOE healing GCDs";

public string ConfigWindow_Param_HealthTankRatio { get; set; } = "Heal tank first if its HP threshold is lower than this.";
public string ConfigWindow_Param_Normal { get; set; } = "Normal";
public string ConfigWindow_Param_Hot { get; set; } = "Hot";

public string ConfigWindow_Param_HealthSingleAbility { get; set; } = "HP ratio for ST healing OGCDs";

public string ConfigWindow_Param_HealthSingleSpell { get; set; } = "HP ratio for ST healing GCDs";

public string ConfigWindow_Param_HealthHealerRatio { get; set; } = "Heal healer first if its HP ratio is lower than this.";

public string ConfigWindow_Param_HealthTankRatio { get; set; } = "Heal tank first if its HP ratio is lower than this.";

public string ConfigWindow_Param_DistanceForMoving { get; set; } = "If the distance between Melee or Tank to target is less than this, using moving ability as attack ability.";

Expand Down
88 changes: 73 additions & 15 deletions RotationSolver/UI/RotationConfigWindow_Param.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using RotationSolver.Commands;
using ECommons.ExcelServices;
using RotationSolver.Commands;
using RotationSolver.Localization;

namespace RotationSolver.UI;
Expand Down Expand Up @@ -387,26 +388,83 @@ private void DrawParamCondition()
ref Service.Config.MeleeRangeOffset, Service.Default.MeleeRangeOffset, 5 * speed, max: 5);

DrawFloatNumber(LocalizationManager.RightLang.ConfigWindow_Param_HealthDifference,
ref Service.Config.HealthDifference, Service.Default.HealthDifference,
speed * 2, 0, 0.5f);
ref Service.Config.HealthDifference, Service.Default.HealthDifference,
speed * 2, 0, 0.5f);

DrawFloatNumber(LocalizationManager.RightLang.ConfigWindow_Param_HealthAreaAbility,
ref Service.Config.HealthAreaAbility, Service.Default.HealthAreaAbility, speed);
if (ImGui.BeginTable("Healing things", 3, ImGuiTableFlags.Borders
| ImGuiTableFlags.Resizable
| ImGuiTableFlags.SizingStretchProp))
{
ImGui.TableSetupScrollFreeze(0, 1);
ImGui.TableNextRow(ImGuiTableRowFlags.Headers);

ImGui.TableNextColumn();
ImGui.TableHeader("");

ImGui.TableNextColumn();
ImGui.TableHeader(LocalizationManager.RightLang.ConfigWindow_Param_Normal);

ImGui.TableNextColumn();
ImGui.TableHeader(LocalizationManager.RightLang.ConfigWindow_Param_Hot);

ImGui.TableNextRow();
ImGui.TableNextColumn();
ImGui.Text(LocalizationManager.RightLang.ConfigWindow_Param_HealthAreaAbility);

ImGui.TableNextColumn();

DrawFloatNumber("##" + nameof(Service.Config.HealthAreaAbility),
ref Service.Config.HealthAreaAbility, Service.Default.HealthAreaAbility, speed);

ImGui.TableNextColumn();

DrawFloatNumber("##" + nameof(Service.Config.HealthAreaAbilityHot),
ref Service.Config.HealthAreaAbilityHot, Service.Default.HealthAreaAbilityHot, speed);

ImGui.TableNextRow();
ImGui.TableNextColumn();
ImGui.Text(LocalizationManager.RightLang.ConfigWindow_Param_HealthAreaSpell);

ImGui.TableNextColumn();

DrawFloatNumber(LocalizationManager.RightLang.ConfigWindow_Param_HealthAreaSpell,
ref Service.Config.HealthAreaSpell, Service.Default.HealthAreaSpell, speed);
DrawFloatNumber("##" + nameof(Service.Config.HealthAreaSpell),
ref Service.Config.HealthAreaSpell, Service.Default.HealthAreaSpell, speed);

DrawFloatNumber(LocalizationManager.RightLang.ConfigWindow_Param_HealthSingleAbility,
ref Service.Config.HealthSingleAbility, Service.Default.HealthSingleAbility, speed);
ImGui.TableNextColumn();

DrawFloatNumber(LocalizationManager.RightLang.ConfigWindow_Param_HealthSingleSpell,
ref Service.Config.HealthSingleSpell, Service.Default.HealthSingleSpell, speed);
DrawFloatNumber("##" + nameof(Service.Config.HealthAreaSpellHot),
ref Service.Config.HealthAreaSpellHot, Service.Default.HealthAreaSpellHot, speed);

DrawFloatNumber(LocalizationManager.RightLang.ConfigWindow_Param_HealthHealerRatio,
ref Service.Config.HealthHealerRatio, Service.Default.HealthHealerRatio, speed);
ImGui.TableNextRow();
ImGui.TableNextColumn();
ImGui.Text(LocalizationManager.RightLang.ConfigWindow_Param_HealthSingleAbility);

DrawFloatNumber(LocalizationManager.RightLang.ConfigWindow_Param_HealthTankRatio,
ref Service.Config.HealthTankRatio, Service.Default.HealthTankRatio, speed);
ImGui.TableNextColumn();

DrawFloatNumber("##" + nameof(Service.Config.HealthSingleAbility),
ref Service.Config.HealthSingleAbility, Service.Default.HealthSingleAbility, speed);

ImGui.TableNextColumn();

DrawFloatNumber("##" + nameof(Service.Config.HealthSingleAbilityHot),
ref Service.Config.HealthSingleAbilityHot, Service.Default.HealthSingleAbilityHot, speed);

ImGui.TableNextRow();
ImGui.TableNextColumn();
ImGui.Text(LocalizationManager.RightLang.ConfigWindow_Param_HealthSingleSpell);

ImGui.TableNextColumn();

DrawFloatNumber("##" + nameof(Service.Config.HealthSingleSpell),
ref Service.Config.HealthSingleSpell, Service.Default.HealthSingleSpell, speed);

ImGui.TableNextColumn();

DrawFloatNumber("##" + nameof(Service.Config.HealthSingleSpellHot),
ref Service.Config.HealthSingleSpellHot, Service.Default.HealthSingleSpellHot, speed);

ImGui.EndTable();
}
}

private void DrawParamTarget()
Expand Down
Loading

0 comments on commit c7764be

Please sign in to comment.