Example #1
0
        /// <summary>
        /// Removes game item from inventory
        /// </summary>
        public void RemoveGameItemFromInventory(GameItemQuantity selectedGameItemQuantity)
        {
            GameItemQuantity gameItemQuantity = _inventory.FirstOrDefault(i => i.GameItem.Id == selectedGameItemQuantity.GameItem.Id);

            if (gameItemQuantity != null)
            {
                _inventory.Remove(gameItemQuantity);
            }
            else
            {
                gameItemQuantity.Quantity--;
            }

            UpdateInventoryCategories();
        }
Example #2
0
        /// <summary>
        /// adds game item to inventory
        /// </summary>
        public void AddGameItemToInventory(GameItemQuantity selectedGameItemQuantity)
        {
            GameItemQuantity gameItemQuantity = _inventory.FirstOrDefault(i => i.GameItem.Id == selectedGameItemQuantity.GameItem.Id);

            if (gameItemQuantity == null)
            {
                GameItemQuantity newGameItemQuantity = new GameItemQuantity();
                newGameItemQuantity.GameItem = selectedGameItemQuantity.GameItem;
                newGameItemQuantity.Quantity = 1;
            }
            else
            {
                gameItemQuantity.Quantity++;
            }
            UpdateInventoryCategories();
        }
Example #3
0
        /// <summary>
        /// remove items from inventory
        /// </summary>
        public void RemoveGameItemQuantityFromLocation(GameItemQuantity selectedGameItemQuantity)
        {
            GameItemQuantity gameItemQuantity = _gameItems.FirstOrDefault(i => i.GameItem.Id == selectedGameItemQuantity.GameItem.Id);

            if (gameItemQuantity != null)
            {
                if (selectedGameItemQuantity.Quantity == 1)
                {
                    _gameItems.Remove(gameItemQuantity);
                }
                else
                {
                    gameItemQuantity.Quantity--;
                }
            }

            UpdateLocationGameItems();
        }
Example #4
0
        /// <summary>
        /// Add game item to location
        /// </summary>
        public void AddGameItemToLocation(GameItemQuantity selectedGameItem)
        {
            GameItemQuantity gameItemQuantity = _gameItems.FirstOrDefault(i => i.GameItem.Id == selectedGameItem.GameItem.Id);

            if (gameItemQuantity == null)
            {
                GameItemQuantity newGameItemQuantity = new GameItemQuantity();
                newGameItemQuantity.GameItem = selectedGameItem.GameItem;
                newGameItemQuantity.Quantity = 1;

                _gameItems.Add(newGameItemQuantity);
            }
            else
            {
                gameItemQuantity.Quantity++;
            }

            UpdateLocationGameItems();
        }
        public List <GameItemQuantity> RequiredGameItemsNotCompleted(List <GameItemQuantity> inventory)
        {
            List <GameItemQuantity> itemsNotCompleted = new List <GameItemQuantity>();

            foreach (var missionGameItem in _requiredGameItems)
            {
                GameItemQuantity inventoryMatch = inventory.FirstOrDefault(gi => gi.GameItem.Id == missionGameItem.GameItem.Id);

                if (inventoryMatch == null)
                {
                    itemsNotCompleted.Add(missionGameItem);
                }
                else
                {
                    if (inventoryMatch.Quantity < missionGameItem.Quantity)
                    {
                        itemsNotCompleted.Add(missionGameItem);
                    }
                }
            }

            return(itemsNotCompleted);
        }