Fix macro generation for combo actions
This commit is contained in:
@@ -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());
|
||||||
|
|||||||
@@ -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)}";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user