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

Commit

Permalink
fix: changed macro.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed May 1, 2023
1 parent 1cfc28b commit 58c837c
Show file tree
Hide file tree
Showing 12 changed files with 123 additions and 30 deletions.
80 changes: 80 additions & 0 deletions Resources/InputConfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"KeyState": {},
"KeySpecial": {},
"KeyDoAction": null,
"ButtonState": {
"Auto": {
"button": 128,
"l2": false,
"r2": true
},
"Manual": {
"button": 16,
"l2": false,
"r2": true
},
"Cancel": {
"button": 32,
"l2": false,
"r2": true
}
},
"ButtonSpecial": {
"EndSpecial": {
"button": 64,
"l2": false,
"r2": true
},
"EsunaStanceNorth": {
"button": 8,
"l2": false,
"r2": true
},
"MoveForward": {
"button": 1,
"l2": false,
"r2": true
},
"MoveBack": {
"button": 2,
"l2": false,
"r2": true
},
"RaiseShirk": {
"button": 4,
"l2": false,
"r2": true
},
"DefenseArea": {
"button": 16,
"l2": true,
"r2": false
},
"DefenseSingle": {
"button": 128,
"l2": true,
"r2": false
},
"HealArea": {
"button": 32,
"l2": true,
"r2": false
},
"HealSingle": {
"button": 64,
"l2": true,
"r2": false
},
"Burst": {
"button": 2,
"l2": true,
"r2": false
},
"AntiKnockback": {
"button": 1,
"l2": true,
"r2": false
}
},
"ButtonDoAction": null
}
4 changes: 2 additions & 2 deletions RotationSolver.Basic/Actions/BaseAction_Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ private bool TargetDeath(out BattleChara target)
private bool TargetHostile(float range, bool mustUse, int aoeCount, out BattleChara target)
{
//如果不用自动找目标,那就直接返回。
if (DataCenter.StateType == StateCommandType.ManualTarget)
if (DataCenter.StateType == StateCommandType.Manual)
{
if (Service.TargetManager.Target is BattleChara b && b.IsNPCEnemy() && b.DistanceToPlayer() <= range)
{
Expand Down Expand Up @@ -335,7 +335,7 @@ private bool TargetSelf(bool mustUse, int aoeCount)
}

//not use when aoe.
if (DataCenter.StateType == StateCommandType.ManualTarget)
if (DataCenter.StateType == StateCommandType.Manual)
{
if (!Service.Config.GetValue(SettingsCommand.UseAOEWhenManual) && !mustUse) return false;
}
Expand Down
4 changes: 2 additions & 2 deletions RotationSolver.Basic/Configuration/OtherConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ public class InputConfiguration
public KeyRecord KeyDoAction { get; set; } = null;
public Dictionary<StateCommandType, ButtonRecord> ButtonState { get; set; } = new Dictionary<StateCommandType, ButtonRecord>()
{
{StateCommandType.AutoTarget, new ButtonRecord( GamepadButtons.East, false, true) },
{StateCommandType.ManualTarget, new ButtonRecord( GamepadButtons.North, false, true) },
{StateCommandType.Auto, new ButtonRecord( GamepadButtons.East, false, true) },
{StateCommandType.Manual, new ButtonRecord( GamepadButtons.North, false, true) },
{StateCommandType.Cancel, new ButtonRecord( GamepadButtons.South, false, true) },
};
public Dictionary<SpecialCommandType, ButtonRecord> ButtonSpecial { get; set; } = new Dictionary<SpecialCommandType, ButtonRecord>()
Expand Down
4 changes: 2 additions & 2 deletions RotationSolver.Basic/Data/RSCommandType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ public enum SpecialCommandType : byte
public enum StateCommandType : byte
{
Cancel,
AutoTarget,
ManualTarget,
Auto,
Manual,

None,
}
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 @@ -146,7 +146,7 @@ internal static void UpdateRotationState()
_lastCountdownTime = Service.CountDownTime;
if (DataCenter.StateType == StateCommandType.Cancel)
{
DoStateCommandType(StateCommandType.AutoTarget);
DoStateCommandType(StateCommandType.Auto);
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions RotationSolver/Commands/RSCommands_StateSpecialCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace RotationSolver.Commands
public static partial class RSCommands
{
private static string _stateString = "Off", _specialString = string.Empty;
private static string _aoeString => "AOE " + (Service.Config.GetValue(SettingsCommand.UseAOEAction) && (DataCenter.StateType != StateCommandType.ManualTarget || Service.Config.GetValue(SettingsCommand.UseAOEWhenManual)) ? "on" : "off");
private static string _aoeString => "AOE " + (Service.Config.GetValue(SettingsCommand.UseAOEAction) && (DataCenter.StateType != StateCommandType.Manual || Service.Config.GetValue(SettingsCommand.UseAOEWhenManual)) ? "on" : "off");

private static string _preventString => "Prevent " + (Service.Config.GetValue(SettingsCommand.PreventActions) ? "on" : "off");

Expand All @@ -24,16 +24,16 @@ private static void UpdateToast()

private static unsafe void DoStateCommandType(StateCommandType stateType) => DoOneCommandType(stateType, EnumTranslations.ToSayout, role =>
{
if (DataCenter.StateType == StateCommandType.AutoTarget
&& stateType == StateCommandType.AutoTarget)
if (DataCenter.StateType == StateCommandType.Auto
&& stateType == StateCommandType.Auto)
{
Service.Config.TargetingIndex += 1;
Service.Config.TargetingIndex %= Service.Config.TargetingTypes.Count;
}

if (Service.Config.ToggleManual
&& DataCenter.StateType == StateCommandType.ManualTarget
&& stateType == StateCommandType.ManualTarget)
&& DataCenter.StateType == StateCommandType.Manual
&& stateType == StateCommandType.Manual)
{
stateType = StateCommandType.Cancel;
}
Expand Down
8 changes: 4 additions & 4 deletions RotationSolver/Localization/EnumTranslations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ internal static class EnumTranslations

internal static string ToStateString(this StateCommandType type, JobRole role) => type switch
{
StateCommandType.AutoTarget => LocalizationManager.RightLang.SpecialCommandType_Smart + RSCommands.TargetingType.ToName(),
StateCommandType.ManualTarget => LocalizationManager.RightLang.SpecialCommandType_Manual,
StateCommandType.Auto => LocalizationManager.RightLang.SpecialCommandType_Smart + RSCommands.TargetingType.ToName(),
StateCommandType.Manual => LocalizationManager.RightLang.SpecialCommandType_Manual,
StateCommandType.Cancel => LocalizationManager.RightLang.SpecialCommandType_Off,
_ => string.Empty,
};
Expand All @@ -170,8 +170,8 @@ internal static class EnumTranslations

internal static string ToHelp(this StateCommandType type) => type switch
{
StateCommandType.AutoTarget => LocalizationManager.RightLang.ConfigWindow_HelpItem_AttackSmart,
StateCommandType.ManualTarget => LocalizationManager.RightLang.ConfigWindow_HelpItem_AttackManual,
StateCommandType.Auto => LocalizationManager.RightLang.ConfigWindow_HelpItem_AttackAuto,
StateCommandType.Manual => LocalizationManager.RightLang.ConfigWindow_HelpItem_AttackManual,
StateCommandType.Cancel => LocalizationManager.RightLang.ConfigWindow_HelpItem_AttackCancel,
_ => string.Empty,
};
Expand Down
4 changes: 2 additions & 2 deletions RotationSolver/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"ConfigWindow_HelpItem": "Help",
"ConfigWindow_ActionItem_Description": "Modify the usage for each action.",
"ConfigWindow_HelpItem_Description": "In this window, you can see all Rotation Solver built-in commands for combat. ",
"ConfigWindow_HelpItem_AttackSmart": "Start attacking in smart mode(auto-targeting) when out of combat, otherwise switch the target according to the conditions.",
"ConfigWindow_HelpItem_AttackManual": "Start attacking in manual mode. You need to choose the target manually.",
"ConfigWindow_HelpItem_AttackAuto": "Start attacking in auto target mode when out of combat, otherwise switch the target according to the conditions.",
"ConfigWindow_HelpItem_AttackManual": "Start attacking in manual target mode. You need to choose the target manually.",
"ConfigWindow_HelpItem_AttackCancel": "Stop attacking. Remember to turn it off when not in use!",
"ConfigWindow_HelpItem_HealArea": "Open a window to use AoE heal.",
"ConfigWindow_HelpItem_HealSingle": "Open a window to use single heal.",
Expand Down
6 changes: 3 additions & 3 deletions RotationSolver/Localization/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ internal partial class Strings
public string ConfigWindow_HelpItem_Description { get; set; }
= "In this window, you can see all Rotation Solver built-in commands for combat. ";

public string ConfigWindow_HelpItem_AttackSmart { get; set; }
= "Start attacking in smart mode(auto-targeting) when out of combat, otherwise switch the target according to the conditions.";
public string ConfigWindow_HelpItem_AttackAuto { get; set; }
= "Start attacking in auto target mode when out of combat, otherwise switch the target according to the conditions.";

public string ConfigWindow_HelpItem_AttackManual { get; set; }
= "Start attacking in manual mode. You need to choose the target manually.";
= "Start attacking in manual target mode. You need to choose the target manually.";

public string ConfigWindow_HelpItem_AttackCancel { get; set; }
= "Stop attacking. Remember to turn it off when not in use!";
Expand Down
23 changes: 18 additions & 5 deletions RotationSolver/UI/ControlWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal class ControlWindow : Window
public ControlWindow()
: base(nameof(ControlWindow), BaseFlags)
{
Size = new Vector2(540f, 300f);
Size = new Vector2(570f, 300f);
SizeCondition = ImGuiCond.FirstUseEver;
}

Expand Down Expand Up @@ -55,30 +55,43 @@ public override void Draw()
var ability = Service.Config.ControlWindow0GCDSize * Service.Config.ControlWindowNextSizeRatio;
var width = gcd + ability + ImGui.GetStyle().ItemSpacing.X;

ImGui.SetColumnWidth(0, width + ImGui.GetStyle().ColumnsMinSpacing * 2);
ImGui.SetColumnWidth(1, 8);

DrawNextAction(gcd, ability, width);

ImGui.SameLine();
var columnWidth = ImGui.GetCursorPosX();
ImGui.NewLine();

ImGui.Spacing();

DrawCommandAction(61751, StateCommandType.ManualTarget, ImGuiColors.DPSRed);
DrawCommandAction(61751, StateCommandType.Manual, ImGuiColors.DPSRed);

ImGui.SameLine();
DrawCommandAction(61764, StateCommandType.Cancel, ImGuiColors.DalamudWhite2);

DrawCommandAction(61822, StateCommandType.AutoTarget, ImGuiColors.DPSRed);
ImGui.SameLine();
columnWidth = Math.Max(columnWidth, ImGui.GetCursorPosX());
ImGui.NewLine();

DrawCommandAction(61822, StateCommandType.Auto, ImGuiColors.DPSRed);

ImGui.SameLine();

ImGui.BeginGroup();

ImGui.Text(DataCenter.TargetingType.ToName());
ImGui.TextColored(ImGuiColors.DPSRed, DataCenter.TargetingType.ToName());

RotationConfigWindow.DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Control_IsInfoWindowNoMove,
ref Service.Config.IsControlWindowLock, Service.Default.IsControlWindowLock);
ImGui.EndGroup();

ImGui.SameLine();
columnWidth = Math.Max(columnWidth, ImGui.GetCursorPosX());
ImGui.NewLine();

ImGui.SetColumnWidth(0, columnWidth);

ImGui.NextColumn();
ImGui.NextColumn();

Expand Down
4 changes: 2 additions & 2 deletions RotationSolver/UI/RotationConfigWindow_Control.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ private void DrawControlTab()
DrawColor4(LocalizationManager.RightLang.ConfigWindow_Control_InfoWindowBg,
ref Service.Config.InfoWindowBg, Service.Default.InfoWindowBg);

DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Control_IsInfoWindowNoInputs,
DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Control_IsInfoWindowNoInputs + "##Info",
ref Service.Config.IsInfoWindowNoInputs, Service.Default.IsInfoWindowNoInputs);

DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Control_IsInfoWindowNoMove,
Expand Down Expand Up @@ -68,7 +68,7 @@ private void DrawControlTab()

if (Service.Config.ShowControlWindow)
{
DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Control_IsInfoWindowNoInputs,
DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Control_IsInfoWindowNoInputs + "##Control",
ref Service.Config.IsControlWindowLock, Service.Default.IsControlWindowLock);

if (Service.Config.IsControlWindowLock)
Expand Down
4 changes: 2 additions & 2 deletions RotationSolver/UI/RotationConfigWindow_Help.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ private void DrawHelpTab()
{
ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, new Vector2(0f, 5f));

StateCommandType.AutoTarget.DisplayCommandHelp(getHelp: EnumTranslations.ToHelp);
StateCommandType.Auto.DisplayCommandHelp(getHelp: EnumTranslations.ToHelp);

StateCommandType.ManualTarget.DisplayCommandHelp(getHelp: EnumTranslations.ToHelp);
StateCommandType.Manual.DisplayCommandHelp(getHelp: EnumTranslations.ToHelp);

StateCommandType.Cancel.DisplayCommandHelp(getHelp: EnumTranslations.ToHelp);

Expand Down

0 comments on commit 58c837c

Please sign in to comment.