Esempio n. 1
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is LiquorBarrel)
                {
                    LiquorBarrel barrel = targeted as LiquorBarrel;

                    if (barrel.IsChildOf(from.Backpack))
                    {
                        if (barrel.IsMature)
                        {
                            from.SendLocalizedMessage(1150811); // This liquor barrel already contains liquor.
                        }
                        else if (!barrel.IsEmpty)
                        {
                            from.SendLocalizedMessage(1150802); // You realize that the liquor is on the process of maturation so you leave it alone.
                        }
                        else
                        {
                            double perc = m_Context.MakeStrong ? 2 : 1;

                            if (HasTotal(from, perc) && barrel != null)
                            {
                                double cooking = from.Skills[SkillName.Cooking].Value;
                                double alchemy = from.Skills[SkillName.Alchemy].Value / 2;
                                int    resist  = 0;

                                for (int i = 0; i < m_Context.SelectedYeast.Length; i++)
                                {
                                    Yeast yeast = m_Context.SelectedYeast[i];

                                    if (yeast != null)
                                    {
                                        resist += yeast.BacterialResistance;
                                    }
                                }

                                int chance = (int)((cooking + alchemy + (resist * 12)) / 2.5);

                                if (chance > Utility.Random(100))
                                {
                                    ConsumeTotal(from, perc);
                                    m_Context.ClearYeasts();
                                    from.SendLocalizedMessage(1150772); // You succeed at your distillation attempt.

                                    Mobile marker = m_Context.Mark ? from : null;
                                    from.PlaySound(0x2D6);

                                    barrel.BeginDistillation(m_Def.Liquor, m_Def.MaturationDuration, m_Context.Label, m_Context.MakeStrong, marker);
                                }
                                else
                                {
                                    from.PlaySound(0x2D6);
                                    ConsumeTotal(from, perc / 2);
                                    from.SendLocalizedMessage(1150745); // You have failed your distillation attempt and ingredients have been lost.
                                }
                            }
                            else
                            {
                                from.SendLocalizedMessage(1150747); // You don't have enough ingredients.
                            }
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1054107); // This item must be in your backpack.
                    }
                }
                else
                {
                    from.SendMessage("That is not a liquor barrel.");
                }

                DistillationSystem.SendDelayedGump(from);
            }