/// <summary> /// <para> IN-GAME TRADING</para> /// <para> TradeItems() implements limited in-game trading of items, if you prefer not to use</para> /// <para> the overlay or an in-game web browser to perform Steam Trading through the website.</para> /// <para> You should implement a UI where both players can see and agree to a trade, and then</para> /// <para> each client should call TradeItems simultaneously (+/- 5 seconds) with matching</para> /// <para> (but reversed) parameters. The result is the same as if both players performed a</para> /// <para> Steam Trading transaction through the web. Each player will get an inventory result</para> /// <para> confirming the removal or quantity changes of the items given away, and the new</para> /// <para> item instance id numbers and quantities of the received items.</para> /// <para> (Note: new item instance IDs are generated whenever an item changes ownership.)</para> /// </summary> public static bool TradeItems(out SteamInventoryResult_t pResultHandle, CSteamID steamIDTradePartner, SteamItemInstanceID_t[] pArrayGive, uint[] pArrayGiveQuantity, uint nArrayGiveLength, SteamItemInstanceID_t[] pArrayGet, uint[] pArrayGetQuantity, uint nArrayGetLength) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamGameServerInventory_TradeItems(out pResultHandle, steamIDTradePartner, pArrayGive, pArrayGiveQuantity, nArrayGiveLength, pArrayGet, pArrayGetQuantity, nArrayGetLength); }
/// <summary> /// <para> Captures the state of a subset of the current user's Steam inventory,</para> /// <para> identified by an array of item instance IDs. The results from this call</para> /// <para> can be serialized and passed to other players to "prove" that the current</para> /// <para> user owns specific items, without exposing the user's entire inventory.</para> /// <para> For example, you could call GetItemsByID with the IDs of the user's</para> /// <para> currently equipped cosmetic items and serialize this to a buffer, and</para> /// <para> then transmit this buffer to other players upon joining a game.</para> /// </summary> public static bool GetItemsByID(out SteamInventoryResult_t pResultHandle, SteamItemInstanceID_t[] pInstanceIDs, uint unCountInstanceIDs) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamGameServerInventory_GetItemsByID(out pResultHandle, pInstanceIDs, unCountInstanceIDs); }
/// <summary> /// <para> TransferItemQuantity() is intended for use with items which are "stackable" (can have</para> /// <para> quantity greater than one). It can be used to split a stack into two, or to transfer</para> /// <para> quantity from one stack into another stack of identical items. To split one stack into</para> /// <para> two, pass k_SteamItemInstanceIDInvalid for itemIdDest and a new item will be generated.</para> /// </summary> public static bool TransferItemQuantity(out SteamInventoryResult_t pResultHandle, SteamItemInstanceID_t itemIdSource, uint unQuantity, SteamItemInstanceID_t itemIdDest) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamGameServerInventory_TransferItemQuantity(out pResultHandle, itemIdSource, unQuantity, itemIdDest); }
/// <summary> /// <para> ExchangeItems() is an atomic combination of GenerateItems and DestroyItems. It can be</para> /// <para> used to implement crafting recipes or transmutations, or items which unpack themselves</para> /// <para> into other items. Like GenerateItems, this is a flexible and dangerous API which is</para> /// <para> meant for rapid prototyping. You can configure restrictions on ExchangeItems via the</para> /// <para> Steamworks website, such as limiting it to a whitelist of input/output combinations</para> /// <para> corresponding to recipes.</para> /// <para> (Note: although GenerateItems may be hard or impossible to use securely in your game,</para> /// <para> ExchangeItems is perfectly reasonable to use once the whitelists are set accordingly.)</para> /// </summary> public static bool ExchangeItems(out SteamInventoryResult_t pResultHandle, SteamItemDef_t[] pArrayGenerate, uint[] punArrayGenerateQuantity, uint unArrayGenerateLength, SteamItemInstanceID_t[] pArrayDestroy, uint[] punArrayDestroyQuantity, uint unArrayDestroyLength) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamGameServerInventory_ExchangeItems(out pResultHandle, pArrayGenerate, punArrayGenerateQuantity, unArrayGenerateLength, pArrayDestroy, punArrayDestroyQuantity, unArrayDestroyLength); }
/// <summary> /// <para> ConsumeItem() removes items from the inventory, permenantly. They cannot be recovered.</para> /// <para> Not for the faint of heart - if your game implements item removal at all, a high-friction</para> /// <para> UI confirmation process is highly recommended. Similar to GenerateItems, punArrayQuantity</para> /// <para> can be NULL or else an array of the same length as pArrayItems which describe the quantity</para> /// <para> of each item to destroy. ConsumeItem can be restricted to certain item definitions or</para> /// <para> fully blocked via the Steamworks website to minimize support/abuse issues such as the</para> /// <para> clasic "my brother borrowed my laptop and deleted all of my rare items".</para> /// </summary> public static bool ConsumeItem(out SteamInventoryResult_t pResultHandle, SteamItemInstanceID_t itemConsume, uint unQuantity) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamGameServerInventory_ConsumeItem(out pResultHandle, itemConsume, unQuantity); }
public static extern bool ISteamGameServerInventory_TransferItemQuantity(out SteamInventoryResult_t pResultHandle, SteamItemInstanceID_t itemIdSource, uint unQuantity, SteamItemInstanceID_t itemIdDest);
public static extern bool ISteamGameServerInventory_ConsumeItem(out SteamInventoryResult_t pResultHandle, SteamItemInstanceID_t itemConsume, uint unQuantity);