Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
b92bff2455 | |||
6437692c0a | |||
de4c2ab9f3 | |||
3bd6b6fbca | |||
cfbd064d4a | |||
d730e2c039 |
@ -990,7 +990,7 @@ csharp_space_around_binary_operators = before_and_after
|
|||||||
csharp_using_directive_placement = outside_namespace:silent
|
csharp_using_directive_placement = outside_namespace:silent
|
||||||
csharp_prefer_simple_using_statement = true:suggestion
|
csharp_prefer_simple_using_statement = true:suggestion
|
||||||
csharp_prefer_braces = true:silent
|
csharp_prefer_braces = true:silent
|
||||||
csharp_style_namespace_declarations = block_scoped:silent
|
csharp_style_namespace_declarations = file_scoped:silent
|
||||||
csharp_style_prefer_method_group_conversion = true:silent
|
csharp_style_prefer_method_group_conversion = true:silent
|
||||||
csharp_style_prefer_top_level_statements = true:silent
|
csharp_style_prefer_top_level_statements = true:silent
|
||||||
csharp_style_prefer_primary_constructors = true:suggestion
|
csharp_style_prefer_primary_constructors = true:suggestion
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<Project Sdk="Dalamud.NET.Sdk/9.0.2">
|
<Project Sdk="Dalamud.NET.Sdk/9.0.2">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>6.0</Version>
|
<Version>6.3</Version>
|
||||||
<OutputPath>dist</OutputPath>
|
<OutputPath>dist</OutputPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ public sealed class AutoDiscardPlogon : IDalamudPlugin
|
|||||||
private readonly ICommandManager _commandManager;
|
private readonly ICommandManager _commandManager;
|
||||||
private readonly InventoryUtils _inventoryUtils;
|
private readonly InventoryUtils _inventoryUtils;
|
||||||
private readonly IconCache _iconCache;
|
private readonly IconCache _iconCache;
|
||||||
|
private readonly GameStrings _gameStrings;
|
||||||
private readonly AutoRetainerApi _autoRetainerApi;
|
private readonly AutoRetainerApi _autoRetainerApi;
|
||||||
|
|
||||||
[SuppressMessage("Usage", "CA2213:Disposable fields should be disposed", Justification = "Obsolete in ECommons")]
|
[SuppressMessage("Usage", "CA2213:Disposable fields should be disposed", Justification = "Obsolete in ECommons")]
|
||||||
@ -53,7 +54,7 @@ public sealed class AutoDiscardPlogon : IDalamudPlugin
|
|||||||
ArgumentNullException.ThrowIfNull(dataManager);
|
ArgumentNullException.ThrowIfNull(dataManager);
|
||||||
|
|
||||||
_pluginInterface = pluginInterface;
|
_pluginInterface = pluginInterface;
|
||||||
_configuration = (Configuration?)_pluginInterface.GetPluginConfig() ?? new Configuration();
|
_configuration = (Configuration?)_pluginInterface.GetPluginConfig() ?? Configuration.CreateNew();
|
||||||
MigrateConfiguration(_configuration);
|
MigrateConfiguration(_configuration);
|
||||||
_chatGui = chatGui;
|
_chatGui = chatGui;
|
||||||
_clientState = clientState;
|
_clientState = clientState;
|
||||||
@ -79,6 +80,7 @@ public sealed class AutoDiscardPlogon : IDalamudPlugin
|
|||||||
listManager.FinishInitialization();
|
listManager.FinishInitialization();
|
||||||
|
|
||||||
_iconCache = new IconCache(textureProvider);
|
_iconCache = new IconCache(textureProvider);
|
||||||
|
_gameStrings = new GameStrings(dataManager, pluginLog);
|
||||||
|
|
||||||
_pluginInterface.UiBuilder.Draw += _windowSystem.Draw;
|
_pluginInterface.UiBuilder.Draw += _windowSystem.Draw;
|
||||||
_pluginInterface.UiBuilder.OpenMainUi += OpenDiscardUi;
|
_pluginInterface.UiBuilder.OpenMainUi += OpenDiscardUi;
|
||||||
@ -122,6 +124,14 @@ public sealed class AutoDiscardPlogon : IDalamudPlugin
|
|||||||
configuration.Version = 2;
|
configuration.Version = 2;
|
||||||
_pluginInterface.SavePluginConfig(configuration);
|
_pluginInterface.SavePluginConfig(configuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (configuration.Version == 2)
|
||||||
|
{
|
||||||
|
if (!configuration.BlacklistedItems.Contains(2820))
|
||||||
|
configuration.BlacklistedItems.Add(2820);
|
||||||
|
configuration.Version = 3;
|
||||||
|
_pluginInterface.SavePluginConfig(configuration);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheckRetainerPostProcess(string retainerName) =>
|
private void CheckRetainerPostProcess(string retainerName) =>
|
||||||
@ -334,7 +344,7 @@ public sealed class AutoDiscardPlogon : IDalamudPlugin
|
|||||||
var textNode = addon->UldManager.NodeList[15]->GetAsAtkTextNode();
|
var textNode = addon->UldManager.NodeList[15]->GetAsAtkTextNode();
|
||||||
var text = MemoryHelper.ReadSeString(&textNode->NodeText).ExtractText();
|
var text = MemoryHelper.ReadSeString(&textNode->NodeText).ExtractText();
|
||||||
_pluginLog.Information($"YesNo prompt: {text}");
|
_pluginLog.Information($"YesNo prompt: {text}");
|
||||||
if (text.StartsWith("Discard", StringComparison.Ordinal))
|
if (_gameStrings.DiscardItem.IsMatch(text) || _gameStrings.DiscardCollectable.IsMatch(text))
|
||||||
{
|
{
|
||||||
return addon;
|
return addon;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ namespace ARDiscard;
|
|||||||
|
|
||||||
internal sealed class Configuration : IPluginConfiguration
|
internal sealed class Configuration : IPluginConfiguration
|
||||||
{
|
{
|
||||||
public int Version { get; set; } = 2;
|
public int Version { get; set; } = 3;
|
||||||
public bool RunAfterVenture { get; set; }
|
public bool RunAfterVenture { get; set; }
|
||||||
public bool RunBeforeLogout { get; set; }
|
public bool RunBeforeLogout { get; set; }
|
||||||
public List<uint> DiscardingItems { get; set; } = new();
|
public List<uint> DiscardingItems { get; set; } = new();
|
||||||
@ -45,4 +45,12 @@ internal sealed class Configuration : IPluginConfiguration
|
|||||||
public bool GroupByCategory { get; set; } = true;
|
public bool GroupByCategory { get; set; } = true;
|
||||||
public bool ShowIcons { get; set; } = true;
|
public bool ShowIcons { get; set; } = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Configuration CreateNew()
|
||||||
|
{
|
||||||
|
return new Configuration
|
||||||
|
{
|
||||||
|
BlacklistedItems = [2820]
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
21
ARDiscard/GameData/GameStrings.cs
Normal file
21
ARDiscard/GameData/GameStrings.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using System.Data;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using Dalamud.Plugin.Services;
|
||||||
|
using LLib;
|
||||||
|
using Lumina.Excel.GeneratedSheets;
|
||||||
|
|
||||||
|
namespace ARDiscard.GameData;
|
||||||
|
|
||||||
|
internal sealed class GameStrings
|
||||||
|
{
|
||||||
|
public GameStrings(IDataManager dataManager, IPluginLog pluginLog)
|
||||||
|
{
|
||||||
|
DiscardItem = dataManager.GetRegex<Addon>(110, addon => addon.Text, pluginLog)
|
||||||
|
?? throw new ConstraintException($"Unable to resolve {nameof(DiscardItem)}");
|
||||||
|
DiscardCollectable = dataManager.GetRegex<Addon>(153, addon => addon.Text, pluginLog)
|
||||||
|
?? throw new ConstraintException($"Unable to resolve {nameof(DiscardCollectable)}");
|
||||||
|
}
|
||||||
|
|
||||||
|
public Regex DiscardItem { get; }
|
||||||
|
public Regex DiscardCollectable { get; }
|
||||||
|
}
|
@ -62,6 +62,14 @@ internal sealed class ItemCache
|
|||||||
cachedItemInfo.CanBeBoughtFromCalamitySalvager = true;
|
cachedItemInfo.CanBeBoughtFromCalamitySalvager = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (var collectableItem in dataManager.GetExcelSheet<CollectablesShopItem>()!)
|
||||||
|
{
|
||||||
|
if (collectableItem.RowId == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
listManager.AddToInternalWhitelist(collectableItem.Item.Row);
|
||||||
|
}
|
||||||
|
|
||||||
// only look at msq + regional side quests
|
// only look at msq + regional side quests
|
||||||
foreach (var quest in dataManager.GetExcelSheet<Quest>()!.Where(x => x.JournalGenre.Value?.JournalCategory.Value?.JournalSection.Row is 0 or 1 or 3))
|
foreach (var quest in dataManager.GetExcelSheet<Quest>()!.Where(x => x.JournalGenre.Value?.JournalCategory.Value?.JournalSection.Row is 0 or 1 or 3))
|
||||||
{
|
{
|
||||||
@ -72,8 +80,14 @@ internal sealed class ItemCache
|
|||||||
listManager.AddToInternalWhitelist(item.RowId);
|
listManager.AddToInternalWhitelist(item.RowId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MaxDungeonItemLevel = _items.Values.Where(x => x.Rarity == 2)
|
||||||
|
.Select(x => (int)x.ILvl)
|
||||||
|
.Max();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int MaxDungeonItemLevel { get; }
|
||||||
|
|
||||||
private bool CanDiscardItemsFromQuest(LazyRow<Quest> quest)
|
private bool CanDiscardItemsFromQuest(LazyRow<Quest> quest)
|
||||||
{
|
{
|
||||||
return quest.Row > 0 &&
|
return quest.Row > 0 &&
|
||||||
|
@ -11,8 +11,6 @@ internal sealed class ListManager : IListManager
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private ISet<uint> _blacklistedItems = new List<uint>
|
private ISet<uint> _blacklistedItems = new List<uint>
|
||||||
{
|
{
|
||||||
2820, // red onion helm
|
|
||||||
|
|
||||||
16039, // ala mhigan earrings
|
16039, // ala mhigan earrings
|
||||||
24589, // aetheryte earrings
|
24589, // aetheryte earrings
|
||||||
33648, // menphina's earrings
|
33648, // menphina's earrings
|
||||||
|
@ -234,7 +234,8 @@ internal sealed class ConfigWindow : LWindow
|
|||||||
if (ImGui.InputInt("Ignore items >= this ilvl (Armoury Chest only)",
|
if (ImGui.InputInt("Ignore items >= this ilvl (Armoury Chest only)",
|
||||||
ref maximumItemLevel))
|
ref maximumItemLevel))
|
||||||
{
|
{
|
||||||
_configuration.Armoury.MaximumGearItemLevel = Math.Max(0, Math.Min(625, maximumItemLevel));
|
_configuration.Armoury.MaximumGearItemLevel =
|
||||||
|
Math.Max(0, Math.Min(_itemCache.MaxDungeonItemLevel, maximumItemLevel));
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ namespace ARDiscard.Windows
|
|||||||
protected override string RightSideLabel => "Items that will be automatically discarded";
|
protected override string RightSideLabel => "Items that will be automatically discarded";
|
||||||
internal required ExcludedListTab ExcludedTab { private get; init; }
|
internal required ExcludedListTab ExcludedTab { private get; init; }
|
||||||
|
|
||||||
public override IEnumerable<uint> ToSavedItems()
|
public IEnumerable<uint> ToSavedItems()
|
||||||
{
|
{
|
||||||
SelectedItems.RemoveAll(x => ExcludedTab.IsBlacklistedInConfiguration(x.ItemId));
|
SelectedItems.RemoveAll(x => ExcludedTab.IsBlacklistedInConfiguration(x.ItemId));
|
||||||
return SelectedItems.Select(x => x.ItemId);
|
return SelectedItems.Select(x => x.ItemId);
|
||||||
|
@ -123,14 +123,12 @@ internal sealed class DiscardWindow : LWindow
|
|||||||
{
|
{
|
||||||
if (_configuration.Preview.ShowIcons)
|
if (_configuration.Preview.ShowIcons)
|
||||||
{
|
{
|
||||||
ISharedImmediateTexture icon = _iconCache.GetIcon(displayedItem.IconId);
|
using IDalamudTextureWrap? icon = _iconCache.GetIcon(displayedItem.IconId);
|
||||||
if (icon.TryGetWrap(out IDalamudTextureWrap? wrap, out _))
|
if (icon != null)
|
||||||
{
|
{
|
||||||
ImGui.Image(wrap.ImGuiHandle, new Vector2(23, 23));
|
ImGui.Image(icon.ImGuiHandle, new Vector2(23, 23));
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGui.SetCursorPosY(ImGui.GetCursorPosY() + 3);
|
ImGui.SetCursorPosY(ImGui.GetCursorPosY() + 3);
|
||||||
|
|
||||||
wrap.Dispose();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ internal sealed class ExcludedListTab : ItemListTab
|
|||||||
|
|
||||||
protected override string RightSideLabel => "Items that will never be discarded";
|
protected override string RightSideLabel => "Items that will never be discarded";
|
||||||
|
|
||||||
public override IEnumerable<uint> ToSavedItems()
|
public IEnumerable<uint> ToSavedItems()
|
||||||
{
|
{
|
||||||
return SelectedItems
|
return SelectedItems
|
||||||
.Select(x => x.ItemId)
|
.Select(x => x.ItemId)
|
||||||
|
@ -26,8 +26,6 @@ internal abstract class ItemListTab
|
|||||||
protected abstract string RightSideLabel { get; }
|
protected abstract string RightSideLabel { get; }
|
||||||
protected List<(uint ItemId, string Name)> SelectedItems { get; } = new();
|
protected List<(uint ItemId, string Name)> SelectedItems { get; } = new();
|
||||||
|
|
||||||
public abstract IEnumerable<uint> ToSavedItems();
|
|
||||||
|
|
||||||
public void Draw()
|
public void Draw()
|
||||||
{
|
{
|
||||||
var ws = ImGui.GetWindowSize();
|
var ws = ImGui.GetWindowSize();
|
||||||
@ -143,8 +141,6 @@ internal abstract class ItemListTab
|
|||||||
|
|
||||||
protected virtual (string Name, bool Enabled) AsLeftSideDisplay(uint itemId, string name) => (name, true);
|
protected virtual (string Name, bool Enabled) AsLeftSideDisplay(uint itemId, string name) => (name, true);
|
||||||
|
|
||||||
protected virtual (string Name, bool Enabled) AsRightSideDisplay(uint itemId, string name) => (name, true);
|
|
||||||
|
|
||||||
protected void Save() => _parent.Save();
|
protected void Save() => _parent.Save();
|
||||||
|
|
||||||
private void UpdateResults()
|
private void UpdateResults()
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit a63c8e7154e272374ffa03d5c801736d4229e38a
|
Subproject commit 1c8745ef2757585d2683b4a83c44c8db81ff8955
|
2
ECommons
2
ECommons
@ -1 +1 @@
|
|||||||
Subproject commit 38080f2a3733aa19b6928f4d2984fac7b9a7fab7
|
Subproject commit 07c07e09101e0c8a5f770dbea2ca6eafea5ec705
|
2
LLib
2
LLib
@ -1 +1 @@
|
|||||||
Subproject commit 7027d291efbbff6a55944dd521d3907210ddecbe
|
Subproject commit fde09c705b648f03c287814191a554f0a4b92cc4
|
Loading…
Reference in New Issue
Block a user