public override void OnDoubleClick(Mobile from) { if (!this.Movable) { return; } if (!from.BeginAction(this.GetType())) { from.SendLocalizedMessage(500119); // You must wait to perform another action. return; } Timer.DelayCall(TimeSpan.FromMilliseconds(500), () => from.EndAction(this.GetType())); if (from.InRange(this.GetWorldLocation(), 1)) { if (!this.RequireFreeHand || HasFreeHand(from)) { if (this is BaseExplosionPotion && this.Amount > 1) { BasePotion pot = (BasePotion)Activator.CreateInstance(this.GetType()); if (pot != null) { this.Amount--; if (from.Backpack != null && !from.Backpack.Deleted) { from.Backpack.DropItem(pot); } else { pot.MoveToWorld(from.Location, from.Map); } pot.Drink(from); } } else { this.Drink(from); } } else { from.SendLocalizedMessage(502172); // You must have a free hand to drink a potion. } } else { from.SendLocalizedMessage(502138); // That is too far away for you to use } }
public override void OnDoubleClick(Mobile from) { if (!Movable) { return; } if (from.Player && ((PlayerMobile)from).Undead && !(this is BaseConflagrationPotion || this is BaseExplosionPotion)) { from.SendMessage("You do not have a functioning digestive system."); return; } if (from.InRange(this.GetWorldLocation(), 1)) { if (!RequireFreeHand || HasFreeHand(from)) { if (this is BaseExplosionPotion && Amount > 1) { BasePotion pot = (BasePotion)Activator.CreateInstance(this.GetType()); if (pot != null) { Amount--; if (from.Backpack != null && !from.Backpack.Deleted) { from.Backpack.DropItem(pot); } else { pot.MoveToWorld(from.Location, from.Map); } pot.Drink(from); } } else { this.Drink(from); } } else { from.SendLocalizedMessage(502172); // You must have a free hand to drink a potion. } } else { from.SendLocalizedMessage(502138); // That is too far away for you to use } }
public override void OnDoubleClick(Mobile from) { if (!Movable) { return; } if (from.InRange(this.GetWorldLocation(), 1)) { if (!RequireFreeHand || HasFreeHand(from)) { if (this is BaseExplosionPotion && Amount > 1) { BasePotion pot = (BasePotion)Activator.CreateInstance(this.GetType()); if (pot != null) { Amount--; if (from.Backpack != null && !from.Backpack.Deleted) { from.Backpack.DropItem(pot); BaseContainer.DropItemFix(pot, from, from.Backpack.ItemID, from.Backpack.GumpID); } else { pot.MoveToWorld(from.Location, from.Map); } pot.Drink(from); } } else { this.Drink(from); } } else { from.SendLocalizedMessage(502172); // You must have a free hand to drink a potion. } } else { from.SendLocalizedMessage(502138); // That is too far away for you to use } }
public bool PourBottle(Mobile from, Item item) { if (item is Bottle) { Container pack = from.Backpack; if (pack != null) { item.Consume(); //Consume a bottle from.SendLocalizedMessage(502242); // You pour some of the keg's contents into an empty bottle... BasePotion pot = FillBottle(); if (pack.TryDropItem(from, pot, false)) { from.SendLocalizedMessage(502243); // ...and place it into your backpack. from.PlaySound(0x240); if (--Held == 0) { from.SendLocalizedMessage(502245); // The keg is now empty. } } else { from.SendLocalizedMessage(502244); // ...but there is no room for the bottle in your backpack. //pot.Delete(); pot.MoveToWorld(pack.GetWorldLocation(), pack.Map); } return(true); } } else if (item is PotionKeg) { PotionKeg keg = item as PotionKeg; if (keg.Held >= 100) { from.SendLocalizedMessage(502233); // The keg will not hold any more! } else if (m_Type != keg.Type) { from.SendLocalizedMessage(502236); // You decide that it would be a bad idea to mix different types of potions. } else { int toHold = Math.Min(100 - keg.Held, m_Held); keg.Held += toHold; if ((m_Held -= toHold) == 0) { from.SendLocalizedMessage(502245); // The keg is now empty. } from.PlaySound(0x240); return(true); } } return(false); }