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

Commit

Permalink
fix: add an option for control window show.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Mar 25, 2023
1 parent 4984eb4 commit ecdcd42
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions RotationSolver.Basic/Configuration/PluginConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ public class PluginConfiguration : IPluginConfiguration
public MacroInfo DutyStart { get; set; } = new MacroInfo();
public MacroInfo DutyEnd { get; set; } = new MacroInfo();

public bool OnlyShowWithHostileOrInDuty = true;
public bool ShowControlWindow = false;
public bool IsControlWindowLock = false;
public bool ShowNextActionWindow = false;
Expand Down
1 change: 1 addition & 0 deletions RotationSolver/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@
"ConfigWindow_Param_ConditionUp": "Up",
"ConfigWindow_Param_ConditionDown": "Down",
"ConfigWindow_Param_ConditionDelete": "Delete",
"ConfigWindow_Control_OnlyShowWithHostileOrInDuty": "Only shown if there are enemies in or in duty",
"ConfigWindow_Control_ShowNextActionWindow": "Show Next Action Window",
"ConfigWindow_Control_ShowControlWindow": "Show Control Window",
"ConfigWindow_Control_UseKeyboardCommand": "Use Keyboard Command",
Expand Down
1 change: 1 addition & 0 deletions RotationSolver/Localization/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ internal partial class Strings
public string ConfigWindow_Param_ConditionDown { get; set; } = "Down";
public string ConfigWindow_Param_ConditionDelete { get; set; } = "Delete";

public string ConfigWindow_Control_OnlyShowWithHostileOrInDuty { get; set; } = "Only shown if there are enemies in or in duty";
public string ConfigWindow_Control_ShowNextActionWindow { get; set; } = "Show Next Action Window";

public string ConfigWindow_Control_ShowControlWindow { get; set; } = "Show Control Window";
Expand Down
7 changes: 6 additions & 1 deletion RotationSolver/RotationSolverPlugin.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using Dalamud.Game.ClientState.Conditions;
using Dalamud.Interface.Windowing;
using Dalamud.Plugin;
using FFXIVClientStructs.FFXIV.Client.Game.Gauge;
using Newtonsoft.Json;
using RotationSolver.Basic;
using RotationSolver.Basic.Configuration;
using RotationSolver.Basic.Data;
using RotationSolver.Basic.Helpers;
using RotationSolver.Commands;
using RotationSolver.Localization;
using RotationSolver.UI;
Expand Down Expand Up @@ -110,7 +112,10 @@ internal static void OpenConfigWindow()

internal static void UpdateDisplayWindow()
{
var isValid = MajorUpdater.IsValid
var isValid = MajorUpdater.IsValid
&& (!Service.Config.OnlyShowWithHostileOrInDuty ||
Service.Conditions[ConditionFlag.BoundByDuty] ||
DataCenter.HostileTargets.Any(o => o.DistanceToPlayer() <= 25))
&& RotationUpdater.RightNowRotation != null
&& !Service.Conditions[ConditionFlag.OccupiedInCutSceneEvent]
&& !Service.Conditions[ConditionFlag.BetweenAreas]
Expand Down
7 changes: 6 additions & 1 deletion RotationSolver/UI/RotationConfigWindow_Control.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ private void DrawControlTab()
DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Control_UseGamepadCommand,
ref Service.Config.UseGamepadCommand);


DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Control_UseKeyboardCommand,
ref Service.Config.UseKeyboardCommand);

ImGui.Separator();

if(Service.Config.ShowNextActionWindow || Service.Config.ShowCooldownWindow || Service.Config.ShowControlWindow)
{
DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Control_OnlyShowWithHostileOrInDuty,
ref Service.Config.OnlyShowWithHostileOrInDuty);
}

DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Control_ShowNextActionWindow,
ref Service.Config.ShowNextActionWindow);

Expand Down
1 change: 1 addition & 0 deletions RotationSolver/UI/RotationConfigWindow_Debug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ private unsafe void DrawStatus()
}

ImGui.Text("Have pet: " + DataCenter.HasPet.ToString());
ImGui.Text("Hostile Near: " + DataCenter.HasHostilesInRange.ToString());
ImGui.Text("Have Companion: " + DataCenter.HasCompanion.ToString());
ImGui.Text("Targetable: " + Service.Player.IsTargetable().ToString());

Expand Down
3 changes: 2 additions & 1 deletion RotationSolver/Updaters/TargetUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ private unsafe static void UpdateHostileTargets(IEnumerable<BattleChara> allTarg

DataCenter.TarOnMeTargets = DataCenter.HostileTargets.Where(tar => tar.TargetObjectId == Service.Player.ObjectId);

DataCenter.HasHostilesInRange = TargetFilter.GetObjectInRadius(DataCenter.HostileTargets, JobRange).Any();

DataCenter.HasHostilesInRange = DataCenter.HostileTargets.Any(o => o.DistanceToPlayer() <= JobRange);

if (DataCenter.HostileTargets.Count() == 1)
{
Expand Down

0 comments on commit ecdcd42

Please sign in to comment.