Skip to content

Commit

Permalink
[#7] feat(Item): add Amount and Flags from save-files
Browse files Browse the repository at this point in the history
  • Loading branch information
lmichaelis committed Jun 30, 2024
1 parent 9f71f55 commit ff147ed
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ZenKit.Test/Vobs/TestItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ public void TestLoad()
{
var vob = new Item("./Samples/G2/VOb/oCItem.zen", GameVersion.Gothic2);
Assert.That(vob.Instance, Is.EqualTo("ITPL_BLUEPLANT"));
Assert.That(vob.Amount, Is.EqualTo(0));
Assert.That(vob.Flags, Is.EqualTo(0));
}

[Test]
public void TestSetters()
{
var vob = new Item("./Samples/G2/VOb/oCItem.zen", GameVersion.Gothic2);
vob.Instance = "ITPL_BLUEPLANT";
vob.Amount = 1;
vob.Flags = 1;
}
}
12 changes: 12 additions & 0 deletions ZenKit/Native.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2218,6 +2218,18 @@ public static extern void
[DllImport(DllName)]
public static extern void ZkItem_setInstance(UIntPtr slf, string instance);

[DllImport(DllName)]
public static extern int ZkItem_getAmount(UIntPtr slf);

[DllImport(DllName)]
public static extern void ZkItem_setAmount(UIntPtr slf, int amount);

[DllImport(DllName)]
public static extern int ZkItem_getFlags(UIntPtr slf);

[DllImport(DllName)]
public static extern void ZkItem_setFlags(UIntPtr slf, int flags);

[DllImport(DllName)]
public static extern UIntPtr ZkLensFlare_load(UIntPtr buf, GameVersion version);

Expand Down
12 changes: 12 additions & 0 deletions ZenKit/Vobs/Item.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@ public string Instance
set => Native.ZkItem_setInstance(Handle, value);
}

public int Amount
{
get => Native.ZkItem_getAmount(Handle);
set => Native.ZkItem_setAmount(Handle, value);
}

public int Flags
{
get => Native.ZkItem_getFlags(Handle);
set => Native.ZkItem_setFlags(Handle, value);
}

protected override void Delete()
{
Native.ZkItem_del(Handle);
Expand Down

0 comments on commit ff147ed

Please sign in to comment.