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

Commit

Permalink
fix: the poslock.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Nov 3, 2023
1 parent 7dca494 commit 8bc11f0
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 14 deletions.
4 changes: 3 additions & 1 deletion Resources/HostileCastingArea.json
Original file line number Diff line number Diff line change
Expand Up @@ -459,5 +459,7 @@
34943,
34921,
35113,
34947
34947,
34748,
34763
]
2 changes: 1 addition & 1 deletion Resources/RotationSolverRecord.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"ClickingCount": 49362,
"ClickingCount": 50318,
"SaidUsers": []
}
1 change: 1 addition & 0 deletions RotationSolver.Basic/Configuration/Configs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ public enum PluginConfigBool : byte
[Default(true)] AutoOffBetweenArea,
[Default(true)] AutoOffCutScene,
[Default(true)] AutoOffWhenDead,
[Default(true)] AutoOffWhenDutyCompleted,
[Default(true)] ChangeTargetForFate,
[Default(true)] MoveTowardsScreenCenter,
[Default(true)] SayOutStateChanged,
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver.Basic/DataCenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static MajorConditionSet RightSet
internal static bool NoPoslock => Svc.Condition[ConditionFlag.OccupiedInEvent]
|| !Service.Config.GetValue(PluginConfigBool.PoslockCasting)
//Key cancel.
|| Svc.KeyState[ConfigurationHelper.Keys[Service.Config.GetValue(Configuration.PluginConfigInt.PoslockModifier) % ConfigurationHelper.Keys.Length]]
|| Svc.KeyState[ConfigurationHelper.Keys[Service.Config.GetValue(PluginConfigInt.PoslockModifier) % ConfigurationHelper.Keys.Length]]
//Gamepad cancel.
|| Svc.GamepadState.Raw(Dalamud.Game.ClientState.GamePad.GamepadButtons.L2) >= 0.5f;

Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/Commands/RSCommands_Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ internal static void ResetSpecial()
{
DoSpecialCommandType(SpecialCommandType.EndSpecial, false);
}
private static void CancelState()
internal static void CancelState()
{
if (DataCenter.State) DoStateCommandType(StateCommandType.Cancel);
}
Expand Down
1 change: 1 addition & 0 deletions RotationSolver/Localization/ConfigTranslation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ internal static class ConfigTranslation
PluginConfigBool.AutoOffBetweenArea => LocalizationManager.RightLang.ConfigWindow_Param_AutoOffBetweenArea,
PluginConfigBool.AutoOffCutScene => LocalizationManager.RightLang.ConfigWindow_Param_AutoOffCutScene,
PluginConfigBool.AutoOffWhenDead => LocalizationManager.RightLang.ConfigWindow_Param_AutoOffWhenDead,
PluginConfigBool.AutoOffWhenDutyCompleted => LocalizationManager.RightLang.ConfigWindow_Param_AutoOffWhenDutyCompleted,
PluginConfigBool.StartOnCountdown => LocalizationManager.RightLang.ConfigWindow_Param_StartOnCountdown,
PluginConfigBool.StartOnAttackedBySomeone => LocalizationManager.RightLang.ConfigWindow_Param_StartOnAttackedBySomeone,
PluginConfigBool.UseWorkTask => LocalizationManager.RightLang.ConfigWindow_Param_UseWorkTask,
Expand Down
1 change: 1 addition & 0 deletions RotationSolver/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"ConfigWindow_Param_AutoOffAfterCombatTime": "seconds.",
"ConfigWindow_Param_AutoOffCutScene": "Auto turn off during cutscenes.",
"ConfigWindow_Param_AutoOffWhenDead": "Auto turn off when dead.",
"ConfigWindow_Param_AutoOffWhenDutyCompleted": "Auto turn off when duty completed.",
"ConfigWindow_Param_UseWorkTask": "Use work task for acceleration.",
"ConfigWindow_Param_ToggleManual": "Make /rotation Manual as a toggle command.",
"ConfigWindow_Param_ToggleAuto": "Make /rotation Auto as a toggle 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 @@ -96,6 +96,7 @@ internal class Strings
public string ConfigWindow_Param_AutoOffCutScene { get; set; } = "Auto turn off during cutscenes.";

public string ConfigWindow_Param_AutoOffWhenDead { get; set; } = "Auto turn off when dead.";
public string ConfigWindow_Param_AutoOffWhenDutyCompleted { get; set; } = "Auto turn off when duty completed.";

public string ConfigWindow_Param_UseWorkTask { get; set; } = "Use work task for acceleration.";
public string ConfigWindow_Param_ToggleManual { get; set; } = "Make /rotation Manual as a toggle command.";
Expand Down
5 changes: 3 additions & 2 deletions RotationSolver/UI/RotationConfigWindow_Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -385,10 +385,10 @@ private static void DrawBasicOthers()

new DragFloatRangeSearchPlugin(PluginConfigFloat.NotInCombatDelayMin, PluginConfigFloat.NotInCombatDelayMax, 0.002f),

new CheckBoxSearchPlugin(PluginConfigBool.UseAdditionalConditions),

new CheckBoxSearchPlugin(PluginConfigBool.SayHelloToUsers),
new CheckBoxSearchPlugin(PluginConfigBool.JustSayHelloOnce),

new CheckBoxSearchPlugin(PluginConfigBool.UseAdditionalConditions),
};

private static readonly ISearchable[] _basicSwitchTurnOn = new ISearchable[]
Expand All @@ -403,6 +403,7 @@ private static void DrawBasicOthers()
{
// Turn off
new CheckBoxSearchPlugin(PluginConfigBool.AutoOffBetweenArea),
new CheckBoxSearchPlugin(PluginConfigBool.AutoOffWhenDutyCompleted),
new CheckBoxSearchPlugin(PluginConfigBool.AutoOffCutScene),
new CheckBoxSearchPlugin(PluginConfigBool.AutoOffWhenDead),
new CheckBoxSearchPlugin(PluginConfigBool.AutoOffAfterCombat,
Expand Down
10 changes: 2 additions & 8 deletions RotationSolver/Updaters/MovingUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,9 @@ internal unsafe static void UpdateCanMove(bool doNextAction)
{
Service.CanMove = false;
}
//Not in combat.
else if (!DataCenter.InCombat)
{
Service.CanMove = true;
}
//Special actions.
else
{
var canMove = !Svc.Condition[ConditionFlag.Casting];

var statusList = new List<StatusID>(4);
var actionList = new List<ActionID>(4);

Expand Down Expand Up @@ -60,12 +53,13 @@ internal unsafe static void UpdateCanMove(bool doNextAction)
: doNextAction ? (ActionID)(ActionUpdater.NextAction?.AdjustedID ?? 0) : 0;

var specialActions = ActionManager.GetAdjustedCastTime(ActionType.Action, (uint)action) > 0
&& Enum.IsDefined(action)
|| actionList.Any(id => Service.GetAdjustedActionId(id) == action);

//Status
var specialStatus = Player.Object.HasStatus(true, statusList.ToArray());

Service.CanMove = !specialStatus && !specialActions && canMove;
Service.CanMove = !specialStatus && !specialActions;
}
}
}
6 changes: 6 additions & 0 deletions RotationSolver/Updaters/SocialUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using FFXIVClientStructs.FFXIV.Client.UI;
using Lumina.Excel.GeneratedSheets;
using RotationSolver.Basic.Configuration;
using RotationSolver.Commands;
using RotationSolver.Helpers;
using RotationSolver.Localization;
using System.Diagnostics.CodeAnalysis;
Expand Down Expand Up @@ -70,6 +71,11 @@ static async void DutyState_DutyCompleted(object sender, ushort e)
await Task.Delay(new Random().Next(4000, 6000));

Service.Config.GlobalConfig.DutyEnd.AddMacro();

if (Service.Config.GetValue(PluginConfigBool.AutoOffWhenDutyCompleted))
{
RSCommands.CancelState();
}
}

static void ClientState_TerritoryChanged(ushort id)
Expand Down

0 comments on commit 8bc11f0

Please sign in to comment.