예제 #1
0
 public List <Item> GetItem(Int16 ID)
 {
     try
     {
         ItemDal objdal = new ItemDal();
         return(objdal.Read(ID));
     }
     catch
     {
         throw;
     }
 }
예제 #2
0
        public bool Buy(int itemId, int quantity)
        {
            if (!eqService.HaveEmptySpace(myHero))
            {
                return(false);
            }

            var item = itemDal.Read(itemId);

            if (myHero.Money < item.Price)
            {
                return(false);
            }

            if (myHero.Level < item.RequiredLevel)
            {
                return(false);
            }

            heroService.RemoveMoney(item.Price, myHero);
            heroDal.Update(myHero);
            eqService.AddItem(itemId, myHero, quantity);
            return(true);
        }