25 lines
758 B
C#
25 lines
758 B
C#
using System;
|
|
using PkmnLibSharp.FFI;
|
|
using PkmnLibSharp.Utils;
|
|
using Interface = PkmnLibSharp.FFI.StaticData.Libraries.ItemLibrary;
|
|
|
|
namespace PkmnLibSharp.StaticData.Libraries
|
|
{
|
|
public class ItemLibrary : DataLibrary<Item>
|
|
{
|
|
protected ItemLibrary(FFIHandle handle) : base(handle){}
|
|
|
|
public static ItemLibrary Create(ulong capacity)
|
|
{
|
|
var handle = Interface.item_library_new(capacity).Resolve();
|
|
var self = Resolver.Instance.ResolveItemLibrary(handle);
|
|
self.ReserveCapacity(capacity);
|
|
return self;
|
|
}
|
|
|
|
protected override void AddNative(string key, Item value)
|
|
{
|
|
Interface.item_library_add(Handle, key.ToPtr(), value.Handle);
|
|
}
|
|
}
|
|
} |