master
Liza 2023-10-11 10:05:58 +02:00
parent c109741066
commit 0bfa666099
Signed by: liza
GPG Key ID: 7199F8D727D55F67
8 changed files with 42 additions and 8 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "LLib"]
path = LLib
url = git@git.carvel.li:liza/LLib.git

View File

@ -2,6 +2,8 @@
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ARDiscard", "ARDiscard\ARDiscard.csproj", "{A9B4C542-1C83-4F46-81E7-5BAFCA109767}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ARDiscard", "ARDiscard\ARDiscard.csproj", "{A9B4C542-1C83-4F46-81E7-5BAFCA109767}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LLib", "LLib\LLib.csproj", "{2E159617-A667-4EC8-B3A8-8B087315C181}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU 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}.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.ActiveCfg = Release|Any CPU
{A9B4C542-1C83-4F46-81E7-5BAFCA109767}.Release|Any CPU.Build.0 = 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 EndGlobalSection
EndGlobal EndGlobal

View File

@ -17,13 +17,17 @@
<PropertyGroup> <PropertyGroup>
<DalamudLibPath>$(appdata)\XIVLauncher\addon\Hooks\dev\</DalamudLibPath> <DalamudLibPath>$(appdata)\XIVLauncher\addon\Hooks\dev\</DalamudLibPath>
<AutoRetainerLibPath>$(appdata)\XIVLauncher\installedPlugins\AutoRetainer\4.2.0.6\</AutoRetainerLibPath> <AutoRetainerLibPath>$(appdata)\XIVLauncher\installedPlugins\AutoRetainer\4.2.1.1\</AutoRetainerLibPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))'"> <PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))'">
<DalamudLibPath>$(DALAMUD_HOME)/</DalamudLibPath> <DalamudLibPath>$(DALAMUD_HOME)/</DalamudLibPath>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\LLib\LLib.csproj" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Dalamud.ContextMenu" Version="1.3.1" /> <PackageReference Include="Dalamud.ContextMenu" Version="1.3.1" />
<PackageReference Include="DalamudPackager" Version="2.1.12"/> <PackageReference Include="DalamudPackager" Version="2.1.12"/>
@ -65,7 +69,6 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<Target Name="RenameLatestZip" AfterTargets="PackagePlugin"> <Target Name="RenameLatestZip" AfterTargets="PackagePlugin">
<Exec Command="rename $(OutDir)$(AssemblyName)\latest.zip $(AssemblyName)-$(Version).zip"/> <Exec Command="rename $(OutDir)$(AssemblyName)\latest.zip $(AssemblyName)-$(Version).zip"/>
</Target> </Target>

View File

@ -68,7 +68,7 @@ public class AutoDiscardPlogon : IDalamudPlugin
_pluginInterface.UiBuilder.Draw += _windowSystem.Draw; _pluginInterface.UiBuilder.Draw += _windowSystem.Draw;
_pluginInterface.UiBuilder.OpenConfigUi += OpenConfigUi; _pluginInterface.UiBuilder.OpenConfigUi += OpenConfigUi;
_discardWindow = new(_inventoryUtils, itemCache, clientState, condition); _discardWindow = new(_pluginInterface, _inventoryUtils, itemCache, clientState, condition);
_windowSystem.AddWindow(_discardWindow); _windowSystem.AddWindow(_discardWindow);
_configWindow = new(_pluginInterface, _configuration, itemCache, clientState, condition); _configWindow = new(_pluginInterface, _configuration, itemCache, clientState, condition);

View File

@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Numerics; using System.Numerics;
using System.Threading.Tasks;
using ARDiscard.GameData; using ARDiscard.GameData;
using Dalamud.Game.ClientState.Conditions; using Dalamud.Game.ClientState.Conditions;
using Dalamud.Interface.Colors; using Dalamud.Interface.Colors;
@ -11,6 +12,7 @@ using Dalamud.Plugin;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using ECommons; using ECommons;
using ImGuiNET; using ImGuiNET;
using LLib;
namespace ARDiscard.Windows; namespace ARDiscard.Windows;
@ -56,6 +58,8 @@ internal sealed class ConfigWindow : Window
public override void Draw() public override void Draw()
{ {
LImGui.AddPatreonIcon(_pluginInterface);
bool runAfterVenture = _configuration.RunAfterVenture; bool runAfterVenture = _configuration.RunAfterVenture;
if (ImGui.Checkbox("[Global] Run automatically after AutoRetainer's venture", ref 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); ConfigSaved?.Invoke(this, EventArgs.Empty);
} }
internal void AddToDiscardList(uint itemId) internal bool AddToDiscardList(uint itemId)
{ {
var item = EnsureAllItemsLoaded().SingleOrDefault(x => x.ItemId == itemId); var item = EnsureAllItemsLoaded().SingleOrDefault(x => x.ItemId == itemId);
if (item.ItemId != 0) if (item.ItemId != 0)
{ {
_discarding.Add(item); _discarding.Add(item);
Save(); Save();
return true;
} }
return false;
} }
internal void RemoveFromDiscardList(uint itemId) internal bool RemoveFromDiscardList(uint itemId)
{ {
if (_discarding.RemoveAll(x => x.ItemId == itemId) > 0) if (_discarding.RemoveAll(x => x.ItemId == itemId) > 0)
{
Save(); Save();
return true;
}
return false;
} }
public bool CanItemBeConfigured(uint itemId) public bool CanItemBeConfigured(uint itemId)

View File

@ -5,9 +5,11 @@ using ARDiscard.GameData;
using Dalamud.Game.ClientState.Conditions; using Dalamud.Game.ClientState.Conditions;
using Dalamud.Interface.Utility; using Dalamud.Interface.Utility;
using Dalamud.Interface.Windowing; using Dalamud.Interface.Windowing;
using Dalamud.Plugin;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using FFXIVClientStructs.FFXIV.Common.Math; using FFXIVClientStructs.FFXIV.Common.Math;
using ImGuiNET; using ImGuiNET;
using LLib;
namespace ARDiscard.Windows; namespace ARDiscard.Windows;
@ -17,20 +19,22 @@ internal sealed class DiscardWindow : Window
private readonly ItemCache _itemCache; private readonly ItemCache _itemCache;
private readonly IClientState _clientState; private readonly IClientState _clientState;
private readonly ICondition _condition; private readonly ICondition _condition;
private readonly DalamudPluginInterface _pluginInterface;
private List<SelectableItem> _displayedItems = new(); private List<SelectableItem> _displayedItems = new();
public event EventHandler? OpenConfigurationClicked; public event EventHandler? OpenConfigurationClicked;
public event EventHandler<ItemFilter>? DiscardAllClicked; public event EventHandler<ItemFilter>? DiscardAllClicked;
public DiscardWindow(InventoryUtils inventoryUtils, ItemCache itemCache, IClientState clientState, public DiscardWindow(DalamudPluginInterface pluginInterface, InventoryUtils inventoryUtils, ItemCache itemCache,
ICondition condition) IClientState clientState, ICondition condition)
: base("Discard Items") : base("Discard Items###AutoDiscardDiscard")
{ {
_inventoryUtils = inventoryUtils; _inventoryUtils = inventoryUtils;
_itemCache = itemCache; _itemCache = itemCache;
_clientState = clientState; _clientState = clientState;
_condition = condition; _condition = condition;
_pluginInterface = pluginInterface;
Size = new Vector2(600, 400); Size = new Vector2(600, 400);
SizeCondition = ImGuiCond.FirstUseEver; SizeCondition = ImGuiCond.FirstUseEver;
@ -46,6 +50,8 @@ internal sealed class DiscardWindow : Window
public override void Draw() public override void Draw()
{ {
LImGui.AddPatreonIcon(_pluginInterface);
ImGui.Text("With your current configuration, the following items would be discarded:"); ImGui.Text("With your current configuration, the following items would be discarded:");
ImGui.BeginDisabled(Locked); ImGui.BeginDisabled(Locked);

View File

@ -13,6 +13,9 @@
"requested": "[2.1.12, )", "requested": "[2.1.12, )",
"resolved": "2.1.12", "resolved": "2.1.12",
"contentHash": "Sc0PVxvgg4NQjcI8n10/VfUQBAS4O+Fw2pZrAqBdRMbthYGeogzu5+xmIGCGmsEZ/ukMOBuAqiNiB5qA3MRalg==" "contentHash": "Sc0PVxvgg4NQjcI8n10/VfUQBAS4O+Fw2pZrAqBdRMbthYGeogzu5+xmIGCGmsEZ/ukMOBuAqiNiB5qA3MRalg=="
},
"llib": {
"type": "Project"
} }
} }
} }

1
LLib Submodule

@ -0,0 +1 @@
Subproject commit abbbec4f26b1a8903b0cd7aa04f00d557602eaf3