protected override void FinishEffect( Point3D p, Map map, Mobile from )
		{
			if ( from.Skills.Fishing.Value < 10 )
			{
				from.SendLocalizedMessage( 1074487 ); // The creatures are too quick for you!
			}
			else
			{
				BaseFish fish = GiveFish( from );
				FishBowl bowl = Aquarium.GetEmptyBowl( from );

				if ( bowl != null )
				{
					fish.StopTimer();
					bowl.AddItem( fish );
					from.SendLocalizedMessage( 1074489 ); // A live creature jumps into the fish bowl in your pack!
					Delete();
					return;
				}
				else
				{
					if ( from.PlaceInBackpack( fish ) )
					{
						from.PlaySound( 0x5A2 );
						from.SendLocalizedMessage( 1074490 ); // A live creature flops around in your pack before running out of air.

						fish.Kill();
						Delete();
						return;
					}
					else
					{
						fish.Delete();

						from.SendLocalizedMessage( 1074488 ); // You could not hold the creature.
					}
				}
			}

			InUse = false;
			Movable = true;

			if ( !from.PlaceInBackpack( this ) )
			{
				if ( from.Map == null || from.Map == Map.Internal )
					Delete();
				else
					MoveToWorld( from.Location, from.Map );
			}
		}
Example #2
0
		public override void OnComponentUsed( AddonComponent c, Mobile from )
		{
			if ( from.InRange( c.Location, 2 ) )
			{
				if ( m_Fruits > 0 )
				{
					Item fruit = Fruit;

					if ( fruit == null )
						return;

					if ( !from.PlaceInBackpack( fruit ) )
					{
						fruit.Delete();
						from.SendLocalizedMessage( 501015 ); // There is no room in your backpack for the fruit.
					}
					else
					{
						if ( --m_Fruits == 0 )
							Timer.DelayCall( TimeSpan.FromMinutes( 30 ), new TimerCallback( Respawn ) );

						from.SendLocalizedMessage( 501016 ); // You pick some fruit and put it in your backpack.
					}
				}
				else
					from.SendLocalizedMessage( 501017 ); // There is no more fruit on this tree
			}
			else
				from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
		}
Example #3
0
        public bool GiveReward( Mobile to )
        {
            Bag bag = new Bag();

            bag.DropItem( new Gold( Utility.RandomMinMax( 500, 1000 ) ) );

            if ( Utility.RandomBool() )
            {
                BaseWeapon weapon = Loot.RandomWeapon();

                BaseRunicTool.ApplyAttributesTo( weapon, 2, 20, 30 );

                bag.DropItem( weapon );
            }
            else
            {
                Item item = Loot.RandomArmorOrShieldOrJewelry();

                if ( item is BaseArmor )
                    BaseRunicTool.ApplyAttributesTo( (BaseArmor) item, 2, 20, 30 );
                else if ( item is BaseJewel )
                    BaseRunicTool.ApplyAttributesTo( (BaseJewel) item, 2, 20, 30 );

                bag.DropItem( item );
            }

            bag.DropItem( new Obsidian() );

            return to.PlaceInBackpack( bag );
        }
Example #4
0
        public static void OnAccepted( Mobile from )
        {
            if ( from.Backpack == null )
                return;

            PlainGreyCloak cloak = from.FindItemOnLayer( Layer.Cloak ) as PlainGreyCloak;

            if ( cloak == null )
            {
                from.DropHolding();
                cloak = from.Backpack.FindItemByType<PlainGreyCloak>();
            }

            if ( cloak == null )
                return;

            cloak.Delete();
            from.PlaceInBackpack( new ShieldOfRecognition() );

            /* *smiles* Surely thy deeds will be recognized by those who see thee
             * wearing this shield! It shall serve as a reminder of the exalted
             * path that thou hast journeyed upon, and I wish to thank thee on
             * behalf of all whom thine efforts shall benefit. Ah, let us not
             * forget that old cloak I gavest thee - I shall take it back now and
             * give thee thine reward. */
            from.SendGump( new GenericQuestGump( 1075783 ) );

            if ( from is PlayerMobile )
                ( (PlayerMobile) from ).HumilityQuestStatus = HumilityQuestStatus.RewardAccepted;
        }
Example #5
0
        public override void OnDoubleClick( Mobile from )
        {
            if ( !from.InRange( Location, 2 ) )
            {
                // I can't reach that.
                from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 );
            }
            else if ( from is PlayerMobile && ( (PlayerMobile) from ).SacredQuest )
            {
                // You cannot think of any reason to want to do this.
                from.SendLocalizedMessage( 1080538 );
            }
            else if ( from.Backpack != null )
            {
                from.DropHolding();

                Item key = from.Backpack.FindItemByType( KeyType );

                if ( key != null )
                {
                    // You are already carrying a copy of this key fragment.
                    from.SendLocalizedMessage( 1111653 );
                }
                else
                {
                    from.PlaceInBackpack( (Item) Activator.CreateInstance( KeyType ) );

                    // You reach for the key and receive a glowing copy that you place in your bag.
                    from.SendLocalizedMessage( 1111652 );
                }
            }
        }
Example #6
0
        public override void OnDoubleClick( Mobile from )
        {
            if ( !this.VerifyMove( from ) )
                return;

            if ( !from.InRange( this.GetWorldLocation(), 2 ) )
            {
                from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "I can't reach that." ); // I can't reach that.
                return;
            }

            Point3D fireLocation = GetFireLocation( from );

            if ( fireLocation == Point3D.Zero )
            {
                from.SendAsciiMessage( "There is not a spot nearby to place your campfire." ); // There is not a spot nearby to place your campfire.
            }
            else if ( !from.CheckSkill( SkillName.Camping, 0.0, 100.0 ) )
            {
                from.SendAsciiMessage("You fail to ignite the campfire."); // You fail to ignite the campfire.
            }
            else
            {
                Consume();

                if ( !this.Deleted && this.Parent == null )
                    from.PlaceInBackpack( this );

                new Campfire(from).MoveToWorld( fireLocation, from.Map );
            }
        }
        public bool GiveReward( Mobile to )
        {
            Bag bag = new Bag();

            bag.DropItem( new Gold( Utility.RandomMinMax( 1500, 2000 ) ) ); //Edit by Blady. Default was (500, 1000)

            if ( Utility.RandomBool() )
            {
                BaseWeapon weapon = Loot.RandomWeapon();

                if ( Core.AOS )
                {
                    BaseRunicTool.ApplyAttributesTo( weapon, (Utility.RandomMinMax(2,5)), 20, 80 ); //By Blady. Default: (3, 20, 30)
                }
                else
                {
                    weapon.DamageLevel = (WeaponDamageLevel)BaseCreature.RandomMinMaxScaled( 2, 3 );
                    weapon.AccuracyLevel = (WeaponAccuracyLevel)BaseCreature.RandomMinMaxScaled( 2, 3 );
                    weapon.DurabilityLevel = (WeaponDurabilityLevel)BaseCreature.RandomMinMaxScaled( 2, 3 );
                }

                bag.DropItem( weapon );
            }
            else
            {
                Item item;

                if ( Core.AOS )
                {
                    item = Loot.RandomArmorOrShieldOrJewelry();

                    if ( item is BaseArmor )
                        BaseRunicTool.ApplyAttributesTo( (BaseArmor)item, (Utility.RandomMinMax(2,5)), 20, 80 ); //By Blady. Default: (3, 20, 30)
                    else if ( item is BaseJewel )
                        BaseRunicTool.ApplyAttributesTo( (BaseJewel)item, (Utility.RandomMinMax(2,5)), 20, 80 ); //By Blady. Default: (3, 20, 30)
                }
                else
                {
                    BaseArmor armor = Loot.RandomArmorOrShield();
                    item = armor;

                    armor.ProtectionLevel = (ArmorProtectionLevel)BaseCreature.RandomMinMaxScaled( 2, 3 );
                    armor.Durability = (ArmorDurabilityLevel)BaseCreature.RandomMinMaxScaled( 2, 3 );
                }

                bag.DropItem( item );
            }

            bag.DropItem( new Obsidian() );

            if ( to.PlaceInBackpack( bag ) )
            {
                return true;
            }
            else
            {
                bag.Delete();
                return false;
            }
        }
 private static void DisRobe( Mobile m_from, Layer layer )
 {
    if ( m_from.FindItemOnLayer( layer ) != null )
    {
       Item item = m_from.FindItemOnLayer( layer );
       m_from.PlaceInBackpack( item ); // Place in a bag first?
    }
 }
        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.GetCurrentFor( from ) < 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();
                        }
                    }
                }
            }
        }
Example #10
0
        public static void PackItem( Mobile m, Item item )
        {
            if ( item is BaseArmor )
                ((BaseArmor)item).Quality = ArmorQuality.Exceptional;
            else if ( item is BaseWeapon )
                ((BaseWeapon)item).Quality = WeaponQuality.Exceptional;

            if ( !m.PlaceInBackpack( item ) )
                item.Delete();
        }
		public void RaiseLevel(Mobile from)
		{
			if (from == null || from.Backpack == null)
				return;

			if (++m_Level == 5)
				from.PlaceInBackpack(new MysticKeys());

			PartSetup(m_Level);
		}
Example #12
0
		public virtual GiftResult GiveGift( Mobile mob, Item item )
		{
			if ( mob.PlaceInBackpack( item ) )
			{
				if ( !WeightOverloading.IsOverloaded( mob ) )
					return GiftResult.Backpack;
			}

			mob.BankBox.DropItem( item );
			return GiftResult.BankBox;
		}
Example #13
0
        public static void GiveItem( Mobile m, Item item )
        {
            if ( item is BaseArmor )
                ((BaseArmor)item).Quality = ArmorQuality.Exceptional;
            else if ( item is BaseWeapon )
                ((BaseWeapon)item).Quality = WeaponQuality.Exceptional;

            Item move = m.FindItemOnLayer( item.Layer );
            if ( move != null )
            {
                if ( !m.PlaceInBackpack( move ) )
                {
                    item.Delete();
                    return;
                }
            }

            if ( !m.EquipItem( item ) && !m.PlaceInBackpack( item ) )
                item.Delete();
        }
Example #14
0
		public override void OnDoubleClick( Mobile from )
		{
			if ( from.Backpack == null )
				return;
		
			if ( from.InRange( Location, 2 ) )
			{
				if ( from.Backpack.FindItemByType( typeof( PrismaticAmber ), true ) == null )
				{
					if ( from.PlaceInBackpack( new PrismaticAmber() ) )
						Delete();
					else
						from.SendLocalizedMessage( 1077971 ); // Make room in your backpack first!
				}
				else
					from.SendLocalizedMessage( 1075464 ); // You already have as many of those as you need.
			}
			else
				from.SendLocalizedMessage( 1076766 ); // That is too far away.
		}
Example #15
0
		public override void OnComponentUsed( AddonComponent c, Mobile from )
		{			
			BaseHouse house = BaseHouse.FindHouseAt( this );

			if ( house != null && house.HasSecureAccess( from, SecureLevel.Friends ) )
			{
				if ( m_Logs > 0 )
				{
					Item logs = null;

					switch ( Utility.Random( 7 ) )
					{
						case 0: logs = new Log(); break;
						case 1: logs = new AshLog(); break;
						case 2: logs = new OakLog(); break;
						case 3: logs = new YewLog(); break;
						case 4: logs = new HeartwoodLog(); break;
						case 5: logs = new BloodwoodLog(); break;
						case 6: logs = new FrostwoodLog(); break;
					}
					
					int amount = Math.Min( 10, m_Logs );
					logs.Amount = amount;

					if ( !from.PlaceInBackpack( logs ) )
					{
						logs.Delete();
						from.SendLocalizedMessage( 1078837 ); // Your backpack is full! Please make room and try again.
					}
					else
					{
						m_Logs -= amount;
						PublicOverheadMessage( MessageType.Regular, 0, 1094719, m_Logs.ToString() ); // Logs: ~1_COUNT~
					}
				}
				else 
					from.SendLocalizedMessage( 1094720 ); // There are no more logs available.
			}
			else 
				from.SendLocalizedMessage( 1061637 ); // You are not allowed to access this.
		}
Example #16
0
        public override void OnDoubleClick( Mobile from )
        {
            if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) )
                return;

            if ( IsChildOf( from.Backpack ) )
            {
                RewardPottedCactus cactus = new RewardPottedCactus();
                cactus.IsRewardItem = m_IsRewardItem;

                if ( !from.PlaceInBackpack( cactus ) )
                {
                    cactus.Delete();
                    from.SendLocalizedMessage( 1078837 ); // Your backpack is full! Please make room and try again.
                }
                else
                    Delete();
            }
            else
                from.SendLocalizedMessage( 1062334 ); // This item must be in your backpack to be used.
        }
Example #17
0
        public override void OnDoubleClick( Mobile from )
        {
            if ( !IsChildOf( from.Backpack ) )
            {
                from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
                return;
            }

            Item replacement = CreateReplacement();

            if ( !from.PlaceInBackpack( replacement ) )
            {
                replacement.Delete();
                from.SendLocalizedMessage( 500720 ); // You don't have enough room in your backpack!
            }
            else
            {
                Delete();
                from.Use( replacement );
            }
        }
		public void Demolish( Mobile by )
		{
			CharacterStatueDeed deed = new CharacterStatueDeed( null );

			if ( by.PlaceInBackpack( deed ) )
			{
				Delete();

				deed.Statue = this;
				deed.IsRewardItem = m_IsRewardItem;

				if ( m_Plinth != null )
					m_Plinth.Delete();
			}
			else
			{
				by.SendLocalizedMessage( 500720 ); // You don't have enough room in your backpack!
				deed.Delete();
			}
		}
		public void GivePrize( Mobile from )
		{
			from.SendMessage( "You grab fragements from the realm of the undead and place them in your backpack." );
			from.PlaceInBackpack( new AltRealmFragment() );
		}
		public static void PackItem( Mobile m, Item item )
		{
			if ( !m.PlaceInBackpack( item ) )
				item.Delete();
		}
        public virtual void OnCarve( Mobile from, Corpse corpse, Item with )
        {
            int feathers = Feathers;
            int wool = Wool;
            int meat = Meat;
            int hides = Hides;
            int scales = Scales;

            if ( (feathers == 0 && wool == 0 && meat == 0 && hides == 0 && scales == 0) || Summoned || IsBonded )
            {
                from.SendLocalizedMessage( 500485 ); // You see nothing useful to carve from the corpse.
            }
            else
            {
                if( Core.ML && from.Race == Race.Human )
                {
                    hides = (int)Math.Ceiling( hides * 1.1 );	//10% Bonus Only applies to Hides, Ore & Logs
                }

                if ( corpse.Map == Map.Felucca )
                {
                    feathers *= 2;
                    wool *= 2;
                    hides *= 2;
                }

                new Blood( 0x122D ).MoveToWorld( corpse.Location, corpse.Map );

                if ( feathers != 0 )
                {
                    corpse.AddCarvedItem( new Feather( feathers ), from );
                    from.SendLocalizedMessage( 500479 ); // You pluck the bird. The feathers are now on the corpse.
                }

                if ( wool != 0 )
                {
                    corpse.AddCarvedItem( new TaintedWool( wool ), from );
                    from.SendLocalizedMessage( 500483 ); // You shear it, and the wool is now on the corpse.
                }

                if ( meat != 0 )
                {
                    if ( MeatType == MeatType.Ribs )
                        corpse.AddCarvedItem( new RawRibs( meat ), from );
                    else if ( MeatType == MeatType.Bird )
                        corpse.AddCarvedItem( new RawBird( meat ), from );
                    else if ( MeatType == MeatType.LambLeg )
                        corpse.AddCarvedItem( new RawLambLeg( meat ), from );

                    from.SendLocalizedMessage( 500467 ); // You carve some meat, which remains on the corpse.
                }

                if ( hides != 0 )
                {
                    Item holding = from.Weapon as Item;
                    if ( Core.AOS && ( holding is SkinningKnife /* TODO: || holding is ButcherWarCleaver || with is ButcherWarCleaver */ ) )
                    {
                        Item leather = null;

                        switch ( HideType )
                        {
                            case HideType.Regular: leather = new Leather( hides ); break;
                            case HideType.Spined: leather = new SpinedLeather( hides ); break;
                            case HideType.Horned: leather = new HornedLeather( hides ); break;
                            case HideType.Barbed: leather = new BarbedLeather( hides ); break;
                        }

                        if ( leather != null )
                        {
                            if ( !from.PlaceInBackpack( leather ) )
                            {
                                corpse.DropItem( leather );
                                from.SendLocalizedMessage( 500471 ); // You skin it, and the hides are now in the corpse.
                            }
                            else
                                from.SendLocalizedMessage( 1073555 ); // You skin it and place the cut-up hides in your backpack.
                        }
                    }
                    else
                    {
                        if ( HideType == HideType.Regular )
                            corpse.DropItem( new Hides( hides ) );
                        else if ( HideType == HideType.Spined )
                            corpse.DropItem( new SpinedHides( hides ) );
                        else if ( HideType == HideType.Horned )
                            corpse.DropItem( new HornedHides( hides ) );
                        else if ( HideType == HideType.Barbed )
                            corpse.DropItem( new BarbedHides( hides ) );

                        from.SendLocalizedMessage( 500471 ); // You skin it, and the hides are now in the corpse.
                    }
                }

                if ( scales != 0 )
                {
                    ScaleType sc = this.ScaleType;

                    switch ( sc )
                    {
                        case ScaleType.Red:     corpse.AddCarvedItem( new RedScales( scales ), from ); break;
                        case ScaleType.Yellow:  corpse.AddCarvedItem( new YellowScales( scales ), from ); break;
                        case ScaleType.Black:   corpse.AddCarvedItem( new BlackScales( scales ), from ); break;
                        case ScaleType.Green:   corpse.AddCarvedItem( new GreenScales( scales ), from ); break;
                        case ScaleType.White:   corpse.AddCarvedItem( new WhiteScales( scales ), from ); break;
                        case ScaleType.Blue:    corpse.AddCarvedItem( new BlueScales( scales ), from ); break;
                        case ScaleType.All:
                        {
                            corpse.AddCarvedItem( new RedScales( scales ), from );
                            corpse.AddCarvedItem( new YellowScales( scales ), from );
                            corpse.AddCarvedItem( new BlackScales( scales ), from );
                            corpse.AddCarvedItem( new GreenScales( scales ), from );
                            corpse.AddCarvedItem( new WhiteScales( scales ), from );
                            corpse.AddCarvedItem( new BlueScales( scales ), from );
                            break;
                        }
                    }

                    from.SendMessage( "You cut away some scales, but they remain on the corpse." );
                }

                corpse.Carved = true;

                if ( corpse.IsCriminalAction( from ) )
                    from.CriminalAction( true );
            }
        }
Example #22
0
        public override void OnDoubleClick( Mobile from )
        {
            if ( m_TeamInfo != null && m_TeamInfo.Game != null )
            {
                CTFTeamInfo ourTeam = m_TeamInfo;
                CTFTeamInfo useTeam = m_TeamInfo.Game.GetTeamInfo( from );

                if ( ourTeam == null || useTeam == null )
                    return;

                if ( IsChildOf( from.Backpack ) )
                {
                    from.BeginTarget( 1, false, TargetFlags.None, new TargetCallback( Flag_OnTarget ) );
                }
                else if ( !from.InRange( this, 1 ) || !from.InLOS( this ) )
                {
                    from.LocalOverheadMessage( MessageType.Regular, 0x26, 1019045 ); // I can't reach that
                }
                else if ( ourTeam == useTeam )
                {
                    if ( this.Location == m_TeamInfo.Origin && this.Map == m_TeamInfo.Game.Facet )
                    {
                        from.Send( new UnicodeMessage( this.Serial, this.ItemID, MessageType.Regular, 0x3B2, 3, "ENU", this.Name, "Touch me not for I am chaste." ) );
                    }
                    else
                    {
                        CTFPlayerInfo playerInfo = useTeam[from];

                        if ( playerInfo != null )
                            playerInfo.Score += 4; // return

                        m_Returner = from;
                        m_ReturnTime = DateTime.Now;

                        SendHome();

                        from.LocalOverheadMessage( MessageType.Regular, 0x59, false, "You returned the flag!" );
                        m_TeamInfo.Game.Alert( "The {1} flag has been returned by {0}.", from.Name, ourTeam.Name );
                    }
                }
                else if ( !from.PlaceInBackpack( this ) )
                {
                    from.LocalOverheadMessage( MessageType.Regular, 0x26, false, "I can't hold that." );
                }
                else
                {
                    from.RevealingAction();

                    from.LocalOverheadMessage( MessageType.Regular, 0x59, false, "You stole the flag!" );
                    m_TeamInfo.Game.Alert( "The {1} flag has been stolen by {0} ({2}).", from.Name, ourTeam.Name, useTeam.Name );

                    BeginCountdown( 120 );
                }
            }
        }
		public override bool Give( Mobile m, Item item, bool placeAtFeet )
		{
			if ( m.Skills.Lumberjacking.Value >= 100 )
			{				
				if ( Utility.RandomDouble() < 0.15 )
				{					
					Item sitem = null;
					int message = 0;
					double chance = Utility.RandomDouble();
					
					if ( chance < 0.0025 ) // not completely sure
					{
						sitem = new BrilliantAmber();
						message = 1072551; // You found a brilliant amber!
					}
					else if ( chance < 0.05 )
					{
						sitem = new ParasiticPlant();
						message = 1072549; // You found a parasitic plant!
					}
					else if ( chance < 0.35 )		
					{
						if ( Utility.RandomBool() )
						{
							sitem = new SwitchItem();
							message = 1072547; // You found a switch!
						}
						else
						{
							sitem = new LuminescentFungi();
							message = 1072550; // You found a luminescent fungi!
						}
					}			
					else
					{
						sitem = new BarkFragment();
						message = 1072548; // You found a bark fragment!
					}	
					
					if ( !m.PlaceInBackpack( sitem ) )
					{						
						if ( placeAtFeet )
						{
							List<Item> atFeet = new List<Item>();
		
							foreach ( Item obj in m.GetItemsInRange( 0 ) )
								atFeet.Add( obj );
				
							for ( int i = 0; i < atFeet.Count; ++i )
							{
								Item check = atFeet[i];
				
								if ( check.StackWith( m, sitem, false ) )
								{
									m.SendLocalizedMessage( message );
									return base.Give( m, item, placeAtFeet );
								}
							}
				
							sitem.MoveToWorld( m.Location, m.Map );
							m.SendLocalizedMessage( message );
						}
						else
							sitem.Delete();
					}
					else	
						m.SendLocalizedMessage( message );
				}				
			}			
			
			return base.Give( m, item, placeAtFeet );
		}
Example #24
0
		public void CompleteCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CustomCraft customCraft )
		{
			int badCraft = craftSystem.CanCraft( from, tool, m_Type );

			if ( badCraft > 0 )
			{
				if ( tool != null && !tool.Deleted && tool.UsesRemaining > 0 )
					from.SendGump( new CraftGump( from, craftSystem, tool, badCraft ) );
				else
					from.SendLocalizedMessage( badCraft );

				return;
			}

			int checkResHue = 0, checkMaxAmount = 0;
			object checkMessage = null;

			// Not enough resource to craft it
			if ( !ConsumeRes( from, typeRes, craftSystem, ref checkResHue, ref checkMaxAmount, ConsumeType.None, ref checkMessage ) )
			{
				if ( tool != null && !tool.Deleted && tool.UsesRemaining > 0 )
					from.SendGump( new CraftGump( from, craftSystem, tool, checkMessage ) );
				else if ( checkMessage is int && (int)checkMessage > 0 )
					from.SendLocalizedMessage( (int)checkMessage );
				else if ( checkMessage is string )
					from.SendMessage( (string)checkMessage );

				return;
			}
			else if ( !ConsumeAttributes( from, ref checkMessage, false ) )
			{
				if ( tool != null && !tool.Deleted && tool.UsesRemaining > 0 )
					from.SendGump( new CraftGump( from, craftSystem, tool, checkMessage ) );
				else if ( checkMessage is int && (int)checkMessage > 0 )
					from.SendLocalizedMessage( (int)checkMessage );
				else if ( checkMessage is string )
					from.SendMessage( (string)checkMessage );

				return;
			}

			bool toolBroken = false;

			int ignored = 1;
			int endquality = 1;

			bool allRequiredSkills = true;

			if ( CheckSkills( from, typeRes, craftSystem, ref ignored, ref allRequiredSkills ) )
			{
				// Resource
				int resHue = 0;
				int maxAmount = 0;

				object message = null;

				// Not enough resource to craft it
				if ( !ConsumeRes( from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref message ) )
				{
					if ( tool != null && !tool.Deleted && tool.UsesRemaining > 0 )
						from.SendGump( new CraftGump( from, craftSystem, tool, message ) );
					else if ( message is int && (int)message > 0 )
						from.SendLocalizedMessage( (int)message );
					else if ( message is string )
						from.SendMessage( (string)message );

					return;
				}
				else if ( !ConsumeAttributes( from, ref message, true ) )
				{
					if ( tool != null && !tool.Deleted && tool.UsesRemaining > 0 )
						from.SendGump( new CraftGump( from, craftSystem, tool, message ) );
					else if ( message is int && (int)message > 0 )
						from.SendLocalizedMessage( (int)message );
					else if ( message is string )
						from.SendMessage( (string)message );

					return;
				}

				tool.UsesRemaining--;

				if ( craftSystem is DefBlacksmithy )
				{
					AncientSmithyHammer hammer = from.FindItemOnLayer( Layer.OneHanded ) as AncientSmithyHammer;
					
					if ( hammer != null && hammer != tool )
					{
						// Genova: suporte ao UO:ML.												
						#region Mondain's Legacy
						if ( hammer is HammerOfHephaestus )
						{
							if ( hammer.UsesRemaining > 0 )
								hammer.UsesRemaining--;
							
							if ( hammer.UsesRemaining < 1 )
								from.PlaceInBackpack( hammer );
						}
						else
						{						
							hammer.UsesRemaining--;
							
							if ( hammer.UsesRemaining < 1 )
								hammer.Delete();
						}
						#endregion
					}
				}

				// Genova: suporte ao UO:ML.					
				#region Mondain's Legacy
				if ( tool is HammerOfHephaestus )
				{
					if ( tool.UsesRemaining < 1 )
						tool.UsesRemaining = 0;
				}
				else
				{
					if ( tool.UsesRemaining < 1 )
						toolBroken = true;
	
					if ( toolBroken )
						tool.Delete();
				}
				#endregion
				
				int num = 0;

				Item item;
				if ( customCraft != null )
				{
					item = customCraft.CompleteCraft( out num );
				}
				else if ( typeof( MapItem ).IsAssignableFrom( ItemType ) && from.Map != Map.Trammel && from.Map != Map.Felucca )
				{
					item = new IndecipherableMap();
					from.SendLocalizedMessage( 1070800 ); // The map you create becomes mysteriously indecipherable.
				}
				else
				{
					item = Activator.CreateInstance( ItemType ) as Item;
				}

				if ( item != null )
				{
					// Genova: suporte ao UO:ML.
					#region Mondain's Legacy
					if ( item is Board )
					{
						Type resourceType = typeRes;
						
						if ( resourceType == null )
							resourceType = Ressources.GetAt( 0 ).ItemType;

						CraftResource thisResource = CraftResources.GetFromType( resourceType );
						
						switch ( thisResource )
						{
							case CraftResource.OakWood:		item = new OakBoard(); break;
							case CraftResource.AshWood:		item = new AshBoard(); break;
							case CraftResource.YewWood:		item = new YewBoard(); break;
							case CraftResource.Heartwood: 	item = new HeartwoodBoard(); break;
							case CraftResource.Bloodwood: 	item = new BloodwoodBoard(); break;
							case CraftResource.Frostwood: 	item = new FrostwoodBoard(); break;							
							default: item = new Board(); break;
						}					
					}
					#endregion
					
					if( item is ICraftable )
						endquality = ((ICraftable)item).OnCraft( quality, makersMark, from, craftSystem, typeRes, tool, this, resHue );
					else if ( item.Hue == 0 )
						item.Hue = resHue;

					if ( maxAmount > 0 )
					{
						if ( !item.Stackable && item is IUsesRemaining )
							((IUsesRemaining)item).UsesRemaining *= maxAmount;
						else
							item.Amount = maxAmount;
					}

					from.AddToBackpack( item );

					if( from.AccessLevel > AccessLevel.Player )
						CommandLogging.WriteLine( from, "Crafting {0} with craft system {1}", CommandLogging.Format( item ), craftSystem.GetType().Name );

					//from.PlaySound( 0x57 );
				}

				if ( num == 0 )
					num = craftSystem.PlayEndingEffect( from, false, true, toolBroken, endquality, makersMark, this );

				bool queryFactionImbue = false;
				int availableSilver = 0;
				FactionItemDefinition def = null;
				Faction faction = null;

				if ( item is IFactionItem )
				{
					def = FactionItemDefinition.Identify( item );

					if ( def != null )
					{
						faction = Faction.Find( from );

						if ( faction != null )
						{
							Town town = Town.FromRegion( from.Region );

							if ( town != null && town.Owner == faction )
							{
								Container pack = from.Backpack;

								if ( pack != null )
								{
									availableSilver = pack.GetAmount( typeof( Silver ) );

									if ( availableSilver >= def.SilverCost )
										queryFactionImbue = Faction.IsNearType( from, def.VendorType, 12 );
								}
							}
						}
					}
				}

				// TODO: Scroll imbuing

				if ( queryFactionImbue )
					from.SendGump( new FactionImbueGump( quality, item, from, craftSystem, tool, num, availableSilver, faction, def ) );
				else if ( tool != null && !tool.Deleted && tool.UsesRemaining > 0 )
					from.SendGump( new CraftGump( from, craftSystem, tool, num ) );
				else if ( num > 0 )
					from.SendLocalizedMessage( num );
			}
			else if ( !allRequiredSkills )
			{
				if ( tool != null && !tool.Deleted && tool.UsesRemaining > 0 )
					from.SendGump( new CraftGump( from, craftSystem, tool, 1044153 ) );
				else
					from.SendLocalizedMessage( 1044153 ); // You don't have the required skills to attempt this item.
			}
			else
			{
				ConsumeType consumeType = ( UseAllRes ? ConsumeType.Half : ConsumeType.All );
				int resHue = 0;
				int maxAmount = 0;

				object message = null;

				// Not enough resource to craft it
				if ( !ConsumeRes( from, typeRes, craftSystem, ref resHue, ref maxAmount, consumeType, ref message, true ) )
				{
					if ( tool != null && !tool.Deleted && tool.UsesRemaining > 0 )
						from.SendGump( new CraftGump( from, craftSystem, tool, message ) );
					else if ( message is int && (int)message > 0 )
						from.SendLocalizedMessage( (int)message );
					else if ( message is string )
						from.SendMessage( (string)message );

					return;
				}

				tool.UsesRemaining--;

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

				if ( toolBroken )
					tool.Delete();

				// SkillCheck failed.
				int num = craftSystem.PlayEndingEffect( from, true, true, toolBroken, endquality, false, this );

				if ( tool != null && !tool.Deleted && tool.UsesRemaining > 0 )
					from.SendGump( new CraftGump( from, craftSystem, tool, num ) );
				else if ( num > 0 )
					from.SendLocalizedMessage( num );
			}
		}
Example #25
0
        public static void Award( Mobile to )
        {
            RewardInfo info = m_Rewards[Utility.Random( m_Rewards.Length )];

            Item reward = (Item) Activator.CreateInstance( info.Type );

            to.PlaceInBackpack( reward );
            to.SendLocalizedMessage( 1074360, String.Format( "#{0}", info.Cliloc.ToString() ) ); // You receive a reward: ~1_REWARD~
        }
		public override bool OnDragDrop( Mobile from, Item dropped )
		{
			if ( dropped is BlankScroll && UzeraanTurmoilQuest.HasLostScrollOfPower( from ) )
			{
				FocusTo( from );

				Item scroll = new SchmendrickScrollOfPower();

				if ( !from.PlaceInBackpack( scroll ) )
				{
					scroll.Delete();
					from.SendLocalizedMessage( 1046260 ); // You need to clear some space in your inventory to continue with the quest.  Come back here when you have more space in your inventory.
					return false;
				}
				else
				{
					dropped.Consume();
					from.SendLocalizedMessage( 1049346 ); // Schmendrick scribbles on the scroll for a few moments and hands you the finished product.
					return dropped.Deleted;
				}
			}

			return base.OnDragDrop( from, dropped );
		}
Example #27
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();
                        }
                    }
                }
            }
        }
Example #28
0
		public virtual bool Give( Mobile m, Item item, bool placeAtFeet )
		{
			if ( m.PlaceInBackpack( item ) )
				return true;

			if ( !placeAtFeet )
				return false;

			Map map = m.Map;

			if ( map == null )
				return false;

			List<Item> atFeet = new List<Item>();

			foreach ( Item obj in m.GetItemsInRange( 0 ) )
				atFeet.Add( obj );

			for ( int i = 0; i < atFeet.Count; ++i )
			{
				Item check = atFeet[i];

				if ( check.StackWith( m, item, false ) )
					return true;
			}

			item.MoveToWorld( m.Location, map );
			return true;
		}
Example #29
0
        private bool TakeBomb( Mobile m, BRTeamInfo team, string verb )
        {
            if ( !m.Player || !m.Alive || m.NetState == null )
                return false;

            if ( m.PlaceInBackpack( this ) )
            {
                m.RevealingAction();

                m.LocalOverheadMessage( MessageType.Regular, 0x59, false, "You got the bomb!" );
                m_Game.Alert( "{1} ({2}) {0} the bomb!", verb, m.Name, team.Name );

                m.Target = new BombTarget( this, m );

                if ( m_Helpers.Contains( m ) )
                    m_Helpers.Remove( m );

                if ( m_Helpers.Count > 0 )
                {
                    Mobile last = (Mobile)m_Helpers[0];

                    if ( m_Game.GetTeamInfo( last ) != team )
                        m_Helpers.Clear();
                }

                m_Helpers.Add( m );

                return true;
            }
            else
            {
                return false;
            }
        }
			protected override void OnTarget( Mobile from, object targeted )
			{
				if ( m_PlantBowl.Deleted )
					return;

				if ( !m_PlantBowl.IsChildOf( from.Backpack ) )
				{
					from.SendLocalizedMessage( 1042664 ); // You must have the object in your backpack to use it.
					return;
				}

				if ( targeted is FertileDirt )
				{
					FertileDirt dirt = (FertileDirt)targeted;

					if ( !dirt.IsChildOf( from.Backpack ) )
					{
						from.SendLocalizedMessage( 1042664 ); // You must have the object in your backpack to use it.
					}
					else if ( dirt.Amount < 40 )
					{
						from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1061896 ); // You need more dirt to fill a plant bowl!
					}
					else
					{
						PlantItem fullBowl = new PlantItem( true );

						if ( from.PlaceInBackpack( fullBowl ) )
						{
							dirt.Consume( 40 );
							m_PlantBowl.Delete();

							from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1061895 ); // You fill the bowl with fresh dirt.
						}
						else
						{
							fullBowl.Delete();

							from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1061894 ); // There is no room in your backpack for a bowl full of dirt!
						}
					}
				}
				else if ( PlantBowl.IsDirtPatch( targeted ) )
				{
					PlantItem fullBowl = new PlantItem( false );

					if ( from.PlaceInBackpack( fullBowl ) )
					{
						m_PlantBowl.Delete();

						from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1061895 ); // You fill the bowl with fresh dirt.
					}
					else
					{
						fullBowl.Delete();

						from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1061894 ); // There is no room in your backpack for a bowl full of dirt!
					}
				}
				else
				{
					from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1061893 ); // You'll want to gather fresh dirt in order to raise a healthy plant!
				}
			}