internal Item ItemFrom(SteamInventoryResult_t handle, SteamItemDetails_t detail, int index) { var props = new Dictionary <string, string>(); if (inventory.GetResultItemProperty(handle, (uint)index, null, out string propertyNames)) { foreach (var propertyName in propertyNames.Split(',')) { if (inventory.GetResultItemProperty(handle, (uint)index, propertyName, out string propertyValue)) { if (propertyName == "error") { Console.Write("Steam item error: "); Console.WriteLine(propertyValue); return(null); } props.Add(propertyName, propertyValue); } } } var item = new Item(this, detail.ItemId, detail.Quantity, detail.Definition); item.Properties = props; return(item); }
public InventoryItem[] GetItems(bool includeProperties = false) { uint cnt = (uint)ItemCount; if (cnt <= 0) { return(null); } var pOutItemsArray = new SteamItemDetails_t[cnt]; if (!SteamInventory.Internal.GetResultItems(_id, pOutItemsArray, ref cnt)) { return(null); } var items = new InventoryItem[cnt]; for (int i = 0; i < cnt; i++) { var item = InventoryItem.From(pOutItemsArray[i]); if (includeProperties) { item._properties = InventoryItem.GetProperties(_id, i); } items[i] = item; } return(items); }
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; } } }
public InventoryItemPointer this[SteamItemDetails_t item] { get { return(this[item.m_iDefinition]); } }
public InventoryItemDefinition this[SteamItemDetails_t item] { get { return(GetDefinition(item)); } }
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; }
internal Item ItemFrom(SteamInventoryResult_t handle, SteamItemDetails_t detail, int index) { var props = new Dictionary <string, string>(); if (inventory.GetResultItemProperty(handle, (uint)index, null, out string propertyNames)) { foreach (var propertyName in propertyNames.Split(',')) { if (inventory.GetResultItemProperty(handle, (uint)index, propertyName, out string propertyValue)) { props.Add(propertyName, propertyValue); } } } var item = new Item() { Quantity = detail.Quantity, Id = detail.ItemId, DefinitionId = detail.Definition, TradeLocked = ((int)detail.Flags & (int)SteamNative.SteamItemFlags.NoTrade) != 0, Definition = FindDefinition(detail.Definition), Properties = props }; return(item); }
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 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 bool SellItem(int a_index) { bool result = false; if (m_itemDetails != null && a_index > -1 && a_index < m_itemDetails.Count) { ulong num = (!(null != m_client)) ? 12345678 : m_client.GetSteamId(); object[] obj = new object[6] { "http://steamcommunity.com/profiles/", num, "/inventory#", 348670, "_2_", null }; SteamItemDetails_t steamItemDetails_t = m_itemDetails[a_index]; obj[5] = steamItemDetails_t.m_itemId.m_SteamItemInstanceID; string text = string.Concat(obj); if (Global.isSteamActive) { SteamFriends.ActivateGameOverlayToWebPage(text); } else { Debug.Log("DEBUG: " + text); } result = true; } return(result); }
private static void updateFilter() { string text = MenuSurvivorsClothingUI.searchField.text; if (text == null || text.Length < 1) { MenuSurvivorsClothingUI.filteredItems = new List <SteamItemDetails_t>(Provider.provider.economyService.inventory); } else { MenuSurvivorsClothingUI.filteredItems = new List <SteamItemDetails_t>(); for (int i = 0; i < Provider.provider.economyService.inventory.Length; i++) { SteamItemDetails_t item = Provider.provider.economyService.inventory[i]; string inventoryName = Provider.provider.economyService.getInventoryName(item.m_iDefinition.m_SteamItemDef); if (inventoryName.IndexOf(text, StringComparison.OrdinalIgnoreCase) != -1) { MenuSurvivorsClothingUI.filteredItems.Add(item); } else { string inventoryType = Provider.provider.economyService.getInventoryType(item.m_iDefinition.m_SteamItemDef); if (inventoryType.IndexOf(text, StringComparison.OrdinalIgnoreCase) != -1) { MenuSurvivorsClothingUI.filteredItems.Add(item); } } } } }
public void addLocalItem(SteamItemDetails_t item) { SteamItemDetails_t[] array = new SteamItemDetails_t[this.inventory.Length + 1]; for (int i = 0; i < this.inventory.Length; i++) { array[i] = this.inventory[i]; } array[this.inventory.Length] = item; this.inventoryDetails = array; }
private bool HasItemDef(int a_itemDef) { for (int i = 0; i < m_itemDetails.Count; i++) { SteamItemDetails_t steamItemDetails_t = m_itemDetails[i]; if (steamItemDetails_t.m_iDefinition.m_SteamItemDef == a_itemDef) { return(true); } } return(false); }
internal static InventoryItem From(SteamItemDetails_t details) { var i = new InventoryItem { _id = details.ItemId, _def = details.Definition, _flags = (SteamItemFlags)details.Flags, _quantity = details.Quantity }; return(i); }
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 Update() { UpdateInventory(); if (!m_waitForResult && !m_caseOpenGui.InProgress() && m_caseOpenFlag) { UpdateInventoryDisplay(); m_caseOpenFlag = false; } if (!Input.GetKeyDown(KeyCode.P)) { return; } if (Global.isSteamActive) { if ("vidiludi" == m_client.GetPlayerName() || "Ethan" == m_client.GetPlayerName() || "Editor" == m_client.GetPlayerName()) { SteamItemDef_t[] array = new SteamItemDef_t[4]; uint[] array2 = new uint[4]; array[0].m_SteamItemDef = 2004; array[1].m_SteamItemDef = 2004; array[2].m_SteamItemDef = 3000; array[3].m_SteamItemDef = 3000; array2[0] = 1u; array2[1] = 1u; array2[2] = 1u; array2[3] = 1u; m_waitForResult = SteamInventory.GenerateItems(out m_resultHandle, array, null, 4u); m_completeRefresh = false; } } else { SteamItemDetails_t item = default(SteamItemDetails_t); item.m_iDefinition.m_SteamItemDef = 2004; item.m_unQuantity = 1; m_itemDetails.Add(item); for (int i = 0; i < 10; i++) { item.m_iDefinition.m_SteamItemDef = 20000 + i; item.m_unQuantity = 1; m_itemDetails.Add(item); } item.m_iDefinition.m_SteamItemDef = 2004; item.m_unQuantity = 1; m_itemDetails.Add(item); UpdateInventoryDisplay(); } }
// Token: 0x0600174A RID: 5962 RVA: 0x00086218 File Offset: 0x00084618 public void addLocalItem(SteamItemDetails_t item, string tags, string dynamic_props) { SteamItemDetails_t[] array = new SteamItemDetails_t[this.inventory.Length + 1]; for (int i = 0; i < this.inventory.Length; i++) { array[i] = this.inventory[i]; } array[this.inventory.Length] = item; this.inventoryDetails = array; this.dynamicInventoryDetails.Remove(item.m_itemId.m_SteamItemInstanceID); DynamicEconDetails value = default(DynamicEconDetails); value.tags = ((!string.IsNullOrEmpty(tags)) ? tags : string.Empty); value.dynamic_props = ((!string.IsNullOrEmpty(dynamic_props)) ? dynamic_props : string.Empty); this.dynamicInventoryDetails.Add(item.m_itemId.m_SteamItemInstanceID, value); }
private SteamItemDetails_t GetRandomItemFromInventory(int a_defIdFrom, int a_defIdTo) { if (this.m_itemDetails != null) { for (int i = 0; i < this.m_itemDetails.Count; i++) { if (this.m_itemDetails[i].m_iDefinition.m_SteamItemDef <= a_defIdTo && this.m_itemDetails[i].m_iDefinition.m_SteamItemDef >= a_defIdFrom) { return(this.m_itemDetails[i]); } } } SteamItemDetails_t result = default(SteamItemDetails_t); result.m_itemId.m_SteamItemInstanceID = 0UL; return(result); }
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(); } } } }
/// <summary> /// Splits an instance quantity, if the destination instance is -1 this will create a new stack of the defined quantity. /// </summary> /// <param name="source">The instance to split</param> /// <param name="quantity">The number of items to remove from the source stack</param> /// <param name="destination">The target to move the quanity to</param> /// <returns></returns> public bool TransferQuantity(SteamItemDetails_t source, uint quantity, SteamItemInstanceID_t destination) { if (source.m_unQuantity >= quantity) { var ret = SteamworksPlayerInventory.TransferQuantity(source.m_itemId, quantity, destination, (result) => { Instances.RemoveAll(p => p.m_itemId == source.m_itemId); source.m_unQuantity -= Convert.ToUInt16(quantity); Instances.Add(source); }); return(ret); } else { return(false); } }
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); } }
/// <summary> /// Moves the quantity from the source into a new stack /// </summary> /// <param name="source">Source instance to move units from</param> /// <param name="quantity">The number of units to move</param> /// <returns></returns> public bool SplitInstance(SteamItemDetails_t source, uint quantity) { if (source.m_unQuantity >= quantity) { var ret = SteamworksPlayerInventory.TransferQuantity(source.m_itemId, quantity, SteamItemInstanceID_t.Invalid, (result) => { Instances.RemoveAll(p => p.m_itemId == source.m_itemId); source.m_unQuantity -= Convert.ToUInt16(quantity); Instances.Add(source); }); return(ret); } else { Debug.LogWarning("Unable to split instance, insufficent units available to move."); return(false); } }
private int GetClickedItemIndex(string a_clickedBtnName) { int result = -1; string[] array = a_clickedBtnName.Split('-'); if (array != null && 1 < array.Length && "sii" == array[0]) { int num = -1; try { num = int.Parse(array[1]); } catch (Exception ex) { Debug.LogWarning("SteamInventoryGUI.cs: " + ex.ToString()); } if (num > -1 && m_itemDetails != null && num < m_itemDetails.Count) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); m_contextMenu.transform.position = ray.GetPoint(3.5f); m_contextMenu.transform.localPosition += new Vector3(0.2f, -0.1f, 0f); SteamItemDetails_t steamItemDetails_t = m_itemDetails[num]; int steamItemDef = steamItemDetails_t.m_iDefinition.m_SteamItemDef; string empty = string.Empty; if (10000 > steamItemDef) { empty = "STEAM_INV_OPEN_CASE"; } else { int lookItemDef = m_steamInventoryHandler.GetLookItemDef(); int skinItemDef = m_steamInventoryHandler.GetSkinItemDef(); empty = ((lookItemDef != steamItemDef && skinItemDef != steamItemDef) ? "STEAM_INV_EQUIP" : "STEAM_INV_UNEQUIP"); } m_txtEquipOpen.text = LNG.Get(empty); result = num; m_contextMenu.SetActive(true); } } return(result); }
private IEconomyRequestResult createInventoryRequestResult(SteamInventoryResult_t steamInventoryResult) { uint num = 0u; SteamworksEconomyItem[] array2; if (SteamGameServerInventory.GetResultItems(steamInventoryResult, null, ref num) && num > 0u) { SteamItemDetails_t[] array = new SteamItemDetails_t[num]; SteamGameServerInventory.GetResultItems(steamInventoryResult, array, ref num); array2 = new SteamworksEconomyItem[num]; for (uint num2 = 0u; num2 < num; num2 += 1u) { SteamItemDetails_t newSteamItemDetail = array[(int)((UIntPtr)num2)]; SteamworksEconomyItem steamworksEconomyItem = new SteamworksEconomyItem(newSteamItemDetail); array2[(int)((UIntPtr)num2)] = steamworksEconomyItem; } } else { array2 = new SteamworksEconomyItem[0]; } return(new EconomyRequestResult(EEconomyRequestState.SUCCESS, array2)); }
// bool // using: Detect_MultiSizeArrayReturn public SteamItemDetails_t[] GetResultItems(SteamInventoryResult_t resultHandle /*SteamInventoryResult_t*/) { uint punOutItemsArraySize = 0; bool success = false; success = platform.ISteamInventory_GetResultItems(resultHandle.Value, IntPtr.Zero, out punOutItemsArraySize); if (!success || punOutItemsArraySize == 0) { return(null); } var pOutItemsArray = new SteamItemDetails_t[punOutItemsArraySize]; fixed(void *pOutItemsArray_ptr = pOutItemsArray) { success = platform.ISteamInventory_GetResultItems(resultHandle.Value, (IntPtr)pOutItemsArray_ptr, out punOutItemsArraySize); if (!success) { return(null); } return(pOutItemsArray); } }
/// <summary> /// Splits an instance quantity, if the destination instance is -1 this will create a new stack of the defined quantity. /// </summary> /// <param name="source">The instance to split</param> /// <param name="quantity">The number of items to remove from the source stack</param> /// <param name="destination">The target to move the quanity to</param> /// <returns></returns> public bool TransferQuantity(InventoryItemDefinition item, SteamItemDetails_t source, uint quantity, SteamItemInstanceID_t destination) { return(item.TransferQuantity(source, quantity, destination)); }
// Token: 0x060017E6 RID: 6118 RVA: 0x00088784 File Offset: 0x00086B84 public SteamworksEconomyItem(SteamItemDetails_t newSteamItemDetail) { this.steamItemDetail = newSteamItemDetail; this.itemDefinitionID = new SteamworksEconomyItemDefinition(this.steamItemDetail.m_iDefinition); this.itemInstanceID = new SteamworksEconomyItemInstance(this.steamItemDetail.m_itemId); }
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); }
/// <summary> /// Moves the source instance in its entirety to the destination. /// </summary> /// <param name="source">The source to move</param> /// <param name="destination">The target destination</param> /// <returns></returns> public bool StackInstance(InventoryItemDefinition item, SteamItemDetails_t source, SteamItemInstanceID_t destination) { return(item.StackInstance(source, destination)); }
/// <summary> /// Moves the quantity from the source into a new stack /// </summary> /// <param name="source">Source instance to move units from</param> /// <param name="quantity">The number of units to move</param> /// <returns></returns> public bool SplitInstance(InventoryItemDefinition item, SteamItemDetails_t source, uint quantity) { return(item.SplitInstance(source, quantity)); }
public abstract bool GetResultItems(int resultHandle,out SteamItemDetails_t [] pOutItemsArray);
public override bool GetResultItems(int resultHandle,out SteamItemDetails_t [] pOutItemsArray) { CheckIfUsable(); uint punOutItemsArraySize = 0; bool result = NativeEntrypoints.SteamAPI_ISteamInventory_GetResultItems(m_pSteamInventory,resultHandle,null,ref punOutItemsArraySize); pOutItemsArray= new SteamItemDetails_t[punOutItemsArraySize]; result = NativeEntrypoints.SteamAPI_ISteamInventory_GetResultItems(m_pSteamInventory,resultHandle,pOutItemsArray,ref punOutItemsArraySize); return result; }