/// <summary> /// This adds the item directly to the player's inventory without adding it to the UI. It assumes the player /// dragged the Item into their inventory. /// </summary> private void HandleOnChestItemTaken(ItemInventoryTile tile) { Item item = tile.GetParentItem(); currentChest.RemoveItem(item); inventoryController.AddItem(item, false); }
private void HandleOnLootAllPressed() { for (int row = 0; row < 4; row++) { for (int col = 0; col < 2; col++) { LootChestSlot slot = chestInventorySlots[row, col]; if (slot.IsOccupied() && backPackSlotManager.HasEmptySlots()) { // Take ItemTile from Chest ItemInventoryTile tile = slot.GetItemTile(); slot.RemoveItemTile(); // Add to the Backpack and to the inventory backPackSlotManager.AddItemTileToBackpack(tile); inventoryController.AddItem(tile.GetParentItem(), false); } } } }
public override bool CanDropDnDItem(ItemInventoryTile tile) { GD.Print("ArmorSlot - CanDropDnDItem"); Item item = tile.GetParentItem(); // Cast to Armor and get stats if (item is IEquipable && item is Armor a) { ArmorStats stats = a.GetStats(); // Verify matching slot types if (stats.slotType == armorSlotType) { // Return true even if we are occupied so we can swap the items return(true); } } // Failed the conversion tree, so the item is not the right type for this slot return(false); }
public override bool CanDropDnDItem(ItemInventoryTile tile) { GD.Print("TrinketSlot - CanDropDnDItem"); Item item = tile.GetParentItem(); // Cast to Armor and get stats if (item is IEquipable && item is Trinket t) { TrinketStats stats = t.GetStats(); // Verify matching slot types if (stats.equipType == TrinketEquipType.RING && (trinketSlotType == TrinketSlotType.LEFT_RING || trinketSlotType == TrinketSlotType.RIGHT_RING)) { // Return true even if we are occupied so we can swap the items return(true); } } // Failed the conversion tree, so the item is not the right type for this slot return(false); }
public override bool CanDropDnDItem(ItemInventoryTile tile) { GD.Print("WeaponSlot - CanDropDnDItem"); Item item = tile.GetParentItem(); // Cast to Armor and get stats if (item is IEquipable && item is Weapon w) { WeaponStats stats = w.GetStats(); // Verify matching slot types if (weaponSlotTypeType == WeaponSlotType.MAIN_HAND) { return(stats.weaponEquipType != WeaponEquipType.OFF_HAND); } else if (weaponSlotTypeType == WeaponSlotType.OFF_HAND) { return(stats.weaponEquipType != WeaponEquipType.MAIN_HAND); } } // Failed the conversion tree, so the item is not the right type for this slot return(false); }
public void ShowMenu(ItemSlot itemSlot) { currentSlot = itemSlot; currentTile = itemSlot.GetItemTile(); if (currentTile == null) { HideMenu(); return; } currentItem = currentTile.GetParentItem(); if (currentItem == null) { HideMenu(); GD.PrintErr("Null Item?"); return; } SelectButtons(); PositionContainer(); Visible = true; }