Esempio n. 1
0
        public static void BlowPouch_OnCommand(CommandEventArgs e)
        {
            bool   nopouch = true;
            Mobile from    = e.Mobile;

            if (from.Backpack != null)
            {
                List <Pouch> pouches = from.Backpack.FindItemsByType <Pouch>();

                for (int i = 0; nopouch && i < pouches.Count; ++i)
                {
                    Pouch pouch = pouches[i];

                    if (pouch.TrapType == TrapType.MagicTrap)
                    {
                        DoubleClickCommand.CommandUseReq(from, pouch);
                        nopouch = false;
                    }
                }
                List <TPouch> pouches2 = from.Backpack.FindItemsByType <TPouch>();

                for (int i = 0; nopouch && i < pouches2.Count; ++i)
                {
                    TPouch pouch2 = pouches2[i];

                    if (pouch2.TrapType == TrapType.MagicTrap)
                    {
                        DoubleClickCommand.CommandUseReq(from, pouch2);
                        nopouch = false;
                    }
                }

                List <ChargeableTrapPouch> pouches3 = from.Backpack.FindItemsByType <ChargeableTrapPouch>();

                for (int i = 0; nopouch && i < pouches3.Count; ++i)
                {
                    ChargeableTrapPouch pouch3 = pouches3[i];

                    if (pouch3.TrapType == TrapType.MagicTrap)
                    {
                        DoubleClickCommand.CommandUseReq(from, pouch3);
                        nopouch = false;
                    }
                }

                if (nopouch)
                {
                    from.SendMessage("You do not have any magically trapped pouches.");
                }
            }
        }
Esempio n. 2
0
        public static void Drink_OnCommand(CommandEventArgs e)
        {
            Mobile from = e.Mobile;

            Type type = ScriptCompiler.FindTypeByName(e.GetString(0).Trim().ToLower(), true);

            if (type != null && typeof(BasePotion).IsAssignableFrom(type))
            {
                BasePotion potion = from.Backpack.FindItemByType(type, true) as BasePotion;

                if (potion != null)
                {
                    DoubleClickCommand.CommandUseReq(from, potion);
                }
                else
                {
                    from.SendMessage("You do not have any of those potions.");
                }
            }
            else
            {
                from.SendMessage("That is not a type of potion.");
            }
        }
Esempio n. 3
0
        public static void DoubleClick_OnCommand(CommandEventArgs e)
        {
            Mobile from = e.Mobile;

            Type type = ScriptCompiler.FindTypeByName(e.GetString(0).Trim().ToLower(), true);

            if (type != null && typeof(Item).IsAssignableFrom(type))
            {
                if (from.AccessLevel >= AccessLevel.GameMaster || DateTime.UtcNow >= from.NextActionTime)
                {
                    Item item = from.Backpack.FindItemByType(type, true);

                    DoubleClickCommand.CommandUseReq(from, item);
                }
                else
                {
                    from.SendActionMessage();
                }
            }
            else
            {
                from.SendMessage("That item type does not exist.");
            }
        }