diff --git a/LLib b/LLib index b5125d4..93fac6e 160000 --- a/LLib +++ b/LLib @@ -1 +1 @@ -Subproject commit b5125d4b3f7cdc0c7514a01764e5b5d4d85f80a7 +Subproject commit 93fac6efb01a1272192d929fd863328271512ea4 diff --git a/Workshoppa/External/ExternalPluginHandler.cs b/Workshoppa/External/ExternalPluginHandler.cs index dc037b0..a833a24 100644 --- a/Workshoppa/External/ExternalPluginHandler.cs +++ b/Workshoppa/External/ExternalPluginHandler.cs @@ -6,13 +6,13 @@ namespace Workshoppa.External; internal sealed class ExternalPluginHandler { - private readonly DalamudPluginInterface _pluginInterface; + private readonly IDalamudPluginInterface _pluginInterface; private readonly IPluginLog _pluginLog; private readonly PandoraIpc _pandoraIpc; private bool? _pandoraState; - public ExternalPluginHandler(DalamudPluginInterface pluginInterface, IPluginLog pluginLog) + public ExternalPluginHandler(IDalamudPluginInterface pluginInterface, IPluginLog pluginLog) { _pluginInterface = pluginInterface; _pluginLog = pluginLog; diff --git a/Workshoppa/External/PandoraIpc.cs b/Workshoppa/External/PandoraIpc.cs index 912bcef..f9708b0 100644 --- a/Workshoppa/External/PandoraIpc.cs +++ b/Workshoppa/External/PandoraIpc.cs @@ -13,7 +13,7 @@ internal sealed class PandoraIpc private readonly ICallGateSubscriber _getEnabled; private readonly ICallGateSubscriber _setEnabled; - public PandoraIpc(DalamudPluginInterface pluginInterface, IPluginLog pluginLog) + public PandoraIpc(IDalamudPluginInterface pluginInterface, IPluginLog pluginLog) { _pluginLog = pluginLog; _getEnabled = pluginInterface.GetIpcSubscriber("PandorasBox.GetFeatureEnabled"); diff --git a/Workshoppa/Windows/ConfigWindow.cs b/Workshoppa/Windows/ConfigWindow.cs index cb07558..150fc00 100644 --- a/Workshoppa/Windows/ConfigWindow.cs +++ b/Workshoppa/Windows/ConfigWindow.cs @@ -7,10 +7,10 @@ namespace Workshoppa.Windows; internal sealed class ConfigWindow : LWindow, IPersistableWindowConfig { - private readonly DalamudPluginInterface _pluginInterface; + private readonly IDalamudPluginInterface _pluginInterface; private readonly Configuration _configuration; - public ConfigWindow(DalamudPluginInterface pluginInterface, Configuration configuration) + public ConfigWindow(IDalamudPluginInterface pluginInterface, Configuration configuration) : base("Workshoppa - Configuration###WorkshoppaConfigWindow") { diff --git a/Workshoppa/Windows/MainWindow.cs b/Workshoppa/Windows/MainWindow.cs index 14901ac..61488e8 100644 --- a/Workshoppa/Windows/MainWindow.cs +++ b/Workshoppa/Windows/MainWindow.cs @@ -7,7 +7,7 @@ using System.Text.RegularExpressions; using Dalamud.Interface; using Dalamud.Interface.Colors; using Dalamud.Interface.Components; -using Dalamud.Interface.Internal; +using Dalamud.Interface.Textures.TextureWraps; using Dalamud.Plugin; using Dalamud.Plugin.Services; using FFXIVClientStructs.FFXIV.Client.Game; @@ -24,7 +24,7 @@ internal sealed class MainWindow : LWindow, IPersistableWindowConfig private static readonly Regex CountAndName = new(@"^(\d{1,5})x?\s+(.*)$", RegexOptions.Compiled); private readonly WorkshopPlugin _plugin; - private readonly DalamudPluginInterface _pluginInterface; + private readonly IDalamudPluginInterface _pluginInterface; private readonly IClientState _clientState; private readonly Configuration _configuration; private readonly WorkshopCache _workshopCache; @@ -37,7 +37,7 @@ internal sealed class MainWindow : LWindow, IPersistableWindowConfig private bool _checkInventory; private string _newPresetName = string.Empty; - public MainWindow(WorkshopPlugin plugin, DalamudPluginInterface pluginInterface, IClientState clientState, + public MainWindow(WorkshopPlugin plugin, IDalamudPluginInterface pluginInterface, IClientState clientState, Configuration configuration, WorkshopCache workshopCache, IconCache iconCache, IChatGui chatGui, RecipeTree recipeTree, IPluginLog pluginLog) : base("Workshoppa###WorkshoppaMainWindow") @@ -547,6 +547,8 @@ internal sealed class MainWindow : LWindow, IPersistableWindowConfig ImGui.Image(icon.ImGuiHandle, new Vector2(ImGui.GetFrameHeight())); ImGui.SameLine(0, ImGui.GetStyle().ItemInnerSpacing.X); ImGui.SetCursorPosY(ImGui.GetCursorPosY() + (ImGui.GetFrameHeight() - ImGui.GetTextLineHeight()) / 2); + + icon.Dispose(); } ImGui.TextColored(inInventory >= item.TotalQuantity ? ImGuiColors.HealerGreen : ImGuiColors.DalamudRed, diff --git a/Workshoppa/WorkshopPlugin.CraftingLog.cs b/Workshoppa/WorkshopPlugin.CraftingLog.cs index f9b5b74..89ace33 100644 --- a/Workshoppa/WorkshopPlugin.CraftingLog.cs +++ b/Workshoppa/WorkshopPlugin.CraftingLog.cs @@ -9,7 +9,7 @@ namespace Workshoppa; partial class WorkshopPlugin { - private void InteractWithFabricationStation(GameObject fabricationStation) + private void InteractWithFabricationStation(IGameObject fabricationStation) => InteractWithTarget(fabricationStation); private void TakeItemFromQueue() diff --git a/Workshoppa/WorkshopPlugin.GameFunctions.cs b/Workshoppa/WorkshopPlugin.GameFunctions.cs index 04f69e7..c267d4f 100644 --- a/Workshoppa/WorkshopPlugin.GameFunctions.cs +++ b/Workshoppa/WorkshopPlugin.GameFunctions.cs @@ -18,7 +18,7 @@ namespace Workshoppa; partial class WorkshopPlugin { - private unsafe void InteractWithTarget(GameObject obj) + private unsafe void InteractWithTarget(IGameObject obj) { _pluginLog.Information($"Setting target to {obj}"); /* @@ -31,7 +31,7 @@ partial class WorkshopPlugin (FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject*)obj.Address, false); } - private float GetDistanceToEventObject(IReadOnlyList npcIds, out GameObject? o) + private float GetDistanceToEventObject(IReadOnlyList npcIds, out IGameObject? o) { Vector3? localPlayerPosition = _clientState.LocalPlayer?.Position; if (localPlayerPosition != null) @@ -40,7 +40,7 @@ partial class WorkshopPlugin { if (obj.ObjectKind == ObjectKind.EventObj) { - if (npcIds.Contains(GetNpcId(obj))) + if (npcIds.Contains(obj.DataId)) { o = obj; float distance = Vector3.Distance(localPlayerPosition.Value, @@ -56,12 +56,6 @@ partial class WorkshopPlugin return float.MaxValue; } - private unsafe uint GetNpcId(GameObject obj) - { - return ((FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject*)obj.Address)->GetNpcID(); - } - - private unsafe AtkUnitBase* GetCompanyCraftingLogAddon() { if (_gameGui.TryGetAddonByName("CompanyCraftRecipeNoteBook", out var addon) && @@ -80,7 +74,7 @@ partial class WorkshopPlugin var agentInterface = AgentModule.Instance()->GetAgentByInternalId(AgentId.CompanyCraftMaterial); if (agentInterface != null && agentInterface->IsAgentActive()) { - var addonId = agentInterface->GetAddonID(); + var addonId = agentInterface->GetAddonId(); if (addonId == 0) return null; @@ -224,7 +218,7 @@ partial class WorkshopPlugin if (item == null) continue; - if (item->ItemID == itemId && item->Quantity >= count) + if (item->ItemId == itemId && item->Quantity >= count) return true; } } @@ -247,7 +241,7 @@ partial class WorkshopPlugin for (int i = 0; i < container->Size; ++i) { var item = container->GetInventorySlot(i); - if (item == null || item->ItemID == 0) + if (item == null || item->ItemId == 0) ++count; } } @@ -270,10 +264,10 @@ partial class WorkshopPlugin for (int i = 0; i < container->Size; ++i) { var item = container->GetInventorySlot(i); - if (item == null || item->ItemID == 0) + if (item == null || item->ItemId == 0) continue; - if (item->ItemID == itemId && predicate((int)item->Quantity)) + if (item->ItemId == itemId && predicate((int)item->Quantity)) ++count; } } @@ -294,10 +288,10 @@ partial class WorkshopPlugin for (int i = 0; i < container->Size; ++i) { var item = container->GetInventorySlot(i); - if (item == null || item->ItemID == 0) + if (item == null || item->ItemId == 0) return 99; - if (item->ItemID == itemId) + if (item->ItemId == itemId) { max += (999 - (int)item->Quantity); if (max >= 99) diff --git a/Workshoppa/WorkshopPlugin.cs b/Workshoppa/WorkshopPlugin.cs index 8f1b509..12328e6 100644 --- a/Workshoppa/WorkshopPlugin.cs +++ b/Workshoppa/WorkshopPlugin.cs @@ -25,7 +25,7 @@ public sealed partial class WorkshopPlugin : IDalamudPlugin internal readonly IReadOnlyList WorkshopTerritories = new ushort[] { 423, 424, 425, 653, 984 }.AsReadOnly(); private readonly WindowSystem _windowSystem = new WindowSystem(nameof(WorkshopPlugin)); - private readonly DalamudPluginInterface _pluginInterface; + private readonly IDalamudPluginInterface _pluginInterface; private readonly IGameGui _gameGui; private readonly IFramework _framework; private readonly ICondition _condition; @@ -50,7 +50,7 @@ public sealed partial class WorkshopPlugin : IDalamudPlugin private DateTime _continueAt = DateTime.MinValue; private DateTime _fallbackAt = DateTime.MaxValue; - public WorkshopPlugin(DalamudPluginInterface pluginInterface, IGameGui gameGui, IFramework framework, + public WorkshopPlugin(IDalamudPluginInterface pluginInterface, IGameGui gameGui, IFramework framework, ICondition condition, IClientState clientState, IObjectTable objectTable, IDataManager dataManager, ICommandManager commandManager, IPluginLog pluginLog, IAddonLifecycle addonLifecycle, IChatGui chatGui, ITextureProvider textureProvider) diff --git a/Workshoppa/Workshoppa.csproj b/Workshoppa/Workshoppa.csproj index 5d3d5c2..5f2ce86 100644 --- a/Workshoppa/Workshoppa.csproj +++ b/Workshoppa/Workshoppa.csproj @@ -1,68 +1,13 @@ - + - net8.0-windows - 5.5 - 11.0 - enable - true - false - false + 6.0 dist - true - portable - $(SolutionDir)=X:\ - true - portable - - $(appdata)\XIVLauncher\addon\Hooks\dev\ - - - - $(DALAMUD_HOME)/ - + + - - - - - - - - $(DalamudLibPath)Dalamud.dll - false - - - $(DalamudLibPath)ImGui.NET.dll - false - - - $(DalamudLibPath)Lumina.dll - false - - - $(DalamudLibPath)Lumina.Excel.dll - false - - - $(DalamudLibPath)Newtonsoft.Json.dll - false - - - $(DalamudLibPath)FFXIVClientStructs.dll - false - - - $(DalamudLibPath)FFXIVClientStructs.dll - false - - - - - - diff --git a/Workshoppa/packages.lock.json b/Workshoppa/packages.lock.json index 9cba519..f5ad582 100644 --- a/Workshoppa/packages.lock.json +++ b/Workshoppa/packages.lock.json @@ -4,12 +4,83 @@ "net8.0-windows7.0": { "DalamudPackager": { "type": "Direct", - "requested": "[2.1.12, )", - "resolved": "2.1.12", - "contentHash": "Sc0PVxvgg4NQjcI8n10/VfUQBAS4O+Fw2pZrAqBdRMbthYGeogzu5+xmIGCGmsEZ/ukMOBuAqiNiB5qA3MRalg==" + "requested": "[2.1.13, )", + "resolved": "2.1.13", + "contentHash": "rMN1omGe8536f4xLMvx9NwfvpAc9YFFfeXJ1t4P4PE6Gu8WCIoFliR1sh07hM+bfODmesk/dvMbji7vNI+B/pQ==" + }, + "DotNet.ReproducibleBuilds": { + "type": "Direct", + "requested": "[1.1.1, )", + "resolved": "1.1.1", + "contentHash": "+H2t/t34h6mhEoUvHi8yGXyuZ2GjSovcGYehJrS2MDm2XgmPfZL2Sdxg+uL2lKgZ4M6tTwKHIlxOob2bgh0NRQ==", + "dependencies": { + "Microsoft.SourceLink.AzureRepos.Git": "1.1.1", + "Microsoft.SourceLink.Bitbucket.Git": "1.1.1", + "Microsoft.SourceLink.GitHub": "1.1.1", + "Microsoft.SourceLink.GitLab": "1.1.1" + } + }, + "Microsoft.SourceLink.Gitea": { + "type": "Direct", + "requested": "[8.0.0, )", + "resolved": "8.0.0", + "contentHash": "KOBodmDnlWGIqZt2hT47Q69TIoGhIApDVLCyyj9TT5ct8ju16AbHYcB4XeknoHX562wO1pMS/1DfBIZK+V+sxg==", + "dependencies": { + "Microsoft.Build.Tasks.Git": "8.0.0", + "Microsoft.SourceLink.Common": "8.0.0" + } + }, + "Microsoft.Build.Tasks.Git": { + "type": "Transitive", + "resolved": "8.0.0", + "contentHash": "bZKfSIKJRXLTuSzLudMFte/8CempWjVamNUR5eHJizsy+iuOuO/k2gnh7W0dHJmYY0tBf+gUErfluCv5mySAOQ==" + }, + "Microsoft.SourceLink.AzureRepos.Git": { + "type": "Transitive", + "resolved": "1.1.1", + "contentHash": "qB5urvw9LO2bG3eVAkuL+2ughxz2rR7aYgm2iyrB8Rlk9cp2ndvGRCvehk3rNIhRuNtQaeKwctOl1KvWiklv5w==", + "dependencies": { + "Microsoft.Build.Tasks.Git": "1.1.1", + "Microsoft.SourceLink.Common": "1.1.1" + } + }, + "Microsoft.SourceLink.Bitbucket.Git": { + "type": "Transitive", + "resolved": "1.1.1", + "contentHash": "cDzxXwlyWpLWaH0em4Idj0H3AmVo3L/6xRXKssYemx+7W52iNskj/SQ4FOmfCb8YQt39otTDNMveCZzYtMoucQ==", + "dependencies": { + "Microsoft.Build.Tasks.Git": "1.1.1", + "Microsoft.SourceLink.Common": "1.1.1" + } + }, + "Microsoft.SourceLink.Common": { + "type": "Transitive", + "resolved": "8.0.0", + "contentHash": "dk9JPxTCIevS75HyEQ0E4OVAFhB2N+V9ShCXf8Q6FkUQZDkgLI12y679Nym1YqsiSysuQskT7Z+6nUf3yab6Vw==" + }, + "Microsoft.SourceLink.GitHub": { + "type": "Transitive", + "resolved": "1.1.1", + "contentHash": "IaJGnOv/M7UQjRJks7B6p7pbPnOwisYGOIzqCz5ilGFTApZ3ktOR+6zJ12ZRPInulBmdAf1SrGdDG2MU8g6XTw==", + "dependencies": { + "Microsoft.Build.Tasks.Git": "1.1.1", + "Microsoft.SourceLink.Common": "1.1.1" + } + }, + "Microsoft.SourceLink.GitLab": { + "type": "Transitive", + "resolved": "1.1.1", + "contentHash": "tvsg47DDLqqedlPeYVE2lmiTpND8F0hkrealQ5hYltSmvruy/Gr5nHAKSsjyw5L3NeM/HLMI5ORv7on/M4qyZw==", + "dependencies": { + "Microsoft.Build.Tasks.Git": "1.1.1", + "Microsoft.SourceLink.Common": "1.1.1" + } }, "llib": { - "type": "Project" + "type": "Project", + "dependencies": { + "DalamudPackager": "[2.1.13, )" + } } } }