///////////////////////////////////////////////////////// // 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 MagicalDiamond : Item { [Constructable] public MagicalDiamond() : this( 1 ) { } [Constructable] public MagicalDiamond( int amount ) : base( 0xF26 ) { Name = "gem of Diamond"; Stackable = true; Weight = 0.1; Amount = amount; } public MagicalDiamond( 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 MagicalDiamond m_gem; public EnchancementTarget( MagicalDiamond 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.Resistances.Physical = 5; BaseMagicJewel.Resistances.Cold = 5; BaseMagicJewel.Resistances.Fire = 5; BaseMagicJewel.Resistances.Poison = 5; BaseMagicJewel.Resistances.Energy = 5; BaseMagicJewel.Hue = 101; BaseMagicJewel.MagGemType = MagGemType.Diamond; pack.ConsumeTotal( typeof( MagicalDiamond ), 1 ); from.SendMessage ( 1172 ,"You successfully add the Diamond to your jewerly." ); } else { from.SendMessage ( 1172 ,"You fail to add the Diamond to your jewerly, which destorying the ring and the gem." ); ((Item)o).Delete(); pack.ConsumeTotal( typeof( MagicalDiamond ), 1 ); } } else if ( BaseMagicJewel.MineralType == MagicalMineralType.Silver ) { if ( .6 > Utility.RandomDouble() ) { BaseMagicJewel.Resistances.Physical = 8; BaseMagicJewel.Resistances.Cold = 8; BaseMagicJewel.Resistances.Fire = 8; BaseMagicJewel.Resistances.Poison = 8; BaseMagicJewel.Resistances.Energy = 8; BaseMagicJewel.Hue = 101; BaseMagicJewel.MagGemType = MagGemType.Diamond; pack.ConsumeTotal( typeof( MagicalDiamond ), 1 ); from.SendMessage ( 1172 ,"You successfully add the Diamond to your jewerly." ); } else { from.SendMessage ( 1172 ,"You fail to add the Diamond to your jewerly, which destorying the ring and the gem." ); ((Item)o).Delete(); pack.ConsumeTotal( typeof( MagicalDiamond ), 1 ); } } else if ( BaseMagicJewel.MineralType == MagicalMineralType.Golden ) { if ( .4 > Utility.RandomDouble() ) { BaseMagicJewel.Resistances.Physical = 10; BaseMagicJewel.Resistances.Cold = 10; BaseMagicJewel.Resistances.Fire = 10; BaseMagicJewel.Resistances.Poison = 10; BaseMagicJewel.Resistances.Energy = 10; BaseMagicJewel.Hue = 101; BaseMagicJewel.MagGemType = MagGemType.Diamond; pack.ConsumeTotal( typeof( MagicalDiamond ), 1 ); from.SendMessage ( 1172 ,"You successfully add the Diamond to your jewerly." ); } else { from.SendMessage ( 1172 ,"You fail to add the Diamond to your jewerly, which destorying the ring and the gem." ); ((Item)o).Delete(); pack.ConsumeTotal( typeof( MagicalDiamond ), 1 ); } } else if ( BaseMagicJewel.MineralType == MagicalMineralType.Platinum ) { if ( .2 > Utility.RandomDouble() ) { BaseMagicJewel.Resistances.Physical = 12; BaseMagicJewel.Resistances.Cold = 12; BaseMagicJewel.Resistances.Fire = 12; BaseMagicJewel.Resistances.Poison = 12; BaseMagicJewel.Resistances.Energy = 12; BaseMagicJewel.Hue = 101; BaseMagicJewel.MagGemType = MagGemType.Diamond; pack.ConsumeTotal( typeof( MagicalDiamond ), 1 ); from.SendMessage ( 1172 ,"You successfully add the Diamond to your jewerly." ); } else { from.SendMessage ( 1172 ,"You fail to add the Diamond to your jewerly, which destorying the ring and the gem." ); ((Item)o).Delete(); pack.ConsumeTotal( typeof( MagicalDiamond ), 1 ); } } else { from.SendMessage ( 1172 ,"That item is not a craftable jewelry, You may not add the Diamond to it!" ); } } else { from.SendMessage ( 1172 ,"Either that item is magically enchanted or you have already added the Diamond 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 Diamond to it!" ); } } else { from.SendMessage ( 1172 ,"That item is not a craftable jewelry, You may not add the Diamond to it!" ); } } } public override Item Dupe( int amount ) { return base.Dupe( new MagicalDiamond( 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(); } } }