forked from liza/ARDiscard
API 11
This commit is contained in:
parent
b92bff2455
commit
6ad112f838
3
ARDiscard.sln.DotSettings
Normal file
3
ARDiscard.sln.DotSettings
Normal file
@ -0,0 +1,3 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=AutoRetainerAPI/@EntryIndexedValue">ExplicitlyExcluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=ECommons/@EntryIndexedValue">ExplicitlyExcluded</s:String></wpf:ResourceDictionary>
|
@ -1,6 +1,6 @@
|
||||
<Project Sdk="Dalamud.NET.Sdk/9.0.2">
|
||||
<Project Sdk="Dalamud.NET.Sdk/11.0.0">
|
||||
<PropertyGroup>
|
||||
<Version>6.3</Version>
|
||||
<Version>7.0</Version>
|
||||
<OutputPath>dist</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
|
@ -16,6 +16,6 @@
|
||||
AssemblyName="$(AssemblyName)"
|
||||
MakeZip="true"
|
||||
VersionComponents="2"
|
||||
Exclude="ARDiscard.deps.json;AutoRetainerAPI.pdb;ClickLib.pdb;ClickLib.xml;ECommons.pdb;ECommons.xml"/>
|
||||
Exclude="ARDiscard.deps.json;AutoRetainerAPI.pdb;ECommons.pdb;ECommons.xml"/>
|
||||
</Target>
|
||||
</Project>
|
||||
|
@ -2,7 +2,7 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using Dalamud.Plugin.Services;
|
||||
using LLib;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
using Lumina.Excel.Sheets;
|
||||
|
||||
namespace ARDiscard.GameData;
|
||||
|
||||
|
@ -60,7 +60,7 @@ internal sealed class InventoryUtils
|
||||
public unsafe List<ItemWrapper> GetAllItemsToDiscard()
|
||||
{
|
||||
List<ItemWrapper> toDiscard = new List<ItemWrapper>();
|
||||
Dictionary<uint, uint> itemCounts = new();
|
||||
Dictionary<uint, int> itemCounts = new();
|
||||
|
||||
InventoryManager* inventoryManager = InventoryManager.Instance();
|
||||
foreach (InventoryType inventoryType in DefaultInventoryTypes)
|
||||
@ -83,7 +83,7 @@ internal sealed class InventoryUtils
|
||||
}
|
||||
|
||||
private unsafe ReadOnlyCollection<ItemWrapper> GetArmouryItemsToDiscard(bool condition, InventoryManager* inventoryManager,
|
||||
InventoryType[] inventoryTypes, Dictionary<uint, uint> itemCounts, List<uint>? gearsetItems)
|
||||
InventoryType[] inventoryTypes, Dictionary<uint, int> itemCounts, List<uint>? gearsetItems)
|
||||
{
|
||||
List<ItemWrapper> items = new();
|
||||
if (condition)
|
||||
@ -104,7 +104,7 @@ internal sealed class InventoryUtils
|
||||
}
|
||||
|
||||
private unsafe ReadOnlyCollection<ItemWrapper> GetItemsToDiscard(InventoryManager* inventoryManager,
|
||||
InventoryType inventoryType, Dictionary<uint, uint> itemCounts,
|
||||
InventoryType inventoryType, Dictionary<uint, int> itemCounts,
|
||||
IReadOnlyList<uint>? gearsetItems)
|
||||
{
|
||||
List<ItemWrapper> toDiscard = new List<ItemWrapper>();
|
||||
@ -115,7 +115,7 @@ internal sealed class InventoryUtils
|
||||
var item = container->GetInventorySlot(i);
|
||||
if (item != null && item->ItemId != 0)
|
||||
{
|
||||
if (itemCounts.TryGetValue(item->ItemId, out uint itemCount))
|
||||
if (itemCounts.TryGetValue(item->ItemId, out int itemCount))
|
||||
itemCounts[item->ItemId] = itemCount + item->Quantity;
|
||||
else
|
||||
itemCounts[item->ItemId] = item->Quantity;
|
||||
|
@ -3,7 +3,7 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Lumina.Excel;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
using Lumina.Excel.Sheets;
|
||||
|
||||
namespace ARDiscard.GameData;
|
||||
|
||||
@ -13,7 +13,7 @@ internal sealed class ItemCache
|
||||
|
||||
public ItemCache(IDataManager dataManager, ListManager listManager)
|
||||
{
|
||||
foreach (var item in dataManager.GetExcelSheet<Item>()!)
|
||||
foreach (var item in dataManager.GetExcelSheet<Item>())
|
||||
{
|
||||
if (item.RowId == 0)
|
||||
continue;
|
||||
@ -23,36 +23,36 @@ internal sealed class ItemCache
|
||||
ItemId = item.RowId,
|
||||
Name = item.Name.ToString(),
|
||||
IconId = item.Icon,
|
||||
ILvl = item.LevelItem.Row,
|
||||
ILvl = item.LevelItem.RowId,
|
||||
Rarity = item.Rarity,
|
||||
IsUnique = item.IsUnique,
|
||||
IsUntradable = item.IsUntradable,
|
||||
IsIndisposable = item.IsIndisposable,
|
||||
Level = item.LevelEquip,
|
||||
UiCategory = item.ItemUICategory.Row,
|
||||
UiCategoryName = item.ItemUICategory.Value!.Name.ToString(),
|
||||
EquipSlotCategory = item.EquipSlotCategory.Row,
|
||||
UiCategory = item.ItemUICategory.RowId,
|
||||
UiCategoryName = item.ItemUICategory.Value.Name.ToString(),
|
||||
EquipSlotCategory = item.EquipSlotCategory.RowId,
|
||||
};
|
||||
|
||||
if (item is { Rarity: 3, MateriaSlotCount: 3, RowId: < 33154 or > 33358 })
|
||||
listManager.AddToInternalBlacklist(item.RowId);
|
||||
|
||||
if (item is { ItemSearchCategory.Row: 79, ItemUICategory.Row: >= 101 and <= 104 })
|
||||
if (item is { ItemSearchCategory.RowId: 79, ItemUICategory.RowId: >= 101 and <= 104 })
|
||||
listManager.AddToInternalBlacklist(item.RowId);
|
||||
}
|
||||
|
||||
foreach (var shopItem in dataManager.GetExcelSheet<GilShopItem>()!)
|
||||
foreach (var shopItem in dataManager.GetSubrowExcelSheet<GilShopItem>().SelectMany(x => x))
|
||||
{
|
||||
// exclude base ARR relics, not strictly necessary since we don't allow discarding weapons anyway
|
||||
if (shopItem.Item.Value!.Rarity == 4)
|
||||
if (shopItem.Item.Value.Rarity == 4)
|
||||
continue;
|
||||
|
||||
// the item can be discarded already
|
||||
if (!_items.TryGetValue(shopItem.Item.Row, out CachedItemInfo? cachedItemInfo) ||
|
||||
if (!_items.TryGetValue(shopItem.Item.RowId, out CachedItemInfo? cachedItemInfo) ||
|
||||
cachedItemInfo.CanBeDiscarded(listManager))
|
||||
continue;
|
||||
|
||||
if (shopItem.AchievementRequired.Row != 0)
|
||||
if (shopItem.AchievementRequired.RowId != 0)
|
||||
continue;
|
||||
|
||||
// has a quest required to unlock from the shop
|
||||
@ -62,22 +62,23 @@ internal sealed class ItemCache
|
||||
cachedItemInfo.CanBeBoughtFromCalamitySalvager = true;
|
||||
}
|
||||
|
||||
foreach (var collectableItem in dataManager.GetExcelSheet<CollectablesShopItem>()!)
|
||||
foreach (var collectableItem in dataManager.GetSubrowExcelSheet<CollectablesShopItem>().SelectMany(x => x))
|
||||
{
|
||||
if (collectableItem.RowId == 0)
|
||||
continue;
|
||||
|
||||
listManager.AddToInternalWhitelist(collectableItem.Item.Row);
|
||||
listManager.AddToInternalWhitelist(collectableItem.Item.RowId);
|
||||
}
|
||||
|
||||
// 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.ValueNullable?.JournalCategory.ValueNullable?.JournalSection.RowId is 0 or 1 or 3))
|
||||
{
|
||||
foreach (var itemId in quest.ItemReward.Where(x => x > 0))
|
||||
foreach (var itemRef in quest.Reward.Where(x => x.RowId > 0))
|
||||
{
|
||||
var item = dataManager.GetExcelSheet<Item>()!.GetRow(itemId);
|
||||
if (item is { Rarity: 1, ItemAction.Row: 388 } && item.RowId != 38809 && item.RowId != 29679)
|
||||
listManager.AddToInternalWhitelist(item.RowId);
|
||||
var item = itemRef.GetValueOrDefault<Item>();
|
||||
if (item is { Rarity: 1, ItemAction.RowId: 388 } && item.Value.RowId != 38809 && item.Value.RowId != 29679)
|
||||
listManager.AddToInternalWhitelist(item.Value.RowId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,11 +89,11 @@ internal sealed class ItemCache
|
||||
|
||||
public int MaxDungeonItemLevel { get; }
|
||||
|
||||
private bool CanDiscardItemsFromQuest(LazyRow<Quest> quest)
|
||||
private bool CanDiscardItemsFromQuest(RowRef<Quest> quest)
|
||||
{
|
||||
return quest.Row > 0 &&
|
||||
quest.Value?.JournalGenre.Value?.JournalCategory.Value?.JournalSection
|
||||
.Row is 0 or 1 or 6; // pre-EW MSQ, EW MSQ or Job/Class quest
|
||||
return quest is { RowId: > 0, IsValid: true } &&
|
||||
quest.ValueNullable?.JournalGenre.ValueNullable?.JournalCategory.ValueNullable?.JournalSection
|
||||
.RowId is 0 or 1 or 6; // pre-EW MSQ, EW MSQ or Job/Class quest
|
||||
}
|
||||
|
||||
public IEnumerable<CachedItemInfo> AllItems => _items.Values;
|
||||
|
@ -109,7 +109,7 @@ internal sealed class ConfigWindow : LWindow
|
||||
{
|
||||
if (_clientState is { IsLoggedIn: true, LocalContentId: > 0 })
|
||||
{
|
||||
string worldName = _clientState.LocalPlayer?.HomeWorld.GameData?.Name ?? "??";
|
||||
string worldName = _clientState.LocalPlayer?.HomeWorld.ValueNullable?.Name .ToString() ?? "??";
|
||||
ImGui.TextWrapped(
|
||||
$"Current Character: {_clientState.LocalPlayer?.Name} @ {worldName} ({_clientState.LocalContentId:X})");
|
||||
ImGui.Indent(30);
|
||||
|
@ -195,5 +195,5 @@ internal sealed class DiscardWindow : LWindow
|
||||
|
||||
public void Login() => RefreshInventory(false);
|
||||
|
||||
public void Logout() => _displayedItems.Clear();
|
||||
public void Logout(int type, int code) => _displayedItems.Clear();
|
||||
}
|
||||
|
@ -4,9 +4,9 @@
|
||||
"net8.0-windows7.0": {
|
||||
"DalamudPackager": {
|
||||
"type": "Direct",
|
||||
"requested": "[2.1.13, )",
|
||||
"resolved": "2.1.13",
|
||||
"contentHash": "rMN1omGe8536f4xLMvx9NwfvpAc9YFFfeXJ1t4P4PE6Gu8WCIoFliR1sh07hM+bfODmesk/dvMbji7vNI+B/pQ=="
|
||||
"requested": "[11.0.0, )",
|
||||
"resolved": "11.0.0",
|
||||
"contentHash": "bjT7XUlhIJSmsE/O76b7weUX+evvGQctbQB8aKXt94o+oPWxHpCepxAGMs7Thow3AzCyqWs7cOpp9/2wcgRRQA=="
|
||||
},
|
||||
"DotNet.ReproducibleBuilds": {
|
||||
"type": "Direct",
|
||||
@ -88,7 +88,7 @@
|
||||
"llib": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"DalamudPackager": "[2.1.13, )"
|
||||
"DalamudPackager": "[11.0.0, )"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 1c8745ef2757585d2683b4a83c44c8db81ff8955
|
||||
Subproject commit 069cf988b5da8657bc13ade73bfcbc2675601023
|
2
ECommons
2
ECommons
@ -1 +1 @@
|
||||
Subproject commit 07c07e09101e0c8a5f770dbea2ca6eafea5ec705
|
||||
Subproject commit 974a0ef35536b7f0a10a278539f7136d6966baa3
|
2
LLib
2
LLib
@ -1 +1 @@
|
||||
Subproject commit fde09c705b648f03c287814191a554f0a4b92cc4
|
||||
Subproject commit e4bbc05ede6f6f01e7028b24614ed8cb333e909c
|
Loading…
x
Reference in New Issue
Block a user