RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Working Name Change Deed

batarex

Sorceror
Working Name Change Deed

I tried to use the name chage deed and noticed that it still didn't work so i decided to mdify it using the one that was posted for shards with races. I don't remember who made the script but this is just a quick mod of thier script.

NameChangeDeed.CS
Code:
using System; 
using Server.Network; 
using Server.Prompts; 
using Server.Mobiles; 
using Server.Misc; 
using Server.Items; 

namespace Server.Items 
{ 
   public class NameChangeDeed : Item 
   { 
      [Constructable] 
      public NameChangeDeed() : base( 0x14F0 ) 
      { 
         base.Weight = 1.0; 
         base.Name = "a name change deed"; 
      } 

      public NameChangeDeed( Serial serial ) : base( serial ) 
      { 
      } 

      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(); 
      } 

      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( "Enter your desired name." ); 
            from.Prompt = new RenamePrompt( from ); 
            this.Delete(); 
         } 
      } 

      private class RenamePrompt : Prompt 
      { 
         private Mobile m_from; 

         public RenamePrompt( Mobile from ) 
         { 
            m_from = from; 
         } 

         public override void OnResponse( Mobile from, string text ) 
         { 
                                PlayerMobile pm = (PlayerMobile) from; 
            text = text.Trim(); 
            if ( !NameVerification.Validate( text, 2, 16, true, true, true, 1, NameVerification.SpaceDashPeriodQuote ) ) 
               return; 

	    pm.Name = text + "" ;                                
            pm.SendMessage( "You will be hence forth know as {0}", text ); 
         } 
      } 
   } 
}
 
Top