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(); } } }
private void Update() { if (!Global.isSteamActive || !m_waitForResult) { return; } EResult resultStatus = SteamInventory.GetResultStatus(m_resultHandle); switch (resultStatus) { case EResult.k_EResultPending: return; case EResult.k_EResultOK: { uint punOutItemsArraySize = 0u; if (SteamInventory.GetResultItems(m_resultHandle, null, ref punOutItemsArraySize) && punOutItemsArraySize != 0) { SteamItemDetails_t[] array = new SteamItemDetails_t[punOutItemsArraySize]; SteamInventory.GetResultItems(m_resultHandle, array, ref punOutItemsArraySize); m_itemDetails.AddRange(array); } EquipSteamInventoryItems(); break; } default: Debug.Log("SteamInventoryHandler.cs: Couldn't get inventory: " + resultStatus); break; } SteamInventory.DestroyResult(m_resultHandle); m_waitForResult = false; }
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); }
private void Update() { if (Global.isSteamActive && this.m_waitForResult) { EResult resultStatus = SteamInventory.GetResultStatus(this.m_resultHandle); if (resultStatus != EResult.k_EResultPending) { if (resultStatus == EResult.k_EResultOK) { uint num = 0U; if (SteamInventory.GetResultItems(this.m_resultHandle, null, ref num) && num > 0U) { SteamItemDetails_t[] array = new SteamItemDetails_t[num]; SteamInventory.GetResultItems(this.m_resultHandle, array, ref num); this.m_itemDetails.AddRange(array); } this.EquipSteamInventoryItems(); } else { Debug.Log("SteamInventoryHandler.cs: Couldn't get inventory: " + resultStatus.ToString()); } SteamInventory.DestroyResult(this.m_resultHandle); this.m_waitForResult = false; } } }
private void HandleDropResult() { if (!m_waitForResult || !Global.isSteamActive) { return; } bool flag = false; EResult resultStatus = SteamInventory.GetResultStatus(m_itemDropHandle); switch (resultStatus) { case EResult.k_EResultPending: return; case EResult.k_EResultOK: { uint punOutItemsArraySize = 0u; if (!SteamInventory.GetResultItems(m_itemDropHandle, null, ref punOutItemsArraySize)) { break; } SteamItemDetails_t[] array = new SteamItemDetails_t[punOutItemsArraySize]; if (punOutItemsArraySize != 0) { SteamInventory.GetResultItems(m_itemDropHandle, array, ref punOutItemsArraySize); for (int i = 0; i < array.Length; i++) { if ((array[i].m_unFlags & 0x100) == 0) { m_itemPopupGui.ShowGui(true, array[i].m_iDefinition.m_SteamItemDef); break; } } } else { flag = true; } break; } default: Debug.Log("RemoteCharacter.cs: Couldn't get item drop: " + resultStatus); break; } SteamInventory.DestroyResult(m_itemDropHandle); m_waitForResult = false; if (flag) { GetPromoItem(); } }
private void HandleDropResult() { if (this.m_waitForResult && Global.isSteamActive) { bool flag = false; EResult resultStatus = SteamInventory.GetResultStatus(this.m_itemDropHandle); if (resultStatus != EResult.k_EResultPending) { if (resultStatus == EResult.k_EResultOK) { uint num = 0U; if (SteamInventory.GetResultItems(this.m_itemDropHandle, null, ref num)) { SteamItemDetails_t[] array = new SteamItemDetails_t[num]; if (num > 0U) { SteamInventory.GetResultItems(this.m_itemDropHandle, array, ref num); for (int i = 0; i < array.Length; i++) { if ((array[i].m_unFlags & 256) == 0) { this.m_itemPopupGui.ShowGui(true, array[i].m_iDefinition.m_SteamItemDef); break; } } } else { flag = true; } } } else { Debug.Log("RemoteCharacter.cs: Couldn't get item drop: " + resultStatus.ToString()); } SteamInventory.DestroyResult(this.m_itemDropHandle); this.m_waitForResult = false; if (flag) { this.GetPromoItem(); } } } }
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); } }
void LoadItemDetails() { EnsureStatusOK(); Console.WriteLine("Items obtained."); // Demo 2: fetching items from result // Get the number of items available first, by setting the items array argument to null uint itemCount = 0; if (!SteamInventory.GetResultItems(currentResult, null, ref itemCount)) { throw new Exception("Failed to get item count."); } // Now get the items currentDetails = new SteamItemDetails_t[itemCount]; if (!SteamInventory.GetResultItems(currentResult, currentDetails, ref itemCount)) { throw new Exception("Failed to get items."); } // We're going to fetch items individually afterwards, so destroy result SteamInventory.DestroyResult(currentResult); currentResult = SteamInventoryResult_t.Invalid; // Not a Steamworks demo, but we can find total number of each item by aggregating, // if they don't stack. Console.WriteLine(); Console.WriteLine("Aggregated total of items by definition"); Console.WriteLine("Definition number\tQuanity"); foreach (var group in currentDetails.GroupBy(itm => itm.m_iDefinition)) { Console.WriteLine($"{group.Key}\t{group.Sum(itm => itm.m_unQuantity)}"); } nextAction = null; InteractiveGetDetails(); }
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); }
// 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; } }
private void UpdateInventory() { if (Global.isSteamActive && this.m_waitForResult) { EResult resultStatus = SteamInventory.GetResultStatus(this.m_resultHandle); if (resultStatus != EResult.k_EResultPending) { if (resultStatus == EResult.k_EResultOK) { uint num = 0U; if (SteamInventory.GetResultItems(this.m_resultHandle, null, ref num)) { SteamItemDetails_t[] array = new SteamItemDetails_t[num]; int num2 = 0; if (this.m_completeRefresh) { this.m_itemDetails.Clear(); } if (num > 0U) { SteamInventory.GetResultItems(this.m_resultHandle, array, ref num); if (this.m_completeRefresh) { this.m_itemDetails.AddRange(array); } else { for (int i = 0; i < array.Length; i++) { for (int j = 0; j < this.m_itemDetails.Count; j++) { if (array[i].m_itemId.m_SteamItemInstanceID == this.m_itemDetails[j].m_itemId.m_SteamItemInstanceID && 0 < (array[i].m_unFlags & 256)) { this.m_itemDetails.RemoveAt(j); break; } } } for (int k = 0; k < array.Length; k++) { if ((array[k].m_unFlags & 256) == 0) { this.m_itemDetails.Add(array[k]); num2 = array[k].m_iDefinition.m_SteamItemDef; } } } int lookItemDef = this.m_steamInventoryHandler.GetLookItemDef(); int skinItemDef = this.m_steamInventoryHandler.GetSkinItemDef(); bool flag = true; bool flag2 = true; int num3 = 0; for (int l = 0; l < this.m_itemDetails.Count; l++) { if (this.m_itemDetails[l].m_iDefinition.m_SteamItemDef == lookItemDef) { flag = false; } else if (this.m_itemDetails[l].m_iDefinition.m_SteamItemDef == skinItemDef) { flag2 = false; } if (3000 > this.m_itemDetails[l].m_iDefinition.m_SteamItemDef) { num3++; } } if (flag2 || flag) { this.m_steamInventoryHandler.SetLook((!flag) ? lookItemDef : 0, (!flag2) ? skinItemDef : 0); } this.m_txtCaseCount.transform.parent.gameObject.SetActive(0 < num3); this.m_txtCaseCount.text = num3.ToString(); } if (this.m_caseOpenFlag && num2 != 0) { this.m_caseOpenGui.Showtime(num2, this.m_generatorDefId); } else { this.UpdateInventoryDisplay(); } } } else { Debug.Log("SteamInventoryGUI.cs: Couldn't get inventory: " + resultStatus.ToString()); } SteamInventory.DestroyResult(this.m_resultHandle); this.m_waitForResult = false; } } }
public void RenderOnGUI() { GUILayout.BeginArea(new Rect(Screen.width - 200, 0, 200, Screen.height)); GUILayout.Label("Variables:"); GUILayout.Label("m_SteamInventoryResult: " + m_SteamInventoryResult); GUILayout.Label("m_SteamItemDetails: " + m_SteamItemDetails); GUILayout.Label("m_SteamItemDef: " + m_SteamItemDef); GUILayout.Label("m_SerializedBuffer: " + m_SerializedBuffer); GUILayout.EndArea(); GUILayout.BeginVertical("box"); m_ScrollPos = GUILayout.BeginScrollView(m_ScrollPos, GUILayout.Width(Screen.width - 215), GUILayout.Height(Screen.height - 33)); // INVENTORY ASYNC RESULT MANAGEMENT GUILayout.Label("GetResultStatus(m_SteamInventoryResult) : " + SteamInventory.GetResultStatus(m_SteamInventoryResult)); if (GUILayout.Button("GetResultItems(m_SteamInventoryResult, m_SteamItemDetails, ref OutItemsArraySize)")) { uint OutItemsArraySize = 0; bool ret = SteamInventory.GetResultItems(m_SteamInventoryResult, null, ref OutItemsArraySize); if (ret && OutItemsArraySize > 0) { m_SteamItemDetails = new SteamItemDetails_t[OutItemsArraySize]; ret = SteamInventory.GetResultItems(m_SteamInventoryResult, m_SteamItemDetails, ref OutItemsArraySize); print("SteamInventory.GetResultItems(" + m_SteamInventoryResult + ", m_SteamItemDetails, out OutItemsArraySize) - " + ret + " -- " + OutItemsArraySize); System.Text.StringBuilder test = new System.Text.StringBuilder(); for (int i = 0; i < OutItemsArraySize; ++i) { test.AppendFormat("{0} - {1} - {2} - {3} - {4}\n", i, m_SteamItemDetails[i].m_itemId, m_SteamItemDetails[i].m_iDefinition, m_SteamItemDetails[i].m_unQuantity, m_SteamItemDetails[i].m_unFlags); } print(test); } else { print("SteamInventory.GetResultItems(" + m_SteamInventoryResult + ", null, out OutItemsArraySize) - " + ret + " -- " + OutItemsArraySize); } } if (GUILayout.Button("GetResultItemProperty(m_SteamInventoryResult, 0, null, out ValueBuffer, ref ValueBufferSize)")) { string ValueBuffer; uint ValueBufferSize = 0; bool ret = SteamInventory.GetResultItemProperty(m_SteamInventoryResult, 0, null, out ValueBuffer, ref ValueBufferSize); if (ret) { ret = SteamInventory.GetResultItemProperty(m_SteamInventoryResult, 0, null, out ValueBuffer, ref ValueBufferSize); } print("SteamInventory.GetResultItemProperty(" + m_SteamInventoryResult + ", " + 0 + ", " + null + ", " + "out ValueBuffer" + ", " + "ref ValueBufferSize" + ") : " + ret + " -- " + ValueBuffer + " -- " + ValueBufferSize); } if (GUILayout.Button("GetResultTimestamp(m_SteamInventoryResult)")) { uint ret = SteamInventory.GetResultTimestamp(m_SteamInventoryResult); print("SteamInventory.GetResultTimestamp(" + m_SteamInventoryResult + ") : " + ret); } if (GUILayout.Button("CheckResultSteamID(m_SteamInventoryResult, SteamUser.GetSteamID())")) { bool ret = SteamInventory.CheckResultSteamID(m_SteamInventoryResult, SteamUser.GetSteamID()); print("SteamInventory.CheckResultSteamID(" + m_SteamInventoryResult + ", " + SteamUser.GetSteamID() + ") : " + ret); } if (GUILayout.Button("DestroyResult(m_SteamInventoryResult)")) { DestroyResult(); } // INVENTORY ASYNC QUERY if (GUILayout.Button("GetAllItems(out m_SteamInventoryResult)")) { bool ret = SteamInventory.GetAllItems(out m_SteamInventoryResult); print("SteamInventory.GetAllItems(" + "out m_SteamInventoryResult" + ") : " + ret + " -- " + m_SteamInventoryResult); } if (GUILayout.Button("GetItemsByID(out m_SteamInventoryResult, InstanceIDs, (uint)InstanceIDs.Length)")) { SteamItemInstanceID_t[] InstanceIDs = { (SteamItemInstanceID_t)0, (SteamItemInstanceID_t)1, }; bool ret = SteamInventory.GetItemsByID(out m_SteamInventoryResult, InstanceIDs, (uint)InstanceIDs.Length); print("SteamInventory.GetItemsByID(" + "out m_SteamInventoryResult" + ", " + InstanceIDs + ", " + (uint)InstanceIDs.Length + ") : " + ret + " -- " + m_SteamInventoryResult); } // RESULT SERIALIZATION AND AUTHENTICATION if (GUILayout.Button("SerializeResult(m_SteamInventoryResult, m_SerializedBuffer, out OutBufferSize)")) { uint OutBufferSize; bool ret = SteamInventory.SerializeResult(m_SteamInventoryResult, null, out OutBufferSize); if (ret) { m_SerializedBuffer = new byte[OutBufferSize]; ret = SteamInventory.SerializeResult(m_SteamInventoryResult, m_SerializedBuffer, out OutBufferSize); print("SteamInventory.SerializeResult(m_SteamInventoryResult, m_SerializedBuffer, out OutBufferSize) - " + ret + " -- " + OutBufferSize + " -- " + System.Text.Encoding.UTF8.GetString(m_SerializedBuffer, 0, m_SerializedBuffer.Length)); } else { print("SteamInventory.SerializeResult(m_SteamInventoryResult, null, out OutBufferSize) - " + ret + " -- " + OutBufferSize); } } if (GUILayout.Button("DeserializeResult(out m_SteamInventoryResult, m_SerializedBuffer, (uint)m_SerializedBuffer.Length)")) { bool ret = SteamInventory.DeserializeResult(out m_SteamInventoryResult, m_SerializedBuffer, (uint)m_SerializedBuffer.Length); print("SteamInventory.DeserializeResult(" + "out m_SteamInventoryResult" + ", " + m_SerializedBuffer + ", " + (uint)m_SerializedBuffer.Length + ") : " + ret + " -- " + m_SteamInventoryResult); } // INVENTORY ASYNC MODIFICATION if (GUILayout.Button("GenerateItems(out m_SteamInventoryResult, ArrayItemDefs, null, (uint)ArrayItemDefs.Length)")) { SteamItemDef_t[] ArrayItemDefs = { ESpaceWarItemDefIDs.k_SpaceWarItem_ShipDecoration1, ESpaceWarItemDefIDs.k_SpaceWarItem_ShipDecoration2 }; bool ret = SteamInventory.GenerateItems(out m_SteamInventoryResult, ArrayItemDefs, null, (uint)ArrayItemDefs.Length); print("SteamInventory.GenerateItems(" + "out m_SteamInventoryResult" + ", " + ArrayItemDefs + ", " + null + ", " + (uint)ArrayItemDefs.Length + ") : " + ret + " -- " + m_SteamInventoryResult); } if (GUILayout.Button("GrantPromoItems(out m_SteamInventoryResult)")) { bool ret = SteamInventory.GrantPromoItems(out m_SteamInventoryResult); print("SteamInventory.GrantPromoItems(" + "out m_SteamInventoryResult" + ") : " + ret + " -- " + m_SteamInventoryResult); } if (GUILayout.Button("AddPromoItem(out m_SteamInventoryResult, ESpaceWarItemDefIDs.k_SpaceWarItem_ShipWeapon1)")) { bool ret = SteamInventory.AddPromoItem(out m_SteamInventoryResult, ESpaceWarItemDefIDs.k_SpaceWarItem_ShipWeapon1); print("SteamInventory.AddPromoItem(" + "out m_SteamInventoryResult" + ", " + ESpaceWarItemDefIDs.k_SpaceWarItem_ShipWeapon1 + ") : " + ret + " -- " + m_SteamInventoryResult); } if (GUILayout.Button("AddPromoItems(out m_SteamInventoryResult, ArrayItemDefs, (uint)ArrayItemDefs.Length)")) { SteamItemDef_t[] ArrayItemDefs = { ESpaceWarItemDefIDs.k_SpaceWarItem_ShipWeapon1, ESpaceWarItemDefIDs.k_SpaceWarItem_ShipWeapon2 }; bool ret = SteamInventory.AddPromoItems(out m_SteamInventoryResult, ArrayItemDefs, (uint)ArrayItemDefs.Length); print("SteamInventory.AddPromoItems(" + "out m_SteamInventoryResult" + ", " + ArrayItemDefs + ", " + (uint)ArrayItemDefs.Length + ") : " + ret + " -- " + m_SteamInventoryResult); } if (GUILayout.Button("ConsumeItem(out m_SteamInventoryResult, m_SteamItemDetails[0].m_itemId, 1)")) { if (m_SteamItemDetails != null) { bool ret = SteamInventory.ConsumeItem(out m_SteamInventoryResult, m_SteamItemDetails[0].m_itemId, 1); print("SteamInventory.ConsumeItem(out m_SteamInventoryResult, " + m_SteamItemDetails[0].m_itemId + ", 1) - " + ret + " -- " + m_SteamInventoryResult); } } if (GUILayout.Button("ExchangeItems(TODO)")) { if (m_SteamItemDetails != null) { bool ret = SteamInventory.ExchangeItems(out m_SteamInventoryResult, null, null, 0, null, null, 0); // TODO print("SteamInventory.ExchangeItems(TODO) - " + ret + " -- " + m_SteamInventoryResult); } } if (GUILayout.Button("TransferItemQuantity(out m_SteamInventoryResult, m_SteamItemDetails[0].m_itemId, 1, SteamItemInstanceID_t.Invalid)")) { if (m_SteamItemDetails != null) { bool ret = SteamInventory.TransferItemQuantity(out m_SteamInventoryResult, m_SteamItemDetails[0].m_itemId, 1, SteamItemInstanceID_t.Invalid); print("SteamInventory.TransferItemQuantity(out m_SteamInventoryResult, " + m_SteamItemDetails[0].m_itemId + ", 1, SteamItemInstanceID_t.Invalid) - " + ret + " -- " + m_SteamInventoryResult); } } // TIMED DROPS AND PLAYTIME CREDIT if (GUILayout.Button("SendItemDropHeartbeat()")) { SteamInventory.SendItemDropHeartbeat(); print("SteamInventory.SendItemDropHeartbeat()"); } if (GUILayout.Button("TriggerItemDrop(out m_SteamInventoryResult, ESpaceWarItemDefIDs.k_SpaceWarItem_TimedDropList)")) { bool ret = SteamInventory.TriggerItemDrop(out m_SteamInventoryResult, ESpaceWarItemDefIDs.k_SpaceWarItem_TimedDropList); print("SteamInventory.TriggerItemDrop(" + "out m_SteamInventoryResult" + ", " + ESpaceWarItemDefIDs.k_SpaceWarItem_TimedDropList + ") : " + ret + " -- " + m_SteamInventoryResult); } // IN-GAME TRADING if (GUILayout.Button("TradeItems(TODO)")) { if (m_SteamItemDetails != null) { bool ret = SteamInventory.TradeItems(out m_SteamInventoryResult, SteamUser.GetSteamID(), null, null, 0, null, null, 0); // TODO... Difficult print("SteamInventory.TradeItems(TODO) - " + ret + " -- " + m_SteamInventoryResult); } } // ITEM DEFINITIONS if (GUILayout.Button("LoadItemDefinitions()")) { bool ret = SteamInventory.LoadItemDefinitions(); print("SteamInventory.LoadItemDefinitions() : " + ret); } if (GUILayout.Button("GetItemDefinitionIDs(ItemDefIDs, ref length)")) { uint length = 0; bool ret = SteamInventory.GetItemDefinitionIDs(null, ref length); if (ret) { m_SteamItemDef = new SteamItemDef_t[length]; ret = SteamInventory.GetItemDefinitionIDs(m_SteamItemDef, ref length); print("SteamInventory.GetItemDefinitionIDs(m_SteamItemDef, ref length) - " + ret + " -- " + length); } else { print("SteamInventory.GetItemDefinitionIDs(null, ref length) - " + ret + " -- " + length); } } if (GUILayout.Button("GetItemDefinitionProperty(ESpaceWarItemDefIDs.k_SpaceWarItem_ShipDecoration1, null, out ValueBuffer, ref length)")) { uint length = 2048; string ValueBuffer; bool ret = SteamInventory.GetItemDefinitionProperty(ESpaceWarItemDefIDs.k_SpaceWarItem_ShipDecoration1, null, out ValueBuffer, ref length); print("SteamInventory.GetItemDefinitionProperty(" + ESpaceWarItemDefIDs.k_SpaceWarItem_ShipDecoration1 + ", " + null + ", " + "out ValueBuffer" + ", " + "ref length" + ") : " + ret + " -- " + ValueBuffer + " -- " + length); } if (GUILayout.Button("RequestEligiblePromoItemDefinitionsIDs(SteamUser.GetSteamID())")) { SteamAPICall_t handle = SteamInventory.RequestEligiblePromoItemDefinitionsIDs(SteamUser.GetSteamID()); OnSteamInventoryEligiblePromoItemDefIDsCallResult.Set(handle); print("SteamInventory.RequestEligiblePromoItemDefinitionsIDs(" + SteamUser.GetSteamID() + ") : " + handle); } //SteamInventory.GetEligiblePromoItemDefinitionIDs() // Should be handled within the SteamInventoryEligiblePromoItemDefIDs_t CallResult! //SteamInventory.StartPurchase() // TODO //SteamInventory.RequestPrices() // TODO //SteamInventory.GetNumItemsWithPrices() // TODO //SteamInventory.GetItemsWithPrices() // TODO //SteamInventory.GetItemPrice() // TODO //SteamInventory.StartUpdateProperties() // TODO //SteamInventory.RemoveProperty() // TODO //SteamInventory.SetProperty() // TODO //SteamInventory.SetProperty() // TODO //SteamInventory.SetProperty() // TODO //SteamInventory.SetProperty() // TODO //SteamInventory.SubmitUpdateProperties() // TODO GUILayout.EndScrollView(); GUILayout.EndVertical(); }
private void UpdateInventory() { if (!Global.isSteamActive || !m_waitForResult) { return; } EResult resultStatus = SteamInventory.GetResultStatus(m_resultHandle); switch (resultStatus) { case EResult.k_EResultPending: return; case EResult.k_EResultOK: { uint punOutItemsArraySize = 0u; if (!SteamInventory.GetResultItems(m_resultHandle, null, ref punOutItemsArraySize)) { break; } SteamItemDetails_t[] array = new SteamItemDetails_t[punOutItemsArraySize]; int num = 0; if (m_completeRefresh) { m_itemDetails.Clear(); } if (punOutItemsArraySize != 0) { SteamInventory.GetResultItems(m_resultHandle, array, ref punOutItemsArraySize); if (m_completeRefresh) { m_itemDetails.AddRange(array); } else { for (int i = 0; i < array.Length; i++) { for (int j = 0; j < m_itemDetails.Count; j++) { ulong steamItemInstanceID = array[i].m_itemId.m_SteamItemInstanceID; SteamItemDetails_t steamItemDetails_t = m_itemDetails[j]; if (steamItemInstanceID == steamItemDetails_t.m_itemId.m_SteamItemInstanceID && 0 < (array[i].m_unFlags & 0x100)) { m_itemDetails.RemoveAt(j); break; } } } for (int k = 0; k < array.Length; k++) { if ((array[k].m_unFlags & 0x100) == 0) { m_itemDetails.Add(array[k]); num = array[k].m_iDefinition.m_SteamItemDef; } } } int lookItemDef = m_steamInventoryHandler.GetLookItemDef(); int skinItemDef = m_steamInventoryHandler.GetSkinItemDef(); bool flag = true; bool flag2 = true; int num2 = 0; for (int l = 0; l < m_itemDetails.Count; l++) { SteamItemDetails_t steamItemDetails_t2 = m_itemDetails[l]; if (steamItemDetails_t2.m_iDefinition.m_SteamItemDef == lookItemDef) { flag = false; } else { SteamItemDetails_t steamItemDetails_t3 = m_itemDetails[l]; if (steamItemDetails_t3.m_iDefinition.m_SteamItemDef == skinItemDef) { flag2 = false; } } SteamItemDetails_t steamItemDetails_t4 = m_itemDetails[l]; if (3000 > steamItemDetails_t4.m_iDefinition.m_SteamItemDef) { num2++; } } if (flag2 || flag) { m_steamInventoryHandler.SetLook((!flag) ? lookItemDef : 0, (!flag2) ? skinItemDef : 0); } m_txtCaseCount.transform.parent.gameObject.SetActive(0 < num2); m_txtCaseCount.text = num2.ToString(); } if (m_caseOpenFlag && num != 0) { m_caseOpenGui.Showtime(num, m_generatorDefId); } else { UpdateInventoryDisplay(); } break; } default: Debug.Log("SteamInventoryGUI.cs: Couldn't get inventory: " + resultStatus); break; } SteamInventory.DestroyResult(m_resultHandle); m_waitForResult = false; }
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; } }
void PrintItemDetail() { // Demo 4: print item details // Similar to getting all results, use GetResultItems(); EnsureStatusOK(); Console.WriteLine("Items by ID obtained."); // Get the number of items available first, by setting the items array argument to null uint itemCount = 0; if (!SteamInventory.GetResultItems(currentResult, null, ref itemCount)) { throw new Exception("Failed to get item count."); } // Now get the items SteamItemDetails_t[] details = new SteamItemDetails_t[itemCount]; if (!SteamInventory.GetResultItems(currentResult, details, ref itemCount)) { throw new Exception("Failed to get items."); } if (details.Length != 1) { throw new Exception("We don't have just one item?"); } SteamItemDetails_t item = details[0]; Console.WriteLine(); // Print basic properties Console.WriteLine($"Instance ID: {item.m_itemId}"); Console.WriteLine($"Definition number: {item.m_iDefinition}"); Console.WriteLine($"Quantity: {item.m_unQuantity}"); Console.WriteLine($"Flags: {(ESteamItemFlags)item.m_unFlags}"); // Print item properties string[] itemKeys = GetResultItemProperty(0, null).Split(','); foreach (var key in itemKeys) { string value = GetResultItemProperty(0, key); if (value == null) { Console.WriteLine($"Could not get value for \"{key}\"."); } else { Console.WriteLine($"{key}: {value}"); } } Console.WriteLine(new string('-', 80)); // Print item definition properties Console.WriteLine($"Definition number: {item.m_iDefinition}"); string[] itemDefKeys = GetItemDefinitionProperty(item.m_iDefinition, null).Split(','); foreach (var key in itemDefKeys) { string value = GetItemDefinitionProperty(item.m_iDefinition, key); if (value == null) { Console.WriteLine($"Could not get value for \"{key}\"."); } else { Console.WriteLine($"{key}: {value}"); } } // Destroy result SteamInventory.DestroyResult(currentResult); currentResult = SteamInventoryResult_t.Invalid; nextAction = null; InteractiveGetDetails(); }
public void RenderOnGUI() { GUILayout.BeginArea(new Rect(Screen.width - 200, 0, 200, Screen.height)); GUILayout.Label("Variables:"); GUILayout.Label("m_SteamInventoryResult: " + m_SteamInventoryResult); GUILayout.EndArea(); // INVENTORY ASYNC RESULT MANAGEMENT GUILayout.Label("SteamInventory.GetResultStatus(" + m_SteamInventoryResult + ") - " + SteamInventory.GetResultStatus(m_SteamInventoryResult)); if (GUILayout.Button("GetResultItems(m_SteamInventoryResult, m_SteamItemDetails, ref OutItemsArraySize)")) { uint OutItemsArraySize = 0; bool ret = SteamInventory.GetResultItems(m_SteamInventoryResult, null, ref OutItemsArraySize); if (ret && OutItemsArraySize > 0) { m_SteamItemDetails = new SteamItemDetails_t[OutItemsArraySize]; ret = SteamInventory.GetResultItems(m_SteamInventoryResult, m_SteamItemDetails, ref OutItemsArraySize); print("SteamInventory.GetResultItems(" + m_SteamInventoryResult + ", m_SteamItemDetails, out OutItemsArraySize) - " + ret + " -- " + OutItemsArraySize); System.Text.StringBuilder test = new System.Text.StringBuilder(); for (int i = 0; i < OutItemsArraySize; ++i) { test.AppendFormat("{0} - {1} - {2} - {3} - {4}\n", i, m_SteamItemDetails[i].m_itemId, m_SteamItemDetails[i].m_iDefinition, m_SteamItemDetails[i].m_unQuantity, m_SteamItemDetails[i].m_unFlags); } print(test); } else { print("SteamInventory.GetResultItems(" + m_SteamInventoryResult + ", null, out OutItemsArraySize) - " + ret + " -- " + OutItemsArraySize); } } if (GUILayout.Button("GetResultTimestamp(m_SteamInventoryResult)")) { print("SteamInventory.GetResultTimestamp(" + m_SteamInventoryResult + ") - " + SteamInventory.GetResultTimestamp(m_SteamInventoryResult)); } if (GUILayout.Button("CheckResultSteamID(m_SteamInventoryResult, SteamUser.GetSteamID())")) { print("SteamInventory.CheckResultSteamID(" + m_SteamInventoryResult + ", " + SteamUser.GetSteamID() + ") - " + SteamInventory.CheckResultSteamID(m_SteamInventoryResult, SteamUser.GetSteamID())); } if (GUILayout.Button("DestroyResult(m_SteamInventoryResult)")) { DestroyResult(); } // INVENTORY ASYNC QUERY if (GUILayout.Button("GetAllItems(out m_SteamInventoryResult)")) { bool ret = SteamInventory.GetAllItems(out m_SteamInventoryResult); print("SteamInventory.GetAllItems(out m_SteamInventoryResult) - " + ret + " -- " + m_SteamInventoryResult); } if (GUILayout.Button("GetItemsByID(out m_SteamInventoryResult, InstanceIDs, InstanceIDs.Length)")) { SteamItemInstanceID_t[] InstanceIDs = { (SteamItemInstanceID_t)0, (SteamItemInstanceID_t)1, }; bool ret = SteamInventory.GetItemsByID(out m_SteamInventoryResult, InstanceIDs, (uint)InstanceIDs.Length); print("SteamInventory.GetItemsByID(out m_SteamInventoryResult, InstanceIDs, " + InstanceIDs.Length + ") - " + ret + " -- " + m_SteamInventoryResult); } // RESULT SERIALIZATION AND AUTHENTICATION if (GUILayout.Button("SerializeResult(m_SteamInventoryResult, m_SerializedBuffer, out OutBufferSize)")) { uint OutBufferSize; bool ret = SteamInventory.SerializeResult(m_SteamInventoryResult, null, out OutBufferSize); if (ret) { m_SerializedBuffer = new byte[OutBufferSize]; ret = SteamInventory.SerializeResult(m_SteamInventoryResult, m_SerializedBuffer, out OutBufferSize); print("SteamInventory.SerializeResult(m_SteamInventoryResult, m_SerializedBuffer, out OutBufferSize) - " + ret + " -- " + OutBufferSize + " -- " + System.Text.Encoding.UTF8.GetString(m_SerializedBuffer, 0, m_SerializedBuffer.Length)); } else { print("SteamInventory.SerializeResult(m_SteamInventoryResult, null, out OutBufferSize) - " + ret + " -- " + OutBufferSize); } } if (GUILayout.Button("DeserializeResult(out m_SteamInventoryResult, m_SerializedBuffer, (uint)m_SerializedBuffer.Length)")) { bool ret = SteamInventory.DeserializeResult(out m_SteamInventoryResult, m_SerializedBuffer, (uint)m_SerializedBuffer.Length); print("SteamInventory.DeserializeResult(out m_SteamInventoryResult, " + m_SerializedBuffer + ", " + (uint)m_SerializedBuffer.Length + ") - " + ret + " -- " + m_SteamInventoryResult); } // INVENTORY ASYNC MODIFICATION if (GUILayout.Button("GenerateItems(out m_SteamInventoryResult, ArrayItemDefs, null, (uint)ArrayItemDefs.Length)")) { SteamItemDef_t[] ArrayItemDefs = { ESpaceWarItemDefIDs.k_SpaceWarItem_ShipDecoration1, ESpaceWarItemDefIDs.k_SpaceWarItem_ShipDecoration2 }; bool ret = SteamInventory.GenerateItems(out m_SteamInventoryResult, ArrayItemDefs, null, (uint)ArrayItemDefs.Length); print("SteamInventory.GenerateItems(out m_SteamInventoryResult, ArrayItemDefs, null, " + (uint)ArrayItemDefs.Length + ") - " + ret + " -- " + m_SteamInventoryResult); } if (GUILayout.Button("GrantPromoItems(out m_SteamInventoryResult)")) { bool ret = SteamInventory.GrantPromoItems(out m_SteamInventoryResult); print("SteamInventory.GrantPromoItems(out m_SteamInventoryResult) - " + ret + " -- " + m_SteamInventoryResult); } if (GUILayout.Button("AddPromoItem(out m_SteamInventoryResult, ESpaceWarItemDefIDs.k_SpaceWarItem_ShipWeapon1)")) { bool ret = SteamInventory.AddPromoItem(out m_SteamInventoryResult, ESpaceWarItemDefIDs.k_SpaceWarItem_ShipWeapon1); print("SteamInventory.AddPromoItem(out m_SteamInventoryResult, ESpaceWarItemDefIDs.k_SpaceWarItem_ShipWeapon1) - " + ret + " -- " + m_SteamInventoryResult); } if (GUILayout.Button("AddPromoItems(out m_SteamInventoryResult, ArrayItemDefs, (uint)ArrayItemDefs.Length)")) { SteamItemDef_t[] ArrayItemDefs = { ESpaceWarItemDefIDs.k_SpaceWarItem_ShipWeapon1, ESpaceWarItemDefIDs.k_SpaceWarItem_ShipWeapon2 }; bool ret = SteamInventory.AddPromoItems(out m_SteamInventoryResult, ArrayItemDefs, (uint)ArrayItemDefs.Length); print("SteamInventory.AddPromoItems(out m_SteamInventoryResult, ArrayItemDefs, " + (uint)ArrayItemDefs.Length + ") - " + ret + " -- " + m_SteamInventoryResult); } if (GUILayout.Button("ConsumeItem(out m_SteamInventoryResult, m_SteamItemDetails[0].m_itemId, 1)")) { if (m_SteamItemDetails != null) { bool ret = SteamInventory.ConsumeItem(out m_SteamInventoryResult, m_SteamItemDetails[0].m_itemId, 1); print("SteamInventory.ConsumeItem(out m_SteamInventoryResult, " + m_SteamItemDetails[0].m_itemId + ", 1) - " + ret + " -- " + m_SteamInventoryResult); } } if (GUILayout.Button("ExchangeItems(TODO)")) { if (m_SteamItemDetails != null) { bool ret = SteamInventory.ExchangeItems(out m_SteamInventoryResult, null, null, 0, null, null, 0); // TODO print("SteamInventory.ExchangeItems(TODO) - " + ret + " -- " + m_SteamInventoryResult); } } if (GUILayout.Button("TransferItemQuantity(out m_SteamInventoryResult, m_SteamItemDetails[0].m_itemId, 1, SteamItemInstanceID_t.Invalid)")) { if (m_SteamItemDetails != null) { bool ret = SteamInventory.TransferItemQuantity(out m_SteamInventoryResult, m_SteamItemDetails[0].m_itemId, 1, SteamItemInstanceID_t.Invalid); print("SteamInventory.TransferItemQuantity(out m_SteamInventoryResult, " + m_SteamItemDetails[0].m_itemId + ", 1, SteamItemInstanceID_t.Invalid) - " + ret + " -- " + m_SteamInventoryResult); } } // TIMED DROPS AND PLAYTIME CREDIT if (GUILayout.Button("SendItemDropHeartbeat()")) { SteamInventory.SendItemDropHeartbeat(); print("SteamInventory.SendItemDropHeartbeat()"); } if (GUILayout.Button("TriggerItemDrop(out m_SteamInventoryResult, k_SpaceWarItem_TimedDropList)")) { SteamInventory.TriggerItemDrop(out m_SteamInventoryResult, ESpaceWarItemDefIDs.k_SpaceWarItem_TimedDropList); print("SteamInventory.TriggerItemDrop(out m_SteamInventoryResult, k_SpaceWarItem_TimedDropList)"); } // IN-GAME TRADING if (GUILayout.Button("TradeItems(TODO)")) { if (m_SteamItemDetails != null) { bool ret = SteamInventory.TradeItems(out m_SteamInventoryResult, SteamUser.GetSteamID(), null, null, 0, null, null, 0); // TODO... Difficult print("SteamInventory.TradeItems(TODO) - " + ret + " -- " + m_SteamInventoryResult); } } // ITEM DEFINITIONS if (GUILayout.Button("LoadItemDefinitions()")) { print("SteamInventory.LoadItemDefinitions() - " + SteamInventory.LoadItemDefinitions()); } if (GUILayout.Button("GetItemDefinitionIDs(ItemDefIDs, ref length)")) { uint length; bool ret = SteamInventory.GetItemDefinitionIDs(null, out length); if (ret) { m_SteamItemDef = new SteamItemDef_t[length]; ret = SteamInventory.GetItemDefinitionIDs(m_SteamItemDef, out length); print("SteamInventory.GetItemDefinitionIDs(m_SteamItemDef, out length) - " + ret + " -- " + length); } else { print("SteamInventory.GetItemDefinitionIDs(null, out length) - " + ret + " -- " + length); } } if (GUILayout.Button("GetItemDefinitionProperty()")) { string ValueBuffer; uint length = 2048; bool ret = SteamInventory.GetItemDefinitionProperty(ESpaceWarItemDefIDs.k_SpaceWarItem_ShipDecoration1, null, out ValueBuffer, ref length); print("SteamInventory.GetItemDefinitionProperty() - " + ret + " -- " + ValueBuffer + " -- " + length); } }