1
0
forked from liza/ARDiscard
This commit is contained in:
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
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

View File

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

View File

@ -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);

View File

@ -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)

View File

@ -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<SelectableItem> _displayedItems = new();
public event EventHandler? OpenConfigurationClicked;
public event EventHandler<ItemFilter>? 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);

View File

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

1
LLib Submodule

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