protected override void OnTarget(Mobile from, object targ)
 {
     if (targ is BaseBeverage)
     {
         BaseBeverage bev = (BaseBeverage)targ;
         if (bev.Content == BeverageType.Milk || bev.Quantity < 1)
         {
             bev.Content = BeverageType.Milk;
             if (t_mk.Quantity > bev.Quantity)
             {
                 t_mk.Quantity -= (bev.MaxQuantity - bev.Quantity);
                 bev.Quantity   = bev.MaxQuantity;
             }
             else
             {
                 bev.Quantity += t_mk.Quantity;
                 t_mk.Quantity = 0;
             }
             t_mk.InvalidateProperties();
             t_mk.UpdateName();
             from.PlaySound(0x4E);
         }
         else
         {
             from.SendMessage("You shouldn't mix beverages.");
         }
     }
     else if (targ is MilkingBucket)
     {
         MilkingBucket bev = (MilkingBucket)targ;
         if (bev.Quantity < 10)
         {
             if (bev.MilkType == t_mk.MilkType || bev.Quantity < 1)
             {
                 bev.MilkType = t_mk.MilkType;
                 if (bev.Quantity < 1)
                 {
                     bev.Age = t_mk.Age;
                 }
                 if (bev.Age > t_mk.Age)
                 {
                     bev.Age = t_mk.Age;
                 }
                 if (t_mk.Quantity > (10 - bev.Quantity))
                 {
                     t_mk.Quantity -= (10 - bev.Quantity);
                     bev.Quantity   = 10;
                 }
                 else
                 {
                     bev.Quantity += t_mk.Quantity;
                     t_mk.Quantity = 0;
                 }
                 t_mk.InvalidateProperties();
                 t_mk.UpdateName();
                 bev.InvalidateProperties();
                 bev.UpdateName();
                 from.PlaySound(0x4E);
                 from.SendMessage("You pour the milk into the keg.");
             }
             else
             {
                 bev.MilkType = TypeOfMilk.Mixed;
                 if (bev.Quantity < 1)
                 {
                     bev.Age = t_mk.Age;
                 }
                 if (bev.Age > t_mk.Age)
                 {
                     bev.Age = t_mk.Age;
                 }
                 if (t_mk.Quantity > (100 - bev.Quantity))
                 {
                     t_mk.Quantity -= (100 - bev.Quantity);
                     bev.Quantity   = 100;
                 }
                 else
                 {
                     bev.Quantity += t_mk.Quantity;
                     t_mk.Quantity = 0;
                 }
                 t_mk.InvalidateProperties();
                 t_mk.UpdateName();
                 bev.InvalidateProperties();
                 bev.UpdateName();
                 from.PlaySound(0x4E);
                 from.SendMessage("You pour the milk into the keg.");
             }
         }
         else
         {
             from.SendMessage("That is full!");
         }
     }
     else if (targ is MilkKeg)
     {
         MilkKeg bev = (MilkKeg)targ;
         if (bev.Quantity < 100)
         {
             if (bev.MilkType == t_mk.MilkType || bev.Quantity < 1)
             {
                 bev.MilkType = t_mk.MilkType;
                 if (bev.Quantity < 1)
                 {
                     bev.Age = t_mk.Age;
                 }
                 if (bev.Age > t_mk.Age)
                 {
                     bev.Age = t_mk.Age;
                 }
                 if (t_mk.Quantity > (100 - bev.Quantity))
                 {
                     t_mk.Quantity -= (100 - bev.Quantity);
                     bev.Quantity   = 100;
                 }
                 else
                 {
                     bev.Quantity += t_mk.Quantity;
                     t_mk.Quantity = 0;
                 }
                 t_mk.InvalidateProperties();
                 t_mk.UpdateName();
                 bev.InvalidateProperties();
                 bev.UpdateName();
                 from.PlaySound(0x4E);
                 from.SendMessage("You pour the milk into the keg.");
             }
             else
             {
                 bev.MilkType = TypeOfMilk.Mixed;
                 if (bev.Quantity < 1)
                 {
                     bev.Age = t_mk.Age;
                 }
                 if (bev.Age > t_mk.Age)
                 {
                     bev.Age = t_mk.Age;
                 }
                 if (t_mk.Quantity > (100 - bev.Quantity))
                 {
                     t_mk.Quantity -= (100 - bev.Quantity);
                     bev.Quantity   = 100;
                 }
                 else
                 {
                     bev.Quantity += t_mk.Quantity;
                     t_mk.Quantity = 0;
                 }
                 t_mk.InvalidateProperties();
                 t_mk.UpdateName();
                 bev.InvalidateProperties();
                 bev.UpdateName();
                 from.PlaySound(0x4E);
                 from.SendMessage("You pour the milk into the keg.");
             }
         }
         else
         {
             from.SendMessage("That is full!");
         }
     }
     else if (targ is MeasuringCup)
     {
         if (t_mk.Quantity > 0)
         {
             from.AddToBackpack(new Milk());
             from.PlaySound(0x240);
             from.SendMessage("You measure out one cup of milk.");
             t_mk.Quantity -= 1;
             t_mk.InvalidateProperties();
             t_mk.UpdateName();
         }
         else
         {
             from.SendMessage("The keg is empty!");
         }
     }
     else
     {
         from.SendMessage("You can't do that.");
     }
 }
 protected override void OnTarget(Mobile from, object targ)
 {
     if (targ is MilkKeg)
     {
         if (t_cp.Quantity < 5)
         {
             bool CanUse = from.CheckSkill(SkillName.Cooking, 15, 30);
             if (CanUse)
             {
                 MilkKeg bev = (MilkKeg)targ;
                 if (bev.Quantity > 10)
                 {
                     if (t_cp.Quantity < 1)
                     {
                         t_cp.Age = bev.Age;
                     }
                     if (t_cp.Age > bev.Age)
                     {
                         t_cp.Age = bev.Age;
                     }
                     bev.Quantity  -= 1;
                     t_cp.Quantity += 1;
                     t_cp.InvalidateProperties();
                     t_cp.UpdateName();
                     bev.InvalidateProperties();
                     bev.UpdateName();
                     from.PlaySound(0x4E);
                     from.SendMessage("You skim off some cream.");
                 }
                 else
                 {
                     from.SendMessage("There is no cream in that!");
                 }
             }
             else
             {
                 from.SendMessage("You fail to skim off the cream!");
                 from.PlaySound(0x4E);
             }
         }
         else
         {
             from.SendMessage("The pitcher is full!");
         }
     }
     else if (targ is ButterChurn)
     {
         ButterChurn bev = (ButterChurn)targ;
         if (bev.Quantity < 10)
         {
             if (t_cp.Quantity < 10 - bev.Quantity)
             {
                 bev.Quantity += t_cp.Quantity;
                 t_cp.Quantity = 0;
             }
             else
             {
                 t_cp.Quantity -= (10 - bev.Quantity);
                 bev.Quantity   = 10;
             }
             t_cp.InvalidateProperties();
             t_cp.UpdateName();
             bev.InvalidateProperties();
             bev.UpdateName();
             from.PlaySound(0x4E);
             from.SendMessage("You pour the cream into the churn.");
         }
         else
         {
             from.SendMessage("That is full!");
         }
     }
     else if (targ is MeasuringCup)
     {
         if (t_cp.Quantity > 0)
         {
             from.AddToBackpack(new Cream());
             from.PlaySound(0x240);
             from.SendMessage("You measure out one cup of cream.");
             t_cp.Quantity -= 1;
             t_cp.InvalidateProperties();
             t_cp.UpdateName();
         }
         else
         {
             from.SendMessage("The pitcher is empty!");
         }
     }
     else
     {
         from.SendMessage("You can't do that.");
     }
 }
 public MilkTarget(MilkKeg mk) : base(1, false, TargetFlags.None)
 {
     t_mk = mk;
 }
Beispiel #4
0
 protected override void OnTarget(Mobile from, object targ)
 {
     if (targ is FarmCow)
     {
         FarmCow c = (FarmCow)targ;
         if (c.Owner == from || c.Owner == null)
         {
             bool CanUse = from.CheckSkill(SkillName.AnimalLore, 20, 50);
             if (CanUse)
             {
                 if (c.Milk > 0)
                 {
                     if (t_mb.Quantity < 10)
                     {
                         c.PlaySound(c.GetIdleSound());
                         from.SendMessage("You milk the cow.");
                         if (t_mb.Quantity < 1)
                         {
                             t_mb.Age = DateTime.UtcNow;
                         }
                         int tofill = 10 - t_mb.Quantity;
                         if (c.Milk > tofill)
                         {
                             t_mb.Quantity = 10;
                             c.Milk       -= tofill;
                             if (t_mb.MilkType != TypeOfMilk.Cow && t_mb.MilkType != TypeOfMilk.None)
                             {
                                 t_mb.MilkType = TypeOfMilk.Mixed;
                             }
                             else
                             {
                                 t_mb.MilkType = TypeOfMilk.Cow;
                             }
                         }
                         else
                         {
                             t_mb.Quantity += c.Milk;
                             c.Milk         = 0;
                             if (t_mb.MilkType != TypeOfMilk.Cow && t_mb.MilkType != TypeOfMilk.None)
                             {
                                 t_mb.MilkType = TypeOfMilk.Mixed;
                             }
                             else
                             {
                                 t_mb.MilkType = TypeOfMilk.Cow;
                             }
                         }
                         t_mb.InvalidateProperties();
                         t_mb.UpdateName();
                     }
                     else
                     {
                         from.SendMessage("Your milk bucket is full!");
                     }
                 }
                 else
                 {
                     from.SendMessage("That animal is out of milk.");
                 }
             }
             else
             {
                 c.PlaySound(c.GetIdleSound());
                 from.SendMessage("You fail to milk the cow!");
             }
         }
         else
         {
             from.SendMessage("You don't own that animal.");
         }
     }
     else if (targ is FarmSheep)
     {
         FarmSheep c = (FarmSheep)targ;
         if (c.Owner == from || c.Owner == null)
         {
             bool CanUse = from.CheckSkill(SkillName.AnimalLore, 20, 50);
             if (CanUse)
             {
                 if (c.Milk > 0)
                 {
                     if (t_mb.Quantity < 10)
                     {
                         c.PlaySound(c.GetIdleSound());
                         from.SendMessage("You milk the sheep.");
                         if (t_mb.Quantity < 1)
                         {
                             t_mb.Age = DateTime.UtcNow;
                         }
                         int tofill = 10 - t_mb.Quantity;
                         if (c.Milk > tofill)
                         {
                             t_mb.Quantity = 10;
                             c.Milk       -= tofill;
                             if (t_mb.MilkType != TypeOfMilk.Sheep && t_mb.MilkType != TypeOfMilk.None)
                             {
                                 t_mb.MilkType = TypeOfMilk.Mixed;
                             }
                             else
                             {
                                 t_mb.MilkType = TypeOfMilk.Sheep;
                             }
                         }
                         else
                         {
                             t_mb.Quantity += c.Milk;
                             c.Milk         = 0;
                             if (t_mb.MilkType != TypeOfMilk.Sheep && t_mb.MilkType != TypeOfMilk.None)
                             {
                                 t_mb.MilkType = TypeOfMilk.Mixed;
                             }
                             else
                             {
                                 t_mb.MilkType = TypeOfMilk.Sheep;
                             }
                         }
                         t_mb.InvalidateProperties();
                         t_mb.UpdateName();
                     }
                     else
                     {
                         from.SendMessage("Your milk bucket is full!");
                     }
                 }
                 else
                 {
                     from.SendMessage("That animal is out of milk.");
                 }
             }
             else
             {
                 c.PlaySound(c.GetIdleSound());
                 from.SendMessage("You fail to milk the sheep!");
             }
         }
         else
         {
             from.SendMessage("You don't own that animal.");
         }
     }
     else if (targ is FarmGoat)
     {
         FarmGoat c = (FarmGoat)targ;
         if (c.Owner == from || c.Owner == null)
         {
             bool CanUse = from.CheckSkill(SkillName.AnimalLore, 20, 50);
             if (CanUse)
             {
                 if (c.Milk > 0)
                 {
                     if (t_mb.Quantity < 10)
                     {
                         c.PlaySound(c.GetIdleSound());
                         from.SendMessage("You milk the goat.");
                         if (t_mb.Quantity < 1)
                         {
                             t_mb.Age = DateTime.UtcNow;
                         }
                         int tofill = 10 - t_mb.Quantity;
                         if (c.Milk > tofill)
                         {
                             t_mb.Quantity = 10;
                             c.Milk       -= tofill;
                             if (t_mb.MilkType != TypeOfMilk.Goat && t_mb.MilkType != TypeOfMilk.None)
                             {
                                 t_mb.MilkType = TypeOfMilk.Mixed;
                             }
                             else
                             {
                                 t_mb.MilkType = TypeOfMilk.Goat;
                             }
                         }
                         else
                         {
                             t_mb.Quantity += c.Milk;
                             c.Milk         = 0;
                             if (t_mb.MilkType != TypeOfMilk.Goat && t_mb.MilkType != TypeOfMilk.None)
                             {
                                 t_mb.MilkType = TypeOfMilk.Mixed;
                             }
                             else
                             {
                                 t_mb.MilkType = TypeOfMilk.Goat;
                             }
                         }
                         t_mb.InvalidateProperties();
                         t_mb.UpdateName();
                     }
                     else
                     {
                         from.SendMessage("Your milk bucket is full!");
                     }
                 }
                 else
                 {
                     from.SendMessage("That animal is out of milk.");
                 }
             }
             else
             {
                 c.PlaySound(c.GetIdleSound());
                 from.SendMessage("You fail to milk the goat!");
             }
         }
         else
         {
             from.SendMessage("You don't own that animal.");
         }
     }
     else if (targ is Pitcher)
     {
         Pitcher bev = (Pitcher)targ;
         if (bev.Content == BeverageType.Milk || bev.Quantity < 1)
         {
             bev.Content = BeverageType.Milk;
             if (t_mb.Quantity > (bev.MaxQuantity - bev.Quantity))
             {
                 t_mb.Quantity -= (bev.MaxQuantity - bev.Quantity);
                 bev.Quantity   = bev.MaxQuantity;
             }
             else
             {
                 bev.Quantity += t_mb.Quantity;
                 t_mb.Quantity = 0;
             }
             t_mb.InvalidateProperties();
             t_mb.UpdateName();
             from.PlaySound(0x4E);
         }
         else
         {
             from.SendMessage("You shouldn't mix beverages.");
         }
     }
     else if (targ is MilkKeg)
     {
         MilkKeg bev = (MilkKeg)targ;
         if (bev.Quantity < 100)
         {
             if (bev.MilkType == t_mb.MilkType || bev.Quantity < 1)
             {
                 bev.MilkType = t_mb.MilkType;
                 if (bev.Quantity < 1)
                 {
                     bev.Age = t_mb.Age;
                 }
                 if (bev.Age > t_mb.Age)
                 {
                     bev.Age = t_mb.Age;
                 }
                 if (t_mb.Quantity > (100 - bev.Quantity))
                 {
                     t_mb.Quantity -= (100 - bev.Quantity);
                     bev.Quantity   = 100;
                 }
                 else
                 {
                     bev.Quantity += t_mb.Quantity;
                     t_mb.Quantity = 0;
                 }
                 t_mb.InvalidateProperties();
                 t_mb.UpdateName();
                 bev.InvalidateProperties();
                 bev.UpdateName();
                 from.PlaySound(0x4E);
                 from.SendMessage("You pour the milk into the keg.");
             }
             else
             {
                 bev.MilkType = TypeOfMilk.Mixed;
                 if (bev.Quantity < 1)
                 {
                     bev.Age = t_mb.Age;
                 }
                 if (bev.Age > t_mb.Age)
                 {
                     bev.Age = t_mb.Age;
                 }
                 if (t_mb.Quantity > (100 - bev.Quantity))
                 {
                     t_mb.Quantity -= (100 - bev.Quantity);
                     bev.Quantity   = 100;
                 }
                 else
                 {
                     bev.Quantity += t_mb.Quantity;
                     t_mb.Quantity = 0;
                 }
                 t_mb.InvalidateProperties();
                 t_mb.UpdateName();
                 bev.InvalidateProperties();
                 bev.UpdateName();
                 from.PlaySound(0x4E);
                 from.SendMessage("You pour the milk into the keg.");
             }
         }
         else
         {
             from.SendMessage("That is full!");
         }
     }
     else if (targ is MeasuringCup)
     {
         if (t_mb.Quantity > 0)
         {
             from.AddToBackpack(new Milk());
             from.PlaySound(0x240);
             from.SendMessage("You measure out one cup of milk.");
             t_mb.Quantity -= 1;
             t_mb.InvalidateProperties();
             t_mb.UpdateName();
         }
         else
         {
             from.SendMessage("The bucket is empty!");
         }
     }
     else
     {
         from.SendMessage("You can't do that.");
     }
 }