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

Commit

Permalink
fix: add toggle for auto command.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Aug 31, 2023
1 parent 59d7ca7 commit ab61790
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 14 deletions.
1 change: 1 addition & 0 deletions RotationSolver.Basic/Configuration/Configs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ public enum PluginConfigBool : byte
[Default(true)] AutoUpdateRotations,

[Default(false)] ToggleManual,
[Default(false)] ToggleAuto,
[Default(true)] OnlyShowWithHostileOrInDuty,
[Default(false)] ShowControlWindow,
[Default(false)] IsControlWindowLock,
Expand Down
4 changes: 3 additions & 1 deletion RotationSolver/Commands/RSCommands_BasicInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ private static void DoOneCommand(string str)
{
if (TryGetOneEnum<StateCommandType>(str, out var stateType))
{
DoStateCommandType(stateType);
var intStr = str.Split(' ', StringSplitOptions.RemoveEmptyEntries).LastOrDefault();
if (!int.TryParse(intStr, out var index)) index = -1;
DoStateCommandType(stateType, index);
}
else if (TryGetOneEnum<SpecialCommandType>(str, out var specialType))
{
Expand Down
36 changes: 23 additions & 13 deletions RotationSolver/Commands/RSCommands_StateSpecialCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,31 @@ private static void UpdateToast()
});
}

private static unsafe void DoStateCommandType(StateCommandType stateType) => DoOneCommandType(EnumTranslations.ToSayout, role =>
private static unsafe void DoStateCommandType(StateCommandType stateType, int index = -1) => DoOneCommandType(EnumTranslations.ToSayout, role =>
{
if (DataCenter.State && !DataCenter.IsManual
&& stateType == StateCommandType.Auto)
if (DataCenter.State)
{
var index = Service.Config.GetValue(Basic.Configuration.PluginConfigInt.TargetingIndex) + 1;
index %= Service.Config.GlobalConfig.TargetingTypes.Count;
Service.Config.SetValue(Basic.Configuration.PluginConfigInt.TargetingIndex, index);
}

if (Service.Config.GetValue(Basic.Configuration.PluginConfigBool.ToggleManual)
&& DataCenter.State && DataCenter.IsManual
&& stateType == StateCommandType.Manual)
{
stateType = StateCommandType.Cancel;
if (DataCenter.IsManual && stateType == StateCommandType.Manual
&& Service.Config.GetValue(Basic.Configuration.PluginConfigBool.ToggleManual))
{
stateType = StateCommandType.Cancel;
}
else if (stateType == StateCommandType.Auto)
{
if (Service.Config.GetValue(Basic.Configuration.PluginConfigBool.ToggleAuto))
{
stateType = StateCommandType.Cancel;
}
else
{
if (index == -1)
{
index = Service.Config.GetValue(Basic.Configuration.PluginConfigInt.TargetingIndex) + 1;
}
index %= Service.Config.GlobalConfig.TargetingTypes.Count;
Service.Config.SetValue(Basic.Configuration.PluginConfigInt.TargetingIndex, index);
}
}
}

switch (stateType)
Expand Down
1 change: 1 addition & 0 deletions RotationSolver/Localization/ConfigTranslation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ internal static class ConfigTranslation
PluginConfigBool.StartOnAttackedBySomeone => LocalizationManager.RightLang.ConfigWindow_Param_StartOnAttackedBySomeone,
PluginConfigBool.UseWorkTask => LocalizationManager.RightLang.ConfigWindow_Param_UseWorkTask,
PluginConfigBool.ToggleManual => LocalizationManager.RightLang.ConfigWindow_Param_ToggleManual,
PluginConfigBool.ToggleAuto => LocalizationManager.RightLang.ConfigWindow_Param_ToggleAuto,
PluginConfigBool.UseStopCasting => LocalizationManager.RightLang.ConfigWindow_Param_UseStopCasting,

// UI
Expand Down
1 change: 1 addition & 0 deletions RotationSolver/Localization/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ internal partial class Strings

public string ConfigWindow_Param_UseWorkTask { get; set; } = "Use work task for acceleration.";
public string ConfigWindow_Param_ToggleManual { get; set; } = "Make Manual Command as toggle.";
public string ConfigWindow_Param_ToggleAuto { get; set; } = "Make Auto Command as toggle.";

public string ConfigWindow_Param_WeaponDelay { get; set; } = "Set the range of random delay for GCD in second.";
public string ConfigWindow_Param_DeathDelay { get; set; } = "Set the range of random delay for using revival abilities in seconds.";
Expand Down
1 change: 1 addition & 0 deletions RotationSolver/UI/RotationConfigWindow_Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ private static void DrawBasicAutoSwitch()
private static readonly ISearchable[] _basicParamsSearchable = new ISearchable[]
{
new CheckBoxSearchPlugin(PluginConfigBool.ToggleManual),
new CheckBoxSearchPlugin(PluginConfigBool.ToggleAuto),

new CheckBoxSearchPlugin(PluginConfigBool.UseWorkTask),

Expand Down

0 comments on commit ab61790

Please sign in to comment.