From 0bfa666099a7b6f5f585764b302e34ba5c411d38 Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Wed, 11 Oct 2023 10:05:58 +0200 Subject: [PATCH] Add LLib --- .gitmodules | 3 +++ ARDiscard.sln | 6 ++++++ ARDiscard/ARDiscard.csproj | 7 +++++-- ARDiscard/AutoDiscardPlogon.cs | 2 +- ARDiscard/Windows/ConfigWindow.cs | 16 ++++++++++++++-- ARDiscard/Windows/DiscardWindow.cs | 12 +++++++++--- ARDiscard/packages.lock.json | 3 +++ LLib | 1 + 8 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 .gitmodules create mode 160000 LLib diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..9124e51 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "LLib"] + path = LLib + url = git@git.carvel.li:liza/LLib.git diff --git a/ARDiscard.sln b/ARDiscard.sln index 4fc5e8b..351049b 100644 --- a/ARDiscard.sln +++ b/ARDiscard.sln @@ -2,6 +2,8 @@ Microsoft Visual Studio Solution File, Format Version 12.00 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ARDiscard", "ARDiscard\ARDiscard.csproj", "{A9B4C542-1C83-4F46-81E7-5BAFCA109767}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LLib", "LLib\LLib.csproj", "{2E159617-A667-4EC8-B3A8-8B087315C181}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -12,5 +14,9 @@ Global {A9B4C542-1C83-4F46-81E7-5BAFCA109767}.Debug|Any CPU.Build.0 = Debug|Any CPU {A9B4C542-1C83-4F46-81E7-5BAFCA109767}.Release|Any CPU.ActiveCfg = Release|Any CPU {A9B4C542-1C83-4F46-81E7-5BAFCA109767}.Release|Any CPU.Build.0 = Release|Any CPU + {2E159617-A667-4EC8-B3A8-8B087315C181}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2E159617-A667-4EC8-B3A8-8B087315C181}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2E159617-A667-4EC8-B3A8-8B087315C181}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2E159617-A667-4EC8-B3A8-8B087315C181}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/ARDiscard/ARDiscard.csproj b/ARDiscard/ARDiscard.csproj index 376f7d7..466d1c3 100644 --- a/ARDiscard/ARDiscard.csproj +++ b/ARDiscard/ARDiscard.csproj @@ -17,13 +17,17 @@ $(appdata)\XIVLauncher\addon\Hooks\dev\ - $(appdata)\XIVLauncher\installedPlugins\AutoRetainer\4.2.0.6\ + $(appdata)\XIVLauncher\installedPlugins\AutoRetainer\4.2.1.1\ $(DALAMUD_HOME)/ + + + + @@ -65,7 +69,6 @@ - diff --git a/ARDiscard/AutoDiscardPlogon.cs b/ARDiscard/AutoDiscardPlogon.cs index 7b1a238..d2dc015 100644 --- a/ARDiscard/AutoDiscardPlogon.cs +++ b/ARDiscard/AutoDiscardPlogon.cs @@ -68,7 +68,7 @@ public class AutoDiscardPlogon : IDalamudPlugin _pluginInterface.UiBuilder.Draw += _windowSystem.Draw; _pluginInterface.UiBuilder.OpenConfigUi += OpenConfigUi; - _discardWindow = new(_inventoryUtils, itemCache, clientState, condition); + _discardWindow = new(_pluginInterface, _inventoryUtils, itemCache, clientState, condition); _windowSystem.AddWindow(_discardWindow); _configWindow = new(_pluginInterface, _configuration, itemCache, clientState, condition); diff --git a/ARDiscard/Windows/ConfigWindow.cs b/ARDiscard/Windows/ConfigWindow.cs index 02734a7..e6ef117 100644 --- a/ARDiscard/Windows/ConfigWindow.cs +++ b/ARDiscard/Windows/ConfigWindow.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Numerics; +using System.Threading.Tasks; using ARDiscard.GameData; using Dalamud.Game.ClientState.Conditions; using Dalamud.Interface.Colors; @@ -11,6 +12,7 @@ using Dalamud.Plugin; using Dalamud.Plugin.Services; using ECommons; using ImGuiNET; +using LLib; namespace ARDiscard.Windows; @@ -56,6 +58,8 @@ internal sealed class ConfigWindow : Window public override void Draw() { + LImGui.AddPatreonIcon(_pluginInterface); + bool runAfterVenture = _configuration.RunAfterVenture; if (ImGui.Checkbox("[Global] Run automatically after AutoRetainer's venture", ref runAfterVenture)) { @@ -372,20 +376,28 @@ internal sealed class ConfigWindow : Window ConfigSaved?.Invoke(this, EventArgs.Empty); } - internal void AddToDiscardList(uint itemId) + internal bool AddToDiscardList(uint itemId) { var item = EnsureAllItemsLoaded().SingleOrDefault(x => x.ItemId == itemId); if (item.ItemId != 0) { _discarding.Add(item); Save(); + return true; } + + return false; } - internal void RemoveFromDiscardList(uint itemId) + internal bool RemoveFromDiscardList(uint itemId) { if (_discarding.RemoveAll(x => x.ItemId == itemId) > 0) + { Save(); + return true; + } + + return false; } public bool CanItemBeConfigured(uint itemId) diff --git a/ARDiscard/Windows/DiscardWindow.cs b/ARDiscard/Windows/DiscardWindow.cs index 531d362..ca2075e 100644 --- a/ARDiscard/Windows/DiscardWindow.cs +++ b/ARDiscard/Windows/DiscardWindow.cs @@ -5,9 +5,11 @@ using ARDiscard.GameData; using Dalamud.Game.ClientState.Conditions; using Dalamud.Interface.Utility; using Dalamud.Interface.Windowing; +using Dalamud.Plugin; using Dalamud.Plugin.Services; using FFXIVClientStructs.FFXIV.Common.Math; using ImGuiNET; +using LLib; namespace ARDiscard.Windows; @@ -17,20 +19,22 @@ internal sealed class DiscardWindow : Window private readonly ItemCache _itemCache; private readonly IClientState _clientState; private readonly ICondition _condition; + private readonly DalamudPluginInterface _pluginInterface; private List _displayedItems = new(); public event EventHandler? OpenConfigurationClicked; public event EventHandler? DiscardAllClicked; - public DiscardWindow(InventoryUtils inventoryUtils, ItemCache itemCache, IClientState clientState, - ICondition condition) - : base("Discard Items") + public DiscardWindow(DalamudPluginInterface pluginInterface, InventoryUtils inventoryUtils, ItemCache itemCache, + IClientState clientState, ICondition condition) + : base("Discard Items###AutoDiscardDiscard") { _inventoryUtils = inventoryUtils; _itemCache = itemCache; _clientState = clientState; _condition = condition; + _pluginInterface = pluginInterface; Size = new Vector2(600, 400); SizeCondition = ImGuiCond.FirstUseEver; @@ -46,6 +50,8 @@ internal sealed class DiscardWindow : Window public override void Draw() { + LImGui.AddPatreonIcon(_pluginInterface); + ImGui.Text("With your current configuration, the following items would be discarded:"); ImGui.BeginDisabled(Locked); diff --git a/ARDiscard/packages.lock.json b/ARDiscard/packages.lock.json index 537ed1a..fda2df7 100644 --- a/ARDiscard/packages.lock.json +++ b/ARDiscard/packages.lock.json @@ -13,6 +13,9 @@ "requested": "[2.1.12, )", "resolved": "2.1.12", "contentHash": "Sc0PVxvgg4NQjcI8n10/VfUQBAS4O+Fw2pZrAqBdRMbthYGeogzu5+xmIGCGmsEZ/ukMOBuAqiNiB5qA3MRalg==" + }, + "llib": { + "type": "Project" } } } diff --git a/LLib b/LLib new file mode 160000 index 0000000..abbbec4 --- /dev/null +++ b/LLib @@ -0,0 +1 @@ +Subproject commit abbbec4f26b1a8903b0cd7aa04f00d557602eaf3