コード例 #1
0
        public static void DrinkHeal_OnCommand(CommandEventArgs e)
        {
            GreaterHealPotion m_GreaterHealPotion = (GreaterHealPotion)e.Mobile.Backpack.FindItemByType(typeof(GreaterHealPotion));
            HealPotion        m_HealPotion        = (HealPotion)e.Mobile.Backpack.FindItemByType(typeof(HealPotion));
            LesserHealPotion  m_LesserHealPotion  = (LesserHealPotion)e.Mobile.Backpack.FindItemByType(typeof(LesserHealPotion));
            int m_Exists   = e.Mobile.Backpack.GetAmount(typeof(GreaterHealPotion));
            int m_Existss  = e.Mobile.Backpack.GetAmount(typeof(HealPotion));
            int m_Existsss = e.Mobile.Backpack.GetAmount(typeof(LesserHealPotion));

            if (m_Exists != 0)
            {
                e.Mobile.SendMessage("Heal Potion found");

                m_GreaterHealPotion.OnDoubleClick(e.Mobile);
            }
            else if (m_Existss != 0)
            {
                e.Mobile.SendMessage("Heal Potion found");

                m_HealPotion.OnDoubleClick(e.Mobile);
            }
            else if (m_Existsss != 0)
            {
                e.Mobile.SendMessage("Heal Potion found");

                m_LesserHealPotion.OnDoubleClick(e.Mobile);
            }
            else
            {
                e.Mobile.SendMessage("Cannot find Heal Potion");
            }
        }
コード例 #2
0
        public static void DrinkHeal_OnCommand(CommandEventArgs e)
        {
            // Added to fix the missing check to region. Ugly fix but this script is so ugly anyways. :p
            if (e.Mobile.Region != null && !e.Mobile.Region.OnDoubleClick(e.Mobile, new HealPotion()))
            {
                return;
            }

            LesserHealPotion  lh_potion = (LesserHealPotion)e.Mobile.Backpack.FindItemByType(typeof(LesserHealPotion));
            HealPotion        mh_potion = (HealPotion)e.Mobile.Backpack.FindItemByType(typeof(HealPotion));
            GreaterHealPotion gh_potion = (GreaterHealPotion)e.Mobile.Backpack.FindItemByType(typeof(GreaterHealPotion));

            int lhp = e.Mobile.Backpack.GetAmount(typeof(LesserHealPotion));

            if (lhp != 0)
            {
                e.Mobile.SendMessage("Lesser heal potion found");
                lh_potion.OnDoubleClick(e.Mobile);
                Targeting.Target.Cancel(e.Mobile);
            }
            else
            {
                int mhp = e.Mobile.Backpack.GetAmount(typeof(HealPotion));

                if (mhp != 0)
                {
                    e.Mobile.SendMessage("Heal potion found");
                    mh_potion.OnDoubleClick(e.Mobile);
                    Targeting.Target.Cancel(e.Mobile);
                }
                else
                {
                    int ghp = e.Mobile.Backpack.GetAmount(typeof(GreaterHealPotion));

                    if (ghp != 0)
                    {
                        e.Mobile.SendMessage("Greater heal potion found");
                        gh_potion.OnDoubleClick(e.Mobile);
                        Targeting.Target.Cancel(e.Mobile);
                    }
                    else
                    {
                        e.Mobile.SendMessage("Healing potion not found");
                    }
                }
            }
        }