protected override void OnTarget( Mobile from, object targeted )
		{
			if ( m_Item.Deleted )
				return;

			if ( targeted is ICarvable )
			{
				((ICarvable)targeted).Carve( from, m_Item );
			}
			else
			{
				HarvestSystem system = Lumberjacking.System;
				HarvestDefinition def = Lumberjacking.System.Definition;

				int tileID;
				Map map;
				Point3D loc;

				if ( !system.GetHarvestDetails( from, m_Item, targeted, out tileID, out map, out loc ) )
				{
					from.SendLocalizedMessage( 500494 ); // You can't use a bladed item on that!
				}
				else if ( !def.Validate( tileID ) )
				{
					from.SendLocalizedMessage( 500494 ); // You can't use a bladed item on that!
				}
				else
				{
					HarvestBank bank = def.GetBank( map, loc.X, loc.Y );

					if ( bank == null )
						return;

					if ( bank.Current < 5 )
					{
						from.SendLocalizedMessage( 500493 ); // There's not enough wood here to harvest.
					}
					else
					{
						bank.Consume( 5, from );

						Item item = new Kindling();

						if ( from.PlaceInBackpack( item ) )
						{
							from.SendLocalizedMessage( 500491 ); // You put some kindling into your backpack.
							from.SendLocalizedMessage( 500492 ); // An axe would probably get you more wood.
						}
						else
						{
							from.SendLocalizedMessage( 500490 ); // You can't place any kindling into your backpack!

							item.Delete();
						}
					}
				}
			}
		}
Exemple #2
0
        protected override void OnTarget( Mobile from, object targeted )
        {
            if ( m_Item.Deleted )
                return;

            if ( targeted is ICarvable )
            {
                ((ICarvable)targeted).Carve( from, m_Item );
            }
            else if ( targeted is SwampDragon && ((SwampDragon)targeted).HasBarding )
            {
                SwampDragon pet = (SwampDragon)targeted;

                if ( !pet.Controlled || pet.ControlMaster != from )
                    from.SendLocalizedMessage( 1053022 ); // You cannot remove barding from a swamp dragon you do not own.
                else
                    pet.HasBarding = false;
            }
            else
            {
                if ( targeted is StaticTarget )
                {
                    int itemID = ((StaticTarget)targeted).ItemID;

                    if ( itemID == 0xD15 || itemID == 0xD16 ) // red mushroom
                    {
                        PlayerMobile player = from as PlayerMobile;

                        if ( player != null )
                        {
                            QuestSystem qs = player.Quest;

                            if ( qs is WitchApprenticeQuest )
                            {
                                FindIngredientObjective obj = qs.FindObjective( typeof( FindIngredientObjective ) ) as FindIngredientObjective;

                                if ( obj != null && !obj.Completed && obj.Ingredient == Ingredient.RedMushrooms )
                                {
                                    player.SendLocalizedMessage( 1055036 ); // You slice a red cap mushroom from its stem.
                                    obj.Complete();
                                    return;
                                }
                            }
                        }
                    }
                }

                HarvestSystem system = Lumberjacking.System;
                HarvestDefinition def = Lumberjacking.System.Definition;

                int tileID;
                Map map;
                Point3D loc;

                if ( !system.GetHarvestDetails( from, m_Item, targeted, out tileID, out map, out loc ) )
                {
                    from.SendLocalizedMessage( 500494 ); // You can't use a bladed item on that!
                }
                else if ( !def.Validate( tileID ) )
                {
                    from.SendLocalizedMessage( 500494 ); // You can't use a bladed item on that!
                }
                else
                {
                    HarvestBank bank = def.GetBank( map, loc.X, loc.Y );

                    if ( bank == null )
                        return;

                    if ( bank.Current < 5 )
                    {
                        from.SendLocalizedMessage( 500493 ); // There's not enough wood here to harvest.
                    }
                    else
                    {
                        bank.Consume( 5, from );

                        Item item = new Kindling();

                        if ( from.PlaceInBackpack( item ) )
                        {
                            from.SendLocalizedMessage( 500491 ); // You put some kindling into your backpack.
                            from.SendLocalizedMessage( 500492 ); // An axe would probably get you more wood.
                        }
                        else
                        {
                            from.SendLocalizedMessage( 500490 ); // You can't place any kindling into your backpack!

                            item.Delete();
                        }
                    }
                }
            }
        }
		protected override void OnTarget( Mobile from, object targeted )
		{
			if ( m_Item.Deleted )
				return;

			if ( targeted is ICarvable )
			{
				((ICarvable)targeted).Carve( from, m_Item );
			}
			else if ( targeted is SwampDragon && ((SwampDragon)targeted).HasBarding )
			{
				SwampDragon pet = (SwampDragon)targeted;

				if ( !pet.Controlled || pet.ControlMaster != from )
					from.SendLocalizedMessage( 1053022 ); // You cannot remove barding from a swamp dragon you do not own.
				else
					pet.HasBarding = false;
			}
            else if (targeted is Head)
            {
                Head targ = (Head)targeted;

                if (from.Karma > - 1500)
                {
                    from.SendMessage("Vous n'avez pas le profil d'un dépeceur de crâne...");
                    return;
                }

                if (from.Dex <= Utility.Random(110))
                {
                    from.SendMessage("Vous avez été trop maladroit et avez raté le dépeçage");
                    targ.Delete();
                    return;
                }

                from.SendMessage("Vous achevez d'enlever la chair du crâne.");
                from.AddToBackpack(new Skull());
                targ.Consume();
            }
            else if (targeted is Pumpkin)
            {
                Pumpkin targ = (Pumpkin)targeted;

                if(from.Dex <= Utility.Random(100))
                {
                    from.SendMessage("Vous avez été trop maladroit et avez raté votre tracé");
                    targ.Consume();
                    return;
                }

                int karma= 0;

                if (from.Karma > 100)
                    karma ++;
                else if (from.Karma < -100)
                    karma --;
                
                int chance = Utility.Random(4) + karma;

                if (chance >=2)
                    from.AddToBackpack(new SmileyPumpkin());
                else
                    from.AddToBackpack(new EvilPumpkin());

                from.SendMessage("Vous taillez la citrouille selon votre humeur");
                targ.Consume();
            }
			else
			{
				if ( targeted is StaticTarget )
				{
					int itemID = ((StaticTarget)targeted).ItemID;

					if ( itemID == 0xD15 || itemID == 0xD16 ) // red mushroom
					{
						PlayerMobile player = from as PlayerMobile;

						if ( player != null )
						{
							QuestSystem qs = player.Quest;

							if ( qs is WitchApprenticeQuest )
							{
								FindIngredientObjective obj = qs.FindObjective( typeof( FindIngredientObjective ) ) as FindIngredientObjective;

								if ( obj != null && !obj.Completed && obj.Ingredient == Ingredient.RedMushrooms )
								{
									player.SendLocalizedMessage( 1055036 ); // You slice a red cap mushroom from its stem.
									obj.Complete();
									return;
								}
							}
						}
					}
				}

				HarvestSystem system = Lumberjacking.System;
				HarvestDefinition def = Lumberjacking.System.Definition;

				int tileID;
				Map map;
				Point3D loc;

				if ( !system.GetHarvestDetails( from, m_Item, targeted, out tileID, out map, out loc ) )
				{
					from.SendLocalizedMessage( 500494 ); // You can't use a bladed item on that!
				}
				else if ( !def.Validate( tileID ) )
				{
					from.SendLocalizedMessage( 500494 ); // You can't use a bladed item on that!
				}
				else
				{
					HarvestBank bank = def.GetBank( map, loc.X, loc.Y );

					if ( bank == null )
						return;

					if ( bank.Current < 5 )
					{
						from.SendLocalizedMessage( 500493 ); // There's not enough wood here to harvest.
					}
					else
					{
						bank.Consume( 5, from );

                        if (map.Season == (int)ServerSeasons.Season.Spring && Utility.RandomDouble() < 0.33)
                        {
                            from.PrivateOverheadMessage(Network.MessageType.Regular, 0x3B2, false, "De la sève se met à couler du tronc, souhaitez-vous la recueillir?", from.NetState);
                            from.BeginTarget(2, false, TargetFlags.None, new TargetCallback(OnSelectTarget));
                            return;
                        }

						Item item = new Kindling();

						if ( from.PlaceInBackpack( item ) )
						{
							from.SendLocalizedMessage( 500491 ); // You put some kindling into your backpack.
							from.SendLocalizedMessage( 500492 ); // An axe would probably get you more wood.
						}
						else
						{
							from.SendLocalizedMessage( 500490 ); // You can't place any kindling into your backpack!

							item.Delete();
						}
					}
				}
			}
		}
        protected override void OnTarget( Mobile from, object targeted )
        {
            if ( m_Item.Deleted )
                return;

            if (m_Item is Dagger && targeted is Dagger && m_Item != targeted)
            {
                Dagger m_Hilt = m_Item as Dagger;
                Dagger m_Blade = targeted as Dagger;
                DualDaggers weapon = new DualDaggers();
                weapon.NewCrafting = true;
                weapon.QualityDamage = (int)(m_Hilt.QualityDamage * 0.5 + m_Blade.QualityDamage * 0.5);
                weapon.QualitySpeed = (int)(m_Hilt.QualitySpeed * 0.5 + m_Blade.QualitySpeed * 0.5);
                weapon.QualityAccuracy = (int)(m_Hilt.QualityAccuracy * 0.5 + m_Blade.QualityAccuracy * 0.5);
                weapon.QualityDefense = (int)(m_Hilt.QualityDefense * 0.5 + m_Blade.QualityDefense * 0.5);
                weapon.Resource = m_Hilt.Resource;
                int quality = (int)(m_Blade.MaxHitPoints * 0.5 + m_Hilt.MaxHitPoints * 0.5);
                weapon.MaxHitPoints = quality;
                quality = (int)(m_Blade.HitPoints * 0.5 + m_Hilt.HitPoints * 0.5);
                weapon.HitPoints = quality;
                weapon.Crafter = from;
                weapon.CraftersOriginalName = from.Name;
                quality = (int)(((int)m_Blade.Quality * 50) * 0.5 + ((int)m_Hilt.Quality * 50) * 0.5);
                if (quality == 500)
                    weapon.Quality = WeaponQuality.Legendary;
                if (quality < 500)
                    weapon.Quality = WeaponQuality.Masterwork;
                if (quality < 450)
                    weapon.Quality = WeaponQuality.Illustrious;
                if (quality < 400)
                    weapon.Quality = WeaponQuality.Extraordinary;
                if (quality < 350)
                    weapon.Quality = WeaponQuality.Remarkable;
                if (quality < 300)
                    weapon.Quality = WeaponQuality.Exceptional;
                if (quality < 250)
                    weapon.Quality = WeaponQuality.Superior;
                if (quality < 200)
                    weapon.Quality = WeaponQuality.Regular;
                if (quality < 150)
                    weapon.Quality = WeaponQuality.Inferior;
                if (quality < 100)
                    weapon.Quality = WeaponQuality.Low;
                if (quality < 50)
                    weapon.Quality = WeaponQuality.Poor;
                weapon.BetaNerf = true;
                weapon.InvalidateProperties();
                from.AddToBackpack(weapon);
                weapon.AddItem(m_Blade);
                weapon.AddItem(m_Hilt);
            }

            if (m_Item is HandScythe && targeted is HandScythe && m_Item != targeted)
            {
                HandScythe m_Hilt = m_Item as HandScythe;
                HandScythe m_Blade = targeted as HandScythe;
                DualPicks weapon = new DualPicks();
                weapon.NewCrafting = true;
                weapon.QualityDamage = (int)(m_Hilt.QualityDamage * 0.5 + m_Blade.QualityDamage * 0.5);
                weapon.QualitySpeed = (int)(m_Hilt.QualitySpeed * 0.5 + m_Blade.QualitySpeed * 0.5);
                weapon.QualityAccuracy = (int)(m_Hilt.QualityAccuracy * 0.5 + m_Blade.QualityAccuracy * 0.5);
                weapon.QualityDefense = (int)(m_Hilt.QualityDefense * 0.5 + m_Blade.QualityDefense * 0.5);
                weapon.Resource = m_Hilt.Resource;
                int quality = (int)(m_Blade.MaxHitPoints * 0.5 + m_Hilt.MaxHitPoints * 0.5);
                weapon.MaxHitPoints = quality;
                quality = (int)(m_Blade.HitPoints * 0.5 + m_Hilt.HitPoints * 0.5);
                weapon.HitPoints = quality;
                weapon.Crafter = from;
                weapon.CraftersOriginalName = from.Name;
                quality = (int)(((int)m_Blade.Quality * 50) * 0.5 + ((int)m_Hilt.Quality * 50) * 0.5);
                if (quality == 500)
                    weapon.Quality = WeaponQuality.Legendary;
                if (quality < 500)
                    weapon.Quality = WeaponQuality.Masterwork;
                if (quality < 450)
                    weapon.Quality = WeaponQuality.Illustrious;
                if (quality < 400)
                    weapon.Quality = WeaponQuality.Extraordinary;
                if (quality < 350)
                    weapon.Quality = WeaponQuality.Remarkable;
                if (quality < 300)
                    weapon.Quality = WeaponQuality.Exceptional;
                if (quality < 250)
                    weapon.Quality = WeaponQuality.Superior;
                if (quality < 200)
                    weapon.Quality = WeaponQuality.Regular;
                if (quality < 150)
                    weapon.Quality = WeaponQuality.Inferior;
                if (quality < 100)
                    weapon.Quality = WeaponQuality.Low;
                if (quality < 50)
                    weapon.Quality = WeaponQuality.Poor;
                weapon.BetaNerf = true;
                weapon.InvalidateProperties();
                from.AddToBackpack(weapon);
                weapon.AddItem(m_Blade);
                weapon.AddItem(m_Hilt);
            }

            if (m_Item is Longsword && targeted is Longsword && m_Item != targeted)
            {
                Longsword m_Hilt = m_Item as Longsword;
                Longsword m_Blade = targeted as Longsword;
                DualSwords weapon = new DualSwords();
                weapon.NewCrafting = true;
                weapon.QualityDamage = (int)(m_Hilt.QualityDamage * 0.5 + m_Blade.QualityDamage * 0.5);
                weapon.QualitySpeed = (int)(m_Hilt.QualitySpeed * 0.5 + m_Blade.QualitySpeed * 0.5);
                weapon.QualityAccuracy = (int)(m_Hilt.QualityAccuracy * 0.5 + m_Blade.QualityAccuracy * 0.5);
                weapon.QualityDefense = (int)(m_Hilt.QualityDefense * 0.5 + m_Blade.QualityDefense * 0.5);
                weapon.Resource = m_Hilt.Resource;
                int quality = (int)(m_Blade.MaxHitPoints * 0.5 + m_Hilt.MaxHitPoints * 0.5);
                weapon.MaxHitPoints = quality;
                quality = (int)(m_Blade.HitPoints * 0.5 + m_Hilt.HitPoints * 0.5);
                weapon.HitPoints = quality;
                weapon.Crafter = from;
                weapon.CraftersOriginalName = from.Name;
                quality = (int)(((int)m_Blade.Quality * 50) * 0.5 + ((int)m_Hilt.Quality * 50) * 0.5);
                if (quality == 500)
                    weapon.Quality = WeaponQuality.Legendary;
                if (quality < 500)
                    weapon.Quality = WeaponQuality.Masterwork;
                if (quality < 450)
                    weapon.Quality = WeaponQuality.Illustrious;
                if (quality < 400)
                    weapon.Quality = WeaponQuality.Extraordinary;
                if (quality < 350)
                    weapon.Quality = WeaponQuality.Remarkable;
                if (quality < 300)
                    weapon.Quality = WeaponQuality.Exceptional;
                if (quality < 250)
                    weapon.Quality = WeaponQuality.Superior;
                if (quality < 200)
                    weapon.Quality = WeaponQuality.Regular;
                if (quality < 150)
                    weapon.Quality = WeaponQuality.Inferior;
                if (quality < 100)
                    weapon.Quality = WeaponQuality.Low;
                if (quality < 50)
                    weapon.Quality = WeaponQuality.Poor;
                weapon.BetaNerf = true;
                weapon.InvalidateProperties();
                from.AddToBackpack(weapon);
                weapon.AddItem(m_Blade);
                weapon.AddItem(m_Hilt);
            }

            if ( targeted is ICarvable )
            {
                ((ICarvable)targeted).Carve( from, m_Item );
            }

            else if ( targeted is BaseClothing && ( (Item)targeted ).IsChildOf( from.Backpack ) )
            {
                BaseClothing clothes = targeted as BaseClothing;

                Bandage bandage = new Bandage( 2 );
                bandage.Amount += Math.Max( 0, (int)clothes.Weight );
                bandage.Hue = clothes.Hue;

                Container pack = from.Backpack;

                pack.DropItem( bandage );

                from.SendMessage( "You rip the garment apart and create some bandages out of it" );

                clothes.Delete();
            }

            else
            {
                HarvestSystem system = Lumberjacking.System;
                HarvestDefinition def = Lumberjacking.System.Definition;

                int tileID;
                Map map;
                Point3D loc;

                if ( !system.GetHarvestDetails( from, m_Item, targeted, out tileID, out map, out loc ) )
                {
                    from.SendLocalizedMessage( 500494 ); // You can't use a bladed item on that!
                }
                else if ( !def.Validate( tileID ) )
                {
                    from.SendLocalizedMessage( 500494 ); // You can't use a bladed item on that!
                }
                else
                {
                    HarvestBank bank = def.GetBank( map, loc.X, loc.Y );

                    if ( bank == null )
                        return;

                    if ( bank.Current < 5 )
                    {
                        from.SendLocalizedMessage( 500493 ); // There's not enough wood here to harvest.
                    }
                    else
                    {
                        bank.Consume( def, 5 );

                        Item item = new Kindling();

                        if ( from.PlaceInBackpack( item ) )
                        {
                            from.SendLocalizedMessage( 500491 ); // You put some kindling into your backpack.
                            from.SendLocalizedMessage( 500492 ); // An axe would probably get you more wood.
                        }
                        else
                        {
                            from.SendLocalizedMessage( 500490 ); // You can't place any kindling into your backpack!

                            item.Delete();
                        }
                    }
                }
            }
        }
		protected override void OnTarget( Mobile from, object targeted )
		{
			if( m_Item.Deleted )
				return;

			if( targeted is ICarvable )
			{
				((ICarvable)targeted).Carve( from, m_Item );
			}
			else if( targeted is ForestWyrm && ((ForestWyrm)targeted).HasBarding )
			{
				ForestWyrm pet = (ForestWyrm)targeted;

				if( !pet.Controlled || pet.ControlMaster != from )
					from.SendLocalizedMessage( 1053022 ); // You cannot remove barding from a swamp dragon you do not own.
				else
					pet.HasBarding = false;
			}
			#region CropSystem
			else if( targeted is Weeds )
			{
				((Weeds)targeted).Delete();

				from.SendMessage( "You slice the roots of the weed and toss them away." );
			}
			else if( targeted is Food && ((Food)targeted).SeedType != null )
			{
				try
				{
					Food food = targeted as Food;
					int amount = (food.Amount * Utility.RandomMinMax( 2, 6 ));
					Item seed = Activator.CreateInstance( food.SeedType, amount ) as Item;

					if( seed != null )
					{
						from.AddToBackpack( seed );
						from.SendMessage( String.Format( "You slice open the plant{0} and remove {1} seeds.",
							(food.Amount > 1 ? "s" : ""), (food.Amount > 1 ? "their" : "its") ) );
					}

					food.Delete();
				}
				catch { }
			}
			else if( targeted is Flax )
			{
				int amount = (((Flax)targeted).Amount * Utility.RandomMinMax( 2, 6 ));

				from.AddToBackpack( new FlaxSeed( amount ) );
				from.SendMessage( "You cut off the stalk of the flax and throw it away, keeping the seeds for later use." );

				((Flax)targeted).Delete();
			}
			else if( targeted is WheatSheaf )
			{
				int amount = (((WheatSheaf)targeted).Amount * Utility.RandomMinMax( 3, 8 ));

				from.AddToBackpack( new WheatSeed( amount ) );
				from.SendMessage( "You split open the wheat and take all the seeds you can find." );

				((WheatSheaf)targeted).Delete();
			}
			else if( targeted is Rose )
			{
				from.AddToBackpack( new RoseBud( Utility.RandomMinMax( 3, 6 ) ) );
				from.SendMessage( "You break away the petals of the flowers and gently remove the buds." );

				((Rose)targeted).Delete();
			}
			#endregion
			else
			{
				HarvestSystem system = Lumberjacking.System;
				HarvestDefinition def = Lumberjacking.System.Definition;

				int tileID;
				Map map;
				Point3D loc;

				if( !system.GetHarvestDetails( from, m_Item, targeted, out tileID, out map, out loc ) )
				{
					from.SendLocalizedMessage( 500494 ); // You can't use a bladed item on that!
				}
				else if( !def.Validate( tileID ) )
				{
					from.SendLocalizedMessage( 500494 ); // You can't use a bladed item on that!
				}
				else
				{
					HarvestBank bank = def.GetBank( map, loc.X, loc.Y );

					if( bank == null )
						return;

					if( bank.Current < 5 )
					{
						from.SendLocalizedMessage( 500493 ); // There's not enough wood here to harvest.
					}
					else
					{
						bank.Consume( 5, from );

						Item item = new Kindling();

						if( from.PlaceInBackpack( item ) )
						{
							from.SendLocalizedMessage( 500491 ); // You put some kindling into your backpack.
							from.SendLocalizedMessage( 500492 ); // An axe would probably get you more wood.
						}
						else
						{
							from.SendLocalizedMessage( 500490 ); // You can't place any kindling into your backpack!

							item.Delete();
						}
					}
				}
			}
		}
            protected override void OnTick()
            {
                ++m_Count;
                if (m_Count < m_MaxCount)
                {
                    new SoundTimer(m_From).Start();
                    if (m_From.Mounted)
                        m_From.Animate(26, 5, 2, true, false, 0);
                    else
                        m_From.Animate(9, 5, 2, true, false, 0);
                }
                else
                {
                    m_Bank.Consume(Lumberjacking.System.Definition, 5, m_From);

                    Item item = new Kindling();

                    if (m_From.PlaceInBackpack(item))
                    {
                        m_From.SendLocalizedMessage(500491); // You put some kindling into your backpack.
                        //m_From.SendLocalizedMessage(500492); // An axe would probably get you more wood.
                    }
                    else
                    {
                        m_From.SendLocalizedMessage(500490); // You can't place any kindling into your backpack!

                        item.Delete();
                    }
                }
            }