context: using System;
  using System.Collections.Generic;
  using Server.Engines.Craft;
  
  namespace Server.Items
  {
      public enum PotionEffect
      {
          Nightsight,
          CureLesser,
          Cure,
          CureGreater,
          Agility,
          AgilityGreater,
          Strength,
          StrengthGreater,
          PoisonLesser,
          Poison,
          PoisonGreater,
          PoisonDeadly,
          Refresh,
          RefreshTotal,
          HealLesser,
          Heal,
          HealGreater,
          ExplosionLesser,
          Explosion,
          ExplosionGreater,
          Conflagration,
          ConflagrationGreater,
          MaskOfDeath,		// Mask of Death is not available in OSI but does exist in cliloc files
          MaskOfDeathGreater,	// included in enumeration for compatability if later enabled by OSI
          ConfusionBlast,
          ConfusionBlastGreater,
          Invisibility,
          Parasitic,
          Darkglow,
  		ExplodingTarPotion,
          #region TOL Publish 93
          Barrab,
          Jukari,
          Kurak,
          Barako,
          Urali,
          Sakkhra,
          #endregion,
          Shatter,
          FearEssence
      }
  
      public abstract class BasePotion : Item, ICraftable, ICommodity
      {
          private PotionEffect m_PotionEffect;
  
          public PotionEffect PotionEffect
          {
              get
              {
                  return this.m_PotionEffect;
              }
              set
              {
                  this.m_PotionEffect = value;
                  this.InvalidateProperties();
              }
          }
  
          TextDefinition ICommodity.Description
          {
              get
              {
                  return this.LabelNumber;
              }
          }
          bool ICommodity.IsDeedable
          {
              get
              {
                  return (Core.ML);
              }
          }
  
          public override int LabelNumber
          {
              get
              {
                  return 1041314 + (int)this.m_PotionEffect;
              }
          }
  
          public BasePotion(int itemID, PotionEffect effect)
              : base(itemID)
          {
              this.m_PotionEffect = effect;
  
              this.Stackable = Core.ML;
              this.Weight = 1.0;
          }
  
          public BasePotion(Serial serial)
              : base(serial)
          {
          }
  
          public virtual bool RequireFreeHand
          {
              get
              {
                  return true;
              }
          }
  
          public static bool HasFreeHand(Mobile m)
          {
              Item handOne = m.FindItemOnLayer(Layer.OneHanded);
              Item handTwo = m.FindItemOnLayer(Layer.TwoHanded);
  
              if (handTwo is BaseWeapon)
                  handOne = handTwo;
              if (handTwo is BaseWeapon)
              {
                  BaseWeapon wep = (BaseWeapon)handTwo;
  				
                  if (wep.Attributes.BalancedWeapon > 0)
                      return true;
              }
  
              return (handOne == null || handTwo == null);
          }
  
          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 Serialize(GenericWriter writer)
          {
              base.Serialize(writer);
  
              writer.Write((int)1); // version
  
              writer.Write((int)this.m_PotionEffect);
          }
  
          public override void Deserialize(GenericReader reader)
          {
              base.Deserialize(reader);
  
              int version = reader.ReadInt();
  
              switch ( version )
              {
                  case 1:
                  case 0:
                      {
                          this.m_PotionEffect = (PotionEffect)reader.ReadInt();
                          break;
                      }
              }
  
              if (version == 0)
                  this.Stackable = Core.ML;
          }
  
          public abstract void Drink(Mobile from);
  
          public static void PlayDrinkEffect(Mobile m)
          {
              m.RevealingAction();
              m.PlaySound(0x2D6);
              m.AddToBackpack(new Bottle());
  
  
gt:             if (m.Body.IsHuman && !m.Mounted)