From 22200b706b4ffc113e76ead452b0ba262a1f457c Mon Sep 17 00:00:00 2001 From: ravenal Date: Tue, 20 Oct 2009 04:04:11 +0000 Subject: [PATCH] Fixed the crazy Formatting on BaseEscortable. --- Scripts/Mobiles/Townfolk/BaseEscortable.cs | 438 ++++++++++----------- 1 file changed, 219 insertions(+), 219 deletions(-) diff --git a/Scripts/Mobiles/Townfolk/BaseEscortable.cs b/Scripts/Mobiles/Townfolk/BaseEscortable.cs index 60ba8fb55..d3ace60da 100644 --- a/Scripts/Mobiles/Townfolk/BaseEscortable.cs +++ b/Scripts/Mobiles/Townfolk/BaseEscortable.cs @@ -19,11 +19,11 @@ namespace Server.Mobiles public override bool Commandable { get { return false; } } // Our master cannot boss us around! - [CommandProperty(AccessLevel.GameMaster)] + [CommandProperty( AccessLevel.GameMaster )] public string Destination { get { return m_Destination == null ? null : m_Destination.Name; } - set { m_DestinationString = value; m_Destination = EDI.Find(value); } + set { m_DestinationString = value; m_Destination = EDI.Find( value ); } } private static string[] m_TownNames = new string[] @@ -42,7 +42,7 @@ namespace Server.Mobiles [Constructable] public BaseEscortable() - : base(AIType.AI_Melee, FightMode.Aggressor, 22, 1, 0.2, 1.0) + : base( AIType.AI_Melee, FightMode.Aggressor, 22, 1, 0.2, 1.0 ) { InitBody(); InitOutfit(); @@ -50,53 +50,53 @@ namespace Server.Mobiles public virtual void InitBody() { - SetStr(90, 100); - SetDex(90, 100); - SetInt(15, 25); + SetStr( 90, 100 ); + SetDex( 90, 100 ); + SetInt( 15, 25 ); Hue = Utility.RandomSkinHue(); - if (Female = Utility.RandomBool()) + if( Female = Utility.RandomBool() ) { - Body = 401; - Name = NameList.RandomName("female"); + Body = 401; + Name = NameList.RandomName( "female" ); } else { - Body = 400; - Name = NameList.RandomName("male"); + Body = 400; + Name = NameList.RandomName( "male" ); } } public virtual void InitOutfit() { - AddItem(new FancyShirt(Utility.RandomNeutralHue())); - AddItem(new ShortPants(Utility.RandomNeutralHue())); - AddItem(new Boots(Utility.RandomNeutralHue())); + AddItem( new FancyShirt( Utility.RandomNeutralHue() ) ); + AddItem( new ShortPants( Utility.RandomNeutralHue() ) ); + AddItem( new Boots( Utility.RandomNeutralHue() ) ); - Utility.AssignRandomHair(this); + Utility.AssignRandomHair( this ); - PackGold(200, 250); + PackGold( 200, 250 ); } - public virtual bool SayDestinationTo(Mobile m) + public virtual bool SayDestinationTo( Mobile m ) { EDI dest = GetDestination(); - if (dest == null || !m.Alive) - return false; + if( dest == null || !m.Alive ) + return false; Mobile escorter = GetEscorter(); - if (escorter == null) + if( escorter == null ) { - Say("I am looking to go to {0}, will you take me?", (dest.Name == "Ocllo" && m.Map == Map.Trammel) ? "Haven" : dest.Name); - return true; + Say( "I am looking to go to {0}, will you take me?", (dest.Name == "Ocllo" && m.Map == Map.Trammel) ? "Haven" : dest.Name ); + return true; } - else if (escorter == m) + else if( escorter == m ) { - Say("Lead on! Payment will be made when we arrive in {0}.", (dest.Name == "Ocllo" && m.Map == Map.Trammel) ? "Haven" : dest.Name); - return true; + Say( "Lead on! Payment will be made when we arrive in {0}.", (dest.Name == "Ocllo" && m.Map == Map.Trammel) ? "Haven" : dest.Name ); + return true; } return false; @@ -109,77 +109,77 @@ namespace Server.Mobiles get { return m_EscortTable; } } - private static TimeSpan m_EscortDelay = TimeSpan.FromMinutes(5.0); + private static TimeSpan m_EscortDelay = TimeSpan.FromMinutes( 5.0 ); - public virtual bool AcceptEscorter(Mobile m) + public virtual bool AcceptEscorter( Mobile m ) { EDI dest = GetDestination(); - if (dest == null) - return false; + if( dest == null ) + return false; Mobile escorter = GetEscorter(); - if (escorter != null || !m.Alive) - return false; + if( escorter != null || !m.Alive ) + return false; BaseEscortable escortable = (BaseEscortable)m_EscortTable[m]; - if (escortable != null && !escortable.Deleted && escortable.GetEscorter() == m) + if( escortable != null && !escortable.Deleted && escortable.GetEscorter() == m ) { - Say("I see you already have an escort."); - return false; + Say( "I see you already have an escort." ); + return false; } - else if (m is PlayerMobile && (((PlayerMobile)m).LastEscortTime + m_EscortDelay) >= DateTime.Now) + else if( m is PlayerMobile && (((PlayerMobile)m).LastEscortTime + m_EscortDelay) >= DateTime.Now ) { - int minutes = (int)Math.Ceiling(((((PlayerMobile)m).LastEscortTime + m_EscortDelay) - DateTime.Now).TotalMinutes); + int minutes = (int)Math.Ceiling( ((((PlayerMobile)m).LastEscortTime + m_EscortDelay) - DateTime.Now).TotalMinutes ); - Say("You must rest {0} minute{1} before we set out on this journey.", minutes, minutes == 1 ? "" : "s"); - return false; + Say( "You must rest {0} minute{1} before we set out on this journey.", minutes, minutes == 1 ? "" : "s" ); + return false; } - else if (SetControlMaster(m)) + else if( SetControlMaster( m ) ) { - m_LastSeenEscorter = DateTime.Now; + m_LastSeenEscorter = DateTime.Now; - if (m is PlayerMobile) - ((PlayerMobile)m).LastEscortTime = DateTime.Now; + if( m is PlayerMobile ) + ((PlayerMobile)m).LastEscortTime = DateTime.Now; - Say("Lead on! Payment will be made when we arrive in {0}.", (dest.Name == "Ocllo" && m.Map == Map.Trammel) ? "Haven" : dest.Name); - m_EscortTable[m] = this; - StartFollow(); - return true; + Say( "Lead on! Payment will be made when we arrive in {0}.", (dest.Name == "Ocllo" && m.Map == Map.Trammel) ? "Haven" : dest.Name ); + m_EscortTable[m] = this; + StartFollow(); + return true; } return false; } - public override bool HandlesOnSpeech(Mobile from) + public override bool HandlesOnSpeech( Mobile from ) { - if (from.InRange(this.Location, 3)) - return true; + if( from.InRange( this.Location, 3 ) ) + return true; - return base.HandlesOnSpeech(from); + return base.HandlesOnSpeech( from ); } - public override void OnSpeech(SpeechEventArgs e) + public override void OnSpeech( SpeechEventArgs e ) { - base.OnSpeech(e); + base.OnSpeech( e ); EDI dest = GetDestination(); - if (dest != null && !e.Handled && e.Mobile.InRange(this.Location, 3)) + if( dest != null && !e.Handled && e.Mobile.InRange( this.Location, 3 ) ) { - if (e.HasKeyword(0x1D)) // *destination* - e.Handled = SayDestinationTo(e.Mobile); - else if (e.HasKeyword(0x1E)) // *i will take thee* - e.Handled = AcceptEscorter(e.Mobile); + if( e.HasKeyword( 0x1D ) ) // *destination* + e.Handled = SayDestinationTo( e.Mobile ); + else if( e.HasKeyword( 0x1E ) ) // *i will take thee* + e.Handled = AcceptEscorter( e.Mobile ); } } public override void OnAfterDelete() { - if (m_DeleteTimer != null) - m_DeleteTimer.Stop(); + if( m_DeleteTimer != null ) + m_DeleteTimer.Stop(); m_DeleteTimer = null; @@ -192,10 +192,10 @@ namespace Server.Mobiles CheckAtDestination(); } - protected override bool OnMove(Direction d) + protected override bool OnMove( Direction d ) { - if (!base.OnMove(d)) - return false; + if( !base.OnMove( d ) ) + return false; CheckAtDestination(); @@ -204,13 +204,13 @@ namespace Server.Mobiles public virtual void StartFollow() { - StartFollow(GetEscorter()); + StartFollow( GetEscorter() ); } - public virtual void StartFollow(Mobile escorter) + public virtual void StartFollow( Mobile escorter ) { - if (escorter == null) - return; + if( escorter == null ) + return; ActiveSpeed = 0.1; PassiveSpeed = 0.2; @@ -236,40 +236,40 @@ namespace Server.Mobiles public virtual Mobile GetEscorter() { - if (!Controlled) - return null; + if( !Controlled ) + return null; Mobile master = ControlMaster; - if (master == null) - return null; - - if (master.Deleted || master.Map != this.Map || !master.InRange(Location, 30) || !master.Alive) - { - StopFollow(); - - TimeSpan lastSeenDelay = DateTime.Now - m_LastSeenEscorter; - - if (lastSeenDelay >= TimeSpan.FromMinutes(2.0)) - { - master.SendLocalizedMessage(1042473); // You have lost the person you were escorting. - Say(1005653); // Hmmm. I seem to have lost my master. - - SetControlMaster(null); - m_EscortTable.Remove(master); - - Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerCallback(Delete)); + if( master == null ) return null; - } - else + + if( master.Deleted || master.Map != this.Map || !master.InRange( Location, 30 ) || !master.Alive ) { - ControlOrder = OrderType.Stay; - return master; - } + StopFollow(); + + TimeSpan lastSeenDelay = DateTime.Now - m_LastSeenEscorter; + + if( lastSeenDelay >= TimeSpan.FromMinutes( 2.0 ) ) + { + master.SendLocalizedMessage( 1042473 ); // You have lost the person you were escorting. + Say( 1005653 ); // Hmmm. I seem to have lost my master. + + SetControlMaster( null ); + m_EscortTable.Remove( master ); + + Timer.DelayCall( TimeSpan.FromSeconds( 5.0 ), new TimerCallback( Delete ) ); + return null; + } + else + { + ControlOrder = OrderType.Stay; + return master; + } } - if (ControlOrder != OrderType.Follow) - StartFollow(master); + if( ControlOrder != OrderType.Follow ) + StartFollow( master ); m_LastSeenEscorter = DateTime.Now; return master; @@ -277,12 +277,12 @@ namespace Server.Mobiles public virtual void BeginDelete() { - if (m_DeleteTimer != null) - m_DeleteTimer.Stop(); + if( m_DeleteTimer != null ) + m_DeleteTimer.Stop(); - m_DeleteTime = DateTime.Now + TimeSpan.FromSeconds(30.0); + m_DeleteTime = DateTime.Now + TimeSpan.FromSeconds( 30.0 ); - m_DeleteTimer = new DeleteTimer(this, m_DeleteTime - DateTime.Now); + m_DeleteTimer = new DeleteTimer( this, m_DeleteTime - DateTime.Now ); m_DeleteTimer.Start(); } @@ -290,166 +290,166 @@ namespace Server.Mobiles { EDI dest = GetDestination(); - if (dest == null) - return false; + if( dest == null ) + return false; Mobile escorter = GetEscorter(); - if (escorter == null) - return false; + if( escorter == null ) + return false; - if (dest.Contains(Location)) + if( dest.Contains( Location ) ) { - Say(1042809, escorter.Name); // We have arrived! I thank thee, ~1_PLAYER_NAME~! I have no further need of thy services. Here is thy pay. + Say( 1042809, escorter.Name ); // We have arrived! I thank thee, ~1_PLAYER_NAME~! I have no further need of thy services. Here is thy pay. - // not going anywhere - m_Destination = null; - m_DestinationString = null; + // not going anywhere + m_Destination = null; + m_DestinationString = null; - Container cont = escorter.Backpack; + Container cont = escorter.Backpack; - if (cont == null) - cont = escorter.BankBox; + if( cont == null ) + cont = escorter.BankBox; - Gold gold = new Gold(500, 1000); + Gold gold = new Gold( 500, 1000 ); - if (!cont.TryDropItem(escorter, gold, false)) - gold.MoveToWorld(escorter.Location, escorter.Map); + if( !cont.TryDropItem( escorter, gold, false ) ) + gold.MoveToWorld( escorter.Location, escorter.Map ); - StopFollow(); - SetControlMaster(null); - m_EscortTable.Remove(escorter); - BeginDelete(); + StopFollow(); + SetControlMaster( null ); + m_EscortTable.Remove( escorter ); + BeginDelete(); - Misc.Titles.AwardFame(escorter, 10, true); + Misc.Titles.AwardFame( escorter, 10, true ); - bool gainedPath = false; + bool gainedPath = false; - PlayerMobile pm = escorter as PlayerMobile; + PlayerMobile pm = escorter as PlayerMobile; - if (pm != null) - { - if (pm.CompassionGains > 0 && DateTime.Now > pm.NextCompassionDay) + if( pm != null ) { - pm.NextCompassionDay = DateTime.MinValue; - pm.CompassionGains = 0; + if( pm.CompassionGains > 0 && DateTime.Now > pm.NextCompassionDay ) + { + pm.NextCompassionDay = DateTime.MinValue; + pm.CompassionGains = 0; + } + + if( pm.CompassionGains >= 5 ) // have already gained 5 times in one day, can gain no more + { + pm.SendLocalizedMessage( 1053004 ); // You must wait about a day before you can gain in compassion again. + } + else if( VirtueHelper.Award( pm, VirtueName.Compassion, this.IsPrisoner ? 400 : 200, ref gainedPath ) ) + { + if( gainedPath ) + pm.SendLocalizedMessage( 1053005 ); // You have achieved a path in compassion! + else + pm.SendLocalizedMessage( 1053002 ); // You have gained in compassion. + + pm.NextCompassionDay = DateTime.Now + TimeSpan.FromDays( 1.0 ); // in one day CompassionGains gets reset to 0 + ++pm.CompassionGains; + } + else + { + pm.SendLocalizedMessage( 1053003 ); // You have achieved the highest path of compassion and can no longer gain any further. + } } - if (pm.CompassionGains >= 5) // have already gained 5 times in one day, can gain no more - { - pm.SendLocalizedMessage(1053004); // You must wait about a day before you can gain in compassion again. - } - else if (VirtueHelper.Award(pm, VirtueName.Compassion, this.IsPrisoner ? 400 : 200, ref gainedPath)) - { - if (gainedPath) - pm.SendLocalizedMessage(1053005); // You have achieved a path in compassion! - else - pm.SendLocalizedMessage(1053002); // You have gained in compassion. - - pm.NextCompassionDay = DateTime.Now + TimeSpan.FromDays(1.0); // in one day CompassionGains gets reset to 0 - ++pm.CompassionGains; - } - else - { - pm.SendLocalizedMessage(1053003); // You have achieved the highest path of compassion and can no longer gain any further. - } - } - - return true; + return true; } return false; } - public BaseEscortable(Serial serial) - : base(serial) + public BaseEscortable( Serial serial ) + : base( serial ) { } - public override void Serialize(GenericWriter writer) + public override void Serialize( GenericWriter writer ) { - base.Serialize(writer); + base.Serialize( writer ); - writer.Write((int)0); // version + writer.Write( (int)0 ); // version EDI dest = GetDestination(); - writer.Write(dest != null); + writer.Write( dest != null ); - if (dest != null) - writer.Write(dest.Name); + if( dest != null ) + writer.Write( dest.Name ); - writer.Write(m_DeleteTimer != null); + writer.Write( m_DeleteTimer != null ); - if (m_DeleteTimer != null) - writer.WriteDeltaTime(m_DeleteTime); + if( m_DeleteTimer != null ) + writer.WriteDeltaTime( m_DeleteTime ); } - public override void Deserialize(GenericReader reader) + public override void Deserialize( GenericReader reader ) { - base.Deserialize(reader); + base.Deserialize( reader ); int version = reader.ReadInt(); - if (reader.ReadBool()) - m_DestinationString = reader.ReadString(); // NOTE: We cannot EDI.Find here, regions have not yet been loaded :-( + if( reader.ReadBool() ) + m_DestinationString = reader.ReadString(); // NOTE: We cannot EDI.Find here, regions have not yet been loaded :-( - if (reader.ReadBool()) + if( reader.ReadBool() ) { - m_DeleteTime = reader.ReadDeltaTime(); - m_DeleteTimer = new DeleteTimer(this, m_DeleteTime - DateTime.Now); - m_DeleteTimer.Start(); + m_DeleteTime = reader.ReadDeltaTime(); + m_DeleteTimer = new DeleteTimer( this, m_DeleteTime - DateTime.Now ); + m_DeleteTimer.Start(); } } - public override bool CanBeRenamedBy(Mobile from) + public override bool CanBeRenamedBy( Mobile from ) { return (from.AccessLevel >= AccessLevel.GameMaster); } - public override void AddCustomContextEntries(Mobile from, List list) + public override void AddCustomContextEntries( Mobile from, List list ) { EDI dest = GetDestination(); - if (dest != null && from.Alive) + if( dest != null && from.Alive ) { - Mobile escorter = GetEscorter(); + Mobile escorter = GetEscorter(); - if (escorter == null || escorter == from) - list.Add(new AskDestinationEntry(this, from)); + if( escorter == null || escorter == from ) + list.Add( new AskDestinationEntry( this, from ) ); - if (escorter == null) - list.Add(new AcceptEscortEntry(this, from)); - else if (escorter == from) - list.Add(new AbandonEscortEntry(this, from)); + if( escorter == null ) + list.Add( new AcceptEscortEntry( this, from ) ); + else if( escorter == from ) + list.Add( new AbandonEscortEntry( this, from ) ); } - base.AddCustomContextEntries(from, list); + base.AddCustomContextEntries( from, list ); } public virtual string[] GetPossibleDestinations() { - if (!Core.ML) - return m_TownNames; + if( !Core.ML ) + return m_TownNames; else - return m_MLTownNames; + return m_MLTownNames; } public virtual string PickRandomDestination() { - if (Map.Felucca.Regions.Count == 0 || Map == null || Map == Map.Internal || Location == Point3D.Zero) - return null; // Not yet fully initialized + if( Map.Felucca.Regions.Count == 0 || Map == null || Map == Map.Internal || Location == Point3D.Zero ) + return null; // Not yet fully initialized string[] possible = GetPossibleDestinations(); string picked = null; - while (picked == null) + while( picked == null ) { - picked = possible[Utility.Random(possible.Length)]; - EDI test = EDI.Find(picked); + picked = possible[Utility.Random( possible.Length )]; + EDI test = EDI.Find( picked ); - if (test != null && test.Contains(Location)) - picked = null; + if( test != null && test.Contains( Location ) ) + picked = null; } return picked; @@ -457,14 +457,14 @@ namespace Server.Mobiles public EDI GetDestination() { - if (m_DestinationString == null && m_DeleteTimer == null) - m_DestinationString = PickRandomDestination(); + if( m_DestinationString == null && m_DeleteTimer == null ) + m_DestinationString = PickRandomDestination(); - if (m_Destination != null && m_Destination.Name == m_DestinationString) - return m_Destination; + if( m_Destination != null && m_Destination.Name == m_DestinationString ) + return m_Destination; - if (Map.Felucca.Regions.Count > 0) - return (m_Destination = EDI.Find(m_DestinationString)); + if( Map.Felucca.Regions.Count > 0 ) + return (m_Destination = EDI.Find( m_DestinationString )); return (m_Destination = null); } @@ -473,17 +473,17 @@ namespace Server.Mobiles { private Mobile m_Mobile; - public DeleteTimer(Mobile m, TimeSpan delay) - : base(delay) + public DeleteTimer( Mobile m, TimeSpan delay ) + : base( delay ) { - m_Mobile = m; + m_Mobile = m; - Priority = TimerPriority.OneSecond; + Priority = TimerPriority.OneSecond; } protected override void OnTick() { - m_Mobile.Delete(); + m_Mobile.Delete(); } } } @@ -509,12 +509,12 @@ namespace Server.Mobiles get{ return m_Bounds; } }*/ - public bool Contains(Point3D p) + public bool Contains( Point3D p ) { - return m_Region.Contains(p); + return m_Region.Contains( p ); } - public EscortDestinationInfo(string name, Region region) + public EscortDestinationInfo( string name, Region region ) { m_Name = name; m_Region = region; @@ -526,28 +526,28 @@ namespace Server.Mobiles { ICollection list = Map.Felucca.Regions.Values; - if (list.Count == 0) - return; + if( list.Count == 0 ) + return; m_Table = new Hashtable(); - foreach (Region r in list) + foreach( Region r in list ) { - if (r.Name == null) - continue; + if( r.Name == null ) + continue; - if (r is Regions.DungeonRegion || r is Regions.TownRegion) - m_Table[r.Name] = new EscortDestinationInfo(r.Name, r); + if( r is Regions.DungeonRegion || r is Regions.TownRegion ) + m_Table[r.Name] = new EscortDestinationInfo( r.Name, r ); } } - public static EDI Find(string name) + public static EDI Find( string name ) { - if (m_Table == null) - LoadTable(); + if( m_Table == null ) + LoadTable(); - if (name == null || m_Table == null) - return null; + if( name == null || m_Table == null ) + return null; return (EscortDestinationInfo)m_Table[name]; } @@ -558,8 +558,8 @@ namespace Server.Mobiles private BaseEscortable m_Mobile; private Mobile m_From; - public AskDestinationEntry(BaseEscortable m, Mobile from) - : base(6100, 3) + public AskDestinationEntry( BaseEscortable m, Mobile from ) + : base( 6100, 3 ) { m_Mobile = m; m_From = from; @@ -567,7 +567,7 @@ namespace Server.Mobiles public override void OnClick() { - m_Mobile.SayDestinationTo(m_From); + m_Mobile.SayDestinationTo( m_From ); } } @@ -576,8 +576,8 @@ namespace Server.Mobiles private BaseEscortable m_Mobile; private Mobile m_From; - public AcceptEscortEntry(BaseEscortable m, Mobile from) - : base(6101, 3) + public AcceptEscortEntry( BaseEscortable m, Mobile from ) + : base( 6101, 3 ) { m_Mobile = m; m_From = from; @@ -585,7 +585,7 @@ namespace Server.Mobiles public override void OnClick() { - m_Mobile.AcceptEscorter(m_From); + m_Mobile.AcceptEscorter( m_From ); } } @@ -594,8 +594,8 @@ namespace Server.Mobiles private BaseEscortable m_Mobile; private Mobile m_From; - public AbandonEscortEntry(BaseEscortable m, Mobile from) - : base(6102, 3) + public AbandonEscortEntry( BaseEscortable m, Mobile from ) + : base( 6102, 3 ) { m_Mobile = m; m_From = from;