Fix confirm check
This commit is contained in:
parent
ed2f8b9c86
commit
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.1</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")]
|
||||||
@ -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;
|
||||||
@ -334,7 +336,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;
|
||||||
}
|
}
|
||||||
|
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; }
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user