C# Class Steamworks.SteamInventory

Mostrar archivo Open project: rlabrecque/Steamworks.NET Class Usage Examples

Public Methods

Method Description
AddPromoItem ( SteamInventoryResult_t &pResultHandle, SteamItemDef_t itemDef ) : bool

AddPromoItem() / AddPromoItems() are restricted versions of GrantPromoItems(). Instead of

scanning for all eligible promotional items, the check is restricted to a single item

definition or set of item definitions. This can be useful if your game has custom UI for

showing a specific promo item to the user.

AddPromoItems ( SteamInventoryResult_t &pResultHandle, SteamItemDef_t pArrayItemDefs, uint unArrayLength ) : bool
CheckResultSteamID ( SteamInventoryResult_t resultHandle, CSteamID steamIDExpected ) : bool

Returns true if the result belongs to the target steam ID, false if the

result does not. This is important when using DeserializeResult, to verify

that a remote player is not pretending to have a different user's inventory.

ConsumeItem ( SteamInventoryResult_t &pResultHandle, SteamItemInstanceID_t itemConsume, uint unQuantity ) : bool

ConsumeItem() removes items from the inventory, permanently. They cannot be recovered.

Not for the faint of heart - if your game implements item removal at all, a high-friction

UI confirmation process is highly recommended. Similar to GenerateItems, punArrayQuantity

can be NULL or else an array of the same length as pArrayItems which describe the quantity

of each item to destroy.

DeserializeResult ( SteamInventoryResult_t &pOutResultHandle, byte pBuffer, uint unBufferSize, bool bRESERVED_MUST_BE_FALSE = false ) : bool

Deserializes a result set and verifies the signature bytes. Returns false

if bRequireFullOnlineVerify is set but Steam is running in Offline mode.

Otherwise returns true and then delivers error codes via GetResultStatus.

The bRESERVED_MUST_BE_FALSE flag is reserved for future use and should not

be set to true by your game at this time.

DeserializeResult has a potential soft-failure mode where the handle status

is set to k_EResultExpired. GetResultItems() still succeeds in this mode.

The "expired" result could indicate that the data may be out of date - not

just due to timed expiration (one hour), but also because one of the items

in the result set may have been traded or consumed since the result set was

generated. You could compare the timestamp from GetResultTimestamp() to

ISteamUtils::GetServerRealTime() to determine how old the data is. You could

simply ignore the "expired" result code and continue as normal, or you

could challenge the player with expired data to send an updated result set.

DestroyResult ( SteamInventoryResult_t resultHandle ) : void

Destroys a result handle and frees all associated memory.

ExchangeItems ( SteamInventoryResult_t &pResultHandle, SteamItemDef_t pArrayGenerate, uint punArrayGenerateQuantity, uint unArrayGenerateLength, SteamItemInstanceID_t pArrayDestroy, uint punArrayDestroyQuantity, uint unArrayDestroyLength ) : bool

ExchangeItems() is an atomic combination of item generation and consumption.

It can be used to implement crafting recipes or transmutations, or items which unpack

themselves into other items (e.g., a chest).

ExchangeItems requires a whitelist - you must define recipes (lists of the components

required for the exchange) on the target ItemDefinition. Exchanges that do not match

a recipe, or do not provide the required amounts, will fail.

GenerateItems ( SteamInventoryResult_t &pResultHandle, SteamItemDef_t pArrayItemDefs, uint punArrayQuantity, uint unArrayLength ) : bool

INVENTORY ASYNC MODIFICATION

GenerateItems() creates one or more items and then generates a SteamInventoryCallback_t

notification with a matching nCallbackContext parameter. This API is insecure, and could

be abused by hacked clients. This call is normally disabled unless you explicitly enable

"Development mode" on the Inventory Service section of the Steamworks website.

You should not enable this mode for a shipping game!

Note that Steam accounts that belong to the publisher group for your game are granted

an exception - as a developer, you may use this to generate and test items in your game.

If punArrayQuantity is not NULL, it should be the same length as pArrayItems and should

describe the quantity of each item to generate.

GetAllItems ( SteamInventoryResult_t &pResultHandle ) : bool

INVENTORY ASYNC QUERY

Captures the entire state of the current user's Steam inventory.

You must call DestroyResult on this handle when you are done with it.

Returns false and sets *pResultHandle to zero if inventory is unavailable.

Note: calls to this function are subject to rate limits and may return

cached results if called too frequently. It is suggested that you call

this function only when you are about to display the user's full inventory,

or if you expect that the inventory may have changed.

GetEligiblePromoItemDefinitionIDs ( CSteamID steamID, SteamItemDef_t pItemDefIDs, uint &punItemDefIDsArraySize ) : bool

After handling a SteamInventoryEligiblePromoItemDefIDs_t call result, use this

function to pull out the list of item definition ids that the user can be

manually granted via the AddPromoItems() call.

GetItemDefinitionIDs ( SteamItemDef_t pItemDefIDs, uint &punItemDefIDsArraySize ) : bool

GetItemDefinitionIDs returns the set of all defined item definition IDs (which are

defined via Steamworks configuration, and not necessarily contiguous integers).

If pItemDefIDs is null, the call will return true and *punItemDefIDsArraySize will

contain the total size necessary for a subsequent call. Otherwise, the call will

return false if and only if there is not enough space in the output array.

GetItemDefinitionProperty ( SteamItemDef_t iDefinition, string pchPropertyName, string &pchValueBuffer, uint &punValueBufferSizeOut ) : bool

GetItemDefinitionProperty returns a string property from a given item definition.

Note that some properties (for example, "name") may be localized and will depend

on the current Steam language settings (see ISteamApps::GetCurrentGameLanguage).

Property names are always composed of ASCII letters, numbers, and/or underscores.

Pass a NULL pointer for pchPropertyName to get a comma - separated list of available

property names. If pchValueBuffer is NULL, *punValueBufferSize will contain the

suggested buffer size. Otherwise it will be the number of bytes actually copied

to pchValueBuffer. If the results do not fit in the given buffer, partial

results may be copied.

GetItemsByID ( SteamInventoryResult_t &pResultHandle, SteamItemInstanceID_t pInstanceIDs, uint unCountInstanceIDs ) : bool

Captures the state of a subset of the current user's Steam inventory,

identified by an array of item instance IDs. The results from this call

can be serialized and passed to other players to "prove" that the current

user owns specific items, without exposing the user's entire inventory.

For example, you could call GetItemsByID with the IDs of the user's

currently equipped cosmetic items and serialize this to a buffer, and

then transmit this buffer to other players upon joining a game.

GetResultItems ( SteamInventoryResult_t resultHandle, SteamItemDetails_t pOutItemsArray, uint &punOutItemsArraySize ) : bool

Copies the contents of a result set into a flat array. The specific

contents of the result set depend on which query which was used.

GetResultStatus ( SteamInventoryResult_t resultHandle ) : EResult

INVENTORY ASYNC RESULT MANAGEMENT

Asynchronous inventory queries always output a result handle which can be used with

GetResultStatus, GetResultItems, etc. A SteamInventoryResultReady_t callback will

be triggered when the asynchronous result becomes ready (or fails).

Find out the status of an asynchronous inventory result handle. Possible values:

k_EResultPending - still in progress

k_EResultOK - done, result ready

k_EResultExpired - done, result ready, maybe out of date (see DeserializeResult)

k_EResultInvalidParam - ERROR: invalid API call parameters

k_EResultServiceUnavailable - ERROR: service temporarily down, you may retry later

k_EResultLimitExceeded - ERROR: operation would exceed per-user inventory limits

k_EResultFail - ERROR: unknown / generic error

GetResultTimestamp ( SteamInventoryResult_t resultHandle ) : uint

Returns the server time at which the result was generated. Compare against

the value of IClientUtils::GetServerRealTime() to determine age.

GrantPromoItems ( SteamInventoryResult_t &pResultHandle ) : bool

GrantPromoItems() checks the list of promotional items for which the user may be eligible

and grants the items (one time only). On success, the result set will include items which

were granted, if any. If no items were granted because the user isn't eligible for any

promotions, this is still considered a success.

LoadItemDefinitions ( ) : bool

ITEM DEFINITIONS

Item definitions are a mapping of "definition IDs" (integers between 1 and 1000000)

to a set of string properties. Some of these properties are required to display items

on the Steam community web site. Other properties can be defined by applications.

Use of these functions is optional; there is no reason to call LoadItemDefinitions

if your game hardcodes the numeric definition IDs (eg, purple face mask = 20, blue

weapon mod = 55) and does not allow for adding new item types without a client patch.

LoadItemDefinitions triggers the automatic load and refresh of item definitions.

Every time new item definitions are available (eg, from the dynamic addition of new

item types while players are still in-game), a SteamInventoryDefinitionUpdate_t

callback will be fired.

RequestEligiblePromoItemDefinitionsIDs ( CSteamID steamID ) : SteamAPICall_t

Request the list of "eligible" promo items that can be manually granted to the given

user. These are promo items of type "manual" that won't be granted automatically.

An example usage of this is an item that becomes available every week.

SendItemDropHeartbeat ( ) : void

TIMED DROPS AND PLAYTIME CREDIT

Deprecated. Calling this method is not required for proper playtime accounting.

SerializeResult ( SteamInventoryResult_t resultHandle, byte pOutBuffer, uint &punOutBufferSize ) : bool

RESULT SERIALIZATION AND AUTHENTICATION

Serialized result sets contain a short signature which can't be forged

or replayed across different game sessions. A result set can be serialized

on the local client, transmitted to other players via your game networking,

and deserialized by the remote players. This is a secure way of preventing

hackers from lying about posessing rare/high-value items.

Serializes a result set with signature bytes to an output buffer. Pass

NULL as an output buffer to get the required size via punOutBufferSize.

The size of a serialized result depends on the number items which are being

serialized. When securely transmitting items to other players, it is

recommended to use "GetItemsByID" first to create a minimal result set.

Results have a built-in timestamp which will be considered "expired" after

an hour has elapsed. See DeserializeResult for expiration handling.

TradeItems ( SteamInventoryResult_t &pResultHandle, CSteamID steamIDTradePartner, SteamItemInstanceID_t pArrayGive, uint pArrayGiveQuantity, uint nArrayGiveLength, SteamItemInstanceID_t pArrayGet, uint pArrayGetQuantity, uint nArrayGetLength ) : bool

IN-GAME TRADING

TradeItems() implements limited in-game trading of items, if you prefer not to use

the overlay or an in-game web browser to perform Steam Trading through the website.

You should implement a UI where both players can see and agree to a trade, and then

each client should call TradeItems simultaneously (+/- 5 seconds) with matching

(but reversed) parameters. The result is the same as if both players performed a

Steam Trading transaction through the web. Each player will get an inventory result

confirming the removal or quantity changes of the items given away, and the new

item instance id numbers and quantities of the received items.

(Note: new item instance IDs are generated whenever an item changes ownership.)

TransferItemQuantity ( SteamInventoryResult_t &pResultHandle, SteamItemInstanceID_t itemIdSource, uint unQuantity, SteamItemInstanceID_t itemIdDest ) : bool

TransferItemQuantity() is intended for use with items which are "stackable" (can have

quantity greater than one). It can be used to split a stack into two, or to transfer

quantity from one stack into another stack of identical items. To split one stack into

two, pass k_SteamItemInstanceIDInvalid for itemIdDest and a new item will be generated.

TriggerItemDrop ( SteamInventoryResult_t &pResultHandle, SteamItemDef_t dropListDefinition ) : bool

Playtime credit must be consumed and turned into item drops by your game. Only item

definitions which are marked as "playtime item generators" can be spawned. The call

will return an empty result set if there is not enough playtime credit for a drop.

Your game should call TriggerItemDrop at an appropriate time for the user to receive

new items, such as between rounds or while the player is dead. Note that players who

hack their clients could modify the value of "dropListDefinition", so do not use it

to directly control rarity.

See your Steamworks configuration to set playtime drop rates for individual itemdefs.

The client library will suppress too-frequent calls to this method.

Method Details

AddPromoItem() public static method

AddPromoItem() / AddPromoItems() are restricted versions of GrantPromoItems(). Instead of

scanning for all eligible promotional items, the check is restricted to a single item

definition or set of item definitions. This can be useful if your game has custom UI for

showing a specific promo item to the user.

public static AddPromoItem ( SteamInventoryResult_t &pResultHandle, SteamItemDef_t itemDef ) : bool
pResultHandle SteamInventoryResult_t
itemDef SteamItemDef_t
return bool

AddPromoItems() public static method

public static AddPromoItems ( SteamInventoryResult_t &pResultHandle, SteamItemDef_t pArrayItemDefs, uint unArrayLength ) : bool
pResultHandle SteamInventoryResult_t
pArrayItemDefs SteamItemDef_t
unArrayLength uint
return bool

CheckResultSteamID() public static method

Returns true if the result belongs to the target steam ID, false if the

result does not. This is important when using DeserializeResult, to verify

that a remote player is not pretending to have a different user's inventory.

public static CheckResultSteamID ( SteamInventoryResult_t resultHandle, CSteamID steamIDExpected ) : bool
resultHandle SteamInventoryResult_t
steamIDExpected CSteamID
return bool

ConsumeItem() public static method

ConsumeItem() removes items from the inventory, permanently. They cannot be recovered.

Not for the faint of heart - if your game implements item removal at all, a high-friction

UI confirmation process is highly recommended. Similar to GenerateItems, punArrayQuantity

can be NULL or else an array of the same length as pArrayItems which describe the quantity

of each item to destroy.

public static ConsumeItem ( SteamInventoryResult_t &pResultHandle, SteamItemInstanceID_t itemConsume, uint unQuantity ) : bool
pResultHandle SteamInventoryResult_t
itemConsume SteamItemInstanceID_t
unQuantity uint
return bool

DeserializeResult() public static method

Deserializes a result set and verifies the signature bytes. Returns false

if bRequireFullOnlineVerify is set but Steam is running in Offline mode.

Otherwise returns true and then delivers error codes via GetResultStatus.

The bRESERVED_MUST_BE_FALSE flag is reserved for future use and should not

be set to true by your game at this time.

DeserializeResult has a potential soft-failure mode where the handle status

is set to k_EResultExpired. GetResultItems() still succeeds in this mode.

The "expired" result could indicate that the data may be out of date - not

just due to timed expiration (one hour), but also because one of the items

in the result set may have been traded or consumed since the result set was

generated. You could compare the timestamp from GetResultTimestamp() to

ISteamUtils::GetServerRealTime() to determine how old the data is. You could

simply ignore the "expired" result code and continue as normal, or you

could challenge the player with expired data to send an updated result set.

public static DeserializeResult ( SteamInventoryResult_t &pOutResultHandle, byte pBuffer, uint unBufferSize, bool bRESERVED_MUST_BE_FALSE = false ) : bool
pOutResultHandle SteamInventoryResult_t
pBuffer byte
unBufferSize uint
bRESERVED_MUST_BE_FALSE bool
return bool

DestroyResult() public static method

Destroys a result handle and frees all associated memory.

public static DestroyResult ( SteamInventoryResult_t resultHandle ) : void
resultHandle SteamInventoryResult_t
return void

ExchangeItems() public static method

ExchangeItems() is an atomic combination of item generation and consumption.

It can be used to implement crafting recipes or transmutations, or items which unpack

themselves into other items (e.g., a chest).

ExchangeItems requires a whitelist - you must define recipes (lists of the components

required for the exchange) on the target ItemDefinition. Exchanges that do not match

a recipe, or do not provide the required amounts, will fail.

public static ExchangeItems ( SteamInventoryResult_t &pResultHandle, SteamItemDef_t pArrayGenerate, uint punArrayGenerateQuantity, uint unArrayGenerateLength, SteamItemInstanceID_t pArrayDestroy, uint punArrayDestroyQuantity, uint unArrayDestroyLength ) : bool
pResultHandle SteamInventoryResult_t
pArrayGenerate SteamItemDef_t
punArrayGenerateQuantity uint
unArrayGenerateLength uint
pArrayDestroy SteamItemInstanceID_t
punArrayDestroyQuantity uint
unArrayDestroyLength uint
return bool

GenerateItems() public static method

INVENTORY ASYNC MODIFICATION

GenerateItems() creates one or more items and then generates a SteamInventoryCallback_t

notification with a matching nCallbackContext parameter. This API is insecure, and could

be abused by hacked clients. This call is normally disabled unless you explicitly enable

"Development mode" on the Inventory Service section of the Steamworks website.

You should not enable this mode for a shipping game!

Note that Steam accounts that belong to the publisher group for your game are granted

an exception - as a developer, you may use this to generate and test items in your game.

If punArrayQuantity is not NULL, it should be the same length as pArrayItems and should

describe the quantity of each item to generate.

public static GenerateItems ( SteamInventoryResult_t &pResultHandle, SteamItemDef_t pArrayItemDefs, uint punArrayQuantity, uint unArrayLength ) : bool
pResultHandle SteamInventoryResult_t
pArrayItemDefs SteamItemDef_t
punArrayQuantity uint
unArrayLength uint
return bool

GetAllItems() public static method

INVENTORY ASYNC QUERY

Captures the entire state of the current user's Steam inventory.

You must call DestroyResult on this handle when you are done with it.

Returns false and sets *pResultHandle to zero if inventory is unavailable.

Note: calls to this function are subject to rate limits and may return

cached results if called too frequently. It is suggested that you call

this function only when you are about to display the user's full inventory,

or if you expect that the inventory may have changed.

public static GetAllItems ( SteamInventoryResult_t &pResultHandle ) : bool
pResultHandle SteamInventoryResult_t
return bool

GetEligiblePromoItemDefinitionIDs() public static method

After handling a SteamInventoryEligiblePromoItemDefIDs_t call result, use this

function to pull out the list of item definition ids that the user can be

manually granted via the AddPromoItems() call.

public static GetEligiblePromoItemDefinitionIDs ( CSteamID steamID, SteamItemDef_t pItemDefIDs, uint &punItemDefIDsArraySize ) : bool
steamID CSteamID
pItemDefIDs SteamItemDef_t
punItemDefIDsArraySize uint
return bool

GetItemDefinitionIDs() public static method

GetItemDefinitionIDs returns the set of all defined item definition IDs (which are

defined via Steamworks configuration, and not necessarily contiguous integers).

If pItemDefIDs is null, the call will return true and *punItemDefIDsArraySize will

contain the total size necessary for a subsequent call. Otherwise, the call will

return false if and only if there is not enough space in the output array.

public static GetItemDefinitionIDs ( SteamItemDef_t pItemDefIDs, uint &punItemDefIDsArraySize ) : bool
pItemDefIDs SteamItemDef_t
punItemDefIDsArraySize uint
return bool

GetItemDefinitionProperty() public static method

GetItemDefinitionProperty returns a string property from a given item definition.

Note that some properties (for example, "name") may be localized and will depend

on the current Steam language settings (see ISteamApps::GetCurrentGameLanguage).

Property names are always composed of ASCII letters, numbers, and/or underscores.

Pass a NULL pointer for pchPropertyName to get a comma - separated list of available

property names. If pchValueBuffer is NULL, *punValueBufferSize will contain the

suggested buffer size. Otherwise it will be the number of bytes actually copied

to pchValueBuffer. If the results do not fit in the given buffer, partial

results may be copied.

public static GetItemDefinitionProperty ( SteamItemDef_t iDefinition, string pchPropertyName, string &pchValueBuffer, uint &punValueBufferSizeOut ) : bool
iDefinition SteamItemDef_t
pchPropertyName string
pchValueBuffer string
punValueBufferSizeOut uint
return bool

GetItemsByID() public static method

Captures the state of a subset of the current user's Steam inventory,

identified by an array of item instance IDs. The results from this call

can be serialized and passed to other players to "prove" that the current

user owns specific items, without exposing the user's entire inventory.

For example, you could call GetItemsByID with the IDs of the user's

currently equipped cosmetic items and serialize this to a buffer, and

then transmit this buffer to other players upon joining a game.

public static GetItemsByID ( SteamInventoryResult_t &pResultHandle, SteamItemInstanceID_t pInstanceIDs, uint unCountInstanceIDs ) : bool
pResultHandle SteamInventoryResult_t
pInstanceIDs SteamItemInstanceID_t
unCountInstanceIDs uint
return bool

GetResultItems() public static method

Copies the contents of a result set into a flat array. The specific

contents of the result set depend on which query which was used.

public static GetResultItems ( SteamInventoryResult_t resultHandle, SteamItemDetails_t pOutItemsArray, uint &punOutItemsArraySize ) : bool
resultHandle SteamInventoryResult_t
pOutItemsArray SteamItemDetails_t
punOutItemsArraySize uint
return bool

GetResultStatus() public static method

INVENTORY ASYNC RESULT MANAGEMENT

Asynchronous inventory queries always output a result handle which can be used with

GetResultStatus, GetResultItems, etc. A SteamInventoryResultReady_t callback will

be triggered when the asynchronous result becomes ready (or fails).

Find out the status of an asynchronous inventory result handle. Possible values:

k_EResultPending - still in progress

k_EResultOK - done, result ready

k_EResultExpired - done, result ready, maybe out of date (see DeserializeResult)

k_EResultInvalidParam - ERROR: invalid API call parameters

k_EResultServiceUnavailable - ERROR: service temporarily down, you may retry later

k_EResultLimitExceeded - ERROR: operation would exceed per-user inventory limits

k_EResultFail - ERROR: unknown / generic error

public static GetResultStatus ( SteamInventoryResult_t resultHandle ) : EResult
resultHandle SteamInventoryResult_t
return EResult

GetResultTimestamp() public static method

Returns the server time at which the result was generated. Compare against

the value of IClientUtils::GetServerRealTime() to determine age.

public static GetResultTimestamp ( SteamInventoryResult_t resultHandle ) : uint
resultHandle SteamInventoryResult_t
return uint

GrantPromoItems() public static method

GrantPromoItems() checks the list of promotional items for which the user may be eligible

and grants the items (one time only). On success, the result set will include items which

were granted, if any. If no items were granted because the user isn't eligible for any

promotions, this is still considered a success.

public static GrantPromoItems ( SteamInventoryResult_t &pResultHandle ) : bool
pResultHandle SteamInventoryResult_t
return bool

LoadItemDefinitions() public static method

ITEM DEFINITIONS

Item definitions are a mapping of "definition IDs" (integers between 1 and 1000000)

to a set of string properties. Some of these properties are required to display items

on the Steam community web site. Other properties can be defined by applications.

Use of these functions is optional; there is no reason to call LoadItemDefinitions

if your game hardcodes the numeric definition IDs (eg, purple face mask = 20, blue

weapon mod = 55) and does not allow for adding new item types without a client patch.

LoadItemDefinitions triggers the automatic load and refresh of item definitions.

Every time new item definitions are available (eg, from the dynamic addition of new

item types while players are still in-game), a SteamInventoryDefinitionUpdate_t

callback will be fired.

public static LoadItemDefinitions ( ) : bool
return bool

RequestEligiblePromoItemDefinitionsIDs() public static method

Request the list of "eligible" promo items that can be manually granted to the given

user. These are promo items of type "manual" that won't be granted automatically.

An example usage of this is an item that becomes available every week.

public static RequestEligiblePromoItemDefinitionsIDs ( CSteamID steamID ) : SteamAPICall_t
steamID CSteamID
return SteamAPICall_t

SendItemDropHeartbeat() public static method

TIMED DROPS AND PLAYTIME CREDIT

Deprecated. Calling this method is not required for proper playtime accounting.

public static SendItemDropHeartbeat ( ) : void
return void

SerializeResult() public static method

RESULT SERIALIZATION AND AUTHENTICATION

Serialized result sets contain a short signature which can't be forged

or replayed across different game sessions. A result set can be serialized

on the local client, transmitted to other players via your game networking,

and deserialized by the remote players. This is a secure way of preventing

hackers from lying about posessing rare/high-value items.

Serializes a result set with signature bytes to an output buffer. Pass

NULL as an output buffer to get the required size via punOutBufferSize.

The size of a serialized result depends on the number items which are being

serialized. When securely transmitting items to other players, it is

recommended to use "GetItemsByID" first to create a minimal result set.

Results have a built-in timestamp which will be considered "expired" after

an hour has elapsed. See DeserializeResult for expiration handling.

public static SerializeResult ( SteamInventoryResult_t resultHandle, byte pOutBuffer, uint &punOutBufferSize ) : bool
resultHandle SteamInventoryResult_t
pOutBuffer byte
punOutBufferSize uint
return bool

TradeItems() public static method

IN-GAME TRADING

TradeItems() implements limited in-game trading of items, if you prefer not to use

the overlay or an in-game web browser to perform Steam Trading through the website.

You should implement a UI where both players can see and agree to a trade, and then

each client should call TradeItems simultaneously (+/- 5 seconds) with matching

(but reversed) parameters. The result is the same as if both players performed a

Steam Trading transaction through the web. Each player will get an inventory result

confirming the removal or quantity changes of the items given away, and the new

item instance id numbers and quantities of the received items.

(Note: new item instance IDs are generated whenever an item changes ownership.)

public static TradeItems ( SteamInventoryResult_t &pResultHandle, CSteamID steamIDTradePartner, SteamItemInstanceID_t pArrayGive, uint pArrayGiveQuantity, uint nArrayGiveLength, SteamItemInstanceID_t pArrayGet, uint pArrayGetQuantity, uint nArrayGetLength ) : bool
pResultHandle SteamInventoryResult_t
steamIDTradePartner CSteamID
pArrayGive SteamItemInstanceID_t
pArrayGiveQuantity uint
nArrayGiveLength uint
pArrayGet SteamItemInstanceID_t
pArrayGetQuantity uint
nArrayGetLength uint
return bool

TransferItemQuantity() public static method

TransferItemQuantity() is intended for use with items which are "stackable" (can have

quantity greater than one). It can be used to split a stack into two, or to transfer

quantity from one stack into another stack of identical items. To split one stack into

two, pass k_SteamItemInstanceIDInvalid for itemIdDest and a new item will be generated.

public static TransferItemQuantity ( SteamInventoryResult_t &pResultHandle, SteamItemInstanceID_t itemIdSource, uint unQuantity, SteamItemInstanceID_t itemIdDest ) : bool
pResultHandle SteamInventoryResult_t
itemIdSource SteamItemInstanceID_t
unQuantity uint
itemIdDest SteamItemInstanceID_t
return bool

TriggerItemDrop() public static method

Playtime credit must be consumed and turned into item drops by your game. Only item

definitions which are marked as "playtime item generators" can be spawned. The call

will return an empty result set if there is not enough playtime credit for a drop.

Your game should call TriggerItemDrop at an appropriate time for the user to receive

new items, such as between rounds or while the player is dead. Note that players who

hack their clients could modify the value of "dropListDefinition", so do not use it

to directly control rarity.

See your Steamworks configuration to set playtime drop rates for individual itemdefs.

The client library will suppress too-frequent calls to this method.

public static TriggerItemDrop ( SteamInventoryResult_t &pResultHandle, SteamItemDef_t dropListDefinition ) : bool
pResultHandle SteamInventoryResult_t
dropListDefinition SteamItemDef_t
return bool