Item Data
Last updated
Last updated
Provides easy access to detailed item information without needing a ScriptableObject. The ItemData structure can be implicitly converted from an int or item def meaning that if you know the ID of the item you want to work with you can get it without needing to look anything up.
Example:
This of course assumes you have "Updated" the inventory at some point previously which can also be done using this structure.
The HandleResult is an Action<InventoryResult>
callback that will invoke when the process is complete and will provide you with detailed information on all the item instances found. Once that completes you can use the ItemData structure to work with your items.
The id of this item
Will return the scriptable object related to this item if any is known. This only has a value if you are using SteamSettings and have configured InventoryObjects.
Gets the name of this item as it appears on the Steam store for this user.
True if this item has a price recorded on the Steam store available to this user. This will only work after Request Prices has been called at least once.
You can request prices using the ItemData as well
For more information see the RequestPrice method listed below.
Get the currency code used by this user
Gets the typical symbol used for the local user's currency e.g. $, โฌ, ยฃ, etc.
Gets the current price displayed to this user as a base 100 ... for example 199 would be โฌ1.99 assuming the user is using Euro.
Gets the base price of this item in the user's currency type, this is a base 100 ... for example 199 would be โฌ1.99 assuming the user is using Euro.
Returns a collection of ItemDetail which defines each "instance" of this item owned by this user.
Steam Inventory works with "item instances" you can think of an "instance" as being a stack or a "slot" in the inventory. Some item type can be stacked and so each "instance" may have a quantity from 0 to many. Thus the count of ItemDetails the user has does not necessarily equate to the "quantity" the user owns.
Returns the total number of this item that the user owns, that is this sums the "quantity" of every "instance" of this item the user owns.
Grants this item to this user ... IF ... the item is a configured promotional item and the user qualifies for this promotion according to the rules you defined on the item definition.
The callback should be a method of the form
Calculates a consume order that will consume the indicated number of this item ... if at all possible. This is meant to be used with the Consume
method.
Consume 1 or more of this item, consume destroys the item and cannot be undone.
or
or
The first option assumes you wish to consume 1 item and does not require you to create any orders first.
The second option should be used with GetConsumeOrders
.
The final and third option will get consume orders for you based on the input quantity and process them in a background thread.
This gets a collection of ExchangeEntry collections for a specified quantity of this item. This is meant to be used with the Exchange method.
For example if you wanted to exchange 10 of itemA
for 1 of itemB
.
The HandleResult method would look like such.
Exchanges a collection of ExchangeEntry
objects for 1 of this item type. This can be used to handle exchanging a loot box for the items inside, for crafting such as exchanging reagents for a crafted item, etc.
This will only work for users that are part of the development team for the project. It is meant for testing and debugging purposes only.
This generates a new item of this type in the users inventory.
or
If this item is valid for purchase this will add the item to the user's cart and open the cart in the Steam overlay so they can continue the purchase process.
or
Gets the current and base price as seen by the user. The values are returned in base 100 so a value of 199 would be โฌ1.99 assuming a local currency of Euro.
If this item is configured as a "Play Time Generator" this will cause Valve's Steam to test the rules and timers and if available generate an item for the player.
Gets the formatted price string of this item ... assuming it has a price and that the prices have already been requested from Valve's Steam API.
This does account for the user's cultural formatting and currency code for example โฌ1.99
would be used in Ireland while โฌ1,99
would be used many other regions of Europe.
Gets the formatted price string of this item from the base price ... assuming it has a price and that the prices have already been requested from Valve's Steam API.
This does account for the user's cultural formatting and currency code for example โฌ1.99
would be used in Ireland while โฌ1,99
would be used many other regions of Europe.
Used to request prices from Valve's Steam API, this only needs to be called once and would usually be called in your bootstrap shortly after updating all items and of course after the Steam API had been initialized.
Requests all inventory items from the Steam API and updates all item details based on the user's inventory. This should be called when you need to know the item states have all been updated recently such as just before opening an Inventory UI or similar.
A set of simple helpers that will return the ItemData object related to the input you provide
or
or
To exchange items we need to gather the instances of the reagents we want to exchange and pass them into the item wish to exchange for.
The following assumes 2 of each reagentA
and reagentB
are required to exchange/craft for itemA
.
See the method for an example of the usage.