///////////////////////////////////////////////////////// // Scripted by BKW of Awaken Lands, Future Online Game // // URL: www.awakenlands.com // // © 2004, By Fanatsy World Entertainment // ///////////////////////////////////////////////////////// /**********PLEASE DO NOT REMOVE THIS HEADER*************/ using System; using System.Collections; using Server; using Server.Items; using Server.Targeting; using Server.Mobiles; using Server.Network; using Server.Engines.Craft; namespace Server.Items { public class MagicalSapphire : Item { [Constructable] public MagicalSapphire() : this( 1 ) { } [Constructable] public MagicalSapphire( int amount ) : base( 0xF19 ) { Name = "gem of Sapphire"; Stackable = true; Weight = 0.1; Amount = amount; } public MagicalSapphire( Serial serial ) : base( serial ) { } public override void OnDoubleClick( Mobile from ) { if ( !IsChildOf( from.Backpack ) ) { from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it. } else { from.SendMessage ( 1172, "Target a jewelry item." ); from.Target = new EnchancementTarget(this); } } private class EnchancementTarget : Target { private MagicalSapphire m_gem; public EnchancementTarget( MagicalSapphire gem ) : base( 6, true, TargetFlags.None ) { m_gem = gem; } protected override void OnTarget( Mobile from, object o ) { Container pack = from.Backpack; BaseMagicJewel BaseMagicJewel = o as BaseMagicJewel; if ( o != null ) { if ( o is BaseMagicJewel ) { if ( BaseMagicJewel != null && BaseMagicJewel.MagGemType == MagGemType.None ) { if ( BaseMagicJewel.MineralType != MagicalMineralType.Magical ) { if ( BaseMagicJewel.MineralType == MagicalMineralType.Copper ) { if ( .8 > Utility.RandomDouble() ) { BaseMagicJewel.Attributes.BonusMana = 2; BaseMagicJewel.Hue = 298; BaseMagicJewel.MagGemType = MagGemType.Sapphire; pack.ConsumeTotal( typeof( MagicalSapphire ), 1 ); from.SendMessage ( 1172 ,"You successfully add the Sapphire to your jewerly." ); } else { from.SendMessage ( 1172 ,"You fail to add the Sapphire to your jewerly, which destorying the ring and the gem." ); ((Item)o).Delete(); pack.ConsumeTotal( typeof( MagicalSapphire ), 1 ); } } else if ( BaseMagicJewel.MineralType == MagicalMineralType.Silver ) { if ( .6 > Utility.RandomDouble() ) { BaseMagicJewel.Attributes.BonusMana = 4; BaseMagicJewel.Hue = 298; BaseMagicJewel.MagGemType = MagGemType.Sapphire; pack.ConsumeTotal( typeof( MagicalSapphire ), 1 ); from.SendMessage ( 1172 ,"You successfully add the Sapphire to your jewerly." ); } else { from.SendMessage ( 1172 ,"You fail to add the Sapphire to your jewerly, which destorying the ring and the gem." ); ((Item)o).Delete(); pack.ConsumeTotal( typeof( MagicalSapphire ), 1 ); } } else if ( BaseMagicJewel.MineralType == MagicalMineralType.Golden ) { if ( .4 > Utility.RandomDouble() ) { BaseMagicJewel.Attributes.BonusMana = 8; BaseMagicJewel.Hue = 298; BaseMagicJewel.MagGemType = MagGemType.Sapphire; pack.ConsumeTotal( typeof( MagicalSapphire ), 1 ); from.SendMessage ( 1172 ,"You successfully add the Sapphire to your jewerly." ); } else { from.SendMessage ( 1172 ,"You fail to add the Sapphire to your jewerly, which destorying the ring and the gem." ); ((Item)o).Delete(); pack.ConsumeTotal( typeof( MagicalSapphire ), 1 ); } } else if ( BaseMagicJewel.MineralType == MagicalMineralType.Platinum ) { if ( .2 > Utility.RandomDouble() ) { BaseMagicJewel.Attributes.BonusMana = 16; BaseMagicJewel.Hue = 298; BaseMagicJewel.MagGemType = MagGemType.Sapphire; pack.ConsumeTotal( typeof( MagicalSapphire ), 1 ); from.SendMessage ( 1172 ,"You successfully add the Sapphire to your jewerly." ); } else { from.SendMessage ( 1172 ,"You fail to add the Sapphire to your jewerly, which destorying the ring and the gem." ); ((Item)o).Delete(); pack.ConsumeTotal( typeof( MagicalSapphire ), 1 ); } } else { from.SendMessage ( 1172 ,"That item is not a craftable jewelry, You may not add the Sapphire to it!" ); } } else { from.SendMessage ( 1172 ,"Either that item is magically enchanted or you have already added the Sapphire to the jewerly." ); } } else { from.SendMessage ( 1172 ,"You have already added a special gem to the item, you may not add another one." ); } } else { from.SendMessage ( 1172 ,"That item is not a craftable jewelry, You may not add the Sapphire to it!" ); } } else { from.SendMessage ( 1172 ,"That item is not a craftable jewelry, You may not add the Sapphire to it!" ); } } } public override Item Dupe( int amount ) { return base.Dupe( new MagicalSapphire( amount ), amount ); } public override void Serialize( GenericWriter writer ) { base.Serialize( writer ); writer.Write( (int) 0 ); // version } public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); } } }