public override bool OnDragDrop(Mobile from, Item item)
        {
            if (item is BasePotion)
            {
                BasePotion pot    = (BasePotion)item;
                int        toHold = Math.Min(100 - m_Held, pot.Amount);

                if (toHold <= 0)
                {
                    from.SendLocalizedMessage(502233);                       // The keg will not hold any more!
                }
                else if (m_Held > 0 && pot.PotionEffect != m_Type)
                {
                    from.SendLocalizedMessage(502236);                       // You decide that it would be a bad idea to mix different types of potions.
                }
                else
                {
                    if (GiveBottle(from, toHold))
                    {
                        if (m_Held == 0)
                        {
                            m_Type = pot.PotionEffect;
                        }

                        Held += toHold;

                        from.PlaySound(0x240);

                        from.SendLocalizedMessage(502237);                           // You place the empty bottle in your backpack.

                        item.Consume(toHold);

                        if (!item.Deleted)
                        {
                            item.Bounce(from);
                        }

                        return(true);
                    }
                    else
                    {
                        from.SendLocalizedMessage(502238);                           // You don't have room for the empty bottle in your backpack.
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(502232);                   // The keg is not designed to hold that type of object.
            }
            return(false);
        }
Example #2
0
        public override bool OnDragDrop(Mobile from, Item item)
        {
            if (item is BasePotion)
            {
                BasePotion pot    = (BasePotion)item;
                int        toHold = Math.Min(100 - m_Held, pot.Amount);

                if (item is BaseExplosionPotion && ((BaseExplosionPotion)item).TimerIsRunning())
                {
                    from.SendMessage("That is about to explode!");
                    return(false);
                }
                if (toHold <= 0)
                {
                    from.SendLocalizedMessage(502233);                       // The keg will not hold any more!
                    return(false);
                }
                else if (m_Held == 0)
                {
                    #region Mondain's Legacy
                    if ((int)pot.PotionEffect >= (int)PotionEffect.Invisibility)
                    {
                        from.SendLocalizedMessage(502232);                           // The keg is not designed to hold that type of object.
                        return(false);
                    }
                    #endregion

                    if (GiveBottle(from, toHold))
                    {
                        m_Type = pot.PotionEffect;
                        Held   = toHold;

                        from.PlaySound(0x240);

                        from.SendLocalizedMessage(502237);                           // You place the empty bottle in your backpack.

                        item.Consume(toHold);

                        if (!item.Deleted)
                        {
                            item.Bounce(from);
                        }

                        return(true);
                    }
                    else
                    {
                        from.SendLocalizedMessage(502238);                           // You don't have room for the empty bottle in your backpack.
                        return(false);
                    }
                }
                else if (pot.PotionEffect != m_Type)
                {
                    from.SendLocalizedMessage(502236);                       // You decide that it would be a bad idea to mix different types of potions.
                    return(false);
                }
                else
                {
                    if (GiveBottle(from, toHold))
                    {
                        Held += toHold;

                        from.PlaySound(0x240);

                        from.SendLocalizedMessage(502237);                           // You place the empty bottle in your backpack.

                        item.Consume(toHold);

                        if (!item.Deleted)
                        {
                            item.Bounce(from);
                        }

                        return(true);
                    }
                    else
                    {
                        from.SendLocalizedMessage(502238);                           // You don't have room for the empty bottle in your backpack.
                        return(false);
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(502232);                   // The keg is not designed to hold that type of object.
                return(false);
            }
        }
        public override bool OnDragDrop(Mobile from, Item item)
        {
            if (item is PolymorphPotion || item is IncognitoPotion || item is RabbitBomb)
            {
                return(false);
            }

            if (item is BasePotion)
            {
                BasePotion pot = (BasePotion)item;

                int toHold = Math.Min(m_MaxHeld - m_Held, pot.Amount);

                if (toHold <= 0)
                {
                    from.SendLocalizedMessage(502233); // The keg will not hold any more!
                    return(false);
                }

                else if (m_Held == 0)
                {
                    if (GiveBottle(from, toHold))
                    {
                        m_Type = pot.PotionEffect;
                        Held   = toHold;

                        from.PlaySound(0x240);

                        from.SendLocalizedMessage(502237); // You place the empty bottle in your backpack.

                        item.Consume(toHold);

                        if (!item.Deleted)
                        {
                            item.Bounce(from);
                        }

                        if (Hue == 0)
                        {
                            //Change the color hue based on the type of the potion
                            switch (item.GetType().BaseType.Name)
                            {
                            case "BaseMagicResistPotion": Hue = 1109; break;

                            case "BaseCurePotion": Hue = 44; break;

                            case "BaseAgilityPotion": Hue = 93; break;

                            case "BaseStrengthPotion": Hue = 956; break;

                            case "BasePoisonPotion": Hue = 363; break;

                            case "BaseRefreshPotion": Hue = 37; break;

                            case "BaseHealPotion": Hue = 253; break;

                            case "BaseExplosionPotion": Hue = 419; break;

                            default: break;
                            }

                            from.SendMessage("The potion keg has absorbed the potion and turned into its color.");
                        }

                        return(true);
                    }

                    else
                    {
                        from.SendLocalizedMessage(502238); // You don't have room for the empty bottle in your backpack.
                        return(false);
                    }
                }

                else if (pot.PotionEffect != m_Type)
                {
                    from.SendLocalizedMessage(502236); // You decide that it would be a bad idea to mix different types of potions.
                    return(false);
                }

                else
                {
                    if (GiveBottle(from, toHold))
                    {
                        Held += toHold;

                        from.PlaySound(0x240);
                        from.SendLocalizedMessage(502237); // You place the empty bottle in your backpack.
                        item.Consume(toHold);

                        if (!item.Deleted)
                        {
                            item.Bounce(from);
                        }

                        return(true);
                    }

                    else
                    {
                        from.SendLocalizedMessage(502238); // You don't have room for the empty bottle in your backpack.
                        return(false);
                    }
                }
            }

            else
            {
                from.SendLocalizedMessage(502232); // The keg is not designed to hold that type of object.
                return(false);
            }
        }