1
0
Fork 0

Revert changes to opening the crafting log

master v3.1
Liza 2023-10-19 21:18:51 +02:00
parent 8a29673e0d
commit b94be6a77c
Signed by: liza
GPG Key ID: 7199F8D727D55F67
5 changed files with 18 additions and 68 deletions

View File

@ -45,6 +45,12 @@ partial class WorkshopPlugin
CurrentStage = Stage.TargetFabricationStation;
}
private void OpenCraftingLog()
{
if (SelectSelectString("craftlog", 0, s => s == _gameStrings.ViewCraftingLog))
CurrentStage = Stage.SelectCraftCategory;
}
private unsafe void SelectCraftCategory()
{
AtkUnitBase* addonCraftingLog = GetCompanyCraftingLogAddon();

View File

@ -1,63 +0,0 @@
using System;
using Dalamud.Game.Addon.Lifecycle;
using Dalamud.Game.Addon.Lifecycle.AddonArgTypes;
using Dalamud.Memory;
using FFXIVClientStructs.FFXIV.Client.UI;
namespace Workshoppa;
partial class WorkshopPlugin
{
private unsafe void SelectStringPostSetup(AddonEvent type, AddonArgs args)
{
_pluginLog.Verbose("SelectString post-setup");
string desiredText;
Action followUp;
if (CurrentStage == Stage.OpenCraftingLog)
{
desiredText = _gameStrings.ViewCraftingLog;
followUp = OpenCraftingLogFollowUp;
}
else
return;
_pluginLog.Verbose($"Looking for '{desiredText}' in prompt");
AddonSelectString* addonSelectString = (AddonSelectString*)args.Addon;
int entries = addonSelectString->PopupMenu.PopupMenu.EntryCount;
for (int i = 0; i < entries; ++i)
{
var textPointer = addonSelectString->PopupMenu.PopupMenu.EntryNames[i];
if (textPointer == null)
continue;
var text = MemoryHelper.ReadSeStringNullTerminated((nint)textPointer).ToString();
_pluginLog.Verbose($" Choice {i} → {text}");
if (text == desiredText)
{
_pluginLog.Information($"Selecting choice {i} ({text})");
addonSelectString->AtkUnitBase.FireCallbackInt(i);
followUp();
return;
}
}
_pluginLog.Verbose($"Text '{desiredText}' was not found in prompt.");
}
private void OpenCraftingLogFollowUp()
{
CurrentStage = Stage.SelectCraftCategory;
}
private void ConfirmCollectProductFollowUp()
{
_configuration.CurrentlyCraftedItem = null;
_pluginInterface.SavePluginConfig(_configuration);
CurrentStage = Stage.TakeItemFromQueue;
_continueAt = DateTime.Now.AddSeconds(0.5);
}
}

View File

@ -53,4 +53,13 @@ partial class WorkshopPlugin
}
}
}
private void ConfirmCollectProductFollowUp()
{
_configuration.CurrentlyCraftedItem = null;
_pluginInterface.SavePluginConfig(_configuration);
CurrentStage = Stage.TakeItemFromQueue;
_continueAt = DateTime.Now.AddSeconds(0.5);
}
}

View File

@ -80,7 +80,6 @@ public sealed partial class WorkshopPlugin : IDalamudPlugin
HelpMessage = "Open UI"
});
_addonLifecycle.RegisterListener(AddonEvent.PostSetup, "SelectString", SelectStringPostSetup);
_addonLifecycle.RegisterListener(AddonEvent.PostSetup, "SelectYesno", SelectYesNoPostSetup);
_addonLifecycle.RegisterListener(AddonEvent.PostSetup, "Request", RequestPostSetup);
_addonLifecycle.RegisterListener(AddonEvent.PostRefresh, "Request", RequestPostRefresh);
@ -170,7 +169,7 @@ public sealed partial class WorkshopPlugin : IDalamudPlugin
break;
case Stage.OpenCraftingLog:
// see SelectStringPostSetup
OpenCraftingLog();
break;
case Stage.SelectCraftCategory:
@ -215,7 +214,7 @@ public sealed partial class WorkshopPlugin : IDalamudPlugin
break;
case Stage.ConfirmCollectProduct:
// see SelectStringPostSetup
// see SelectYesNoPostSetup
break;
case Stage.Stopped:
@ -250,7 +249,6 @@ public sealed partial class WorkshopPlugin : IDalamudPlugin
_addonLifecycle.UnregisterListener(AddonEvent.PostRefresh, "Request", RequestPostRefresh);
_addonLifecycle.UnregisterListener(AddonEvent.PostSetup, "Request", RequestPostSetup);
_addonLifecycle.UnregisterListener(AddonEvent.PostSetup, "SelectYesno", SelectYesNoPostSetup);
_addonLifecycle.UnregisterListener(AddonEvent.PostSetup, "SelectString", SelectStringPostSetup);
_commandManager.RemoveHandler("/ws");
_pluginInterface.UiBuilder.Draw -= _windowSystem.Draw;
_pluginInterface.UiBuilder.OpenConfigUi -= _configWindow.Toggle;

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<Version>3.0</Version>
<Version>3.1</Version>
<LangVersion>11.0</LangVersion>
<Nullable>enable</Nullable>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>