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

Commit

Permalink
fix: changed the visibility of options between pvp and pve.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Nov 7, 2023
1 parent acd7003 commit 56b6968
Show file tree
Hide file tree
Showing 9 changed files with 216 additions and 200 deletions.
1 change: 1 addition & 0 deletions RotationSolver.Basic/Configuration/Configs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ public enum PluginConfigFloat : byte
[Default(1f, 0.2f, 10f), Unit(ConfigUnitType.Pixels)] StateIconSize,

[Default(0.02f, 0f, 1f), Unit(ConfigUnitType.Seconds)] MinUpdatingTime,
[Default(0.15f), Unit(ConfigUnitType.Ratio)] HealthForGuard,
}

public enum PluginConfigVector4 : byte
Expand Down
6 changes: 3 additions & 3 deletions RotationSolver.Basic/Helpers/TargetFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ private static T FindMoveTargetScreenCenter<T>(IEnumerable<T> charas) where T :
/// <param name="charas"></param>
/// <param name="mustUse"></param>
/// <returns></returns>
public static BattleChara FindAttackedTarget(IEnumerable<BattleChara> charas, bool mustUse)
public static BattleChara FindAttackedTarget(IEnumerable<BattleChara> charas, bool _)
{
if (!charas.Any()) return null;
var attachedT = charas.Where(tank => tank.TargetObject?.TargetObject == tank);
Expand Down Expand Up @@ -303,14 +303,14 @@ private static bool IsJobCategory(this BattleChara obj, SortedSet<byte> validJob
return validJobs.Contains((byte)obj.ClassJob.GameData?.RowId);
}

internal static BattleChara ASTRangeTarget(IEnumerable<BattleChara> ASTTargets, bool mustUse)
internal static BattleChara ASTRangeTarget(IEnumerable<BattleChara> ASTTargets, bool _)
{
ASTTargets = ASTTargets.Where(b => !b.HasStatus(false, StatusID.Weakness, StatusID.BrinkOfDeath));

return ASTTargets.ASTGetTargetByJobs(JobRole.RangedMagical, JobRole.RangedPhysical, JobRole.Melee);
}

internal static BattleChara ASTMeleeTarget(IEnumerable<BattleChara> ASTTargets, bool mustUse)
internal static BattleChara ASTMeleeTarget(IEnumerable<BattleChara> ASTTargets, bool _)
{
ASTTargets = ASTTargets.Where(b => !b.HasStatus(false, StatusID.Weakness, StatusID.BrinkOfDeath));

Expand Down
7 changes: 6 additions & 1 deletion RotationSolver.Basic/Rotations/CustomRotation_Ability.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,12 @@ protected virtual bool EmergencyAbility(IAction nextGCD, out IAction act)
}
}

act = null;
#region PvP
if (PvP_Guard.CanUse(out act)
&& (Player.GetHealthRatio() <= Service.Config.GetValue(PluginConfigFloat.HealthForGuard)
|| IsRaiseShirk)) return true;
#endregion

return false;
}

Expand Down
5 changes: 4 additions & 1 deletion RotationSolver.Basic/Rotations/CustomRotation_GCD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,10 @@ protected virtual bool EmergencyGCD(out IAction act)
#endregion

#region PvP
if (IsRaiseShirk && PvP_Guard.CanUse(out act)) return true;
if (PvP_Guard.CanUse(out act)
&& (Player.GetHealthRatio() <= Service.Config.GetValue(PluginConfigFloat.HealthForGuard)
|| IsRaiseShirk)) return true;

if (PvP_StandardIssueElixir.CanUse(out act)) return true;
#endregion
act = null; return false;
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/Localization/ConfigTranslation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ internal static class ConfigTranslation
PluginConfigFloat.MoveTargetAngle => LocalizationManager.RightLang.ConfigWindow_Param_MoveTargetAngle,
PluginConfigFloat.AutoHealTimeToKill => LocalizationManager.RightLang.ConfigWindow_Auto_AutoHealTimeToKill,
PluginConfigFloat.ProvokeDelayMin => LocalizationManager.RightLang.ConfigWindow_Auto_ProvokeDelay,

PluginConfigFloat.HealthForGuard => LocalizationManager.RightLang.ConfigWindow_Param_HealthForGuard,
// target
PluginConfigFloat.BossTimeToKill => LocalizationManager.RightLang.ConfigWindow_Param_BossTimeToKill,
PluginConfigFloat.DyingTimeToKill => LocalizationManager.RightLang.ConfigWindow_Param_DyingTimeToKill,
Expand Down
1 change: 1 addition & 0 deletions RotationSolver/Localization/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ internal class Strings
public string ConfigWindow_Param_HealWhenNothingTodoDelay { get; set; } = "The delay of this type of healing.";

public string ConfigWindow_Param_HealthForDyingTank { get; set; } = "Set the HP%% for tank to use invulnerability";
public string ConfigWindow_Param_HealthForGuard { get; set; } = "Set the HP%% for using Guard.";

public string ConfigWindow_Param_MeleeRangeOffset { get; set; } = "Melee Range action using offset";
public string ConfigWindow_Param_RightNowTargetToHostileType { get; set; } = "Engage settings";
Expand Down
75 changes: 36 additions & 39 deletions RotationSolver/UI/RotationConfigWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,56 +124,54 @@ private void DrawConditionSet()
}
ImguiTooltips.HoveredTooltip(LocalizationManager.RightLang.ConfigWindow_ConditionSetDesc);

using (var popup = ImRaii.Popup(popUpId))
using var popup = ImRaii.Popup(popUpId);
if (popup.Success)
{
if (popup.Success)
var combos = DataCenter.ConditionSets;
for (int i = 0; i < combos.Length; i++)
{
var combos = DataCenter.ConditionSets;
for (int i = 0; i < combos.Length; i++)
void DeleteFile()
{
void DeleteFile()
{
ActionSequencerUpdater.Delete(combos[i].Name);
}

if (combos[i].Name == set.Name)
{
ImGuiHelper.SetNextWidthWithName(set.Name);
ImGui.InputText("##MajorConditionSet", ref set.Name, 100);
}
else
{
var key = "Condition Set At " + i.ToString();
ImGuiHelper.DrawHotKeysPopup(key, string.Empty, (LocalizationManager.RightLang.ConfigWindow_List_Remove, DeleteFile, new string[] { "Delete" }));
ActionSequencerUpdater.Delete(combos[i].Name);
}

if (combos[i].Name == set.Name)
{
ImGuiHelper.SetNextWidthWithName(set.Name);
ImGui.InputText("##MajorConditionSet", ref set.Name, 100);
}
else
{
var key = "Condition Set At " + i.ToString();
ImGuiHelper.DrawHotKeysPopup(key, string.Empty, (LocalizationManager.RightLang.ConfigWindow_List_Remove, DeleteFile, new string[] { "Delete" }));

if (ImGui.Selectable(combos[i].Name))
{
Service.Config.SetValue(PluginConfigInt.ActionSequencerIndex, i);
}

ImGuiHelper.ExecuteHotKeysPopup(key, string.Empty, string.Empty, false,
(DeleteFile, new Dalamud.Game.ClientState.Keys.VirtualKey[] { Dalamud.Game.ClientState.Keys.VirtualKey.DELETE }));
if (ImGui.Selectable(combos[i].Name))
{
Service.Config.SetValue(PluginConfigInt.ActionSequencerIndex, i);
}
}

ImGui.PushFont(UiBuilder.IconFont);

ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.HealerGreen);
if (ImGui.Selectable(FontAwesomeIcon.Plus.ToIconString()))
{
ActionSequencerUpdater.AddNew();
ImGuiHelper.ExecuteHotKeysPopup(key, string.Empty, string.Empty, false,
(DeleteFile, new Dalamud.Game.ClientState.Keys.VirtualKey[] { Dalamud.Game.ClientState.Keys.VirtualKey.DELETE }));
}
ImGui.PopStyleColor();
}

if (ImGui.Selectable(FontAwesomeIcon.FileDownload.ToIconString()))
{
ActionSequencerUpdater.LoadFiles();
}
ImGui.PushFont(UiBuilder.IconFont);

ImGui.PopFont();
ImguiTooltips.HoveredTooltip(LocalizationManager.RightLang.ActionSequencer_Load);
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.HealerGreen);
if (ImGui.Selectable(FontAwesomeIcon.Plus.ToIconString()))
{
ActionSequencerUpdater.AddNew();
}
ImGui.PopStyleColor();

if (ImGui.Selectable(FontAwesomeIcon.FileDownload.ToIconString()))
{
ActionSequencerUpdater.LoadFiles();
}

ImGui.PopFont();
ImguiTooltips.HoveredTooltip(LocalizationManager.RightLang.ActionSequencer_Load);
}
}

Expand Down Expand Up @@ -551,7 +549,6 @@ private void DrawBody()
}

#region About

private static readonly SortedList<uint, string> CountStringPair = new()
{
{ 100_000, LocalizationManager.RightLang.ConfigWindow_About_Clicking100k },
Expand Down
Loading

0 comments on commit 56b6968

Please sign in to comment.