From 9e8bf53f42e8941e094e34331a8042906e0cce42 Mon Sep 17 00:00:00 2001 From: Garry Newman Date: Wed, 7 Feb 2018 12:31:01 +0000 Subject: [PATCH] TriggerPromoDrop, TriggerItemDrop, GrantAllPromoItems --- .../Interfaces/Inventory.Definition.cs | 46 +++++++++++++++++-- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/Facepunch.Steamworks/Interfaces/Inventory.Definition.cs b/Facepunch.Steamworks/Interfaces/Inventory.Definition.cs index 9cbf966..8bd0c7f 100644 --- a/Facepunch.Steamworks/Interfaces/Inventory.Definition.cs +++ b/Facepunch.Steamworks/Interfaces/Inventory.Definition.cs @@ -4,6 +4,7 @@ using System.Net; using System.Runtime.InteropServices; using System.Text; +using SteamNative; namespace Facepunch.Steamworks { @@ -190,9 +191,16 @@ internal void SetupCommonProperties() /// public void TriggerItemDrop() { - SteamNative.SteamInventoryResult_t result = 0; - inventory.inventory.TriggerItemDrop( ref result, Id ); - inventory.inventory.DestroyResult( result ); + inventory.TriggerItemDrop( Id ); + } + + /// + /// Trigger a promo item drop. You can call this at startup, it won't + /// give users multiple promo drops. + /// + public void TriggerPromoDrop() + { + inventory.TriggerPromoDrop( Id ); } internal void Link( Definition[] definitions ) @@ -221,6 +229,38 @@ internal void InRecipe( Recipe r ) } } + /// + /// Trigger a promo item drop. You can call this at startup, it won't + /// give users multiple promo drops. + /// + public void TriggerPromoDrop( int definitionId ) + { + SteamNative.SteamInventoryResult_t result = 0; + inventory.AddPromoItem( ref result, definitionId ); + inventory.DestroyResult( result ); + } + + /// + /// Trigger an item drop for this user. This is for timed drops. For promo + /// drops use TriggerPromoDrop. + /// + public void TriggerItemDrop( int definitionId ) + { + SteamNative.SteamInventoryResult_t result = 0; + inventory.TriggerItemDrop( ref result, definitionId ); + inventory.DestroyResult( result ); + } + + /// + /// Grant all promotional items the user is eligible for. + /// + public void GrantAllPromoItems() + { + SteamNative.SteamInventoryResult_t result = 0; + inventory.GrantPromoItems( ref result ); + inventory.DestroyResult( result ); + } + /// /// Represents a crafting recepie which was defined using the exchange /// section in the item schema.