示例#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));
        }
示例#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));
        }
示例#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;
 }
示例#5
0
        public void RemoveItemFromInventory(GameItem item)
        {
            Inventory.Remove(item);

            OnPropertyChanged(nameof(Weapons));
        }
示例#6
0
        public void AddItemToInventory(GameItem item)
        {
            Inventory.Add(item);

            OnPropertyChanged(nameof(Weapons));
        }
示例#7
0
 public void RemoveItemFromInventory(GameItem item)
 {
     Inventory.Remove(item);
 }
示例#8
0
 public void AddItemToInventory(GameItem item)
 {
     Inventory.Add(item);
 }
示例#9
0
 public GroupedInventoryItem(GameItem groupItem, int groupQuantity)
 {
     item     = groupItem;
     quantity = groupQuantity;
 }
示例#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;
 }
示例#11
0
 public void RemoveItem(GameItem item)
 {
     _quickChoiceItems.Remove(item);
     item.IsInQuickChoose = false;
 }
示例#12
0
 List <GameItem> _quickChoiceItems = new List <GameItem>(); //LIFO
 public void InsertItem(GameItem item)
 {
     _quickChoiceItems.Add(item);
     item.IsInQuickChoose = true;
 }