From 0254b12e845763341fd651036dcaa2a0466ea872 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E6=B0=B4?= <1123993881@qq.com> Date: Sun, 22 Jan 2023 14:45:27 +0800 Subject: [PATCH] feat: add an option called autooff between area. --- .../Configuration/PluginConfiguration.cs | 1 + RotationSolver/Localization/Localization.json | 17 +++++++++-------- RotationSolver/Localization/Strings.cs | 16 +++++++++------- .../CustomRotation/CustomRotation_Display.cs | 16 ++++++++++++---- RotationSolver/Updaters/ActionUpdater.cs | 2 +- .../Updaters/TargetUpdater_Hostile.cs | 11 ++++++++--- .../Windows/RotationConfigWindow_Action.cs | 2 +- .../Windows/RotationConfigWindow_Events.cs | 2 +- .../Windows/RotationConfigWindow_Help.cs | 2 +- .../Windows/RotationConfigWindow_Param.cs | 5 ++++- .../Windows/RotationConfigWindow_Rotation.cs | 16 ++++++++-------- 11 files changed, 55 insertions(+), 35 deletions(-) diff --git a/RotationSolver/Configuration/PluginConfiguration.cs b/RotationSolver/Configuration/PluginConfiguration.cs index 02a6f7137..11e377569 100644 --- a/RotationSolver/Configuration/PluginConfiguration.cs +++ b/RotationSolver/Configuration/PluginConfiguration.cs @@ -26,6 +26,7 @@ public class PluginConfiguration : IPluginConfiguration public int TimelineIndex = 0; public bool AutoBurst = true; + public bool AutoOffBetweenArea = true; public bool UseAbility = true; public bool UseDefenceAbility = true; public bool NeverReplaceIcon = false; diff --git a/RotationSolver/Localization/Localization.json b/RotationSolver/Localization/Localization.json index 271bf1928..2c36760b9 100644 --- a/RotationSolver/Localization/Localization.json +++ b/RotationSolver/Localization/Localization.json @@ -56,6 +56,7 @@ "Configwindow_Param_InterruptibleTime": "Set the delay of interrupting", "Configwindow_Param_SpecialDuration": "Set the duration of special windows set by commands", "Configwindow_Param_AddDotGCDCount": "Set GCD advance of DOT refresh", + "Configwindow_Param_AutoOffBetweenArea": "Turn off when player is between area.", "Configwindow_Param_DisplayEnhancement": "Display enhancement", "Configwindow_Param_PoslockCasting": "Lock the movement when casting", "Configwindow_Param_PoslockModifier": "Set the modifier key to unlock the movement temporary", @@ -103,16 +104,17 @@ "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_Params_HealingOfTimeSubtractArea": "Set the HP threshold reduce with hot effect(AOE)", + "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_Params_HealingOfTimeSubtractSingle": "Set the HP threshold reduce with hot effect(single)", - "Configwindow_Params_HealthForDyingTank": "Set the HP threshold for tank to use invincibility", + "Configwindow_Param_HealingOfTimeSubtractSingle": "Set the HP threshold reduce with hot effect(single)", + "Configwindow_Param_HealthForDyingTank": "Set the HP threshold for tank to use invincibility", "Configwindow_Param_Target": "Target selection", - "Configwindow_Params_RightNowTargetToHostileType": "Hostile target filtering condition", - "Configwindow_Params_TargetToHostileType1": "All targets can attack", - "Configwindow_Params_TargetToHostileType2": "Targets have a target or all targets can attack", - "Configwindow_Params_TargetToHostileType3": "Targets have a target", + "Configwindow_Param_RightNowTargetToHostileType": "Hostile target filtering condition", + "Configwindow_Param_TargetToHostileType1": "All targets can attack", + "Configwindow_Param_TargetToHostileType2": "Targets have a target or all targets can attack", + "Configwindow_Param_TargetToHostileType3": "Targets have a target", + "Configwindow_Param_NoticeUnexpectedCombat": "NOTICE: You are not turn the auto off between area on. It may start a combat unexpectedly.", "Configwindow_Param_AddEnemyListToHostile": "Enemies", "Configwindow_Param_ChooseAttackMark": "Priority attack targets with attack markers", "Configwindow_Param_CanAttackMarkAOE": "Forced use of AOE", @@ -159,7 +161,6 @@ "Timeline_StatusSelfDesc": "StatusSelf", "Action_Friendly": "Support", "Action_Attack": "Attack", - "Action_WrongPositional": "Positional {0}!", "ActionConditionType_Elapsed": "Elapsed", "ActionConditionType_ElapsedGCD": "ElapsedGCD ", "ActionConditionType_Remain": "RemainTime", diff --git a/RotationSolver/Localization/Strings.cs b/RotationSolver/Localization/Strings.cs index af6489eb2..5e77ff624 100644 --- a/RotationSolver/Localization/Strings.cs +++ b/RotationSolver/Localization/Strings.cs @@ -103,6 +103,7 @@ internal class Strings public string Configwindow_Param_InterruptibleTime { get; set; } = "Set the delay of interrupting"; public string Configwindow_Param_SpecialDuration { get; set; } = "Set the duration of special windows set by commands"; public string Configwindow_Param_AddDotGCDCount { get; set; } = "Set GCD advance of DOT refresh"; + public string Configwindow_Param_AutoOffBetweenArea { get; set; } = "Turn off when player is between area."; public string Configwindow_Param_DisplayEnhancement { get; set; } = "Display enhancement"; public string Configwindow_Param_PoslockCasting { get; set; } = "Lock the movement when casting"; public string Configwindow_Param_PoslockModifier { get; set; } = "Set the modifier key to unlock the movement temporary"; @@ -150,16 +151,17 @@ internal class Strings 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_Params_HealingOfTimeSubtractArea { get; set; } = "Set the HP threshold reduce with hot effect(AOE)"; + 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_Params_HealingOfTimeSubtractSingle { get; set; } = "Set the HP threshold reduce with hot effect(single)"; - public string Configwindow_Params_HealthForDyingTank { get; set; } = "Set the HP threshold for tank to use invincibility"; + public string Configwindow_Param_HealingOfTimeSubtractSingle { get; set; } = "Set the HP threshold reduce with hot effect(single)"; + public string Configwindow_Param_HealthForDyingTank { get; set; } = "Set the HP threshold for tank to use invincibility"; public string Configwindow_Param_Target { get; set; } = "Target selection"; - public string Configwindow_Params_RightNowTargetToHostileType { get; set; } = "Hostile target filtering condition"; - public string Configwindow_Params_TargetToHostileType1 { get; set; } = "All targets can attack"; - public string Configwindow_Params_TargetToHostileType2 { get; set; } = "Targets have a target or all targets can attack"; - public string Configwindow_Params_TargetToHostileType3 { get; set; } = "Targets have a target"; + public string Configwindow_Param_RightNowTargetToHostileType { get; set; } = "Hostile target filtering condition"; + public string Configwindow_Param_TargetToHostileType1 { get; set; } = "All targets can attack"; + public string Configwindow_Param_TargetToHostileType2 { get; set; } = "Targets have a target or all targets can attack"; + public string Configwindow_Param_TargetToHostileType3 { get; set; } = "Targets have a target"; + public string Configwindow_Param_NoticeUnexpectedCombat { get; set; } = "NOTICE: You are not turn the auto off between area on. It may start a combat unexpectedly."; public string Configwindow_Param_AddEnemyListToHostile { get; set; } = "Enemies"; public string Configwindow_Param_ChooseAttackMark { get; set; } = "Priority attack targets with attack markers"; public string Configwindow_Param_CanAttackMarkAOE { get; set; } = "Forced use of AOE"; diff --git a/RotationSolver/Rotations/CustomRotation/CustomRotation_Display.cs b/RotationSolver/Rotations/CustomRotation/CustomRotation_Display.cs index 12dc11ab9..35135f242 100644 --- a/RotationSolver/Rotations/CustomRotation/CustomRotation_Display.cs +++ b/RotationSolver/Rotations/CustomRotation/CustomRotation_Display.cs @@ -1,4 +1,6 @@ using Dalamud.Interface; +using Dalamud.Interface.Colors; +using Dalamud.Interface.Style; using Dalamud.Utility; using ImGuiNET; using Lumina.Data.Parsing; @@ -60,16 +62,22 @@ public unsafe void Display(ICustomRotation[] rotations, bool canAddButton) => th { int isAllTargetAsHostile = (byte)IconReplacer.GetTargetHostileType(Job); ImGui.SetNextItemWidth(300); - if (ImGui.Combo(LocalizationManager.RightLang.Configwindow_Params_RightNowTargetToHostileType + $"##HostileType{GetHashCode()}", ref isAllTargetAsHostile, new string[] + if (ImGui.Combo(LocalizationManager.RightLang.Configwindow_Param_RightNowTargetToHostileType + $"##HostileType{GetHashCode()}", ref isAllTargetAsHostile, new string[] { - LocalizationManager.RightLang.Configwindow_Params_TargetToHostileType1, - LocalizationManager.RightLang.Configwindow_Params_TargetToHostileType2, - LocalizationManager.RightLang.Configwindow_Params_TargetToHostileType3, + LocalizationManager.RightLang.Configwindow_Param_TargetToHostileType1, + LocalizationManager.RightLang.Configwindow_Param_TargetToHostileType2, + LocalizationManager.RightLang.Configwindow_Param_TargetToHostileType3, }, 3)) { Service.Configuration.TargetToHostileTypes[Job.RowId] = (byte)isAllTargetAsHostile; Service.Configuration.Save(); } + + if(isAllTargetAsHostile != 2 && !Service.Configuration.AutoOffBetweenArea) + { + ImGui.TextColored(ImGuiColors.DPSRed, LocalizationManager.RightLang.Configwindow_Param_NoticeUnexpectedCombat); + } + Configs.Draw(canAddButton); }); } diff --git a/RotationSolver/Updaters/ActionUpdater.cs b/RotationSolver/Updaters/ActionUpdater.cs index c6ede60ae..83f3e86a5 100644 --- a/RotationSolver/Updaters/ActionUpdater.cs +++ b/RotationSolver/Updaters/ActionUpdater.cs @@ -160,7 +160,7 @@ internal unsafe static void DoAction() || Service.Conditions[Dalamud.Game.ClientState.Conditions.ConditionFlag.Occupied33] || Service.Conditions[Dalamud.Game.ClientState.Conditions.ConditionFlag.Occupied38] || Service.Conditions[Dalamud.Game.ClientState.Conditions.ConditionFlag.Jumping61] - || Service.Conditions[Dalamud.Game.ClientState.Conditions.ConditionFlag.BetweenAreas] + || Service.Conditions[Dalamud.Game.ClientState.Conditions.ConditionFlag.BetweenAreas] && Service.Configuration.AutoOffBetweenArea || Service.Conditions[Dalamud.Game.ClientState.Conditions.ConditionFlag.BetweenAreas51] || Service.Conditions[Dalamud.Game.ClientState.Conditions.ConditionFlag.Mounted] || Service.Conditions[Dalamud.Game.ClientState.Conditions.ConditionFlag.SufferingStatusAffliction] diff --git a/RotationSolver/Updaters/TargetUpdater_Hostile.cs b/RotationSolver/Updaters/TargetUpdater_Hostile.cs index 52fe346c9..0f765f644 100644 --- a/RotationSolver/Updaters/TargetUpdater_Hostile.cs +++ b/RotationSolver/Updaters/TargetUpdater_Hostile.cs @@ -37,17 +37,22 @@ internal static partial class TargetUpdater internal static bool IsHostileCastingToTank { get; private set; } = false; + private static bool IsInvincibleStatus(Status status) + { + if (status.Icon == 15024) return true; + return false; + } + internal unsafe static void UpdateHostileTargets() { var inFate = Service.Configuration.ChangeTargetForFate && (IntPtr)FateManager.Instance() != IntPtr.Zero && FateManager.Instance()->FateJoined > 0; AllTargets = TargetFilter.GetTargetable(TargetFilter.GetObjectInRadius(Service.ObjectTable, 30).Where(obj => { - if (obj is BattleChara c && c.CurrentHp != 0) { - if (c.StatusList.Any(status => Service.DataManager.GetExcelSheet() - .GetRow(status.StatusId).Icon == 15024)) return false; + if (c.StatusList.Any(status => IsInvincibleStatus(Service.DataManager.GetExcelSheet() + .GetRow(status.StatusId)))) return false; //不可选中 if (!c.IsTargetable()) return false; diff --git a/RotationSolver/Windows/RotationConfigWindow_Action.cs b/RotationSolver/Windows/RotationConfigWindow_Action.cs index 562f0700b..aac2f9bc8 100644 --- a/RotationSolver/Windows/RotationConfigWindow_Action.cs +++ b/RotationSolver/Windows/RotationConfigWindow_Action.cs @@ -30,7 +30,7 @@ private void DrawActionTab() private void DrawActionList() { - ImGui.Text(LocalizationManager.RightLang.ConfigWindow_ActionItem_Description); + ImGui.TextWrapped(LocalizationManager.RightLang.ConfigWindow_ActionItem_Description); ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, new Vector2(0f, 5f)); diff --git a/RotationSolver/Windows/RotationConfigWindow_Events.cs b/RotationSolver/Windows/RotationConfigWindow_Events.cs index be903d8f4..5d443b854 100644 --- a/RotationSolver/Windows/RotationConfigWindow_Events.cs +++ b/RotationSolver/Windows/RotationConfigWindow_Events.cs @@ -18,7 +18,7 @@ private void DrawEventTab() ImGui.SameLine(); ImGuiHelper.Spacing(); - ImGui.Text(LocalizationManager.RightLang.Configwindow_Events_Description); + ImGui.TextWrapped(LocalizationManager.RightLang.Configwindow_Events_Description); ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, new Vector2(0f, 5f)); diff --git a/RotationSolver/Windows/RotationConfigWindow_Help.cs b/RotationSolver/Windows/RotationConfigWindow_Help.cs index 11050ab03..4b991b5bf 100644 --- a/RotationSolver/Windows/RotationConfigWindow_Help.cs +++ b/RotationSolver/Windows/RotationConfigWindow_Help.cs @@ -12,7 +12,7 @@ internal partial class RotationConfigWindow { private void DrawHelpTab() { - ImGui.Text(LocalizationManager.RightLang.ConfigWindow_HelpItem_Description); + ImGui.TextWrapped(LocalizationManager.RightLang.ConfigWindow_HelpItem_Description); ImGui.SameLine(); diff --git a/RotationSolver/Windows/RotationConfigWindow_Param.cs b/RotationSolver/Windows/RotationConfigWindow_Param.cs index 085c119c1..ac79651ab 100644 --- a/RotationSolver/Windows/RotationConfigWindow_Param.cs +++ b/RotationSolver/Windows/RotationConfigWindow_Param.cs @@ -12,7 +12,7 @@ internal partial class RotationConfigWindow { private void DrawParamTab() { - ImGui.Text(LocalizationManager.RightLang.Configwindow_Params_Description); + ImGui.TextWrapped(LocalizationManager.RightLang.Configwindow_Params_Description); ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, new Vector2(0f, 5f)); @@ -92,6 +92,9 @@ private void DrawParamBasic() DrawIntNumber(LocalizationManager.RightLang.Configwindow_Param_AddDotGCDCount, ref Service.Configuration.AddDotGCDCount, min: 0, max: 3); + + DrawCheckBox(LocalizationManager.RightLang.Configwindow_Param_AutoOffBetweenArea, + ref Service.Configuration.AutoOffBetweenArea); } private void DrawParamDisplay() diff --git a/RotationSolver/Windows/RotationConfigWindow_Rotation.cs b/RotationSolver/Windows/RotationConfigWindow_Rotation.cs index f5d3bdb3e..be5d3a6c9 100644 --- a/RotationSolver/Windows/RotationConfigWindow_Rotation.cs +++ b/RotationSolver/Windows/RotationConfigWindow_Rotation.cs @@ -20,7 +20,7 @@ internal partial class RotationConfigWindow { private void DrawRotationTab() { - ImGui.Text(LocalizationManager.RightLang.Configwindow_AttackItem_Description); + ImGui.TextWrapped(LocalizationManager.RightLang.Configwindow_AttackItem_Description); ImGui.BeginChild("Attack Items", new Vector2(0f, -1f), true); ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, new Vector2(0f, 5f)); @@ -86,11 +86,11 @@ private static void DrawTargetHostileTYpe(ICustomRotation rotation) { var isAllTargetAsHostile = (int)IconReplacer.GetTargetHostileType(rotation.Job); ImGui.SetNextItemWidth(300); - if (ImGui.Combo(LocalizationManager.RightLang.Configwindow_Params_RightNowTargetToHostileType + $"##HostileType{rotation.GetHashCode()}", ref isAllTargetAsHostile, new string[] + if (ImGui.Combo(LocalizationManager.RightLang.Configwindow_Param_RightNowTargetToHostileType + $"##HostileType{rotation.GetHashCode()}", ref isAllTargetAsHostile, new string[] { - LocalizationManager.RightLang.Configwindow_Params_TargetToHostileType1, - LocalizationManager.RightLang.Configwindow_Params_TargetToHostileType2, - LocalizationManager.RightLang.Configwindow_Params_TargetToHostileType3, + LocalizationManager.RightLang.Configwindow_Param_TargetToHostileType1, + LocalizationManager.RightLang.Configwindow_Param_TargetToHostileType2, + LocalizationManager.RightLang.Configwindow_Param_TargetToHostileType3, }, 3)) { Service.Configuration.TargetToHostileTypes[rotation.Job.RowId] = (byte)isAllTargetAsHostile; @@ -106,7 +106,7 @@ private static void DrawSpecialRoleSettings(JobRole role, ClassJobID job) } else if (role == JobRole.Tank) { - DrawDragFloat(job, LocalizationManager.RightLang.Configwindow_Params_HealthForDyingTank, + DrawDragFloat(job, LocalizationManager.RightLang.Configwindow_Param_HealthForDyingTank, () => ConfigurationHelper.GetHealthForDyingTank(job), (value) => Service.Configuration.HealthForDyingTanks[job] = value); } @@ -122,7 +122,7 @@ private static void DrawHealerSettings(ClassJobID job) () => ConfigurationHelper.GetHealAreafSpell(job), (value) => Service.Configuration.HealthAreafSpells[job] = value); - DrawDragFloat(job, LocalizationManager.RightLang.Configwindow_Params_HealingOfTimeSubtractArea, + DrawDragFloat(job, LocalizationManager.RightLang.Configwindow_Param_HealingOfTimeSubtractArea, () => ConfigurationHelper.GetHealingOfTimeSubtractArea(job), (value) => Service.Configuration.HealingOfTimeSubtractAreas[job] = value); @@ -134,7 +134,7 @@ private static void DrawHealerSettings(ClassJobID job) () => ConfigurationHelper.GetHealSingleSpell(job), (value) => Service.Configuration.HealthSingleSpells[job] = value); - DrawDragFloat(job, LocalizationManager.RightLang.Configwindow_Params_HealingOfTimeSubtractSingle, + DrawDragFloat(job, LocalizationManager.RightLang.Configwindow_Param_HealingOfTimeSubtractSingle, () => ConfigurationHelper.GetHealingOfTimeSubtractSingle(job), (value) => Service.Configuration.HealingOfTimeSubtractSingles[job] = value); }