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

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

                    PlantClippings clippings = targeted as PlantClippings;

                    if (from.Backpack == null || from.Backpack.GetAmount(typeof(Bottle)) < 1)
                    {
                        // You don't have any empty bottles.
                        from.SendGump(new CraftGump(from, m_CraftSystem, m_Tool, 1044558));
                    }
                    else
                    {
                        PlantPigment.DoCraft(from, m_CraftSystem, m_TypeRes, m_Tool, m_CraftItem, clippings);
                    }
                }
            }
Ejemplo n.º 2
0
        public override void OnAfterDuped(Item newItem)
        {
            PlantClippings newClippings = newItem as PlantClippings;

            if (newClippings != null)
            {
                newClippings.PlantHue = PlantHue;
            }
        }
Ejemplo n.º 3
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Clippers.Deleted)
                {
                    return;
                }

                if (targeted is PlantItem)
                {
                    PlantItem plant = (PlantItem)targeted;

                    if (!plant.IsChildOf(from.Backpack))
                    {
                        from.SendLocalizedMessage(502437);                           // Items you wish to cut must be in your backpack.
                    }
                    if (plant.PlantStatus != PlantStatus.DecorativePlant)
                    {
                        from.SendLocalizedMessage(1112119);                           // You may only use these clippers on decorative plants.
                    }
                    else
                    {
                        // TODO (SA): ¿Se puede podar cualquier tipo de planta?

                        Item item;
                        if (m_Clippers.CutReeds)
                        {
                            item = new DryReeds(plant.PlantHue);
                        }
                        else
                        {
                            item = new PlantClippings(plant.PlantHue);
                        }

                        plant.Delete();

                        if (!from.PlaceInBackpack(item))
                        {
                            item.MoveToWorld(from.Location, from.Map);
                        }

                        from.SendLocalizedMessage(1112120);                           // You cut the plant into small pieces and place them in your backpack.

                        m_Clippers.UsesRemaining--;

                        if (m_Clippers.UsesRemaining <= 0)
                        {
                            m_Clippers.Delete();
                            from.SendLocalizedMessage(1112126);                               // Your clippers break as you use up the last charge.
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1112119);                       // You may only use these clippers on decorative plants.
                }
            }
Ejemplo n.º 4
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                PlayerMobile pm = from as PlayerMobile;

                if (m_Item.Deleted)
                {
                    return;
                }

                PlantItem plant = targeted as PlantItem;

                if (null == plant || PlantStatus.DecorativePlant != plant.PlantStatus)
                {
                    from.SendLocalizedMessage(1112119); // You may only use these clippers on decorative plants.
                    return;
                }
                if (pm.ToggleCutClippings == true)
                {
                    /*PlantClippings clippings = new PlantClippings();
                     * clippings.PlantHue = plant.PlantHue;
                     * clippings.MoveToWorld(plant.Location, plant.Map);
                     * plant.Delete();*/
                    from.PlaySound(0x248);
                    PlantClippings cl = new PlantClippings();
                    cl.Hue      = ((PlantItem)targeted).Hue;
                    cl.PlantHue = plant.PlantHue;
                    from.AddToBackpack(cl);
                    plant.Delete();
                }


                else if (pm.ToggleCutReeds == true)
                {
                    /*DryReeds reeds = new DryReeds();
                     * reeds.PlantHue = plant.PlantHue;
                     * reeds.MoveToWorld(plant.Location, plant.Map);
                     * plant.Delete();
                     * from.PlaySound(0x248);*/
                    from.PlaySound(0x248);
                    DryReeds dr = new DryReeds();
                    dr.Hue      = ((PlantItem)targeted).Hue;
                    dr.PlantHue = plant.PlantHue;
                    from.AddToBackpack(dr);
                    plant.Delete();
                }
            }
Ejemplo n.º 5
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                PlayerMobile pm = from as PlayerMobile;

                if (this.m_Item.Deleted)
                    return;

                PlantItem plant = targeted as PlantItem;

                if (null == plant || PlantStatus.DecorativePlant != plant.PlantStatus)
                {
                    from.SendLocalizedMessage(1112119); // You may only use these clippers on decorative plants.
                    return;
                }
                if (pm.ToggleCutClippings == true)
                {
                    /*PlantClippings clippings = new PlantClippings();
                    clippings.PlantHue = plant.PlantHue;
                    clippings.MoveToWorld(plant.Location, plant.Map);
                    plant.Delete();*/
                    from.PlaySound(0x248);
                    PlantClippings cl = new PlantClippings();
                    cl.Hue = ((PlantItem)targeted).Hue;
                    cl.PlantHue = plant.PlantHue;
                    from.AddToBackpack(cl);
                    plant.Delete();
                }
                else if (pm.ToggleCutReeds == true)
                {
                    /*DryReeds reeds = new DryReeds();
                    reeds.PlantHue = plant.PlantHue;
                    reeds.MoveToWorld(plant.Location, plant.Map);
                    plant.Delete();
                    from.PlaySound(0x248);*/
                    from.PlaySound(0x248);
                    DryReeds dr = new DryReeds();
                    dr.Hue = ((PlantItem)targeted).Hue;
                    dr.PlantHue = plant.PlantHue;
                    from.AddToBackpack(dr);
                    plant.Delete();
                }
                //TODO: Add in clipping hedges (short and tall) and juniperbushes for topiaries
            }
Ejemplo n.º 6
0
        public static void DoCraft(Mobile from, CraftSystem system, Type typeRes, BaseTool tool, CraftItem craftItem, PlantClippings clippings)
        {
            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)
            {
                clippings.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(Bottle), 1);

                    from.AddToBackpack(new PlantPigment(clippings.PlantHue));

                    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));
                    }
                }
            }
            else
            {
                // You don't have the required skills to attempt this item.
                from.SendGump(new CraftGump(from, system, tool, 1044153));
            }
        }
Ejemplo n.º 7
0
        public static void DoCraft( Mobile from, CraftSystem system, Type typeRes, BaseTool tool, CraftItem craftItem, PlantClippings clippings )
        {
            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 )
            {
                clippings.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( Bottle ), 1 );

                    from.AddToBackpack( new PlantPigment( clippings.PlantHue ) );

                    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 ) );
                    }
                }
            }
            else
            {
                // You don't have the required skills to attempt this item.
                from.SendGump( new CraftGump( from, system, tool, 1044153 ) );
            }
        }