Exemplo n.º 1
0
        public void RemoveItemFromInventory(GameItem item)
        {
            Inventory.Remove(item);

            GroupedInventoryItem groupedInventoryItemToRemove = item.IsUnique ?
                                                                GroupedInventory.FirstOrDefault(gi => gi.Item == item) :
                                                                GroupedInventory.FirstOrDefault(gi => gi.Item.ItemTypeID == item.ItemTypeID);

            if (groupedInventoryItemToRemove != null)
            {
                if (groupedInventoryItemToRemove.Quantity == 1)
                {
                    GroupedInventory.Remove(groupedInventoryItemToRemove);
                }
                else
                {
                    groupedInventoryItemToRemove.Quantity--;
                }
            }

            OnPropertyChanged(nameof(Weapons));
            OnPropertyChanged(nameof(Potions));
        }
Exemplo n.º 2
0
        public void AddItemToInventory(GameItem item)
        {
            Inventory.Add(item);

            if (item.IsUnique)
            {
                // If the game item is unique, it is added in
                GroupedInventory.Add(new GroupedInventoryItem(item, 1));
            }
            else
            {
                if (!GroupedInventory.Any(gi => gi.Item.ItemTypeID == item.ItemTypeID))
                {
                    //if the game item isn't unique, it's added in too with a quantity of 0
                    GroupedInventory.Add(new GroupedInventoryItem(item, 0));
                }

                // non-uniques have their quantity increased by one
                GroupedInventory.First(gi => gi.Item.ItemTypeID == item.ItemTypeID).Quantity++;
            }

            OnPropertyChanged(nameof(Weapons));
        }
Exemplo n.º 3
0
        public void AddItemToInventory(GameItem item)
        {
            Inventory.Add(item);

            //if item is unique, add a new groupedinventory item with quantity 1.
            if (item.IsUnique)
            {
                GroupedInventory.Add(new GroupedInventoryItem(item, 1));
            }
            else
            {
                //Check if this is the first one of this item that the player has
                if (!GroupedInventory.Any(gi => gi.Item.ItemTypeID == item.ItemTypeID))
                {
                    //quantity 0 because next line adds 1 to quantity
                    GroupedInventory.Add(new GroupedInventoryItem(item, 0));
                }

                GroupedInventory.First(gi => gi.Item.ItemTypeID == item.ItemTypeID).Quantity++;
            }

            OnPropertyChanged(nameof(Weapons));
        }
 public GroupedInventoryItem(GameItem item, int quantity)
 {
     Item     = item;
     Quantity = quantity;
 }
Exemplo n.º 5
0
        public void RemoveItemFromInventory(GameItem item)
        {
            Inventory.Remove(item);

            OnPropertyChanged(nameof(Weapons));
        }
Exemplo n.º 6
0
        public void AddItemToInventory(GameItem item)
        {
            Inventory.Add(item);

            OnPropertyChanged(nameof(Weapons));
        }
Exemplo n.º 7
0
 public void RemoveItemFromInventory(GameItem item)
 {
     Inventory.Remove(item);
 }
Exemplo n.º 8
0
 public void AddItemToInventory(GameItem item)
 {
     Inventory.Add(item);
 }
Exemplo n.º 9
0
 public GroupedInventoryItem(GameItem groupItem, int groupQuantity)
 {
     item     = groupItem;
     quantity = groupQuantity;
 }
Exemplo n.º 10
0
 public Monster(int id, string name, string imageName, int dexterity, int maximumHitPoints, GameItem currentWeapon,
                int rewardExperiencePoints, int gold)
     : base(name, dexterity, maximumHitPoints, maximumHitPoints, gold)
 {
     ID                     = id;
     ImageName              = imageName;
     CurrentWeapon          = currentWeapon;
     RewardExperiencePoints = rewardExperiencePoints;
 }
Exemplo n.º 11
0
 public void RemoveItem(GameItem item)
 {
     _quickChoiceItems.Remove(item);
     item.IsInQuickChoose = false;
 }
Exemplo n.º 12
0
 List <GameItem> _quickChoiceItems = new List <GameItem>(); //LIFO
 public void InsertItem(GameItem item)
 {
     _quickChoiceItems.Add(item);
     item.IsInQuickChoose = true;
 }