Automatically adjust max gear item level based on the highest ilvl green item (dungeon drop)

master v6.2
Liza 2024-07-19 19:15:35 +02:00
parent d730e2c039
commit cfbd064d4a
Signed by: liza
GPG Key ID: 7199F8D727D55F67
6 changed files with 11 additions and 8 deletions

View File

@ -1,6 +1,6 @@
<Project Sdk="Dalamud.NET.Sdk/9.0.2"> <Project Sdk="Dalamud.NET.Sdk/9.0.2">
<PropertyGroup> <PropertyGroup>
<Version>6.1</Version> <Version>6.2</Version>
<OutputPath>dist</OutputPath> <OutputPath>dist</OutputPath>
</PropertyGroup> </PropertyGroup>

View File

@ -72,8 +72,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 &&

View File

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

View File

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

View File

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

View File

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