public void RemoveQuestCompletionItems(Quest quest)
        {
            foreach (QuestCompletionItem qci in quest.QuestCompletionItems)
            {
                InventoryItem item = Inventory.SingleOrDefault(ii => ii.Details.ID == qci.Details.ID);

                if (item != null)
                {
                    //subtract the qty from player's inventory that was required for quest completion
                    item.Quantity -= qci.Quantity;
                }
            }
        }
Exemple #2
0
        public void RemoveQuestCompletionItems(Quest quest)
        {
            foreach (QuestCompletionItem qci in quest.QuestCompletionItems)
            {
                InventoryItem item = Inventory.SingleOrDefault(ii => ii.Details.ID == qci.Details.ID);

                if (item != null)
                {
                    //subtract qci quantity from player's inventory
                    RemoveItemFromInventory(item.Details, qci.Quantity);
                }
            }
        }
Exemple #3
0
        // Check for the item to add, if its null, add 1 to quantity, otherwise increase it by 1
        public void AddItemToInventory(IItem itemToAdd)
        {
            InventoryItem item = Inventory.SingleOrDefault(inventoryItem => inventoryItem.Item.ID == itemToAdd.ID);

            if (item == null)
            {
                Inventory.Add(new InventoryItem(itemToAdd, 1));
            }
            else
            {
                item.Quantity++;
            }
        }
Exemple #4
0
        //removes required quest items in inventory
        public void RemoveQuestCompletionItems(Quest quest)
        {
            foreach (QuestCompletionItem qci in quest.QuestCompletionItems)
            {
                // Subtract the quantity from the player's inventory that was needed to complete the quest
                InventoryItem item = Inventory.SingleOrDefault(ii => ii.Details.ID == qci.Details.ID);

                if (item != null)
                {
                    RemoveItemFromInventory(item.Details, qci.Quantity);
                }
            }
        }
Exemple #5
0
        public void RemoveQuestCompletionItems(Quest quest)
        {
            foreach (QuestCompletionItem qci in quest.QuestCompletionItems)
            {
                InventoryItem item = Inventory.SingleOrDefault(ii => ii.Details.ID == qci.Details.ID);

                if (item != null)
                {
                    //Subtract quest quantity from inventory
                    item.Quantity -= qci.Quantity;
                }
            }
        }
Exemple #6
0
        public void AddItemToInventory(Item itemToAdd)
        {
            InventoryItem item = Inventory.SingleOrDefault(ii => ii.Details.ID == itemToAdd.ID);

            if (item != null)
            {
                item.Quantity++;
            }
            else
            {
                Inventory.Add(new InventoryItem(itemToAdd, 1));
            }
        }
Exemple #7
0
        public void RemoveQuestCompletionItems(Quest quest)
        {
            foreach (FinishedQuest finishedQuest in quest.FinishedQuests)
            {
                Inventory item = Inventory.SingleOrDefault(i => i.Item.ID == finishedQuest.Item.ID);

                if (item != null)
                {
                    // Subtract the quantity from the player's inventory that was needed to complete the quest
                    item.Quantity -= finishedQuest.Quantity;
                }
            }
        }
        public void additemtoinventor(_items itemtoadd, int quantity = 1)
        {
            Inventory item = Inventory.SingleOrDefault(ii => ii.Details.ID == itemtoadd.ID);

            if (item == null)
            {
                Inventory.Add(new Inventory(itemtoadd, quantity));
            }
            else
            {
                item.Quantity += quantity;
            }
            raiseInventoryChangedEvent(itemtoadd);
        }
        public void RemoveItemFromInventory(_items itemToRemove, int quantity = 1)
        {
            Inventory item = Inventory.SingleOrDefault(ii => ii.Details.ID == itemToRemove.ID);

            if (item != null)
            {
                item.Quantity -= quantity;
                if (item.Quantity == 0)
                {
                    Inventory.Remove(item);
                }
                raiseInventoryChangedEvent(itemToRemove);
            }
        }
Exemple #10
0
        public void AddItem(Item item, int quantity) // add item to the player inventory
        {
            InventoryItem theitem = Inventory.SingleOrDefault(ii => ii.Details.ID == item.ID);

            if (theitem != null)
            {
                theitem.Quantity += quantity;
            }
            else
            {
                this.Inventory.Add(new InventoryItem(item, quantity));
            }
            CallInventoryChangedEvent(item);
        }
Exemple #11
0
        public void AddQuestRewards(Quest quest)
        {
            AddExperiencePoints(quest.RewardExperiencePoints);
            Gold += quest.RewardGold;

            if (Inventory.Any(x => x.Details.ID == quest.RewardItem.ID))
            {
                Inventory.SingleOrDefault(x => x.Details.ID == quest.RewardItem.ID).Quantity += 1;
            }
            else
            {
                Inventory.Add(new InventoryItem(quest.RewardItem, 1));
            }
        }
Exemple #12
0
        public void AddItemToInventory(Item itemToAdd, int quantity = 1)
        {
            InventoryItem item = Inventory.SingleOrDefault(ii => ii.Details.ID == itemToAdd.ID);

            if (item == null)
            {
                Inventory.Add(new InventoryItem(itemToAdd, quantity));
            }
            else
            {
                item.Quantity += quantity;
            }
            RaiseInventoryChangedEvent(itemToAdd);
        }
Exemple #13
0
        public void AddItemToInventory(Item itemToAdd)
        {
            InventoryItem item = Inventory.SingleOrDefault(ii => ii.Details.ID == itemToAdd.ID);

            if (item == null)
            {
                // Добавить предмет в инвентарь и увеличить количество предметов на один
                Inventory.Add(new InventoryItem(itemToAdd, 1));
            }
            else
            {
                // Предмет уже имеется, увеличить количество на один
                item.Quantity++;
            }
        }
Exemple #14
0
        public void AddItemToInventory(Item itemToAdd)
        {
            InventoryItem item = Inventory.SingleOrDefault(ii => ii.Details.ID == itemToAdd.ID);

            if (item == null)
            {
                // didnt have item; add it
                Inventory.Add(new InventoryItem(itemToAdd, 1));
            }
            else
            {
                // have it; increment
                item.Quantity++;
            }
        }
Exemple #15
0
        public void AddItemToInventory(Item itemToAdd)
        {
            InventoryItem item = Inventory.SingleOrDefault(ii => ii.Details.ID == itemToAdd.ID);

            if (item == null)
            {
                //they didn't have the item, so we add it
                Inventory.Add(new InventoryItem(itemToAdd, 1));
            }
            else
            {
                //they have the item in the inventory
                item.Quantity++;
            }
        }
Exemple #16
0
        public void AddItemToInventory(Item itemToAdd, int quantity = 1)
        {
            // Обхожда Inventory, за да провери дали reward item-a го няма вече в Inventory
            InventoryItem item = Inventory.SingleOrDefault(ii => ii.Details.ID == itemToAdd.ID);

            if (item == null) // RewardItem не се съдържа в Inventory щом все още сме във функцията, така че добави reward item-a като нов InventoryItem (в нов слот) с брой 1 по default
            {
                Inventory.Add(new InventoryItem(itemToAdd, quantity));
            }
            else // RewardItem се съдържа в Inventory, затова само увеличи броя с 1
            {
                item.Quantity++;
            }
            RaiseInventoryChangedEvent(itemToAdd);
        }
Exemple #17
0
        public void AddItemToInventory(Weapon itemToAdd, int quantity = 1)
        {
            Inventory item = Inventory.SingleOrDefault(ii => ii.Details.ID == itemToAdd.ID);

            if (item == null)
            {
                // They didn't have the item, so add it to their inventory
                Inventory.Add(new Inventory(itemToAdd, quantity));
            }
            else
            {
                // They have the item in their inventory, so increase the quantity
                item.Quantity += quantity;
            }
        }
Exemple #18
0
        public void AddItemToInventory(Item itemToAdd)
        {
            InventoryItem item = Inventory.SingleOrDefault(ii => ii.Details.ID == itemToAdd.ID);

            if (item == null)
            {
                // They didn't have the item, so add it to their inventory, with a quantity of 1
                Inventory.Add(new InventoryItem(itemToAdd, 1));
            }
            else
            {
                // They have the item in their inventory, so increase the quantity by one
                item.Quantity++;
            }
        }
        public void RemoveQuestCompletionItems(Quest quest)
        {
            //NOTE: if the player doesn't have the item, this will do nothing
            foreach (QuestCompletionItem qci in quest.QuestCompletionItems)
            {
                // Subtract the quantity from the player's inventory that was needed to complete the quest
                InventoryItem item = Inventory.SingleOrDefault(
                    ii => ii.Details.ID == qci.Details.ID);

                if (item != null)  // Don't have to check for this if we know he has the item?
                {
                    RemoveItemFromInventory(item.Details, qci.Quantity);
                }
            }
        }
        public void AddItemToInventory(Item itemToAdd)
        {
            //LINQ para comprobar si el jugador tiene el item en su inventario
            InventoryItem item = Inventory.SingleOrDefault(ii => ii.Details.ID == itemToAdd.ID);

            if (item == null)
            {
                // si no lo tiene lo añadimos a la lista.
                Inventory.Add(new InventoryItem(itemToAdd, 1));
            }
            else
            {
                // Si ya lo tiene, añadimos uno más a la cantidad.
                item.Quantity++;
            }
        }
Exemple #21
0
        public void AddItemToInventory(int itemID, int quantity = 1)
        {
            InventoryItem invItem = Inventory.SingleOrDefault(ii => ii.ID == itemID);

            if (invItem == null)
            {
                invItem = new InventoryItem(World.GetItem(itemID), quantity);
                Inventory.Add(invItem);
            }
            else
            {
                invItem.Quantity += quantity;
            }

            RaiseInventoryChangedEvent(invItem.Data);
        }
Exemple #22
0
        public void RemoveItemFromInventory(int itemID, int quantity = 1)
        {
            InventoryItem invItem = Inventory.SingleOrDefault(ii => ii.ID == itemID);

            if (invItem != null)
            {
                invItem.Quantity -= quantity;

                if (invItem.Quantity <= 0)
                {
                    Inventory.Remove(invItem);
                }

                RaiseInventoryChangedEvent(invItem.Data);
            }
        }
        public void AddItemToInventory(Item itemToAdd, int quantity = 1)
        {
            InventoryItem inventoryItem = Inventory.SingleOrDefault(ii => ii.Details.ID == itemToAdd.ID);

            if (inventoryItem == null)
            {
                //They don't have the item, so add 1
                Inventory.Add(new InventoryItem(itemToAdd, quantity));
            }
            else
            {
                //They have the item, increase by 1
                inventoryItem.Quantity += quantity;
            }
            RaiseInventoryChangeEvent(itemToAdd);
        }
 public void AddItemToInventory(Item itemToAdd)
 {
     InventoryItem item = Inventory.SingleOrDefault(ii => ii.Details.ID == itemToAdd.ID);
     {
         if (item == null)
         {
             //if they already have them same item in their inventory, increase the quantity by one
             Inventory.Add(new InventoryItem(itemToAdd, 1));
         }
         else
         {
             //they have the item in their inventory,so increase the quantity.
             item.Quantity++;
         }
     }
 }
Exemple #25
0
        public void AddItemToInventory(Item itemToAdd)
        {
            InventoryItem item = Inventory.SingleOrDefault(ii => ii.Details.ID == itemToAdd.ID);

            if (item == null)
            {
                //Inventory.SingleOrDefault returns null, so there is no InventoryItem that == itemToAdd.ID
                //Add Item to Inventory by storing to new InventoryItem in list
                Inventory.Add(new InventoryItem(itemToAdd, 1));
            }
            else
            {
                //The have the item in the inventory, so we just add quantity
                item.Quantity++;
            }
        }
Exemple #26
0
        public void AddItemToInventory(Item itemToAdd, int quantity = 1)
        {
            InventoryItem item = Inventory.SingleOrDefault(ii => ii.Details.ID == itemToAdd.ID);

            if (item == null)
            {
                //They didnt have the item so add it to their inventory, with a quantity of 1
                Inventory.Add(new InventoryItem(itemToAdd, quantity));
            }
            else
            {
                //They have the item in their inventory so increase it by one
                item.Quantity += quantity;
            }

            RaiseInventoryChangedEvent(itemToAdd);
        }
Exemple #27
0
        public void AddMonsterRewards(Monster monster, List <Item> loot)
        {
            AddExperiencePoints(monster.RewardExperiencePoints);
            Gold += monster.RewardGold;

            foreach (Item rewardItems in loot)
            {
                if (Inventory.Any(x => x.Details.ID == rewardItems.ID))
                {
                    Inventory.SingleOrDefault(x => x.Details.ID == rewardItems.ID).Quantity += 1;
                }
                else
                {
                    Inventory.Add(new InventoryItem(rewardItems, 1));
                }
            }
        }
        public void AddItemToInventory(Item itemToAdd, int quantity = 1)
        {
            InventoryItem existingItemInInventory = Inventory.SingleOrDefault(ii => ii.Details.ID == itemToAdd.ID);

            if (existingItemInInventory == null)
            {
                // They didn't have the item, so add it to their inventory
                Inventory.Add(new InventoryItem(itemToAdd, quantity));
            }
            else
            {
                // They have the item in their inventory, so increase the quantity
                existingItemInInventory.Quantity += quantity;
            }

            RaiseInventoryChangedEvent(itemToAdd);
        }
Exemple #29
0
        public void AddItemToInventory(Item itemToAdd, int quantity = 1)
        {
            if (quantity <= 0)
            {
                return;
            }

            InventoryItem item = Inventory.SingleOrDefault(a => a.Details.ID == itemToAdd.ID);

            if (item == null)
            {
                Inventory.Add(new InventoryItem(itemToAdd, quantity));
            }
            else
            {
                item.Quantity += quantity;
            }
        }
Exemple #30
0
        public void AddItemToInventory(Item itemToAdd, int quantity = 1)
        {
            InventoryItem item = Inventory.SingleOrDefault(ii => ii.Details.ID == itemToAdd.ID);

            if (item == null)
            {
                // They didn't have the item, so add it to their inventory
                Inventory.Add(new InventoryItem(itemToAdd, quantity));
            }
            else
            {
                // They have the item in their inventory, so increase the quantity
                item.Quantity += quantity;
            }

            OnPropertyChanged(nameof(Inventory));
            OnPropertyChanged(nameof(VendorGold));
        }