Fix macro generation for combo actions

This commit is contained in:
Asriel Camora
2023-07-14 23:56:30 +04:00
parent 5ab53f56b9
commit eae91d6d02
2 changed files with 14 additions and 3 deletions
+13 -2
View File
@@ -362,18 +362,29 @@ public unsafe class CraftingLog : Window
Service.Plugin.OpenSimulatorWindow(Recipe.ItemResult.Value!, Recipe.IsExpert, CharacterSimulationInput, RecipeClassJob, macro); Service.Plugin.OpenSimulatorWindow(Recipe.ItemResult.Value!, Recipe.IsExpert, CharacterSimulationInput, RecipeClassJob, macro);
} }
private string GetMacroCommand(ActionType action, bool addWaitTimes)
{
var actionBase = action.Base();
if (actionBase is BaseComboAction comboActionBase)
return $"{GetMacroCommand(comboActionBase.ActionTypeA, addWaitTimes)}\n{GetMacroCommand(comboActionBase.ActionTypeB, addWaitTimes)}";
if (addWaitTimes)
return $"/ac \"{action.GetName(RecipeClassJob)}\" <wait.{actionBase.MacroWaitTime}>";
else
return $"/ac \"{action.GetName(RecipeClassJob)}\"";
}
private void CopyMacroToClipboard(Macro macro) private void CopyMacroToClipboard(Macro macro)
{ {
var s = new StringBuilder(); var s = new StringBuilder();
if (ImGui.IsKeyDown(ImGuiKey.ModShift)) if (ImGui.IsKeyDown(ImGuiKey.ModShift))
{ {
foreach (var action in macro.Actions) foreach (var action in macro.Actions)
s.AppendLine($"/ac \"{action.GetName(RecipeClassJob)}\""); s.AppendLine(GetMacroCommand(action, false));
} }
else else
{ {
foreach (var action in macro.Actions) foreach (var action in macro.Actions)
s.AppendLine($"/ac \"{action.GetName(RecipeClassJob)}\" <wait.{action.Base().MacroWaitTime}>"); s.AppendLine(GetMacroCommand(action, true));
s.AppendLine($"/echo Macro Complete! <se.1>"); s.AppendLine($"/echo Macro Complete! <se.1>");
} }
ImGui.SetClipboardText(s.ToString()); ImGui.SetClipboardText(s.ToString());
+1 -1
View File
@@ -23,5 +23,5 @@ internal abstract class BaseComboAction<A, B> : BaseComboAction where A : BaseAc
} }
public override string GetTooltip(Simulator s, bool addUsability) => public override string GetTooltip(Simulator s, bool addUsability) =>
$"{ActionA.GetTooltip(s, addUsability)}\n{ActionB.GetTooltip(s, addUsability)}"; $"{ActionA.GetTooltip(s, addUsability)}\n\n{ActionB.GetTooltip(s, addUsability)}";
} }