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

Commit

Permalink
feat: add an option called autooff between area.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Jan 22, 2023
1 parent 795f4cb commit 0254b12
Show file tree
Hide file tree
Showing 11 changed files with 55 additions and 35 deletions.
1 change: 1 addition & 0 deletions RotationSolver/Configuration/PluginConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
17 changes: 9 additions & 8 deletions RotationSolver/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
16 changes: 9 additions & 7 deletions RotationSolver/Localization/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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";
Expand Down
16 changes: 12 additions & 4 deletions RotationSolver/Rotations/CustomRotation/CustomRotation_Display.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using Dalamud.Interface;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Style;
using Dalamud.Utility;
using ImGuiNET;
using Lumina.Data.Parsing;
Expand Down Expand Up @@ -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);
});
}
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/Updaters/ActionUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
11 changes: 8 additions & 3 deletions RotationSolver/Updaters/TargetUpdater_Hostile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Status>()
.GetRow(status.StatusId).Icon == 15024)) return false;
if (c.StatusList.Any(status => IsInvincibleStatus(Service.DataManager.GetExcelSheet<Status>()
.GetRow(status.StatusId)))) return false;

//不可选中
if (!c.IsTargetable()) return false;
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/Windows/RotationConfigWindow_Action.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/Windows/RotationConfigWindow_Events.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/Windows/RotationConfigWindow_Help.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
5 changes: 4 additions & 1 deletion RotationSolver/Windows/RotationConfigWindow_Param.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down Expand Up @@ -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()
Expand Down
16 changes: 8 additions & 8 deletions RotationSolver/Windows/RotationConfigWindow_Rotation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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;
Expand All @@ -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);
}
Expand All @@ -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);

Expand All @@ -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);
}
Expand Down

0 comments on commit 0254b12

Please sign in to comment.