public void Remove(MissileLauncherDataObject dataObject)
 {
     database.Remove(dataObject);
 }
 public void Add(MissileLauncherDataObject dataObject)
 {
     database.Add(dataObject);
 }
 public void Add(MissileLauncherDataObject dataObject)
 {
     database.Add(dataObject);
 }
 public void Remove(MissileLauncherDataObject dataObject)
 {
     database.Remove(dataObject);
 }
    /// <summary>
    /// Adds an item or quantity to the cargo hold collection
    /// </summary>
    /// <param name="ItemID"></param>
    /// <param name="ItemClass"></param>
    /// <param name="ItemType"></param>
    /// <param name="Quantity"></param>
    public void AddItem(int ItemID, PlayerInventoryDataObject.INVENTORY_CLASS ItemClass, PlayerInventoryDataObject.INVENTORY_TYPE ItemType, int Quantity)
    {
        //Make sure we have room. Check the property plus the intended addition
        if (CurrentCargoLoad + Quantity < CargoCapacity)
        {
            //We have room
            PlayerInventoryDataObject pido = InventoryItemList
                                             .Where(i => i.inventoryObjectID.Equals(ItemID) && i.inventoryObjectClass.Equals(ItemClass) && i.inventoryObjectType.Equals(ItemType))
                                             .First();

            //Is this an existing item or a new item?
            if (pido != null)
            {
                //Existing. We have already made sure we can fit it, so increment current quantity
                pido.inventoryQuantity += Quantity;
            }
            else
            {
                //A new item! Need to determine if it's a commodity or equipment
                PlayerInventoryDataObject npido = new PlayerInventoryDataObject();

                switch (ItemClass)
                {
                case PlayerInventoryDataObject.INVENTORY_CLASS.Commodity:
                    //This is a commodity, so all we need is commodity info
                    CommodityDataObject cmdo = DataController.DataAccess.commodityMasterList.Where(c => c.commodityID.Equals(ItemID)).First();
                    npido.inventoryObjectID    = cmdo.commodityID;
                    npido.inventoryObjectClass = PlayerInventoryDataObject.INVENTORY_CLASS.Commodity;
                    npido.inventoryObjectType  = ItemType;
                    npido.inventoryQuantity    = Quantity;
                    break;

                case PlayerInventoryDataObject.INVENTORY_CLASS.ShipEquipment:
                    //This is ship equipment. We need to know which DB to query for the details.
                    //Some items are commented out because it doesn't make sense to be able to carry them around
                    //  Like a hull inside a cargo hold.
                    //Commented these because I might need to move them elsewhere, like for station storage
                    switch (ItemType)
                    {
                    //case PlayerInventoryDataObject.INVENTORY_TYPE.Hull:
                    //    HullDataObject hdo = DataController.dataController.hullMasterList.Where(h => h.iD.Equals(ItemID)).First();
                    //    npido.inventoryObjectID = hdo.iD;
                    //    npido.inventoryObjectClass = PlayerInventoryDataObject.INVENTORY_CLASS.ShipEquipment;
                    //    npido.inventoryObjectType = ItemType;
                    //    npido.inventoryQuantity = Quantity;
                    //    break;
                    case PlayerInventoryDataObject.INVENTORY_TYPE.Engine:
                        EngineDataObject edo = DataController.DataAccess.engineMasterList.Where(e => e.iD.Equals(ItemID)).First();
                        npido.inventoryObjectID    = edo.iD;
                        npido.inventoryObjectClass = PlayerInventoryDataObject.INVENTORY_CLASS.ShipEquipment;
                        npido.inventoryObjectType  = ItemType;
                        npido.inventoryQuantity    = Quantity;
                        break;

                    //case PlayerInventoryDataObject.INVENTORY_TYPE.Cargo:
                    //    CargoDataObject crdo = DataController.dataController.cargoHoldMasterList.Where(c => c.iD.Equals(ItemID)).First();
                    //    npido.inventoryObjectID = crdo.iD;
                    //    npido.inventoryObjectClass = PlayerInventoryDataObject.INVENTORY_CLASS.ShipEquipment;
                    //    npido.inventoryObjectType = ItemType;
                    //    npido.inventoryQuantity = Quantity;
                    //    break;
                    case PlayerInventoryDataObject.INVENTORY_TYPE.Shield:
                        ShieldDataObject shdo = DataController.DataAccess.shieldMasterList.Where(s => s.iD.Equals(ItemID)).First();
                        npido.inventoryObjectID    = shdo.iD;
                        npido.inventoryObjectClass = PlayerInventoryDataObject.INVENTORY_CLASS.ShipEquipment;
                        npido.inventoryObjectType  = ItemType;
                        npido.inventoryQuantity    = Quantity;
                        break;

                    case PlayerInventoryDataObject.INVENTORY_TYPE.Cannon:
                        CannonDataObject cndo = DataController.DataAccess.cannonMasterList.Where(c => c.iD.Equals(ItemID)).First();
                        npido.inventoryObjectID    = cndo.iD;
                        npido.inventoryObjectClass = PlayerInventoryDataObject.INVENTORY_CLASS.ShipEquipment;
                        npido.inventoryObjectType  = ItemType;
                        npido.inventoryQuantity    = Quantity;
                        break;

                    case PlayerInventoryDataObject.INVENTORY_TYPE.MissileLauncher:
                        MissileLauncherDataObject mldo = DataController.DataAccess.missileLauncherMasterList.Where(m => m.iD.Equals(ItemID)).First();
                        npido.inventoryObjectID    = mldo.iD;
                        npido.inventoryObjectClass = PlayerInventoryDataObject.INVENTORY_CLASS.ShipEquipment;
                        npido.inventoryObjectType  = ItemType;
                        npido.inventoryQuantity    = Quantity;
                        break;

                    case PlayerInventoryDataObject.INVENTORY_TYPE.Scanner:
                        ScannerDataObject scdo = DataController.DataAccess.scannerMasterList.Where(s => s.iD.Equals(ItemID)).First();
                        npido.inventoryObjectID    = scdo.iD;
                        npido.inventoryObjectClass = PlayerInventoryDataObject.INVENTORY_CLASS.ShipEquipment;
                        npido.inventoryObjectType  = ItemType;
                        npido.inventoryQuantity    = Quantity;
                        break;

                    case PlayerInventoryDataObject.INVENTORY_TYPE.FighterBay:
                        FighterBayDataObject fbdo = DataController.DataAccess.figherBayMasterList.Where(f => f.iD.Equals(ItemID)).First();
                        npido.inventoryObjectID    = fbdo.iD;
                        npido.inventoryObjectClass = PlayerInventoryDataObject.INVENTORY_CLASS.ShipEquipment;
                        npido.inventoryObjectType  = ItemType;
                        npido.inventoryQuantity    = Quantity;
                        break;

                    case PlayerInventoryDataObject.INVENTORY_TYPE.Plating:
                        PlatingDataObject pdo = DataController.DataAccess.platingMasterList.Where(p => p.iD.Equals(ItemID)).First();
                        npido.inventoryObjectID    = pdo.iD;
                        npido.inventoryObjectClass = PlayerInventoryDataObject.INVENTORY_CLASS.ShipEquipment;
                        npido.inventoryObjectType  = ItemType;
                        npido.inventoryQuantity    = Quantity;
                        break;

                    default:
                        break;
                    }
                    break;

                default:
                    break;
                }

                InventoryItemList.Add(npido);
            }
        }
        else
        {
            Debug.Log("Not enough room to add more items to cargo");
        }
    }