Example #1
0
    private void OnLootboxResultReady(SteamInventoryResultReady_t pCallback)
    {
        Debug.Log("@OnLootboxResultReady called, callback params: " + pCallback.m_handle + ", " + pCallback.m_result);

        LootboxResult = pCallback.m_handle;
        uint size = 0;

        SteamItemDetails_t[] items;
        bool result = SteamInventory.GetResultItems(LootboxResult, null, ref size);

        if (result && size > 0)
        {
            items  = new SteamItemDetails_t[size];
            result = SteamInventory.GetResultItems(LootboxResult, items, ref size);
            Debug.LogWarning("@OnLootboxResultReady: Get lootbox result: " + result + " with items num: " + items.Length);

            UpdateInventory(items, display: true);

            /// Dispose results and update
            Debug.Log("Disposing resources");
            SteamInventory.DestroyResult(LootboxResult);
            _lootboxesRequested -= items.Length;
            if (_lootboxesRequested <= 0)
            {
                m_LootboxResultReady.Dispose();
            }
        }
    }
Example #2
0
    private void OnInventoryResultReady(SteamInventoryResultReady_t pCallback)
    {
        Debug.Log("@OnInventoryResultReady called, callback params: " + pCallback.m_handle + ", " + pCallback.m_result);

        InventoryResult = pCallback.m_handle;
        uint size = 0;

        SteamItemDetails_t[] items;
        bool result = SteamInventory.GetResultItems(InventoryResult, null, ref size);

        if (result && size > 0)
        {
            items = new SteamItemDetails_t[size];
            bool ret = SteamInventory.GetResultItems(InventoryResult, items, ref size);
            Debug.LogWarning("@OnInventoryResultReady: Inventory fetch result: " + ret + " with items num: " + items.Length);

            /// Add anew
            UpdateInventory(items, display: false);
        }
        else
        {
            Debug.LogWarning("@OnInventoryResultReady: InventoryResult = " + InventoryResult.m_SteamInventoryResult + ", Size = " + size + ". Could not get result items, problem may be in:\n" +
                             "- InventoryResult оказался недействительным, либо дескриптор результата действий с инвентарём оказался не готов.\n" +
                             "- Массив не уместился в pOutItemsArray.\n" +
                             "- У пользователя нет предметов.");
        }

        /// Dispose result
        SteamInventory.DestroyResult(InventoryResult);
    }
Example #3
0
            internal void OnSteamResult(SteamInventoryResultReady_t data)
            {
                var success = data.Result == SteamNative.Result.OK;

                if (success)
                {
                    Fill();
                }
            }
            internal void OnSteamResult(SteamInventoryResultReady_t data, bool error)
            {
                var success = data.Esult == SteamNative.Result.OK && !error;

                if (success)
                {
                    Fill();
                }
            }
 void ResultReadyCallbackHandler(SteamInventoryResultReady_t param)
 {
     Console.WriteLine($"Received {nameof(SteamInventoryResultReady_t)} callback.");
     if (param.m_handle == currentResult)
     {
         nextAction?.Invoke();
     }
     else
     {
         Console.WriteLine("Handle in callback does not match current handle!");
     }
 }
        private void onSteamInventoryResultReady(SteamInventoryResultReady_t callback)
        {
            SteamworksEconomyRequestHandle steamworksEconomyRequestHandle = this.findSteamworksEconomyRequestHandles(callback.m_handle);

            if (steamworksEconomyRequestHandle == null)
            {
                return;
            }
            IEconomyRequestResult inventoryRequestResult = this.createInventoryRequestResult(steamworksEconomyRequestHandle.steamInventoryResult);

            steamworksEconomyRequestHandle.triggerInventoryRequestReadyCallback(inventoryRequestResult);
            SteamInventory.DestroyResult(steamworksEconomyRequestHandle.steamInventoryResult);
        }
Example #7
0
        /// <summary>
        /// A generic result has returned.
        /// </summary>
        private void onResultReady(SteamInventoryResultReady_t data, bool error)
        {
            if (Result.Pending.ContainsKey(data.Handle))
            {
                var result = Result.Pending[data.Handle];

                result.OnSteamResult(data, error);

                if (!error && data.Esult == SteamNative.Result.OK)
                {
                    onResult(result, false);
                }

                Result.Pending.Remove(data.Handle);
            }
        }
Example #8
0
        /// <summary>
        /// A generic result has returned.
        /// </summary>
        private void onResultReady(SteamInventoryResultReady_t data)
        {
            if (Result.Pending.ContainsKey(data.Handle))
            {
                var result = Result.Pending[data.Handle];

                result.OnSteamResult(data);

                if (data.Result == SteamNative.Result.OK)
                {
                    onResult(result, false);
                }

                Result.Pending.Remove(data.Handle);
                result.Dispose();
            }
        }
Example #9
0
    private void OnItemResultReady(SteamInventoryResultReady_t pCallback)
    {
        Debug.Log("@OnItemResultReady called, callback params: " + pCallback.m_handle + ", " + pCallback.m_result);

        ItemResult = pCallback.m_handle;
        uint size = 0;

        SteamItemDetails_t[] items;
        bool result = SteamInventory.GetResultItems(ItemResult, null, ref size);

        if (result && size > 0)
        {
            items  = new SteamItemDetails_t[size];
            result = SteamInventory.GetResultItems(ItemResult, items, ref size);
            Debug.LogWarning("@OnItemResultReady: Get item result: " + result + " with items num: " + items.Length);

            UpdateInventory(items, display: true);
        }
    }
Example #10
0
        /// <summary>
        /// A generic result has returned.
        /// </summary>
        private void onResultReady(SteamInventoryResultReady_t data)
        {
            Result result;

            if (Result.Pending.TryGetValue(data.Handle, out result))
            {
                result.OnSteamResult(data);

                if (data.Result == SteamNative.Result.OK)
                {
                    onResult(result, false);
                }

                Result.Pending.Remove(data.Handle);
                result.Dispose();
            }
            else
            {
                result = new Result(this, data.Handle, false);
                result.Fill();
            }

            OnInventoryResultReady?.Invoke(result);
        }
Example #11
0
            public static bool Prefix(ref SteamInventoryResultReady_t callback,
                                      ref SteamInventoryResult_t ___inventoryResult,
                                      ref Dictionary <ulong, DynamicEconDetails> ___dynamicInventoryDetails,
                                      TempSteamworksEconomy __instance)
            {
                bool inst = false;

                if ((___inventoryResult != SteamInventoryResult_t.Invalid) && (callback.m_handle == ___inventoryResult))
                {
                    ___dynamicInventoryDetails.Clear();
                    uint num12 = 0;
                    if (SteamInventory.GetResultItems(___inventoryResult, null, ref num12) && (num12 > 0))
                    {
                        SteamItemDetails_t[] _tArray3 = new SteamItemDetails_t[num12];
                        SteamInventory.GetResultItems(___inventoryResult, _tArray3, ref num12);
                        for (uint i = 0; i < num12; i++)
                        {
                            string str7;

                            string str8;
                            uint   num14 = 0x400;
                            SteamInventory.GetResultItemProperty(___inventoryResult, i, "tags", out str7, ref num14);
                            uint num15 = 0x400;
                            SteamInventory.GetResultItemProperty(___inventoryResult, i, "dynamic_props", out str8, ref num15);
                            DynamicEconDetails details2 = new DynamicEconDetails
                            {
                                tags          = !string.IsNullOrEmpty(str7) ? str7 : string.Empty,
                                dynamic_props = !string.IsNullOrEmpty(str8) ? str8 : string.Empty
                            };
                            ___dynamicInventoryDetails.Add(_tArray3[i].m_itemId.m_SteamItemInstanceID, details2);
                        }

                        __instance.inventoryDetails = new List <SteamItemDetails_t>(_tArray3);

                        inst = true;
                    }

                    if (!inst)
                    {
                        __instance.inventoryDetails = new List <SteamItemDetails_t>();
                    }

                    //Add custom skins
                    foreach (Sk t in SkinList)
                    {
                        __instance.inventoryDetails.Add(new SteamItemDetails_t()
                        {
                            m_iDefinition = new SteamItemDef_t(t.itemDef),
                            m_itemId      = new SteamItemInstanceID_t(t.instanceId),
                            m_unFlags     = 0,
                            m_unQuantity  = 1
                        });
                    }

                    __instance.consolidateStacks();
                    __instance.onInventoryRefreshed?.Invoke();
                    __instance.isInventoryAvailable = true;
                    Provider.isLoadingInventory     = false;
                    SteamInventory.DestroyResult(___inventoryResult);
                    ___inventoryResult = SteamInventoryResult_t.Invalid;

                    return(false);
                }

                return(true);
            }
Example #12
0
 // Token: 0x0600174B RID: 5963 RVA: 0x000862F8 File Offset: 0x000846F8
 private void onInventoryResultReady(SteamInventoryResultReady_t callback)
 {
     if (this.appInfo.isDedicated)
     {
         SteamPending steamPending = null;
         for (int i = 0; i < Provider.pending.Count; i++)
         {
             if (Provider.pending[i].inventoryResult == callback.m_handle)
             {
                 steamPending = Provider.pending[i];
                 break;
             }
         }
         if (steamPending == null)
         {
             return;
         }
         if (callback.m_result != EResult.k_EResultOK || !SteamGameServerInventory.CheckResultSteamID(callback.m_handle, steamPending.playerID.steamID))
         {
             Debug.Log(string.Concat(new object[]
             {
                 "inventory auth: ",
                 callback.m_result,
                 " ",
                 SteamGameServerInventory.CheckResultSteamID(callback.m_handle, steamPending.playerID.steamID)
             }));
             Provider.reject(steamPending.playerID.steamID, ESteamRejection.AUTH_ECON_VERIFY);
             return;
         }
         uint num = 0u;
         if (SteamGameServerInventory.GetResultItems(callback.m_handle, null, ref num) && num > 0u)
         {
             steamPending.inventoryDetails = new SteamItemDetails_t[num];
             SteamGameServerInventory.GetResultItems(callback.m_handle, steamPending.inventoryDetails, ref num);
             for (uint num2 = 0u; num2 < num; num2 += 1u)
             {
                 uint   num3 = 1024u;
                 string text;
                 SteamGameServerInventory.GetResultItemProperty(callback.m_handle, num2, "tags", out text, ref num3);
                 uint   num4 = 1024u;
                 string text2;
                 SteamGameServerInventory.GetResultItemProperty(callback.m_handle, num2, "dynamic_props", out text2, ref num4);
                 DynamicEconDetails value = default(DynamicEconDetails);
                 value.tags          = ((!string.IsNullOrEmpty(text)) ? text : string.Empty);
                 value.dynamic_props = ((!string.IsNullOrEmpty(text2)) ? text2 : string.Empty);
                 steamPending.dynamicInventoryDetails.Add(steamPending.inventoryDetails[(int)((UIntPtr)num2)].m_itemId.m_SteamItemInstanceID, value);
             }
         }
         steamPending.inventoryDetailsReady();
     }
     else if (this.promoResult != SteamInventoryResult_t.Invalid && callback.m_handle == this.promoResult)
     {
         SteamInventory.DestroyResult(this.promoResult);
         this.promoResult = SteamInventoryResult_t.Invalid;
     }
     else if (this.exchangeResult != SteamInventoryResult_t.Invalid && callback.m_handle == this.exchangeResult)
     {
         SteamItemDetails_t[] array = null;
         string tags          = null;
         string dynamic_props = null;
         uint   num5          = 0u;
         if (SteamInventory.GetResultItems(this.exchangeResult, null, ref num5) && num5 > 0u)
         {
             array = new SteamItemDetails_t[num5];
             SteamInventory.GetResultItems(this.exchangeResult, array, ref num5);
             uint num6 = 1024u;
             SteamInventory.GetResultItemProperty(this.exchangeResult, num5 - 1u, "tags", out tags, ref num6);
             uint num7 = 1024u;
             SteamInventory.GetResultItemProperty(this.exchangeResult, num5 - 1u, "dynamic_props", out dynamic_props, ref num7);
         }
         Terminal.print("onInventoryResultReady: Exchange " + num5, null, Provider.STEAM_IC, Provider.STEAM_DC, true);
         if (array != null && num5 > 0u)
         {
             SteamItemDetails_t item = array[(int)((UIntPtr)(num5 - 1u))];
             this.addLocalItem(item, tags, dynamic_props);
             if (this.onInventoryExchanged != null)
             {
                 this.onInventoryExchanged(item.m_iDefinition.m_SteamItemDef, item.m_unQuantity, item.m_itemId.m_SteamItemInstanceID);
             }
             this.refreshInventory();
         }
         SteamInventory.DestroyResult(this.exchangeResult);
         this.exchangeResult = SteamInventoryResult_t.Invalid;
     }
     else if (this.dropResult != SteamInventoryResult_t.Invalid && callback.m_handle == this.dropResult)
     {
         SteamItemDetails_t[] array2 = null;
         string tags2          = null;
         string dynamic_props2 = null;
         uint   num8           = 0u;
         if (SteamInventory.GetResultItems(this.dropResult, null, ref num8) && num8 > 0u)
         {
             array2 = new SteamItemDetails_t[num8];
             SteamInventory.GetResultItems(this.dropResult, array2, ref num8);
             uint num9 = 1024u;
             SteamInventory.GetResultItemProperty(this.dropResult, 0u, "tags", out tags2, ref num9);
             uint num10 = 1024u;
             SteamInventory.GetResultItemProperty(this.dropResult, 0u, "dynamic_props", out dynamic_props2, ref num10);
         }
         Terminal.print("onInventoryResultReady: Drop " + num8, null, Provider.STEAM_IC, Provider.STEAM_DC, true);
         if (array2 != null && num8 > 0u)
         {
             SteamItemDetails_t item2 = array2[0];
             this.addLocalItem(item2, tags2, dynamic_props2);
             if (this.onInventoryDropped != null)
             {
                 this.onInventoryDropped(item2.m_iDefinition.m_SteamItemDef, item2.m_unQuantity, item2.m_itemId.m_SteamItemInstanceID);
             }
             this.refreshInventory();
         }
         SteamInventory.DestroyResult(this.dropResult);
         this.dropResult = SteamInventoryResult_t.Invalid;
     }
     else if (this.inventoryResult != SteamInventoryResult_t.Invalid && callback.m_handle == this.inventoryResult)
     {
         this.dynamicInventoryDetails.Clear();
         uint num11 = 0u;
         if (SteamInventory.GetResultItems(this.inventoryResult, null, ref num11) && num11 > 0u)
         {
             this.inventoryDetails = new SteamItemDetails_t[num11];
             SteamInventory.GetResultItems(this.inventoryResult, this.inventoryDetails, ref num11);
             for (uint num12 = 0u; num12 < num11; num12 += 1u)
             {
                 uint   num13 = 1024u;
                 string text3;
                 SteamInventory.GetResultItemProperty(this.inventoryResult, num12, "tags", out text3, ref num13);
                 uint   num14 = 1024u;
                 string text4;
                 SteamInventory.GetResultItemProperty(this.inventoryResult, num12, "dynamic_props", out text4, ref num14);
                 DynamicEconDetails value2 = default(DynamicEconDetails);
                 value2.tags          = ((!string.IsNullOrEmpty(text3)) ? text3 : string.Empty);
                 value2.dynamic_props = ((!string.IsNullOrEmpty(text4)) ? text4 : string.Empty);
                 this.dynamicInventoryDetails.Add(this.inventoryDetails[(int)((UIntPtr)num12)].m_itemId.m_SteamItemInstanceID, value2);
             }
         }
         if (this.onInventoryRefreshed != null)
         {
             this.onInventoryRefreshed();
         }
         this.isInventoryAvailable   = true;
         Provider.isLoadingInventory = false;
         SteamInventory.DestroyResult(this.inventoryResult);
         this.inventoryResult = SteamInventoryResult_t.Invalid;
     }
     else if (this.commitResult != SteamInventoryResult_t.Invalid && callback.m_handle == this.commitResult)
     {
         Debug.Log("Commit dynamic properties result: " + callback.m_result);
         SteamInventory.DestroyResult(this.commitResult);
         this.commitResult = SteamInventoryResult_t.Invalid;
     }
 }
Example #13
0
    void OnSteamInventoryResultReady(SteamInventoryResultReady_t pCallback)
    {
        Debug.Log("[" + SteamInventoryResultReady_t.k_iCallback + " - SteamInventoryResultReady] - " + pCallback.m_handle + " -- " + pCallback.m_result);

        m_SteamInventoryResult = pCallback.m_handle;
    }
 private void onInventoryResultReady(SteamInventoryResultReady_t callback)
 {
     if (this.appInfo.isDedicated)
     {
         SteamPending steamPending = null;
         for (int i = 0; i < Provider.pending.Count; i++)
         {
             if (Provider.pending[i].inventoryResult == callback.m_handle)
             {
                 steamPending = Provider.pending[i];
                 break;
             }
         }
         if (steamPending == null)
         {
             return;
         }
         if (callback.m_result != 1 || !SteamGameServerInventory.CheckResultSteamID(callback.m_handle, steamPending.playerID.steamID))
         {
             Debug.Log(string.Concat(new object[]
             {
                 "inventory auth: ",
                 callback.m_result,
                 " ",
                 SteamGameServerInventory.CheckResultSteamID(callback.m_handle, steamPending.playerID.steamID)
             }));
             Provider.reject(steamPending.playerID.steamID, ESteamRejection.AUTH_ECON_VERIFY);
             return;
         }
         uint num = 0u;
         if (SteamGameServerInventory.GetResultItems(callback.m_handle, null, ref num) && num > 0u)
         {
             steamPending.inventoryDetails = new SteamItemDetails_t[num];
             SteamGameServerInventory.GetResultItems(callback.m_handle, steamPending.inventoryDetails, ref num);
         }
         steamPending.inventoryDetailsReady();
     }
     else if (this.promoResult != SteamInventoryResult_t.Invalid && callback.m_handle == this.promoResult)
     {
         SteamInventory.DestroyResult(this.promoResult);
         this.promoResult = SteamInventoryResult_t.Invalid;
     }
     else if (this.exchangeResult != SteamInventoryResult_t.Invalid && callback.m_handle == this.exchangeResult)
     {
         SteamItemDetails_t[] array = null;
         uint num2 = 0u;
         if (SteamInventory.GetResultItems(this.exchangeResult, null, ref num2) && num2 > 0u)
         {
             array = new SteamItemDetails_t[num2];
             SteamInventory.GetResultItems(this.exchangeResult, array, ref num2);
         }
         Terminal.print("onInventoryResultReady: Exchange " + num2, null, Provider.STEAM_IC, Provider.STEAM_DC, true);
         if (array != null && num2 > 0u)
         {
             SteamItemDetails_t item = array[(int)((UIntPtr)(num2 - 1u))];
             this.addLocalItem(item);
             if (this.onInventoryExchanged != null)
             {
                 this.onInventoryExchanged(item.m_iDefinition.m_SteamItemDef, item.m_unQuantity, item.m_itemId.m_SteamItemInstanceID);
             }
             this.refreshInventory();
         }
         SteamInventory.DestroyResult(this.exchangeResult);
         this.exchangeResult = SteamInventoryResult_t.Invalid;
     }
     else if (this.dropResult != SteamInventoryResult_t.Invalid && callback.m_handle == this.dropResult)
     {
         SteamItemDetails_t[] array2 = null;
         uint num3 = 0u;
         if (SteamInventory.GetResultItems(this.dropResult, null, ref num3) && num3 > 0u)
         {
             array2 = new SteamItemDetails_t[num3];
             SteamInventory.GetResultItems(this.dropResult, array2, ref num3);
         }
         Terminal.print("onInventoryResultReady: Drop " + num3, null, Provider.STEAM_IC, Provider.STEAM_DC, true);
         if (array2 != null && num3 > 0u)
         {
             SteamItemDetails_t item2 = array2[0];
             this.addLocalItem(item2);
             if (this.onInventoryDropped != null)
             {
                 this.onInventoryDropped(item2.m_iDefinition.m_SteamItemDef, item2.m_unQuantity, item2.m_itemId.m_SteamItemInstanceID);
             }
             this.refreshInventory();
         }
         SteamInventory.DestroyResult(this.dropResult);
         this.dropResult = SteamInventoryResult_t.Invalid;
     }
     else if (this.inventoryResult != SteamInventoryResult_t.Invalid && callback.m_handle == this.inventoryResult)
     {
         uint num4 = 0u;
         if (SteamInventory.GetResultItems(this.inventoryResult, null, ref num4) && num4 > 0u)
         {
             this.inventoryDetails = new SteamItemDetails_t[num4];
             SteamInventory.GetResultItems(this.inventoryResult, this.inventoryDetails, ref num4);
         }
         if (this.onInventoryRefreshed != null)
         {
             this.onInventoryRefreshed();
         }
         this.isInventoryAvailable   = true;
         Provider.isLoadingInventory = false;
         SteamInventory.DestroyResult(this.inventoryResult);
         this.inventoryResult = SteamInventoryResult_t.Invalid;
     }
 }