// === EQUIP === // void BagManager::equip(Actor* item) { ItemSlotType itemSlot = item->getFeature<Pickable>()->getItemSlot(); Wearer* playerWearer = Actor::Player->getFeature<Wearer>(); if ( playerWearer->hasSlot( itemSlot ) ) { if ( canEquip(itemSlot) ) doTheEquip(item); } else { msgBox( "You haven't got appropriate slot to equip this item.", gui::MsgType::Error); } }
EquipmentSlot Item::getEquipmentSlot() const { CHECK(canEquip()); if (getType() == ItemType::WEAPON) return EquipmentSlot::WEAPON; if (getType() == ItemType::RANGED_WEAPON) return EquipmentSlot::RANGED_WEAPON; if (getType() == ItemType::AMULET) return EquipmentSlot::AMULET; if (armorType == ArmorType::BODY_ARMOR) return EquipmentSlot::BODY_ARMOR; if (armorType == ArmorType::HELMET) return EquipmentSlot::HELMET; if (armorType == ArmorType::BOOTS) return EquipmentSlot::BOOTS; FAIL << "other equipment slot"; return EquipmentSlot::HELMET; }
EquipmentSlot Item::getEquipmentSlot() const { CHECK(canEquip()); return *attributes->equipmentSlot; }