Example #1
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001);                   // That must be in your pack for you to use it.
                return;
            }

            Item oneHanded = from.FindItemOnLayer(Layer.OneHanded);
            Item twoHanded = from.FindItemOnLayer(Layer.TwoHanded);

            if ((oneHanded != null && !oneHanded.AllowEquipedCast(from)) || (twoHanded != null && !twoHanded.AllowEquipedCast(from)))
            {
                //m_Caster.SendLocalizedMessage( 502626 ); // Your hands must be free to cast spells or meditate
                from.SendAsciiMessage("Your hands must be free to cast spells.");
                return;
            }

            Spell spell = SpellRegistry.NewSpell(m_SpellID, from, this);

            if (spell != null)
            {
                spell.Cast();
            }
            else
            {
                from.SendLocalizedMessage(502345);                   // This spell has been temporarily disabled.
            }
        }