public List <Item> GetInventoryItems(InventoryIndex index) { Inventory inventory = GameController.Game.IngameState.IngameUi.InventoryPanel[index]; List <NormalInventoryItem> inventoryItems = inventory.VisibleInventoryItems; List <Item> itemList = new List <Item>(); if (inventoryItems == null) { LogMessage("Player inventory->VisibleInventoryItems is null!", 5); return(itemList); } foreach (NormalInventoryItem inventoryItem in inventoryItems) { if (inventoryItem.Item == null) { continue; } if (string.IsNullOrEmpty(inventoryItem.Item.Path)) { LogMessage($"Bugged item detected on X:{inventoryItem.InventPosX}, Y:{inventoryItem.InventPosY}, skipping.. Change location to fix this or restart the game (exit to character selection).", 5); continue; } itemList.Add(new Item(inventoryItem)); } return(itemList); }
internal InventoryCell( int rowCoord, int colCoord) { IndexInInventory = new InventoryIndex(rowCoord, colCoord); ItemId = ""; }
public Inventory this[InventoryIndex k] { get { return(AllInventories[k]); } }
public void SwitchActiveWeapon(KeyCode keyPressed) { switch (keyPressed) { case KeyCode.Alpha1: { _currentActiveWeaponSlot = InventoryIndex.First; ChangeSelectedWeaponHUD?.Invoke(InventoryIndex.First); if (_weaponSlots[InventoryIndex.Second] != null) { _weaponSlots[InventoryIndex.Second].WeaponStateProp = WeaponState.InInventory; } break; } case KeyCode.Alpha2: { _currentActiveWeaponSlot = InventoryIndex.Second; ChangeSelectedWeaponHUD?.Invoke(InventoryIndex.Second); if (_weaponSlots[InventoryIndex.First] != null) { _weaponSlots[InventoryIndex.First].WeaponStateProp = WeaponState.InInventory; } break; } } }
public Element GetElementSlot(InventoryIndex inventoryIndex) { switch (inventoryIndex) { case InventoryIndex.None: throw new ArgumentOutOfRangeException(nameof(inventoryIndex)); case InventoryIndex.Helm: return(EquippedItems.GetChildAtIndex(10)); case InventoryIndex.Amulet: return(EquippedItems.GetChildAtIndex(11)); case InventoryIndex.Chest: return(EquippedItems.GetChildAtIndex(12)); case InventoryIndex.LWeapon: return(EquippedItems.GetChildAtIndex(14)); case InventoryIndex.RWeapon: return(EquippedItems.GetChildAtIndex(13)); case InventoryIndex.LWeaponSwap: return(EquippedItems.GetChildAtIndex(3)); case InventoryIndex.RWeaponSwap: return(EquippedItems.GetChildAtIndex(2)); case InventoryIndex.LRing: return(EquippedItems.GetChildAtIndex(17)); case InventoryIndex.RRing: return(EquippedItems.GetChildAtIndex(18)); case InventoryIndex.Gloves: return(EquippedItems.GetChildAtIndex(19)); case InventoryIndex.Belt: return(EquippedItems.GetChildAtIndex(20)); case InventoryIndex.Boots: return(EquippedItems.GetChildAtIndex(21)); case InventoryIndex.PlayerInventory: return(EquippedItems.GetChildAtIndex(22)); case InventoryIndex.Flask: return(EquippedItems.GetChildAtIndex(23)); case InventoryIndex.Trinket: return(EquippedItems.GetChildAtIndex(24)); case InventoryIndex.BloodCrucible: return(EquippedItems.GetChildAtIndex(1)); default: throw new ArgumentOutOfRangeException(nameof(inventoryIndex)); } }
public Inventory this[InventoryIndex inv] { get { int num = (int)inv; return base.ReadObject<Inventory>((this.ListStart + 8) + (num * 0x10)); } }
public Inventory this[InventoryIndex inv] { get { int num = (int)inv; return(base.ReadObject <Inventory>((this.ListStart + 8) + (num * 0x10))); } }
public Inventory this[InventoryIndex inv] { get { var num = (int)inv; return(ReadObject <Inventory>(ListStart + 8 + num * 0x10)); } }
private void Awake() { _weaponSlots = new Dictionary <InventoryIndex, WeaponBehaviourScript> { { InventoryIndex.First, null }, { InventoryIndex.Second, null }, { InventoryIndex.Throwable, null } }; _currentActiveWeaponSlot = InventoryIndex.First; }
public Inventory this[InventoryIndex inv] { get { var num = (int)inv; if (num < 0 || num >= InventoryCount) { return(null); } return(ReadObjectAt <Inventory>(num * 8)); } }
/// <summary> /// Adds a weapon to the inventory, at the given inventory slot. If there already is a weapon there, drops it. /// </summary> /// <param name="slot">The inventory slot to add the weapon to</param> /// <param name="weaponScript">The WeaponBehaviourScript attached to the weapon gameobject</param> /// <returns>A boolean indicating if the addition was successful</returns> private bool AddWeapon(InventoryIndex slot, WeaponBehaviourScript weaponScript) { if (_weaponSlots[slot] != null) { if (_weaponSlots[slot].WeaponData.WeaponName.Equals(weaponScript.WeaponData.WeaponName)) { if (_weaponSlots[slot].WeaponData.WeaponName is WeaponName.Grenade) { _weaponSlots[slot].CurrentMagazineAmmunition += weaponScript.CurrentMagazineAmmunition + weaponScript.CurrentTotalAmmunition; } else { _weaponSlots[slot].CurrentTotalAmmunition += weaponScript.CurrentMagazineAmmunition + weaponScript.CurrentTotalAmmunition; } Destroy(weaponScript.gameObject); weaponScript.gameObject.transform.parent = gameObject.transform; return(true); } else { _weaponSlots[slot].WeaponStateProp = WeaponState.OnGround; _weaponSlots[slot].transform.parent = null; weaponScript.WeaponStateProp = WeaponState.InInventory; _weaponSlots[slot] = weaponScript; AddWeaponHUD?.Invoke(slot, weaponScript); weaponScript.gameObject.transform.parent = gameObject.transform; return(true); } } else { weaponScript.WeaponStateProp = WeaponState.InInventory; _weaponSlots[slot] = weaponScript; AddWeaponHUD?.Invoke(slot, weaponScript); weaponScript.gameObject.transform.parent = gameObject.transform; return(true); } }
public Element GetElementSlot(InventoryIndex inventoryIndex) { return(inventoryIndex switch { InventoryIndex.None => throw new ArgumentOutOfRangeException(nameof(inventoryIndex)), InventoryIndex.Helm => EquippedItems.GetChildAtIndex(6), InventoryIndex.Amulet => EquippedItems.GetChildAtIndex(7), InventoryIndex.Chest => EquippedItems.GetChildAtIndex(8), InventoryIndex.LWeapon => EquippedItems.GetChildAtIndex(10), InventoryIndex.RWeapon => EquippedItems.GetChildAtIndex(9), InventoryIndex.LWeaponSwap => EquippedItems.GetChildAtIndex(12), InventoryIndex.RWeaponSwap => EquippedItems.GetChildAtIndex(11), InventoryIndex.LRing => EquippedItems.GetChildAtIndex(13), InventoryIndex.RRing => EquippedItems.GetChildAtIndex(14), InventoryIndex.Gloves => EquippedItems.GetChildAtIndex(15), InventoryIndex.Belt => EquippedItems.GetChildAtIndex(16), InventoryIndex.Boots => EquippedItems.GetChildAtIndex(17), InventoryIndex.PlayerInventory => EquippedItems.GetChildAtIndex(18), InventoryIndex.Flask => EquippedItems.GetChildAtIndex(19), InventoryIndex.Trinket => EquippedItems.GetChildAtIndex(20), InventoryIndex.BloodCrucible => EquippedItems.GetChildAtIndex(1), _ => throw new ArgumentOutOfRangeException(nameof(inventoryIndex)) });
public void RemoveFromInventory(InventoryIndex weaponSlot) { _inventoryContainer[weaponSlot].SendMessage("RemoveWeaponFromInventorySlot", SendMessageOptions.DontRequireReceiver); }
public Inventory this[InventoryIndex k] => AllInventories[k];
public void AddToInventory(InventoryIndex slot, WeaponBehaviourScript weaponScript) { _inventoryContainer[slot].SendMessage("AddWeaponToInventorySlot", weaponScript, SendMessageOptions.DontRequireReceiver); }
//Outlines the weapon image in the HUD inventory that is currently used by the player. public void ChangeSelected(InventoryIndex newSelectedSlot) { _inventoryContainer[_selectedSlot].transform.Find("Selected").gameObject.SetActive(false); _selectedSlot = newSelectedSlot; _inventoryContainer[_selectedSlot].transform.Find("Selected").gameObject.SetActive(true); }
/// <summary> /// Sorted by InventoryIndex /// </summary> public int CompareTo(ItemModel other) => InventoryIndex.CompareTo(other.InventoryIndex);