private static bool validateFromCursorOperation(ItemInventorySlot swapSlot, EquipmentItem swapEquipItem, int slotNum, bool drop, int quantity, PlayerInfo info) { //cursor must have something in it for a valid transfer if (info.cursorSlot == null || info.cursorSlot.isEmpty()) { Debug.Log("InventoryOperation validation error: cursor is null or has no contents to transfer"); return(false); } Item transferItem = info.cursorSlot.getItem(); int cursorQuantity = info.cursorSlot.getQuantity(); //quantity tranferred cannot be greater than that in cursor if (quantity > cursorQuantity) { Debug.Log("InventoryOperation validation error: cannot transfer more items than cursor has"); return(false); } bool handleEquipment = true; //if there is an equipment slot or if dropping, not performing an equipment change if (swapSlot != null || drop == true) { handleEquipment = false; } if (handleEquipment) { //equippables dont stack if (cursorQuantity > 1) { Debug.Log("InventoryOperation validation error: cursor cannot carry more than one equipment item"); return(false); } EquipSlots eSlot = (EquipSlots)slotNum; switch (eSlot) { case EquipSlots.Helmet: //check for inconsistency. if (info.helmet != null && swapEquipItem == null) { Debug.Log("InventoryOperation validation error: trying to equip incorrect equipment to helmet slot or slot is occupied"); return(false); } return(transferItem is HelmetItem); case EquipSlots.UpperBody: if (info.upperBody != null && swapEquipItem == null) { Debug.Log("InventoryOperation validation error: trying to equip incorrect equipment to upper body slot or slot is occupied"); return(false); } return(transferItem is UpperBodyItem); case EquipSlots.LowerBody: if (info.lowerBody != null && swapEquipItem == null) { Debug.Log("InventoryOperation validation error: trying to equip incorrect equipment to lower body slot or slot is occupied"); return(false); } return(transferItem is LowerBodyItem); case EquipSlots.Boots: if (info.boots != null && swapEquipItem == null) { Debug.Log("InventoryOperation validation error: trying to equip incorrect equipment to boots slot or slot is occupied"); return(false); } return(transferItem is BootsItem); case EquipSlots.LeftClaw: if (info.leftClaw != null && swapEquipItem == null) { Debug.Log("InventoryOperation validation error: trying to equip incorrect equipment to left claw slot or slot is occupied"); return(false); } return(transferItem is ClawItem); case EquipSlots.RightClaw: if (info.rightClaw != null && swapEquipItem == null) { Debug.Log("InventoryOperation validation error: trying to equip incorrect equipment to right claw slot or slot is occupied"); return(false); } return(transferItem is ClawItem); case EquipSlots.Backpack: if (info.backpack != null && swapEquipItem == null) { Debug.Log("InventoryOperation validation error: trying to equip incorrect equipment to backpack slot or slot is occupied"); return(false); } return(transferItem is BackpackItem); default: Debug.Log("InventoryOperation validation error: unrecognized equipment type"); return(false); } } else { if (swapSlot != null) { //if enough space and item is same as destination, success. if (swapSlot.isAddableItems(transferItem, quantity)) { return(true); } else { Debug.Log("InventoryOperation validation error: trying to unequip non-existing helmet"); return(false); } } else { //if not a swap slot, must be drop. Return drop success. return(drop); } } }