TriggerPromoDrop, TriggerItemDrop, GrantAllPromoItems

This commit is contained in:
Garry Newman 2018-02-07 12:31:01 +00:00
parent 3a4bb29f7e
commit 9e8bf53f42

View File

@ -4,6 +4,7 @@
using System.Net; using System.Net;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;
using SteamNative;
namespace Facepunch.Steamworks namespace Facepunch.Steamworks
{ {
@ -190,9 +191,16 @@ internal void SetupCommonProperties()
/// </summary> /// </summary>
public void TriggerItemDrop() public void TriggerItemDrop()
{ {
SteamNative.SteamInventoryResult_t result = 0; inventory.TriggerItemDrop( Id );
inventory.inventory.TriggerItemDrop( ref result, Id ); }
inventory.inventory.DestroyResult( result );
/// <summary>
/// Trigger a promo item drop. You can call this at startup, it won't
/// give users multiple promo drops.
/// </summary>
public void TriggerPromoDrop()
{
inventory.TriggerPromoDrop( Id );
} }
internal void Link( Definition[] definitions ) internal void Link( Definition[] definitions )
@ -221,6 +229,38 @@ internal void InRecipe( Recipe r )
} }
} }
/// <summary>
/// Trigger a promo item drop. You can call this at startup, it won't
/// give users multiple promo drops.
/// </summary>
public void TriggerPromoDrop( int definitionId )
{
SteamNative.SteamInventoryResult_t result = 0;
inventory.AddPromoItem( ref result, definitionId );
inventory.DestroyResult( result );
}
/// <summary>
/// Trigger an item drop for this user. This is for timed drops. For promo
/// drops use TriggerPromoDrop.
/// </summary>
public void TriggerItemDrop( int definitionId )
{
SteamNative.SteamInventoryResult_t result = 0;
inventory.TriggerItemDrop( ref result, definitionId );
inventory.DestroyResult( result );
}
/// <summary>
/// Grant all promotional items the user is eligible for.
/// </summary>
public void GrantAllPromoItems()
{
SteamNative.SteamInventoryResult_t result = 0;
inventory.GrantPromoItems( ref result );
inventory.DestroyResult( result );
}
/// <summary> /// <summary>
/// Represents a crafting recepie which was defined using the exchange /// Represents a crafting recepie which was defined using the exchange
/// section in the item schema. /// section in the item schema.