/*Scripted by _____ * \_ \___ ___ * / /\/ __/ _ \ * /\/ /_| (_| __/ * \____/ \___\___| * * This is a hoodable robe that will work * even if you change the itemid of it. * */ using System; using Server.Items; namespace Server.Items { public class CraftableHoodRobe : BaseArmor { /********************************/ private bool isHooded; //Creates info private int RobeID = 7939;//Creates info and sets it to a itemid /********************************/ [Constructable] public CraftableHoodRobe() : base( 7939 ) { isHooded = false; //Set the robes no hooded to start Weight = 10.0; Name = "Leather Hood Robe"; Hue = 1823; Layer = Layer.OuterTorso; } public CraftableHoodRobe( Serial serial ) : base( serial ) { } public override void OnDoubleClick( Mobile m ) { if( Parent != m ) { m.SendMessage( "You must be wearing the robe to use it!" ); } else { if( isHooded == true && (ItemID == 0x2683 || ItemID == 0x2684))//Checks if the robe iis hooded and it its the hooded itemid { m.SendMessage( "You lower the hood." ); m.PlaySound( 0x57 ); ItemID = this.RobeID;//saves the last itemid is this.isHooded = false;//tells the robes its no hooded m.RemoveItem(this); m.EquipItem(this); }else if ( isHooded == true && ( ItemID != 0x2683 || ItemID != 0x2684 ) )//checks it the robe isn't hooded and if it isn't the hooded itemid { m.SendMessage( "You pull the hood over your head." ); m.PlaySound( 0x57 ); this.RobeID = ItemID;//Saves the last itemid ItemID = 0x2683; this.isHooded = true;//tells the robe its hooded m.RemoveItem(this); m.EquipItem(this); } else if ( isHooded == false )// { m.SendMessage( "You pull the hood over your head." ); m.PlaySound( 0x57 ); this.RobeID = ItemID;///saves the last itemid ItemID = 0x2683; this.isHooded = true;//tells the robe its hooded m.RemoveItem(this); m.EquipItem(this); } } } public override void Serialize( GenericWriter writer ) { base.Serialize( writer ); writer.Write( (int) 0 ); writer.Write(RobeID); //World saves the robe itemid writer.Write(isHooded); //world saves the robes hooded info } public override void Deserialize(GenericReader reader) { base.Deserialize( reader ); int version = reader.ReadInt(); switch ( version ) //update the robes so anyother robes you use then on will no be deleted when u start the world { case 0: { RobeID = reader.ReadInt();//world loads the info isHooded = reader.ReadBool(); //world loads the info //goto case 1; } } } }