Exemple #1
0
            protected override void OnTick()
            {
                if (m_Drunk.Deleted || m_Drunk.Map == Map.Internal)
                {
                    Stop();
                    m_Table.Remove(m_Drunk);
                }

                else if (m_Drunk.Alive)
                {
                    if (m_Drunk.BAC > 60)
                    {
                        m_Drunk.BAC = 60;
                    }

                    // chance to get sober
                    if (10 > Utility.Random(100))
                    {
                        --m_Drunk.BAC;
                    }

                    // lose some stats
                    m_Drunk.Stam -= 1;
                    m_Drunk.Mana -= 1;

                    int minActions = 1;
                    int maxActions = 2;

                    //Player Enhancement Customization: Drunkard
                    bool drunkard = PlayerEnhancementPersistance.IsCustomizationEntryActive(m_Drunk, CustomizationType.Drunkard);

                    if (drunkard)
                    {
                        maxActions += 4;
                    }

                    switch (Utility.RandomMinMax(minActions, maxActions))
                    {
                    case 1:
                        if (drunkard)
                        {
                            if (m_Drunk.Female)
                            {
                                m_Drunk.PlaySound(0x31E);
                            }
                            else
                            {
                                m_Drunk.PlaySound(0x42E);
                            }
                        }

                        if (!m_Drunk.Mounted)
                        {
                            m_Drunk.Direction = (Direction)Utility.Random(8);
                        }

                        m_Drunk.PublicOverheadMessage(MessageType.Regular, 0, false, "*hic*");
                        break;

                    case 2:
                        if (drunkard)
                        {
                            if (m_Drunk.Female)
                            {
                                m_Drunk.PlaySound(0x31E);
                            }
                            else
                            {
                                m_Drunk.PlaySound(0x42E);
                            }
                        }

                        m_Drunk.Animate(32, 5, 1, true, false, 0);     //Stumble
                        m_Drunk.PublicOverheadMessage(MessageType.Regular, 0, false, "*hic*");
                        break;

                    case 3:
                        if (m_Drunk.Female)
                        {
                            m_Drunk.PlaySound(0x31E);
                        }
                        else
                        {
                            m_Drunk.PlaySound(0x42E);
                        }

                        m_Drunk.Animate(21, 5, 1, true, false, 0);     //Fall Backward
                        m_Drunk.PublicOverheadMessage(MessageType.Regular, 0, false, "*hic*");
                        break;

                    case 4:
                        if (m_Drunk.Female)
                        {
                            m_Drunk.PlaySound(0x31E);
                        }
                        else
                        {
                            m_Drunk.PlaySound(0x42E);
                        }

                        m_Drunk.Animate(22, 6, 1, true, false, 0);     //Fall Forward
                        m_Drunk.PublicOverheadMessage(MessageType.Regular, 0, false, "*hic*");
                        break;

                    case 5:
                        CustomizationAbilities.DrunkardThrowBottle(m_Drunk);
                        break;

                    case 6:
                        CustomizationAbilities.DrunkardVomit(m_Drunk);
                        break;
                    }

                    if (m_Drunk.BAC <= 0)
                    {
                        Stop();
                        m_Table.Remove(m_Drunk);

                        m_Drunk.SendLocalizedMessage(500850);                           // You feel sober.
                    }
                }
            }
Exemple #2
0
        public virtual void OnDrink(Mobile from)
        {
            //Player Enhancement Customization: Mouthy
            bool mouthy = PlayerEnhancementPersistance.IsCustomizationEntryActive(from, CustomizationType.Mouthy);

            if (from.Body.IsHuman && !from.Mounted)
            {
                from.Animate(34, 5, 1, true, false, 0);
            }

            Point3D location = from.Location;
            Map     map      = from.Map;

            if (mouthy)
            {
                //Chomp
                from.PlaySound(Utility.RandomList(0x5AD));
                from.PublicOverheadMessage(MessageType.Regular, 0, false, "*opens a drink*");

                for (int a = 1; a < 3; a++)
                {
                    Timer.DelayCall(TimeSpan.FromSeconds(a * 1), delegate
                    {
                        if (from == null)
                        {
                            return;
                        }
                        if (!from.Alive)
                        {
                            return;
                        }

                        if (from.Body.IsHuman && !from.Mounted)
                        {
                            from.Animate(34, 5, 1, true, false, 0);
                        }

                        //Gargle
                        if (Utility.RandomDouble() <= .02)
                        {
                            from.PlaySound(Utility.RandomList(0x021));
                            from.PublicOverheadMessage(MessageType.Regular, 0, false, "*gargles*");
                        }

                        //Chug
                        else if (Utility.RandomDouble() <= .75)
                        {
                            from.PlaySound(Utility.RandomList(0x4CC, 0x4CD, 0x030, 0x031));
                            from.PublicOverheadMessage(MessageType.Regular, 0, false, "*drinks*");
                        }

                        //Spill
                        else
                        {
                            from.PlaySound(Utility.RandomList(0x5A4, 0x4D1, 0x2D7, 0x23F, 0x022));

                            TimedStatic splashedWater = new TimedStatic(2482, 5);

                            splashedWater.ItemID = Utility.RandomList(4651, 4652, 4653, 4654);
                            splashedWater.Hue    = 2592;

                            Point3D splashLocation = new Point3D(location.X + Utility.RandomList(-1, 1), location.Y + Utility.RandomList(-1, 1), location.Z);
                            SpellHelper.AdjustField(ref splashLocation, map, 12, false);

                            splashedWater.MoveToWorld(splashLocation, map);

                            from.PublicOverheadMessage(MessageType.Regular, 0, false, "*spills*");
                        }
                    });
                }
            }
        }
Exemple #3
0
        public virtual bool Eat(Mobile from)
        {
            if (AttemptEat(from))
            {
                //Player Enhancement Customization: Mouthy
                bool mouthy = PlayerEnhancementPersistance.IsCustomizationEntryActive(from, CustomizationType.Mouthy);

                if (from.Body.IsHuman && !from.Mounted)
                {
                    from.Animate(34, 5, 1, true, false, 0);
                }

                Point3D location = from.Location;
                Map     map      = from.Map;

                if (mouthy)
                {
                    //Chomp
                    from.PlaySound(Utility.RandomList(0x5DA));
                    from.PublicOverheadMessage(MessageType.Regular, 0, false, "*chomps*");

                    for (int a = 1; a < 3; a++)
                    {
                        Timer.DelayCall(TimeSpan.FromSeconds(a * 1), delegate
                        {
                            if (from == null)
                            {
                                return;
                            }
                            if (!from.Alive)
                            {
                                return;
                            }

                            if (from.Body.IsHuman && !from.Mounted)
                            {
                                from.Animate(34, 5, 1, true, false, 0);
                            }

                            //Chew
                            if (Utility.RandomDouble() <= .75)
                            {
                                from.PlaySound(Utility.RandomList(0x5A9, 0x5AB, 0x03A, 0x03B, 0x03C));
                                from.PublicOverheadMessage(MessageType.Regular, 0, false, "*chews noisily*");
                            }

                            //Spill
                            else
                            {
                                from.PlaySound(Utility.RandomList(0x5D8, 0x5D9, 0x5DB, 0x5A2, 0x580, 0x581));

                                TimedStatic droppedFood = new TimedStatic(2482, 5);

                                switch (Utility.RandomMinMax(1, 3))
                                {
                                case 1:
                                    droppedFood.Name   = "food mush";
                                    droppedFood.ItemID = 2484;
                                    droppedFood.Hue    = 2313;
                                    break;

                                case 2:
                                    droppedFood.Name   = "food mush";
                                    droppedFood.ItemID = 2485;
                                    droppedFood.Hue    = 2313;
                                    break;

                                case 3:
                                    droppedFood.Name   = "food mush";
                                    droppedFood.ItemID = 2486;
                                    droppedFood.Hue    = 2313;
                                    break;
                                }

                                from.PublicOverheadMessage(MessageType.Regular, 0, false, "*spills*");

                                Point3D foodLocation = new Point3D(location.X + Utility.RandomList(-1, 1), location.Y + Utility.RandomList(-1, 1), location.Z);
                                SpellHelper.AdjustField(ref foodLocation, map, 12, false);

                                droppedFood.MoveToWorld(foodLocation, map);
                            }
                        });
                    }
                }

                else
                {
                    from.PlaySound(Utility.Random(0x3A, 3));
                }

                if (m_Poison != null)
                {
                    from.ApplyPoison(m_Poisoner, m_Poison);
                }

                if (Stackable)
                {
                    Consume();
                }

                else if (m_Charges > 1)
                {
                    m_Charges--;
                }

                else
                {
                    Delete();
                }

                return(true);
            }

            return(false);
        }