예제 #1
0
 public Location(int id, string name, string description, bool trap, _items itemrequired = null,
                 Quest questfind = null)
 {
     ID                  = id;
     Name                = name;
     Description         = description;
     Itemrequiredtoenter = itemrequired;
     QuestAvailableHere  = questfind;
     Trap                = trap;
 }
예제 #2
0
 //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//
 private void raiseInventoryChangedEvent(_items item)
 {
     if (item is Weapon)
     {
         OnPropertyChanged("Weapon");
     }
     if (item is Healing)
     {
         OnPropertyChanged("Potion");
     }
 }
        public void Additemtoinventory(_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;
            }
            OnPropertyChanged("inventory");
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
            }
        }
        private void PlayerItems_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 4)
            {
                var itemID = PlayerItems.Rows[e.RowIndex].Cells[0].Value;

                _items itembeingsold = World.ItemByID(Convert.ToInt32(itemID));

                if (itembeingsold.Price == World.UNSELLABLE_ITEM_PRICE)
                {
                    MessageBox.Show("You cannot sell the " + itembeingsold.Name);
                }
                else
                {
                    _currentPlayer.RemoveItemFromInventory(itembeingsold);
                    _currentPlayer.Gold += itembeingsold.Price;
                }
            }
        }
        private void TraderItems_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 3)
            {
                var itemID = TraderItems.Rows[e.RowIndex].Cells[0].Value;

                _items itembeingbought = World.ItemByID(Convert.ToInt32(itemID));

                if (_currentPlayer.Gold >= itembeingbought.Price)
                {
                    _currentPlayer.additemtoinventor(itembeingbought);
                    _currentPlayer.Gold -= itembeingbought.Price;
                }
                else
                {
                    MessageBox.Show("You do not have enough gold to buy the " + itembeingbought.Name);
                }
            }
        }
        public void removeAItemFromInventory(_items itemtoRemove, int quantity = 1)
        {
            Inventory item = Inventory.SingleOrDefault(ii => ii.Details.ID == itemtoRemove.ID);

            if (item == null)
            {
            }
            else
            {
                item.Quantity -= quantity;
                if (item.Quantity < 0)
                {
                    item.Quantity = 0;
                }
                if (item.Quantity == 0)
                {
                    Inventory.Remove(item);
                }
                OnPropertyChanged("Inventory");
            }
        }
예제 #9
0
 public Inventory(_items details, int quantity)
 {
     Details  = details;
     Quantity = quantity;
 }
예제 #10
0
 public LootItem(_items details, int dropPercentage, bool isdefaultitem)
 {
     Details        = details;
     DropPercentage = dropPercentage;
     IsDefaultItem  = isdefaultitem;
 }
 public QuestCompletedItem(_items details, int quantity)
 {
     Details = details;
     Quanity = quantity;
 }