Exemplo n.º 1
0
        public Ingradient TakeIngradient(Ingradient what, ref double userMoney)
        {
            CheckOrder();
            IngradientOnCargo find = ingradients.Find(i => i.Name == what.Name);

            if (find == null || find.MassGr < what.MassGr)
            {
                return(null);

                throw new Exception("No more ings");
            }

            var res = new Ingradient(find)
            {
                MassGr = what.MassGr
            };

            find.MassGr        -= what.MassGr;
            res.Quality.current = (int)(res.Quality.current * this.QualityMod) - (DateTime.Now - find.PlacedOn).Seconds / 5;

            double deliverPriceBuy = find.PriceSell * what.MassGr / 1000;

            if (userMoney != 0)
            {
                userMoney   -= deliverPriceBuy * SellMod;
                EarnedMoney += deliverPriceBuy * SellMod;
            }

            if (find.MassGr == 0)
            {
                ingradients.Remove(find);
            }
            return(res);
        }
Exemplo n.º 2
0
        IngradientWithPrice CreateIngradienteWithPrice(Ingradient ingradiente)
        {
            //if (ingradiente.Equals(IngradientLoader.Tomato()))
            return(new IngradientWithPrice(ingradiente, 100, 100 * CostMod));

            return(null);
        }
Exemplo n.º 3
0
 static void SerializeIngradiente(string name, string desc, DELIVERY_TYPE delType)
 {
     using (fout = new FileStream(ingradientsFolder + name + ".ing", FileMode.OpenOrCreate)) {
         ing = new Ingradient(delType, name, desc, 0, 10000);
         fs.Serialize(fout, ing);
     }
 }
Exemplo n.º 4
0
 public bool CanOrder(Ingradient ingradiente)
 {
     if (this.DeliveryType == DELIVERY_TYPE.All)
     {
         return(true);
     }
     return(ingradiente.DeliveredBy == this.DeliveryType);
 }
Exemplo n.º 5
0
 public void OrderIngradient(Ingradient what, bool Immediate = false)
 {
     if (what != null && delivery.CanOrder(what))
     {
         delivery.AddToOrder(what);
     }
     if (Immediate || GetOrderPrice() >= 1500)
     {
         isOrdered = true;
         CheckOrder();
         isOrdered = false;
     }
 }
Exemplo n.º 6
0
        public int CanTakeIngradient(Ingradient what)
        {
            CheckOrder();
            Ingradient find = ingradients.Find(i => i.Name == what.Name);

            if (find == null)
            {
                return(-1);
            }
            if (find.MassGr < what.MassGr)
            {
                return(-1);
            }
            return(0);
        }
Exemplo n.º 7
0
 public bool IsInOrder(Ingradient what)
 {
     foreach (var i in toOrder)
     {
         if (i.Name == what.Name)
         {
             return(true);
         }
     }
     foreach (var i in toDeliver)
     {
         if (i.Name == what.Name)
         {
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 8
0
 public bool IsOrderedd(Ingradient what)
 {
     return((delivery as DeliveryBasic).IsInOrder(what));
 }
Exemplo n.º 9
0
        public uint GetIngMass(Ingradient what)
        {
            IngradientOnCargo find = ingradients.Find(i => i.Name == what.Name);

            return(find?.MassGr ?? 0);
        }
Exemplo n.º 10
0
 public void AddToOrder(Ingradient ingradiente)
 {
     toOrder.Add(CreateIngradienteWithPrice(ingradiente));
 }
Exemplo n.º 11
0
 public IngradientWithPrice(Ingradient basic, double _PriceBuy, double _PriceSell) : base(basic)
 {
     PriceBuy  = _PriceBuy;
     PriceSell = _PriceSell;
 }
Exemplo n.º 12
0
 public Ingradient(Ingradient rhs) : this(rhs.DeliveredBy, rhs.Name, rhs.Description, rhs.MassGr, 0)
 {
     Quality = new Stat(rhs.Quality);
 }