Ejemplo n.º 1
0
        /// <summary>
        /// Execute a sale
        /// </summary>
        /// <param name="item">the item in question</param>
        /// <param name="price">the sale price</param>
        /// <returns>error or blank</returns>
        public string Instruct(IMobile customer, string qualityName, int level, int price)
        {
            string returnString = string.Empty;

            if (customer == null)
            {
                return("Invalid customer");
            }

            IQuality quality = TeachableProficencies.FirstOrDefault(qual => qual.Name.Equals(qualityName, StringComparison.InvariantCultureIgnoreCase) && qual.Value > level);

            if (quality == null)
            {
                return("I can't teach that proficency to you.");
            }

            int customerWallet = customer.GetQuality("Bells");

            if (customerWallet < price)
            {
                return("Insufficient Funds.");
            }

            customer.SetQuality(-1 * price, "Bells", true);
            customer.SetQuality(1, quality.Name, true);

            return(returnString);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Execute a sale
        /// </summary>
        /// <param name="item">the item in question</param>
        /// <param name="price">the sale price</param>
        /// <returns>error or blank</returns>
        public string MakeSale(IMobile customer, IInanimate item, int price)
        {
            string returnString = string.Empty;

            if (customer == null)
            {
                return("Invalid customer");
            }

            if (item == null || !Inventory.Contains(item))
            {
                return("I don't have that item in stock.");
            }

            int customerWallet = customer.GetQuality("Bells");

            if (customerWallet < price)
            {
                return("Insufficient Funds.");
            }

            customer.SetQuality(-1 * price, "Bells", true);
            item.TryMoveTo(customer.GetContainerAsLocation());

            return(returnString);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Execute a sale
        /// </summary>
        /// <param name="item">the item in question</param>
        /// <param name="price">the sale price</param>
        /// <returns>error or blank</returns>
        public string Instruct(IMobile customer, string useName, int price)
        {
            string returnString = string.Empty;

            if (customer == null)
            {
                return("Invalid customer");
            }

            int customerWallet = customer.GetQuality("Bells");

            if (customerWallet < price)
            {
                return("Insufficient Funds.");
            }

            customer.SetQuality(-1 * price, "Bells", true);
            customer.Save();

            return(returnString);
        }