private void OnTargetBottle(Mobile from, object target) { if (target is Bottle) { Bottle bottle = (Bottle)target; object parent = bottle.RootParent; if (parent == from || (parent == null && from.InRange(bottle.GetWorldLocation(), 3))) { Item potion; try { ConstructorInfo ctor = m_Contains.GetConstructor(Type.EmptyTypes); potion = ctor.Invoke(null) as Item; } catch { potion = null; } m_Contains = null; if (potion != null) { from.PublicOverheadMessage(MessageType.Emote, 0x25, true, String.Format("*{0} pours the completed potion into a bottle.*", from.Name)); from.PlaySound(0x240); from.AddToBackpack(potion); bottle.Consume(); } else { from.SendAsciiMessage("Maybe there was nothing in the mortar after all...."); } } else { from.SendAsciiMessage("The bottle must be in your backpack to use."); } } else { from.SendAsciiMessage("That is not an empty bottle."); } }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is Bottle) { Bottle bottle = targeted as Bottle; Container pack = from.Backpack; from.SendLocalizedMessage(502242); // You pour some of the keg's contents into an empty bottle... BasePotion pot = m_Keg.FillBottle(); if (pack.TryDropItem(from, pot, false)) { from.SendLocalizedMessage(502243); // ...and place it into your backpack. from.PlaySound(0x240); if (--m_Keg.Held == 0) { from.SendLocalizedMessage(502245); // The keg is now empty. } else { m_Keg.Unknown = false; } bottle.Consume(); } else { from.SendLocalizedMessage(502244); // ...but there is no room for the bottle in your backpack. from.SendLocalizedMessage(502217); // Nothing comes out of the tap! pot.Delete(); } } else { from.SendLocalizedMessage(502227); // That cannot be used to hold a potion. } }