Beispiel #1
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (!(targeted is DryReeds) || !((DryReeds)targeted).IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1046439);                       // That is not a valid target.
                    from.SendLocalizedMessage(1074794);                       // Target the material to use:

                    from.Target = new ReedsTarget(m_CraftSystem, m_TypeRes, m_Tool, m_CraftItem);
                }
                else
                {
                    from.EndAction(typeof(CraftSystem));

                    DryReeds reeds = targeted as DryReeds;

                    if (!reeds.IsChildOf(from.Backpack))
                    {
                        // You do not have enough scouring toxins to make that!
                        from.SendGump(new CraftGump(from, m_CraftSystem, m_Tool, 1112326));
                    }
                    if (from.Backpack == null || from.Backpack.GetAmount(typeof(ScouringToxin)) < 1)
                    {
                        // You do not have enough scouring toxins to make that!
                        from.SendGump(new CraftGump(from, m_CraftSystem, m_Tool, 1112326));
                    }
                    else if (DryReeds.GetTotalReeds(from.Backpack, reeds.PlantHue) < 2)
                    {
                        // You don't have enough of this type of dry reeds to make that.
                        from.SendGump(new CraftGump(from, m_CraftSystem, m_Tool, 1112250));
                    }
                    else
                    {
                        bool allRequiredSkills = true;

                        double chance = m_CraftItem.GetSuccessChance(from, m_TypeRes, m_CraftSystem, true, ref allRequiredSkills);

                        if (chance > 0.0)
                        {
                            chance += m_CraftItem.GetTalismanBonus(from, m_CraftSystem);
                        }

                        if (allRequiredSkills)
                        {
                            if (chance < Utility.RandomDouble())
                            {
                                DryReeds.ConsumeReeds(from.Backpack, reeds.PlantHue, 1);

                                from.SendGump(new CraftGump(from, m_CraftSystem, m_Tool, 1044043));                                     // You failed to create the item, and some of your materials are lost.
                            }
                            else
                            {
                                from.Backpack.ConsumeTotal(typeof(ScouringToxin), 1);
                                DryReeds.ConsumeReeds(from.Backpack, reeds.PlantHue, 2);

                                from.AddToBackpack(new SoftenedReeds(reeds.PlantHue));

                                bool toolBroken = false;

                                m_Tool.UsesRemaining--;

                                if (m_Tool.UsesRemaining < 1)
                                {
                                    toolBroken = true;
                                }

                                if (toolBroken)
                                {
                                    m_Tool.Delete();

                                    from.SendLocalizedMessage(1044038);                                       // You have worn out your tool!
                                    from.SendLocalizedMessage(1044154);                                       // You create the item.
                                }

                                if (!toolBroken)
                                {
                                    // You create the item.
                                    from.SendGump(new CraftGump(from, m_CraftSystem, m_Tool, 1044154));
                                }
                            }
                        }
                        else
                        {
                            // You don't have the required skills to attempt this item.
                            from.SendGump(new CraftGump(from, m_CraftSystem, m_Tool, 1044153));
                        }
                    }
                }
            }
Beispiel #2
0
        protected void Target(Mobile from, object targeted)
        {
            if (from.Backpack == null)
            {
                return;
            }

            if (!IsChildOf(from.Backpack))
            {
                // This must be in your backpack to use it.
                from.SendLocalizedMessage(1080063);
            }
            else if (targeted is Item)
            {
                Item item = targeted as Item;

                if (item.Parent is Mobile)
                {
                    // You cannot scour items that are being worn!
                    from.SendLocalizedMessage(1112350);
                }
                else if (!item.IsChildOf(from.Backpack))
                {
                    // That must be in your pack for you to use it.
                    from.SendLocalizedMessage(1042001);
                }
                else if (!item.Movable)
                {
                    // You may not scour items which are locked down.
                    from.SendLocalizedMessage(1112351);
                }
                else if (item is DryReeds)
                {
                    if (!(from is PlayerMobile) || !((PlayerMobile)from).BasketWeaving)
                    {
                        // You haven't learned basket weaving. Perhaps studying a book would help!
                        from.SendLocalizedMessage(1112253);
                    }
                    else
                    {
                        PlantHue hue = ((DryReeds)item).PlantHue;

                        if (DryReeds.ConsumeReeds(from.Backpack, hue, 2))
                        {
                            Consume();
                            from.AddToBackpack(new SoftenedReeds(hue));
                        }
                        else
                        {
                            // You don't have enough of this type of dry reeds to make that.
                            from.SendLocalizedMessage(1112250);
                        }
                    }
                }
                else if (NaturalDye.IsValidItem(item))
                {
                    Consume();

                    item.Hue = 0;
                    from.PlaySound(0x23E);
                }
                else
                {
                    // You cannot scour that!
                    from.SendLocalizedMessage(1112349);
                }
            }
            else
            {
                // You cannot scour that!
                from.SendLocalizedMessage(1112349);
            }
        }