Beispiel #1
0
        protected void Target(Mobile from, object targeted)
        {
            if (!IsChildOf(from.Backpack))
            {
                // You must have the object in your backpack to use it.
                from.SendLocalizedMessage(1042010);
            }
            else if (!(targeted is PlantPigment))
            {
                // You may only mix this with another non-saturated plant pigment.
                from.SendLocalizedMessage(1112124);
            }
            else
            {
                PlantPigment pigment = targeted as PlantPigment;

                if (!pigment.IsChildOf(from.Backpack))
                {
                    // The item must be in your backpack to use it.
                    from.SendLocalizedMessage(1060640);
                }
                else
                {
                    PlantPigment mixed = Mix(from, m_PlantHue, pigment.PlantHue);

                    if (mixed != null)
                    {
                        Consume();
                        pigment.Consume();

                        from.AddToBackpack(mixed);
                    }
                }
            }
        }
Beispiel #2
0
        public static void DoCraft( Mobile from, CraftSystem system, Type typeRes, BaseTool tool, CraftItem craftItem, PlantPigment pigments )
        {
            CraftContext context = system.GetContext( from );

            if ( context != null )
                context.OnMade( craftItem );

            bool allRequiredSkills = true;

            double chance = craftItem.GetSuccessChance( from, typeRes, system, true, ref allRequiredSkills );

            if ( chance > 0.0 )
                chance += craftItem.GetTalismanBonus( from, system );

            if ( allRequiredSkills )
            {
                pigments.Consume();

                if ( chance < Utility.RandomDouble() )
                {
                    from.SendGump( new CraftGump( from, system, tool, 1044043 ) ); // You failed to create the item, and some of your materials are lost.
                }
                else
                {
                    from.Backpack.ConsumeTotal( typeof( ColorFixative ), 1 );

                    bool toolBroken = false;

                    tool.UsesRemaining--;

                    if ( tool.UsesRemaining < 1 )
                        toolBroken = true;

                    if ( toolBroken )
                    {
                        tool.Delete();

                        from.SendLocalizedMessage( 1044038 ); // You have worn out your tool!
                        from.SendLocalizedMessage( 1044154 ); // You create the item.
                    }
                    else
                    {
                        // You create the item.
                        from.SendGump( new CraftGump( from, system, tool, 1044154 ) );
                    }

                    from.AddToBackpack( new NaturalDye( pigments.PlantHue ) );
                }
            }
            else
            {
                // You don't have the required skills to attempt this item.
                from.SendGump( new CraftGump( from, system, tool, 1044153 ) );
            }
        }
Beispiel #3
0
        public static void DoCraft(Mobile from, CraftSystem system, Type typeRes, BaseTool tool, CraftItem craftItem, PlantPigment pigments)
        {
            CraftContext context = system.GetContext(from);

            if (context != null)
            {
                context.OnMade(craftItem);
            }

            bool allRequiredSkills = true;

            double chance = craftItem.GetSuccessChance(from, typeRes, system, true, ref allRequiredSkills);

            if (chance > 0.0)
            {
                chance += craftItem.GetTalismanBonus(from, system);
            }

            if (allRequiredSkills)
            {
                pigments.Consume();

                if (chance < Utility.RandomDouble())
                {
                    from.SendGump(new CraftGump(from, system, tool, 1044043));                         // You failed to create the item, and some of your materials are lost.
                }
                else
                {
                    from.Backpack.ConsumeTotal(typeof(ColorFixative), 1);

                    bool toolBroken = false;

                    tool.UsesRemaining--;

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

                    if (toolBroken)
                    {
                        tool.Delete();

                        from.SendLocalizedMessage(1044038);                           // You have worn out your tool!
                        from.SendLocalizedMessage(1044154);                           // You create the item.
                    }
                    else
                    {
                        // You create the item.
                        from.SendGump(new CraftGump(from, system, tool, 1044154));
                    }

                    from.AddToBackpack(new NaturalDye(pigments.PlantHue));
                }
            }
            else
            {
                // You don't have the required skills to attempt this item.
                from.SendGump(new CraftGump(from, system, tool, 1044153));
            }
        }