Loading...   


bool EQEmu::InventoryProfile::IsSlotValid(const InventorySlot &inventory_slot)
{
	if (inventory_slot.IsDelete())
		return true;

	if (inventory_slot.Type < inventory::InvTypeBegin || inventory_slot.Type >= inventory::InvTypeCount)
		return false;

	size_t type_size = impl_->data_profile_.Lookup->InventoryTypeSize[inventory_slot.Type];
	if (!type_size)
		return false;

	if (inventory_slot.Slot < inventory::InvSlotBegin || inventory_slot.Slot >= type_size)
		return false;

	if (inventory_slot.Type == inventory::InvTypePossessions) {
		if (!(((uint64)1 << inventory_slot.Slot) & impl_->data_profile_.Lookup->PossessionsBitmask))
			return false;
	}
		
	if (inventory_slot.Bag < inventory::InvBagInvalid || inventory_slot.Bag >= impl_->data_profile_.Lookup->ItemBagSize)
		return false;

	if (inventory_slot.Aug < inventory::InvAugInvalid || inventory_slot.Aug >= impl_->data_profile_.Lookup->ItemAugSize)
		return false;

	return true;
}

Raw Paste Data