示例#1
0
        /// <summary>
        /// This is used to grant a specific item to the user. This should
        /// only be used for development prototyping, from a trusted server,
        /// or if you don't care about hacked clients granting arbitrary items.
        /// This call can be disabled by a setting on Steamworks.
        /// </summary>
        public Result GenerateItem(Definition target, int amount)
        {
            SteamNative.SteamInventoryResult_t resultHandle = -1;

            var newItems = new SteamNative.SteamItemDef_t[] { new SteamNative.SteamItemDef_t()
                                                              {
                                                                  Value = target.Id
                                                              } };
            var newItemC = new uint[] { (uint)amount };

            if (!inventory.GenerateItems(ref resultHandle, newItems, newItemC, 1))
            {
                return(null);
            }

            return(new Result(this, resultHandle, true));
        }
示例#2
0
        /// <summary>
        /// Crafting! Uses the passed items to buy the target item.
        /// You need to have set up the appropriate exchange rules in your item
        /// definitions.
        /// </summary>
        public Result CraftItem(Item.Amount[] list, Definition target)
        {
            SteamNative.SteamInventoryResult_t resultHandle = -1;

            var newItems = new SteamNative.SteamItemDef_t[] { new SteamNative.SteamItemDef_t()
                                                              {
                                                                  Value = target.Id
                                                              } };
            var newItemC = new uint[] { 1 };

            var takeItems  = list.Select(x => (SteamNative.SteamItemInstanceID_t)x.Item.Id).ToArray();
            var takeItemsC = list.Select(x => (uint)x.Quantity).ToArray();

            if (!inventory.ExchangeItems(ref resultHandle, newItems, newItemC, 1, takeItems, takeItemsC, (uint)takeItems.Length))
            {
                return(null);
            }

            return(new Result(this, resultHandle, true));
        }
 // bool
 public bool TriggerItemDrop(ref SteamInventoryResult_t pResultHandle /*SteamInventoryResult_t **/, SteamItemDef_t dropListDefinition /*SteamItemDef_t*/)
 {
     return(platform.ISteamInventory_TriggerItemDrop(ref pResultHandle.Value, dropListDefinition.Value));
 }
 // bool
 public bool AddPromoItem(ref SteamInventoryResult_t pResultHandle /*SteamInventoryResult_t **/, SteamItemDef_t itemDef /*SteamItemDef_t*/)
 {
     return(platform.ISteamInventory_AddPromoItem(ref pResultHandle.Value, itemDef.Value));
 }
 // bool
 public bool GetItemPrice(SteamItemDef_t iDefinition /*SteamItemDef_t*/, out ulong pPrice /*uint64 **/)
 {
     return(platform.ISteamInventory_GetItemPrice(iDefinition.Value, out pPrice));
 }