Example #1
0
        public static void ThrowExplosion_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 ExplosionPotion()))
            {
                return;
            }


            LesserExplosionPotion  le_potion = (LesserExplosionPotion)e.Mobile.Backpack.FindItemByType(typeof(LesserExplosionPotion));
            ExplosionPotion        me_potion = (ExplosionPotion)e.Mobile.Backpack.FindItemByType(typeof(ExplosionPotion));
            GreaterExplosionPotion ge_potion = (GreaterExplosionPotion)e.Mobile.Backpack.FindItemByType(typeof(GreaterExplosionPotion));

            int lep = e.Mobile.Backpack.GetAmount(typeof(LesserExplosionPotion));

            if (lep != 0)
            {
                e.Mobile.SendMessage("Lesser explosion potion found");
                le_potion.OnDoubleClick(e.Mobile);
            }
            else
            {
                int mep = e.Mobile.Backpack.GetAmount(typeof(ExplosionPotion));

                if (mep != 0)
                {
                    e.Mobile.SendMessage("Explosion potion found");
                    me_potion.OnDoubleClick(e.Mobile);
                }
                else
                {
                    int gep = e.Mobile.Backpack.GetAmount(typeof(GreaterExplosionPotion));

                    if (gep != 0)
                    {
                        e.Mobile.SendMessage("Greater explosion potion found");
                        ge_potion.OnDoubleClick(e.Mobile);
                    }
                    else
                    {
                        e.Mobile.SendMessage("Explosion potion not found");
                    }
                }
            }
        }