Exemplo n.º 1
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);
            }