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

Commit

Permalink
fix: add a feature for only attack the target in view.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Feb 16, 2023
1 parent 13ceffc commit 8ae676a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions RotationSolver/Configuration/PluginConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public class PluginConfiguration : IPluginConfiguration

public bool UseStopCasting = false;
public bool EsunaAll = false;
public bool OnlyAttackInView = false;

public string PositionalErrorText = string.Empty;

Expand Down
2 changes: 2 additions & 0 deletions RotationSolver/Localization/Strings_Major.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ internal partial class Strings
public string Configwindow_Param_MoveTargetAngle { get; set; } = "The size of the sector angle that can be selected as the moveable target";
public string Configwindow_Param_MoveTargetAngleDesc { get; set; } = "If the selection mode is based on character facing, i.e., targets within the character's viewpoint are movable targets. \nIf the selection mode is screen-centered, i.e., targets within a sector drawn upward from the character's point are movable targets.";
public string Configwindow_Param_ChangeTargetForFate { get; set; } = "Select only Fate targets in Fate";
public string Configwindow_Param_OnlyAttackInView { get; set; } = "Only attack the target in view.";

public string Configwindow_Param_MoveTowardsScreen { get; set; } = "Using movement actions towards the object in the center of the screen";
public string Configwindow_Param_MoveTowardsScreenDesc { get; set; } = "Using movement actions towards the object in the center of the screen, otherwise toward the facing object.";
public string Configwindow_Param_RaiseAll { get; set; } = "Raise all (include passerby)";
Expand Down
5 changes: 5 additions & 0 deletions RotationSolver/Updaters/TargetUpdater_Hostile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ private unsafe static void UpdateHostileTargets(IEnumerable<BattleChara> allTarg

if (b.StatusList.Any(StatusHelper.IsInvincible)) return false;

if (Service.Configuration.OnlyAttackInView)
{
if(!Service.GameGui.WorldToScreen(b.Position, out _)) return false;
}

return true;
});

Expand Down
1 change: 1 addition & 0 deletions RotationSolver/Windows/RotationConfigWindow_Debug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ private unsafe void DrawTargetData()
ImGui.Text("EventType: " + b.GetEventType().ToString());
ImGui.Text("NamePlate: " + b.GetNamePlateIcon().ToString());
ImGui.Text("StatusFlags: " + b.StatusFlags.ToString());
ImGui.Text("InView: " + Service.GameGui.WorldToScreen(b.Position, out _).ToString());

foreach (var status in b.StatusList)
{
Expand Down
3 changes: 3 additions & 0 deletions RotationSolver/Windows/RotationConfigWindow_Param.cs
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,9 @@ private void DrawParamTarget()
DrawCheckBox(LocalizationManager.RightLang.Configwindow_Param_ChangeTargetForFate,
ref Service.Configuration.ChangeTargetForFate);

DrawCheckBox(LocalizationManager.RightLang.Configwindow_Param_OnlyAttackInView,
ref Service.Configuration.OnlyAttackInView);

DrawCheckBox(LocalizationManager.RightLang.Configwindow_Param_MoveTowardsScreen,
ref Service.Configuration.MoveTowardsScreenCenter,
LocalizationManager.RightLang.Configwindow_Param_MoveTowardsScreenDesc);
Expand Down

0 comments on commit 8ae676a

Please sign in to comment.