Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add IGameInventory.GetInventoryItems #2008

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Dalamud/Game/Inventory/GameInventory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,9 @@ internal class GameInventoryPluginScoped : IInternalDisposableService, IGameInve
/// <inheritdoc/>
public event IGameInventory.InventoryChangedDelegate<InventoryItemMergedArgs>? ItemMergedExplicit;

/// <inheritdoc/>
public ReadOnlySpan<GameInventoryItem> GetInventoryItems(GameInventoryType type) => GameInventoryItem.GetReadOnlySpanOfInventory(type);
Copy link
Member

@KazWolfe KazWolfe Aug 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is it that this use case hasn't come up yet?

No, legitimately. It seems weird to the point of being intentional that this has yet to be a thing.

Copy link
Contributor Author

@Haselnussbomber Haselnussbomber Aug 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because everyone that needs inventory items uses InventoryManager directly? I don't know. 🤷‍♂️
I think its weird that Dalamud has a IGameInventory service and you can't even read the inventories with it.


/// <inheritdoc/>
void IInternalDisposableService.DisposeService()
{
Expand Down
7 changes: 7 additions & 0 deletions Dalamud/Plugin/Services/IGameInventory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,11 @@ public interface IGameInventory

/// <inheritdoc cref="ItemMerged"/>
public event InventoryChangedDelegate<InventoryItemMergedArgs> ItemMergedExplicit;

/// <summary>
/// Gets all item slots of the specified inventory type.
/// </summary>
/// <param name="type">The type of inventory to get the items for.</param>
/// <returns>A read-only span of all items in the specified inventory type.</returns>
public ReadOnlySpan<GameInventoryItem> GetInventoryItems(GameInventoryType type);
}
Loading