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

This commit is contained in:
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">
<PropertyGroup>
<Version>6.1</Version>
<Version>6.2</Version>
<OutputPath>dist</OutputPath>
</PropertyGroup>

View File

@ -72,8 +72,14 @@ internal sealed class ItemCache
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)
{
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)",
ref maximumItemLevel))
{
_configuration.Armoury.MaximumGearItemLevel = Math.Max(0, Math.Min(625, maximumItemLevel));
_configuration.Armoury.MaximumGearItemLevel =
Math.Max(0, Math.Min(_itemCache.MaxDungeonItemLevel, maximumItemLevel));
Save();
}

View File

@ -14,7 +14,7 @@ namespace ARDiscard.Windows
protected override string RightSideLabel => "Items that will be automatically discarded";
internal required ExcludedListTab ExcludedTab { private get; init; }
public override IEnumerable<uint> ToSavedItems()
public IEnumerable<uint> ToSavedItems()
{
SelectedItems.RemoveAll(x => ExcludedTab.IsBlacklistedInConfiguration(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";
public override IEnumerable<uint> ToSavedItems()
public IEnumerable<uint> ToSavedItems()
{
return SelectedItems
.Select(x => x.ItemId)

View File

@ -26,8 +26,6 @@ internal abstract class ItemListTab
protected abstract string RightSideLabel { get; }
protected List<(uint ItemId, string Name)> SelectedItems { get; } = new();
public abstract IEnumerable<uint> ToSavedItems();
public void Draw()
{
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) AsRightSideDisplay(uint itemId, string name) => (name, true);
protected void Save() => _parent.Save();
private void UpdateResults()