PkmnLib.NET/PkmnLib.Static/Libraries/ItemLibrary.cs

33 lines
857 B
C#

using System.Diagnostics.CodeAnalysis;
using PkmnLib.Static.Utils;
namespace PkmnLib.Static.Libraries;
/// <summary>
/// The library for all items in the game.
/// </summary>
public interface IReadOnlyItemLibrary
{
/// <summary>
/// Tries to get an item from the library. Returns false if the item is not found.
/// </summary>
bool TryGet(StringKey key, [MaybeNullWhen(false)] out IItem value);
/// <summary>
/// Gets a random item from the library.
/// </summary>
IItem GetRandom(IRandom random);
/// <summary>
/// The amount of items in the library.
/// </summary>
int Count { get; }
/// <summary>
/// Whether the library is empty.
/// </summary>
bool IsEmpty { get; }
}
/// <inheritdoc cref="IReadOnlyItemLibrary"/>
public class ItemLibrary : DataLibrary<IItem>, IReadOnlyItemLibrary;