diff --git a/Scripts/Accounting/Account.cs b/Scripts/Accounting/Account.cs index 53b52d867..b341d925c 100644 --- a/Scripts/Accounting/Account.cs +++ b/Scripts/Accounting/Account.cs @@ -242,9 +242,9 @@ namespace Server.Accounting /// public bool Inactive { - get + get { - if( this.AccessLevel != AccessLevel.Player ) + if ( this.AccessLevel != AccessLevel.Player ) return false; TimeSpan inactiveLength = DateTime.UtcNow - m_LastLogin; @@ -263,9 +263,7 @@ namespace Server.Accounting { for ( int i = 0; i < m_Mobiles.Length; i++ ) { - PlayerMobile m = m_Mobiles[i] as PlayerMobile; - - if ( m != null && m.NetState != null ) + if ( m_Mobiles[i] is PlayerMobile m && m.NetState != null ) return m_TotalGameTime + ( DateTime.UtcNow - m.SessionStart ); } @@ -511,9 +509,7 @@ namespace Server.Accounting private static void EventSink_Connected( ConnectedEventArgs e ) { - Account acc = e.Mobile.Account as Account; - - if ( acc == null ) + if ( !(e.Mobile.Account is Account acc) ) return; if ( acc.Young && acc.m_YoungTimer == null ) @@ -525,9 +521,7 @@ namespace Server.Accounting private static void EventSink_Disconnected( DisconnectedEventArgs e ) { - Account acc = e.Mobile.Account as Account; - - if ( acc == null ) + if ( !(e.Mobile.Account is Account acc) ) return; if ( acc.m_YoungTimer != null ) @@ -536,8 +530,7 @@ namespace Server.Accounting acc.m_YoungTimer = null; } - PlayerMobile m = e.Mobile as PlayerMobile; - if ( m == null ) + if ( !(e.Mobile is PlayerMobile m) ) return; acc.m_TotalGameTime += DateTime.UtcNow - m.SessionStart; @@ -545,14 +538,10 @@ namespace Server.Accounting private static void EventSink_Login( LoginEventArgs e ) { - PlayerMobile m = e.Mobile as PlayerMobile; - - if ( m == null ) + if ( !(e.Mobile is PlayerMobile m) ) return; - Account acc = m.Account as Account; - - if ( acc == null ) + if ( !(m.Account is Account acc) ) return; if ( m.Young && acc.Young ) @@ -570,9 +559,7 @@ namespace Server.Accounting for ( int i = 0; i < m_Mobiles.Length; i++ ) { - PlayerMobile m = m_Mobiles[i] as PlayerMobile; - - if ( m != null && m.Young ) + if ( m_Mobiles[i] is PlayerMobile m && m.Young ) { m.Young = false; @@ -614,7 +601,7 @@ namespace Server.Accounting public Account( string username, string password ) { m_Username = username; - + SetPassword( password ); m_AccessLevel = AccessLevel.Player; @@ -685,7 +672,7 @@ namespace Server.Accounting m_Flags = Utility.GetXMLInt32( Utility.GetText( node["flags"], "0" ), 0 ); m_Created = Utility.GetXMLDateTime( Utility.GetText( node["created"], null ), DateTime.UtcNow ); m_LastLogin = Utility.GetXMLDateTime( Utility.GetText( node["lastLogin"], null ), DateTime.UtcNow ); - + TotalGold = Utility.GetXMLInt32( Utility.GetText(node["totalGold"], "0" ), 0 ); TotalPlat = Utility.GetXMLInt32(Utility.GetText(node["totalPlat"], "0"), 0); @@ -706,9 +693,7 @@ namespace Server.Accounting { for ( int i = 0; i < m_Mobiles.Length; i++ ) { - PlayerMobile m = m_Mobiles[i] as PlayerMobile; - - if ( m != null ) + if ( m_Mobiles[i] is PlayerMobile m ) totalGameTime += m.GameTime; } } @@ -776,7 +761,7 @@ namespace Server.Accounting { IPAddress address; - if( IPAddress.TryParse( Utility.GetText( ip, null ), out address ) ) + if ( IPAddress.TryParse( Utility.GetText( ip, null ), out address ) ) { list[count] = Utility.Intern( address ); count++; @@ -1221,8 +1206,8 @@ namespace Server.Accounting public int CompareTo( object obj ) { - if ( obj is Account ) - return this.CompareTo( (Account) obj ); + if ( obj is Account account ) + return this.CompareTo( account ); throw new ArgumentException(); } diff --git a/Scripts/Accounting/AccountHandler.cs b/Scripts/Accounting/AccountHandler.cs index f130bed7e..d7d8686ec 100644 --- a/Scripts/Accounting/AccountHandler.cs +++ b/Scripts/Accounting/AccountHandler.cs @@ -82,9 +82,8 @@ namespace Server.Misc public static void Password_OnCommand( CommandEventArgs e ) { Mobile from = e.Mobile; - Account acct = from.Account as Account; - if ( acct == null ) + if ( !(from.Account is Account acct) ) return; IPAddress[] accessList = acct.LoginIPs; @@ -102,7 +101,7 @@ namespace Server.Misc from.SendMessage( "You must specify the new password." ); return; } - else if ( e.Length == 1 ) + if ( e.Length == 1 ) { from.SendMessage( "To prevent potential typing mistakes, you must type the password twice. Use the format:" ); from.SendMessage( "Password \"(newPassword)\" \"(repeated)\"" ); @@ -172,9 +171,7 @@ namespace Server.Misc NetState state = e.State; int index = e.Index; - Account acct = state.Account as Account; - - if ( acct == null ) + if ( !(state.Account is Account acct) ) { state.Dispose(); } @@ -315,9 +312,8 @@ namespace Server.Misc string pw = e.Password; e.Accepted = false; - Account acct = Accounts.GetAccount( un ) as Account; - if ( acct == null ) + if ( !(Accounts.GetAccount( un ) is Account acct) ) { if ( AutoAccountCreation && un.Trim().Length > 0 ) // To prevent someone from making an account of just '' or a bunch of meaningless spaces { @@ -378,9 +374,7 @@ namespace Server.Misc string un = e.Username; string pw = e.Password; - Account acct = Accounts.GetAccount( un ) as Account; - - if ( acct == null ) + if ( !(Accounts.GetAccount( un ) is Account acct) ) { e.Accepted = false; } @@ -415,21 +409,16 @@ namespace Server.Misc public static bool CheckAccount( Mobile mobCheck, Mobile accCheck ) { - if ( accCheck != null ) + if ( accCheck?.Account is Account a ) { - Account a = accCheck.Account as Account; - - if ( a != null ) + for ( int i = 0; i < a.Length; ++i ) { - for ( int i = 0; i < a.Length; ++i ) - { - if ( a[i] == mobCheck ) - return true; - } + if ( a[i] == mobCheck ) + return true; } } return false; } } -} \ No newline at end of file +} diff --git a/Scripts/Accounting/Firewall.cs b/Scripts/Accounting/Firewall.cs index 03ff2ff20..1df97f4b0 100644 --- a/Scripts/Accounting/Firewall.cs +++ b/Scripts/Accounting/Firewall.cs @@ -34,20 +34,18 @@ namespace Server public override bool Equals( object obj ) { - if( obj is IPAddress ) + if ( obj is IPAddress ) { return obj.Equals( m_Address ); } - else if( obj is string ) + if ( obj is string s ) { - IPAddress otherAddress; - - if( IPAddress.TryParse( (string)obj, out otherAddress ) ) + if ( IPAddress.TryParse( s, out IPAddress otherAddress ) ) return otherAddress.Equals( m_Address ); } - else if( obj is IPFirewallEntry ) + else if ( obj is IPFirewallEntry entry ) { - return m_Address.Equals( ((IPFirewallEntry)obj).m_Address ); + return m_Address.Equals( entry.m_Address ); } return false; @@ -82,31 +80,22 @@ namespace Server public override bool Equals( object obj ) { - - if( obj is string ) + if ( obj is string entry ) { - string entry= (string)obj; - string[] str = entry.Split( '/' ); - if( str.Length == 2 ) + if ( str.Length == 2 ) { - IPAddress cidrPrefix; - - if( IPAddress.TryParse( str[0], out cidrPrefix ) ) + if ( IPAddress.TryParse( str[0], out IPAddress cidrPrefix ) ) { - int cidrLength; - - if( int.TryParse( str[1], out cidrLength ) ) + if ( int.TryParse( str[1], out int cidrLength ) ) return m_CIDRPrefix.Equals( cidrPrefix ) && m_CIDRLength.Equals( cidrLength ); } } } - else if( obj is CIDRFirewallEntry ) + else if ( obj is CIDRFirewallEntry cidrEntry ) { - CIDRFirewallEntry entry = obj as CIDRFirewallEntry; - - return m_CIDRPrefix.Equals( entry.m_CIDRPrefix ) && m_CIDRLength.Equals( entry.m_CIDRLength ); + return m_CIDRPrefix.Equals( cidrEntry.m_CIDRPrefix ) && m_CIDRLength.Equals( cidrEntry.m_CIDRLength ); } return false; @@ -131,7 +120,7 @@ namespace Server public bool IsBlocked( IPAddress address ) { - if( !m_Valid ) + if ( !m_Valid ) return false; //Why process if it's invalid? it'll return false anyway after processing it. return Utility.IPMatch( m_Entry, address, ref m_Valid ); @@ -139,17 +128,15 @@ namespace Server public override string ToString() { - return m_Entry.ToString(); + return m_Entry; } public override bool Equals( object obj ) { - if( obj is string ) + if ( obj is string ) return obj.Equals( m_Entry ); - else if( obj is WildcardIPFirewallEntry ) - return m_Entry.Equals( ((WildcardIPFirewallEntry)obj).m_Entry ); - return false; + return obj is WildcardIPFirewallEntry entry && m_Entry.Equals( entry.m_Entry ); } public override int GetHashCode() @@ -186,7 +173,7 @@ namespace Server object toAdd; IPAddress addr; - if( IPAddress.TryParse( line, out addr ) ) + if ( IPAddress.TryParse( line, out addr ) ) toAdd = addr; else toAdd = line; @@ -208,35 +195,29 @@ namespace Server public static IFirewallEntry ToFirewallEntry( object entry ) { - if( entry is IFirewallEntry ) - return (IFirewallEntry)entry; - else if( entry is IPAddress ) - return new IPFirewallEntry( (IPAddress)entry ); - else if( entry is string ) - return ToFirewallEntry( (string)entry ); + if ( entry is IFirewallEntry firewallEntry ) + return firewallEntry; + if ( entry is IPAddress address ) + return new IPFirewallEntry( address ); + if ( entry is string s ) + return ToFirewallEntry( s ); return null; } public static IFirewallEntry ToFirewallEntry( string entry ) { - IPAddress addr; - - if( IPAddress.TryParse( entry, out addr ) ) + if ( IPAddress.TryParse( entry, out IPAddress addr ) ) return new IPFirewallEntry( addr ); //Try CIDR parse string[] str = entry.Split( '/' ); - if( str.Length == 2 ) + if ( str.Length == 2 ) { - IPAddress cidrPrefix; - - if( IPAddress.TryParse( str[0], out cidrPrefix ) ) + if ( IPAddress.TryParse( str[0], out IPAddress cidrPrefix ) ) { - int cidrLength; - - if( int.TryParse( str[1], out cidrLength ) ) + if ( int.TryParse( str[1], out int cidrLength ) ) return new CIDRFirewallEntry( cidrPrefix, cidrLength ); } } @@ -254,7 +235,7 @@ namespace Server { IFirewallEntry entry = ToFirewallEntry( obj ); - if( entry != null ) + if ( entry != null ) { m_Blocked.Remove( entry ); Save(); @@ -263,17 +244,17 @@ namespace Server public static void Add( object obj ) { - if( obj is IPAddress ) - Add( (IPAddress)obj ); - else if( obj is string ) - Add( (string)obj ); - else if( obj is IFirewallEntry ) - Add( (IFirewallEntry)obj ); + if ( obj is IPAddress address ) + Add( address ); + else if ( obj is string s ) + Add( s ); + else if ( obj is IFirewallEntry entry ) + Add( entry ); } public static void Add( IFirewallEntry entry ) { - if( !m_Blocked.Contains( entry ) ) + if ( !m_Blocked.Contains( entry ) ) m_Blocked.Add( entry ); Save(); @@ -283,7 +264,7 @@ namespace Server { IFirewallEntry entry = ToFirewallEntry( pattern ); - if( !m_Blocked.Contains( entry ) ) + if ( !m_Blocked.Contains( entry ) ) m_Blocked.Add( entry ); Save(); @@ -293,7 +274,7 @@ namespace Server { IFirewallEntry entry = new IPFirewallEntry( ip ); - if( !m_Blocked.Contains( entry ) ) + if ( !m_Blocked.Contains( entry ) ) m_Blocked.Add( entry ); Save(); @@ -314,7 +295,7 @@ namespace Server { for( int i = 0; i < m_Blocked.Count; i++ ) { - if( m_Blocked[i].IsBlocked( ip ) ) + if ( m_Blocked[i].IsBlocked( ip ) ) return true; } @@ -332,7 +313,7 @@ namespace Server contains = Utility.IPMatchCIDR( s, ip ); - if( !contains ) + if ( !contains ) contains = Utility.IPMatch( s, ip ); } } @@ -341,4 +322,4 @@ namespace Server * */ } } -} \ No newline at end of file +} diff --git a/Scripts/Commands/Add.cs b/Scripts/Commands/Add.cs index ff72bd31b..162f71a7a 100644 --- a/Scripts/Commands/Add.cs +++ b/Scripts/Commands/Add.cs @@ -328,12 +328,10 @@ namespace Server.Commands sb.AppendFormat( "0x{0:X}; ", built.Serial.Value ); - if ( built is Item ) { - Container pack = packs[i]; - pack.DropItem( (Item)built ); + if ( built is Item item ) { + packs[i].DropItem( item ); } - else if ( built is Mobile ) { - Mobile m = (Mobile)built; + else if ( built is Mobile m ) { m.MoveToWorld( new Point3D( start.X, start.Y, start.Z ), map ); } } @@ -356,12 +354,10 @@ namespace Server.Commands sb.AppendFormat( "0x{0:X}; ", built.Serial.Value ); - if ( built is Item ) { - Item item = (Item)built; + if ( built is Item item ) { item.MoveToWorld( new Point3D( x, y, z ), map ); } - else if ( built is Mobile ) { - Mobile m = (Mobile)built; + else if ( built is Mobile m ) { m.MoveToWorld( new Point3D( x, y, z ), map ); } } @@ -438,14 +434,12 @@ namespace Server.Commands protected override void OnTarget( Mobile from, object o ) { - IPoint3D p = o as IPoint3D; - - if ( p != null ) + if ( o is IPoint3D p ) { - if ( p is Item ) - p = ((Item)p).GetWorldTop(); - else if ( p is Mobile ) - p = ((Mobile)p).Location; + if ( p is Item item ) + p = item.GetWorldTop(); + else if ( p is Mobile m ) + p = m.Location; Point3D point = new Point3D( p ); Add.Invoke( from, point, point, m_Args ); diff --git a/Scripts/Commands/BoundingBoxPicker.cs b/Scripts/Commands/BoundingBoxPicker.cs index d0a5e8412..95c12394f 100644 --- a/Scripts/Commands/BoundingBoxPicker.cs +++ b/Scripts/Commands/BoundingBoxPicker.cs @@ -37,12 +37,11 @@ namespace Server protected override void OnTarget( Mobile from, object targeted ) { - IPoint3D p = targeted as IPoint3D; - - if ( p == null ) + if ( !(targeted is IPoint3D p) ) return; - else if ( p is Item ) - p = ((Item)p).GetWorldTop(); + + if ( p is Item item ) + p = item.GetWorldTop(); if ( m_First ) { @@ -65,4 +64,4 @@ namespace Server } } } -} \ No newline at end of file +} diff --git a/Scripts/Commands/Decorate.cs b/Scripts/Commands/Decorate.cs index f851b157b..40c1b8262 100644 --- a/Scripts/Commands/Decorate.cs +++ b/Scripts/Commands/Decorate.cs @@ -6,6 +6,7 @@ using Server; using Server.Items; using Server.Engines.Quests.Haven; using Server.Engines.Quests.Necro; +using Server.Mobiles; namespace Server.Commands { @@ -388,12 +389,10 @@ namespace Server.Commands throw new Exception( String.Format( "Bad type: {0}", m_Type ), e ); } - if ( item is BaseAddon ) + if ( item is BaseAddon addon ) { - if ( item is MaabusCoffin ) + if ( addon is MaabusCoffin coffin ) { - MaabusCoffin coffin = (MaabusCoffin)item; - for ( int i = 0; i < m_Params.Length; ++i ) { if ( m_Params[i].StartsWith( "SpawnLocation" ) ) @@ -407,18 +406,18 @@ namespace Server.Commands } else if ( m_ItemID > 0 ) { - List comps = ((BaseAddon)item).Components; + List comps = addon.Components; for ( int i = 0; i < comps.Count; ++i ) { - AddonComponent comp = (AddonComponent)comps[i]; + AddonComponent comp = comps[i]; if ( comp.Offset == Point3D.Zero ) comp.ItemID = m_ItemID; } } } - else if ( item is BaseLight ) + else if ( item is BaseLight light ) { bool unlit = false, unprotected = false; @@ -428,23 +427,21 @@ namespace Server.Commands unlit = true; else if ( !unprotected && m_Params[i] == "Unprotected" ) unprotected = true; - + if ( unlit && unprotected ) break; } if ( !unlit ) - ((BaseLight)item).Ignite(); + light.Ignite(); if ( !unprotected ) - ((BaseLight)item).Protected = true; + light.Protected = true; if ( m_ItemID > 0 ) - item.ItemID = m_ItemID; + light.ItemID = m_ItemID; } - else if ( item is Server.Mobiles.Spawner ) + else if ( item is Spawner sp ) { - Server.Mobiles.Spawner sp = (Server.Mobiles.Spawner)item; - sp.NextSpawn = TimeSpan.Zero; for ( int i = 0; i < m_Params.Length; ++i ) @@ -518,10 +515,8 @@ namespace Server.Commands } } } - else if ( item is RecallRune ) + else if ( item is RecallRune rune ) { - RecallRune rune = (RecallRune)item; - for ( int i = 0; i < m_Params.Length; ++i ) { if ( m_Params[i].StartsWith( "Description" ) ) @@ -554,10 +549,8 @@ namespace Server.Commands } } } - else if ( item is SkillTeleporter ) + else if ( item is SkillTeleporter st ) { - SkillTeleporter tp = (SkillTeleporter)item; - for ( int i = 0; i < m_Params.Length; ++i ) { if ( m_Params[i].StartsWith( "Skill" ) ) @@ -565,94 +558,92 @@ namespace Server.Commands int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.Skill = (SkillName)Enum.Parse( typeof( SkillName ), m_Params[i].Substring( ++indexOf ), true ); + st.Skill = (SkillName)Enum.Parse( typeof( SkillName ), m_Params[i].Substring( ++indexOf ), true ); } else if ( m_Params[i].StartsWith( "RequiredFixedPoint" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.Required = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ) * 0.1; + st.Required = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ) * 0.1; } else if ( m_Params[i].StartsWith( "Required" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.Required = Utility.ToDouble( m_Params[i].Substring( ++indexOf ) ); + st.Required = Utility.ToDouble( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "MessageString" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.MessageString = m_Params[i].Substring( ++indexOf ); + st.MessageString = m_Params[i].Substring( ++indexOf ); } else if ( m_Params[i].StartsWith( "MessageNumber" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.MessageNumber = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); + st.MessageNumber = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "PointDest" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.PointDest = Point3D.Parse( m_Params[i].Substring( ++indexOf ) ); + st.PointDest = Point3D.Parse( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "MapDest" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.MapDest = Map.Parse( m_Params[i].Substring( ++indexOf ) ); + st.MapDest = Map.Parse( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "Creatures" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.Creatures = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); + st.Creatures = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "SourceEffect" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.SourceEffect = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); + st.SourceEffect = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "DestEffect" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.DestEffect = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); + st.DestEffect = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "SoundID" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.SoundID = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); + st.SoundID = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "Delay" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.Delay = TimeSpan.Parse( m_Params[i].Substring( ++indexOf ) ); + st.Delay = TimeSpan.Parse( m_Params[i].Substring( ++indexOf ) ); } } if ( m_ItemID > 0 ) - item.ItemID = m_ItemID; + st.ItemID = m_ItemID; } - else if ( item is KeywordTeleporter ) + else if ( item is KeywordTeleporter kt ) { - KeywordTeleporter tp = (KeywordTeleporter)item; - for ( int i = 0; i < m_Params.Length; ++i ) { if ( m_Params[i].StartsWith( "Substring" ) ) @@ -660,80 +651,78 @@ namespace Server.Commands int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.Substring = m_Params[i].Substring( ++indexOf ); + kt.Substring = m_Params[i].Substring( ++indexOf ); } else if ( m_Params[i].StartsWith( "Keyword" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.Keyword = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); + kt.Keyword = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "Range" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.Range = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); + kt.Range = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "PointDest" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.PointDest = Point3D.Parse( m_Params[i].Substring( ++indexOf ) ); + kt.PointDest = Point3D.Parse( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "MapDest" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.MapDest = Map.Parse( m_Params[i].Substring( ++indexOf ) ); + kt.MapDest = Map.Parse( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "Creatures" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.Creatures = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); + kt.Creatures = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "SourceEffect" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.SourceEffect = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); + kt.SourceEffect = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "DestEffect" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.DestEffect = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); + kt.DestEffect = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "SoundID" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.SoundID = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); + kt.SoundID = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "Delay" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.Delay = TimeSpan.Parse( m_Params[i].Substring( ++indexOf ) ); + kt.Delay = TimeSpan.Parse( m_Params[i].Substring( ++indexOf ) ); } } if ( m_ItemID > 0 ) - item.ItemID = m_ItemID; + kt.ItemID = m_ItemID; } - else if ( item is Teleporter ) + else if ( item is Teleporter tp ) { - Teleporter tp = (Teleporter)item; - for ( int i = 0; i < m_Params.Length; ++i ) { if ( m_Params[i].StartsWith( "PointDest" ) ) @@ -788,12 +777,10 @@ namespace Server.Commands } if ( m_ItemID > 0 ) - item.ItemID = m_ItemID; + tp.ItemID = m_ItemID; } - else if ( item is FillableContainer ) + else if ( item is FillableContainer cont ) { - FillableContainer cont = (FillableContainer) item; - for ( int i = 0; i < m_Params.Length; ++i ) { if ( m_Params[i].StartsWith( "ContentType" ) ) @@ -806,7 +793,7 @@ namespace Server.Commands } if ( m_ItemID > 0 ) - item.ItemID = m_ItemID; + cont.ItemID = m_ItemID; } else if ( m_ItemID > 0 ) { @@ -832,8 +819,8 @@ namespace Server.Commands { int hue = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); - if ( item is DyeTub ) - ((DyeTub)item).DyedHue = hue; + if ( item is DyeTub tub ) + tub.DyedHue = hue; else item.Hue = hue; } @@ -1000,27 +987,30 @@ namespace Server.Commands item.MoveToWorld( loc, maps[j] ); ++count; - if ( item is BaseDoor ) + if ( item is BaseDoor door ) { IPooledEnumerable eable = maps[j].GetItemsInRange( loc, 1 ); - Type itemType = item.GetType(); + Type itemType = door.GetType(); foreach ( BaseDoor link in eable ) { - if ( link != item && link.Z == item.Z && link.GetType() == itemType ) + if ( link != item && link.Z == door.Z && link.GetType() == itemType ) { - ((BaseDoor)item).Link = link; - link.Link = (BaseDoor)item; + door.Link = link; + link.Link = door; break; } } eable.Free(); } - else if ( item is MarkContainer ) + else if ( item is MarkContainer markCont ) { - try{ ((MarkContainer)item).Target = Point3D.Parse( extra ); } + try + { + markCont.Target = Point3D.Parse( extra ); + } catch{} } diff --git a/Scripts/Commands/DecorateMag.cs b/Scripts/Commands/DecorateMag.cs index e85d82478..91d7d26ed 100644 --- a/Scripts/Commands/DecorateMag.cs +++ b/Scripts/Commands/DecorateMag.cs @@ -6,6 +6,7 @@ using Server; using Server.Items; using Server.Engines.Quests.Haven; using Server.Engines.Quests.Necro; +using Server.Mobiles; namespace Server.Commands { @@ -385,12 +386,10 @@ namespace Server.Commands throw new Exception( String.Format( "Bad type: {0}", m_Type ), e ); } - if ( item is BaseAddon ) + if ( item is BaseAddon addon ) { - if ( item is MaabusCoffin ) + if ( addon is MaabusCoffin coffin ) { - MaabusCoffin coffin = (MaabusCoffin)item; - for ( int i = 0; i < m_Params.Length; ++i ) { if ( m_Params[i].StartsWith( "SpawnLocation" ) ) @@ -404,7 +403,7 @@ namespace Server.Commands } else if ( m_ItemID > 0 ) { - List comps = ((BaseAddon)item).Components; + List comps = addon.Components; for ( int i = 0; i < comps.Count; ++i ) { @@ -415,7 +414,7 @@ namespace Server.Commands } } } - else if ( item is BaseLight ) + else if ( item is BaseLight light ) { bool unlit = false, unprotected = false; @@ -425,23 +424,21 @@ namespace Server.Commands unlit = true; else if ( !unprotected && m_Params[i] == "Unprotected" ) unprotected = true; - + if ( unlit && unprotected ) break; } if ( !unlit ) - ((BaseLight)item).Ignite(); + light.Ignite(); if ( !unprotected ) - ((BaseLight)item).Protected = true; + light.Protected = true; if ( m_ItemID > 0 ) - item.ItemID = m_ItemID; + light.ItemID = m_ItemID; } - else if ( item is Server.Mobiles.Spawner ) + else if ( item is Spawner sp ) { - Server.Mobiles.Spawner sp = (Server.Mobiles.Spawner)item; - sp.NextSpawn = TimeSpan.Zero; for ( int i = 0; i < m_Params.Length; ++i ) @@ -515,10 +512,8 @@ namespace Server.Commands } } } - else if ( item is RecallRune ) + else if ( item is RecallRune rune ) { - RecallRune rune = (RecallRune)item; - for ( int i = 0; i < m_Params.Length; ++i ) { if ( m_Params[i].StartsWith( "Description" ) ) @@ -551,10 +546,8 @@ namespace Server.Commands } } } - else if ( item is SkillTeleporter ) + else if ( item is SkillTeleporter st ) { - SkillTeleporter tp = (SkillTeleporter)item; - for ( int i = 0; i < m_Params.Length; ++i ) { if ( m_Params[i].StartsWith( "Skill" ) ) @@ -562,94 +555,92 @@ namespace Server.Commands int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.Skill = (SkillName)Enum.Parse( typeof( SkillName ), m_Params[i].Substring( ++indexOf ), true ); + st.Skill = (SkillName)Enum.Parse( typeof( SkillName ), m_Params[i].Substring( ++indexOf ), true ); } else if ( m_Params[i].StartsWith( "RequiredFixedPoint" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.Required = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ) * 0.1; + st.Required = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ) * 0.1; } else if ( m_Params[i].StartsWith( "Required" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.Required = Utility.ToDouble( m_Params[i].Substring( ++indexOf ) ); + st.Required = Utility.ToDouble( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "MessageString" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.MessageString = m_Params[i].Substring( ++indexOf ); + st.MessageString = m_Params[i].Substring( ++indexOf ); } else if ( m_Params[i].StartsWith( "MessageNumber" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.MessageNumber = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); + st.MessageNumber = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "PointDest" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.PointDest = Point3D.Parse( m_Params[i].Substring( ++indexOf ) ); + st.PointDest = Point3D.Parse( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "MapDest" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.MapDest = Map.Parse( m_Params[i].Substring( ++indexOf ) ); + st.MapDest = Map.Parse( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "Creatures" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.Creatures = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); + st.Creatures = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "SourceEffect" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.SourceEffect = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); + st.SourceEffect = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "DestEffect" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.DestEffect = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); + st.DestEffect = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "SoundID" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.SoundID = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); + st.SoundID = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "Delay" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.Delay = TimeSpan.Parse( m_Params[i].Substring( ++indexOf ) ); + st.Delay = TimeSpan.Parse( m_Params[i].Substring( ++indexOf ) ); } } if ( m_ItemID > 0 ) - item.ItemID = m_ItemID; + st.ItemID = m_ItemID; } - else if ( item is KeywordTeleporter ) + else if ( item is KeywordTeleporter kt ) { - KeywordTeleporter tp = (KeywordTeleporter)item; - for ( int i = 0; i < m_Params.Length; ++i ) { if ( m_Params[i].StartsWith( "Substring" ) ) @@ -657,80 +648,78 @@ namespace Server.Commands int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.Substring = m_Params[i].Substring( ++indexOf ); + kt.Substring = m_Params[i].Substring( ++indexOf ); } else if ( m_Params[i].StartsWith( "Keyword" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.Keyword = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); + kt.Keyword = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "Range" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.Range = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); + kt.Range = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "PointDest" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.PointDest = Point3D.Parse( m_Params[i].Substring( ++indexOf ) ); + kt.PointDest = Point3D.Parse( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "MapDest" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.MapDest = Map.Parse( m_Params[i].Substring( ++indexOf ) ); + kt.MapDest = Map.Parse( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "Creatures" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.Creatures = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); + kt.Creatures = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "SourceEffect" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.SourceEffect = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); + kt.SourceEffect = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "DestEffect" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.DestEffect = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); + kt.DestEffect = Utility.ToBoolean( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "SoundID" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.SoundID = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); + kt.SoundID = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); } else if ( m_Params[i].StartsWith( "Delay" ) ) { int indexOf = m_Params[i].IndexOf( '=' ); if ( indexOf >= 0 ) - tp.Delay = TimeSpan.Parse( m_Params[i].Substring( ++indexOf ) ); + kt.Delay = TimeSpan.Parse( m_Params[i].Substring( ++indexOf ) ); } } if ( m_ItemID > 0 ) - item.ItemID = m_ItemID; + kt.ItemID = m_ItemID; } - else if ( item is Teleporter ) + else if ( item is Teleporter tp ) { - Teleporter tp = (Teleporter)item; - for ( int i = 0; i < m_Params.Length; ++i ) { if ( m_Params[i].StartsWith( "PointDest" ) ) @@ -785,12 +774,10 @@ namespace Server.Commands } if ( m_ItemID > 0 ) - item.ItemID = m_ItemID; + tp.ItemID = m_ItemID; } - else if ( item is FillableContainer ) + else if ( item is FillableContainer cont ) { - FillableContainer cont = (FillableContainer) item; - for ( int i = 0; i < m_Params.Length; ++i ) { if ( m_Params[i].StartsWith( "ContentType" ) ) @@ -803,7 +790,7 @@ namespace Server.Commands } if ( m_ItemID > 0 ) - item.ItemID = m_ItemID; + cont.ItemID = m_ItemID; } else if ( m_ItemID > 0 ) { @@ -829,8 +816,8 @@ namespace Server.Commands { int hue = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) ); - if ( item is DyeTub ) - ((DyeTub)item).DyedHue = hue; + if ( item is DyeTub tub ) + tub.DyedHue = hue; else item.Hue = hue; } @@ -997,27 +984,30 @@ namespace Server.Commands item.MoveToWorld( loc, maps[j] ); ++count; - if ( item is BaseDoor ) + if ( item is BaseDoor door ) { IPooledEnumerable eable = maps[j].GetItemsInRange( loc, 1 ); - Type itemType = item.GetType(); + Type itemType = door.GetType(); foreach ( BaseDoor link in eable ) { - if ( link != item && link.Z == item.Z && link.GetType() == itemType ) + if ( link != item && link.Z == door.Z && link.GetType() == itemType ) { - ((BaseDoor)item).Link = link; - link.Link = (BaseDoor)item; + door.Link = link; + link.Link = door; break; } } eable.Free(); } - else if ( item is MarkContainer ) + else if ( item is MarkContainer markCont ) { - try{ ((MarkContainer)item).Target = Point3D.Parse( extra ); } + try + { + markCont.Target = Point3D.Parse( extra ); + } catch{} } diff --git a/Scripts/Commands/Docs.cs b/Scripts/Commands/Docs.cs index 54b6644ba..9abc56ee4 100644 --- a/Scripts/Commands/Docs.cs +++ b/Scripts/Commands/Docs.cs @@ -36,7 +36,7 @@ namespace Server.Commands Network.NetState.Resume(); - if( generated ) + if ( generated ) { World.Broadcast( 0x35, true, "Documentation has been completed. The entire process took {0:F1} seconds.", (endTime - startTime).TotalSeconds ); Console.WriteLine( "Documentation complete." ); @@ -52,7 +52,7 @@ namespace Server.Commands { public int Compare( object x, object y ) { - if( x == y ) + if ( x == y ) return 0; ConstructorInfo aCtor = x as ConstructorInfo; @@ -67,44 +67,44 @@ namespace Server.Commands bool aStatic = GetStaticFor( aCtor, aProp, aMethod ); bool bStatic = GetStaticFor( bCtor, bProp, bMethod ); - if( aStatic && !bStatic ) + if ( aStatic && !bStatic ) return -1; - else if( !aStatic && bStatic ) + else if ( !aStatic && bStatic ) return 1; int v = 0; - if( aCtor != null ) + if ( aCtor != null ) { - if( bCtor == null ) + if ( bCtor == null ) v = -1; } - else if( bCtor != null ) + else if ( bCtor != null ) { - if( aCtor == null ) + if ( aCtor == null ) v = 1; } - else if( aProp != null ) + else if ( aProp != null ) { - if( bProp == null ) + if ( bProp == null ) v = -1; } - else if( bProp != null ) + else if ( bProp != null ) { - if( aProp == null ) + if ( aProp == null ) v = 1; } - if( v == 0 ) + if ( v == 0 ) { v = GetNameFrom( aCtor, aProp, aMethod ).CompareTo( GetNameFrom( bCtor, bProp, bMethod ) ); } - if( v == 0 && aCtor != null && bCtor != null ) + if ( v == 0 && aCtor != null && bCtor != null ) { v = aCtor.GetParameters().Length.CompareTo( bCtor.GetParameters().Length ); } - else if( v == 0 && aMethod != null && bMethod != null ) + else if ( v == 0 && aMethod != null && bMethod != null ) { v = aMethod.GetParameters().Length.CompareTo( bMethod.GetParameters().Length ); } @@ -114,12 +114,12 @@ namespace Server.Commands private bool GetStaticFor( ConstructorInfo ctor, PropertyInfo prop, MethodInfo method ) { - if( ctor != null ) + if ( ctor != null ) return ctor.IsStatic; - else if( method != null ) + else if ( method != null ) return method.IsStatic; - if( prop != null ) + if ( prop != null ) { MethodInfo getMethod = prop.GetGetMethod(); MethodInfo setMethod = prop.GetGetMethod(); @@ -132,11 +132,11 @@ namespace Server.Commands private string GetNameFrom( ConstructorInfo ctor, PropertyInfo prop, MethodInfo method ) { - if( ctor != null ) + if ( ctor != null ) return ctor.DeclaringType.Name; - else if( prop != null ) + else if ( prop != null ) return prop.Name; - else if( method != null ) + else if ( method != null ) return method.Name; else return ""; @@ -147,11 +147,11 @@ namespace Server.Commands { public int Compare( TypeInfo x, TypeInfo y ) { - if( x == null && y == null ) + if ( x == null && y == null ) return 0; - else if( x == null ) + else if ( x == null ) return -1; - else if( y == null ) + else if ( y == null ) return 1; return x.TypeName.CompareTo( y.TypeName ); @@ -195,7 +195,7 @@ namespace Server.Commands public static string GetFileName( string root, string name, string ext ) { - if( name.IndexOfAny( ReplaceChars ) >= 0 ) + if ( name.IndexOfAny( ReplaceChars ) >= 0 ) { StringBuilder sb = new StringBuilder( name ); @@ -224,7 +224,7 @@ namespace Server.Commands { path = Path.Combine( m_RootDirectory, path ); - if( !Directory.Exists( path ) ) + if ( !Directory.Exists( path ) ) Directory.CreateDirectory( path ); } @@ -232,7 +232,7 @@ namespace Server.Commands { path = Path.Combine( m_RootDirectory, path ); - if( Directory.Exists( path ) ) + if ( Directory.Exists( path ) ) Directory.Delete( path, true ); } @@ -278,17 +278,17 @@ namespace Server.Commands Type realType = varType; - if( varType.IsByRef ) + if ( varType.IsByRef ) { - if( !ignoreRef ) + if ( !ignoreRef ) prepend = RefString; realType = varType.GetElementType(); } - if( realType.IsPointer ) + if ( realType.IsPointer ) { - if( realType.IsArray ) + if ( realType.IsArray ) { append.Append( '*' ); @@ -312,7 +312,7 @@ namespace Server.Commands append.Append( " *" ); } } - else if( realType.IsArray ) + else if ( realType.IsArray ) { do { @@ -338,7 +338,7 @@ namespace Server.Commands m_Types.TryGetValue( realType, out TypeInfo info ); - if( info != null ) + if ( info != null ) { aliased = ""+info.LinkName( null ); //aliased = String.Format( "{1}", info.m_FileName, info.m_TypeName ); @@ -346,7 +346,7 @@ namespace Server.Commands else { //FormatGeneric( ); - if( realType.IsGenericType ) + if ( realType.IsGenericType ) { string typeName = ""; string fileName = ""; @@ -360,7 +360,7 @@ namespace Server.Commands { for( int i = 0; i < m_AliasLength; ++i ) { - if( m_Aliases[i, 0] == fullName ) + if ( m_Aliases[i, 0] == fullName ) { aliased = m_Aliases[i, 1]; break; @@ -368,7 +368,7 @@ namespace Server.Commands } } - if( aliased == null ) + if ( aliased == null ) aliased = realType.Name; } @@ -608,7 +608,7 @@ namespace Server.Commands sbod.Type = typeof( LeatherCap ); for( BulkMaterialType mat = BulkMaterialType.None; mat <= BulkMaterialType.Barbed; ++mat ) { - if( mat >= BulkMaterialType.DullCopper && mat <= BulkMaterialType.Valorite ) + if ( mat >= BulkMaterialType.DullCopper && mat <= BulkMaterialType.Valorite ) continue; sbod.Material = mat; @@ -629,7 +629,7 @@ namespace Server.Commands sbod.Type = typeof( LeatherCap ); for( BulkMaterialType mat = BulkMaterialType.None; mat <= BulkMaterialType.Barbed; ++mat ) { - if( mat >= BulkMaterialType.DullCopper && mat <= BulkMaterialType.Valorite ) + if ( mat >= BulkMaterialType.DullCopper && mat <= BulkMaterialType.Valorite ) continue; sbod.Material = mat; @@ -650,7 +650,7 @@ namespace Server.Commands sbod.Type = typeof( LeatherCap ); for( BulkMaterialType mat = BulkMaterialType.None; mat <= BulkMaterialType.Barbed; ++mat ) { - if( mat >= BulkMaterialType.DullCopper && mat <= BulkMaterialType.Valorite ) + if ( mat >= BulkMaterialType.DullCopper && mat <= BulkMaterialType.Valorite ) continue; sbod.Material = mat; @@ -671,7 +671,7 @@ namespace Server.Commands sbod.Type = typeof( LeatherCap ); for( BulkMaterialType mat = BulkMaterialType.None; mat <= BulkMaterialType.Barbed; ++mat ) { - if( mat >= BulkMaterialType.DullCopper && mat <= BulkMaterialType.Valorite ) + if ( mat >= BulkMaterialType.DullCopper && mat <= BulkMaterialType.Valorite ) continue; sbod.Material = mat; @@ -714,11 +714,11 @@ namespace Server.Commands lbod.RequireExceptional = false; lbod.AmountMax = 10; - if( showCloth ) + if ( showCloth ) { lbod.Material = BulkMaterialType.None; - if( expandCloth ) + if ( expandCloth ) { lbod.AmountMax = 10; DocumentTailorBOD( html, lbod.ComputeRewards( true ), "10, 15", lbod.Material, type ); @@ -734,7 +734,7 @@ namespace Server.Commands lbod.Material = BulkMaterialType.None; - if( expandPlain ) + if ( expandPlain ) { lbod.AmountMax = 10; DocumentTailorBOD( html, lbod.ComputeRewards( true ), "10, 15, 20", lbod.Material, typeof( LeatherCap ) ); @@ -763,11 +763,11 @@ namespace Server.Commands lbod.RequireExceptional = true; lbod.AmountMax = 10; - if( showCloth ) + if ( showCloth ) { lbod.Material = BulkMaterialType.None; - if( expandCloth ) + if ( expandCloth ) { lbod.AmountMax = 10; DocumentTailorBOD( html, lbod.ComputeRewards( true ), "10, 15", lbod.Material, type ); @@ -783,7 +783,7 @@ namespace Server.Commands lbod.Material = BulkMaterialType.None; - if( expandPlain ) + if ( expandPlain ) { lbod.AmountMax = 10; DocumentTailorBOD( html, lbod.ComputeRewards( true ), "10, 15, 20", lbod.Material, typeof( LeatherCap ) ); @@ -885,52 +885,48 @@ namespace Server.Commands { Item item = (Item)items[i]; - if( item is Sandals ) + if ( item is Sandals ) rewards[5] = true; - else if( item is SmallStretchedHideEastDeed || item is SmallStretchedHideSouthDeed ) + else if ( item is SmallStretchedHideEastDeed || item is SmallStretchedHideSouthDeed ) rewards[10] = rewards[11] = true; - else if( item is MediumStretchedHideEastDeed || item is MediumStretchedHideSouthDeed ) + else if ( item is MediumStretchedHideEastDeed || item is MediumStretchedHideSouthDeed ) rewards[10] = rewards[11] = true; - else if( item is LightFlowerTapestryEastDeed || item is LightFlowerTapestrySouthDeed ) + else if ( item is LightFlowerTapestryEastDeed || item is LightFlowerTapestrySouthDeed ) rewards[12] = rewards[13] = true; - else if( item is DarkFlowerTapestryEastDeed || item is DarkFlowerTapestrySouthDeed ) + else if ( item is DarkFlowerTapestryEastDeed || item is DarkFlowerTapestrySouthDeed ) rewards[12] = rewards[13] = true; - else if( item is BrownBearRugEastDeed || item is BrownBearRugSouthDeed ) + else if ( item is BrownBearRugEastDeed || item is BrownBearRugSouthDeed ) rewards[14] = rewards[15] = true; - else if( item is PolarBearRugEastDeed || item is PolarBearRugSouthDeed ) + else if ( item is PolarBearRugEastDeed || item is PolarBearRugSouthDeed ) rewards[14] = rewards[15] = true; - else if( item is ClothingBlessDeed ) + else if ( item is ClothingBlessDeed ) rewards[16] = true; - else if( item is PowerScroll ) + else if ( item is PowerScroll ps ) { - PowerScroll ps = (PowerScroll)item; - - if( ps.Value == 105.0 ) + if ( ps.Value == 105.0 ) rewards[6] = true; - else if( ps.Value == 110.0 ) + else if ( ps.Value == 110.0 ) rewards[7] = true; - else if( ps.Value == 115.0 ) + else if ( ps.Value == 115.0 ) rewards[8] = true; - else if( ps.Value == 120.0 ) + else if ( ps.Value == 120.0 ) rewards[9] = true; } - else if( item is UncutCloth ) + else if ( item is UncutCloth ) { - if( item.Hue == 0x483 || item.Hue == 0x48C || item.Hue == 0x488 || item.Hue == 0x48A ) + if ( item.Hue == 0x483 || item.Hue == 0x48C || item.Hue == 0x488 || item.Hue == 0x48A ) rewards[0] = true; - else if( item.Hue == 0x495 || item.Hue == 0x48B || item.Hue == 0x486 || item.Hue == 0x485 ) + else if ( item.Hue == 0x495 || item.Hue == 0x48B || item.Hue == 0x486 || item.Hue == 0x485 ) rewards[1] = true; - else if( item.Hue == 0x48D || item.Hue == 0x490 || item.Hue == 0x48E || item.Hue == 0x491 ) + else if ( item.Hue == 0x48D || item.Hue == 0x490 || item.Hue == 0x48E || item.Hue == 0x491 ) rewards[2] = true; - else if( item.Hue == 0x48F || item.Hue == 0x494 || item.Hue == 0x484 || item.Hue == 0x497 ) + else if ( item.Hue == 0x48F || item.Hue == 0x494 || item.Hue == 0x484 || item.Hue == 0x497 ) rewards[3] = true; else rewards[4] = true; } - else if( item is RunicSewingKit ) + else if ( item is RunicSewingKit rkit ) { - RunicSewingKit rkit = (RunicSewingKit)item; - rewards[16 + CraftResources.GetIndex( rkit.Resource )] = true; } @@ -944,7 +940,7 @@ namespace Server.Commands { case BulkMaterialType.None: { - if( type.IsSubclassOf( typeof( BaseArmor ) ) || type.IsSubclassOf( typeof( BaseShoes ) ) ) + if ( type.IsSubclassOf( typeof( BaseArmor ) ) || type.IsSubclassOf( typeof( BaseShoes ) ) ) { style = "pl"; name = "Plain"; @@ -969,7 +965,7 @@ namespace Server.Commands while( index < 20 ) { - if( rewards[index] ) + if ( rewards[index] ) { html.WriteLine( "
X
", style ); ++index; @@ -983,7 +979,7 @@ namespace Server.Commands ++count; ++index; - if( index == 5 || index == 6 || index == 10 || index == 17 ) + if ( index == 5 || index == 6 || index == 10 || index == 17 ) break; } @@ -1121,54 +1117,48 @@ namespace Server.Commands for( int i = 0; i < items.Count; ++i ) { - Item item = (Item)items[i]; + Item item = items[i]; - if( item is SturdyPickaxe || item is SturdyShovel ) + if ( item is SturdyPickaxe || item is SturdyShovel ) rewards[0] = true; - else if( item is LeatherGlovesOfMining ) + else if ( item is LeatherGlovesOfMining ) rewards[1] = true; - else if( item is StuddedGlovesOfMining ) + else if ( item is StuddedGlovesOfMining ) rewards[2] = true; - else if( item is RingmailGlovesOfMining ) + else if ( item is RingmailGlovesOfMining ) rewards[3] = true; - else if( item is GargoylesPickaxe ) + else if ( item is GargoylesPickaxe ) rewards[4] = true; - else if( item is ProspectorsTool ) + else if ( item is ProspectorsTool ) rewards[5] = true; - else if( item is PowderOfTemperament ) + else if ( item is PowderOfTemperament ) rewards[6] = true; - else if( item is ColoredAnvil ) + else if ( item is ColoredAnvil ) rewards[7] = true; - else if( item is PowerScroll ) + else if ( item is PowerScroll ps ) { - PowerScroll ps = (PowerScroll)item; - - if( ps.Value == 105.0 ) + if ( ps.Value == 105.0 ) rewards[8] = true; - else if( ps.Value == 110.0 ) + else if ( ps.Value == 110.0 ) rewards[9] = true; - else if( ps.Value == 115.0 ) + else if ( ps.Value == 115.0 ) rewards[10] = true; - else if( ps.Value == 120.0 ) + else if ( ps.Value == 120.0 ) rewards[11] = true; } - else if( item is RunicHammer ) + else if ( item is RunicHammer rh ) { - RunicHammer rh = (RunicHammer)item; - rewards[11 + CraftResources.GetIndex( rh.Resource )] = true; } - else if( item is AncientSmithyHammer ) + else if ( item is AncientSmithyHammer ash ) { - AncientSmithyHammer ash = (AncientSmithyHammer)item; - - if( ash.Bonus == 10 ) + if ( ash.Bonus == 10 ) rewards[20] = true; - else if( ash.Bonus == 15 ) + else if ( ash.Bonus == 15 ) rewards[21] = true; - else if( ash.Bonus == 30 ) + else if ( ash.Bonus == 30 ) rewards[22] = true; - else if( ash.Bonus == 60 ) + else if ( ash.Bonus == 60 ) rewards[23] = true; } @@ -1198,7 +1188,7 @@ namespace Server.Commands while( index < 24 ) { - if( rewards[index] ) + if ( rewards[index] ) { html.WriteLine( "
X
", style ); ++index; @@ -1212,7 +1202,7 @@ namespace Server.Commands ++count; ++index; - if( index == 4 || index == 8 || index == 12 || index == 20 ) + if ( index == 4 || index == 8 || index == 12 || index == 20 ) break; } @@ -1234,7 +1224,7 @@ namespace Server.Commands string path = Core.FindDataFile( "models/models.txt" ); - if( File.Exists( path ) ) + if ( File.Exists( path ) ) { using( StreamReader ip = new StreamReader( path ) ) { @@ -1244,12 +1234,12 @@ namespace Server.Commands { line = line.Trim(); - if( line.Length == 0 || line.StartsWith( "#" ) ) + if ( line.Length == 0 || line.StartsWith( "#" ) ) continue; string[] split = line.Split( '\t' ); - if( split.Length >= 9 ) + if ( split.Length >= 9 ) { Body body = Utility.ToInt32( split[0] ); ModelBodyType type = (ModelBodyType)Utility.ToInt32( split[1] ); @@ -1257,7 +1247,7 @@ namespace Server.Commands BodyEntry entry = new BodyEntry( body, type, name ); - if( !list.Contains( entry ) ) + if ( !list.Contains( entry ) ) list.Add( entry ); } } @@ -1282,7 +1272,7 @@ namespace Server.Commands html.WriteLine( " " ); html.WriteLine( "

Back to the index

" ); - if( list.Count > 0 ) + if ( list.Count > 0 ) { html.WriteLine( "

Body List

" ); @@ -1295,9 +1285,9 @@ namespace Server.Commands BodyEntry entry = list[i]; ModelBodyType type = entry.BodyType; - if( type != lastType ) + if ( type != lastType ) { - if( lastType != ModelBodyType.Invalid ) + if ( lastType != ModelBodyType.Invalid ) html.WriteLine( "
" ); lastType = type; @@ -1355,7 +1345,7 @@ namespace Server.Commands { Dictionary table = tables[p]; - if( p > 0 ) + if ( p > 0 ) html.WriteLine( "
" ); html.WriteLine( " " ); @@ -1376,7 +1366,7 @@ namespace Server.Commands for( int j = 0; j < entry.Strings.Count; ++j ) { - if( j > 0 ) + if ( j > 0 ) html.Write( "
" ); string v = entry.Strings[j]; @@ -1385,17 +1375,17 @@ namespace Server.Commands { char c = v[k]; - if( c == '<' ) + if ( c == '<' ) html.Write( "<" ); - else if( c == '>' ) + else if ( c == '>' ) html.Write( ">" ); - else if( c == '&' ) + else if ( c == '&' ) html.Write( "&" ); - else if( c == '"' ) + else if ( c == '"' ) html.Write( """ ); - else if( c == '\'' ) + else if ( c == '\'' ) html.Write( "'" ); - else if( c >= 0x20 && c < 0x7F ) + else if ( c >= 0x20 && c < 0x7F ) html.Write( c ); else html.Write( "&#{0};", (int)c ); @@ -1445,7 +1435,7 @@ namespace Server.Commands string path = Core.FindDataFile( "speech.mul" ); - if( File.Exists( path ) ) + if ( File.Exists( path ) ) { using( FileStream ip = new FileStream( path, FileMode.Open, FileAccess.Read, FileShare.Read ) ) { @@ -1457,12 +1447,12 @@ namespace Server.Commands int length = (bin.ReadByte() << 8) | bin.ReadByte(); string text = Encoding.UTF8.GetString( bin.ReadBytes( length ) ).Trim(); - if( text.Length == 0 ) + if ( text.Length == 0 ) continue; - if( table == null || lastIndex > index ) + if ( table == null || lastIndex > index ) { - if( index == 0 && text == "*withdraw*" ) + if ( index == 0 && text == "*withdraw*" ) tables.Insert( 0, table = new Dictionary() ); else tables.Add( table = new Dictionary() ); @@ -1472,7 +1462,7 @@ namespace Server.Commands table.TryGetValue( index, out SpeechEntry entry ); - if( entry == null ) + if ( entry == null ) table[index] = entry = new SpeechEntry( index ); entry.Strings.Add( text ); @@ -1516,7 +1506,7 @@ namespace Server.Commands { int v = b.AccessLevel.CompareTo( a.AccessLevel ); - if( v == 0 ) + if ( v == 0 ) v = a.Name.CompareTo( b.Name ); return v; @@ -1552,19 +1542,17 @@ namespace Server.Commands object[] attrs = mi.GetCustomAttributes( typeof( UsageAttribute ), false ); - if( attrs.Length == 0 ) + if ( attrs.Length == 0 ) continue; UsageAttribute usage = attrs[0] as UsageAttribute; attrs = mi.GetCustomAttributes( typeof( DescriptionAttribute ), false ); - if( attrs.Length == 0 ) + if ( attrs.Length == 0 ) continue; - DescriptionAttribute desc = attrs[0] as DescriptionAttribute; - - if( usage == null || desc == null ) + if ( usage == null || !(attrs[0] is DescriptionAttribute desc) ) continue; attrs = mi.GetCustomAttributes( typeof( AliasesAttribute ), false ); @@ -1573,7 +1561,7 @@ namespace Server.Commands string descString = desc.Description.Replace( "<", "<" ).Replace( ">", ">" ); - if( aliases == null ) + if ( aliases == null ) list.Add( new DocCommandEntry( e.AccessLevel, e.Command, null, usage.Usage, descString ) ); else list.Add( new DocCommandEntry( e.AccessLevel, e.Command, aliases.Aliases, usage.Usage, descString ) ); @@ -1586,7 +1574,7 @@ namespace Server.Commands string usage = command.Usage; string desc = command.Description; - if( usage == null || desc == null ) + if ( usage == null || desc == null ) continue; string[] cmds = command.Commands; @@ -1598,31 +1586,31 @@ namespace Server.Commands desc = desc.Replace( "<", "<" ).Replace( ">", ">" ); - if( command.Supports != CommandSupport.Single ) + if ( command.Supports != CommandSupport.Single ) { StringBuilder sb = new StringBuilder( 50 + desc.Length ); sb.Append( "Modifiers: " ); - if( (command.Supports & CommandSupport.Global) != 0 ) + if ( (command.Supports & CommandSupport.Global) != 0 ) sb.Append( "Global, " ); - if( (command.Supports & CommandSupport.Online) != 0 ) + if ( (command.Supports & CommandSupport.Online) != 0 ) sb.Append( "Online, " ); - if( (command.Supports & CommandSupport.Region) != 0 ) + if ( (command.Supports & CommandSupport.Region) != 0 ) sb.Append( "Region, " ); - if( (command.Supports & CommandSupport.Contained) != 0 ) + if ( (command.Supports & CommandSupport.Contained) != 0 ) sb.Append( "Contained, " ); - if( (command.Supports & CommandSupport.Multi) != 0 ) + if ( (command.Supports & CommandSupport.Multi) != 0 ) sb.Append( "Multi, " ); - if( (command.Supports & CommandSupport.Area) != 0 ) + if ( (command.Supports & CommandSupport.Area) != 0 ) sb.Append( "Area, " ); - if( (command.Supports & CommandSupport.Self) != 0 ) + if ( (command.Supports & CommandSupport.Self) != 0 ) sb.Append( "Self, " ); sb.Remove( sb.Length - 2, 2 ); @@ -1644,7 +1632,7 @@ namespace Server.Commands string usage = command.Usage; string desc = command.Description; - if( usage == null || desc == null ) + if ( usage == null || desc == null ) continue; string[] cmds = command.Accessors; @@ -1665,9 +1653,9 @@ namespace Server.Commands foreach( DocCommandEntry e in list ) { - if( e.AccessLevel != last ) + if ( e.AccessLevel != last ) { - if( last != AccessLevel.Player ) + if ( last != AccessLevel.Player ) html.WriteLine( "

" ); last = e.AccessLevel; @@ -1708,7 +1696,7 @@ namespace Server.Commands { CommandEntry c = list[j]; - if( e.Handler.Method == c.Handler.Method ) + if ( e.Handler.Method == c.Handler.Method ) { list.RemoveAt( j ); --j; @@ -1725,7 +1713,7 @@ namespace Server.Commands html.Write( " {0}", e.Name ); - if( aliases == null || aliases.Length == 0 ) + if ( aliases == null || aliases.Length == 0 ) { html.Write( "Usage: {0}
{1}", usage.Replace( "<", "<" ).Replace( ">", ">" ), desc ); } @@ -1735,7 +1723,7 @@ namespace Server.Commands for( int i = 0; i < aliases.Length; ++i ) { - if( i != 0 ) + if ( i != 0 ) html.Write( ", " ); html.Write( aliases[i] ); @@ -1759,7 +1747,7 @@ namespace Server.Commands string nspace = type.Namespace; - if( nspace == null || type.IsSpecialName ) + if ( nspace == null || type.IsSpecialName ) continue; TypeInfo info = new TypeInfo( type ); @@ -1767,21 +1755,21 @@ namespace Server.Commands m_Namespaces.TryGetValue( nspace, out List nspaces ); - if( nspaces == null ) + if ( nspaces == null ) m_Namespaces[nspace] = nspaces = new List(); nspaces.Add( info ); Type baseType = info.m_BaseType; - if( baseType != null && InAssemblies( baseType, asms ) ) + if ( baseType != null && InAssemblies( baseType, asms ) ) { m_Types.TryGetValue( baseType, out TypeInfo baseInfo ); - if( baseInfo == null ) + if ( baseInfo == null ) m_Types[baseType] = baseInfo = new TypeInfo( baseType ); - if( baseInfo.m_Derived == null ) + if ( baseInfo.m_Derived == null ) baseInfo.m_Derived = new List(); baseInfo.m_Derived.Add( info ); @@ -1789,14 +1777,14 @@ namespace Server.Commands Type decType = info.m_Declaring; - if( decType != null ) + if ( decType != null ) { m_Types.TryGetValue( decType, out TypeInfo decInfo ); - if( decInfo == null ) + if ( decInfo == null ) m_Types[decType] = decInfo = new TypeInfo( decType ); - if( decInfo.m_Nested == null ) + if ( decInfo.m_Nested == null ) decInfo.m_Nested = new List(); decInfo.m_Nested.Add( info ); @@ -1806,15 +1794,15 @@ namespace Server.Commands { Type iface = info.m_Interfaces[j]; - if( !InAssemblies( iface, asms ) ) + if ( !InAssemblies( iface, asms ) ) continue; m_Types.TryGetValue( iface, out TypeInfo ifaceInfo ); - if( ifaceInfo == null ) + if ( ifaceInfo == null ) m_Types[iface] = ifaceInfo = new TypeInfo( iface ); - if( ifaceInfo.m_Derived == null ) + if ( ifaceInfo.m_Derived == null ) ifaceInfo.m_Derived = new List(); ifaceInfo.m_Derived.Add( info ); @@ -1827,7 +1815,7 @@ namespace Server.Commands Assembly a = t.Assembly; for( int i = 0; i < asms.Length; ++i ) - if( a == asms[i] ) + if ( a == asms[i] ) return true; return false; @@ -1839,7 +1827,7 @@ namespace Server.Commands private static bool IsConstructible( Type t, out bool isItem ) { - if( isItem = typeofItem.IsAssignableFrom( t ) ) + if ( isItem = typeofItem.IsAssignableFrom( t ) ) return true; return typeofMobile.IsAssignableFrom( t ); @@ -1862,7 +1850,7 @@ namespace Server.Commands Type t = types[i].m_Type; bool isItem; - if( t.IsAbstract || !IsConstructible( t, out isItem ) ) + if ( t.IsAbstract || !IsConstructible( t, out isItem ) ) continue; ConstructorInfo[] ctors = t.GetConstructors(); @@ -1871,7 +1859,7 @@ namespace Server.Commands for( int j = 0; !anyConstructible && j < ctors.Length; ++j ) anyConstructible = IsConstructible( ctors[j] ); - if( anyConstructible ) + if ( anyConstructible ) { (isItem ? items : mobiles).Add( t ); (isItem ? items : mobiles).Add( ctors ); @@ -1926,10 +1914,10 @@ namespace Server.Commands { ConstructorInfo ctor = ctors[i]; - if( !IsConstructible( ctor ) ) + if ( !IsConstructible( ctor ) ) continue; - if( !first ) + if ( !first ) html.Write( "
" ); first = false; @@ -1944,7 +1932,7 @@ namespace Server.Commands m_Types.TryGetValue( parms[j].ParameterType, out TypeInfo typeInfo ); - if( typeInfo != null ) + if ( typeInfo != null ) html.Write( "href=\"types/{0}\" ", typeInfo.FileName ); html.Write( "title=\"{0}\">{1}
", GetTooltipFor( parms[j] ), parms[j].Name ); @@ -1985,11 +1973,11 @@ namespace Server.Commands { Type checkType = (Type)m_Tooltips[i, 0]; - if( paramType == checkType ) + if ( paramType == checkType ) return String.Format( (string)m_Tooltips[i, 1], HtmlNewLine ); } - if( paramType.IsEnum ) + if ( paramType.IsEnum ) { StringBuilder sb = new StringBuilder(); @@ -2002,30 +1990,25 @@ namespace Server.Commands return sb.ToString(); } - else if( paramType.IsDefined( typeofCustomEnum, false ) ) + if ( paramType.IsDefined( typeofCustomEnum, false ) ) { object[] attributes = paramType.GetCustomAttributes( typeofCustomEnum, false ); - if( attributes != null && attributes.Length > 0 ) + if ( attributes.Length > 0 && attributes[0] is CustomEnumAttribute attr ) { - CustomEnumAttribute attr = attributes[0] as CustomEnumAttribute; + StringBuilder sb = new StringBuilder(); - if( attr != null ) - { - StringBuilder sb = new StringBuilder(); + sb.AppendFormat( "Enumeration value or name. Possible named values include:{0}", HtmlNewLine ); - sb.AppendFormat( "Enumeration value or name. Possible named values include:{0}", HtmlNewLine ); + string[] names = attr.Names; - string[] names = attr.Names; + for( int i = 0; i < names.Length; ++i ) + sb.AppendFormat( "{0}- {1}", HtmlNewLine, names[i] ); - for( int i = 0; i < names.Length; ++i ) - sb.AppendFormat( "{0}- {1}", HtmlNewLine, names[i] ); - - return sb.ToString(); - } + return sb.ToString(); } } - else if( paramType == typeofMap ) + else if ( paramType == typeofMap ) { StringBuilder sb = new StringBuilder(); @@ -2110,7 +2093,7 @@ namespace Server.Commands private static void SaveType( TypeInfo info, StreamWriter nsHtml, string nsFileName, string nsName ) { - if( info.m_Declaring == null ) + if ( info.m_Declaring == null ) nsHtml.WriteLine( " "+info.LinkName( "../types/" ) + "
" ); using( StreamWriter typeHtml = Docs.GetWriter( info.FileName ) ) @@ -2122,7 +2105,7 @@ namespace Server.Commands typeHtml.WriteLine( " " ); typeHtml.WriteLine( "

Back to {1}

", nsFileName, nsName ); - if( info.m_Type.IsEnum ) + if ( info.m_Type.IsEnum ) WriteEnum( info, typeHtml ); else WriteType( info, typeHtml ); @@ -2144,7 +2127,7 @@ namespace Server.Commands bool flags = type.IsDefined( typeof( FlagsAttribute ), false ); string format; - if( flags ) + if ( flags ) format = " {0:G} = 0x{1:X}{2}
"; else format = " {0:G} = {1:D}{2}
"; @@ -2165,7 +2148,7 @@ namespace Server.Commands Type decType = info.m_Declaring; - if( decType != null ) + if ( decType != null ) { // We are a nested type @@ -2173,7 +2156,7 @@ namespace Server.Commands m_Types.TryGetValue( decType, out TypeInfo decInfo ); - if( decInfo == null ) + if ( decInfo == null ) typeHtml.Write( decType.Name ); else //typeHtml.Write( "{1}", decInfo.m_FileName, decInfo.m_TypeName ); @@ -2189,13 +2172,13 @@ namespace Server.Commands int extendCount = 0; - if( baseType != null && baseType != typeof( object ) && baseType != typeof( ValueType ) && !baseType.IsPrimitive ) + if ( baseType != null && baseType != typeof( object ) && baseType != typeof( ValueType ) && !baseType.IsPrimitive ) { typeHtml.Write( " : " ); m_Types.TryGetValue( baseType, out TypeInfo baseInfo ); - if( baseInfo == null ) + if ( baseInfo == null ) typeHtml.Write( baseType.Name ); else { @@ -2205,9 +2188,9 @@ namespace Server.Commands ++extendCount; } - if( ifaces.Length > 0 ) + if ( ifaces.Length > 0 ) { - if( extendCount == 0 ) + if ( extendCount == 0 ) typeHtml.Write( " : " ); for( int i = 0; i < ifaces.Length; ++i ) @@ -2215,12 +2198,12 @@ namespace Server.Commands Type iface = ifaces[i]; m_Types.TryGetValue( iface, out TypeInfo ifaceInfo ); - if( extendCount != 0 ) + if ( extendCount != 0 ) typeHtml.Write( ", " ); ++extendCount; - if( ifaceInfo == null ) + if ( ifaceInfo == null ) { string typeName = ""; string fileName = ""; @@ -2240,7 +2223,7 @@ namespace Server.Commands List derived = info.m_Derived; - if( derived != null ) + if ( derived != null ) { typeHtml.Write( "

Derived Types: " ); @@ -2250,7 +2233,7 @@ namespace Server.Commands { TypeInfo derivedInfo = derived[i]; - if( i != 0 ) + if ( i != 0 ) typeHtml.Write( ", " ); //typeHtml.Write( "{1}", derivedInfo.m_FileName, derivedInfo.m_TypeName ); @@ -2262,7 +2245,7 @@ namespace Server.Commands List nested = info.m_Nested; - if( nested != null ) + if ( nested != null ) { typeHtml.Write( "

Nested Types: " ); @@ -2272,7 +2255,7 @@ namespace Server.Commands { TypeInfo nestedInfo = nested[i]; - if( i != 0 ) + if ( i != 0 ) typeHtml.Write( ", " ); //typeHtml.Write( "{1}", nestedInfo.m_FileName, nestedInfo.m_TypeName ); @@ -2290,12 +2273,12 @@ namespace Server.Commands { MemberInfo mi = membs[i]; - if( mi is PropertyInfo ) - WriteProperty( (PropertyInfo)mi, typeHtml ); - else if( mi is ConstructorInfo ) - WriteCtor( info.TypeName, (ConstructorInfo)mi, typeHtml ); - else if( mi is MethodInfo ) - WriteMethod( (MethodInfo)mi, typeHtml ); + if ( mi is PropertyInfo propertyInfo ) + WriteProperty( propertyInfo, typeHtml ); + else if ( mi is ConstructorInfo constructorInfo ) + WriteCtor( info.TypeName, constructorInfo, typeHtml ); + else if ( mi is MethodInfo methodInfo ) + WriteMethod( methodInfo, typeHtml ); } } @@ -2306,16 +2289,16 @@ namespace Server.Commands MethodInfo getMethod = pi.GetGetMethod(); MethodInfo setMethod = pi.GetSetMethod(); - if( (getMethod != null && getMethod.IsStatic) || (setMethod != null && setMethod.IsStatic) ) + if ( (getMethod != null && getMethod.IsStatic) || (setMethod != null && setMethod.IsStatic) ) html.Write( StaticString ); html.Write( GetPair( pi.PropertyType, pi.Name, false ) ); html.Write( '(' ); - if( pi.CanRead ) + if ( pi.CanRead ) html.Write( GetString ); - if( pi.CanWrite ) + if ( pi.CanWrite ) html.Write( SetString ); html.WriteLine( " )
" ); @@ -2323,7 +2306,7 @@ namespace Server.Commands private static void WriteCtor( string name, ConstructorInfo ctor, StreamWriter html ) { - if( ctor.IsStatic ) + if ( ctor.IsStatic ) return; html.Write( " " ); @@ -2333,7 +2316,7 @@ namespace Server.Commands ParameterInfo[] parms = ctor.GetParameters(); - if( parms.Length > 0 ) + if ( parms.Length > 0 ) { html.Write( ' ' ); @@ -2341,12 +2324,12 @@ namespace Server.Commands { ParameterInfo pi = parms[i]; - if( i != 0 ) + if ( i != 0 ) html.Write( ", " ); - if( pi.IsIn ) + if ( pi.IsIn ) html.Write( InString ); - else if( pi.IsOut ) + else if ( pi.IsOut ) html.Write( OutString ); html.Write( GetPair( pi.ParameterType, pi.Name, pi.IsOut ) ); @@ -2360,15 +2343,15 @@ namespace Server.Commands private static void WriteMethod( MethodInfo mi, StreamWriter html ) { - if( mi.IsSpecialName ) + if ( mi.IsSpecialName ) return; html.Write( " " ); - if( mi.IsStatic ) + if ( mi.IsStatic ) html.Write( StaticString ); - if( mi.IsVirtual ) + if ( mi.IsVirtual ) html.Write( VirtString ); html.Write( GetPair( mi.ReturnType, mi.Name, false ) ); @@ -2376,7 +2359,7 @@ namespace Server.Commands ParameterInfo[] parms = mi.GetParameters(); - if( parms.Length > 0 ) + if ( parms.Length > 0 ) { html.Write( ' ' ); @@ -2384,12 +2367,12 @@ namespace Server.Commands { ParameterInfo pi = parms[i]; - if( i != 0 ) + if ( i != 0 ) html.Write( ", " ); - if( pi.IsIn ) + if ( pi.IsIn ) html.Write( InString ); - else if( pi.IsOut ) + else if ( pi.IsOut ) html.Write( OutString ); html.Write( GetPair( pi.ParameterType, pi.Name, pi.IsOut ) ); @@ -2408,18 +2391,18 @@ namespace Server.Commands string fnam = null; string link = null; - if( type.IsGenericType ) + if ( type.IsGenericType ) { int index = type.Name.IndexOf( '`' ); - if( index > 0 ) + if ( index > 0 ) { string rootType = type.Name.Substring( 0, index ); StringBuilder nameBuilder = new StringBuilder( rootType ); StringBuilder fnamBuilder = new StringBuilder( "docs/types/" + Docs.SanitizeType( rootType ) ); StringBuilder linkBuilder; - if( DontLink( type ) )//if( DontLink( rootType ) ) + if ( DontLink( type ) )//if ( DontLink( rootType ) ) linkBuilder = new StringBuilder( "" + rootType + "" ); else linkBuilder = new StringBuilder( "" + rootType + "" ); @@ -2432,7 +2415,7 @@ namespace Server.Commands for( int i = 0; i < typeArguments.Length; i++ ) { - if( i != 0 ) + if ( i != 0 ) { nameBuilder.Append( ',' ); fnamBuilder.Append( ',' ); @@ -2444,7 +2427,7 @@ namespace Server.Commands nameBuilder.Append( sanitizedName ); fnamBuilder.Append( "T" ); - if( DontLink( typeArguments[i] ) )//if( DontLink( typeArguments[i].Name ) ) + if ( DontLink( typeArguments[i] ) )//if ( DontLink( typeArguments[i].Name ) ) linkBuilder.Append( "" + aliasedName + "" ); else linkBuilder.Append( "" + aliasedName + "" ); @@ -2459,15 +2442,15 @@ namespace Server.Commands link = linkBuilder.ToString(); } } - if( name == null ) typeName = type.Name; + if ( name == null ) typeName = type.Name; else typeName = name; - if( fnam == null ) fileName = "docs/types/" + Docs.SanitizeType( type.Name ) + ".html"; + if ( fnam == null ) fileName = "docs/types/" + Docs.SanitizeType( type.Name ) + ".html"; else fileName = fnam + ".html"; - if( link == null ) + if ( link == null ) { - if( DontLink( type ) ) //if( DontLink( type.Name ) ) + if ( DontLink( type ) ) //if ( DontLink( type.Name ) ) linkName = "" + Docs.SanitizeType( type.Name ) + ""; else linkName = "" + Docs.SanitizeType( type.Name ) + ""; @@ -2480,11 +2463,11 @@ namespace Server.Commands public static string SanitizeType( string name ) { bool anonymousType = false; - if( name.Contains( "<" ) ) anonymousType = true; + if ( name.Contains( "<" ) ) anonymousType = true; StringBuilder sb = new StringBuilder( name ); for( int i = 0; i < ReplaceChars.Length; ++i ) { sb.Replace( ReplaceChars[i], '-' ); } - if( anonymousType ) return "(Anonymous-Type)"+sb.ToString(); + if ( anonymousType ) return "(Anonymous-Type)"+sb.ToString(); else return sb.ToString(); } @@ -2492,7 +2475,7 @@ namespace Server.Commands { for( int i = 0; i < m_AliasLength; ++i ) { - if( m_Aliases[i, 0] == name ) + if ( m_Aliases[i, 0] == name ) { return m_Aliases[i, 1]; } @@ -2520,7 +2503,7 @@ namespace Server.Commands public static bool DontLink( string name ) { foreach( string dontLink in m_DontLink ) - if( dontLink == name ) return true; + if ( dontLink == name ) return true; return false; } */ @@ -2531,7 +2514,7 @@ namespace Server.Commands if ( type.Name == "T" || String.IsNullOrEmpty( type.Namespace ) || m_Namespaces == null ) return true; - if( type.Namespace.StartsWith( "Server" ) ) + if ( type.Namespace.StartsWith( "Server" ) ) return false; return !m_Namespaces.ContainsKey( type.Namespace ); @@ -2585,10 +2568,10 @@ namespace Server.Commands { int v = a.BodyType.CompareTo( b.BodyType ); - if( v == 0 ) + if ( v == 0 ) v = a.Body.BodyID.CompareTo( b.Body.BodyID ); - if( v == 0 ) + if ( v == 0 ) v = a.Name.CompareTo( b.Name ); return v; diff --git a/Scripts/Commands/Dupe.cs b/Scripts/Commands/Dupe.cs index de311747b..c8b083d8d 100644 --- a/Scripts/Commands/Dupe.cs +++ b/Scripts/Commands/Dupe.cs @@ -60,16 +60,14 @@ namespace Server.Commands CommandLogging.WriteLine( from, "{0} {1} duping {2} (inBag={3}; amount={4})", from.AccessLevel, CommandLogging.Format( from ), CommandLogging.Format( targ ), m_InBag, m_Amount ); Item copy = (Item)targ; - Container pack; + Container pack = null; if ( m_InBag ) { - if ( copy.Parent is Container ) - pack = (Container)copy.Parent; - else if ( copy.Parent is Mobile ) - pack = ( (Mobile)copy.Parent ).Backpack; - else - pack = null; + if ( copy.Parent is Container cont ) + pack = cont; + else if ( copy.Parent is Mobile m ) + pack = m.Backpack; } else pack = from.Backpack; @@ -87,11 +85,8 @@ namespace Server.Commands from.SendMessage( "Duping {0}...", m_Amount ); for ( int i = 0; i < m_Amount; i++ ) { - object o = c.Invoke( null ); - - if ( o != null && o is Item ) + if ( c.Invoke( null ) is Item newItem ) { - Item newItem = (Item)o; CopyProperties( newItem, copy );//copy.Dupe( item, copy.Amount ); copy.OnAfterDuped( newItem ); newItem.Parent = null; diff --git a/Scripts/Commands/GenCategorization.cs b/Scripts/Commands/GenCategorization.cs index 343980c06..729289e4d 100644 --- a/Scripts/Commands/GenCategorization.cs +++ b/Scripts/Commands/GenCategorization.cs @@ -97,16 +97,12 @@ namespace Server.Commands xml.WriteAttributeString( "type", cte.Type.ToString() ); - object obj = cte.Object; - - if ( obj is Item ) + if ( cte.Object is Item item ) { - Item item = (Item)obj; - int itemID = item.ItemID; - if ( item is BaseAddon && ((BaseAddon)item).Components.Count == 1 ) - itemID = ((AddonComponent)(((BaseAddon)item).Components[0])).ItemID; + if ( item is BaseAddon addon && addon.Components.Count == 1 ) + itemID = addon.Components[0].ItemID; if ( itemID > TileData.MaxItemValue ) itemID = 1; @@ -123,10 +119,8 @@ namespace Server.Commands item.Delete(); } - else if ( obj is Mobile ) + else if ( cte.Object is Mobile mob ) { - Mobile mob = (Mobile)obj; - int itemID = ShrinkTable.Lookup( mob, 1 ); xml.WriteAttributeString( "gfx", XmlConvert.ToString( itemID ) ); @@ -251,15 +245,15 @@ namespace Server.Commands { string a = null, b = null; - if ( x is CategoryEntry ) - a = ((CategoryEntry)x).Title; - else if ( x is CategoryTypeEntry ) - a = ((CategoryTypeEntry)x).Type.Name; + if ( x is CategoryEntry entry ) + a = entry.Title; + else if ( x is CategoryTypeEntry typeEntry ) + a = typeEntry.Type.Name; - if ( y is CategoryEntry ) - b = ((CategoryEntry)y).Title; - else if ( y is CategoryTypeEntry ) - b = ((CategoryTypeEntry)y).Type.Name; + if ( y is CategoryEntry categoryEntry ) + b = categoryEntry.Title; + else if ( y is CategoryTypeEntry typeEntry ) + b = typeEntry.Type.Name; if ( a == null && b == null ) return 0; @@ -423,4 +417,4 @@ namespace Server.Commands return (CategoryLine[])list.ToArray( typeof( CategoryLine ) ); } } -} \ No newline at end of file +} diff --git a/Scripts/Commands/Generic/Commands/BaseCommand.cs b/Scripts/Commands/Generic/Commands/BaseCommand.cs index 07d2022c5..f5ed12909 100644 --- a/Scripts/Commands/Generic/Commands/BaseCommand.cs +++ b/Scripts/Commands/Generic/Commands/BaseCommand.cs @@ -76,19 +76,14 @@ namespace Server.Commands.Generic if ( from.AccessLevel >= AccessLevel.Administrator || obj == null ) return true; - Mobile mob; + Mobile mob = null; - if ( obj is Mobile ) - mob = (Mobile)obj; - else if ( obj is Item ) - mob = ((Item)obj).RootParent as Mobile; - else - mob = null; + if ( obj is Mobile m ) + mob = m; + else if ( obj is Item item ) + mob = item.RootParent as Mobile; - if ( mob == null || mob == from || from.AccessLevel > mob.AccessLevel ) - return true; - - return false; + return mob == null || mob == from || from.AccessLevel > mob.AccessLevel; } public virtual void ExecuteList( CommandEventArgs e, ArrayList list ) @@ -179,16 +174,16 @@ namespace Server.Commands.Generic { object obj = m_Responses[i]; - if ( obj is MessageEntry ) + if ( obj is MessageEntry entry ) { - from.SendMessage( ((MessageEntry)obj).ToString() ); + from.SendMessage( entry.ToString() ); if ( flushToLog ) - CommandLogging.WriteLine( from, ((MessageEntry)obj).ToString() ); + CommandLogging.WriteLine( from, entry.ToString() ); } - else if ( obj is Gump ) + else if ( obj is Gump gump ) { - from.SendGump( (Gump) obj ); + from.SendGump( gump ); } } } @@ -202,4 +197,4 @@ namespace Server.Commands.Generic m_Failures.Clear(); } } -} \ No newline at end of file +} diff --git a/Scripts/Commands/Generic/Commands/Commands.cs b/Scripts/Commands/Generic/Commands/Commands.cs index 543a14651..8e214bd41 100644 --- a/Scripts/Commands/Generic/Commands/Commands.cs +++ b/Scripts/Commands/Generic/Commands/Commands.cs @@ -130,9 +130,7 @@ namespace Server.Commands.Generic public override void Execute( CommandEventArgs e, object obj ) { - Item item = obj as Item; - - if ( item != null ) + if ( obj is Item item ) { if ( e.Mobile.PlaceInBackpack( item ) ) AddResponse( "The item has been placed in your backpack." ); @@ -156,9 +154,9 @@ namespace Server.Commands.Generic public override void Execute( CommandEventArgs e, object obj ) { - if ( obj is HouseSign ) + if ( obj is HouseSign sign ) { - BaseHouse house = ((HouseSign)obj).Owner; + BaseHouse house = sign.Owner; if ( house == null ) { @@ -416,10 +414,10 @@ namespace Server.Commands.Generic object obj = list[i]; Container cont = null; - if ( obj is Mobile ) - cont = ((Mobile)obj).Backpack; - else if ( obj is Container ) - cont = (Container)obj; + if ( obj is Mobile mobile ) + cont = mobile.Backpack; + else if ( obj is Container container ) + cont = container; if ( cont != null ) packs.Add( cont ); @@ -480,15 +478,13 @@ namespace Server.Commands.Generic public override void Execute( CommandEventArgs e, object obj ) { - IPoint3D p = obj as IPoint3D; - - if ( p == null ) + if ( !(obj is IPoint3D p) ) return; - if ( p is Item ) - p = ((Item)p).GetWorldTop(); - else if ( p is Mobile ) - p = ((Mobile)p).Location; + if ( p is Item item ) + p = item.GetWorldTop(); + else if ( p is Mobile m ) + p = m.Location; Add.Invoke( e.Mobile, new Point3D( p ), new Point3D( p ), e.Arguments ); } @@ -508,9 +504,7 @@ namespace Server.Commands.Generic public override void Execute( CommandEventArgs e, object obj ) { - IPoint3D p = obj as IPoint3D; - - if ( p == null ) + if ( !(obj is IPoint3D p) ) return; Mobile from = e.Mobile; @@ -560,9 +554,9 @@ namespace Server.Commands.Generic { Item item = mob.Items[i]; - if ( item is IMountItem ) + if ( item is IMountItem mountItem ) { - IMount mount = ((IMountItem)item).Mount; + IMount mount = mountItem.Mount; if ( mount != null ) { @@ -608,11 +602,11 @@ namespace Server.Commands.Generic public override void Execute( CommandEventArgs e, object obj ) { - if ( obj is BaseVendor ) + if ( obj is BaseVendor vendor ) { - CommandLogging.WriteLine( e.Mobile, "{0} {1} restocking {2}", e.Mobile.AccessLevel, CommandLogging.Format( e.Mobile ), CommandLogging.Format( obj ) ); + CommandLogging.WriteLine( e.Mobile, "{0} {1} restocking {2}", e.Mobile.AccessLevel, CommandLogging.Format( e.Mobile ), CommandLogging.Format( vendor ) ); - ((BaseVendor)obj).Restock(); + vendor.Restock(); AddResponse( "The vendor has been restocked." ); } else @@ -816,16 +810,16 @@ namespace Server.Commands.Generic public override void Execute( CommandEventArgs e, object obj ) { - if ( obj is Item ) + if ( obj is Item item ) { - CommandLogging.WriteLine( e.Mobile, "{0} {1} deleting {2}", e.Mobile.AccessLevel, CommandLogging.Format( e.Mobile ), CommandLogging.Format( obj ) ); - ((Item)obj).Delete(); + CommandLogging.WriteLine( e.Mobile, "{0} {1} deleting {2}", e.Mobile.AccessLevel, CommandLogging.Format( e.Mobile ), CommandLogging.Format( item ) ); + item.Delete(); AddResponse( "The item has been deleted." ); } - else if ( obj is Mobile && !((Mobile)obj).Player ) + else if ( obj is Mobile mobile && !mobile.Player ) { - CommandLogging.WriteLine( e.Mobile, "{0} {1} deleting {2}", e.Mobile.AccessLevel, CommandLogging.Format( e.Mobile ), CommandLogging.Format( obj ) ); - ((Mobile)obj).Delete(); + CommandLogging.WriteLine( e.Mobile, "{0} {1} deleting {2}", e.Mobile.AccessLevel, CommandLogging.Format( e.Mobile ), CommandLogging.Format( mobile ) ); + mobile.Delete(); AddResponse( "The mobile has been deleted." ); } else @@ -887,9 +881,7 @@ namespace Server.Commands.Generic { if ( mob.IsDeadBondedPet ) { - BaseCreature bc = mob as BaseCreature; - - if ( bc != null ) + if ( mob is BaseCreature bc ) { CommandLogging.WriteLine( from, "{0} {1} resurrecting {2}", from.AccessLevel, CommandLogging.Format( from ), CommandLogging.Format( mob ) ); @@ -1048,10 +1040,7 @@ namespace Server.Commands.Generic if ( fromState != null && targState != null ) { - Account fromAccount = fromState.Account as Account; - Account targAccount = targState.Account as Account; - - if ( fromAccount != null && targAccount != null ) + if ( fromState.Account is Account && targState.Account is Account targAccount ) { CommandLogging.WriteLine( from, "{0} {1} {2} {3}", from.AccessLevel, CommandLogging.Format( from ), m_Ban ? "banning" : "kicking", CommandLogging.Format( targ ) ); @@ -1095,9 +1084,7 @@ namespace Server.Commands.Generic public override void Execute( CommandEventArgs e, object obj ) { - Item item = obj as Item; - - if ( item == null ) + if ( !(obj is Item item) ) return; if ( !item.IsLockedDown && !item.IsSecure ) diff --git a/Scripts/Commands/Generic/Commands/Interface.cs b/Scripts/Commands/Generic/Commands/Interface.cs index d41964e77..29cd5ef39 100644 --- a/Scripts/Commands/Generic/Commands/Interface.cs +++ b/Scripts/Commands/Generic/Commands/Interface.cs @@ -137,17 +137,13 @@ namespace Server.Commands.Generic object obj = m_List[i]; bool isDeleted = false; - if ( obj is Item ) + if ( obj is Item item ) { - Item item = (Item)obj; - if ( !(isDeleted = item.Deleted) ) AddEntryHtml( 40 + 130, item.GetType().Name ); } - else if ( obj is Mobile ) + else if ( obj is Mobile mob ) { - Mobile mob = (Mobile)obj; - if ( !(isDeleted = mob.Deleted) ) AddEntryHtml( 40 + 130, mob.Name ); } @@ -231,10 +227,10 @@ namespace Server.Commands.Generic break; } - if ( obj is Item && !((Item)obj).Deleted ) - m_From.SendGump( new InterfaceItemGump( m_From, m_Columns, m_List, m_Page, (Item) obj ) ); - else if ( obj is Mobile && !((Mobile)obj).Deleted ) - m_From.SendGump( new InterfaceMobileGump( m_From, m_Columns, m_List, m_Page, (Mobile) obj ) ); + if ( obj is Item item && !item.Deleted ) + m_From.SendGump( new InterfaceItemGump( m_From, m_Columns, m_List, m_Page, item ) ); + else if ( obj is Mobile mobile && !mobile.Deleted ) + m_From.SendGump( new InterfaceMobileGump( m_From, m_Columns, m_List, m_Page, mobile ) ); else m_From.SendGump( new InterfaceGump( m_From, m_Columns, m_List, m_Page, m_Select ) ); } @@ -567,4 +563,4 @@ namespace Server.Commands.Generic } } } -} \ No newline at end of file +} diff --git a/Scripts/Commands/Generic/Extensions/BaseExtension.cs b/Scripts/Commands/Generic/Extensions/BaseExtension.cs index 2dd46128c..36b7239ad 100644 --- a/Scripts/Commands/Generic/Extensions/BaseExtension.cs +++ b/Scripts/Commands/Generic/Extensions/BaseExtension.cs @@ -107,8 +107,8 @@ namespace Server.Commands.Generic ext.Parse( from, args, i + 1, size - i - 1 ); - if ( ext is WhereExtension ) - baseType = ( ext as WhereExtension ).Conditional.Type; + if ( ext is WhereExtension extension ) + baseType = extension.Conditional.Type; parsed.Add( ext ); diff --git a/Scripts/Commands/Generic/Extensions/Compilers/ConditionalCompiler.cs b/Scripts/Commands/Generic/Extensions/Compilers/ConditionalCompiler.cs index 499eb8adb..e626b86c3 100644 --- a/Scripts/Commands/Generic/Extensions/Compilers/ConditionalCompiler.cs +++ b/Scripts/Commands/Generic/Extensions/Compilers/ConditionalCompiler.cs @@ -87,22 +87,22 @@ namespace Server.Commands.Generic } else { - if ( m_Value is int ) - method.Load( (int) m_Value ); - else if ( m_Value is long ) - method.Load( (long) m_Value ); - else if ( m_Value is float ) - method.Load( (float) m_Value ); - else if ( m_Value is double ) - method.Load( (double) m_Value ); - else if ( m_Value is char ) - method.Load( (char) m_Value ); - else if ( m_Value is bool ) - method.Load( (bool) m_Value ); - else if ( m_Value is string ) - method.Load( (string) m_Value ); - else if ( m_Value is Enum ) - method.Load( (Enum) m_Value ); + if ( m_Value is int i ) + method.Load( i ); + else if ( m_Value is long l ) + method.Load( l ); + else if ( m_Value is float f ) + method.Load( f ); + else if ( m_Value is double d ) + method.Load( d ); + else if ( m_Value is char c ) + method.Load( c ); + else if ( m_Value is bool b ) + method.Load( b ); + else if ( m_Value is string s ) + method.Load( s ); + else if ( m_Value is Enum e ) + method.Load( e ); else throw new InvalidOperationException( "Unrecognized comparison value." ); } @@ -110,10 +110,8 @@ namespace Server.Commands.Generic public void Acquire( TypeBuilder typeBuilder, ILGenerator il, string fieldName ) { - if ( m_Value is string ) + if ( m_Value is string toParse ) { - string toParse = (string) m_Value; - if ( !m_Type.IsValueType && toParse == "null" ) { m_Value = null; @@ -391,7 +389,7 @@ namespace Server.Commands.Generic bool inverse = false; bool couldCompare = - emitter.CompareTo( 1, delegate() + emitter.CompareTo( 1, delegate { m_Value.Load( emitter ); } ); diff --git a/Scripts/Commands/Generic/Extensions/Compilers/DistinctCompiler.cs b/Scripts/Commands/Generic/Extensions/Compilers/DistinctCompiler.cs index 3c49414de..af6937e28 100644 --- a/Scripts/Commands/Generic/Extensions/Compilers/DistinctCompiler.cs +++ b/Scripts/Commands/Generic/Extensions/Compilers/DistinctCompiler.cs @@ -84,7 +84,7 @@ namespace Server.Commands.Generic emitter.Chain( prop ); bool couldCompare = - emitter.CompareTo( 1, delegate() + emitter.CompareTo( 1, delegate { emitter.LoadLocal( b ); emitter.Chain( prop ); diff --git a/Scripts/Commands/Generic/Extensions/Compilers/SortCompiler.cs b/Scripts/Commands/Generic/Extensions/Compilers/SortCompiler.cs index 386aa8a88..21d056c56 100644 --- a/Scripts/Commands/Generic/Extensions/Compilers/SortCompiler.cs +++ b/Scripts/Commands/Generic/Extensions/Compilers/SortCompiler.cs @@ -130,7 +130,7 @@ namespace Server.Commands.Generic emitter.Chain( prop ); bool couldCompare = - emitter.CompareTo( sign, delegate() + emitter.CompareTo( sign, delegate { emitter.LoadLocal( b ); emitter.Chain( prop ); diff --git a/Scripts/Commands/Generic/Extensions/DistinctExtension.cs b/Scripts/Commands/Generic/Extensions/DistinctExtension.cs index b57446b07..f9868b6dc 100644 --- a/Scripts/Commands/Generic/Extensions/DistinctExtension.cs +++ b/Scripts/Commands/Generic/Extensions/DistinctExtension.cs @@ -8,7 +8,7 @@ namespace Server.Commands.Generic { public sealed class DistinctExtension : BaseExtension { - public static ExtensionInfo ExtInfo = new ExtensionInfo( 30, "Distinct", -1, delegate() { return new DistinctExtension(); } ); + public static ExtensionInfo ExtInfo = new ExtensionInfo( 30, "Distinct", -1, delegate { return new DistinctExtension(); } ); public static void Initialize() { diff --git a/Scripts/Commands/Generic/Extensions/LimitExtension.cs b/Scripts/Commands/Generic/Extensions/LimitExtension.cs index 9836445b9..48426c409 100644 --- a/Scripts/Commands/Generic/Extensions/LimitExtension.cs +++ b/Scripts/Commands/Generic/Extensions/LimitExtension.cs @@ -6,7 +6,7 @@ namespace Server.Commands.Generic { public sealed class LimitExtension : BaseExtension { - public static ExtensionInfo ExtInfo = new ExtensionInfo( 80, "Limit", 1, delegate() { return new LimitExtension(); } ); + public static ExtensionInfo ExtInfo = new ExtensionInfo( 80, "Limit", 1, delegate { return new LimitExtension(); } ); public static void Initialize() { diff --git a/Scripts/Commands/Generic/Extensions/SortExtension.cs b/Scripts/Commands/Generic/Extensions/SortExtension.cs index 713afc37e..f8813e7e0 100644 --- a/Scripts/Commands/Generic/Extensions/SortExtension.cs +++ b/Scripts/Commands/Generic/Extensions/SortExtension.cs @@ -8,7 +8,7 @@ namespace Server.Commands.Generic { public sealed class SortExtension : BaseExtension { - public static ExtensionInfo ExtInfo = new ExtensionInfo( 40, "Order", -1, delegate() { return new SortExtension(); } ); + public static ExtensionInfo ExtInfo = new ExtensionInfo( 40, "Order", -1, delegate { return new SortExtension(); } ); public static void Initialize() { diff --git a/Scripts/Commands/Generic/Extensions/WhereExtension.cs b/Scripts/Commands/Generic/Extensions/WhereExtension.cs index 3d9be7d81..6694168c9 100644 --- a/Scripts/Commands/Generic/Extensions/WhereExtension.cs +++ b/Scripts/Commands/Generic/Extensions/WhereExtension.cs @@ -8,7 +8,7 @@ namespace Server.Commands.Generic { public sealed class WhereExtension : BaseExtension { - public static ExtensionInfo ExtInfo = new ExtensionInfo( 20, "Where", -1, delegate() { return new WhereExtension(); } ); + public static ExtensionInfo ExtInfo = new ExtensionInfo( 20, "Where", -1, delegate { return new WhereExtension(); } ); public static void Initialize() { diff --git a/Scripts/Commands/Generic/Implementors/BaseCommandImplementor.cs b/Scripts/Commands/Generic/Implementors/BaseCommandImplementor.cs index 989f176f8..59ce66bfb 100644 --- a/Scripts/Commands/Generic/Implementors/BaseCommandImplementor.cs +++ b/Scripts/Commands/Generic/Implementors/BaseCommandImplementor.cs @@ -121,9 +121,9 @@ namespace Server.Commands.Generic foreach ( BaseExtension check in ext ) { - if ( check is WhereExtension ) + if ( check is WhereExtension extension ) { - cond = ( check as WhereExtension ).Conditional; + cond = extension.Conditional; break; } @@ -234,10 +234,8 @@ namespace Server.Commands.Generic bool flushToLog = false; - if ( obj is ArrayList ) + if ( obj is ArrayList list ) { - ArrayList list = (ArrayList)obj; - if ( list.Count > 20 ) CommandLogging.Enabled = false; else if ( list.Count == 0 ) @@ -255,9 +253,7 @@ namespace Server.Commands.Generic { if ( command.ListOptimized ) { - ArrayList list = new ArrayList(); - list.Add( obj ); - command.ExecuteList( e, list ); + command.ExecuteList( e, new ArrayList{ obj } ); } else { diff --git a/Scripts/Commands/Generic/Implementors/OnlineCommandImplementor.cs b/Scripts/Commands/Generic/Implementors/OnlineCommandImplementor.cs index 165abf83e..722e57d8b 100644 --- a/Scripts/Commands/Generic/Implementors/OnlineCommandImplementor.cs +++ b/Scripts/Commands/Generic/Implementors/OnlineCommandImplementor.cs @@ -47,7 +47,7 @@ namespace Server.Commands.Generic if ( mob == null ) continue; - if( !BaseCommand.IsAccessible( from, mob ) ) + if ( !BaseCommand.IsAccessible( from, mob ) ) continue; if ( ext.IsValid( mob ) ) @@ -64,4 +64,4 @@ namespace Server.Commands.Generic } } } -} \ No newline at end of file +} diff --git a/Scripts/Commands/Generic/Implementors/RegionCommandImplementor.cs b/Scripts/Commands/Generic/Implementors/RegionCommandImplementor.cs index 8408abb0d..f1120b74e 100644 --- a/Scripts/Commands/Generic/Implementors/RegionCommandImplementor.cs +++ b/Scripts/Commands/Generic/Implementors/RegionCommandImplementor.cs @@ -35,7 +35,7 @@ namespace Server.Commands.Generic { foreach ( Mobile mob in reg.GetMobiles() ) { - if( !BaseCommand.IsAccessible( from, mob ) ) + if ( !BaseCommand.IsAccessible( from, mob ) ) continue; if ( ext.IsValid( mob ) ) @@ -58,4 +58,4 @@ namespace Server.Commands.Generic } } } -} \ No newline at end of file +} diff --git a/Scripts/Commands/Handlers.cs b/Scripts/Commands/Handlers.cs index cf26b4550..648fe207d 100644 --- a/Scripts/Commands/Handlers.cs +++ b/Scripts/Commands/Handlers.cs @@ -148,9 +148,8 @@ namespace Server.Commands public static void DropHolding_OnTarget( Mobile from, object obj ) { - if ( obj is Mobile && ((Mobile)obj).Player ) + if ( obj is Mobile targ && targ.Player ) { - Mobile targ = (Mobile)obj; Item held = targ.Holding; if ( held == null ) @@ -163,15 +162,12 @@ namespace Server.Commands { Engines.Help.PageEntry pe = Engines.Help.PageQueue.GetEntry( targ ); - if ( pe == null || pe.Handler != from ) - { - if ( pe == null ) - from.SendMessage( "You may only use this command on someone who has paged you." ); - else - from.SendMessage( "You may only use this command if you are handling their help page." ); + if ( pe?.Handler == from ) + from.SendMessage( "You may only use this command if you are handling their help page." ); + else + from.SendMessage( "You may only use this command on someone who has paged you." ); - return; - } + return; } if ( targ.AddToBackpack( held ) ) @@ -262,23 +258,22 @@ namespace Server.Commands public static void GetFollowers_OnTarget( Mobile from, object obj ) { - if ( obj is PlayerMobile ) + if ( obj is PlayerMobile pm ) { - PlayerMobile master = (PlayerMobile)obj; - List pets = master.AllFollowers; + List pets = pm.AllFollowers; if ( pets.Count > 0 ) { - CommandLogging.WriteLine( from, "{0} {1} getting all followers of {2}", from.AccessLevel, CommandLogging.Format( from ), CommandLogging.Format( master ) ); + CommandLogging.WriteLine( from, "{0} {1} getting all followers of {2}", from.AccessLevel, CommandLogging.Format( from ), CommandLogging.Format( pm ) ); from.SendMessage( "That player has {0} pet{1}.", pets.Count, pets.Count != 1 ? "s" : "" ); for ( int i = 0; i < pets.Count; ++i ) { - Mobile pet = (Mobile)pets[i]; + Mobile pet = pets[i]; - if ( pet is IMount ) - ((IMount)pet).Rider = null; // make sure it's dismounted + if ( pet is IMount mount ) + mount.Rider = null; // make sure it's dismounted pet.MoveToWorld( from.Location, from.Map ); } @@ -288,17 +283,14 @@ namespace Server.Commands from.SendMessage( "There were no pets found for that player." ); } } - else if ( obj is Mobile && ((Mobile)obj).Player ) + else if ( obj is Mobile master && master.Player ) { - Mobile master = (Mobile)obj; ArrayList pets = new ArrayList(); foreach ( Mobile m in World.Mobiles.Values ) { - if ( m is BaseCreature ) + if ( m is BaseCreature bc ) { - BaseCreature bc = (BaseCreature)m; - if ( (bc.Controlled && bc.ControlMaster == master) || (bc.Summoned && bc.SummonMaster == master) ) pets.Add( bc ); } @@ -314,8 +306,8 @@ namespace Server.Commands { Mobile pet = (Mobile)pets[i]; - if ( pet is IMount ) - ((IMount)pet).Rider = null; // make sure it's dismounted + if ( pet is IMount mount ) + mount.Rider = null; // make sure it's dismounted pet.MoveToWorld( from.Location, from.Map ); } @@ -346,8 +338,8 @@ namespace Server.Commands return; } - if ( targeted is Mobile ) - from.SendMenu( new EquipMenu( from, (Mobile)targeted, GetEquip( (Mobile)targeted ) ) ); + if ( targeted is Mobile mobile ) + from.SendMenu( new EquipMenu( from, mobile, GetEquip( mobile ) ) ); } private static ItemListEntry[] GetEquip( Mobile m ) @@ -472,17 +464,15 @@ namespace Server.Commands protected override void OnTarget( Mobile from, object targeted ) { - if ( targeted is Mobile ) + if ( targeted is Mobile m ) { - Mobile m = (Mobile)targeted; - BankBox box = ( m.Player ? m.BankBox : m.FindBankNoCreate() ); if ( box != null ) { - CommandLogging.WriteLine( from, "{0} {1} opening bank box of {2}", from.AccessLevel, CommandLogging.Format( from ), CommandLogging.Format( targeted ) ); + CommandLogging.WriteLine( from, "{0} {1} opening bank box of {2}", from.AccessLevel, CommandLogging.Format( from ), CommandLogging.Format( m ) ); - if ( from == targeted ) + if ( from == m ) box.Open(); else box.DisplayTo( from ); @@ -522,19 +512,17 @@ namespace Server.Commands protected override void OnTarget( Mobile from, object targeted ) { - if ( targeted is Mobile ) + if ( targeted is Mobile targ ) { - CommandLogging.WriteLine( from, "{0} {1} dismounting {2}", from.AccessLevel, CommandLogging.Format( from ), CommandLogging.Format( targeted ) ); - - Mobile targ = (Mobile)targeted; + CommandLogging.WriteLine( from, "{0} {1} dismounting {2}", from.AccessLevel, CommandLogging.Format( from ), CommandLogging.Format( targ ) ); for ( int i = 0; i < targ.Items.Count; ++i ) { Item item = targ.Items[i]; - if ( item is IMountItem ) + if ( item is IMountItem mountItem ) { - IMount mount = ((IMountItem)item).Mount; + IMount mount = mountItem.Mount; if ( mount != null ) mount.Rider = null; @@ -566,15 +554,10 @@ namespace Server.Commands protected override void OnTarget( Mobile from, object targeted ) { - if ( targeted is Mobile ) + if ( targeted is Mobile targ && targ.NetState != null ) { - Mobile targ = (Mobile)targeted; - - if ( targ.NetState != null ) - { - CommandLogging.WriteLine( from, "{0} {1} opening client menu of {2}", from.AccessLevel, CommandLogging.Format( from ), CommandLogging.Format( targeted ) ); - from.SendGump( new ClientGump( from, targ.NetState ) ); - } + CommandLogging.WriteLine( from, "{0} {1} opening client menu of {2}", from.AccessLevel, CommandLogging.Format( from ), CommandLogging.Format( targ ) ); + from.SendGump( new ClientGump( from, targ.NetState ) ); } } } @@ -610,14 +593,7 @@ namespace Server.Commands private static bool FixMap( ref Map map, ref Point3D loc, Item item ) { - if ( map == null || map == Map.Internal ) - { - Mobile m = item.RootParent as Mobile; - - return ( m != null && FixMap( ref map, ref loc, m ) ); - } - - return true; + return map == null || map == Map.Internal && item.RootParent is Mobile m && FixMap( ref map, ref loc, m ); } private static bool FixMap( ref Map map, ref Point3D loc, Mobile m ) @@ -651,26 +627,24 @@ namespace Server.Commands IEntity ent = World.FindEntity( ser ); - if ( ent is Item ) + if ( ent is Item item ) { - Item item = (Item)ent; - Map map = item.Map; Point3D loc = item.GetWorldLocation(); Mobile owner = item.RootParent as Mobile; - if( owner != null && (owner.Map != null && owner.Map != Map.Internal) && !BaseCommand.IsAccessible( from, owner ) /* !from.CanSee( owner )*/ ) + if ( owner != null && (owner.Map != null && owner.Map != Map.Internal) && !BaseCommand.IsAccessible( from, owner ) /* !from.CanSee( owner )*/ ) { from.SendMessage( "You can not go to what you can not see." ); return; } - else if ( owner != null && (owner.Map == null || owner.Map == Map.Internal) && owner.Hidden && owner.AccessLevel >= from.AccessLevel ) + if ( owner != null && (owner.Map == null || owner.Map == Map.Internal) && owner.Hidden && owner.AccessLevel >= from.AccessLevel ) { from.SendMessage( "You can not go to what you can not see." ); return; } - else if ( !FixMap( ref map, ref loc, item ) ) + if ( !FixMap( ref map, ref loc, item ) ) { from.SendMessage( "That is an internal item and you cannot go to it." ); return; @@ -680,26 +654,24 @@ namespace Server.Commands return; } - else if ( ent is Mobile ) + if ( ent is Mobile m ) { - Mobile m = (Mobile)ent; - Map map = m.Map; Point3D loc = m.Location; Mobile owner = m; - if ( owner != null && (owner.Map != null && owner.Map != Map.Internal) && !BaseCommand.IsAccessible( from, owner ) /* !from.CanSee( owner )*/ ) + if ( (owner.Map != null && owner.Map != Map.Internal) && !BaseCommand.IsAccessible( from, owner ) /* !from.CanSee( owner )*/ ) { from.SendMessage( "You can not go to what you can not see." ); return; } - else if ( owner != null && (owner.Map == null || owner.Map == Map.Internal) && owner.Hidden && owner.AccessLevel >= from.AccessLevel ) + if ( (owner.Map == null || owner.Map == Map.Internal) && owner.Hidden && owner.AccessLevel >= from.AccessLevel ) { from.SendMessage( "You can not go to what you can not see." ); return; } - else if ( !FixMap( ref map, ref loc, m ) ) + if ( !FixMap( ref map, ref loc, m ) ) { from.SendMessage( "That is an internal mobile and you cannot go to it." ); return; @@ -743,16 +715,16 @@ namespace Server.Commands for( int i = 0; i < Map.AllMaps.Count; ++i ) { - Map m = Map.AllMaps[i]; + map = Map.AllMaps[i]; - if( m.MapIndex == 0x7F || m.MapIndex == 0xFF || from.Map == m ) + if ( map.MapIndex == 0x7F || map.MapIndex == 0xFF || from.Map == map ) continue; - foreach( Region r in m.Regions.Values ) + foreach( Region r in map.Regions.Values ) { - if( Insensitive.Equals( r.Name, name ) ) + if ( Insensitive.Equals( r.Name, name ) ) { - from.MoveToWorld( r.GoLocation, m ); + from.MoveToWorld( r.GoLocation, map ); return; } } @@ -873,8 +845,8 @@ namespace Server.Commands BroadcastMessage( AccessLevel.Player, 0x482, e.ArgString ); } - public static void BroadcastMessage ( AccessLevel ac, int hue, string message ) - { + public static void BroadcastMessage ( AccessLevel ac, int hue, string message ) + { foreach ( NetState state in NetState.Instances ) { Mobile m = state.Mobile; @@ -940,12 +912,12 @@ namespace Server.Commands protected override void OnTarget( Mobile from, object targeted ) { - if ( targeted is Mobile ) + if ( targeted is Mobile mobile ) { - if( ((Mobile)targeted).AccessLevel >= from.AccessLevel && targeted != from ) + if ( mobile.AccessLevel >= from.AccessLevel && mobile != from ) from.SendMessage( "You can't do that to someone with higher Accesslevel than you!" ); else - from.SendGump( new StuckMenu( from, (Mobile) targeted, false ) ); + from.SendGump( new StuckMenu( from, mobile, false ) ); } } } diff --git a/Scripts/Commands/HelpInfo.cs b/Scripts/Commands/HelpInfo.cs index 57657950e..5146bc334 100644 --- a/Scripts/Commands/HelpInfo.cs +++ b/Scripts/Commands/HelpInfo.cs @@ -34,14 +34,14 @@ namespace Server.Commands [Description( "Gives information on a specified command, or when no argument specified, displays a gump containing all commands" )] private static void HelpInfo_OnCommand( CommandEventArgs e ) { - if( e.Length > 0 ) + if ( e.Length > 0 ) { string arg = e.GetString( 0 ).ToLower(); if (m_HelpInfos.TryGetValue( arg, out CommandInfo c )) { Mobile m = e.Mobile; - if( m.AccessLevel >= c.AccessLevel ) + if ( m.AccessLevel >= c.AccessLevel ) m.SendGump( new CommandInfoGump( c ) ); else m.SendMessage( "You don't have access to that command." ); @@ -73,19 +73,17 @@ namespace Server.Commands object[] attrs = mi.GetCustomAttributes( typeof( UsageAttribute ), false ); - if( attrs.Length == 0 ) + if ( attrs.Length == 0 ) continue; UsageAttribute usage = attrs[0] as UsageAttribute; attrs = mi.GetCustomAttributes( typeof( DescriptionAttribute ), false ); - if( attrs.Length == 0 ) + if ( attrs.Length == 0 ) continue; - DescriptionAttribute desc = attrs[0] as DescriptionAttribute; - - if( usage == null || desc == null ) + if ( usage == null || !(attrs[0] is DescriptionAttribute desc) ) continue; attrs = mi.GetCustomAttributes( typeof( AliasesAttribute ), false ); @@ -94,7 +92,7 @@ namespace Server.Commands string descString = desc.Description.Replace( "<", "(" ).Replace( ">", ")" ); - if( aliases == null ) + if ( aliases == null ) list.Add( new CommandInfo( e.AccessLevel, e.Command, null, usage.Usage, descString ) ); else { @@ -121,7 +119,7 @@ namespace Server.Commands string usage = command.Usage; string desc = command.Description; - if( usage == null || desc == null ) + if ( usage == null || desc == null ) continue; string[] cmds = command.Commands; @@ -133,31 +131,31 @@ namespace Server.Commands desc = desc.Replace( "<", "(" ).Replace( ">", ")" ); - if( command.Supports != CommandSupport.Single ) + if ( command.Supports != CommandSupport.Single ) { StringBuilder sb = new StringBuilder( 50 + desc.Length ); sb.Append( "Modifiers: " ); - if( (command.Supports & CommandSupport.Global) != 0 ) + if ( (command.Supports & CommandSupport.Global) != 0 ) sb.Append( "Global, " ); - if( (command.Supports & CommandSupport.Online) != 0 ) + if ( (command.Supports & CommandSupport.Online) != 0 ) sb.Append( "Online, " ); - if( (command.Supports & CommandSupport.Region) != 0 ) + if ( (command.Supports & CommandSupport.Region) != 0 ) sb.Append( "Region, " ); - if( (command.Supports & CommandSupport.Contained) != 0 ) + if ( (command.Supports & CommandSupport.Contained) != 0 ) sb.Append( "Contained, " ); - if( (command.Supports & CommandSupport.Multi) != 0 ) + if ( (command.Supports & CommandSupport.Multi) != 0 ) sb.Append( "Multi, " ); - if( (command.Supports & CommandSupport.Area) != 0 ) + if ( (command.Supports & CommandSupport.Area) != 0 ) sb.Append( "Area, " ); - if( (command.Supports & CommandSupport.Self) != 0 ) + if ( (command.Supports & CommandSupport.Self) != 0 ) sb.Append( "Self, " ); sb.Remove( sb.Length - 2, 2 ); @@ -190,7 +188,7 @@ namespace Server.Commands string usage = command.Usage; string desc = command.Description; - if( usage == null || desc == null ) + if ( usage == null || desc == null ) continue; string[] cmds = command.Accessors; @@ -222,7 +220,7 @@ namespace Server.Commands foreach( CommandInfo c in m_SortedHelpInfo ) { - if( !m_HelpInfos.ContainsKey( c.Name.ToLower() ) ) + if ( !m_HelpInfos.ContainsKey( c.Name.ToLower() ) ) m_HelpInfos.Add( c.Name.ToLower(), c ); } } @@ -239,13 +237,13 @@ namespace Server.Commands { m_Page = page; - if( list == null ) + if ( list == null ) { m_List = new List(); foreach( CommandInfo c in m_SortedHelpInfo ) { - if( from.AccessLevel >= c.AccessLevel ) + if ( from.AccessLevel >= c.AccessLevel ) m_List.Add( c ); } } @@ -255,14 +253,14 @@ namespace Server.Commands AddNewPage(); - if( m_Page > 0 ) + if ( m_Page > 0 ) AddEntryButton( 20, ArrowLeftID1, ArrowLeftID2, 1, ArrowLeftWidth, ArrowLeftHeight ); else AddEntryHeader( 20 ); AddEntryHtml( 160, Center( String.Format( "Page {0} of {1}", m_Page+1, (m_List.Count + EntriesPerPage - 1) / EntriesPerPage ) ) ); - if( (m_Page + 1) * EntriesPerPage < m_List.Count ) + if ( (m_Page + 1) * EntriesPerPage < m_List.Count ) AddEntryButton( 20, ArrowRightID1, ArrowRightID2, 2, ArrowRightWidth, ArrowRightHeight ); else AddEntryHeader( 20 ); @@ -272,9 +270,9 @@ namespace Server.Commands for( int i = m_Page * EntriesPerPage, line = 0; line < EntriesPerPage && i < m_List.Count; ++i, ++line ) { CommandInfo c = m_List[i]; - if( from.AccessLevel >= c.AccessLevel ) + if ( from.AccessLevel >= c.AccessLevel ) { - if( (int)c.AccessLevel != last ) + if ( (int)c.AccessLevel != last ) { AddNewLine(); @@ -308,14 +306,14 @@ namespace Server.Commands } case 1: { - if( m_Page > 0 ) + if ( m_Page > 0 ) m.SendGump( new CommandListGump( m_Page - 1, m, m_List ) ); break; } case 2: { - if( (m_Page + 1) * EntriesPerPage < m_SortedHelpInfo.Count ) + if ( (m_Page + 1) * EntriesPerPage < m_SortedHelpInfo.Count ) m.SendGump( new CommandListGump( m_Page + 1, m, m_List ) ); break; @@ -325,11 +323,11 @@ namespace Server.Commands int v = info.ButtonID - 3; - if( v >= 0 && v < m_List.Count ) + if ( v >= 0 && v < m_List.Count ) { CommandInfo c = m_List[v]; - if( m.AccessLevel >= c.AccessLevel ) + if ( m.AccessLevel >= c.AccessLevel ) { m.SendGump( new CommandInfoGump( c ) ); m.SendGump( new CommandListGump( m_Page, m, m_List ) ); @@ -387,13 +385,13 @@ namespace Server.Commands string[] aliases = info.Aliases; - if( aliases != null && aliases.Length != 0 ) + if ( aliases != null && aliases.Length != 0 ) { sb.Append( String.Format( "Alias{0}: ", aliases.Length == 1 ? "" : "es" ) ); for( int i = 0; i < aliases.Length; ++i ) { - if( i != 0 ) + if ( i != 0 ) sb.Append( ", " ); sb.Append( aliases[i] ); diff --git a/Scripts/Commands/Logging.cs b/Scripts/Commands/Logging.cs index a68772518..905c5d6ac 100644 --- a/Scripts/Commands/Logging.cs +++ b/Scripts/Commands/Logging.cs @@ -43,19 +43,15 @@ namespace Server.Commands public static object Format( object o ) { - if ( o is Mobile ) + if ( o is Mobile m ) { - Mobile m = (Mobile)o; - if ( m.Account == null ) return String.Format( "{0} (no account)", m ); - else - return String.Format( "{0} ('{1}')", m, m.Account.Username ); - } - else if ( o is Item ) - { - Item item = (Item)o; + return String.Format( "{0} ('{1}')", m, m.Account.Username ); + } + if ( o is Item item ) + { return String.Format( "0x{0:X} ({1})", item.Serial.Value, item.GetType().Name ); } @@ -81,9 +77,7 @@ namespace Server.Commands string path = Core.BaseDirectory; - Account acct = from.Account as Account; - - string name = ( acct == null ? from.Name : acct.Username ); + string name = ( !(from.Account is Account acct) ? from.Name : acct.Username ); AppendPath( ref path, "Logs" ); AppendPath( ref path, "Commands" ); @@ -144,4 +138,4 @@ namespace Server.Commands WriteLine( from, "{0} {1} set property '{2}' of {3} to '{4}'", from.AccessLevel, Format( from ), name, Format( o ), value ); } } -} \ No newline at end of file +} diff --git a/Scripts/Commands/Profiling.cs b/Scripts/Commands/Profiling.cs index 13387f79b..f31c9bde9 100644 --- a/Scripts/Commands/Profiling.cs +++ b/Scripts/Commands/Profiling.cs @@ -109,13 +109,11 @@ namespace Server.Commands private int GetCount( object obj ) { - if ( obj is int ) - return (int) obj; + if ( obj is int intObj ) + return intObj; - if ( obj is int[] ) + if ( obj is int[] list ) { - int[] list = (int[]) obj; - int total = 0; for ( int i = 0; i < list.Length; ++i ) @@ -207,9 +205,7 @@ namespace Server.Commands do { - int[] countTable = typeTable[itemType] as int[]; - - if ( countTable == null ) + if ( !(typeTable[itemType] is int[] countTable) ) typeTable[itemType] = countTable = new int[9]; if ( ( flags & ExpandFlag.Name ) != 0 ) @@ -401,4 +397,4 @@ namespace Server.Commands } } } -} \ No newline at end of file +} diff --git a/Scripts/Commands/Properties.cs b/Scripts/Commands/Properties.cs index aca09945b..273fc9d73 100644 --- a/Scripts/Commands/Properties.cs +++ b/Scripts/Commands/Properties.cs @@ -263,7 +263,7 @@ namespace Server.Commands { object obj = realProps[i].GetValue( realObjs[i], null ); - if( !( obj is IConvertible ) ) + if ( !( obj is IConvertible ) ) return "Property is not IConvertable."; try @@ -509,9 +509,8 @@ namespace Server.Commands { try { - if ( toSet is AccessLevel ) + if ( toSet is AccessLevel newLevel ) { - AccessLevel newLevel = (AccessLevel) toSet; AccessLevel reqLevel = AccessLevel.Administrator; if ( newLevel == AccessLevel.Administrator ) @@ -843,4 +842,4 @@ namespace Server return prop; } } -} \ No newline at end of file +} diff --git a/Scripts/Commands/Skills.cs b/Scripts/Commands/Skills.cs index 428aded79..2448deb62 100644 --- a/Scripts/Commands/Skills.cs +++ b/Scripts/Commands/Skills.cs @@ -25,7 +25,7 @@ namespace Server.Commands else { SkillName skill; - if( Enum.TryParse( arg.GetString( 0 ), true, out skill ) ) + if ( Enum.TryParse( arg.GetString( 0 ), true, out skill ) ) { arg.Mobile.Target = new SkillTarget( skill, arg.GetDouble( 1 ) ); } @@ -61,7 +61,7 @@ namespace Server.Commands else { SkillName skill; - if( Enum.TryParse( arg.GetString( 0 ), true, out skill ) ) + if ( Enum.TryParse( arg.GetString( 0 ), true, out skill ) ) { arg.Mobile.Target = new SkillTarget( skill ); } @@ -83,9 +83,8 @@ namespace Server.Commands protected override void OnTarget( Mobile from, object targeted ) { - if ( targeted is Mobile ) + if ( targeted is Mobile targ ) { - Mobile targ = (Mobile)targeted; Server.Skills skills = targ.Skills; for ( int i = 0; i < skills.Length; ++i ) @@ -121,9 +120,8 @@ namespace Server.Commands protected override void OnTarget( Mobile from, object targeted ) { - if ( targeted is Mobile ) + if ( targeted is Mobile targ ) { - Mobile targ = (Mobile)targeted; Skill skill = targ.Skills[m_Skill]; if ( skill == null ) @@ -144,4 +142,4 @@ namespace Server.Commands } } } -} \ No newline at end of file +} diff --git a/Scripts/Commands/SkillsMenu.cs b/Scripts/Commands/SkillsMenu.cs index fbd8e3e6f..acb0fb40d 100644 --- a/Scripts/Commands/SkillsMenu.cs +++ b/Scripts/Commands/SkillsMenu.cs @@ -25,8 +25,8 @@ namespace Server.Commands protected override void OnTarget( Mobile from, object o ) { - if ( o is Mobile ) - from.SendGump( new SkillsGump( from, (Mobile)o ) ); + if ( o is Mobile mobile ) + from.SendGump( new SkillsGump( from, mobile ) ); } } @@ -37,4 +37,4 @@ namespace Server.Commands e.Mobile.Target = new SkillsTarget(); } } -} \ No newline at end of file +} diff --git a/Scripts/Commands/VisibilityList.cs b/Scripts/Commands/VisibilityList.cs index 8fc660968..3cbfa1934 100644 --- a/Scripts/Commands/VisibilityList.cs +++ b/Scripts/Commands/VisibilityList.cs @@ -21,10 +21,8 @@ namespace Server.Commands public static void OnLogin( LoginEventArgs e ) { - if ( e.Mobile is PlayerMobile ) + if ( e.Mobile is PlayerMobile pm ) { - PlayerMobile pm = (PlayerMobile)e.Mobile; - pm.VisibilityList.Clear(); } } @@ -44,9 +42,8 @@ namespace Server.Commands [Description( "Shows the names of everyone in your visibility list." )] public static void VisList_OnCommand( CommandEventArgs e ) { - if ( e.Mobile is PlayerMobile ) + if ( e.Mobile is PlayerMobile pm ) { - PlayerMobile pm = (PlayerMobile)e.Mobile; List list = pm.VisibilityList; if ( list.Count > 0 ) @@ -67,11 +64,10 @@ namespace Server.Commands [Description( "Removes everyone from your visibility list." )] public static void VisClear_OnCommand( CommandEventArgs e ) { - if ( e.Mobile is PlayerMobile ) + if ( e.Mobile is PlayerMobile pm ) { - PlayerMobile pm = (PlayerMobile)e.Mobile; List list = new List( pm.VisibilityList ); - + pm.VisibilityList.Clear(); pm.SendMessage( "Your visibility list has been cleared." ); @@ -93,24 +89,21 @@ namespace Server.Commands protected override void OnTarget( Mobile from, object targeted ) { - if ( from is PlayerMobile && targeted is Mobile ) + if ( from is PlayerMobile pm && targeted is Mobile targ ) { - PlayerMobile pm = (PlayerMobile)from; - Mobile targ = (Mobile)targeted; - - if ( targ.AccessLevel <= from.AccessLevel ) + if ( targ.AccessLevel <= pm.AccessLevel ) { List list = pm.VisibilityList; if ( list.Contains( targ ) ) { list.Remove( targ ); - from.SendMessage( "{0} has been removed from your visibility list.", targ.Name ); + pm.SendMessage( "{0} has been removed from your visibility list.", targ.Name ); } else { list.Add( targ ); - from.SendMessage( "{0} has been added to your visibility list.", targ.Name ); + pm.SendMessage( "{0} has been added to your visibility list.", targ.Name ); } if ( Utility.InUpdateRange( targ, from ) ) @@ -118,28 +111,28 @@ namespace Server.Commands NetState ns = targ.NetState; if ( ns != null ) { - if ( targ.CanSee( from ) ) + if ( targ.CanSee( pm ) ) { - ns.Send(MobileIncoming.Create(ns, targ, from)); + ns.Send(MobileIncoming.Create(ns, targ, pm)); if ( ObjectPropertyList.Enabled ) { - ns.Send( from.OPLPacket ); + ns.Send( pm.OPLPacket ); - foreach ( Item item in from.Items ) + foreach ( Item item in pm.Items ) ns.Send( item.OPLPacket ); } } else { - ns.Send( from.RemovePacket ); + ns.Send( pm.RemovePacket ); } } } } else { - from.SendMessage( "They can already see you!" ); + pm.SendMessage( "They can already see you!" ); } } else diff --git a/Scripts/Commands/Wipe.cs b/Scripts/Commands/Wipe.cs index 265842d7a..f9b0bd281 100644 --- a/Scripts/Commands/Wipe.cs +++ b/Scripts/Commands/Wipe.cs @@ -89,8 +89,8 @@ namespace Server.Commands toDelete.Add( obj ); else if ( multis && (obj is BaseMulti) ) toDelete.Add( obj ); - else if ( mobiles && (obj is Mobile) && !((Mobile)obj).Player ) - toDelete.Add( obj ); + else if ( mobiles && (obj is Mobile mobile) && !mobile.Player ) + toDelete.Add( mobile ); } eable.Free(); diff --git a/Scripts/Context Menus/AddToSpellbookEntry.cs b/Scripts/Context Menus/AddToSpellbookEntry.cs index 3ec24eccf..c2ca6550c 100644 --- a/Scripts/Context Menus/AddToSpellbookEntry.cs +++ b/Scripts/Context Menus/AddToSpellbookEntry.cs @@ -13,8 +13,8 @@ namespace Server.ContextMenus public override void OnClick() { - if ( Owner.From.CheckAlive() && Owner.Target is SpellScroll ) - Owner.From.Target = new InternalTarget( (SpellScroll)Owner.Target ); + if ( Owner.From.CheckAlive() && Owner.Target is SpellScroll scroll ) + Owner.From.Target = new InternalTarget( scroll ); } private class InternalTarget : Target @@ -28,12 +28,10 @@ namespace Server.ContextMenus protected override void OnTarget( Mobile from, object targeted ) { - if ( targeted is Spellbook ) + if ( targeted is Spellbook book ) { if ( from.CheckAlive() && !m_Scroll.Deleted && m_Scroll.Movable && m_Scroll.Amount >= 1 && m_Scroll.CheckItemUse( from ) ) { - Spellbook book = (Spellbook)targeted; - SpellbookType type = Spellbook.GetTypeForSpell( m_Scroll.SpellID ); if ( type != book.SpellbookType ) @@ -61,4 +59,4 @@ namespace Server.ContextMenus } } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/BulkOrders/Books/BOBGump.cs b/Scripts/Engines/BulkOrders/Books/BOBGump.cs index 46e1e9e71..a0be8ad39 100644 --- a/Scripts/Engines/BulkOrders/Books/BOBGump.cs +++ b/Scripts/Engines/BulkOrders/Books/BOBGump.cs @@ -22,9 +22,9 @@ namespace Server.Engines.BulkOrders { Item item = null; - if ( obj is BOBLargeEntry ) - item = ((BOBLargeEntry)obj).Reconstruct(); - else if ( obj is BOBSmallEntry ) + if ( obj is BOBLargeEntry entry ) + item = entry.Reconstruct(); + else item = ((BOBSmallEntry)obj).Reconstruct(); return item; @@ -32,17 +32,13 @@ namespace Server.Engines.BulkOrders public bool CheckFilter( object obj ) { - if ( obj is BOBLargeEntry ) + if ( obj is BOBLargeEntry entry ) { - BOBLargeEntry e = (BOBLargeEntry)obj; - - return CheckFilter( e.Material, e.AmountMax, true, e.RequireExceptional, e.DeedType, ( e.Entries.Length > 0 ? e.Entries[0].ItemType : null ) ); + return CheckFilter( entry.Material, entry.AmountMax, true, entry.RequireExceptional, entry.DeedType, ( entry.Entries.Length > 0 ? entry.Entries[0].ItemType : null ) ); } - else if ( obj is BOBSmallEntry ) + if ( obj is BOBSmallEntry smallEntry ) { - BOBSmallEntry e = (BOBSmallEntry)obj; - - return CheckFilter( e.Material, e.AmountMax, false, e.RequireExceptional, e.DeedType, e.ItemType ); + return CheckFilter( smallEntry.Material, smallEntry.AmountMax, false, smallEntry.RequireExceptional, smallEntry.DeedType, smallEntry.ItemType ); } return false; @@ -57,25 +53,25 @@ namespace Server.Engines.BulkOrders if ( f.Quality == 1 && reqExc ) return false; - else if ( f.Quality == 2 && !reqExc ) + if ( f.Quality == 2 && !reqExc ) return false; if ( f.Quantity == 1 && amountMax != 10 ) return false; - else if ( f.Quantity == 2 && amountMax != 15 ) + if ( f.Quantity == 2 && amountMax != 15 ) return false; - else if ( f.Quantity == 3 && amountMax != 20 ) + if ( f.Quantity == 3 && amountMax != 20 ) return false; if ( f.Type == 1 && isLarge ) return false; - else if ( f.Type == 2 && !isLarge ) + if ( f.Type == 2 && !isLarge ) return false; switch ( f.Material ) { default: - case 0: return true; + return true; case 1: return ( deedType == BODType.Smith ); case 2: return ( deedType == BODType.Tailor ); @@ -122,8 +118,8 @@ namespace Server.Engines.BulkOrders { int add; - if ( obj is BOBLargeEntry ) - add = ((BOBLargeEntry)obj).Entries.Length; + if ( obj is BOBLargeEntry entry ) + add = entry.Entries.Length; else add = 1; @@ -156,8 +152,8 @@ namespace Server.Engines.BulkOrders obj = list[i]; if (CheckFilter(obj)) { - if (obj is BOBLargeEntry) - add = ((BOBLargeEntry)obj).Entries.Length; + if (obj is BOBLargeEntry entry) + add = entry.Entries.Length; else add = 1; count += add; @@ -185,8 +181,8 @@ namespace Server.Engines.BulkOrders obj = list[i]; if (CheckFilter(obj)) { - if (obj is BOBLargeEntry) - count += ((BOBLargeEntry)obj).Entries.Length; + if (obj is BOBLargeEntry entry) + count += entry.Entries.Length; else count += 1; } @@ -327,8 +323,8 @@ namespace Server.Engines.BulkOrders if (m_Book.IsChildOf(m_From.Backpack)) { int sizeOfDroppedBod; - if (obj is BOBLargeEntry) - sizeOfDroppedBod = ((BOBLargeEntry)obj).Entries.Length; + if (obj is BOBLargeEntry entry) + sizeOfDroppedBod = entry.Entries.Length; else sizeOfDroppedBod = 1; @@ -336,13 +332,13 @@ namespace Server.Engines.BulkOrders m_From.SendLocalizedMessage(1045152); // The bulk order deed has been placed in your backpack. m_Book.Entries.Remove(obj); m_Book.InvalidateProperties(); - + if ( m_Book.Entries.Count / 5 < m_Book.ItemCount ) { m_Book.ItemCount--; m_Book.InvalidateItems(); } - + if (m_Book.Entries.Count > 0) { m_Page = GetPageForIndex(index, sizeOfDroppedBod); @@ -366,19 +362,18 @@ namespace Server.Engines.BulkOrders m_From.Prompt = new SetPricePrompt( m_Book, obj, m_Page, m_List ); m_From.SendLocalizedMessage( 1062383 ); // Type in a price for the deed: } - else if ( m_Book.RootParent is PlayerVendor ) + else if ( m_Book.RootParent is PlayerVendor pv ) { - PlayerVendor pv = (PlayerVendor)m_Book.RootParent; VendorItem vi = pv.GetVendorItem( m_Book ); if (vi != null && !vi.IsForSale) { int sizeOfDroppedBod; int price = 0; - if (obj is BOBLargeEntry) + if (obj is BOBLargeEntry entry) { - price = ((BOBLargeEntry)obj).Price; - sizeOfDroppedBod = ((BOBLargeEntry)obj).Entries.Length; + price = entry.Price; + sizeOfDroppedBod = entry.Entries.Length; } else { @@ -443,34 +438,34 @@ namespace Server.Engines.BulkOrders if ( !m_Book.Entries.Contains( obj ) ) continue; - if ( obj is BOBLargeEntry ) - ((BOBLargeEntry)obj).Price = price; - else if ( obj is BOBSmallEntry ) + if ( obj is BOBLargeEntry entry ) + entry.Price = price; + else ((BOBSmallEntry)obj).Price = price; } from.SendMessage( "Deed prices set." ); - if ( from is PlayerMobile ) - from.SendGump( new BOBGump( (PlayerMobile)from, m_Book, m_Page, m_List ) ); + if ( from is PlayerMobile mobile ) + mobile.SendGump( new BOBGump( mobile, m_Book, m_Page, m_List ) ); } - else if ( m_Object is BOBLargeEntry ) + else if ( m_Object is BOBLargeEntry entry ) { - ((BOBLargeEntry)m_Object).Price = price; + entry.Price = price; from.SendLocalizedMessage( 1062384 ); // Deed price set. - if ( from is PlayerMobile ) - from.SendGump( new BOBGump( (PlayerMobile)from, m_Book, m_Page, m_List ) ); + if ( from is PlayerMobile mobile ) + mobile.SendGump( new BOBGump( mobile, m_Book, m_Page, m_List ) ); } - else if ( m_Object is BOBSmallEntry ) + else { ((BOBSmallEntry)m_Object).Price = price; from.SendLocalizedMessage( 1062384 ); // Deed price set. - if ( from is PlayerMobile ) - from.SendGump( new BOBGump( (PlayerMobile)from, m_Book, m_Page, m_List ) ); + if ( from is PlayerMobile mobile ) + mobile.SendGump( new BOBGump( mobile, m_Book, m_Page, m_List ) ); } } } @@ -553,9 +548,9 @@ namespace Server.Engines.BulkOrders AddImageTiled( 24, 94 + (tableIndex * 32), canPrice ? 573 : 489, 2, 2624 ); - if ( obj is BOBLargeEntry ) - tableIndex += ((BOBLargeEntry)obj).Entries.Length; - else if ( obj is BOBSmallEntry ) + if ( obj is BOBLargeEntry entry ) + tableIndex += entry.Entries.Length; + else ++tableIndex; } @@ -628,81 +623,79 @@ namespace Server.Engines.BulkOrders if ( !CheckFilter( obj ) ) continue; - if ( obj is BOBLargeEntry ) + if ( obj is BOBLargeEntry entry ) { - BOBLargeEntry e = (BOBLargeEntry)obj; - int y = 96 + (tableIndex * 32); if ( canDrop ) AddButton( 35, y + 2, 5602, 5606, 5 + (i * 2), GumpButtonType.Reply, 0 ); - if ( canDrop || (canBuy && e.Price > 0) ) + if ( canDrop || (canBuy && entry.Price > 0) ) { AddButton( 579, y + 2, 2117, 2118, 6 + (i * 2), GumpButtonType.Reply, 0 ); - AddLabel( 495, y, 1152, e.Price.ToString() ); + AddLabel( 495, y, 1152, entry.Price.ToString() ); } AddHtmlLocalized( 61, y, 50, 32, 1062225, LabelColor, false, false ); // Large - for ( int j = 0; j < e.Entries.Length; ++j ) + for ( int j = 0; j < entry.Entries.Length; ++j ) { - BOBLargeSubEntry sub = e.Entries[j]; + BOBLargeSubEntry sub = entry.Entries[j]; AddHtmlLocalized( 103, y, 130, 32, sub.Number, LabelColor, false, false ); - if ( e.RequireExceptional ) + if ( entry.RequireExceptional ) AddHtmlLocalized( 235, y, 80, 20, 1060636, LabelColor, false, false ); // exceptional else AddHtmlLocalized( 235, y, 80, 20, 1011542, LabelColor, false, false ); // normal - object name = GetMaterialName( e.Material, e.DeedType, sub.ItemType ); + object name = GetMaterialName( entry.Material, entry.DeedType, sub.ItemType ); - if ( name is int ) - AddHtmlLocalized( 316, y, 100, 20, (int)name, LabelColor, false, false ); - else if ( name is string ) - AddLabel( 316, y, 1152, (string)name ); + if ( name is int intName ) + AddHtmlLocalized( 316, y, 100, 20, intName, LabelColor, false, false ); + else + AddLabel( 316, y, 1152, name.ToString() ); - AddLabel( 421, y, 1152, String.Format( "{0} / {1}", sub.AmountCur, e.AmountMax ) ); + AddLabel( 421, y, 1152, String.Format( "{0} / {1}", sub.AmountCur, entry.AmountMax ) ); ++tableIndex; y += 32; } } - else if ( obj is BOBSmallEntry ) + else { - BOBSmallEntry e = (BOBSmallEntry)obj; + BOBSmallEntry smallEntry = (BOBSmallEntry)obj; int y = 96 + (tableIndex++ * 32); if ( canDrop ) AddButton( 35, y + 2, 5602, 5606, 5 + (i * 2), GumpButtonType.Reply, 0 ); - if ( canDrop || (canBuy && e.Price > 0) ) + if ( canDrop || (canBuy && smallEntry.Price > 0) ) { AddButton( 579, y + 2, 2117, 2118, 6 + (i * 2), GumpButtonType.Reply, 0 ); - AddLabel( 495, y, 1152, e.Price.ToString() ); + AddLabel( 495, y, 1152, smallEntry.Price.ToString() ); } AddHtmlLocalized( 61, y, 50, 32, 1062224, LabelColor, false, false ); // Small - AddHtmlLocalized( 103, y, 130, 32, e.Number, LabelColor, false, false ); + AddHtmlLocalized( 103, y, 130, 32, smallEntry.Number, LabelColor, false, false ); - if ( e.RequireExceptional ) + if ( smallEntry.RequireExceptional ) AddHtmlLocalized( 235, y, 80, 20, 1060636, LabelColor, false, false ); // exceptional else AddHtmlLocalized( 235, y, 80, 20, 1011542, LabelColor, false, false ); // normal - object name = GetMaterialName( e.Material, e.DeedType, e.ItemType ); + object name = GetMaterialName( smallEntry.Material, smallEntry.DeedType, smallEntry.ItemType ); - if ( name is int ) - AddHtmlLocalized( 316, y, 100, 20, (int)name, LabelColor, false, false ); - else if ( name is string ) - AddLabel( 316, y, 1152, (string)name ); + if ( name is int intName ) + AddHtmlLocalized( 316, y, 100, 20, intName, LabelColor, false, false ); + else + AddLabel( 316, y, 1152, name.ToString() ); - AddLabel( 421, y, 1152, String.Format( "{0} / {1}", e.AmountCur, e.AmountMax ) ); + AddLabel( 421, y, 1152, String.Format( "{0} / {1}", smallEntry.AmountCur, smallEntry.AmountMax ) ); } } } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/BulkOrders/Books/BODBuyGump.cs b/Scripts/Engines/BulkOrders/Books/BODBuyGump.cs index 9b621af02..d1844c5de 100644 --- a/Scripts/Engines/BulkOrders/Books/BODBuyGump.cs +++ b/Scripts/Engines/BulkOrders/Books/BODBuyGump.cs @@ -28,9 +28,9 @@ namespace Server.Engines.BulkOrders if ( vi != null && !vi.IsForSale ) { - if ( m_Object is BOBLargeEntry ) - price = ((BOBLargeEntry)m_Object).Price; - else if ( m_Object is BOBSmallEntry ) + if ( m_Object is BOBLargeEntry entry ) + price = entry.Price; + else price = ((BOBSmallEntry)m_Object).Price; } @@ -46,9 +46,9 @@ namespace Server.Engines.BulkOrders { Item item = null; - if ( m_Object is BOBLargeEntry ) - item = ((BOBLargeEntry)m_Object).Reconstruct(); - else if ( m_Object is BOBSmallEntry ) + if ( m_Object is BOBLargeEntry entry ) + item = entry.Reconstruct(); + else item = ((BOBSmallEntry)m_Object).Reconstruct(); if ( item == null ) @@ -75,7 +75,7 @@ namespace Server.Engines.BulkOrders pv.HoldGold += price; m_From.AddToBackpack( item ); m_From.SendLocalizedMessage( 1045152 ); // The bulk order deed has been placed in your backpack. - + if ( m_Book.Entries.Count / 5 < m_Book.ItemCount ) { m_Book.ItemCount--; diff --git a/Scripts/Engines/BulkOrders/Books/BulkOrderBook.cs b/Scripts/Engines/BulkOrders/Books/BulkOrderBook.cs index 136348142..2a07dfc85 100644 --- a/Scripts/Engines/BulkOrders/Books/BulkOrderBook.cs +++ b/Scripts/Engines/BulkOrders/Books/BulkOrderBook.cs @@ -42,7 +42,7 @@ namespace Server.Engines.BulkOrders { get{ return m_Filter; } } - + public int ItemCount { get{ return m_ItemCount; } @@ -67,8 +67,8 @@ namespace Server.Engines.BulkOrders from.LocalOverheadMessage( Network.MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that. else if ( m_Entries.Count == 0 ) from.SendLocalizedMessage( 1062381 ); // The book is empty. - else if ( from is PlayerMobile ) - from.SendGump( new BOBGump( (PlayerMobile)from, this ) ); + else if ( from is PlayerMobile mobile ) + mobile.SendGump( new BOBGump( mobile, this ) ); } public override void OnDoubleClickSecureTrade( Mobile from ) @@ -108,17 +108,17 @@ namespace Server.Engines.BulkOrders from.SendLocalizedMessage( 1062385 ); // You must have the book in your backpack to add deeds to it. return false; } - else if ( !from.Backpack.CheckHold( from, dropped, true, true ) ) + if ( !from.Backpack.CheckHold( from, dropped, true, true ) ) return false; - else if ( m_Entries.Count < 500 ) + if ( m_Entries.Count < 500 ) { - if ( dropped is LargeBOD ) - m_Entries.Add( new BOBLargeEntry( (LargeBOD)dropped ) ); - else if ( dropped is SmallBOD ) // Sanity + if ( dropped is LargeBOD bod ) + m_Entries.Add( new BOBLargeEntry( bod ) ); + else m_Entries.Add( new BOBSmallEntry( (SmallBOD)dropped ) ); - + InvalidateProperties(); - + if ( m_Entries.Count / 5 > m_ItemCount ) { m_ItemCount++; @@ -128,51 +128,45 @@ namespace Server.Engines.BulkOrders from.SendSound(0x42, GetWorldLocation()); from.SendLocalizedMessage( 1062386 ); // Deed added to book. - if ( from is PlayerMobile ) - from.SendGump( new BOBGump( (PlayerMobile)from, this ) ); + if ( from is PlayerMobile pm ) + pm.SendGump( new BOBGump( pm, this ) ); dropped.Delete(); return true; } - else - { - from.SendLocalizedMessage( 1062387 ); // The book is full of deeds. - return false; - } + + from.SendLocalizedMessage( 1062387 ); // The book is full of deeds. + return false; } from.SendLocalizedMessage( 1062388 ); // That is not a bulk order deed. return false; } - + public override int GetTotal( TotalType type ) { int total = base.GetTotal( type ); - + if ( type == TotalType.Items ) total = m_ItemCount; return total; } - + public void InvalidateItems() { - if ( RootParent is Mobile ) + if ( RootParent is Mobile m ) { - Mobile m = (Mobile) RootParent; - m.UpdateTotals(); InvalidateContainers( Parent ); } } - + public void InvalidateContainers( object parent ) { - if ( parent != null && parent is Container ) + if ( parent is Container c ) { - Container c = (Container)parent; - c.InvalidateProperties(); InvalidateContainers( c.Parent ); } @@ -187,7 +181,7 @@ namespace Server.Engines.BulkOrders base.Serialize( writer ); writer.Write( (int) 2 ); // version - + writer.Write( (int) m_ItemCount ); writer.Write( (int) m_Level ); @@ -202,19 +196,15 @@ namespace Server.Engines.BulkOrders { object obj = m_Entries[i]; - if ( obj is BOBLargeEntry ) + if ( obj is BOBLargeEntry entry ) { writer.WriteEncodedInt( 0 ); - ((BOBLargeEntry)obj).Serialize( writer ); - } - else if ( obj is BOBSmallEntry ) - { - writer.WriteEncodedInt( 1 ); - ((BOBSmallEntry)obj).Serialize( writer ); + entry.Serialize( writer ); } else { - writer.WriteEncodedInt( -1 ); + writer.WriteEncodedInt( 1 ); + ((BOBSmallEntry)obj).Serialize( writer ); } } } @@ -341,4 +331,4 @@ namespace Server.Engines.BulkOrders } } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/BulkOrders/LargeBOD.cs b/Scripts/Engines/BulkOrders/LargeBOD.cs index 53816c441..e04b07485 100644 --- a/Scripts/Engines/BulkOrders/LargeBOD.cs +++ b/Scripts/Engines/BulkOrders/LargeBOD.cs @@ -146,12 +146,10 @@ namespace Server.Engines.BulkOrders public void EndCombine( Mobile from, object o ) { - if ( o is Item && ((Item)o).IsChildOf( from.Backpack ) ) + if ( o is Item item && item.IsChildOf( from.Backpack ) ) { - if ( o is SmallBOD ) + if ( item is SmallBOD small ) { - SmallBOD small = (SmallBOD)o; - LargeBulkEntry entry = null; for ( int i = 0; entry == null && i < m_Entries.Length; ++i ) diff --git a/Scripts/Engines/BulkOrders/LargeSmithBOD.cs b/Scripts/Engines/BulkOrders/LargeSmithBOD.cs index d73df7f24..13f39a4b8 100644 --- a/Scripts/Engines/BulkOrders/LargeSmithBOD.cs +++ b/Scripts/Engines/BulkOrders/LargeSmithBOD.cs @@ -38,7 +38,7 @@ namespace Server.Engines.BulkOrders { LargeBulkEntry[] entries; bool useMaterials = true; - + int rand = Utility.Random( 8 ); switch ( rand ) @@ -53,8 +53,8 @@ namespace Server.Engines.BulkOrders case 6: entries = LargeBulkEntry.ConvertEntries( this, LargeBulkEntry.LargePolearms ); break; case 7: entries = LargeBulkEntry.ConvertEntries( this, LargeBulkEntry.LargeSwords ); break; } - - if( rand > 2 && rand < 8 ) + + if ( rand > 2 && rand < 8 ) useMaterials = false; int hue = 0x44E; @@ -137,4 +137,4 @@ namespace Server.Engines.BulkOrders int version = reader.ReadInt(); } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/BulkOrders/SmallBOD.cs b/Scripts/Engines/BulkOrders/SmallBOD.cs index f78cede43..46e378433 100644 --- a/Scripts/Engines/BulkOrders/SmallBOD.cs +++ b/Scripts/Engines/BulkOrders/SmallBOD.cs @@ -167,26 +167,24 @@ namespace Server.Engines.BulkOrders public void EndCombine( Mobile from, object o ) { - if ( o is Item && ((Item)o).IsChildOf( from.Backpack ) ) + if ( o is Item item && item.IsChildOf( from.Backpack ) ) { - Type objectType = o.GetType(); + Type objectType = item.GetType(); if ( m_AmountCur >= m_AmountMax ) { from.SendLocalizedMessage( 1045166 ); // The maximum amount of requested items have already been combined to this deed. } - else if ( m_Type == null || (objectType != m_Type && !objectType.IsSubclassOf( m_Type )) || (!(o is BaseWeapon) && !(o is BaseArmor) && !(o is BaseClothing)) ) + else if ( m_Type == null || (objectType != m_Type && !objectType.IsSubclassOf( m_Type )) || (!(item is BaseWeapon) && !(item is BaseArmor) && !(item is BaseClothing)) ) { from.SendLocalizedMessage( 1045169 ); // The item is not in the request. } else { - BulkMaterialType material = BulkMaterialType.None; + BaseArmor armor = item as BaseArmor; + BaseClothing clothing = item as BaseClothing; - if ( o is BaseArmor ) - material = GetMaterial( ((BaseArmor)o).Resource ); - else if ( o is BaseClothing ) - material = GetMaterial( ((BaseClothing)o).Resource ); + BulkMaterialType material = GetMaterial( armor?.Resource ?? clothing?.Resource ?? CraftResource.None ); if ( m_Material >= BulkMaterialType.DullCopper && m_Material <= BulkMaterialType.Valorite && material != m_Material ) { @@ -198,14 +196,14 @@ namespace Server.Engines.BulkOrders } else { - bool isExceptional = false; + bool isExceptional; - if ( o is BaseWeapon ) - isExceptional = ( ((BaseWeapon)o).Quality == WeaponQuality.Exceptional ); - else if ( o is BaseArmor ) - isExceptional = ( ((BaseArmor)o).Quality == ArmorQuality.Exceptional ); - else if ( o is BaseClothing ) - isExceptional = ( ((BaseClothing)o).Quality == ClothingQuality.Exceptional ); + if ( item is BaseWeapon weapon ) + isExceptional = weapon.Quality == WeaponQuality.Exceptional; + else if ( armor != null ) + isExceptional = armor.Quality == ArmorQuality.Exceptional; + else + isExceptional = clothing.Quality == ClothingQuality.Exceptional; if ( m_RequireExceptional && !isExceptional ) { @@ -213,7 +211,7 @@ namespace Server.Engines.BulkOrders } else { - ((Item)o).Delete(); + item.Delete(); ++AmountCur; from.SendLocalizedMessage( 1045170 ); // The item has been combined with the deed. diff --git a/Scripts/Engines/CannedEvil/ChampionSkull.cs b/Scripts/Engines/CannedEvil/ChampionSkull.cs index 95007b73a..116406fbc 100644 --- a/Scripts/Engines/CannedEvil/ChampionSkull.cs +++ b/Scripts/Engines/CannedEvil/ChampionSkull.cs @@ -60,7 +60,7 @@ namespace Server.Items } } - if( version == 0 ) + if ( version == 0 ) { if ( LootType != LootType.Cursed ) LootType = LootType.Cursed; diff --git a/Scripts/Engines/CannedEvil/ChampionSpawn.cs b/Scripts/Engines/CannedEvil/ChampionSpawn.cs index 665daf7bb..04600c88b 100644 --- a/Scripts/Engines/CannedEvil/ChampionSpawn.cs +++ b/Scripts/Engines/CannedEvil/ChampionSpawn.cs @@ -99,17 +99,17 @@ namespace Server.Engines.CannedEvil public void UpdateRegion() { - if( m_Region != null ) + if ( m_Region != null ) m_Region.Unregister(); - if( !Deleted && this.Map != Map.Internal ) + if ( !Deleted && this.Map != Map.Internal ) { m_Region = new ChampionSpawnRegion( this ); m_Region.Register(); } /* - if( m_Region == null ) + if ( m_Region == null ) { m_Region = new ChampionSpawnRegion( this ); } @@ -229,7 +229,7 @@ namespace Server.Engines.CannedEvil } set { - if( value ) + if ( value ) Start(); else Stop(); @@ -322,24 +322,24 @@ namespace Server.Engines.CannedEvil public void Start() { - if( m_Active || Deleted ) + if ( m_Active || Deleted ) return; m_Active = true; m_HasBeenAdvanced = false; - if( m_Timer != null ) + if ( m_Timer != null ) m_Timer.Stop(); m_Timer = new SliceTimer( this ); m_Timer.Start(); - if( m_RestartTimer != null ) + if ( m_RestartTimer != null ) m_RestartTimer.Stop(); m_RestartTimer = null; - if( m_Altar != null ) + if ( m_Altar != null ) { if ( m_Champion != null ) m_Altar.Hue = 0x26; @@ -353,23 +353,23 @@ namespace Server.Engines.CannedEvil public void Stop() { - if( !m_Active || Deleted ) + if ( !m_Active || Deleted ) return; m_Active = false; m_HasBeenAdvanced = false; - if( m_Timer != null ) + if ( m_Timer != null ) m_Timer.Stop(); m_Timer = null; - if( m_RestartTimer != null ) + if ( m_RestartTimer != null ) m_RestartTimer.Stop(); m_RestartTimer = null; - if( m_Altar != null ) + if ( m_Altar != null ) m_Altar.Hue = 0; if ( m_Platform != null ) @@ -378,7 +378,7 @@ namespace Server.Engines.CannedEvil public void BeginRestart( TimeSpan ts ) { - if( m_RestartTimer != null ) + if ( m_RestartTimer != null ) m_RestartTimer.Stop(); m_RestartTime = DateTime.UtcNow + ts; @@ -389,7 +389,7 @@ namespace Server.Engines.CannedEvil public void EndRestart() { - if( RandomizeType ) + if ( RandomizeType ) { switch( Utility.Random( 5 ) ) { @@ -420,7 +420,7 @@ namespace Server.Engines.CannedEvil public static void GiveScrollTo( Mobile killer, SpecialScroll scroll ) { - if( scroll == null || killer == null ) //sanity + if ( scroll == null || killer == null ) //sanity return; if ( scroll is ScrollofTranscendence ) @@ -432,7 +432,7 @@ namespace Server.Engines.CannedEvil killer.AddToBackpack( scroll ); else { - if( killer.Corpse != null && !killer.Corpse.Deleted ) + if ( killer.Corpse != null && !killer.Corpse.Deleted ) killer.Corpse.DropItem( scroll ); else killer.AddToBackpack( scroll ); @@ -462,9 +462,7 @@ namespace Server.Engines.CannedEvil { prot.SendLocalizedMessage( 1049368 ); // You have been rewarded for your dedication to Justice! - SpecialScroll scrollDupe = Activator.CreateInstance( scroll.GetType() ) as SpecialScroll; - - if ( scrollDupe != null ) + if ( Activator.CreateInstance( scroll.GetType() ) is SpecialScroll scrollDupe ) { scrollDupe.Skill = scroll.Skill; scrollDupe.Value = scroll.Value; @@ -478,28 +476,28 @@ namespace Server.Engines.CannedEvil public void OnSlice() { - if( !m_Active || Deleted ) + if ( !m_Active || Deleted ) return; - if( m_Champion != null ) + if ( m_Champion != null ) { - if( m_Champion.Deleted ) + if ( m_Champion.Deleted ) { RegisterDamageTo( m_Champion ); - if( m_Champion is BaseChampion ) - AwardArtifact( ((BaseChampion)m_Champion).GetArtifact() ); + if ( m_Champion is BaseChampion champion ) + AwardArtifact( champion.GetArtifact() ); m_DamageEntries.Clear(); - if( m_Platform != null ) + if ( m_Platform != null ) m_Platform.Hue = 0x497; - if( m_Altar != null ) + if ( m_Altar != null ) { m_Altar.Hue = 0; - if( !Core.ML || Map == Map.Felucca ) + if ( !Core.ML || Map == Map.Felucca ) { new StarRoomGate( true, m_Altar.Location, m_Altar.Map ); } @@ -521,7 +519,7 @@ namespace Server.Engines.CannedEvil if ( m.Deleted ) { - if( m.Corpse != null && !m.Corpse.Deleted ) + if ( m.Corpse != null && !m.Corpse.Deleted ) { ((Corpse)m.Corpse).BeginDecay( TimeSpan.FromMinutes( 1 )); } @@ -533,10 +531,10 @@ namespace Server.Engines.CannedEvil RegisterDamageTo( m ); - if( killer is BaseCreature ) - killer = ((BaseCreature)killer).GetMaster(); + if ( killer is BaseCreature bc ) + killer = bc.GetMaster(); - if( killer is PlayerMobile ) + if ( killer is PlayerMobile pm ) { #region Scroll of Transcendence if ( Core.ML ) @@ -545,7 +543,6 @@ namespace Server.Engines.CannedEvil { if ( Utility.RandomDouble() < 0.001 ) { - PlayerMobile pm = (PlayerMobile)killer; double random = Utility.Random ( 49 ); if ( random <= 24 ) @@ -565,9 +562,9 @@ namespace Server.Engines.CannedEvil { if ( Utility.RandomDouble() < 0.0015 ) { - killer.SendLocalizedMessage( 1094936 ); // You have received a Scroll of Transcendence! + pm.SendLocalizedMessage( 1094936 ); // You have received a Scroll of Transcendence! ScrollofTranscendence SoTT = CreateRandomSoT( false ); - killer.AddToBackpack( SoTT ); + pm.AddToBackpack( SoTT ); } } } @@ -575,15 +572,15 @@ namespace Server.Engines.CannedEvil int mobSubLevel = GetSubLevelFor( m ) + 1; - if( mobSubLevel >= 0 ) + if ( mobSubLevel >= 0 ) { bool gainedPath = false; int pointsToGain = mobSubLevel * 40; - if( VirtueHelper.Award( killer, VirtueName.Valor, pointsToGain, ref gainedPath ) ) + if ( VirtueHelper.Award( pm, VirtueName.Valor, pointsToGain, ref gainedPath ) ) { - if( gainedPath ) + if ( gainedPath ) m.SendLocalizedMessage( 1054032 ); // You have gained a path in Valor! else m.SendLocalizedMessage( 1054030 ); // You have gained in Valor! @@ -591,7 +588,7 @@ namespace Server.Engines.CannedEvil //No delay on Valor gains } - PlayerMobile.ChampionTitleInfo info = ((PlayerMobile)killer).ChampionTitles; + PlayerMobile.ChampionTitleInfo info = pm.ChampionTitles; info.Award( m_Type, mobSubLevel ); } @@ -606,12 +603,12 @@ namespace Server.Engines.CannedEvil double n = m_Kills / (double)MaxKills; int p = (int)(n * 100); - if( p >= 90 ) + if ( p >= 90 ) AdvanceLevel(); - else if( p > 0 ) + else if ( p > 0 ) SetWhiteSkullCount( p / 20 ); - if( DateTime.UtcNow >= m_ExpireTime ) + if ( DateTime.UtcNow >= m_ExpireTime ) Expire(); Respawn(); @@ -622,14 +619,14 @@ namespace Server.Engines.CannedEvil { m_ExpireTime = DateTime.UtcNow + m_ExpireDelay; - if( Level < 16 ) + if ( Level < 16 ) { m_Kills = 0; ++Level; InvalidateProperties(); SetWhiteSkullCount( 0 ); - if( m_Altar != null ) + if ( m_Altar != null ) { Effects.PlaySound( m_Altar.Location, m_Altar.Map, 0x29 ); Effects.SendLocationEffect( new Point3D( m_Altar.X + 1, m_Altar.Y + 1, m_Altar.Z ), m_Altar.Map, 0x3728, 10 ); @@ -643,7 +640,7 @@ namespace Server.Engines.CannedEvil public void SpawnChampion() { - if( m_Altar != null ) + if ( m_Altar != null ) m_Altar.Hue = 0x26; if ( m_Platform != null ) @@ -660,20 +657,20 @@ namespace Server.Engines.CannedEvil } catch { } - if( m_Champion != null ) + if ( m_Champion != null ) m_Champion.MoveToWorld( new Point3D( X, Y, Z - 15 ), Map ); } public void Respawn() { - if( !m_Active || Deleted || m_Champion != null ) + if ( !m_Active || Deleted || m_Champion != null ) return; while( m_Creatures.Count < ( ( m_SPawnSzMod * ( 200 / 12 ) ) ) - ( GetSubLevel() * ( m_SPawnSzMod * ( 40 / 12 ) ) ) ) { Mobile m = Spawn(); - if( m == null ) + if ( m == null ) return; Point3D loc = GetSpawnLocation(); @@ -684,12 +681,11 @@ namespace Server.Engines.CannedEvil m_Creatures.Add( m ); m.MoveToWorld( loc, Map ); - if( m is BaseCreature ) + if ( m is BaseCreature bc ) { - BaseCreature bc = m as BaseCreature; bc.Tamable = false; - if( !m_ConfinedRoaming ) + if ( !m_ConfinedRoaming ) { bc.Home = this.Location; bc.RangeHome = (int)(Math.Sqrt( m_SpawnArea.Width * m_SpawnArea.Width + m_SpawnArea.Height * m_SpawnArea.Height )/2); @@ -716,7 +712,7 @@ namespace Server.Engines.CannedEvil { Map map = Map; - if( map == null ) + if ( map == null ) return Location; // Try 20 times to find a spawnable location. @@ -732,11 +728,11 @@ namespace Server.Engines.CannedEvil int z = Map.GetAverageZ( x, y ); - if( Map.CanSpawnMobile( new Point2D( x, y ), z ) ) + if ( Map.CanSpawnMobile( new Point2D( x, y ), z ) ) return new Point3D( x, y, z ); /* try @ platform Z if map z fails */ - else if( Map.CanSpawnMobile( new Point2D( x, y ), m_Platform.Location.Z ) ) + else if ( Map.CanSpawnMobile( new Point2D( x, y ), m_Platform.Location.Z ) ) return new Point3D( x, y, m_Platform.Location.Z ); } @@ -751,11 +747,11 @@ namespace Server.Engines.CannedEvil { int level = this.Level; - if( level <= Level1 ) + if ( level <= Level1 ) return 0; - else if( level <= Level2 ) + else if ( level <= Level2 ) return 1; - else if( level <= Level3 ) + else if ( level <= Level3 ) return 2; return 3; @@ -772,7 +768,7 @@ namespace Server.Engines.CannedEvil for( int j = 0; j < individualTypes.Length; j++ ) { - if( t == individualTypes[j] ) + if ( t == individualTypes[j] ) return i; } } @@ -786,7 +782,7 @@ namespace Server.Engines.CannedEvil int v = GetSubLevel(); - if( v >= 0 && v < types.Length ) + if ( v >= 0 && v < types.Length ) return Spawn( types[v] ); return null; @@ -808,11 +804,11 @@ namespace Server.Engines.CannedEvil { m_Kills = 0; - if( m_WhiteSkulls.Count == 0 ) + if ( m_WhiteSkulls.Count == 0 ) { // They didn't even get 20%, go back a level - if( Level > 0 ) + if ( Level > 0 ) --Level; InvalidateProperties(); @@ -829,17 +825,17 @@ namespace Server.Engines.CannedEvil { int x, y; - if( index < 5 ) + if ( index < 5 ) { x = index - 2; y = -2; } - else if( index < 9 ) + else if ( index < 9 ) { x = 2; y = index - 6; } - else if( index < 13 ) + else if ( index < 13 ) { x = 10 - index; y = 2; @@ -878,7 +874,7 @@ namespace Server.Engines.CannedEvil { base.GetProperties( list ); - if( m_Active ) + if ( m_Active ) { list.Add( 1060742 ); // active list.Add( 1060658, "Type\t{0}", m_Type ); // ~1_val~: ~2_val~ @@ -894,7 +890,7 @@ namespace Server.Engines.CannedEvil public override void OnSingleClick( Mobile from ) { - if( m_Active ) + if ( m_Active ) LabelTo( from, "{0} (Active; Level: {1}; Kills: {2}/{3})", m_Type, Level, m_Kills, MaxKills ); else LabelTo( from, "{0} (Inactive)", m_Type ); @@ -907,25 +903,25 @@ namespace Server.Engines.CannedEvil public override void OnLocationChange( Point3D oldLoc ) { - if( Deleted ) + if ( Deleted ) return; - if( m_Platform != null ) + if ( m_Platform != null ) m_Platform.Location = new Point3D( X, Y, Z - 20 ); - if( m_Altar != null ) + if ( m_Altar != null ) m_Altar.Location = new Point3D( X, Y, Z - 15 ); - if( m_Idol != null ) + if ( m_Idol != null ) m_Idol.Location = new Point3D( X, Y, Z - 15 ); - if( m_RedSkulls != null ) + if ( m_RedSkulls != null ) { for( int i = 0; i < m_RedSkulls.Count; ++i ) m_RedSkulls[i].Location = GetRedSkullLocation( i ); } - if( m_WhiteSkulls != null ) + if ( m_WhiteSkulls != null ) { for( int i = 0; i < m_WhiteSkulls.Count; ++i ) m_WhiteSkulls[i].Location = GetWhiteSkullLocation( i ); @@ -939,25 +935,25 @@ namespace Server.Engines.CannedEvil public override void OnMapChange() { - if( Deleted ) + if ( Deleted ) return; - if( m_Platform != null ) + if ( m_Platform != null ) m_Platform.Map = Map; - if( m_Altar != null ) + if ( m_Altar != null ) m_Altar.Map = Map; - if( m_Idol != null ) + if ( m_Idol != null ) m_Idol.Map = Map; - if( m_RedSkulls != null ) + if ( m_RedSkulls != null ) { for( int i = 0; i < m_RedSkulls.Count; ++i ) m_RedSkulls[i].Map = Map; } - if( m_WhiteSkulls != null ) + if ( m_WhiteSkulls != null ) { for( int i = 0; i < m_WhiteSkulls.Count; ++i ) m_WhiteSkulls[i].Map = Map; @@ -970,16 +966,16 @@ namespace Server.Engines.CannedEvil { base.OnAfterDelete(); - if( m_Platform != null ) + if ( m_Platform != null ) m_Platform.Delete(); - if( m_Altar != null ) + if ( m_Altar != null ) m_Altar.Delete(); - if( m_Idol != null ) + if ( m_Idol != null ) m_Idol.Delete(); - if( m_RedSkulls != null ) + if ( m_RedSkulls != null ) { for( int i = 0; i < m_RedSkulls.Count; ++i ) m_RedSkulls[i].Delete(); @@ -987,7 +983,7 @@ namespace Server.Engines.CannedEvil m_RedSkulls.Clear(); } - if( m_WhiteSkulls != null ) + if ( m_WhiteSkulls != null ) { for( int i = 0; i < m_WhiteSkulls.Count; ++i ) m_WhiteSkulls[i].Delete(); @@ -995,20 +991,20 @@ namespace Server.Engines.CannedEvil m_WhiteSkulls.Clear(); } - if( m_Creatures != null ) + if ( m_Creatures != null ) { for( int i = 0; i < m_Creatures.Count; ++i ) { Mobile mob = m_Creatures[i]; - if( !mob.Player ) + if ( !mob.Player ) mob.Delete(); } m_Creatures.Clear(); } - if( m_Champion != null && !m_Champion.Player ) + if ( m_Champion != null && !m_Champion.Player ) m_Champion.Delete(); Stop(); @@ -1022,19 +1018,19 @@ namespace Server.Engines.CannedEvil public virtual void RegisterDamageTo( Mobile m ) { - if( m == null ) + if ( m == null ) return; foreach( DamageEntry de in m.DamageEntries ) { - if( de.HasExpired ) + if ( de.HasExpired ) continue; Mobile damager = de.Damager; Mobile master = damager.GetDamageMaster( m ); - if( master != null ) + if ( master != null ) damager = master; RegisterDamage( damager, de.DamageGiven ); @@ -1043,10 +1039,10 @@ namespace Server.Engines.CannedEvil public void RegisterDamage( Mobile from, int amount ) { - if( from == null || !from.Player ) + if ( from == null || !from.Player ) return; - if( m_DamageEntries.ContainsKey( from ) ) + if ( m_DamageEntries.ContainsKey( from ) ) m_DamageEntries[from] += amount; else m_DamageEntries.Add( from, amount ); @@ -1063,7 +1059,7 @@ namespace Server.Engines.CannedEvil foreach (KeyValuePair kvp in m_DamageEntries) { - if( IsEligible( kvp.Key, artifact ) ) + if ( IsEligible( kvp.Key, artifact ) ) { validEntries.Add( kvp.Key, kvp.Value ); totalDamage += kvp.Value; @@ -1078,7 +1074,7 @@ namespace Server.Engines.CannedEvil { totalDamage += kvp.Value; - if( totalDamage >= randomDamage ) + if ( totalDamage >= randomDamage ) { GiveArtifact( kvp.Key, artifact ); return; @@ -1144,7 +1140,7 @@ namespace Server.Engines.CannedEvil writer.Write( m_RestartTimer != null ); - if( m_RestartTimer != null ) + if ( m_RestartTimer != null ) writer.WriteDeltaTime( m_RestartTime ); } @@ -1203,7 +1199,7 @@ namespace Server.Engines.CannedEvil } case 1: { - if( version < 3 ) + if ( version < 3 ) { int oldRange = reader.ReadInt(); @@ -1216,7 +1212,7 @@ namespace Server.Engines.CannedEvil } case 0: { - if( version < 1 ) + if ( version < 1 ) m_SpawnArea = new Rectangle2D( new Point2D( X - 24, Y - 24 ), new Point2D( X + 24, Y + 24 ) ); //Default was 24 bool active = reader.ReadBool(); @@ -1231,21 +1227,21 @@ namespace Server.Engines.CannedEvil m_Champion = reader.ReadMobile(); m_RestartDelay = reader.ReadTimeSpan(); - if( reader.ReadBool() ) + if ( reader.ReadBool() ) { m_RestartTime = reader.ReadDeltaTime(); BeginRestart( m_RestartTime - DateTime.UtcNow ); } - if( version < 4 ) + if ( version < 4 ) { m_Idol = new IdolOfTheChampion( this ); m_Idol.MoveToWorld( new Point3D( X, Y, Z - 15 ), Map ); } - if( m_Platform == null || m_Altar == null || m_Idol == null ) + if ( m_Platform == null || m_Altar == null || m_Idol == null ) Delete(); - else if( active ) + else if ( active ) Start(); break; diff --git a/Scripts/Engines/CannedEvil/ChampionSpawnType.cs b/Scripts/Engines/CannedEvil/ChampionSpawnType.cs index 2d12f66d9..13b8d1892 100644 --- a/Scripts/Engines/CannedEvil/ChampionSpawnType.cs +++ b/Scripts/Engines/CannedEvil/ChampionSpawnType.cs @@ -113,7 +113,7 @@ namespace Server.Engines.CannedEvil { int v = (int)type; - if( v < 0 || v >= m_Table.Length ) + if ( v < 0 || v >= m_Table.Length ) v = 0; return m_Table[v]; diff --git a/Scripts/Engines/Chat/ChatUser.cs b/Scripts/Engines/Chat/ChatUser.cs index 6c7d3c6fd..32d550941 100644 --- a/Scripts/Engines/Chat/ChatUser.cs +++ b/Scripts/Engines/Chat/ChatUser.cs @@ -48,18 +48,14 @@ namespace Server.Engines.Chat { get { - Account acct = m_Mobile.Account as Account; - - if ( acct != null ) + if ( m_Mobile.Account is Account acct ) return acct.GetTag( "ChatName" ); return null; } set { - Account acct = m_Mobile.Account as Account; - - if ( acct != null ) + if ( m_Mobile.Account is Account acct ) acct.SetTag( "ChatName", value ); } } diff --git a/Scripts/Engines/ConPVP/AcceptDuelGump.cs b/Scripts/Engines/ConPVP/AcceptDuelGump.cs index a367e38ab..1f6b1a089 100644 --- a/Scripts/Engines/ConPVP/AcceptDuelGump.cs +++ b/Scripts/Engines/ConPVP/AcceptDuelGump.cs @@ -197,9 +197,7 @@ namespace Server.Engines.ConPVP if ( info.IsSwitched( 1 ) ) { - PlayerMobile pm = m_Challenged as PlayerMobile; - - if ( pm == null ) + if ( !(m_Challenged is PlayerMobile pm) ) return; if ( pm.DuelContext != null ) @@ -254,25 +252,15 @@ namespace Server.Engines.ConPVP { foreach ( Gump g in ns.Gumps ) { - if ( g is ParticipantGump ) + if ( g is ParticipantGump pg && pg.Participant == m_Participant ) { - ParticipantGump pg = (ParticipantGump)g; - - if ( pg.Participant == m_Participant ) - { - m_Challenger.SendGump( new ParticipantGump( m_Challenger, m_Context, m_Participant ) ); - break; - } + m_Challenger.SendGump( new ParticipantGump( m_Challenger, m_Context, m_Participant ) ); + break; } - else if ( g is DuelContextGump ) + if ( g is DuelContextGump dcg && dcg.Context == m_Context ) { - DuelContextGump dcg = (DuelContextGump)g; - - if ( dcg.Context == m_Context ) - { - m_Challenger.SendGump( new DuelContextGump( m_Challenger, m_Context ) ); - break; - } + m_Challenger.SendGump( new DuelContextGump( m_Challenger, m_Context ) ); + break; } } } @@ -294,4 +282,4 @@ namespace Server.Engines.ConPVP } } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/ConPVP/Arena.cs b/Scripts/Engines/ConPVP/Arena.cs index ca05aeca4..5ed7a0fd4 100644 --- a/Scripts/Engines/ConPVP/Arena.cs +++ b/Scripts/Engines/ConPVP/Arena.cs @@ -615,12 +615,8 @@ namespace Server.Engines.ConPVP List pets = new List(); foreach ( Mobile mob in facet.GetMobilesInBounds( m_Bounds ) ) { - BaseCreature pet = mob as BaseCreature; - - if ( pet != null && pet.Controlled && pet.ControlMaster != null ) { - if ( m_Players.Contains( pet.ControlMaster ) ) { - pets.Add( pet ); - } + if ( mob is BaseCreature pet && pet.Controlled && pet.ControlMaster != null && m_Players.Contains( pet.ControlMaster ) ) { + pets.Add( pet ); } } @@ -826,4 +822,4 @@ namespace Server.Engines.ConPVP return a.CompareTo( b ); } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/ConPVP/DuelContext.cs b/Scripts/Engines/ConPVP/DuelContext.cs index cddde19b2..e3b46f516 100644 --- a/Scripts/Engines/ConPVP/DuelContext.cs +++ b/Scripts/Engines/ConPVP/DuelContext.cs @@ -55,15 +55,13 @@ namespace Server.Engines.ConPVP { if ( m_EventGame != null ) return m_EventGame.CantDoAnything( mob ); - else + return false; } public static bool IsFreeConsume( Mobile mob ) { - PlayerMobile pm = mob as PlayerMobile; - - if ( pm == null || pm.DuelContext == null || pm.DuelContext.m_EventGame == null ) + if ( !(mob is PlayerMobile pm) || pm.DuelContext?.m_EventGame == null ) return false; return pm.DuelContext.m_EventGame.FreeConsume; @@ -76,14 +74,13 @@ namespace Server.Engines.ConPVP public static bool AllowSpecialMove( Mobile from, string name, SpecialMove move ) { - PlayerMobile pm = from as PlayerMobile; - - if( pm == null ) + if ( !(from is PlayerMobile pm) ) return true; DuelContext dc = pm.DuelContext; - return (dc == null || dc.InstAllowSpecialMove( from, name, move )); + // No DuelContext, or InstaAllowSpecialMove + return dc?.InstAllowSpecialMove( from, name, move ) != false; } public bool InstAllowSpecialMove( Mobile from, string name, SpecialMove move ) @@ -102,9 +99,9 @@ namespace Server.Engines.ConPVP string title = null; - if( move is NinjaMove ) + if ( move is NinjaMove ) title = "Bushido"; - else if( move is SamuraiMove ) + else if ( move is SamuraiMove ) title = "Ninjitsu"; @@ -133,7 +130,7 @@ namespace Server.Engines.ConPVP string title = null, option = null; - if( spell is ArcanistSpell ) + if ( spell is ArcanistSpell ) { title = "Spellweaving"; option = spell.Name; @@ -158,9 +155,9 @@ namespace Server.Engines.ConPVP title = "Bushido"; option = spell.Name; } - else if( spell is MagerySpell ) + else if ( spell is MagerySpell magerySpell ) { - switch( ((MagerySpell)spell).Circle ) + switch( magerySpell.Circle ) { case SpellCircle.First: title = "1st Circle"; break; case SpellCircle.Second: title = "2nd Circle"; break; @@ -172,7 +169,7 @@ namespace Server.Engines.ConPVP case SpellCircle.Eighth: title = "8th Circle"; break; } - option = spell.Name; + option = magerySpell.Name; } else { @@ -206,14 +203,13 @@ namespace Server.Engines.ConPVP public static bool AllowSpecialAbility( Mobile from, string name, bool message ) { - PlayerMobile pm = from as PlayerMobile; - - if ( pm == null ) + if ( !(from is PlayerMobile pm) ) return true; DuelContext dc = pm.DuelContext; - return ( dc == null || dc.InstAllowSpecialAbility( from, name, message ) ); + // No DuelContext or InstAllowSpecialAbility + return dc?.InstAllowSpecialAbility( from, name, message ) != false; } public bool InstAllowSpecialAbility( Mobile from, string name, bool message ) @@ -223,7 +219,7 @@ namespace Server.Engines.ConPVP DuelPlayer pl = Find( from ); - if ( pl == null || pl.Eliminated ) + if ( pl?.Eliminated != false ) return true; if ( CantDoAnything( from ) ) @@ -245,10 +241,8 @@ namespace Server.Engines.ConPVP if ( !m_Ruleset.GetOption( "Weapons", "Wrestling" ) ) return false; } - else if ( item is BaseArmor ) + else if ( item is BaseArmor armor ) { - BaseArmor armor = (BaseArmor)item; - if ( armor.ProtectionLevel > ArmorProtectionLevel.Regular && !m_Ruleset.GetOption( "Armor", "Magical" ) ) return false; @@ -258,10 +252,8 @@ namespace Server.Engines.ConPVP if ( armor is BaseShield && !m_Ruleset.GetOption( "Armor", "Shields" ) ) return false; } - else if ( item is BaseWeapon ) + else if ( item is BaseWeapon weapon ) { - BaseWeapon weapon = (BaseWeapon)item; - if ( (weapon.DamageLevel > WeaponDamageLevel.Regular || weapon.AccuracyLevel > WeaponAccuracyLevel.Regular) && !m_Ruleset.GetOption( "Weapons", "Magical" ) ) return false; @@ -353,9 +345,9 @@ namespace Server.Engines.ConPVP title = "Items"; option = "Bandages"; } - else if ( item is TrappableContainer ) + else if ( item is TrappableContainer container ) { - if ( ((TrappableContainer)item).TrapType != TrapType.None ) + if ( container.TrapType != TrapType.None ) { title = "Items"; option = "Trapped Containers"; @@ -402,12 +394,12 @@ namespace Server.Engines.ConPVP from.SendMessage( "You may not use this item before the duel begins." ); return false; } - else if ( item is BasePotion && !(item is BaseExplosionPotion) && !(item is BaseRefreshPotion) && IsSuddenDeath ) + if ( item is BasePotion && !(item is BaseExplosionPotion) && !(item is BaseRefreshPotion) && IsSuddenDeath ) { from.SendMessage( 0x22, "You may not drink potions in sudden death." ); return false; } - else if ( item is Bandage && IsSuddenDeath ) + if ( item is Bandage && IsSuddenDeath ) { from.SendMessage( 0x22, "You may not use bandages in sudden death." ); return false; @@ -529,14 +521,11 @@ namespace Server.Engines.ConPVP public void Requip( Mobile from, Container cont ) { - Corpse corpse = cont as Corpse; - - if ( corpse == null ) + if ( !(cont is Corpse corpse) ) return; List items = new List( corpse.Items ); - bool gathered = false; bool didntFit = false; Container pack = from.Backpack; @@ -544,20 +533,14 @@ namespace Server.Engines.ConPVP for ( int i = 0; !didntFit && i < items.Count; ++i ) { Item item = items[i]; - Point3D loc = item.Location; if ( (item.Layer == Layer.Hair || item.Layer == Layer.FacialHair) || !item.Movable ) continue; if ( pack != null ) - { pack.DropItem( item ); - gathered = true; - } else - { didntFit = true; - } } corpse.Carved = true; @@ -578,10 +561,11 @@ namespace Server.Engines.ConPVP from.PlaySound( 0x3E3 ); - if ( gathered && !didntFit ) - from.SendLocalizedMessage( 1062471 ); // You quickly gather all of your belongings. - else if ( gathered && didntFit ) - from.SendLocalizedMessage( 1062472 ); // You gather some of your belongings. The rest remain on the corpse. + if (didntFit) + from.SendLocalizedMessage(1062472); // You gather some of your belongings. The rest remain on the corpse. + else + from.SendLocalizedMessage(1062471); // You quickly gather all of your belongings. + } public void Refresh( Mobile mob, Container cont ) @@ -590,15 +574,11 @@ namespace Server.Engines.ConPVP { mob.Resurrect(); - DeathRobe robe = mob.FindItemOnLayer( Layer.OuterTorso ) as DeathRobe; - - if ( robe != null ) + if ( mob.FindItemOnLayer( Layer.OuterTorso ) is DeathRobe robe ) robe.Delete(); - if ( cont is Corpse ) + if ( cont is Corpse corpse ) { - Corpse corpse = (Corpse) cont; - for ( int i = 0; i < corpse.EquipItems.Count; ++i ) { Item item = corpse.EquipItems[i]; @@ -774,13 +754,13 @@ namespace Server.Engines.ConPVP for ( int j = 0; j < p.Players.Length; ++j ) { - DuelPlayer pl = (DuelPlayer)p.Players[j]; + DuelPlayer pl = p.Players[j]; if ( pl == null ) continue; - if ( pl.Mobile is PlayerMobile ) - ((PlayerMobile)pl.Mobile).DuelPlayer = null; + if ( pl.Mobile is PlayerMobile mobile ) + mobile.DuelPlayer = null; for ( int k = 0; k < types.Length; ++k ) pl.Mobile.CloseGump( types[k] ); @@ -822,10 +802,8 @@ namespace Server.Engines.ConPVP public DuelPlayer Find( Mobile mob ) { - if ( mob is PlayerMobile ) + if ( mob is PlayerMobile pm ) { - PlayerMobile pm = (PlayerMobile)mob; - if ( pm.DuelContext == this ) return pm.DuelPlayer; @@ -985,15 +963,7 @@ namespace Server.Engines.ConPVP public static bool CheckSuddenDeath( Mobile mob ) { - if ( mob is PlayerMobile ) - { - PlayerMobile pm = (PlayerMobile)mob; - - if ( pm.DuelPlayer != null && !pm.DuelPlayer.Eliminated && pm.DuelContext != null && pm.DuelContext.IsSuddenDeath ) - return true; - } - - return false; + return mob is PlayerMobile pm && pm.DuelPlayer?.Eliminated == false && pm.DuelContext?.IsSuddenDeath == true; } public void ActivateSuddenDeath() @@ -1134,10 +1104,8 @@ namespace Server.Engines.ConPVP private static void vli_ot( Mobile from, object obj ) { - if ( obj is PlayerMobile ) + if ( obj is PlayerMobile pm ) { - PlayerMobile pm = (PlayerMobile)obj; - Ladder ladder = Ladder.Instance; if ( ladder == null ) @@ -1176,9 +1144,7 @@ namespace Server.Engines.ConPVP private static void EventSink_Login( LoginEventArgs e ) { - PlayerMobile pm = e.Mobile as PlayerMobile; - - if ( pm == null ) + if ( !(e.Mobile is PlayerMobile pm) ) return; DuelContext dc = pm.DuelContext; @@ -1202,9 +1168,8 @@ namespace Server.Engines.ConPVP private static void ViewLadder_OnTarget( Mobile from, object obj, object state ) { - if ( obj is PlayerMobile ) + if ( obj is PlayerMobile pm ) { - PlayerMobile pm = (PlayerMobile)obj; Ladder ladder = (Ladder)state; LadderEntry entry = ladder.Find( pm ); @@ -1216,10 +1181,8 @@ namespace Server.Engines.ConPVP pm.PrivateOverheadMessage( MessageType.Regular, pm.SpeechHue, true, String.Format( text, from==pm?"You":"They" ), from.NetState ); } - else if ( obj is Mobile ) + else if ( obj is Mobile mob ) { - Mobile mob = (Mobile)obj; - if ( mob.Body.IsHuman ) mob.PrivateOverheadMessage( MessageType.Regular, mob.SpeechHue, false, "I'm not a duelist, and quite frankly, I resent the implication.", from.NetState ); else @@ -1236,9 +1199,7 @@ namespace Server.Engines.ConPVP if ( e.Handled ) return; - PlayerMobile pm = e.Mobile as PlayerMobile; - - if ( pm == null ) + if ( !(e.Mobile is PlayerMobile pm) ) return; if ( Insensitive.Contains( e.Speech, "i wish to duel" ) ) @@ -1388,25 +1349,15 @@ namespace Server.Engines.ConPVP { foreach ( Gump g in ns.Gumps ) { - if ( g is ParticipantGump ) + if (g is ParticipantGump pg && pg.Participant == p) { - ParticipantGump pg = (ParticipantGump)g; - - if ( pg.Participant == p ) - { - init.SendGump( new ParticipantGump( init, dc, p ) ); - break; - } + init.SendGump( new ParticipantGump( init, dc, p ) ); + break; } - else if ( g is DuelContextGump ) + if ( g is DuelContextGump dcg && dcg.Context == dc ) { - DuelContextGump dcg = (DuelContextGump)g; - - if ( dcg.Context == dc ) - { - init.SendGump( new DuelContextGump( init, dc ) ); - break; - } + init.SendGump( new DuelContextGump( init, dc ) ); + break; } } } @@ -1433,31 +1384,22 @@ namespace Server.Engines.ConPVP if ( ns != null ) { - bool send=true; + bool send = true; foreach ( Gump g in ns.Gumps ) { - if ( g is ParticipantGump ) + if ( g is ParticipantGump pg && pg.Participant == p ) { - ParticipantGump pg = (ParticipantGump)g; - - if ( pg.Participant == p ) - { - init.SendGump( new ParticipantGump( init, dc, p ) ); - send=false; - break; - } + init.SendGump( new ParticipantGump( init, dc, p ) ); + send=false; + break; } - else if ( g is DuelContextGump ) - { - DuelContextGump dcg = (DuelContextGump)g; - if ( dcg.Context == dc ) - { - init.SendGump( new DuelContextGump( init, dc ) ); - send=false; - break; - } + if ( g is DuelContextGump dcg && dcg.Context == dc ) + { + init.SendGump( new DuelContextGump( init, dc ) ); + send=false; + break; } } @@ -1468,9 +1410,8 @@ namespace Server.Engines.ConPVP } else { - if ( pm.DuelContext.m_Countdown != null ) - pm.DuelContext.m_Countdown.Stop(); - pm.DuelContext.m_Countdown= null; + pm.DuelContext.m_Countdown?.Stop(); + pm.DuelContext.m_Countdown = null; pm.DuelContext.m_StartedReadyCountdown=false; p.Broadcast( 0x22, null, "{0} has yielded.", "You have yielded." ); @@ -1492,31 +1433,21 @@ namespace Server.Engines.ConPVP if ( ns != null ) { - bool send=true; + bool send = true; foreach ( Gump g in ns.Gumps ) { - if ( g is ParticipantGump ) + if ( g is ParticipantGump pg && pg.Participant == p ) { - ParticipantGump pg = (ParticipantGump)g; - - if ( pg.Participant == p ) - { - init.SendGump( new ParticipantGump( init, dc, p ) ); - send=false; - break; - } + init.SendGump( new ParticipantGump( init, dc, p ) ); + send=false; + break; } - else if ( g is DuelContextGump ) + if ( g is DuelContextGump dcg && dcg.Context == dc ) { - DuelContextGump dcg = (DuelContextGump)g; - - if ( dcg.Context == dc ) - { - init.SendGump( new DuelContextGump( init, dc ) ); - send=false; - break; - } + init.SendGump( new DuelContextGump( init, dc ) ); + send=false; + break; } } @@ -1705,10 +1636,10 @@ namespace Server.Engines.ConPVP TransformationSpellHelper.RemoveContext( mob, true ); AnimalForm.RemoveContext( mob, true ); - if( DisguiseTimers.IsDisguised( mob ) ) + if ( DisguiseTimers.IsDisguised( mob ) ) DisguiseTimers.StopTimer( mob ); - if( !mob.CanBeginAction( typeof( PolymorphSpell ) ) ) + if ( !mob.CanBeginAction( typeof( PolymorphSpell ) ) ) { mob.BodyMod = 0; mob.HueMod = -1; @@ -1727,8 +1658,8 @@ namespace Server.Engines.ConPVP public static void CancelSpell( Mobile mob ) { - if ( mob.Spell is Spells.Spell ) - ((Spells.Spell)mob.Spell).Disturb( Spells.DisturbType.Kill ); + if ( mob.Spell is Spell spell ) + spell.Disturb( DisturbType.Kill ); Targeting.Target.Cancel( mob ); } @@ -2529,9 +2460,7 @@ namespace Server.Engines.ConPVP m_GateFacet = m_Initiator.Map; } - ExitTeleporter tp = arena.Teleporter as ExitTeleporter; - - if ( tp == null ) + if ( !(arena.Teleporter is ExitTeleporter tp) ) { arena.Teleporter = tp = new ExitTeleporter(); tp.MoveToWorld( arena.GateOut == Point3D.Zero ? arena.Outside : arena.GateOut, arena.Facet ); diff --git a/Scripts/Engines/ConPVP/Games/BombingRun.cs b/Scripts/Engines/ConPVP/Games/BombingRun.cs index 8b8fe7635..a1e44ef0a 100644 --- a/Scripts/Engines/ConPVP/Games/BombingRun.cs +++ b/Scripts/Engines/ConPVP/Games/BombingRun.cs @@ -24,11 +24,11 @@ namespace Server.Engines.ConPVP private Mobile FindOwner( object parent ) { - if ( parent is Item ) - return ( (Item) parent ).RootParent as Mobile; + if ( parent is Item item ) + return item.RootParent as Mobile; - if ( parent is Mobile ) - return (Mobile) parent; + if ( parent is Mobile mobile ) + return mobile; return null; } @@ -282,8 +282,8 @@ namespace Server.Engines.ConPVP if ( obj is Mobile ) pt.Z += 10; - else if ( obj is Item ) - pt.Z += ((Item)obj).ItemData.CalcHeight + 1; + else if ( obj is Item item ) + pt.Z += item.ItemData.CalcHeight + 1; m_Flying = true; this.Visible = false; @@ -317,12 +317,12 @@ namespace Server.Engines.ConPVP if ( zdiff < 0 ) return false; - else if ( zdiff < 12 ) + if ( zdiff < 12 ) return true; - else if ( zdiff < 16 ) + if ( zdiff < 16 ) return Utility.RandomBool(); // 50% chance - else - return false; + + return false; } private void DoAnim( Point3D start, Point3D end, Map map ) @@ -604,10 +604,10 @@ namespace Server.Engines.ConPVP continue; area.Free(); - if ( i is BRGoal ) + if ( i is BRGoal goal ) { Point3D oldLoc = new Point3D( this.GetWorldLocation() ); - if ( CheckScore( (BRGoal)i, m_Thrower, 3 ) ) + if ( CheckScore( goal, m_Thrower, 3 ) ) DoAnim( oldLoc, point, this.Map ); else HitObject( point, loc.Z, height ); @@ -939,9 +939,7 @@ namespace Server.Engines.ConPVP else this.Hue = 0x84C; - BRBomb b = m.Backpack.FindItemByType( typeof( BRBomb ), true ) as BRBomb; - - if ( b != null ) + if ( m.Backpack.FindItemByType( typeof( BRBomb ), true ) is BRBomb b ) b.CheckScore( this, m, 7 ); return true; @@ -1321,9 +1319,7 @@ namespace Server.Engines.ConPVP if ( mob == null ) return null; - BRPlayerInfo val = m_Players[mob] as BRPlayerInfo; - - if ( val == null ) + if ( !(m_Players[mob] is BRPlayerInfo val) ) m_Players[mob] = val = new BRPlayerInfo( this, mob ); return val; @@ -1623,15 +1619,8 @@ namespace Server.Engines.ConPVP public int GetTeamID( Mobile mob ) { - PlayerMobile pm = mob as PlayerMobile; - - if ( pm == null ) - { - if ( mob is BaseCreature ) - return ((BaseCreature)mob).Team - 1; - else - return -1; - } + if ( !(mob is PlayerMobile pm) ) + return mob is BaseCreature creature ? creature.Team - 1 : -1; if ( pm.DuelContext == null || pm.DuelContext != m_Context ) return -1; @@ -1644,12 +1633,7 @@ namespace Server.Engines.ConPVP public int GetColor( Mobile mob ) { - BRTeamInfo teamInfo = GetTeamInfo( mob ); - - if ( teamInfo != null ) - return teamInfo.Color; - - return -1; + return GetTeamInfo( mob )?.Color ?? -1; } private void ApplyHues( Participant p, int hueOverride ) @@ -1674,8 +1658,8 @@ namespace Server.Engines.ConPVP DuelPlayer dp = null; - if ( mob is PlayerMobile ) - dp = ( mob as PlayerMobile ).DuelPlayer; + if ( mob is PlayerMobile mobile ) + dp = mobile.DuelPlayer; m_Context.RemoveAggressions( mob ); @@ -1896,9 +1880,7 @@ namespace Server.Engines.ConPVP for ( int i = 0; i < m_Context.Participants.Count; ++i ) { - Participant p = m_Context.Participants[i] as Participant; - - if ( p == null || p.Players == null ) + if ( !(m_Context.Participants[i] is Participant p) || p.Players == null ) continue; for ( int j = 0; j < p.Players.Length; ++j ) @@ -1915,7 +1897,7 @@ namespace Server.Engines.ConPVP if ( i == winner.TeamID ) continue; - if ( p != null && p.Players != null ) + if ( p.Players != null ) { for ( int j = 0; j < p.Players.Length; ++j ) { @@ -1942,15 +1924,12 @@ namespace Server.Engines.ConPVP ReturnBomb(); - if( m_Bomb != null ) - m_Bomb.Delete(); + m_Bomb?.Delete(); for ( int i = 0; i < m_Context.Participants.Count; ++i ) ApplyHues( m_Context.Participants[i] as Participant, -1 ); - if ( m_FinishTimer != null ) - m_FinishTimer.Stop(); - + m_FinishTimer?.Stop(); m_FinishTimer = null; } } diff --git a/Scripts/Engines/ConPVP/Games/CTF.cs b/Scripts/Engines/ConPVP/Games/CTF.cs index df83f8710..d61a768bf 100644 --- a/Scripts/Engines/ConPVP/Games/CTF.cs +++ b/Scripts/Engines/ConPVP/Games/CTF.cs @@ -448,10 +448,8 @@ namespace Server.Engines.ConPVP from.LocalOverheadMessage( MessageType.Regular, 0x26, false, "Those are not my cookies." ); } } - else if ( obj is Mobile ) + else if ( obj is Mobile passTo ) { - Mobile passTo = obj as Mobile; - CTFTeamInfo passTeam = m_TeamInfo.Game.GetTeamInfo( passTo ); if ( passTo == from ) @@ -481,11 +479,11 @@ namespace Server.Engines.ConPVP private Mobile FindOwner( object parent ) { - if ( parent is Item ) - return ( (Item) parent ).RootParent as Mobile; + if ( parent is Item item ) + return item.RootParent as Mobile; - if ( parent is Mobile ) - return (Mobile) parent; + if ( parent is Mobile mobile ) + return mobile; return null; } @@ -969,9 +967,7 @@ namespace Server.Engines.ConPVP public int GetTeamID( Mobile mob ) { - PlayerMobile pm = mob as PlayerMobile; - - if ( pm == null ) + if ( !(mob is PlayerMobile pm) ) return -1; if ( pm.DuelContext == null || pm.DuelContext != m_Context ) @@ -1015,8 +1011,8 @@ namespace Server.Engines.ConPVP DuelPlayer dp = null; - if ( mob is PlayerMobile ) - dp = ( mob as PlayerMobile ).DuelPlayer; + if ( mob is PlayerMobile mobile ) + dp = mobile.DuelPlayer; m_Context.RemoveAggressions( mob ); @@ -1088,9 +1084,7 @@ namespace Server.Engines.ConPVP { for ( int j = 0; j < ourFlagCarrier.Aggressors.Count; ++j ) { - AggressorInfo aggr = ourFlagCarrier.Aggressors[j] as AggressorInfo; - - if ( aggr == null || aggr.Defender != ourFlagCarrier || aggr.Attacker != mob ) + if ( !(ourFlagCarrier.Aggressors[j] is AggressorInfo aggr) || aggr.Defender != ourFlagCarrier || aggr.Attacker != mob ) continue; playerInfo.Score += 2; // helped defend guy capturing enemy flag diff --git a/Scripts/Engines/ConPVP/Games/DoubleDom.cs b/Scripts/Engines/ConPVP/Games/DoubleDom.cs index 20e80e8ec..1cafaa16e 100644 --- a/Scripts/Engines/ConPVP/Games/DoubleDom.cs +++ b/Scripts/Engines/ConPVP/Games/DoubleDom.cs @@ -604,9 +604,7 @@ namespace Server.Engines.ConPVP public int GetTeamID( Mobile mob ) { - PlayerMobile pm = mob as PlayerMobile; - - if ( pm == null ) + if ( !(mob is PlayerMobile pm) ) return -1; if ( pm.DuelContext == null || pm.DuelContext != m_Context ) @@ -620,12 +618,7 @@ namespace Server.Engines.ConPVP public int GetColor( Mobile mob ) { - DDTeamInfo teamInfo = GetTeamInfo( mob ); - - if ( teamInfo != null ) - return teamInfo.Color; - - return -1; + return GetTeamInfo( mob )?.Color ?? -1; } private void ApplyHues( Participant p, int hueOverride ) @@ -650,8 +643,8 @@ namespace Server.Engines.ConPVP DuelPlayer dp = null; - if ( mob is PlayerMobile ) - dp = ( mob as PlayerMobile ).DuelPlayer; + if ( mob is PlayerMobile mobile ) + dp = mobile.DuelPlayer; m_Context.RemoveAggressions( mob ); @@ -748,9 +741,7 @@ namespace Server.Engines.ConPVP for ( int i = 0; i < m_Context.Participants.Count; ++i ) ApplyHues( m_Context.Participants[i] as Participant, m_Controller.TeamInfo[i % m_Controller.TeamInfo.Length].Color ); - if ( m_FinishTimer != null ) - m_FinishTimer.Stop(); - + m_FinishTimer?.Stop(); m_FinishTimer = Timer.DelayCall( m_Controller.Duration, new TimerCallback( Finish_Callback ) ); } @@ -766,10 +757,7 @@ namespace Server.Engines.ConPVP teams.Add( teamInfo ); } - teams.Sort( delegate( DDTeamInfo a, DDTeamInfo b ) - { - return b.Score - a.Score; - } ); + teams.Sort((a, b) => b.Score - a.Score); Tournament tourny = m_Context.m_Tournament; @@ -897,7 +885,7 @@ namespace Server.Engines.ConPVP { DuelPlayer dp = p.Players[j]; - if ( dp != null && dp.Mobile != null ) + if ( dp?.Mobile != null ) { dp.Mobile.CloseGump( typeof( DDBoardGump ) ); dp.Mobile.SendGump( new DDBoardGump( dp.Mobile, this ) ); @@ -952,9 +940,7 @@ namespace Server.Engines.ConPVP for ( int i = 0; i < m_Context.Participants.Count; ++i ) ApplyHues( m_Context.Participants[i] as Participant, -1 ); - if ( m_FinishTimer != null ) - m_FinishTimer.Stop(); - + m_FinishTimer?.Stop(); m_FinishTimer = null; } @@ -981,14 +967,9 @@ namespace Server.Engines.ConPVP { Alert( "Domination averted!" ); - if ( m_Controller.PointA != null ) - m_Controller.PointA.SetNonCaptureHue(); - - if ( m_Controller.PointB != null ) - m_Controller.PointB.SetNonCaptureHue(); - - if ( m_CaptureTimer != null ) - m_CaptureTimer.Stop(); + m_Controller.PointA?.SetNonCaptureHue(); + m_Controller.PointB?.SetNonCaptureHue(); + m_CaptureTimer?.Stop(); m_CaptureTimer = null; } @@ -1012,8 +993,7 @@ namespace Server.Engines.ConPVP if ( team == null ) { m_Capturable = true; - if ( m_CaptureTimer != null ) - m_CaptureTimer.Stop(); + m_CaptureTimer?.Stop(); m_CaptureTimer = null; return; } @@ -1022,11 +1002,8 @@ namespace Server.Engines.ConPVP { Alert( "{0} is dominating... {1}", team.Name, 10 - m_CapStage ); - if ( m_Controller.PointA != null ) - m_Controller.PointA.SetCaptureHue( m_CapStage ); - - if ( m_Controller.PointB != null ) - m_Controller.PointB.SetCaptureHue( m_CapStage ); + m_Controller.PointA?.SetCaptureHue( m_CapStage ); + m_Controller.PointB?.SetCaptureHue( m_CapStage ); } else { diff --git a/Scripts/Engines/ConPVP/Games/KingOfTheHill.cs b/Scripts/Engines/ConPVP/Games/KingOfTheHill.cs index 2ba60e8dd..9ff286ea1 100644 --- a/Scripts/Engines/ConPVP/Games/KingOfTheHill.cs +++ b/Scripts/Engines/ConPVP/Games/KingOfTheHill.cs @@ -673,9 +673,7 @@ namespace Server.Engines.ConPVP if (mob == null) return null; - KHPlayerInfo val = m_Players[mob] as KHPlayerInfo; - - if (val == null) + if (!(m_Players[mob] is KHPlayerInfo val)) m_Players[mob] = val = new KHPlayerInfo(this, mob); return val; @@ -978,15 +976,8 @@ namespace Server.Engines.ConPVP public int GetTeamID(Mobile mob) { - PlayerMobile pm = mob as PlayerMobile; - - if (pm == null) - { - if (mob is BaseCreature) - return ((BaseCreature)mob).Team - 1; - else - return -1; - } + if (!(mob is PlayerMobile pm)) + return mob is BaseCreature creature ? creature.Team - 1 : -1; if (pm.DuelContext == null || pm.DuelContext != m_Context) return -1; @@ -999,12 +990,7 @@ namespace Server.Engines.ConPVP public int GetColor(Mobile mob) { - KHTeamInfo teamInfo = GetTeamInfo(mob); - - if (teamInfo != null) - return teamInfo.Color; - - return -1; + return GetTeamInfo(mob)?.Color ?? -1; } private void ApplyHues(Participant p, int hueOverride) @@ -1029,8 +1015,8 @@ namespace Server.Engines.ConPVP DuelPlayer dp = null; - if (mob is PlayerMobile) - dp = (mob as PlayerMobile).DuelPlayer; + if (mob is PlayerMobile mobile) + dp = mobile.DuelPlayer; m_Context.RemoveAggressions(mob); @@ -1252,16 +1238,14 @@ namespace Server.Engines.ConPVP for (int i = 0; i < m_Context.Participants.Count; ++i) { - Participant p = m_Context.Participants[i] as Participant; - - if (p == null || p.Players == null) + if (!(m_Context.Participants[i] is Participant p) || p.Players == null) continue; for (int j = 0; j < p.Players.Length; ++j) { DuelPlayer dp = p.Players[j]; - if (dp != null && dp.Mobile != null) + if (dp?.Mobile != null) { dp.Mobile.CloseGump(typeof(KHBoardGump)); dp.Mobile.SendGump(new KHBoardGump(dp.Mobile, this)); @@ -1271,7 +1255,7 @@ namespace Server.Engines.ConPVP if (i == winner.TeamID) continue; - if (p != null && p.Players != null) + if (p?.Players != null) { for (int j = 0; j < p.Players.Length; ++j) { @@ -1304,9 +1288,8 @@ namespace Server.Engines.ConPVP for (int i = 0; i < m_Context.Participants.Count; ++i) ApplyHues(m_Context.Participants[i] as Participant, -1); - if (m_FinishTimer != null) - m_FinishTimer.Stop(); - m_FinishTimer = null; + m_FinishTimer?.Stop(); + m_FinishTimer = null; } } } diff --git a/Scripts/Engines/ConPVP/Participant.cs b/Scripts/Engines/ConPVP/Participant.cs index f4c6a5a6d..43f2a626e 100644 --- a/Scripts/Engines/ConPVP/Participant.cs +++ b/Scripts/Engines/ConPVP/Participant.cs @@ -19,10 +19,8 @@ namespace Server.Engines.ConPVP public DuelPlayer Find( Mobile mob ) { - if ( mob is PlayerMobile ) + if ( mob is PlayerMobile pm ) { - PlayerMobile pm = (PlayerMobile)mob; - if ( pm.DuelContext == m_Context && pm.DuelPlayer.Participant == this ) return pm.DuelPlayer; @@ -229,8 +227,8 @@ namespace Server.Engines.ConPVP m_Mobile = mob; m_Participant = p; - if ( mob is PlayerMobile ) - ((PlayerMobile)mob).DuelPlayer = this; + if ( mob is PlayerMobile mobile ) + mobile.DuelPlayer = this; } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/ConPVP/ParticipantGump.cs b/Scripts/Engines/ConPVP/ParticipantGump.cs index e4c24feaf..009f15d6c 100644 --- a/Scripts/Engines/ConPVP/ParticipantGump.cs +++ b/Scripts/Engines/ConPVP/ParticipantGump.cs @@ -15,7 +15,7 @@ namespace Server.Engines.ConPVP private DuelContext m_Context; private Participant m_Participant; - public Mobile From{ get{ return m_From; } } + public Mobile From{ get{ return m_From; } } public DuelContext Context{ get{ return m_Context; } } public Participant Participant{ get{ return m_Participant; } } @@ -52,7 +52,7 @@ namespace Server.Engines.ConPVP count = 4; AddPage( 0 ); - + int height = 35 + 10 + 22 + 22 + 30 + 22 + 2 + (count * 22) + 2 + 30; AddBackground( 0, 0, 300, height, 9250 ); @@ -203,9 +203,7 @@ namespace Server.Engines.ConPVP if ( index < 0 || index >= m_Participant.Players.Length ) return; - Mobile mob = targeted as Mobile; - - if ( mob == null ) + if ( !(targeted is Mobile mob) ) { from.SendMessage( "That is not a player." ); } @@ -222,9 +220,7 @@ namespace Server.Engines.ConPVP } else { - PlayerMobile pm = mob as PlayerMobile; - - if ( pm == null ) + if ( !(mob is PlayerMobile pm) ) return; if ( pm.DuelContext != null ) @@ -247,4 +243,4 @@ namespace Server.Engines.ConPVP } } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/ConPVP/ReadyUpGump.cs b/Scripts/Engines/ConPVP/ReadyUpGump.cs index c981429bd..908758f82 100644 --- a/Scripts/Engines/ConPVP/ReadyUpGump.cs +++ b/Scripts/Engines/ConPVP/ReadyUpGump.cs @@ -209,9 +209,7 @@ namespace Server.Engines.ConPVP { case 1: // okay { - PlayerMobile pm = m_From as PlayerMobile; - - if ( pm == null ) + if ( !(m_From is PlayerMobile pm) ) break; pm.DuelPlayer.Ready = true; @@ -232,4 +230,4 @@ namespace Server.Engines.ConPVP } } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/ConPVP/RulesetLayout.cs b/Scripts/Engines/ConPVP/RulesetLayout.cs index e4c13f12c..ef49773ce 100644 --- a/Scripts/Engines/ConPVP/RulesetLayout.cs +++ b/Scripts/Engines/ConPVP/RulesetLayout.cs @@ -136,7 +136,7 @@ namespace Server.Engines.ConPVP "Suprise Attack" } ) ); - if( Core.ML ) + if ( Core.ML ) { entries.Add( new RulesetLayout( "Spellweaving", new string[] { @@ -280,7 +280,7 @@ namespace Server.Engines.ConPVP } ) ); } - if( Core.SE ) + if ( Core.SE ) { entries.Add( new RulesetLayout( "Items", new RulesetLayout[] { @@ -342,7 +342,7 @@ namespace Server.Engines.ConPVP // Set up default rulesets - if( !Core.AOS ) + if ( !Core.AOS ) { #region Mage 5x Ruleset m5x = new Ruleset( m_Root ); @@ -785,4 +785,4 @@ namespace Server.Engines.ConPVP children[i].m_Parent = this; } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/ConPVP/SafeZone.cs b/Scripts/Engines/ConPVP/SafeZone.cs index 359337262..ce2963f14 100644 --- a/Scripts/Engines/ConPVP/SafeZone.cs +++ b/Scripts/Engines/ConPVP/SafeZone.cs @@ -39,15 +39,10 @@ namespace Server.Engines.ConPVP PlayerMobile pm = m as PlayerMobile; - if ( pm == null && m is BaseCreature ) - { - BaseCreature bc = (BaseCreature)m; + if ( pm == null && m is BaseCreature bc && bc.Summoned ) + pm = bc.SummonMaster as PlayerMobile; - if ( bc.Summoned ) - pm = bc.SummonMaster as PlayerMobile; - } - - if ( pm != null && pm.DuelContext != null && pm.DuelContext.StartedBeginCountdown ) + if ( pm?.DuelContext != null && pm.DuelContext.StartedBeginCountdown ) return true; if ( DuelContext.CheckCombat( m ) ) diff --git a/Scripts/Engines/ConPVP/Tournament.cs b/Scripts/Engines/ConPVP/Tournament.cs index 02d769fa1..cca128063 100644 --- a/Scripts/Engines/ConPVP/Tournament.cs +++ b/Scripts/Engines/ConPVP/Tournament.cs @@ -163,9 +163,9 @@ namespace Server.Engines.ConPVP { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that } - else if ( m_Tournament != null ) + else { - Tournament tourny = m_Tournament.Tournament; + Tournament tourny = m_Tournament?.Tournament; if ( tourny != null ) { @@ -194,60 +194,46 @@ namespace Server.Engines.ConPVP } case TournamentStage.Inactive: { - if ( m_Registrar != null ) - m_Registrar.PrivateOverheadMessage( MessageType.Regular, - 0x35, false, "The tournament is closed.", from.NetState ); + m_Registrar?.PrivateOverheadMessage( MessageType.Regular, + 0x35, false, "The tournament is closed.", from.NetState ); break; } case TournamentStage.Signup: { Ladder ladder = Ladder.Instance; + LadderEntry entry = ladder?.Find( from ); - if ( ladder != null ) + if ( entry != null && Ladder.GetLevel( entry.Experience ) < tourny.LevelRequirement ) { - LadderEntry entry = ladder.Find( from ); + m_Registrar?.PrivateOverheadMessage( MessageType.Regular, + 0x35, false, "You have not yet proven yourself a worthy dueler.", from.NetState ); - if ( entry != null && Ladder.GetLevel( entry.Experience ) < tourny.LevelRequirement ) - { - if ( m_Registrar != null ) - { - m_Registrar.PrivateOverheadMessage( MessageType.Regular, - 0x35, false, "You have not yet proven yourself a worthy dueler.", from.NetState ); - } - - break; - } + break; } if ( tourny.IsFactionRestricted && Faction.Find( from ) == null ) { - if ( m_Registrar != null ) - { - m_Registrar.PrivateOverheadMessage( MessageType.Regular, - 0x35, false, "Only those who have declared their faction allegiance may participate.", from.NetState ); - } + m_Registrar?.PrivateOverheadMessage( MessageType.Regular, + 0x35, false, "Only those who have declared their faction allegiance may participate.", from.NetState ); break; } if ( from.HasGump( typeof( AcceptTeamGump ) ) ) { - if ( m_Registrar != null ) - m_Registrar.PrivateOverheadMessage( MessageType.Regular, - 0x22, false, "You must first respond to the offer I've given you.", from.NetState ); + m_Registrar?.PrivateOverheadMessage( MessageType.Regular, + 0x22, false, "You must first respond to the offer I've given you.", from.NetState ); } else if ( from.HasGump( typeof( AcceptDuelGump ) ) ) { - if ( m_Registrar != null ) - m_Registrar.PrivateOverheadMessage( MessageType.Regular, - 0x22, false, "You must first cancel your duel offer.", from.NetState ); + m_Registrar?.PrivateOverheadMessage( MessageType.Regular, + 0x22, false, "You must first cancel your duel offer.", from.NetState ); } - else if ( from is PlayerMobile && ((PlayerMobile)from).DuelContext != null ) + else if ( from is PlayerMobile mobile && mobile.DuelContext != null ) { - if ( m_Registrar != null ) - m_Registrar.PrivateOverheadMessage( MessageType.Regular, - 0x22, false, "You are already participating in a duel.", from.NetState ); + m_Registrar?.PrivateOverheadMessage( MessageType.Regular, + 0x22, false, "You are already participating in a duel.", mobile.NetState ); } else if ( !tourny.HasParticipant( from ) ) { @@ -256,9 +242,9 @@ namespace Server.Engines.ConPVP from.CloseGump( typeof( ConfirmSignupGump ) ); from.SendGump( new ConfirmSignupGump( from, m_Registrar, tourny, players ) ); } - else if ( m_Registrar != null ) + else { - m_Registrar.PrivateOverheadMessage( MessageType.Regular, + m_Registrar?.PrivateOverheadMessage( MessageType.Regular, 0x35, false, "You have already entered this tournament.", from.NetState ); } @@ -642,7 +628,7 @@ namespace Server.Engines.ConPVP { Mobile mob = (Mobile)m_Players[i]; - LadderEntry entry = ( ladder == null ? null : ladder.Find( mob ) ); + LadderEntry entry = ladder?.Find( mob ); if ( entry != null && Ladder.GetLevel( entry.Experience ) < tourny.LevelRequirement ) { @@ -663,18 +649,15 @@ namespace Server.Engines.ConPVP m_From.SendGump( new ConfirmSignupGump( m_From, m_Registrar, m_Tournament, m_Players ) ); return; } - else if ( tourny.IsFactionRestricted && Faction.Find( mob ) == null ) + if ( tourny.IsFactionRestricted && Faction.Find( mob ) == null ) { - if ( m_Registrar != null ) - { - m_Registrar.PrivateOverheadMessage( MessageType.Regular, - 0x35, false, "Only those who have declared their faction allegiance may participate.", from.NetState ); - } + m_Registrar?.PrivateOverheadMessage( MessageType.Regular, + 0x35, false, "Only those who have declared their faction allegiance may participate.", from.NetState ); m_From.SendGump( new ConfirmSignupGump( m_From, m_Registrar, m_Tournament, m_Players ) ); return; } - else if ( tourny.HasParticipant( mob ) ) + if ( tourny.HasParticipant( mob ) ) { if ( m_Registrar != null ) { @@ -693,20 +676,17 @@ namespace Server.Engines.ConPVP m_From.SendGump( new ConfirmSignupGump( m_From, m_Registrar, m_Tournament, m_Players ) ); return; } - else if ( mob is PlayerMobile && ((PlayerMobile)mob).DuelContext != null ) + if ( mob is PlayerMobile mobile && mobile.DuelContext != null ) { - if ( m_Registrar != null ) + if ( mob == from ) { - if ( mob == from ) - { - m_Registrar.PrivateOverheadMessage( MessageType.Regular, - 0x35, false, "You are already assigned to a duel. You must yield it before joining this tournament.", from.NetState ); - } - else - { - m_Registrar.PrivateOverheadMessage( MessageType.Regular, - 0x35, false, String.Format( "{0} is already assigned to a duel. They must yield it before joining this tournament.", mob.Name ), from.NetState ); - } + m_Registrar?.PrivateOverheadMessage( MessageType.Regular, + 0x35, false, "You are already assigned to a duel. You must yield it before joining this tournament.", from.NetState ); + } + else + { + m_Registrar?.PrivateOverheadMessage( MessageType.Regular, + 0x35, false, String.Format( "{0} is already assigned to a duel. They must yield it before joining this tournament.", mobile.Name ), from.NetState ); } m_From.SendGump( new ConfirmSignupGump( m_From, m_Registrar, m_Tournament, m_Players ) ); @@ -766,15 +746,12 @@ namespace Server.Engines.ConPVP private void AddPlayer_OnTarget( Mobile from, object obj ) { - Mobile mob = obj as Mobile; - - if ( mob == null || mob == from ) + if ( !(obj is Mobile mob) || mob == from ) { m_From.SendGump( new ConfirmSignupGump( m_From, m_Registrar, m_Tournament, m_Players ) ); - if ( m_Registrar != null ) - m_Registrar.PrivateOverheadMessage( MessageType.Regular, - 0x22, false, "Excuse me?", from.NetState ); + m_Registrar?.PrivateOverheadMessage( MessageType.Regular, + 0x22, false, "Excuse me?", from.NetState ); } else if ( !mob.Player ) { @@ -789,73 +766,63 @@ namespace Server.Engines.ConPVP { m_From.SendGump( new ConfirmSignupGump( m_From, m_Registrar, m_Tournament, m_Players ) ); - if ( m_Registrar != null ) - m_Registrar.PrivateOverheadMessage( MessageType.Regular, - 0x22, false, "They ignore your invitation.", from.NetState ); + m_Registrar?.PrivateOverheadMessage( MessageType.Regular, + 0x22, false, "They ignore your invitation.", from.NetState ); } else { - PlayerMobile pm = mob as PlayerMobile; - - if ( pm == null ) + if ( !(mob is PlayerMobile pm) ) return; if ( pm.DuelContext != null ) { m_From.SendGump( new ConfirmSignupGump( m_From, m_Registrar, m_Tournament, m_Players ) ); - if ( m_Registrar != null ) - m_Registrar.PrivateOverheadMessage( MessageType.Regular, - 0x22, false, "They are already assigned to another duel.", from.NetState ); + m_Registrar?.PrivateOverheadMessage( MessageType.Regular, + 0x22, false, "They are already assigned to another duel.", from.NetState ); } else if ( mob.HasGump( typeof( AcceptTeamGump ) ) ) { m_From.SendGump( new ConfirmSignupGump( m_From, m_Registrar, m_Tournament, m_Players ) ); - if ( m_Registrar != null ) - m_Registrar.PrivateOverheadMessage( MessageType.Regular, - 0x22, false, "They have already been offered a partnership.", from.NetState ); + m_Registrar?.PrivateOverheadMessage( MessageType.Regular, + 0x22, false, "They have already been offered a partnership.", from.NetState ); } else if ( mob.HasGump( typeof( ConfirmSignupGump ) ) ) { m_From.SendGump( new ConfirmSignupGump( m_From, m_Registrar, m_Tournament, m_Players ) ); - if ( m_Registrar != null ) - m_Registrar.PrivateOverheadMessage( MessageType.Regular, - 0x22, false, "They are already trying to join this tournament.", from.NetState ); + m_Registrar?.PrivateOverheadMessage( MessageType.Regular, + 0x22, false, "They are already trying to join this tournament.", from.NetState ); } else if ( m_Players.Contains( mob ) ) { m_From.SendGump( new ConfirmSignupGump( m_From, m_Registrar, m_Tournament, m_Players ) ); - if ( m_Registrar != null ) - m_Registrar.PrivateOverheadMessage( MessageType.Regular, - 0x22, false, "You have already named them as a team member.", from.NetState ); + m_Registrar?.PrivateOverheadMessage( MessageType.Regular, + 0x22, false, "You have already named them as a team member.", from.NetState ); } else if ( m_Tournament.HasParticipant( mob ) ) { m_From.SendGump( new ConfirmSignupGump( m_From, m_Registrar, m_Tournament, m_Players ) ); - if ( m_Registrar != null ) - m_Registrar.PrivateOverheadMessage( MessageType.Regular, - 0x22, false, "They have already entered this tournament.", from.NetState ); + m_Registrar?.PrivateOverheadMessage( MessageType.Regular, + 0x22, false, "They have already entered this tournament.", from.NetState ); } else if ( m_Players.Count >= m_Tournament.PlayersPerParticipant ) { m_From.SendGump( new ConfirmSignupGump( m_From, m_Registrar, m_Tournament, m_Players ) ); - if ( m_Registrar != null ) - m_Registrar.PrivateOverheadMessage( MessageType.Regular, - 0x22, false, "Your team is full.", from.NetState ); + m_Registrar?.PrivateOverheadMessage( MessageType.Regular, + 0x22, false, "Your team is full.", from.NetState ); } else { m_From.SendGump( new ConfirmSignupGump( m_From, m_Registrar, m_Tournament, m_Players ) ); mob.SendGump( new AcceptTeamGump( from, mob, m_Tournament, m_Registrar, m_Players ) ); - if ( m_Registrar != null ) - m_Registrar.PrivateOverheadMessage( MessageType.Regular, - 0x59, false, String.Format( "As you command m'{0}. I've given your offer to {1}.", from.Female ? "Lady" : "Lord", mob.Name ), from.NetState ); + m_Registrar?.PrivateOverheadMessage( MessageType.Regular, + 0x59, false, String.Format( "As you command m'{0}. I've given your offer to {1}.", from.Female ? "Lady" : "Lord", mob.Name ), from.NetState ); } } } @@ -1144,50 +1111,43 @@ namespace Server.Engines.ConPVP if ( info.IsSwitched( 1 ) ) { - PlayerMobile pm = mob as PlayerMobile; - - if ( pm == null ) + if ( !(mob is PlayerMobile pm) ) return; if ( AcceptDuelGump.IsIgnored( mob, from ) || mob.Blessed ) { m_From.SendGump( new ConfirmSignupGump( m_From, m_Registrar, m_Tournament, m_Players ) ); - if ( m_Registrar != null ) - m_Registrar.PrivateOverheadMessage( MessageType.Regular, - 0x22, false, "They ignore your invitation.", from.NetState ); + m_Registrar?.PrivateOverheadMessage( MessageType.Regular, + 0x22, false, "They ignore your invitation.", from.NetState ); } else if ( pm.DuelContext != null ) { m_From.SendGump( new ConfirmSignupGump( m_From, m_Registrar, m_Tournament, m_Players ) ); - if ( m_Registrar != null ) - m_Registrar.PrivateOverheadMessage( MessageType.Regular, - 0x22, false, "They are already assigned to another duel.", from.NetState ); + m_Registrar?.PrivateOverheadMessage( MessageType.Regular, + 0x22, false, "They are already assigned to another duel.", from.NetState ); } else if ( m_Players.Contains( mob ) ) { m_From.SendGump( new ConfirmSignupGump( m_From, m_Registrar, m_Tournament, m_Players ) ); - if ( m_Registrar != null ) - m_Registrar.PrivateOverheadMessage( MessageType.Regular, - 0x22, false, "You have already named them as a team member.", from.NetState ); + m_Registrar?.PrivateOverheadMessage( MessageType.Regular, + 0x22, false, "You have already named them as a team member.", from.NetState ); } else if ( m_Tournament.HasParticipant( mob ) ) { m_From.SendGump( new ConfirmSignupGump( m_From, m_Registrar, m_Tournament, m_Players ) ); - if ( m_Registrar != null ) - m_Registrar.PrivateOverheadMessage( MessageType.Regular, - 0x22, false, "They have already entered this tournament.", from.NetState ); + m_Registrar?.PrivateOverheadMessage( MessageType.Regular, + 0x22, false, "They have already entered this tournament.", from.NetState ); } else if ( m_Players.Count >= m_Tournament.PlayersPerParticipant ) { m_From.SendGump( new ConfirmSignupGump( m_From, m_Registrar, m_Tournament, m_Players ) ); - if ( m_Registrar != null ) - m_Registrar.PrivateOverheadMessage( MessageType.Regular, - 0x22, false, "Your team is full.", from.NetState ); + m_Registrar?.PrivateOverheadMessage( MessageType.Regular, + 0x22, false, "Your team is full.", from.NetState ); } else { @@ -3094,9 +3054,7 @@ namespace Server.Engines.ConPVP if ( m_Tournament.TournyType != TournyType.Standard && part.Players.Count == 1 ) { - PlayerMobile pm = part.Players[0] as PlayerMobile; - - if ( pm != null && pm.DuelPlayer != null ) + if ( part.Players[0] is PlayerMobile pm && pm.DuelPlayer != null ) name = Color( name, pm.DuelPlayer.Eliminated ? 0x6633333 : 0x336666 ); } @@ -3107,9 +3065,7 @@ namespace Server.Engines.ConPVP } case TournyBracketGumpType.Participant_Info: { - TournyParticipant part = obj as TournyParticipant; - - if ( part == null ) + if ( !(obj is TournyParticipant part) ) break; AddPage( 0 ); @@ -3130,9 +3086,7 @@ namespace Server.Engines.ConPVP if ( m_Tournament.TournyType != TournyType.Standard ) { - PlayerMobile pm = mob as PlayerMobile; - - if ( pm != null && pm.DuelPlayer != null ) + if ( mob is PlayerMobile pm && pm.DuelPlayer != null ) name = Color( name, pm.DuelPlayer.Eliminated ? 0x6633333 : 0x336666 ); } @@ -3171,13 +3125,11 @@ namespace Server.Engines.ConPVP AddLeftArrow( 25, 11, ToButtonID( 0, 3 ) ); AddHtml( 25, 35, 250, 20, Center( "Participants" ), false, false ); - Mobile mob = obj as Mobile; - - if ( mob == null ) + if ( !(obj is Mobile mob) ) break; Ladder ladder = Ladder.Instance; - LadderEntry entry = ( ladder == null ? null : ladder.Find( mob ) ); + LadderEntry entry = ladder?.Find( mob ); AddHtml( 25, 53, 250, 20, String.Format( "Name: {0}", mob.Name ), false, false ); AddHtml( 25, 73, 250, 20, String.Format( "Guild: {0}", mob.Guild == null ? "None" : mob.Guild.Name + " [" + mob.Guild.Abbreviation + "]" ), false, false ); @@ -3204,7 +3156,7 @@ namespace Server.Engines.ConPVP for ( int i = 0; i < count; ++i, y += 18 ) { - PyramidLevel level = (PyramidLevel)m_List[index + i]; + // PyramidLevel level = (PyramidLevel)m_List[index + i]; AddRightArrow( 25, y, ToButtonID( 3, index + i ), "Round #" + (index + i + 1) ); } @@ -3219,9 +3171,7 @@ namespace Server.Engines.ConPVP AddLeftArrow( 25, 11, ToButtonID( 0, 2 ) ); AddHtml( 25, 35, 250, 20, Center( "Rounds" ), false, false ); - PyramidLevel level = m_Object as PyramidLevel; - - if ( level == null ) + if ( !(m_Object is PyramidLevel level) ) break; if ( m_List == null ) @@ -3343,9 +3293,7 @@ namespace Server.Engines.ConPVP } case TournyBracketGumpType.Match_Info: { - TournyMatch match = obj as TournyMatch; - - if ( match == null ) + if ( !(obj is TournyMatch match) ) break; int ct = ( m_Tournament.TournyType == TournyType.FreeForAll ? 2 : match.Participants.Count ); @@ -3358,7 +3306,7 @@ namespace Server.Engines.ConPVP AddHtml( 25, 53, 250, 20, String.Format( "Winner: {0}", match.Winner == null ? "N/A" : match.Winner.NameList ), false, false ); AddHtml( 25, 73, 250, 20, String.Format( "State: {0}", match.InProgress ? "In progress" : match.Context != null ? "Complete" : "Waiting" ), false, false ); - AddHtml( 25, 93, 250, 20, String.Format( "Participants:" ), false, false ); + AddHtml( 25, 93, 250, 20, "Participants:", false, false ); if ( m_Tournament.TournyType == TournyType.Standard ) { @@ -3465,9 +3413,7 @@ namespace Server.Engines.ConPVP } case 5: { - TournyMatch match = m_Object as TournyMatch; - - if ( match == null ) + if ( !(m_Object is TournyMatch match) ) break; for ( int i = 0; i < m_Tournament.Pyramid.Levels.Count; ++i ) @@ -3531,9 +3477,7 @@ namespace Server.Engines.ConPVP if ( m_Type != TournyBracketGumpType.Participant_Info ) break; - TournyParticipant part = m_Object as TournyParticipant; - - if ( part != null && index >= 0 && index < part.Players.Count ) + if ( m_Object is TournyParticipant part && index >= 0 && index < part.Players.Count ) m_From.SendGump( new TournamentBracketGump( m_From, m_Tournament, TournyBracketGumpType.Player_Info, null, 0, part.Players[index] ) ); break; @@ -3543,9 +3487,7 @@ namespace Server.Engines.ConPVP if ( m_Type != TournyBracketGumpType.Round_Info ) break; - PyramidLevel level = m_Object as PyramidLevel; - - if ( level == null ) + if ( !(m_Object is PyramidLevel level) ) break; if ( index == 0 ) @@ -3567,9 +3509,7 @@ namespace Server.Engines.ConPVP if ( m_Type != TournyBracketGumpType.Match_Info ) break; - TournyMatch match = m_Object as TournyMatch; - - if ( match != null && index >= 0 && index < match.Participants.Count ) + if ( m_Object is TournyMatch match && index >= 0 && index < match.Participants.Count ) m_From.SendGump( new TournamentBracketGump( m_From, m_Tournament, TournyBracketGumpType.Participant_Info, null, 0, match.Participants[index] ) ); break; @@ -3602,9 +3542,9 @@ namespace Server.Engines.ConPVP { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that } - else if ( m_Tournament != null ) + else { - Tournament tourny = m_Tournament.Tournament; + Tournament tourny = m_Tournament?.Tournament; if ( tourny != null ) { @@ -3648,4 +3588,4 @@ namespace Server.Engines.ConPVP } } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Craft/Core/CraftGump.cs b/Scripts/Engines/Craft/Core/CraftGump.cs index 5bb081f34..c8b626061 100644 --- a/Scripts/Engines/Craft/Core/CraftGump.cs +++ b/Scripts/Engines/Craft/Core/CraftGump.cs @@ -104,8 +104,8 @@ namespace Server.Engines.Craft } // **************************************** - if ( notice is int && (int)notice > 0 ) - AddHtmlLocalized( 170, 295, 350, 40, (int)notice, LabelColor, false, false ); + if ( notice is int noticeInt && noticeInt > 0 ) + AddHtmlLocalized( 170, 295, 350, 40, noticeInt, LabelColor, false, false ); else if ( notice is string ) AddHtml( 170, 295, 350, 40, String.Format( "{1}", FontColor, notice ), false, false ); @@ -115,7 +115,7 @@ namespace Server.Engines.Craft string nameString = craftSystem.CraftSubRes.NameString; int nameNumber = craftSystem.CraftSubRes.NameNumber; - int resIndex = ( context == null ? -1 : context.LastResourceIndex ); + int resIndex = context?.LastResourceIndex ?? -1; Type resourceType = craftSystem.CraftSubRes.ResType; @@ -616,4 +616,4 @@ namespace Server.Engines.Craft } } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Craft/Core/CraftGumpItem.cs b/Scripts/Engines/Craft/Core/CraftGumpItem.cs index ecaec7851..806c9512d 100644 --- a/Scripts/Engines/Craft/Core/CraftGumpItem.cs +++ b/Scripts/Engines/Craft/Core/CraftGumpItem.cs @@ -62,9 +62,9 @@ namespace Server.Engines.Craft AddButton( 15, 387, 4014, 4016, 0, GumpButtonType.Reply, 0 ); AddHtmlLocalized( 50, 390, 150, 18, 1044150, LabelColor, false, false ); // BACK - bool needsRecipe = ( craftItem.Recipe != null && from is PlayerMobile && !((PlayerMobile)from).HasRecipe( craftItem.Recipe ) ); + bool needsRecipe = ( craftItem.Recipe != null && from is PlayerMobile mobile && !mobile.HasRecipe( craftItem.Recipe ) ); - if( needsRecipe ) + if ( needsRecipe ) { AddButton( 270, 387, 4005, 4007, 0, GumpButtonType.Page, 0 ); AddHtmlLocalized( 305, 390, 150, 18, 1044151, GreyLabelColor, false, false ); // MAKE NOW @@ -88,17 +88,17 @@ namespace Server.Engines.Craft DrawResource(); /* - if( craftItem.RequiresSE ) + if ( craftItem.RequiresSE ) AddHtmlLocalized( 170, 302 + (m_OtherCount++ * 20), 310, 18, 1063363, LabelColor, false, false ); //* Requires the "Samurai Empire" expansion * */ - if( craftItem.RequiredExpansion != Expansion.None ) + if ( craftItem.RequiredExpansion != Expansion.None ) { bool supportsEx = (from.NetState != null && from.NetState.SupportsExpansion( craftItem.RequiredExpansion )); TextDefinition.AddHtmlText( this, 170, 302 + (m_OtherCount++ * 20), 310, 18, RequiredExpansionMessage( craftItem.RequiredExpansion ), false, false, supportsEx ? LabelColor : RedLabelColor, supportsEx ? LabelHue : RedLabelHue ); } - if( needsRecipe ) + if ( needsRecipe ) AddHtmlLocalized( 170, 302 + (m_OtherCount++ * 20), 310, 18, 1073620, RedLabelColor, false, false ); // You have not learned this recipe. } @@ -167,9 +167,9 @@ namespace Server.Engines.Craft if ( m_ShowExceptionalChance ) { - if( excepChance < 0.0 ) + if ( excepChance < 0.0 ) excepChance = 0.0; - else if( excepChance > 1.0 ) + else if ( excepChance > 1.0 ) excepChance = 1.0; AddHtmlLocalized( 170, 100, 250, 18, 1044058, 32767, false, false ); // Exceptional Chance: @@ -207,7 +207,7 @@ namespace Server.Engines.Craft type = craftResource.ItemType; nameString = craftResource.NameString; nameNumber = craftResource.NameNumber; - + // Resource Mutation if ( type == res.ResType && resIndex > -1 ) { @@ -284,4 +284,4 @@ namespace Server.Engines.Craft } } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Craft/Core/CraftItem.cs b/Scripts/Engines/Craft/Core/CraftItem.cs index 1a7d7ed1e..912babd89 100644 --- a/Scripts/Engines/Craft/Core/CraftItem.cs +++ b/Scripts/Engines/Craft/Core/CraftItem.cs @@ -72,7 +72,7 @@ namespace Server.Engines.Craft public void AddRecipe( int id, CraftSystem system ) { - if( m_Recipe != null ) + if ( m_Recipe != null ) { Console.WriteLine( "Warning: Attempted add of recipe #{0} to the crafting of {1} in CraftSystem {2}.", id, this.m_Type.Name, system ); return; @@ -395,7 +395,7 @@ namespace Server.Engines.Craft public bool IsMarkable( Type type ) { - if( m_ForceNonExceptional ) //Don't even display the stuff for marking if it can't ever be exceptional. + if ( m_ForceNonExceptional ) //Don't even display the stuff for marking if it can't ever be exceptional. return false; for ( int i = 0; i < m_MarkableTable.Length; ++i ) @@ -526,15 +526,13 @@ namespace Server.Engines.Craft for ( int j = 0; j < items[i].Length; ++j ) { - IHasQuantity hq = items[i][j] as IHasQuantity; - - if ( hq == null ) + if ( !(items[i][j] is IHasQuantity hq) ) { totals[i] += items[i][j].Amount; } else { - if ( hq is BaseBeverage && ((BaseBeverage)hq).Content != m_RequiredBeverage ) + if ( hq is BaseBeverage beverage && beverage.Content != m_RequiredBeverage ) continue; totals[i] += hq.Quantity; @@ -552,9 +550,8 @@ namespace Server.Engines.Craft for ( int j = 0; j < items[i].Length; ++j ) { Item item = items[i][j]; - IHasQuantity hq = item as IHasQuantity; - if ( hq == null ) + if ( !(item is IHasQuantity hq) ) { int theirAmount = item.Amount; @@ -571,7 +568,7 @@ namespace Server.Engines.Craft } else { - if ( hq is BaseBeverage && ((BaseBeverage)hq).Content != m_RequiredBeverage ) + if ( hq is BaseBeverage beverage && beverage.Content != m_RequiredBeverage ) continue; int theirAmount = hq.Quantity; @@ -601,15 +598,13 @@ namespace Server.Engines.Craft for ( int i = 0; i < items.Length; ++i ) { - IHasQuantity hq = items[i] as IHasQuantity; - - if ( hq == null ) + if ( !(items[i] is IHasQuantity hq) ) { amount += items[i].Amount; } else { - if ( hq is BaseBeverage && ((BaseBeverage)hq).Content != m_RequiredBeverage ) + if ( hq is BaseBeverage beverage && beverage.Content != m_RequiredBeverage ) continue; amount += hq.Quantity; @@ -862,26 +857,20 @@ namespace Server.Engines.Craft public double GetExceptionalChance( CraftSystem system, double chance, Mobile from ) { - if( m_ForceNonExceptional ) + if ( m_ForceNonExceptional ) return 0.0; double bonus = 0.0; - if ( from.Talisman is BaseTalisman ) + if ( from.Talisman is BaseTalisman talisman && talisman.Skill == system.MainSkill ) { - BaseTalisman talisman = (BaseTalisman) from.Talisman; - - if ( talisman.Skill == system.MainSkill ) - { - chance -= talisman.SuccessBonus / 100.0; - bonus = talisman.ExceptionalBonus / 100.0; - } + chance -= talisman.SuccessBonus / 100.0; + bonus = talisman.ExceptionalBonus / 100.0; } switch ( system.ECA ) { - default: - case CraftECA.ChanceMinusSixty: chance -= 0.6; break; + default: chance -= 0.6; break; case CraftECA.FiftyPercentChanceMinusTenPercent: chance = chance * 0.5 - 0.1; break; case CraftECA.ChanceMinusSixtyToFourtyFive: { @@ -955,13 +944,8 @@ namespace Server.Engines.Craft else chance = 0.0; - if ( allRequiredSkills && from.Talisman is BaseTalisman ) - { - BaseTalisman talisman = (BaseTalisman) from.Talisman; - - if ( talisman.Skill == craftSystem.MainSkill ) - chance += talisman.SuccessBonus / 100.0; - } + if ( allRequiredSkills && from.Talisman is BaseTalisman talisman && talisman.Skill == craftSystem.MainSkill ) + chance += talisman.SuccessBonus / 100.0; if ( allRequiredSkills && valMainSkill == maxMainSkill ) chance = 1.0; @@ -973,32 +957,32 @@ namespace Server.Engines.Craft { if ( from.BeginAction( typeof( CraftSystem ) ) ) { - if( RequiredExpansion == Expansion.None || ( from.NetState != null && from.NetState.SupportsExpansion( RequiredExpansion ) ) ) + if ( RequiredExpansion == Expansion.None || ( from.NetState != null && from.NetState.SupportsExpansion( RequiredExpansion ) ) ) { bool allRequiredSkills = true; double chance = GetSuccessChance( from, typeRes, craftSystem, false, ref allRequiredSkills ); if ( allRequiredSkills && chance >= 0.0 ) { - if( this.Recipe == null || !(from is PlayerMobile) || ((PlayerMobile)from).HasRecipe( this.Recipe ) ) + if ( this.Recipe == null || !(from is PlayerMobile) || ((PlayerMobile)from).HasRecipe( this.Recipe ) ) { int badCraft = craftSystem.CanCraft( from, tool, m_Type ); - if( badCraft <= 0 ) + if ( badCraft <= 0 ) { int resHue = 0; int maxAmount = 0; object message = null; - if( ConsumeRes( from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.None, ref message ) ) + if ( ConsumeRes( from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.None, ref message ) ) { message = null; - if( ConsumeAttributes( from, ref message, false ) ) + if ( ConsumeAttributes( from, ref message, false ) ) { CraftContext context = craftSystem.GetContext( from ); - if( context != null ) + if ( context != null ) context.OnMade( this ); int iMin = craftSystem.MinCraftEffect; @@ -1080,25 +1064,15 @@ namespace Server.Engines.Craft object checkMessage = null; // Not enough resource to craft it - if ( !ConsumeRes( from, typeRes, craftSystem, ref checkResHue, ref checkMaxAmount, ConsumeType.None, ref checkMessage ) ) + if ( !(ConsumeRes( from, typeRes, craftSystem, ref checkResHue, ref checkMaxAmount, ConsumeType.None, ref checkMessage ) + && ConsumeAttributes( from, ref checkMessage, false ))) { if ( tool != null && !tool.Deleted && tool.UsesRemaining > 0 ) from.SendGump( new CraftGump( from, craftSystem, tool, checkMessage ) ); - else if ( checkMessage is int && (int)checkMessage > 0 ) - from.SendLocalizedMessage( (int)checkMessage ); - else if ( checkMessage is string ) - from.SendMessage( (string)checkMessage ); - - return; - } - else if ( !ConsumeAttributes( from, ref checkMessage, false ) ) - { - if ( tool != null && !tool.Deleted && tool.UsesRemaining > 0 ) - from.SendGump( new CraftGump( from, craftSystem, tool, checkMessage ) ); - else if ( checkMessage is int && (int)checkMessage > 0 ) - from.SendLocalizedMessage( (int)checkMessage ); - else if ( checkMessage is string ) - from.SendMessage( (string)checkMessage ); + else if ( checkMessage is int messageInt && messageInt > 0 ) + from.SendLocalizedMessage( messageInt ); + else + from.SendMessage( checkMessage.ToString() ); return; } @@ -1119,25 +1093,15 @@ namespace Server.Engines.Craft object message = null; // Not enough resource to craft it - if ( !ConsumeRes( from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref message ) ) + if ( !(ConsumeRes( from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref message ) + && ConsumeAttributes( from, ref message, true ))) { if ( tool != null && !tool.Deleted && tool.UsesRemaining > 0 ) from.SendGump( new CraftGump( from, craftSystem, tool, message ) ); - else if ( message is int && (int)message > 0 ) - from.SendLocalizedMessage( (int)message ); - else if ( message is string ) - from.SendMessage( (string)message ); - - return; - } - else if ( !ConsumeAttributes( from, ref message, true ) ) - { - if ( tool != null && !tool.Deleted && tool.UsesRemaining > 0 ) - from.SendGump( new CraftGump( from, craftSystem, tool, message ) ); - else if ( message is int && (int)message > 0 ) - from.SendLocalizedMessage( (int)message ); - else if ( message is string ) - from.SendMessage( (string)message ); + else if ( message is int messageIn && messageIn > 0 ) + from.SendLocalizedMessage( messageIn ); + else + from.SendMessage( message.ToString() ); return; } @@ -1146,8 +1110,7 @@ namespace Server.Engines.Craft if ( craftSystem is DefBlacksmithy ) { - AncientSmithyHammer hammer = from.FindItemOnLayer( Layer.OneHanded ) as AncientSmithyHammer; - if ( hammer != null && hammer != tool ) + if ( from.FindItemOnLayer( Layer.OneHanded ) is AncientSmithyHammer hammer && hammer != tool ) { hammer.UsesRemaining--; if ( hammer.UsesRemaining < 1 ) @@ -1180,22 +1143,22 @@ namespace Server.Engines.Craft if ( item != null ) { - if( item is ICraftable ) - endquality = ((ICraftable)item).OnCraft( quality, makersMark, from, craftSystem, typeRes, tool, this, resHue ); + if ( item is ICraftable craftable ) + endquality = craftable.OnCraft( quality, makersMark, from, craftSystem, typeRes, tool, this, resHue ); else if ( item.Hue == 0 ) item.Hue = resHue; if ( maxAmount > 0 ) { - if ( !item.Stackable && item is IUsesRemaining ) - ((IUsesRemaining)item).UsesRemaining *= maxAmount; + if ( !item.Stackable && item is IUsesRemaining remaining ) + remaining.UsesRemaining *= maxAmount; else item.Amount = maxAmount; } from.AddToBackpack( item ); - if( from.AccessLevel > AccessLevel.Player ) + if ( from.AccessLevel > AccessLevel.Player ) CommandLogging.WriteLine( from, "Crafting {0} with craft system {1}", CommandLogging.Format( item ), craftSystem.GetType().Name ); //from.PlaySound( 0x57 ); @@ -1266,10 +1229,10 @@ namespace Server.Engines.Craft { if ( tool != null && !tool.Deleted && tool.UsesRemaining > 0 ) from.SendGump( new CraftGump( from, craftSystem, tool, message ) ); - else if ( message is int && (int)message > 0 ) - from.SendLocalizedMessage( (int)message ); - else if ( message is string ) - from.SendMessage( (string)message ); + else if ( message is int messageInt && messageInt > 0 ) + from.SendLocalizedMessage( messageInt ); + else + from.SendMessage( message.ToString() ); return; } diff --git a/Scripts/Engines/Craft/Core/Enhance.cs b/Scripts/Engines/Craft/Core/Enhance.cs index 9b6e2e37f..eb36da5e7 100644 --- a/Scripts/Engines/Craft/Core/Enhance.cs +++ b/Scripts/Engines/Craft/Core/Enhance.cs @@ -32,18 +32,14 @@ namespace Server.Engines.Craft if ( !(item is BaseArmor) && !(item is BaseWeapon) ) return EnhanceResult.BadItem; - if ( item is IArcaneEquip ) - { - IArcaneEquip eq = (IArcaneEquip)item; - if ( eq.IsArcane ) - return EnhanceResult.BadItem; - } + if ( item is IArcaneEquip eq && eq.IsArcane ) + return EnhanceResult.BadItem; if ( CraftResources.IsStandard( resource ) ) return EnhanceResult.BadResource; - + int num = craftSystem.CanCraft( from, tool, item.GetType() ); - + if ( num > 0 ) { resMessage = num; @@ -56,7 +52,7 @@ namespace Server.Engines.Craft return EnhanceResult.BadItem; bool allRequiredSkills = false; - if( craftItem.GetSuccessChance( from, resType, craftSystem, false, ref allRequiredSkills ) <= 0.0 ) + if ( craftItem.GetSuccessChance( from, resType, craftSystem, false, ref allRequiredSkills ) <= 0.0 ) return EnhanceResult.NoSkill; CraftResourceInfo info = CraftResources.GetInfo( resource ); @@ -76,8 +72,7 @@ namespace Server.Engines.Craft if ( craftSystem is DefBlacksmithy ) { - AncientSmithyHammer hammer = from.FindItemOnLayer( Layer.OneHanded ) as AncientSmithyHammer; - if ( hammer != null ) + if ( from.FindItemOnLayer( Layer.OneHanded ) is AncientSmithyHammer hammer ) { hammer.UsesRemaining--; if ( hammer.UsesRemaining < 1 ) @@ -99,10 +94,8 @@ namespace Server.Engines.Craft bool lreqBonus = false; bool dincBonus = false; - if ( item is BaseWeapon ) + if ( item is BaseWeapon weapon ) { - BaseWeapon weapon = (BaseWeapon)item; - if ( !CraftResources.IsStandard( weapon.Resource ) ) return EnhanceResult.AlreadyEnhanced; @@ -203,17 +196,15 @@ namespace Server.Engines.Craft if ( !craftItem.ConsumeRes( from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref resMessage ) ) return EnhanceResult.NoResources; - if( item is BaseWeapon ) + if ( item is BaseWeapon w ) { - BaseWeapon w = (BaseWeapon)item; - w.Resource = resource; int hue = w.GetElementalDamageHue(); - if( hue > 0 ) + if ( hue > 0 ) w.Hue = hue; } - else if( item is BaseArmor ) //Sanity + else { ((BaseArmor)item).Resource = resource; } @@ -302,10 +293,10 @@ namespace Server.Engines.Craft protected override void OnTarget( Mobile from, object targeted ) { - if ( targeted is Item ) + if ( targeted is Item item ) { object message = null; - EnhanceResult res = Enhance.Invoke( from, m_CraftSystem, m_Tool, (Item)targeted, m_Resource, m_ResourceType, ref message ); + EnhanceResult res = Enhance.Invoke( from, m_CraftSystem, m_Tool, item, m_Resource, m_ResourceType, ref message ); switch ( res ) { @@ -324,4 +315,4 @@ namespace Server.Engines.Craft } } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Craft/Core/Recipes.cs b/Scripts/Engines/Craft/Core/Recipes.cs index e75133aa0..776852d34 100644 --- a/Scripts/Engines/Craft/Core/Recipes.cs +++ b/Scripts/Engines/Craft/Core/Recipes.cs @@ -24,10 +24,10 @@ namespace Server.Engines.Craft m.BeginTarget( -1, false, Server.Targeting.TargetFlags.None, new TargetCallback( delegate( Mobile from, object targeted ) { - if( targeted is PlayerMobile ) + if ( targeted is PlayerMobile mobile ) { foreach( KeyValuePair kvp in m_Recipes ) - ((PlayerMobile)targeted).AcquireRecipe( kvp.Key ); + mobile.AcquireRecipe( kvp.Key ); m.SendMessage( "You teach them all of the recipies." ); } @@ -49,9 +49,9 @@ namespace Server.Engines.Craft m.BeginTarget( -1, false, Server.Targeting.TargetFlags.None, new TargetCallback( delegate( Mobile from, object targeted ) { - if( targeted is PlayerMobile ) + if ( targeted is PlayerMobile mobile ) { - ((PlayerMobile)targeted).ResetRecipes(); + mobile.ResetRecipes(); m.SendMessage( "They forget all their recipies." ); } @@ -99,7 +99,7 @@ namespace Server.Engines.Craft { get { - if( m_TD == null ) + if ( m_TD == null ) m_TD = new TextDefinition( m_CraftItem.NameNumber, m_CraftItem.NameString ); return m_TD; @@ -112,7 +112,7 @@ namespace Server.Engines.Craft m_System = system; m_CraftItem = item; - if( m_Recipes.ContainsKey( id ) ) + if ( m_Recipes.ContainsKey( id ) ) throw new Exception( "Attempting to create recipe with preexisting ID." ); m_Recipes.Add( id, this ); diff --git a/Scripts/Engines/Craft/Core/Repair.cs b/Scripts/Engines/Craft/Core/Repair.cs index b761b13d6..9bff3482a 100644 --- a/Scripts/Engines/Craft/Core/Repair.cs +++ b/Scripts/Engines/Craft/Core/Repair.cs @@ -68,15 +68,15 @@ namespace Server.Engines.Craft double difficulty = GetRepairDifficulty( curHits, maxHits ) * 0.1; - if( m_Deed != null ) + if ( m_Deed != null ) { double value = m_Deed.SkillLevel; double minSkill = difficulty - 25.0; double maxSkill = difficulty + 25; - if( value < minSkill ) + if ( value < minSkill ) return false; // Too difficult - else if( value >= maxSkill ) + else if ( value >= maxSkill ) return true; // No challenge double chance = (value - minSkill) / (maxSkill - minSkill); @@ -91,7 +91,7 @@ namespace Server.Engines.Craft private bool CheckDeed( Mobile from ) { - if( m_Deed != null ) + if ( m_Deed != null ) { return m_Deed.Check( from ); } @@ -211,7 +211,7 @@ namespace Server.Engines.Craft { int number; - if( !CheckDeed( from ) ) + if ( !CheckDeed( from ) ) return; bool usingDeed = (m_Deed != null); @@ -223,9 +223,8 @@ namespace Server.Engines.Craft { number = 1044282; // You must be near a forge and and anvil to repair items. * Yes, there are two and's * } - else if ( m_CraftSystem is DefTinkering && targeted is Golem ) + else if ( m_CraftSystem is DefTinkering && targeted is Golem g ) { - Golem g = (Golem)targeted; int damage = g.HitsMax - g.Hits; if ( g.IsDeadBondedPet ) @@ -286,9 +285,8 @@ namespace Server.Engines.Craft } } } - else if ( targeted is BaseWeapon ) + else if ( targeted is BaseWeapon weapon ) { - BaseWeapon weapon = (BaseWeapon)targeted; SkillName skill = m_CraftSystem.MainSkill; int toWeaken = 0; @@ -351,9 +349,8 @@ namespace Server.Engines.Craft toDelete = true; } } - else if ( targeted is BaseArmor ) + else if ( targeted is BaseArmor armor ) { - BaseArmor armor = (BaseArmor)targeted; SkillName skill = m_CraftSystem.MainSkill; int toWeaken = 0; @@ -412,9 +409,8 @@ namespace Server.Engines.Craft toDelete = true; } } - else if ( targeted is BaseClothing ) + else if ( targeted is BaseClothing clothing ) { - BaseClothing clothing = (BaseClothing)targeted; SkillName skill = m_CraftSystem.MainSkill; int toWeaken = 0; @@ -434,7 +430,7 @@ namespace Server.Engines.Craft toWeaken = 3; } - if (m_CraftSystem.CraftItems.SearchForSubclass(clothing.GetType()) == null && !IsSpecialClothing(clothing) && !((targeted is TribalMask) || (targeted is HornedTribalMask)) ) + if (m_CraftSystem.CraftItems.SearchForSubclass(clothing.GetType()) == null && !IsSpecialClothing(clothing) && !((clothing is TribalMask) || (clothing is HornedTribalMask)) ) { number = (usingDeed) ? 1061136 : 1044277; // That item cannot be repaired. // You cannot repair that item with this type of repair contract. } @@ -473,13 +469,13 @@ namespace Server.Engines.Craft toDelete = true; } } - else if( !usingDeed && targeted is BlankScroll ) + else if ( !usingDeed && targeted is BlankScroll scroll ) { SkillName skill = m_CraftSystem.MainSkill; - if( from.Skills[skill].Value >= 50.0 ) + if ( from.Skills[skill].Value >= 50.0 ) { - ((BlankScroll)targeted).Consume( 1 ); + scroll.Consume( 1 ); RepairDeed deed = new RepairDeed( RepairDeed.GetTypeFor( m_CraftSystem ), from.Skills[skill].Value, from ); from.AddToBackpack( deed ); @@ -497,7 +493,7 @@ namespace Server.Engines.Craft number = 500426; // You can't repair that. } - if( !usingDeed ) + if ( !usingDeed ) { CraftContext context = m_CraftSystem.GetContext( from ); from.SendGump( new CraftGump( from, m_CraftSystem, m_Tool, number ) ); @@ -506,10 +502,10 @@ namespace Server.Engines.Craft { from.SendLocalizedMessage( number ); - if( toDelete ) + if ( toDelete ) m_Deed.Delete(); } } } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Craft/Core/Resmelt.cs b/Scripts/Engines/Craft/Core/Resmelt.cs index 7a9a39aff..4bfdb7318 100644 --- a/Scripts/Engines/Craft/Core/Resmelt.cs +++ b/Scripts/Engines/Craft/Core/Resmelt.cs @@ -90,7 +90,7 @@ namespace Server.Engines.Craft Type resourceType = info.ResourceTypes[0]; Item ingot = (Item)Activator.CreateInstance( resourceType ); - if ( item is DragonBardingDeed || (item is BaseArmor && ((BaseArmor)item).PlayerConstructed) || (item is BaseWeapon && ((BaseWeapon)item).PlayerConstructed) || (item is BaseClothing && ((BaseClothing)item).PlayerConstructed) ) + if ( item is DragonBardingDeed || (item is BaseArmor armor && armor.PlayerConstructed) || (item is BaseWeapon weapon && weapon.PlayerConstructed) || (item is BaseClothing clothing && clothing.PlayerConstructed) ) ingot.Amount = craftResource.Amount / 2; else ingot.Amount = 1; @@ -118,7 +118,7 @@ namespace Server.Engines.Craft if ( num == 1044267 ) { bool anvil, forge; - + DefBlacksmithy.CheckAnvilAndForge( from, 2, out anvil, out forge ); if ( !anvil ) @@ -135,19 +135,19 @@ namespace Server.Engines.Craft bool isStoreBought = false; int message; - if ( targeted is BaseArmor ) + if ( targeted is BaseArmor armor ) { - result = Resmelt( from, (BaseArmor)targeted, ((BaseArmor)targeted).Resource ); - isStoreBought = !((BaseArmor)targeted).PlayerConstructed; + result = Resmelt( from, armor, armor.Resource ); + isStoreBought = !armor.PlayerConstructed; } - else if ( targeted is BaseWeapon ) + else if ( targeted is BaseWeapon weapon ) { - result = Resmelt( from, (BaseWeapon)targeted, ((BaseWeapon)targeted).Resource ); - isStoreBought = !((BaseWeapon)targeted).PlayerConstructed; + result = Resmelt( from, weapon, weapon.Resource ); + isStoreBought = !weapon.PlayerConstructed; } - else if ( targeted is DragonBardingDeed ) + else if ( targeted is DragonBardingDeed deed ) { - result = Resmelt( from, (DragonBardingDeed)targeted, ((DragonBardingDeed)targeted).Resource ); + result = Resmelt( from, deed, deed.Resource ); isStoreBought = false; } @@ -164,4 +164,4 @@ namespace Server.Engines.Craft } } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Craft/DefAlchemy.cs b/Scripts/Engines/Craft/DefAlchemy.cs index fa8b26f48..b43826f7a 100644 --- a/Scripts/Engines/Craft/DefAlchemy.cs +++ b/Scripts/Engines/Craft/DefAlchemy.cs @@ -39,7 +39,7 @@ namespace Server.Engines.Craft public override int CanCraft( Mobile from, BaseTool tool, Type itemType ) { - if( tool == null || tool.Deleted || tool.UsesRemaining < 0 ) + if ( tool == null || tool.Deleted || tool.UsesRemaining < 0 ) return 1044038; // You have worn out your tool! else if ( !BaseTool.CheckAccessible( tool, from ) ) return 1044263; // The tool must be on your person to use. @@ -154,7 +154,7 @@ namespace Server.Engines.Craft index = AddCraft( typeof( GreaterExplosionPotion ), 1044537, 1044557, 65.0, 115.0, typeof( SulfurousAsh ), 1044359, 10, 1044367 ); AddRes( index, typeof ( Bottle ), 1044529, 1, 500315 ); - if( Core.SE ) + if ( Core.SE ) { index = AddCraft( typeof( SmokeBomb ), 1044537, 1030248, 90.0, 120.0, typeof( Eggs ), 1044477, 1, 1044253 ); AddRes( index, typeof ( Ginseng ), 1044356, 3, 1044364 ); @@ -177,4 +177,4 @@ namespace Server.Engines.Craft } } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Craft/DefBlacksmithy.cs b/Scripts/Engines/Craft/DefBlacksmithy.cs index 469a05910..0bae49319 100644 --- a/Scripts/Engines/Craft/DefBlacksmithy.cs +++ b/Scripts/Engines/Craft/DefBlacksmithy.cs @@ -229,7 +229,7 @@ namespace Server.Engines.Craft if ( Core.AOS ) // exact pre-aos functionality unknown AddCraft( typeof( DragonBardingDeed ), 1011078, 1053012, 72.5, 122.5, typeof( IronIngot ), 1044036, 750, 1044037 ); - if( Core.SE ) + if ( Core.SE ) { index = AddCraft( typeof( PlateMempo ), 1011078, 1030180, 80.0, 130.0, typeof( IronIngot ), 1044036, 18, 1044037 ); SetNeededExpansion( index, Expansion.SE ); @@ -256,7 +256,7 @@ namespace Server.Engines.Craft AddCraft( typeof( NorseHelm ), 1011079, 1025134, 37.9, 87.9, typeof( IronIngot ), 1044036, 15, 1044037 ); AddCraft( typeof( PlateHelm ), 1011079, 1025138, 62.6, 112.6, typeof( IronIngot ), 1044036, 15, 1044037 ); - if( Core.SE ) + if ( Core.SE ) { index = AddCraft( typeof( ChainHatsuburi ), 1011079, 1030175, 30.0, 80.0, typeof( IronIngot ), 1044036, 20, 1044037 ); SetNeededExpansion( index, Expansion.SE ); @@ -282,7 +282,7 @@ namespace Server.Engines.Craft index = AddCraft( typeof( StandardPlateKabuto ), 1011079, 1030196, 90.0, 140.0, typeof( IronIngot ), 1044036, 25, 1044037 ); SetNeededExpansion( index, Expansion.SE ); - if( Core.ML ) + if ( Core.ML ) { index = AddCraft( typeof( Circlet ), 1011079, 1032645, 62.1, 112.1, typeof( IronIngot ), 1044036, 6, 1044037 ); SetNeededExpansion( index, Expansion.ML ); @@ -332,7 +332,7 @@ namespace Server.Engines.Craft AddCraft( typeof( Scimitar ), 1011081, 1025046, 31.7, 81.7, typeof( IronIngot ), 1044036, 10, 1044037 ); AddCraft( typeof( VikingSword ), 1011081, 1025049, 24.3, 74.3, typeof( IronIngot ), 1044036, 14, 1044037 ); - if( Core.SE ) + if ( Core.SE ) { index = AddCraft( typeof( NoDachi ), 1011081, 1030221, 75.0, 125.0, typeof( IronIngot ), 1044036, 18, 1044037 ); SetNeededExpansion( index, Expansion.SE ); @@ -351,7 +351,7 @@ namespace Server.Engines.Craft index = AddCraft( typeof( Sai ), 1011081, 1030234, 50.0, 100.0, typeof( IronIngot ), 1044036, 12, 1044037 ); SetNeededExpansion( index, Expansion.SE ); - if( Core.ML ) + if ( Core.ML ) { index = AddCraft( typeof( RadiantScimitar ), 1011081, 1031571, 75.0, 125.0, typeof( IronIngot ), 1044036, 15, 1044037 ); SetNeededExpansion( index, Expansion.ML ); @@ -565,7 +565,7 @@ namespace Server.Engines.Craft AddCraft( typeof( TwoHandedAxe ), 1011082, 1025187, 33.0, 83.0, typeof( IronIngot ), 1044036, 16, 1044037 ); AddCraft( typeof( WarAxe ), 1011082, 1025040, 39.1, 89.1, typeof( IronIngot ), 1044036, 16, 1044037 ); - if( Core.ML ) + if ( Core.ML ) { index = AddCraft( typeof( OrnateAxe ), 1011082, 1031572, 70.0, 120.0, typeof( IronIngot ), 1044036, 18, 1044037 ); SetNeededExpansion( index, Expansion.ML ); @@ -634,7 +634,7 @@ namespace Server.Engines.Craft AddCraft( typeof( WarMace ), 1011084, 1025127, 28.0, 78.0, typeof( IronIngot ), 1044036, 14, 1044037 ); AddCraft( typeof( WarHammer ), 1011084, 1025177, 34.2, 84.2, typeof( IronIngot ), 1044036, 16, 1044037 ); - if( Core.SE ) + if ( Core.SE ) { index = AddCraft( typeof( Tessen ), 1011084, 1030222, 85.0, 135.0, typeof( IronIngot ), 1044036, 16, 1044037 ); AddSkill( index, SkillName.Tailoring, 50.0, 55.0 ); @@ -642,7 +642,7 @@ namespace Server.Engines.Craft SetNeededExpansion( index, Expansion.SE ); } - if( Core.ML ) + if ( Core.ML ) { index = AddCraft( typeof( DiamondMace ), 1011084, 1031556, 70.0, 120.0, typeof( IronIngot ), 1044036, 20, 1044037 ); SetNeededExpansion( index, Expansion.ML ); diff --git a/Scripts/Engines/Craft/DefBowFletching.cs b/Scripts/Engines/Craft/DefBowFletching.cs index f2bfb4fc6..88d3f216d 100644 --- a/Scripts/Engines/Craft/DefBowFletching.cs +++ b/Scripts/Engines/Craft/DefBowFletching.cs @@ -39,7 +39,7 @@ namespace Server.Engines.Craft public override int CanCraft( Mobile from, BaseTool tool, Type itemType ) { - if( tool == null || tool.Deleted || tool.UsesRemaining < 0 ) + if ( tool == null || tool.Deleted || tool.UsesRemaining < 0 ) return 1044038; // You have worn out your tool! else if ( !BaseTool.CheckAccessible( tool, from ) ) return 1044263; // The tool must be on your person to use. @@ -102,7 +102,7 @@ namespace Server.Engines.Craft AddRes( index, typeof( Feather ), 1044562, 1, 1044563 ); SetUseAllRes( index, true ); - if( Core.SE ) + if ( Core.SE ) { index = AddCraft( typeof( FukiyaDarts ), 1044565, 1030246, 50.0, 90.0, typeof( Log ), 1044041, 1, 1044351 ); SetUseAllRes( index, true ); @@ -120,7 +120,7 @@ namespace Server.Engines.Craft AddCraft( typeof( RepeatingCrossbow ), 1044566, 1029923, 90.0, 130.0, typeof( Log ), 1044041, 10, 1044351 ); } - if( Core.SE ) + if ( Core.SE ) { index = AddCraft( typeof( Yumi ), 1044566, 1030224, 90.0, 130.0, typeof( Log ), 1044041, 10, 1044351 ); SetNeededExpansion( index, Expansion.SE ); diff --git a/Scripts/Engines/Craft/DefCarpentry.cs b/Scripts/Engines/Craft/DefCarpentry.cs index 4fdeef9b9..444414b8e 100644 --- a/Scripts/Engines/Craft/DefCarpentry.cs +++ b/Scripts/Engines/Craft/DefCarpentry.cs @@ -39,7 +39,7 @@ namespace Server.Engines.Craft public override int CanCraft( Mobile from, BaseTool tool, Type itemType ) { - if( tool == null || tool.Deleted || tool.UsesRemaining < 0 ) + if ( tool == null || tool.Deleted || tool.UsesRemaining < 0 ) return 1044038; // You have worn out your tool! else if ( !BaseTool.CheckAccessible( tool, from ) ) return 1044263; // The tool must be on your person to use. @@ -98,7 +98,7 @@ namespace Server.Engines.Craft AddCraft( typeof( TallMusicStand ), 1044294, 1044315, 81.5, 106.5, typeof( Log ), 1044041, 20, 1044351 ); AddCraft( typeof( Easle ), 1044294, 1044317, 86.8, 111.8, typeof( Log ), 1044041, 20, 1044351 ); - if( Core.SE ) + if ( Core.SE ) { index = AddCraft( typeof( RedHangingLantern ), 1044294, 1029412, 65.0, 90.0, typeof( Log ), 1044041, 5, 1044351 ); AddRes( index, typeof( BlankScroll ), 1044377, 10, 1044378 ); @@ -119,7 +119,7 @@ namespace Server.Engines.Craft SetNeededExpansion( index, Expansion.SE ); } - if( Core.AOS ) //Duplicate Entries to preserve ordering depending on era + if ( Core.AOS ) //Duplicate Entries to preserve ordering depending on era { index = AddCraft( typeof( FishingPole ), 1044294, 1023519, 68.4, 93.4, typeof( Log ), 1044041, 5, 1044351 ); //This is in the categor of Other during AoS AddSkill( index, SkillName.Tailoring, 40.0, 45.0 ); @@ -177,7 +177,7 @@ namespace Server.Engines.Craft AddCraft( typeof( YewWoodTable ), 1044291, 1044307, 63.1, 88.1, typeof( Log ), 1044041, 23, 1044351 ); AddCraft( typeof( LargeTable ), 1044291, 1044308, 84.2, 109.2, typeof( Log ), 1044041, 27, 1044351 ); - if( Core.SE ) + if ( Core.SE ) { index = AddCraft( typeof( ElegantLowTable ), 1044291, 1030265, 80.0, 105.0, typeof( Log ), 1044041, 35, 1044351 ); SetNeededExpansion( index, Expansion.SE ); @@ -203,7 +203,7 @@ namespace Server.Engines.Craft AddCraft( typeof( FancyArmoire ), 1044292, 1044312, 84.2, 109.2, typeof( Log ), 1044041, 35, 1044351 ); AddCraft( typeof( Armoire ), 1044292, 1022643, 84.2, 109.2, typeof( Log ), 1044041, 35, 1044351 ); - if( Core.SE ) + if ( Core.SE ) { index = AddCraft( typeof( PlainWoodenChest ), 1044292, 1030251, 90.0, 115.0, typeof( Log ), 1044041, 30, 1044351 ); SetNeededExpansion( index, Expansion.SE ); @@ -291,14 +291,14 @@ namespace Server.Engines.Craft AddCraft( typeof( GnarledStaff ), Core.ML ? 1044566 : 1044295, 1025112, 78.9, 103.9, typeof( Log ), 1044041, 7, 1044351 ); AddCraft( typeof( WoodenShield ), Core.ML ? 1062760 : 1044295, 1027034, 52.6, 77.6, typeof( Log ), 1044041, 9, 1044351 ); - if( !Core.AOS ) //Duplicate Entries to preserve ordering depending on era + if ( !Core.AOS ) //Duplicate Entries to preserve ordering depending on era { index = AddCraft( typeof( FishingPole ), Core.ML ? 1044294 : 1044295, 1023519, 68.4, 93.4, typeof( Log ), 1044041, 5, 1044351 ); //This is in the categor of Other during AoS AddSkill( index, SkillName.Tailoring, 40.0, 45.0 ); AddRes( index, typeof( Cloth ), 1044286, 5, 1044287 ); } - if( Core.SE ) + if ( Core.SE ) { index = AddCraft( typeof( Bokuto ), Core.ML ? 1044566 : 1044295, 1030227, 70.0, 95.0, typeof( Log ), 1044041, 6, 1044351 ); SetNeededExpansion( index, Expansion.SE ); @@ -386,7 +386,7 @@ namespace Server.Engines.Craft AddSkill( index, SkillName.Musicianship, 45.0, 50.0 ); AddRes( index, typeof( Cloth ), 1044286, 15, 1044287 ); - if( Core.SE ) + if ( Core.SE ) { index = AddCraft( typeof( BambooFlute ), 1044293, 1030247, 80.0, 105.0, typeof( Log ), 1044041, 15, 1044351 ); AddSkill( index, SkillName.Musicianship, 45.0, 50.0 ); @@ -519,4 +519,4 @@ namespace Server.Engines.Craft AddSubRes( typeof( FrostwoodLog ), 1072649, 100.0, 1044041, 1072652 ); } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Craft/DefCartography.cs b/Scripts/Engines/Craft/DefCartography.cs index c7ca403b5..4800ef5e1 100644 --- a/Scripts/Engines/Craft/DefCartography.cs +++ b/Scripts/Engines/Craft/DefCartography.cs @@ -39,7 +39,7 @@ namespace Server.Engines.Craft public override int CanCraft( Mobile from, BaseTool tool, Type itemType ) { - if( tool == null || tool.Deleted || tool.UsesRemaining < 0 ) + if ( tool == null || tool.Deleted || tool.UsesRemaining < 0 ) return 1044038; // You have worn out your tool! else if ( !BaseTool.CheckAccessible( tool, from ) ) return 1044263; // The tool must be on your person to use. @@ -72,7 +72,7 @@ namespace Server.Engines.Craft return 1044156; // You create an exceptional quality item and affix your maker's mark. else if ( quality == 2 ) return 1044155; // You create an exceptional quality item. - else + else return 1044154; // You create the item. } } @@ -85,4 +85,4 @@ namespace Server.Engines.Craft AddCraft( typeof( WorldMap ), 1044448, 1015233, 39.5, 99.5, typeof( BlankMap ), 1044449, 1, 1044450 ); } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Craft/DefCooking.cs b/Scripts/Engines/Craft/DefCooking.cs index efca67840..c559f5292 100644 --- a/Scripts/Engines/Craft/DefCooking.cs +++ b/Scripts/Engines/Craft/DefCooking.cs @@ -41,7 +41,7 @@ namespace Server.Engines.Craft public override int CanCraft( Mobile from, BaseTool tool, Type itemType ) { - if( tool == null || tool.Deleted || tool.UsesRemaining < 0 ) + if ( tool == null || tool.Deleted || tool.UsesRemaining < 0 ) return 1044038; // You have worn out your tool! else if ( !BaseTool.CheckAccessible( tool, from ) ) return 1044263; // The tool must be on your person to use. diff --git a/Scripts/Engines/Craft/DefGlassblowing.cs b/Scripts/Engines/Craft/DefGlassblowing.cs index 8e5507fa6..3ff6585d8 100644 --- a/Scripts/Engines/Craft/DefGlassblowing.cs +++ b/Scripts/Engines/Craft/DefGlassblowing.cs @@ -31,7 +31,7 @@ namespace Server.Engines.Craft public override double GetChanceAtMin( CraftItem item ) { - if( item.ItemType == typeof( HollowPrism ) ) + if ( item.ItemType == typeof( HollowPrism ) ) return 0.5; // 50% return 0.0; // 0% @@ -43,13 +43,13 @@ namespace Server.Engines.Craft public override int CanCraft( Mobile from, BaseTool tool, Type itemType ) { - if( tool == null || tool.Deleted || tool.UsesRemaining < 0 ) + if ( tool == null || tool.Deleted || tool.UsesRemaining < 0 ) return 1044038; // You have worn out your tool! - else if ( !BaseTool.CheckTool( tool, from ) ) + if ( !BaseTool.CheckTool( tool, from ) ) return 1048146; // If you have a tool equipped, you must use that tool. - else if ( !(from is PlayerMobile && ((PlayerMobile)from).Glassblowing && from.Skills[SkillName.Alchemy].Base >= 100.0) ) + if ( !(from is PlayerMobile mobile && mobile.Glassblowing && mobile.Skills[SkillName.Alchemy].Base >= 100.0) ) return 1044634; // You havent learned glassblowing. - else if ( !BaseTool.CheckAccessible( tool, from ) ) + if ( !BaseTool.CheckAccessible( tool, from ) ) return 1044263; // The tool must be on your person to use. bool anvil, forge; @@ -139,4 +139,4 @@ namespace Server.Engines.Craft } } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Craft/DefInscription.cs b/Scripts/Engines/Craft/DefInscription.cs index f8770473d..2b2fdef67 100644 --- a/Scripts/Engines/Craft/DefInscription.cs +++ b/Scripts/Engines/Craft/DefInscription.cs @@ -43,16 +43,15 @@ namespace Server.Engines.Craft { if ( tool == null || tool.Deleted || tool.UsesRemaining < 0 ) return 1044038; // You have worn out your tool! - if ( !BaseTool.CheckAccessible( tool, @from ) ) + if ( !BaseTool.CheckAccessible( tool, from ) ) return 1044263; // The tool must be on your person to use. if ( typeItem != null ) { var o = Activator.CreateInstance( typeItem ); - if ( o is SpellScroll ) + if ( o is SpellScroll scroll ) { - var scroll = (SpellScroll) o; var book = Spellbook.Find( from, scroll.SpellID ); var hasSpell = ( book != null && book.HasSpell( scroll.SpellID ) ); @@ -61,9 +60,10 @@ namespace Server.Engines.Craft return ( hasSpell ? 0 : 1042404 ); // null : You don't have that spell! } - else if ( o is Item ) + + if ( o is Item item ) { - ( (Item) o ).Delete(); + item.Delete(); } } @@ -404,4 +404,4 @@ namespace Server.Engines.Craft MarkOption = true; } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Craft/DefMasonry.cs b/Scripts/Engines/Craft/DefMasonry.cs index 31331068f..feb0fd583 100644 --- a/Scripts/Engines/Craft/DefMasonry.cs +++ b/Scripts/Engines/Craft/DefMasonry.cs @@ -1,42 +1,42 @@ -using System; -using Server.Items; -using Server.Mobiles; +using System; +using Server.Items; +using Server.Mobiles; -namespace Server.Engines.Craft -{ - public class DefMasonry : CraftSystem - { - public override SkillName MainSkill - { - get{ return SkillName.Carpentry; } - } +namespace Server.Engines.Craft +{ + public class DefMasonry : CraftSystem + { + public override SkillName MainSkill + { + get{ return SkillName.Carpentry; } + } - public override int GumpTitleNumber - { - get{ return 1044500; } //
MASONRY MENU
- } + public override int GumpTitleNumber + { + get{ return 1044500; } //
MASONRY MENU
+ } - private static CraftSystem m_CraftSystem; + private static CraftSystem m_CraftSystem; - public static CraftSystem CraftSystem - { - get - { - if ( m_CraftSystem == null ) - m_CraftSystem = new DefMasonry(); + public static CraftSystem CraftSystem + { + get + { + if ( m_CraftSystem == null ) + m_CraftSystem = new DefMasonry(); - return m_CraftSystem; - } - } + return m_CraftSystem; + } + } - public override double GetChanceAtMin( CraftItem item ) - { - return 0.0; // 0% - } + public override double GetChanceAtMin( CraftItem item ) + { + return 0.0; // 0% + } - private DefMasonry() : base( 1, 1, 1.25 )// base( 1, 2, 1.7 ) - { - } + private DefMasonry() : base( 1, 1, 1.25 )// base( 1, 2, 1.7 ) + { + } public override bool RetainsColorFrom( CraftItem item, Type type ) { @@ -45,74 +45,74 @@ namespace Server.Engines.Craft public override int CanCraft( Mobile from, BaseTool tool, Type itemType ) { - if( tool == null || tool.Deleted || tool.UsesRemaining < 0 ) + if ( tool == null || tool.Deleted || tool.UsesRemaining < 0 ) return 1044038; // You have worn out your tool! - else if ( !BaseTool.CheckTool( tool, from ) ) + if ( !BaseTool.CheckTool( tool, from ) ) return 1048146; // If you have a tool equipped, you must use that tool. - else if ( !(from is PlayerMobile && ((PlayerMobile)from).Masonry && from.Skills[SkillName.Carpentry].Base >= 100.0) ) + if ( !(from is PlayerMobile mobile && mobile.Masonry && mobile.Skills[SkillName.Carpentry].Base >= 100.0) ) return 1044633; // You havent learned stonecraft. - else if ( !BaseTool.CheckAccessible( tool, from ) ) + if ( !BaseTool.CheckAccessible( tool, from ) ) return 1044263; // The tool must be on your person to use. return 0; - } + } - public override void PlayCraftEffect( Mobile from ) - { + public override void PlayCraftEffect( Mobile from ) + { // no effects - //if ( from.Body.Type == BodyType.Human && !from.Mounted ) - // from.Animate( 9, 5, 1, true, false, 0 ); - //new InternalTimer( from ).Start(); - } + //if ( from.Body.Type == BodyType.Human && !from.Mounted ) + // from.Animate( 9, 5, 1, true, false, 0 ); + //new InternalTimer( from ).Start(); + } - // Delay to synchronize the sound with the hit on the anvil - private class InternalTimer : Timer - { - private Mobile m_From; + // Delay to synchronize the sound with the hit on the anvil + private class InternalTimer : Timer + { + private Mobile m_From; - public InternalTimer( Mobile from ) : base( TimeSpan.FromSeconds( 0.7 ) ) - { - m_From = from; - } + public InternalTimer( Mobile from ) : base( TimeSpan.FromSeconds( 0.7 ) ) + { + m_From = from; + } - protected override void OnTick() - { - m_From.PlaySound( 0x23D ); - } - } + protected override void OnTick() + { + m_From.PlaySound( 0x23D ); + } + } - public override int PlayEndingEffect( Mobile from, bool failed, bool lostMaterial, bool toolBroken, int quality, bool makersMark, CraftItem item ) - { - if ( toolBroken ) - from.SendLocalizedMessage( 1044038 ); // You have worn out your tool + public override int PlayEndingEffect( Mobile from, bool failed, bool lostMaterial, bool toolBroken, int quality, bool makersMark, CraftItem item ) + { + if ( toolBroken ) + from.SendLocalizedMessage( 1044038 ); // You have worn out your tool - if ( failed ) - { - if ( lostMaterial ) - return 1044043; // You failed to create the item, and some of your materials are lost. - else - return 1044157; // You failed to create the item, but no materials were lost. - } - else - { - if ( quality == 0 ) - return 502785; // You were barely able to make this item. It's quality is below average. - else if ( makersMark && quality == 2 ) - return 1044156; // You create an exceptional quality item and affix your maker's mark. - else if ( quality == 2 ) - return 1044155; // You create an exceptional quality item. - else - return 1044154; // You create the item. - } - } + if ( failed ) + { + if ( lostMaterial ) + return 1044043; // You failed to create the item, and some of your materials are lost. + else + return 1044157; // You failed to create the item, but no materials were lost. + } + else + { + if ( quality == 0 ) + return 502785; // You were barely able to make this item. It's quality is below average. + else if ( makersMark && quality == 2 ) + return 1044156; // You create an exceptional quality item and affix your maker's mark. + else if ( quality == 2 ) + return 1044155; // You create an exceptional quality item. + else + return 1044154; // You create the item. + } + } - public override void InitCraftList() - { + public override void InitCraftList() + { // Decorations AddCraft( typeof( Vase ), 1044501, 1022888, 52.5, 102.5, typeof( Granite ), 1044514, 1, 1044513 ); AddCraft( typeof( LargeVase ), 1044501, 1022887, 52.5, 102.5, typeof( Granite ), 1044514, 3, 1044513 ); - if( Core.SE ) + if ( Core.SE ) { int index = AddCraft( typeof( SmallUrn ), 1044501, 1029244, 82.0, 132.0, typeof( Granite ), 1044514, 3, 1044513 ); SetNeededExpansion( index, Expansion.SE ); @@ -147,4 +147,4 @@ namespace Server.Engines.Craft AddSubRes( typeof( ValoriteGranite ), 1044030, 99.0, 1044514, 1044527 ); } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Craft/DefTailoring.cs b/Scripts/Engines/Craft/DefTailoring.cs index a855d55a2..219ad59d5 100644 --- a/Scripts/Engines/Craft/DefTailoring.cs +++ b/Scripts/Engines/Craft/DefTailoring.cs @@ -41,7 +41,7 @@ namespace Server.Engines.Craft public override int CanCraft( Mobile from, BaseTool tool, Type itemType ) { - if( tool == null || tool.Deleted || tool.UsesRemaining < 0 ) + if ( tool == null || tool.Deleted || tool.UsesRemaining < 0 ) return 1044038; // You have worn out your tool! else if ( !BaseTool.CheckAccessible( tool, from ) ) return 1044263; // The tool must be on your person to use. @@ -123,7 +123,7 @@ namespace Server.Engines.Craft if ( Core.AOS ) AddCraft( typeof( FlowerGarland ), 1011375, 1028965, 10.0, 35.0, typeof( Cloth ), 1044286, 5, 1044287 ); - if( Core.SE ) + if ( Core.SE ) { index = AddCraft( typeof( ClothNinjaHood ), 1011375, 1030202, 80.0, 105.0, typeof( Cloth ), 1044286, 13, 1044287 ); SetNeededExpansion( index, Expansion.SE ); @@ -152,7 +152,7 @@ namespace Server.Engines.Craft AddCraft( typeof( FormalShirt ), 1015269, 1028975, 26.0, 51.0, typeof( Cloth ), 1044286, 16, 1044287 ); } - if( Core.SE ) + if ( Core.SE ) { index = AddCraft( typeof( ClothNinjaJacket ), 1015269, 1030207, 75.0, 100.0, typeof( Cloth ), 1044286, 12, 1044287 ); SetNeededExpansion( index, Expansion.SE ); @@ -179,7 +179,7 @@ namespace Server.Engines.Craft if ( Core.AOS ) AddCraft( typeof( FurSarong ), 1015279, 1028971, 35.0, 60.0, typeof( Cloth ), 1044286, 12, 1044287 ); - if( Core.SE ) + if ( Core.SE ) { index = AddCraft( typeof( Hakama ), 1015279, 1030213, 50.0, 75.0, typeof( Cloth ), 1044286, 16, 1044287 ); SetNeededExpansion( index, Expansion.SE ); @@ -194,13 +194,13 @@ namespace Server.Engines.Craft AddCraft( typeof( HalfApron ), 1015283, 1025435, 20.7, 45.7, typeof( Cloth ), 1044286, 6, 1044287 ); AddCraft( typeof( FullApron ), 1015283, 1025437, 29.0, 54.0, typeof( Cloth ), 1044286, 10, 1044287 ); - if( Core.SE ) + if ( Core.SE ) { index = AddCraft( typeof( Obi ), 1015283, 1030219, 20.0, 45.0, typeof( Cloth ), 1044286, 6, 1044287 ); SetNeededExpansion( index, Expansion.SE ); } - if( Core.ML ) + if ( Core.ML ) { index = AddCraft( typeof( ElvenQuiver ), 1015283, 1032657, 65.0, 115.0, typeof( Leather ), 1044462, 28, 1044463 ); AddRecipe( index, 501 ); @@ -229,7 +229,7 @@ namespace Server.Engines.Craft AddCraft( typeof( OilCloth ), 1015283, 1041498, 74.6, 99.6, typeof( Cloth ), 1044286, 1, 1044287 ); - if( Core.SE ) + if ( Core.SE ) { index = AddCraft( typeof( GozaMatEastDeed ), 1015283, 1030404, 55.0, 80.0, typeof( Cloth ), 1044286, 25, 1044287 ); SetNeededExpansion( index, Expansion.SE ); @@ -255,7 +255,7 @@ namespace Server.Engines.Craft if ( Core.AOS ) AddCraft( typeof( FurBoots ), 1015288, 1028967, 50.0, 75.0, typeof( Cloth ), 1044286, 12, 1044287 ); - if( Core.SE ) + if ( Core.SE ) { index = AddCraft( typeof( NinjaTabi ), 1015288, 1030210, 70.0, 95.0, typeof( Cloth ), 1044286, 10, 1044287 ); SetNeededExpansion( index, Expansion.SE ); @@ -305,7 +305,7 @@ namespace Server.Engines.Craft AddCraft( typeof( LeatherLegs ), 1015293, 1025067, 66.3, 91.3, typeof( Leather ), 1044462, 10, 1044463 ); AddCraft( typeof( LeatherChest ), 1015293, 1025068, 70.5, 95.5, typeof( Leather ), 1044462, 12, 1044463 ); - if( Core.SE ) + if ( Core.SE ) { index = AddCraft( typeof( LeatherJingasa ), 1015293, 1030177, 45.0, 70.0, typeof( Leather ), 1044462, 4, 1044463 ); SetNeededExpansion( index, Expansion.SE ); @@ -340,7 +340,7 @@ namespace Server.Engines.Craft AddCraft( typeof( StuddedLegs ), 1015300, 1025082, 91.2, 116.2, typeof( Leather ), 1044462, 12, 1044463 ); AddCraft( typeof( StuddedChest ), 1015300, 1025083, 94.0, 119.0, typeof( Leather ), 1044462, 14, 1044463 ); - if( Core.SE ) + if ( Core.SE ) { index = AddCraft( typeof( StuddedMempo ), 1015300, 1030216, 80.0, 105.0, typeof( Leather ), 1044462, 8, 1044463 ); SetNeededExpansion( index, Expansion.SE ); diff --git a/Scripts/Engines/Craft/DefTinkering.cs b/Scripts/Engines/Craft/DefTinkering.cs index d7331c4f8..f54a61cf9 100644 --- a/Scripts/Engines/Craft/DefTinkering.cs +++ b/Scripts/Engines/Craft/DefTinkering.cs @@ -45,7 +45,7 @@ namespace Server.Engines.Craft public override int CanCraft( Mobile from, BaseTool tool, Type itemType ) { - if( tool == null || tool.Deleted || tool.UsesRemaining < 0 ) + if ( tool == null || tool.Deleted || tool.UsesRemaining < 0 ) return 1044038; // You have worn out your tool! else if ( !BaseTool.CheckAccessible( tool, from ) ) return 1044263; // The tool must be on your person to use. @@ -158,7 +158,7 @@ namespace Server.Engines.Craft AddCraft( typeof( Axle ), 1044042, 1024187, -25.0, 25.0, typeof( Log ), 1044041, 2, 1044351 ); AddCraft( typeof( RollingPin ), 1044042, 1024163, 0.0, 50.0, typeof( Log ), 1044041, 5, 1044351 ); - if( Core.SE ) + if ( Core.SE ) { index = AddCraft( typeof( Nunchaku ), 1044042, 1030158, 70.0, 120.0, typeof( IronIngot ), 1044036, 3, 1044037 ); AddRes( index, typeof( Log ), 1044041, 8, 1044351 ); diff --git a/Scripts/Engines/Doom/GauntletSpawner.cs b/Scripts/Engines/Doom/GauntletSpawner.cs index 13b18fded..ac3116af4 100644 --- a/Scripts/Engines/Doom/GauntletSpawner.cs +++ b/Scripts/Engines/Doom/GauntletSpawner.cs @@ -334,17 +334,10 @@ namespace Server.Engines.Doom object obj = Activator.CreateInstance( type ); - if ( obj == null ) - return; - - if ( obj is Item ) + if ( obj is Item item ) + item.Delete(); + else if ( obj is Mobile mob ) { - ((Item)obj).Delete(); - } - else if ( obj is Mobile ) - { - Mobile mob = (Mobile)obj; - mob.MoveToWorld( GetWorldLocation(), this.Map ); m_Creatures.Add( mob ); @@ -414,7 +407,7 @@ namespace Server.Engines.Doom public GauntletSpawner( Serial serial ) : base( serial ) { } - + public override void Serialize( GenericWriter writer ) { base.Serialize( writer ); @@ -704,4 +697,4 @@ namespace Server.Engines.Doom { } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Doom/LeverPuzzle/LeverPuzzleController.cs b/Scripts/Engines/Doom/LeverPuzzle/LeverPuzzleController.cs index 481b7f962..b69789cc9 100644 --- a/Scripts/Engines/Doom/LeverPuzzle/LeverPuzzleController.cs +++ b/Scripts/Engines/Doom/LeverPuzzle/LeverPuzzleController.cs @@ -9,7 +9,7 @@ using System.Collections.Generic; /* this is From me to you, Under no terms, Conditions... K? to apply you just simply Unpatch/delete, Stick these in, Same location.. Restart - */ + */ namespace Server.Engines.Doom { @@ -75,7 +75,7 @@ namespace Server.Engines.Doom { for (int i=0; i<5; i++) { - if( GetOccupant( i ) == null) + if ( GetOccupant( i ) == null) { return false; } @@ -107,7 +107,7 @@ namespace Server.Engines.Doom for (; i<19; i++) m_Statues.Add( AddLeverPuzzlePart( TA[i], new LeverPuzzleStatue( TA[++i], this ))); - if(!installed) + if (!installed) Delete(); else Enabled=true; @@ -119,7 +119,7 @@ namespace Server.Engines.Doom public static Item AddLeverPuzzlePart( int[] Loc, Item newitem ) { - if( newitem == null || newitem.Deleted ) + if ( newitem == null || newitem.Deleted ) { installed=false; } @@ -141,7 +141,7 @@ namespace Server.Engines.Doom NukeItemList( m_Statues ); NukeItemList( m_Levers ); - if( m_LampRoom != null ) + if ( m_LampRoom != null ) { m_LampRoom.Unregister(); } @@ -152,7 +152,7 @@ namespace Server.Engines.Doom region.Unregister(); } } - if( m_Box != null && !m_Box.Deleted ) + if ( m_Box != null && !m_Box.Deleted ) { m_Box.Delete(); } @@ -164,7 +164,7 @@ namespace Server.Engines.Doom { foreach ( Item item in list ) { - if( item != null && !item.Deleted ) + if ( item != null && !item.Deleted ) { item.Delete(); } @@ -178,7 +178,7 @@ namespace Server.Engines.Doom if ( region != null ) { - if( region.Occupant != null && region.Occupant.Alive ) + if ( region.Occupant != null && region.Occupant.Alive ) { return (PlayerMobile)region.Occupant; } @@ -190,7 +190,7 @@ namespace Server.Engines.Doom { LeverPuzzleStatue statue = (LeverPuzzleStatue)m_Statues[index]; - if( statue != null && !statue.Deleted ) + if ( statue != null && !statue.Deleted ) { return statue; } @@ -201,7 +201,7 @@ namespace Server.Engines.Doom { LeverPuzzleLever lever = (LeverPuzzleLever)m_Levers[index]; - if( lever != null && !lever.Deleted ) + if ( lever != null && !lever.Deleted ) { return lever; } @@ -213,7 +213,7 @@ namespace Server.Engines.Doom for( int i=0; i<2; i++) { Item s; - if(( s = GetStatue( i )) != null ) + if (( s = GetStatue( i )) != null ) { s.PublicOverheadMessage( MessageType.Regular, 0x3B2, message, fstring ); } @@ -231,7 +231,7 @@ namespace Server.Engines.Doom for(int i=0;i<4; i++) { Item l; - if(( l = GetLever( i )) != null ) + if (( l = GetLever( i )) != null ) { l.ItemID=0x108E; Effects.PlaySound( l.Location, Map, 0x3E8 ); @@ -266,24 +266,24 @@ namespace Server.Engines.Doom /* if one bit in each of the four nibbles is set, this is false */ - if( (TheirKey=(ushort)(code|(TheirKey<<=4))) < 0x0FFF ) + if ( (TheirKey=(ushort)(code|(TheirKey<<=4))) < 0x0FFF ) { l_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 30.0 ), new TimerCallback( ResetPuzzle )); return; } - if( !CircleComplete ) + if ( !CircleComplete ) { PuzzleStatus( 1050004, null ); // The circle is the key... } else { - if( TheirKey == MyKey ) + if ( TheirKey == MyKey ) { GenKey(); if (( m_Successful = ( m_Player=GetOccupant( 0 ))) != null ) { - SendLocationEffect( lp_Center, 0x1153, 0, 60, 1 ); + SendLocationEffect( lp_Center, 0x1153, 0, 60, 1 ); PlaySounds( lp_Center, cs1 ); Effects.SendBoltEffect( m_Player, true ); @@ -298,7 +298,7 @@ namespace Server.Engines.Doom { for(int i=0; i<16; i++) /* Count matching SET bits, ie correct codes */ { - if( (((MyKey>>i)&1)==1)&&(((TheirKey>>i)&1)==1) ) + if ( (((MyKey>>i)&1)==1)&&(((TheirKey>>i)&1)==1) ) { Correct++; } @@ -308,7 +308,7 @@ namespace Server.Engines.Doom for (int i=0; i<5; i++) { - if(( m_Player=GetOccupant( i )) != null ) + if (( m_Player=GetOccupant( i )) != null ) { Timer smash = new RockTimer( m_Player, this ); smash.Start(); @@ -324,7 +324,7 @@ namespace Server.Engines.Doom UInt16 tmp; int n, i; ushort[] CA = { 1,2,4,8 }; for (i=0; i<4; i++) { - n=(((n = Utility.Random(0,3))==i) ? n&~i : n ); /* if(i==n) { return pointless; } */ + n=(((n = Utility.Random(0,3))==i) ? n&~i : n ); /* if (i==n) { return pointless; } */ tmp = CA[i]; CA[i]=CA[n]; CA[n]=tmp; @@ -338,7 +338,7 @@ namespace Server.Engines.Doom private Mobile m_Player; private LeverPuzzleController m_Controller; - public RockTimer( Mobile player, LeverPuzzleController Controller ) + public RockTimer( Mobile player, LeverPuzzleController Controller ) : base( TimeSpan.Zero, TimeSpan.FromSeconds( .25 ) ) { Count = 0; @@ -353,7 +353,7 @@ namespace Server.Engines.Doom protected override void OnTick() { - if( m_Player == null || !(m_Player.Map == Map.Malas) ) + if ( m_Player == null || !(m_Player.Map == Map.Malas) ) { Stop(); } @@ -361,7 +361,7 @@ namespace Server.Engines.Doom { Count++; if ( Count == 1 ) /* TODO consolidate */ - { + { m_Player.Paralyze( TimeSpan.FromSeconds(2) ); Effects.SendTargetEffect( m_Player, 0x11B7, 20, 10 ); PlayerSendASCII( m_Player, 0 ); // You are pinned down ... @@ -376,7 +376,7 @@ namespace Server.Engines.Doom PlaySounds( m_Player.Location, exp ); PlayerSendASCII( m_Player, 1 ); // A speeding rock ... - if( AniSafe( m_Player )) + if ( AniSafe( m_Player )) { m_Player.Animate( 21, 10, 1, true, true, 0 ); } @@ -401,12 +401,12 @@ namespace Server.Engines.Doom } for( int k=0; k true; public override bool OnMoveOver( Mobile m ) { - if( m != null && m is PlayerMobile ) + if ( m != null && m is PlayerMobile ) { if ( SpellHelper.CheckCombat( m ) ) { diff --git a/Scripts/Engines/Doom/LeverPuzzle/LeverPuzzleRegions.cs b/Scripts/Engines/Doom/LeverPuzzle/LeverPuzzleRegions.cs index 796b7f0d3..d12319d64 100644 --- a/Scripts/Engines/Doom/LeverPuzzle/LeverPuzzleRegions.cs +++ b/Scripts/Engines/Doom/LeverPuzzle/LeverPuzzleRegions.cs @@ -49,14 +49,9 @@ namespace Server.Engines.Doom return; } } - else if ( m is BaseCreature ) - { - BaseCreature bc = (BaseCreature)m; - if(( bc.Controlled && bc.ControlMaster == Controller.Successful ) || bc.Summoned ) - { - return; - } - } + else if (m is BaseCreature bc && ((bc.Controlled && bc.ControlMaster == Controller.Successful) || + bc.Summoned)) + return; } Timer kick = new LeverPuzzleController.LampRoomKickTimer( m ); kick.Start(); @@ -64,16 +59,16 @@ namespace Server.Engines.Doom public override void OnExit( Mobile m ) { - if( m != null && m == Controller.Successful ) + if ( m != null && m == Controller.Successful ) Controller.RemoveSuccessful(); } public override void OnDeath( Mobile m ) { - if( m != null && !m.Deleted && !(m is WandererOfTheVoid) ) + if ( m != null && !m.Deleted && !(m is WandererOfTheVoid) ) { Timer kick = new LeverPuzzleController.LampRoomKickTimer( m ); - kick.Start();; + kick.Start(); } } @@ -103,7 +98,7 @@ namespace Server.Engines.Doom } } - public LeverPuzzleRegion ( LeverPuzzleController controller, int[] loc ) + public LeverPuzzleRegion ( LeverPuzzleController controller, int[] loc ) : base( null, Map.Malas, Region.Find( LeverPuzzleController.lr_Enter, Map.Malas ), new Rectangle2D(loc[0],loc[1],1,1) ) { Controller = controller; @@ -112,13 +107,13 @@ namespace Server.Engines.Doom public override void OnEnter( Mobile m ) { - if( m != null && m_Occupant == null && m is PlayerMobile && m.Alive ) + if ( m != null && m_Occupant == null && m is PlayerMobile && m.Alive ) m_Occupant = m; } public override void OnExit( Mobile m ) { - if( m != null && m == m_Occupant ) + if ( m != null && m == m_Occupant ) m_Occupant = null; } } diff --git a/Scripts/Engines/Ethics/Core/Ethic.cs b/Scripts/Engines/Ethics/Core/Ethic.cs index f44965676..12c036366 100644 --- a/Scripts/Engines/Ethics/Core/Ethic.cs +++ b/Scripts/Engines/Ethics/Core/Ethic.cs @@ -84,7 +84,7 @@ namespace Server.Ethics public static void Initialize() { - if( Enabled ) + if ( Enabled ) EventSink.Speech += new SpeechEventHandler( EventSink_Speech ); } @@ -134,7 +134,7 @@ namespace Server.Ethics } else { - if ( e.Mobile is PlayerMobile && ( e.Mobile as PlayerMobile ).DuelContext != null ) + if ( e.Mobile is PlayerMobile mobile && mobile.DuelContext != null ) return; Ethic ethic = pl.Ethic; @@ -188,15 +188,13 @@ namespace Server.Ethics if ( pl != null ) return pl.Ethic; - if ( inherit && mob is BaseCreature ) + if ( inherit && mob is BaseCreature bc ) { - BaseCreature bc = (BaseCreature) mob; - if ( bc.Controlled ) return Find( bc.ControlMaster, false ); - else if ( bc.Summoned ) + if ( bc.Summoned ) return Find( bc.SummonMaster, false ); - else if ( allegiance ) + if ( allegiance ) return bc.EthicAllegiance; } @@ -252,4 +250,4 @@ namespace Server.Ethics Evil }; } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Ethics/Core/Player.cs b/Scripts/Engines/Ethics/Core/Player.cs index 6d625c462..85849ab3e 100644 --- a/Scripts/Engines/Ethics/Core/Player.cs +++ b/Scripts/Engines/Ethics/Core/Player.cs @@ -23,13 +23,11 @@ namespace Server.Ethics if ( pm == null ) { - if ( inherit && mob is BaseCreature ) + if ( inherit && mob is BaseCreature bc ) { - BaseCreature bc = mob as BaseCreature; - - if ( bc != null && bc.Controlled ) + if ( bc.Controlled ) pm = bc.ControlMaster as PlayerMobile; - else if ( bc != null && bc.Summoned ) + else if ( bc.Summoned ) pm = bc.SummonMaster as PlayerMobile; } @@ -114,16 +112,16 @@ namespace Server.Ethics public void Attach() { - if ( m_Mobile is PlayerMobile ) - ( m_Mobile as PlayerMobile ).EthicPlayer = this; + if ( m_Mobile is PlayerMobile mobile ) + mobile.EthicPlayer = this; m_Ethic.Players.Add( this ); } public void Detach() { - if ( m_Mobile is PlayerMobile ) - ( m_Mobile as PlayerMobile ).EthicPlayer = null; + if ( m_Mobile is PlayerMobile mobile ) + mobile.EthicPlayer = null; m_Ethic.Players.Remove( this ); } diff --git a/Scripts/Engines/Ethics/Evil/Powers/Blight.cs b/Scripts/Engines/Ethics/Evil/Powers/Blight.cs index 2000b80e9..6a6d770d8 100644 --- a/Scripts/Engines/Ethics/Evil/Powers/Blight.cs +++ b/Scripts/Engines/Ethics/Evil/Powers/Blight.cs @@ -27,9 +27,7 @@ namespace Server.Ethics.Evil { Player from = state as Player; - IPoint3D p = obj as IPoint3D; - - if ( p == null ) + if ( !(obj is IPoint3D p) ) return; if ( !CheckInvoke( from ) ) diff --git a/Scripts/Engines/Ethics/Evil/Powers/UnholyItem.cs b/Scripts/Engines/Ethics/Evil/Powers/UnholyItem.cs index 1fc8ff291..af288890a 100644 --- a/Scripts/Engines/Ethics/Evil/Powers/UnholyItem.cs +++ b/Scripts/Engines/Ethics/Evil/Powers/UnholyItem.cs @@ -25,11 +25,10 @@ namespace Server.Ethics.Evil private void Power_OnTarget( Mobile fromMobile, object obj, object state ) { - Player from = state as Player; + if (!(state is Player from)) + return; - Item item = obj as Item; - - if ( item == null ) + if ( !(obj is Item item) ) { from.Mobile.LocalOverheadMessage( Server.Network.MessageType.Regular, 0x3B2, false, "You may not imbue that." ); return; diff --git a/Scripts/Engines/Ethics/Hero/Powers/Bless.cs b/Scripts/Engines/Ethics/Hero/Powers/Bless.cs index f2e487b38..224124946 100644 --- a/Scripts/Engines/Ethics/Hero/Powers/Bless.cs +++ b/Scripts/Engines/Ethics/Hero/Powers/Bless.cs @@ -25,11 +25,10 @@ namespace Server.Ethics.Hero private void Power_OnTarget( Mobile fromMobile, object obj, object state ) { - Player from = state as Player; + if (!(state is Player from)) + return; - IPoint3D p = obj as IPoint3D; - - if ( p == null ) + if ( !(obj is IPoint3D p) ) return; if ( !CheckInvoke( from ) ) diff --git a/Scripts/Engines/Ethics/Hero/Powers/HolyItem.cs b/Scripts/Engines/Ethics/Hero/Powers/HolyItem.cs index 5f9f5fcde..70cfb386d 100644 --- a/Scripts/Engines/Ethics/Hero/Powers/HolyItem.cs +++ b/Scripts/Engines/Ethics/Hero/Powers/HolyItem.cs @@ -25,11 +25,10 @@ namespace Server.Ethics.Hero private void Power_OnTarget( Mobile fromMobile, object obj, object state ) { - Player from = state as Player; + if (!(state is Player from)) + return; - Item item = obj as Item; - - if ( item == null ) + if ( !(obj is Item item) ) { from.Mobile.LocalOverheadMessage( Server.Network.MessageType.Regular, 0x3B2, false, "You may not imbue that." ); return; diff --git a/Scripts/Engines/Factions/Core/Election.cs b/Scripts/Engines/Factions/Core/Election.cs index 4797c32a3..c30a50d0e 100644 --- a/Scripts/Engines/Factions/Core/Election.cs +++ b/Scripts/Engines/Factions/Core/Election.cs @@ -409,8 +409,8 @@ namespace Server.Factions { TimeSpan gameTime = TimeSpan.Zero; - if ( m_From is PlayerMobile ) - gameTime = ((PlayerMobile)m_From).GameTime; + if ( m_From is PlayerMobile mobile ) + gameTime = mobile.GameTime; int kp = 0; diff --git a/Scripts/Engines/Factions/Core/Faction.cs b/Scripts/Engines/Factions/Core/Faction.cs index cc50ad80d..dc2b37484 100644 --- a/Scripts/Engines/Factions/Core/Faction.cs +++ b/Scripts/Engines/Factions/Core/Faction.cs @@ -198,10 +198,8 @@ namespace Server.Factions public void HonorLeadership_OnTarget( Mobile from, object obj ) { - if ( obj is Mobile ) + if ( obj is Mobile recv ) { - Mobile recv = (Mobile) obj; - PlayerState giveState = PlayerState.Find( from ); PlayerState recvState = PlayerState.Find( recv ); @@ -353,7 +351,7 @@ namespace Server.Factions int killPoints = pl.KillPoints; - if( mob.Backpack != null ) + if ( mob.Backpack != null ) { //Ordinarily, through normal faction removal, this will never find any sigils. //Only with a leave delay less than the ReturnPeriod or a Faction Kick/Ban, will this ever do anything @@ -377,8 +375,8 @@ namespace Server.Factions Members.Remove( pl ); - if ( mob is PlayerMobile ) - ((PlayerMobile)mob).FactionPlayerState = null; + if ( mob is PlayerMobile mobile ) + mobile.FactionPlayerState = null; mob.InvalidateProperties(); mob.Delta( MobileDelta.Noto ); @@ -397,8 +395,8 @@ namespace Server.Factions if ( Commander == mob ) Commander = null; - if ( mob is PlayerMobile ) - ((PlayerMobile)mob).ValidateEquipment(); + if ( mob is PlayerMobile playerMobile ) + playerMobile.ValidateEquipment(); if ( killPoints > 0 ) DistributePoints( killPoints ); @@ -436,9 +434,7 @@ namespace Server.Factions private bool AlreadyHasCharInFaction( Mobile mob ) { - Account acct = mob.Account as Account; - - if ( acct != null ) + if ( mob.Account is Account acct ) { for ( int i = 0; i < acct.Length; ++i ) { @@ -454,9 +450,7 @@ namespace Server.Factions public static bool IsFactionBanned( Mobile mob ) { - Account acct = mob.Account as Account; - - if ( acct == null ) + if ( !(mob.Account is Account acct) ) return false; return ( acct.GetTag( "FactionBanned" ) != null ); @@ -464,9 +458,7 @@ namespace Server.Factions public void OnJoinAccepted( Mobile mob ) { - PlayerMobile pm = mob as PlayerMobile; - - if ( pm == null ) + if ( !(mob is PlayerMobile pm) ) return; // sanity PlayerState pl = PlayerState.Find( pm ); @@ -483,7 +475,7 @@ namespace Server.Factions { Guild guild = pm.Guild as Guild; - if ( guild.Leader != pm ) + if ( guild?.Leader != pm ) pm.SendLocalizedMessage( 1005057 ); // You cannot join a faction because you are in a guild and not the guildmaster else if ( guild.Type != GuildType.Regular ) pm.SendLocalizedMessage( 1042161 ); // You cannot join a faction because your guild is an Order or Chaos type. @@ -499,9 +491,7 @@ namespace Server.Factions for ( int i = 0; i < members.Count; ++i ) { - PlayerMobile member = members[i] as PlayerMobile; - - if ( member == null ) + if ( !(members[i] is PlayerMobile member) ) continue; JoinGuilded( member, guild ); @@ -745,9 +735,9 @@ namespace Server.Factions public static void FactionCommander_OnTarget( Mobile from, object obj ) { - if ( obj is PlayerMobile ) + if ( obj is PlayerMobile mobile ) { - Mobile targ = (Mobile)obj; + Mobile targ = mobile; PlayerState pl = PlayerState.Find( targ ); if ( pl != null ) @@ -774,9 +764,9 @@ namespace Server.Factions public static void FactionElection_OnTarget( Mobile from, object obj ) { - if ( obj is FactionStone ) + if ( obj is FactionStone stone ) { - Faction faction = ((FactionStone)obj).Faction; + Faction faction = stone.Faction; if ( faction != null ) from.SendGump( new ElectionManagementGump( faction.Election ) ); @@ -798,10 +788,9 @@ namespace Server.Factions public static void FactionKick_OnTarget( Mobile from, object obj ) { - if ( obj is Mobile ) + if ( obj is Mobile mob ) { - Mobile mob = (Mobile) obj; - PlayerState pl = PlayerState.Find( (Mobile) mob ); + PlayerState pl = PlayerState.Find( mob ); if ( pl != null ) { @@ -1004,7 +993,7 @@ namespace Server.Factions public bool CanHandleInflux( int influx ) { - if( !StabilityActive()) + if ( !StabilityActive()) return true; Faction smallest = FindSmallestFaction(); @@ -1063,9 +1052,8 @@ namespace Server.Factions if ( killerState == null ) return; - if ( victim is BaseCreature ) + if ( victim is BaseCreature bc ) { - BaseCreature bc = (BaseCreature)victim; Faction victimFaction = bc.FactionAllegiance; if ( bc.Map == Faction.Facet && victimFaction != null && killerState.Faction != victimFaction ) @@ -1261,17 +1249,15 @@ namespace Server.Factions if ( pl != null ) return pl.Faction; - if ( inherit && mob is BaseCreature ) + if ( inherit && mob is BaseCreature bc ) { - BaseCreature bc = (BaseCreature)mob; - if ( bc.Controlled ) return Find( bc.ControlMaster, false ); - else if ( bc.Summoned ) + if ( bc.Summoned ) return Find( bc.SummonMaster, false ); - else if ( creatureAllegiances && mob is BaseFactionGuard ) - return ((BaseFactionGuard)mob).Faction; - else if ( creatureAllegiances ) + if ( creatureAllegiances && bc is BaseFactionGuard guard ) + return guard.Faction; + if ( creatureAllegiances ) return bc.FactionAllegiance; } @@ -1364,9 +1350,7 @@ namespace Server.Factions } case FactionKickType.Ban: { - Account acct = mob.Account as Account; - - if ( acct != null ) + if ( mob.Account is Account acct ) { if ( acct.GetTag( "FactionBanned" ) == null ) { @@ -1404,9 +1388,7 @@ namespace Server.Factions } case FactionKickType.Unban: { - Account acct = mob.Account as Account; - - if ( acct != null ) + if ( mob.Account is Account acct ) { if ( acct.GetTag( "FactionBanned" ) == null ) { diff --git a/Scripts/Engines/Factions/Core/FactionItem.cs b/Scripts/Engines/Factions/Core/FactionItem.cs index 8bb9c8201..88623d01b 100644 --- a/Scripts/Engines/Factions/Core/FactionItem.cs +++ b/Scripts/Engines/Factions/Core/FactionItem.cs @@ -45,17 +45,16 @@ namespace Server.Factions public void Attach() { - if ( m_Item is IFactionItem ) - ((IFactionItem)m_Item).FactionItemState = this; + if ( m_Item is IFactionItem item ) + item.FactionItemState = this; - if ( m_Faction != null ) - m_Faction.State.FactionItems.Add( this ); + m_Faction?.State.FactionItems.Add( this ); } public void Detach() { - if ( m_Item is IFactionItem ) - ((IFactionItem)m_Item).FactionItemState = null; + if ( m_Item is IFactionItem item ) + item.FactionItemState = null; if ( m_Faction != null && m_Faction.State.FactionItems.Contains( this ) ) m_Faction.State.FactionItems.Remove( this ); @@ -107,11 +106,11 @@ namespace Server.Factions public static FactionItem Find( Item item ) { - if ( item is IFactionItem ) + if ( item is IFactionItem factionItem ) { - FactionItem state = ((IFactionItem)item).FactionItemState; + FactionItem state = factionItem.FactionItemState; - if ( state != null && state.HasExpired ) + if ( state?.HasExpired == true ) { state.Detach(); state = null; @@ -143,4 +142,4 @@ namespace Server.Factions return item; } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Factions/Core/FactionState.cs b/Scripts/Engines/Factions/Core/FactionState.cs index 5b485ea54..6eb830e39 100644 --- a/Scripts/Engines/Factions/Core/FactionState.cs +++ b/Scripts/Engines/Factions/Core/FactionState.cs @@ -51,7 +51,7 @@ namespace Server.Factions for ( int i = 0; i < members.Count; ++i ) { PlayerState ps = members[i]; - + if ( ps.IsActive ) { ps.IsActive = false; @@ -219,7 +219,7 @@ namespace Server.Factions } m_Faction.State = this; - + m_Faction.ZeroRankOffset = m_Members.Count; m_Members.Sort(); @@ -254,9 +254,7 @@ namespace Server.Factions for ( int i = 0; i < factionTrapCount; ++i ) { - BaseFactionTrap trap = reader.ReadItem() as BaseFactionTrap; - - if ( trap != null && !trap.CheckDecay() ) + if ( reader.ReadItem() is BaseFactionTrap trap && !trap.CheckDecay() ) m_FactionTraps.Add( trap ); } } @@ -309,4 +307,4 @@ namespace Server.Factions writer.Write( (Item) m_FactionTraps[i] ); } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Factions/Core/Keywords.cs b/Scripts/Engines/Factions/Core/Keywords.cs index 15011967d..880fcf30a 100644 --- a/Scripts/Engines/Factions/Core/Keywords.cs +++ b/Scripts/Engines/Factions/Core/Keywords.cs @@ -40,8 +40,8 @@ namespace Server.Factions if ( FactionGump.Exists( from ) ) from.SendLocalizedMessage( 1042160 ); // You already have a faction menu open. - else if ( town.Owner != null && from is PlayerMobile ) - from.SendGump( new FinanceGump( (PlayerMobile)from, town.Owner, town ) ); + else if ( town.Owner != null && from is PlayerMobile mobile ) + mobile.SendGump( new FinanceGump( mobile, town.Owner, town ) ); break; } @@ -75,7 +75,7 @@ namespace Server.Factions { PlayerState pl = PlayerState.Find( from ); - if ( pl != null && pl.Finance != null ) + if ( pl?.Finance != null ) { pl.Finance.Finance = null; from.SendLocalizedMessage( 1005081 ); // You have been fired as Finance Minister @@ -87,7 +87,7 @@ namespace Server.Factions { PlayerState pl = PlayerState.Find( from ); - if ( pl != null && pl.Sheriff != null ) + if ( pl?.Sheriff != null ) { pl.Sheriff.Sheriff = null; from.SendLocalizedMessage( 1010270 ); // You have been fired as Sheriff @@ -99,16 +99,16 @@ namespace Server.Factions { PlayerState pl = PlayerState.Find( from ); - if ( pl != null && pl.IsLeaving ) + if ( pl?.IsLeaving == true ) { if ( Faction.CheckLeaveTimer( from ) ) break; TimeSpan remaining = ( pl.Leaving + Faction.LeavePeriod ) - DateTime.UtcNow; - if( remaining.TotalDays >= 1 ) + if ( remaining.TotalDays >= 1 ) from.SendLocalizedMessage( 1042743, remaining.TotalDays.ToString( "N0" ) ) ;// Your term of service will come to an end in ~1_DAYS~ days. - else if( remaining.TotalHours >= 1 ) + else if ( remaining.TotalHours >= 1 ) from.SendLocalizedMessage( 1042741, remaining.TotalHours.ToString( "N0" ) ); // Your term of service will come to an end in ~1_HOURS~ hours. else from.SendLocalizedMessage( 1042742 ); // Your term of service will come to an end in less than one hour. @@ -156,4 +156,4 @@ namespace Server.Factions } } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Factions/Core/PlayerState.cs b/Scripts/Engines/Factions/Core/PlayerState.cs index bdaae0bab..299cb7639 100644 --- a/Scripts/Engines/Factions/Core/PlayerState.cs +++ b/Scripts/Engines/Factions/Core/PlayerState.cs @@ -169,9 +169,8 @@ namespace Server.Factions public void Invalidate() { - if ( m_Mobile is PlayerMobile ) + if ( m_Mobile is PlayerMobile pm ) { - PlayerMobile pm = (PlayerMobile)m_Mobile; pm.InvalidateProperties(); pm.InvalidateMyRunUO(); } @@ -179,8 +178,8 @@ namespace Server.Factions public void Attach() { - if ( m_Mobile is PlayerMobile ) - ((PlayerMobile)m_Mobile).FactionPlayerState = this; + if ( m_Mobile is PlayerMobile mobile ) + mobile.FactionPlayerState = this; } public PlayerState( Mobile mob, Faction faction, List owner ) @@ -241,10 +240,7 @@ namespace Server.Factions public static PlayerState Find( Mobile mob ) { - if ( mob is PlayerMobile ) - return ((PlayerMobile)mob).FactionPlayerState; - - return null; + return mob is PlayerMobile mobile ? mobile.FactionPlayerState : null; } public int CompareTo( object obj ) diff --git a/Scripts/Engines/Factions/Core/Reflector.cs b/Scripts/Engines/Factions/Core/Reflector.cs index f174e58da..5c9f435cc 100644 --- a/Scripts/Engines/Factions/Core/Reflector.cs +++ b/Scripts/Engines/Factions/Core/Reflector.cs @@ -59,20 +59,16 @@ namespace Server.Factions if ( type.IsSubclassOf( typeof( Faction ) ) ) { - Faction faction = Construct( type ) as Faction; - - if ( faction != null ) + if ( Construct( type ) is Faction faction ) Faction.Factions.Add( faction ); } else if ( type.IsSubclassOf( typeof( Town ) ) ) { - Town town = Construct( type ) as Town; - - if ( town != null ) + if ( Construct( type ) is Town town ) Town.Towns.Add( town ); } } } } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Factions/Core/StrongholdRegion.cs b/Scripts/Engines/Factions/Core/StrongholdRegion.cs index 82b70507c..152a9c785 100644 --- a/Scripts/Engines/Factions/Core/StrongholdRegion.cs +++ b/Scripts/Engines/Factions/Core/StrongholdRegion.cs @@ -30,14 +30,10 @@ namespace Server.Factions if ( m.AccessLevel >= AccessLevel.Counselor || Contains( oldLocation ) ) return true; - - if ( m is PlayerMobile ) { - PlayerMobile pm = (PlayerMobile)m; - if ( pm.DuelContext != null ) { - m.SendMessage( "You may not enter this area while participating in a duel or a tournament." ); - return false; - } + if ( m is PlayerMobile pm && pm.DuelContext != null) { + pm.SendMessage( "You may not enter this area while participating in a duel or a tournament." ); + return false; } return ( Faction.Find( m, true, true ) != null ); @@ -48,4 +44,4 @@ namespace Server.Factions return false; } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Factions/Core/Town.cs b/Scripts/Engines/Factions/Core/Town.cs index b9e023223..f25253e33 100644 --- a/Scripts/Engines/Factions/Core/Town.cs +++ b/Scripts/Engines/Factions/Core/Town.cs @@ -134,13 +134,8 @@ namespace Server.Factions foreach ( BaseMonolith monolith in monoliths ) { - if ( monolith is TownMonolith ) - { - TownMonolith townMonolith = (TownMonolith)monolith; - - if ( townMonolith.Town == this ) - return townMonolith; - } + if ( monolith is TownMonolith townMonolith && townMonolith.Town == this ) + return townMonolith; } return null; @@ -184,20 +179,10 @@ namespace Server.Factions else if ( isSheriff ) type = "guard"; - if ( obj is BaseFactionVendor ) - { - BaseFactionVendor vendor = (BaseFactionVendor)obj; - - if ( vendor.Town == this && isFinance ) - vendor.Delete(); - } - else if ( obj is BaseFactionGuard ) - { - BaseFactionGuard guard = (BaseFactionGuard)obj; - - if ( guard.Town == this && isSheriff ) - guard.Delete(); - } + if ( obj is BaseFactionVendor vendor && vendor.Town == this && isFinance ) + vendor.Delete(); + else if ( obj is BaseFactionGuard guard && guard.Town == this && isSheriff ) + guard.Delete(); else { from.SendMessage( "That is not a {0}!", type ); @@ -208,16 +193,14 @@ namespace Server.Factions public void StartIncomeTimer() { - if ( m_IncomeTimer != null ) - m_IncomeTimer.Stop(); + m_IncomeTimer?.Stop(); m_IncomeTimer = Timer.DelayCall( TimeSpan.FromMinutes( 1.0 ), TimeSpan.FromMinutes( 1.0 ), new TimerCallback( CheckIncome ) ); } public void StopIncomeTimer() { - if ( m_IncomeTimer != null ) - m_IncomeTimer.Stop(); + m_IncomeTimer?.Stop(); m_IncomeTimer = null; } diff --git a/Scripts/Engines/Factions/Definitions/FactionItemDefinition.cs b/Scripts/Engines/Factions/Definitions/FactionItemDefinition.cs index 344b273fb..f93916f7b 100644 --- a/Scripts/Engines/Factions/Definitions/FactionItemDefinition.cs +++ b/Scripts/Engines/Factions/Definitions/FactionItemDefinition.cs @@ -28,9 +28,9 @@ namespace Server.Factions public static FactionItemDefinition Identify( Item item ) { - if ( item is BaseArmor ) + if ( item is BaseArmor armor ) { - if ( CraftResources.GetType( ((BaseArmor)item).Resource ) == CraftResourceType.Leather ) + if ( CraftResources.GetType( armor.Resource ) == CraftResourceType.Leather ) return m_LeatherArmor; return m_MetalArmor; @@ -38,14 +38,14 @@ namespace Server.Factions if ( item is BaseRanged ) return m_RangedWeapon; - else if ( item is BaseWeapon ) + if ( item is BaseWeapon ) return m_Weapon; - else if ( item is BaseClothing ) + if ( item is BaseClothing ) return m_Clothing; - else if ( item is SpellScroll ) + if ( item is SpellScroll ) return m_Scroll; return null; } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Factions/Gumps/ElectionManagementGump.cs b/Scripts/Engines/Factions/Gumps/ElectionManagementGump.cs index e1bee4ec7..5a64550ab 100644 --- a/Scripts/Engines/Factions/Gumps/ElectionManagementGump.cs +++ b/Scripts/Engines/Factions/Gumps/ElectionManagementGump.cs @@ -154,9 +154,9 @@ namespace Server.Factions { object obj = fields[j]; - if ( obj is Mobile ) + if ( obj is Mobile mobile ) { - AddHtml( x + 2, 140 + (idx * 20), 150, 20, Color( ((Mobile)obj).Name, LabelColor ), false, false ); + AddHtml( x + 2, 140 + (idx * 20), 150, 20, Color( mobile.Name, LabelColor ), false, false ); x += 150; } else if ( obj is System.Net.IPAddress ) @@ -164,14 +164,14 @@ namespace Server.Factions AddHtml( x, 140 + (idx * 20), 100, 20, Color( Center( obj.ToString() ), LabelColor ), false, false ); x += 100; } - else if ( obj is DateTime ) + else if ( obj is DateTime time ) { - AddHtml( x, 140 + (idx * 20), 80, 20, Color( Center( FormatTimeSpan( ((DateTime)obj) - election.LastStateTime ) ), LabelColor ), false, false ); + AddHtml( x, 140 + (idx * 20), 80, 20, Color( Center( FormatTimeSpan( time - election.LastStateTime ) ), LabelColor ), false, false ); x += 80; } - else if ( obj is int ) + else if ( obj is int i1 ) { - AddHtml( x, 140 + (idx * 20), 60, 20, Color( Center( (int)obj + "%" ), LabelColor ), false, false ); + AddHtml( x, 140 + (idx * 20), 60, 20, Color( Center( i1 + "%" ), LabelColor ), false, false ); x += 60; } } @@ -215,4 +215,4 @@ namespace Server.Factions } } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Factions/Gumps/FactionImbueGump.cs b/Scripts/Engines/Factions/Gumps/FactionImbueGump.cs index aad98a4fc..89a1be094 100644 --- a/Scripts/Engines/Factions/Gumps/FactionImbueGump.cs +++ b/Scripts/Engines/Factions/Gumps/FactionImbueGump.cs @@ -20,8 +20,8 @@ namespace Server.Factions private FactionItemDefinition m_Definition; - public FactionImbueGump( int quality, Item item, Mobile from, CraftSystem craftSystem, BaseTool tool, object notice, int availableSilver, Faction faction, FactionItemDefinition def ) : base( 100, 200 ) - { + public FactionImbueGump( int quality, Item item, Mobile from, CraftSystem craftSystem, BaseTool tool, object notice, int availableSilver, Faction faction, FactionItemDefinition def ) : base( 100, 200 ) + { m_Item = item; m_Mobile = from; m_Faction = faction; @@ -39,13 +39,13 @@ namespace Server.Factions AddHtmlLocalized( 20, 20, 210, 25, 1011569, false, false ); // Imbue with Faction properties? - AddHtmlLocalized( 20, 60, 170, 25, 1018302, false, false ); // Item quality: + AddHtmlLocalized( 20, 60, 170, 25, 1018302, false, false ); // Item quality: AddHtmlLocalized( 175, 60, 100, 25, 1018305 - m_Quality, false, false ); // Exceptional, Average, Low - AddHtmlLocalized( 20, 80, 170, 25, 1011572, false, false ); // Item Cost : + AddHtmlLocalized( 20, 80, 170, 25, 1011572, false, false ); // Item Cost : AddLabel( 175, 80, 0x34, def.SilverCost.ToString( "N0" ) ); // NOTE: Added 'N0' - AddHtmlLocalized( 20, 100, 170, 25, 1011573, false, false ); // Your Silver : + AddHtmlLocalized( 20, 100, 170, 25, 1011573, false, false ); // Your Silver : AddLabel( 175, 100, 0x34, availableSilver.ToString( "N0" ) ); // NOTE: Added 'N0' @@ -95,10 +95,10 @@ namespace Server.Factions if ( m_Tool != null && !m_Tool.Deleted && m_Tool.UsesRemaining > 0 ) m_Mobile.SendGump( new CraftGump( m_Mobile, m_CraftSystem, m_Tool, m_Notice ) ); - else if ( m_Notice is string ) - m_Mobile.SendMessage( (string) m_Notice ); - else if ( m_Notice is int && ((int)m_Notice) > 0 ) - m_Mobile.SendLocalizedMessage( (int) m_Notice ); + else if ( m_Notice is string s ) + m_Mobile.SendMessage( s ); + else if ( m_Notice is int i && i > 0 ) + m_Mobile.SendLocalizedMessage( i ); } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Factions/Gumps/LeaveFactionGump.cs b/Scripts/Engines/Factions/Gumps/LeaveFactionGump.cs index 8897ca358..1397636f1 100644 --- a/Scripts/Engines/Factions/Gumps/LeaveFactionGump.cs +++ b/Scripts/Engines/Factions/Gumps/LeaveFactionGump.cs @@ -20,7 +20,7 @@ namespace Server.Factions AddBackground( 0, 0, 270, 120, 5054 ); AddBackground( 10, 10, 250, 100, 3000 ); - if ( from.Guild is Guild && ((Guild)from.Guild).Leader == from ) + if ( from.Guild is Guild guild && guild.Leader == from ) AddHtmlLocalized( 20, 15, 230, 60, 1018057, true, true ); // Are you sure you want your entire guild to leave this faction? else AddHtmlLocalized( 20, 15, 230, 60, 1018063, true, true ); // Are you sure you want to leave this faction? @@ -38,9 +38,7 @@ namespace Server.Factions { case 1: // continue { - Guild guild = m_From.Guild as Guild; - - if ( guild == null ) + if ( !(m_From.Guild is Guild guild) ) { PlayerState pl = PlayerState.Find( m_From ); @@ -89,4 +87,4 @@ namespace Server.Factions } } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Factions/Gumps/TownStoneGump.cs b/Scripts/Engines/Factions/Gumps/TownStoneGump.cs index 2dc887f2a..64817078a 100644 --- a/Scripts/Engines/Factions/Gumps/TownStoneGump.cs +++ b/Scripts/Engines/Factions/Gumps/TownStoneGump.cs @@ -124,9 +124,8 @@ namespace Server.Factions { from.SendLocalizedMessage( 1010342 ); // You must fire your Sheriff before you can elect a new one } - else if ( obj is Mobile ) + else if ( obj is Mobile targ ) { - Mobile targ = (Mobile)obj; PlayerState pl = PlayerState.Find( targ ); if ( pl == null ) @@ -163,15 +162,13 @@ namespace Server.Factions if ( m_Town.Owner != m_Faction || !m_Faction.IsCommander( from ) ) { from.SendLocalizedMessage( 1010339 ); // You no longer control this city - return; } else if ( m_Town.Finance != null ) { from.SendLocalizedMessage( 1010342 ); // You must fire your Sheriff before you can elect a new one } - else if ( obj is Mobile ) + else if ( obj is Mobile targ ) { - Mobile targ = (Mobile)obj; PlayerState pl = PlayerState.Find( targ ); if ( pl == null ) @@ -203,4 +200,4 @@ namespace Server.Factions } } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Factions/Items/FactionStone.cs b/Scripts/Engines/Factions/Items/FactionStone.cs index 866a9af9b..03d6829d8 100644 --- a/Scripts/Engines/Factions/Items/FactionStone.cs +++ b/Scripts/Engines/Factions/Items/FactionStone.cs @@ -48,27 +48,27 @@ namespace Server.Factions { from.SendLocalizedMessage( 1042160 ); // You already have a faction menu open. } - else if ( from is PlayerMobile ) + else if ( from is PlayerMobile mobile ) { - Faction existingFaction = Faction.Find( from ); + Faction existingFaction = Faction.Find( mobile ); - if ( existingFaction == m_Faction || from.AccessLevel >= AccessLevel.GameMaster ) + if ( existingFaction == m_Faction || mobile.AccessLevel >= AccessLevel.GameMaster ) { - PlayerState pl = PlayerState.Find( from ); + PlayerState pl = PlayerState.Find( mobile ); if ( pl != null && pl.IsLeaving ) - from.SendLocalizedMessage( 1005051 ); // You cannot use the faction stone until you have finished quitting your current faction + mobile.SendLocalizedMessage( 1005051 ); // You cannot use the faction stone until you have finished quitting your current faction else - from.SendGump( new FactionStoneGump( (PlayerMobile) from, m_Faction ) ); + mobile.SendGump( new FactionStoneGump( mobile, m_Faction ) ); } else if ( existingFaction != null ) { // TODO: Validate - from.SendLocalizedMessage( 1005053 ); // This is not your faction stone! + mobile.SendLocalizedMessage( 1005053 ); // This is not your faction stone! } else { - from.SendGump( new JoinStoneGump( (PlayerMobile) from, m_Faction ) ); + mobile.SendGump( new JoinStoneGump( mobile, m_Faction ) ); } } } diff --git a/Scripts/Engines/Factions/Items/JoinStone.cs b/Scripts/Engines/Factions/Items/JoinStone.cs index 931e9468f..bd3b409d9 100644 --- a/Scripts/Engines/Factions/Items/JoinStone.cs +++ b/Scripts/Engines/Factions/Items/JoinStone.cs @@ -45,8 +45,8 @@ namespace Server.Factions from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that. else if ( FactionGump.Exists( from ) ) from.SendLocalizedMessage( 1042160 ); // You already have a faction menu open. - else if ( Faction.Find( from ) == null && from is PlayerMobile ) - from.SendGump( new JoinStoneGump( (PlayerMobile) from, m_Faction ) ); + else if ( Faction.Find( from ) == null && from is PlayerMobile mobile ) + mobile.SendGump( new JoinStoneGump( mobile, m_Faction ) ); } public JoinStone( Serial serial ) : base( serial ) diff --git a/Scripts/Engines/Factions/Items/Power Faction Items/ClarityPotion.cs b/Scripts/Engines/Factions/Items/Power Faction Items/ClarityPotion.cs index ba058d510..a73943a94 100644 --- a/Scripts/Engines/Factions/Items/Power Faction Items/ClarityPotion.cs +++ b/Scripts/Engines/Factions/Items/Power Faction Items/ClarityPotion.cs @@ -49,7 +49,7 @@ namespace Server { from.PlaySound( 0x1EE ); from.AddStatMod( new StatMod( StatType.Int, "clarity-potion", amount, TimeSpan.FromMinutes( time ) ) ); - Timer.DelayCall( TimeSpan.FromMinutes( time ), delegate() { + Timer.DelayCall( TimeSpan.FromMinutes( time ), delegate { from.EndAction( typeof( ClarityPotion ) ); } ); @@ -71,4 +71,4 @@ namespace Server { int version = reader.ReadEncodedInt(); } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Factions/Items/Power Faction Items/PowerFactionItem.cs b/Scripts/Engines/Factions/Items/Power Faction Items/PowerFactionItem.cs index 6cfee7825..1fc064fe3 100644 --- a/Scripts/Engines/Factions/Items/Power Faction Items/PowerFactionItem.cs +++ b/Scripts/Engines/Factions/Items/Power Faction Items/PowerFactionItem.cs @@ -119,16 +119,16 @@ namespace Server { public override void OnDoubleClick( Mobile from ) { if ( !IsChildOf( from.Backpack ) ) { from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it. - } else if ( from is PlayerMobile && ((PlayerMobile)from).DuelContext != null ) { - from.SendMessage( "You can't use that." ); + } else if ( from is PlayerMobile mobile && mobile.DuelContext != null ) { + mobile.SendMessage( "You can't use that." ); } else if ( Faction.Find( from ) == null ) { from.LocalOverheadMessage( Server.Network.MessageType.Regular, 2119, false, "The object vanishes from your hands as you touch it." ); - Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), delegate() { + Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), delegate { from.LocalOverheadMessage( Server.Network.MessageType.Regular, 2118, false, "You feel a strange tingling sensation throughout your body." ); } ); - Timer.DelayCall( TimeSpan.FromSeconds( 4.0 ), delegate() { + Timer.DelayCall( TimeSpan.FromSeconds( 4.0 ), delegate { from.LocalOverheadMessage( Server.Network.MessageType.Regular, 2118, false, "Your skin begins to burn." ); } ); @@ -162,4 +162,4 @@ namespace Server { int version = reader.ReadEncodedInt(); } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Factions/Items/Power Faction Items/StormsEye.cs b/Scripts/Engines/Factions/Items/Power Faction Items/StormsEye.cs index 3e292bda5..9956b03e6 100644 --- a/Scripts/Engines/Factions/Items/Power Faction Items/StormsEye.cs +++ b/Scripts/Engines/Factions/Items/Power Faction Items/StormsEye.cs @@ -30,9 +30,7 @@ namespace Server { if ( this.Movable ) { user.BeginTarget( 12, true, Server.Targeting.TargetFlags.None, delegate( Mobile from, object obj ) { if ( this.Movable && !this.Deleted ) { - IPoint3D pt = obj as IPoint3D; - - if ( pt != null ) { + if ( obj is IPoint3D pt ) { SpellHelper.GetSurfaceTop( ref pt ); Point3D origin = new Point3D( pt ); @@ -46,7 +44,7 @@ namespace Server { this.ItemID & 0x3FFF, 7, 0, false, false, this.Hue - 1, 0 ); - Timer.DelayCall( TimeSpan.FromSeconds( 0.5 ), delegate() { + Timer.DelayCall( TimeSpan.FromSeconds( 0.5 ), delegate { this.Delete(); Effects.PlaySound( origin, facet, 530 ); @@ -57,7 +55,7 @@ namespace Server { 14284, 96, 1, 0, 2 ); - Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), delegate() { + Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), delegate { List targets = new List(); foreach ( Mobile mob in facet.GetMobilesInRange( origin, 12 ) ) { @@ -88,7 +86,7 @@ namespace Server { SpellHelper.Damage( TimeSpan.FromSeconds( 0.70 ), mob, from, damage / 3, 0, 0, 0, 0, 100 ); SpellHelper.Damage( TimeSpan.FromSeconds( 1.00 ), mob, from, damage / 3, 0, 0, 0, 0, 100 ); - Timer.DelayCall( TimeSpan.FromSeconds( 0.50 ), delegate() { + Timer.DelayCall( TimeSpan.FromSeconds( 0.50 ), delegate { mob.PlaySound( 0x1FB ); } ); } @@ -115,4 +113,4 @@ namespace Server { int version = reader.ReadEncodedInt(); } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Factions/Items/Sigil.cs b/Scripts/Engines/Factions/Items/Sigil.cs index 9b91eec1e..338446bcc 100644 --- a/Scripts/Engines/Factions/Items/Sigil.cs +++ b/Scripts/Engines/Factions/Items/Sigil.cs @@ -15,7 +15,7 @@ namespace Server.Factions public static readonly TimeSpan CorruptionGrace = TimeSpan.FromMinutes( (Core.SE) ? 30.0 : 15.0 ); // Sigil must be held at a stronghold for this amount of time in order to become corrupted - public static readonly TimeSpan CorruptionPeriod = ( (Core.SE) ? TimeSpan.FromHours( 10.0 ) : TimeSpan.FromHours( 24.0 ) ); + public static readonly TimeSpan CorruptionPeriod = ( (Core.SE) ? TimeSpan.FromHours( 10.0 ) : TimeSpan.FromHours( 24.0 ) ); // After a sigil has been corrupted it must be returned to the town within this period of time public static readonly TimeSpan ReturnPeriod = TimeSpan.FromHours( 1.0 ); @@ -177,11 +177,11 @@ namespace Server.Factions private Mobile FindOwner( object parent ) { - if ( parent is Item ) - return ((Item)parent).RootParent as Mobile; + if ( parent is Item item ) + return item.RootParent as Mobile; - if ( parent is Mobile ) - return (Mobile) parent; + if ( parent is Mobile mobile ) + return mobile; return null; } @@ -227,7 +227,7 @@ namespace Server.Factions { Container pack = mob.Backpack; - return ( pack != null && pack.FindItemByType( typeof( Sigil ) ) != null ); + return ( pack?.FindItemByType( typeof( Sigil ) ) != null ); } private void BeginCorrupting( Faction faction ) @@ -267,10 +267,8 @@ namespace Server.Factions #region Give To Mobile if ( obj is Mobile ) { - if ( obj is PlayerMobile ) + if ( obj is PlayerMobile targ ) { - PlayerMobile targ = (PlayerMobile)obj; - Faction toFaction = Faction.Find( targ ); Faction fromFaction = Faction.Find( from ); @@ -280,14 +278,13 @@ namespace Server.Factions from.SendLocalizedMessage( 1005222 ); // You cannot give the sigil to someone not in your faction else if ( Sigil.ExistsOn( targ ) ) from.SendLocalizedMessage( 1005220 ); // You cannot give this sigil to someone who already has a sigil - else if( !targ.Alive ) + else if ( !targ.Alive ) from.SendLocalizedMessage( 1042248 ); // You cannot give a sigil to a dead person. else if ( from.NetState != null && targ.NetState != null ) { Container pack = targ.Backpack; - if ( pack != null ) - pack.DropItem( this ); + pack?.DropItem( this ); } } else @@ -299,19 +296,17 @@ namespace Server.Factions else if ( obj is BaseMonolith ) { #region Put in Stronghold - if ( obj is StrongholdMonolith ) + if ( obj is StrongholdMonolith sm ) { - StrongholdMonolith m = (StrongholdMonolith)obj; - - if ( m.Faction == null || m.Faction != Faction.Find( from ) ) + if ( sm.Faction == null || sm.Faction != Faction.Find( from ) ) from.SendLocalizedMessage( 1042246 ); // You can't place that on an enemy monolith - else if ( m.Town == null || m.Town != m_Town ) + else if ( sm.Town == null || sm.Town != m_Town ) from.SendLocalizedMessage( 1042247 ); // That is not the correct faction monolith else { - m.Sigil = this; + sm.Sigil = this; - Faction newController = m.Faction; + Faction newController = sm.Faction; Faction oldController = m_Corrupting; if ( oldController == null ) @@ -343,17 +338,15 @@ namespace Server.Factions #endregion #region Put in Town - else if ( obj is TownMonolith ) + else if ( obj is TownMonolith tm ) { - TownMonolith m = (TownMonolith)obj; - - if ( m.Town == null || m.Town != m_Town ) + if ( tm.Town == null || tm.Town != m_Town ) from.SendLocalizedMessage( 1042245 ); // This is not the correct town sigil monolith else if ( m_Corrupted == null || m_Corrupted != Faction.Find( from ) ) from.SendLocalizedMessage( 1042244 ); // Your faction did not corrupt this sigil. Take it to your stronghold. else { - m.Sigil = this; + tm.Sigil = this; m_Corrupting = null; m_PurificationStart = DateTime.UtcNow; @@ -367,7 +360,7 @@ namespace Server.Factions } else { - from.SendLocalizedMessage( 1005224 ); // You can't use the sigil on that + from.SendLocalizedMessage( 1005224 ); // You can't use the sigil on that } Update(); @@ -419,9 +412,7 @@ namespace Server.Factions Update(); - Mobile mob = RootParent as Mobile; - - if ( mob != null ) + if ( RootParent is Mobile mob ) mob.SolidHueOverride = OwnershipHue; break; @@ -468,4 +459,4 @@ namespace Server.Factions public static List Sigils{ get{ return m_Sigils; } } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Factions/Items/TownStone.cs b/Scripts/Engines/Factions/Items/TownStone.cs index f543a75f5..90c1ce9ef 100644 --- a/Scripts/Engines/Factions/Items/TownStone.cs +++ b/Scripts/Engines/Factions/Items/TownStone.cs @@ -51,8 +51,8 @@ namespace Server.Factions from.SendLocalizedMessage( 1005242 ); // Only faction Leaders can use townstones else if ( FactionGump.Exists( from ) ) from.SendLocalizedMessage( 1042160 ); // You already have a faction menu open. - else if ( from is PlayerMobile ) - from.SendGump( new TownStoneGump( (PlayerMobile)from, m_Town.Owner, m_Town ) ); + else if ( @from is PlayerMobile mobile ) + mobile.SendGump( new TownStoneGump( mobile, m_Town.Owner, m_Town ) ); } public TownStone( Serial serial ) : base( serial ) diff --git a/Scripts/Engines/Factions/Items/Traps/BaseFactionTrap.cs b/Scripts/Engines/Factions/Items/Traps/BaseFactionTrap.cs index 7a79cfda7..207e72702 100644 --- a/Scripts/Engines/Factions/Items/Traps/BaseFactionTrap.cs +++ b/Scripts/Engines/Factions/Items/Traps/BaseFactionTrap.cs @@ -110,7 +110,7 @@ namespace Server.Factions public abstract void DoVisibleEffect(); public abstract void DoAttackEffect( Mobile m ); - + public virtual int IsValidLocation() { return IsValidLocation( GetWorldLocation(), Map ); @@ -118,14 +118,14 @@ namespace Server.Factions public virtual int IsValidLocation( Point3D p, Map m ) { - if( m == null ) + if ( m == null ) return 502956; // You cannot place a trap on that. - if( Core.ML ) + if ( Core.ML ) { foreach( Item item in m.GetItemsInRange( p, 0 ) ) { - if( item is BaseFactionTrap && ((BaseFactionTrap)item).Faction == this.Faction ) + if ( item is BaseFactionTrap trap && trap.Faction == this.Faction ) return 1075263; // There is already a trap belonging to your faction at this location.; } } @@ -282,8 +282,8 @@ namespace Server.Factions Faction faction = Faction.Find( mob, true ); - if ( faction == null && mob is BaseFactionGuard ) - faction = ((BaseFactionGuard)mob).Faction; + if ( faction == null && mob is BaseFactionGuard guard ) + faction = guard.Faction; if ( faction == null ) return false; @@ -291,4 +291,4 @@ namespace Server.Factions return ( faction != m_Faction ); } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Factions/Items/Traps/BaseFactionTrapDeed.cs b/Scripts/Engines/Factions/Items/Traps/BaseFactionTrapDeed.cs index 98f2768b2..d55b553b1 100644 --- a/Scripts/Engines/Factions/Items/Traps/BaseFactionTrapDeed.cs +++ b/Scripts/Engines/Factions/Items/Traps/BaseFactionTrapDeed.cs @@ -54,9 +54,9 @@ namespace Server.Factions from.SendLocalizedMessage( 1010353, "", 0x23 ); // Only faction members may place faction traps else if ( faction != m_Faction ) from.SendLocalizedMessage( 1010354, "", 0x23 ); // You may only place faction traps created by your faction - else if( faction.Traps.Count >= faction.MaximumTraps ) + else if ( faction.Traps.Count >= faction.MaximumTraps ) from.SendLocalizedMessage( 1010358, "", 0x23 ); // Your faction already has the maximum number of traps placed - else + else { BaseFactionTrap trap = Construct( from ); @@ -109,4 +109,4 @@ namespace Server.Factions #endregion } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Factions/Mobiles/Guards/BaseFactionGuard.cs b/Scripts/Engines/Factions/Mobiles/Guards/BaseFactionGuard.cs index 2780b7450..abf1183e7 100644 --- a/Scripts/Engines/Factions/Mobiles/Guards/BaseFactionGuard.cs +++ b/Scripts/Engines/Factions/Mobiles/Guards/BaseFactionGuard.cs @@ -62,8 +62,8 @@ namespace Server.Factions Faction ourFaction = m_Faction; Faction theirFaction = Faction.Find( m ); - if ( theirFaction == null && m is BaseFactionGuard ) - theirFaction = ((BaseFactionGuard)m).Faction; + if ( theirFaction == null && m is BaseFactionGuard guard ) + theirFaction = guard.Faction; if ( ourFaction != null && theirFaction != null && ourFaction != theirFaction ) { @@ -72,22 +72,14 @@ namespace Server.Factions if ( reactionType == ReactionType.Attack ) return true; - if ( theirFaction != null ) + List list = m.Aggressed; + + for ( int i = 0; i < list.Count; ++i ) { - List list = m.Aggressed; + AggressorInfo ai = list[i]; - for ( int i = 0; i < list.Count; ++i ) - { - AggressorInfo ai = list[i]; - - if ( ai.Defender is BaseFactionGuard ) - { - BaseFactionGuard bf = (BaseFactionGuard)ai.Defender; - - if ( bf.Faction == ourFaction ) - return true; - } - } + if ( ai.Defender is BaseFactionGuard bf && bf.Faction == ourFaction ) + return true; } } diff --git a/Scripts/Engines/Factions/Mobiles/Guards/GuardAI.cs b/Scripts/Engines/Factions/Mobiles/Guards/GuardAI.cs index 76efea725..0958df537 100644 --- a/Scripts/Engines/Factions/Mobiles/Guards/GuardAI.cs +++ b/Scripts/Engines/Factions/Mobiles/Guards/GuardAI.cs @@ -165,9 +165,7 @@ namespace Server.Factions if ( pack == null ) return false; - Item weapon = m_Guard.Weapon as Item; - - if ( weapon != null && weapon.Parent == m_Guard && !(weapon is Fists) ) + if ( m_Guard.Weapon is Item weapon && weapon.Parent == m_Guard && !(weapon is Fists) ) { pack.DropItem( weapon ); return true; @@ -180,10 +178,7 @@ namespace Server.Factions { Container pack = m_Guard.Backpack; - if ( pack == null ) - return false; - - Item weapon = pack.FindItemByType( typeof( BaseWeapon ) ); + Item weapon = pack?.FindItemByType( typeof( BaseWeapon ) ); if ( weapon == null ) return false; @@ -197,10 +192,7 @@ namespace Server.Factions Container pack = m_Guard.Backpack; - if ( pack == null ) - return false; - - Item bandage = pack.FindItemByType( typeof( Bandage ) ); + Item bandage = pack?.FindItemByType( typeof( Bandage ) ); if ( bandage == null ) return false; @@ -214,10 +206,7 @@ namespace Server.Factions { Container pack = m_Guard.Backpack; - if ( pack == null ) - return false; - - Item item = pack.FindItemByType( type ); + Item item = pack?.FindItemByType( type ); if ( item == null ) return false; @@ -375,7 +364,7 @@ namespace Server.Factions public bool CanDispel( Mobile m ) { - return ( m is BaseCreature && ((BaseCreature)m).Summoned && m_Mobile.CanBeHarmful( m, false ) && !((BaseCreature)m).IsAnimatedDead ); + return ( m is BaseCreature creature && creature.Summoned && m_Mobile.CanBeHarmful( creature, false ) && !creature.IsAnimatedDead ); } public void RunTo( Mobile m ) @@ -606,7 +595,7 @@ namespace Server.Factions } else if ( IsDamaged && (m_Guard.HitsMax - m_Guard.Hits) > Utility.Random( 200 ) ) { - if( IsAllowed( GuardAI.Magic ) && ((m_Guard.Hits * 100) / Math.Max( m_Guard.HitsMax, 1 )) < 10 && m_Guard.Home != Point3D.Zero && !Utility.InRange( m_Guard.Location, m_Guard.Home, 15 ) && m_Guard.Mana >= 11 ) + if ( IsAllowed( GuardAI.Magic ) && ((m_Guard.Hits * 100) / Math.Max( m_Guard.HitsMax, 1 )) < 10 && m_Guard.Home != Point3D.Zero && !Utility.InRange( m_Guard.Location, m_Guard.Home, 15 ) && m_Guard.Mana >= 11 ) { spell = new RecallSpell( m_Guard, null, new RunebookEntry( m_Guard.Home, m_Guard.Map, "Guard's Home", null ), null ); } @@ -768,7 +757,7 @@ namespace Server.Factions if ( spell == null || !spell.Cast() ) EquipWeapon(); } - else if ( m_Mobile.Spell is Spell && ((Spell)m_Mobile.Spell).State == SpellState.Sequencing ) + else if ( m_Mobile.Spell is Spell spell && spell.State == SpellState.Sequencing ) { EquipWeapon(); } @@ -776,4 +765,4 @@ namespace Server.Factions return true; } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Factions/Mobiles/Guards/Types/FactionKnight.cs b/Scripts/Engines/Factions/Mobiles/Guards/Types/FactionKnight.cs index 2adba7ece..d9807444e 100644 --- a/Scripts/Engines/Factions/Mobiles/Guards/Types/FactionKnight.cs +++ b/Scripts/Engines/Factions/Mobiles/Guards/Types/FactionKnight.cs @@ -40,7 +40,7 @@ namespace Server.Factions AddItem( Immovable( Rehued( new ChainChest(), 2125 ) ) ); AddItem( Immovable( Rehued( new ChainLegs(), 2125 ) ) ); - AddItem( Immovable( Rehued( new ChainCoif(), 2125 ) ) ); + AddItem( Immovable( Rehued( new ChainCoif (), 2125 ) ) ); AddItem( Immovable( Rehued( new PlateArms(), 2125 ) ) ); AddItem( Immovable( Rehued( new PlateGloves(), 2125 ) ) ); diff --git a/Scripts/Engines/Factions/Mobiles/Guards/Types/FactionMercenary.cs b/Scripts/Engines/Factions/Mobiles/Guards/Types/FactionMercenary.cs index be46c9b03..e322c5f13 100644 --- a/Scripts/Engines/Factions/Mobiles/Guards/Types/FactionMercenary.cs +++ b/Scripts/Engines/Factions/Mobiles/Guards/Types/FactionMercenary.cs @@ -36,7 +36,7 @@ namespace Server.Factions AddItem( new ChainLegs() ); AddItem( new RingmailArms() ); AddItem( new RingmailGloves() ); - AddItem( new ChainCoif() ); + AddItem( new ChainCoif () ); AddItem( new Boots() ); AddItem( Newbied( new ShortSpear() ) ); diff --git a/Scripts/Engines/Factions/Mobiles/Vendors/FactionHorseVendor.cs b/Scripts/Engines/Factions/Mobiles/Vendors/FactionHorseVendor.cs index cabac7eac..7faf92b7e 100644 --- a/Scripts/Engines/Factions/Mobiles/Vendors/FactionHorseVendor.cs +++ b/Scripts/Engines/Factions/Mobiles/Vendors/FactionHorseVendor.cs @@ -14,7 +14,7 @@ namespace Server.Factions { SetSkill( SkillName.AnimalLore, 64.0, 100.0 ); SetSkill( SkillName.AnimalTaming, 90.0, 100.0 ); - SetSkill( SkillName.Veterinary, 65.0, 88.0 ); + SetSkill( SkillName.Veterinary, 65.0, 88.0 ); } public override void InitSBInfo() @@ -48,8 +48,8 @@ namespace Server.Factions PrivateOverheadMessage( MessageType.Regular, 0x3B2, 1042201, from.NetState ); // You are not in my faction, I cannot sell you a horse! else if ( FactionGump.Exists( from ) ) from.SendLocalizedMessage( 1042160 ); // You already have a faction menu open. - else if ( from is PlayerMobile ) - from.SendGump( new HorseBreederGump( (PlayerMobile) from, this.Faction ) ); + else if ( @from is PlayerMobile mobile ) + mobile.SendGump( new HorseBreederGump( mobile, this.Faction ) ); } public override void VendorSell( Mobile from ) @@ -80,4 +80,4 @@ namespace Server.Factions int version = reader.ReadInt(); } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Harvest/Core/HarvestDefinition.cs b/Scripts/Engines/Harvest/Core/HarvestDefinition.cs index 86cc1e0df..61a855d90 100644 --- a/Scripts/Engines/Harvest/Core/HarvestDefinition.cs +++ b/Scripts/Engines/Harvest/Core/HarvestDefinition.cs @@ -63,10 +63,10 @@ namespace Server.Engines.Harvest public void SendMessageTo( Mobile from, object message ) { - if ( message is int ) - from.SendLocalizedMessage( (int)message ); - else if ( message is string ) - from.SendMessage( (string)message ); + if ( message is int messageInt ) + from.SendLocalizedMessage( messageInt ); + else + from.SendMessage( message.ToString() ); } public HarvestBank GetBank( Map map, int x, int y ) diff --git a/Scripts/Engines/Harvest/Core/HarvestResource.cs b/Scripts/Engines/Harvest/Core/HarvestResource.cs index 05ff7d453..029a42dbe 100644 --- a/Scripts/Engines/Harvest/Core/HarvestResource.cs +++ b/Scripts/Engines/Harvest/Core/HarvestResource.cs @@ -16,10 +16,10 @@ namespace Server.Engines.Harvest public void SendSuccessTo( Mobile m ) { - if ( m_SuccessMessage is int ) - m.SendLocalizedMessage( (int)m_SuccessMessage ); - else if ( m_SuccessMessage is string ) - m.SendMessage( (string)m_SuccessMessage ); + if ( m_SuccessMessage is int messageInt ) + m.SendLocalizedMessage( messageInt ); + else + m.SendMessage( m_SuccessMessage.ToString() ); } public HarvestResource( double reqSkill, double minSkill, double maxSkill, object message, params Type[] types ) @@ -31,4 +31,4 @@ namespace Server.Engines.Harvest m_SuccessMessage = message; } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Harvest/Core/HarvestSystem.cs b/Scripts/Engines/Harvest/Core/HarvestSystem.cs index 890447d35..0edd0673f 100644 --- a/Scripts/Engines/Harvest/Core/HarvestSystem.cs +++ b/Scripts/Engines/Harvest/Core/HarvestSystem.cs @@ -20,7 +20,7 @@ namespace Server.Engines.Harvest public virtual bool CheckTool( Mobile from, Item tool ) { - bool wornOut = ( tool == null || tool.Deleted || (tool is IUsesRemaining && ((IUsesRemaining)tool).UsesRemaining <= 0) ); + bool wornOut = ( tool == null || tool.Deleted || (tool is IUsesRemaining remaining && remaining.UsesRemaining <= 0) ); if ( wornOut ) from.SendLocalizedMessage( 1044038 ); // You have worn out your tool! @@ -176,11 +176,11 @@ namespace Server.Engines.Harvest bool eligableForRacialBonus = ( def.RaceBonus && from.Race == Race.Human ); bool inFelucca = (map == Map.Felucca); - if( eligableForRacialBonus && inFelucca && bank.Current >= feluccaRacialAmount && 0.1 > Utility.RandomDouble() ) + if ( eligableForRacialBonus && inFelucca && bank.Current >= feluccaRacialAmount && 0.1 > Utility.RandomDouble() ) item.Amount = feluccaRacialAmount; - else if( inFelucca && bank.Current >= feluccaAmount ) + else if ( inFelucca && bank.Current >= feluccaAmount ) item.Amount = feluccaAmount; - else if( eligableForRacialBonus && bank.Current >= racialAmount && 0.1 > Utility.RandomDouble() ) + else if ( eligableForRacialBonus && bank.Current >= racialAmount && 0.1 > Utility.RandomDouble() ) item.Amount = racialAmount; else item.Amount = amount; @@ -214,10 +214,8 @@ namespace Server.Engines.Harvest } } - if ( tool is IUsesRemaining ) + if ( tool is IUsesRemaining toolWithUses ) { - IUsesRemaining toolWithUses = (IUsesRemaining)tool; - toolWithUses.ShowUsesRemaining = true; if ( toolWithUses.UsesRemaining > 0 ) @@ -316,7 +314,7 @@ namespace Server.Engines.Harvest { bool racialBonus = (def.RaceBonus && from.Race == Race.Elf ); - if( vein.ChanceToFallback > (Utility.RandomDouble() + (racialBonus ? .20 : 0)) ) + if ( vein.ChanceToFallback > (Utility.RandomDouble() + (racialBonus ? .20 : 0)) ) return fallback; double skillValue = from.Skills[def.Skill].Value; @@ -447,29 +445,23 @@ namespace Server.Engines.Harvest public virtual bool GetHarvestDetails( Mobile from, Item tool, object toHarvest, out int tileID, out Map map, out Point3D loc ) { - if ( toHarvest is Static && !((Static)toHarvest).Movable ) + if ( toHarvest is Static staticObj && !staticObj.Movable ) { - Static obj = (Static)toHarvest; - - tileID = (obj.ItemID & 0x3FFF) | 0x4000; - map = obj.Map; - loc = obj.GetWorldLocation(); + tileID = (staticObj.ItemID & 0x3FFF) | 0x4000; + map = staticObj.Map; + loc = staticObj.GetWorldLocation(); } - else if ( toHarvest is StaticTarget ) + else if ( toHarvest is StaticTarget staticTarget ) { - StaticTarget obj = (StaticTarget)toHarvest; - - tileID = (obj.ItemID & 0x3FFF) | 0x4000; + tileID = (staticTarget.ItemID & 0x3FFF) | 0x4000; map = from.Map; - loc = obj.Location; + loc = staticTarget.Location; } - else if ( toHarvest is LandTarget ) + else if ( toHarvest is LandTarget landTarget ) { - LandTarget obj = (LandTarget)toHarvest; - - tileID = obj.TileID; + tileID = landTarget.TileID; map = from.Map; - loc = obj.Location; + loc = landTarget.Location; } else { diff --git a/Scripts/Engines/Harvest/Core/HarvestTarget.cs b/Scripts/Engines/Harvest/Core/HarvestTarget.cs index 33d79e891..ecb42ae8d 100644 --- a/Scripts/Engines/Harvest/Core/HarvestTarget.cs +++ b/Scripts/Engines/Harvest/Core/HarvestTarget.cs @@ -24,53 +24,45 @@ namespace Server.Engines.Harvest protected override void OnTarget( Mobile from, object targeted ) { - if ( m_System is Mining && targeted is StaticTarget ) + if ( m_System is Mining && targeted is StaticTarget target ) { - int itemID = ((StaticTarget)targeted).ItemID; + int itemID = target.ItemID; // grave if ( itemID == 0xED3 || itemID == 0xEDF || itemID == 0xEE0 || itemID == 0xEE1 || itemID == 0xEE2 || itemID == 0xEE8 ) { - PlayerMobile player = from as PlayerMobile; - - if ( player != null ) + if ( from is PlayerMobile player ) { QuestSystem qs = player.Quest; - if ( qs is WitchApprenticeQuest ) + if ( qs is WitchApprenticeQuest && qs.FindObjective( typeof( FindIngredientObjective ) ) is FindIngredientObjective obj && !obj.Completed && obj.Ingredient == Ingredient.Bones ) { - FindIngredientObjective obj = qs.FindObjective( typeof( FindIngredientObjective ) ) as FindIngredientObjective; + player.SendLocalizedMessage( 1055037 ); // You finish your grim work, finding some of the specific bones listed in the Hag's recipe. + obj.Complete(); - if ( obj != null && !obj.Completed && obj.Ingredient == Ingredient.Bones ) - { - player.SendLocalizedMessage( 1055037 ); // You finish your grim work, finding some of the specific bones listed in the Hag's recipe. - obj.Complete(); - - return; - } + return; } } } } - if ( m_System is Lumberjacking && targeted is IChopable ) - ((IChopable)targeted).OnChop( from ); - else if ( m_System is Lumberjacking && targeted is IAxe && m_Tool is BaseAxe ) + if ( m_System is Lumberjacking && targeted is IChopable chopable ) + chopable.OnChop( from ); + else if ( m_System is Lumberjacking && targeted is IAxe obj && m_Tool is BaseAxe axe ) { - IAxe obj = (IAxe)targeted; - Item item = (Item)targeted; - + Item item = (Item)obj; + if ( !item.IsChildOf( from.Backpack ) ) from.SendLocalizedMessage( 1062334 ); // This item must be in your backpack to be used. - else if ( obj.Axe( from, (BaseAxe)m_Tool ) ) + else if ( obj.Axe( from, axe ) ) from.PlaySound( 0x13E ); } - else if ( m_System is Lumberjacking && targeted is ICarvable ) - ((ICarvable)targeted).Carve( from, (Item)m_Tool ); + else if ( m_System is Lumberjacking && targeted is ICarvable carvable ) + carvable.Carve( from, m_Tool ); else if ( m_System is Lumberjacking && FurnitureAttribute.Check( targeted as Item ) ) DestroyFurniture( from, (Item)targeted ); - else if ( m_System is Mining && targeted is TreasureMap ) - ((TreasureMap)targeted).OnBeginDig( from ); + else if ( m_System is Mining && targeted is TreasureMap map ) + map.OnBeginDig( from ); else m_System.StartHarvesting( from, m_Tool, targeted ); } @@ -82,7 +74,7 @@ namespace Server.Engines.Harvest from.SendLocalizedMessage( 500446 ); // That is too far away. return; } - else if ( !item.IsChildOf( from.Backpack ) && !item.Movable ) + if ( !item.IsChildOf( from.Backpack ) && !item.Movable ) { from.SendLocalizedMessage( 500462 ); // You can't destroy that while it is here. return; @@ -91,12 +83,12 @@ namespace Server.Engines.Harvest from.SendLocalizedMessage( 500461 ); // You destroy the item. Effects.PlaySound( item.GetWorldLocation(), item.Map, 0x3B3 ); - if ( item is Container ) + if ( item is Container container ) { - if ( item is TrappableContainer ) - (item as TrappableContainer).ExecuteTrap( from ); + if ( container is TrappableContainer trappableContainer ) + trappableContainer.ExecuteTrap( from ); - ((Container)item).Destroy(); + container.Destroy(); } else { @@ -104,4 +96,4 @@ namespace Server.Engines.Harvest } } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Harvest/Fishing.cs b/Scripts/Engines/Harvest/Fishing.cs index c950f5ae2..03eb00009 100644 --- a/Scripts/Engines/Harvest/Fishing.cs +++ b/Scripts/Engines/Harvest/Fishing.cs @@ -140,9 +140,7 @@ namespace Server.Engines.Harvest public override bool SpecialHarvest( Mobile from, Item tool, HarvestDefinition def, Map map, Point3D loc ) { - PlayerMobile player = from as PlayerMobile; - - if ( player != null ) + if ( from is PlayerMobile player ) { QuestSystem qs = player.Quest; @@ -230,14 +228,14 @@ namespace Server.Engines.Harvest if ( type == typeof( TreasureMap ) ) { int level; - if ( from is PlayerMobile && ((PlayerMobile)from).Young && from.Map == Map.Trammel && TreasureMap.IsInHavenIsland( from ) ) + if ( @from is PlayerMobile mobile && mobile.Young && mobile.Map == Map.Trammel && TreasureMap.IsInHavenIsland( from ) ) level = 0; else level = 1; return new TreasureMap( level, from.Map == Map.Felucca ? Map.Felucca : Map.Trammel ); } - else if ( type == typeof( MessageInABottle ) ) + if ( type == typeof( MessageInABottle ) ) { return new MessageInABottle( from.Map == Map.Felucca ? Map.Felucca : Map.Trammel ); } @@ -329,14 +327,14 @@ namespace Server.Engines.Harvest if ( preLoot != null ) { - if ( preLoot is IShipwreckedItem ) - ( (IShipwreckedItem)preLoot ).IsShipwreckedItem = true; + if ( preLoot is IShipwreckedItem shipwreckedItem ) + shipwreckedItem.IsShipwreckedItem = true; return preLoot; } LockableContainer chest; - + if ( Utility.RandomBool() ) chest = new MetalGoldenChest(); else @@ -418,11 +416,10 @@ namespace Server.Engines.Harvest public override void SendSuccessTo( Mobile from, Item item, HarvestResource resource ) { - if ( item is BigFish ) + if ( item is BigFish fish ) { from.SendLocalizedMessage( 1042635 ); // Your fishing pole bends as you pull a big fish from the depths! - - ((BigFish)item).Fisher = from; + fish.Fisher = from; } else if ( item is WoodenChest || item is MetalGoldenChest ) { @@ -496,10 +493,10 @@ namespace Server.Engines.Harvest Point3D loc; if ( GetHarvestDetails( from, tool, toHarvest, out tileID, out map, out loc ) ) - Timer.DelayCall( TimeSpan.FromSeconds( 1.5 ), + Timer.DelayCall( TimeSpan.FromSeconds( 1.5 ), delegate { - if( Core.ML ) + if ( Core.ML ) from.RevealingAction(); Effects.SendLocationEffect( loc, map, 0x352D, 16, 4 ); @@ -567,4 +564,4 @@ namespace Server.Engines.Harvest 0x74B5, 0x75D5 }; } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Harvest/Lumberjacking.cs b/Scripts/Engines/Harvest/Lumberjacking.cs index 3b060b546..7bdcaab8f 100644 --- a/Scripts/Engines/Harvest/Lumberjacking.cs +++ b/Scripts/Engines/Harvest/Lumberjacking.cs @@ -175,8 +175,8 @@ namespace Server.Engines.Harvest public override void OnHarvestStarted( Mobile from, Item tool, HarvestDefinition def, object toHarvest ) { base.OnHarvestStarted( from, tool, def, toHarvest ); - - if( Core.ML ) + + if ( Core.ML ) from.RevealingAction(); } @@ -212,4 +212,4 @@ namespace Server.Engines.Harvest }; #endregion } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Khaldun/PuzzleChest.cs b/Scripts/Engines/Khaldun/PuzzleChest.cs index c2ebc0e4c..eadc51353 100644 --- a/Scripts/Engines/Khaldun/PuzzleChest.cs +++ b/Scripts/Engines/Khaldun/PuzzleChest.cs @@ -634,11 +634,11 @@ namespace Server.Items DropItem( item ); } - else if( item is BaseHat ) + else if ( item is BaseHat ) { BaseHat hat = (BaseHat)item; - if( Core.AOS ) + if ( Core.AOS ) { int attributeCount; int min, max; @@ -650,7 +650,7 @@ namespace Server.Items DropItem( item ); } - else if( item is BaseJewel ) + else if ( item is BaseJewel ) { int attributeCount; int min, max; diff --git a/Scripts/Engines/Party/Party.cs b/Scripts/Engines/Party/Party.cs index 07ee0dae4..9c4a2ff43 100644 --- a/Scripts/Engines/Party/Party.cs +++ b/Scripts/Engines/Party/Party.cs @@ -368,9 +368,9 @@ namespace Server.Engines.PartySystem { Mobile mob = ns.Mobile; - if( mob != null && mob.AccessLevel >= AccessLevel.GameMaster && mob.AccessLevel > from.AccessLevel && mob.Party != this && !m_Listeners.Contains( mob ) ) + if ( mob != null && mob.AccessLevel >= AccessLevel.GameMaster && mob.AccessLevel > from.AccessLevel && mob.Party != this && !m_Listeners.Contains( mob ) ) { - if( p == null ) + if ( p == null ) p = Packet.Acquire( new UnicodeMessage( from.Serial, from.Body, MessageType.Regular, from.SpeechHue, 3, from.Language, from.Name, text ) ); ns.Send( p ); diff --git a/Scripts/Engines/Quests/Core/Items/HornOfRetreat.cs b/Scripts/Engines/Quests/Core/Items/HornOfRetreat.cs index eac821f36..a9c08b0ad 100644 --- a/Scripts/Engines/Quests/Core/Items/HornOfRetreat.cs +++ b/Scripts/Engines/Quests/Core/Items/HornOfRetreat.cs @@ -66,15 +66,15 @@ namespace Server.Engines.Quests { SendLocalizedMessageTo( from, 500309 ); // Nothing Happens. } - else if( Core.ML && from.Map != Map.Trammel && from.Map != Map.Malas ) + else if ( Core.ML && from.Map != Map.Trammel && from.Map != Map.Malas ) { from.SendLocalizedMessage( 1076154 ); // You can only use this in Trammel and Malas. } - else if( m_PlayTimer != null ) + else if ( m_PlayTimer != null ) { SendLocalizedMessageTo( from, 1042144 ); // This is currently in use. } - else if( Charges > 0 ) + else if ( Charges > 0 ) { from.Animate( 34, 7, 1, true, false, 0 ); from.PlaySound( 0xFF ); diff --git a/Scripts/Engines/Quests/Core/Regions/QuestNoEntryRegion.cs b/Scripts/Engines/Quests/Core/Regions/QuestNoEntryRegion.cs index 56f988787..4fa9c6269 100644 --- a/Scripts/Engines/Quests/Core/Regions/QuestNoEntryRegion.cs +++ b/Scripts/Engines/Quests/Core/Regions/QuestNoEntryRegion.cs @@ -36,11 +36,11 @@ namespace Server.Engines.Quests if ( m.AccessLevel > AccessLevel.Player ) return true; - if( m is BaseCreature ) + if ( m is BaseCreature ) { BaseCreature bc = m as BaseCreature; - if( !bc.Controlled && !bc.Summoned ) + if ( !bc.Controlled && !bc.Summoned ) return true; } @@ -64,4 +64,4 @@ namespace Server.Engines.Quests } } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Quests/Uzeraan Turmoil/Mobiles/MilitiaCanoneer.cs b/Scripts/Engines/Quests/Uzeraan Turmoil/Mobiles/MilitiaCanoneer.cs index 4c03d5358..318584dbd 100644 --- a/Scripts/Engines/Quests/Uzeraan Turmoil/Mobiles/MilitiaCanoneer.cs +++ b/Scripts/Engines/Quests/Uzeraan Turmoil/Mobiles/MilitiaCanoneer.cs @@ -69,7 +69,7 @@ namespace Server.Engines.Quests.Haven BaseCreature bc = (BaseCreature)m; Mobile master = bc.GetMaster(); - if( master != null ) + if ( master != null ) return IsEnemy( master ); } @@ -110,4 +110,4 @@ namespace Server.Engines.Quests.Haven m_Active = reader.ReadBool(); } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Quests/Uzeraan Turmoil/Mobiles/MilitiaFighter.cs b/Scripts/Engines/Quests/Uzeraan Turmoil/Mobiles/MilitiaFighter.cs index 893ea18a6..35ab6d30c 100644 --- a/Scripts/Engines/Quests/Uzeraan Turmoil/Mobiles/MilitiaFighter.cs +++ b/Scripts/Engines/Quests/Uzeraan Turmoil/Mobiles/MilitiaFighter.cs @@ -67,7 +67,7 @@ namespace Server.Engines.Quests.Haven BaseCreature bc = (BaseCreature)m; Mobile master = bc.GetMaster(); - if( master != null ) + if ( master != null ) return IsEnemy( master ); } diff --git a/Scripts/Engines/Reports/Rendering/BarGraphRenderer.cs b/Scripts/Engines/Reports/Rendering/BarGraphRenderer.cs index 5d73584bf..76ec0233f 100644 --- a/Scripts/Engines/Reports/Rendering/BarGraphRenderer.cs +++ b/Scripts/Engines/Reports/Rendering/BarGraphRenderer.cs @@ -48,13 +48,13 @@ namespace Server.Engines.Reports private float _maxTickValueWidth; // Used to calculate left offset of bar graph private float _totalHeight; private float _totalWidth; - + // Graph related members private float _barWidth; private float _bottomBuffer; // Space from bottom to x axis - private bool _displayBarData; + private bool _displayBarData; private Color _fontColor; - private float _graphHeight; + private float _graphHeight; private float _graphWidth; private float _maxValue = 0.0f; // = final tick value * tick count private float _scaleFactor; // = _maxValue / _graphHeight @@ -72,7 +72,7 @@ namespace Server.Engines.Reports private string _longestLabel = string.Empty; // Used to calculate legend width private float _maxLabelWidth = 0.0f; - public string FontFamily + public string FontFamily { get{ return _fontFamily; } set{ _fontFamily = value; } @@ -84,56 +84,56 @@ namespace Server.Engines.Reports set{ _renderMode = value; } } - public Color BackgroundColor + public Color BackgroundColor { set{ _backColor = value; } } - public int BottomBuffer + public int BottomBuffer { set { _bottomBuffer = Convert.ToSingle(value); } } - public Color FontColor + public Color FontColor { set{ _fontColor = value; } } - public int Height + public int Height { get{ return Convert.ToInt32(_totalHeight); } - set{ _totalHeight = Convert.ToSingle(value); } + set{ _totalHeight = Convert.ToSingle(value); } } - public int Width + public int Width { get{ return Convert.ToInt32(_totalWidth); } - set{ _totalWidth = Convert.ToSingle(value); } + set{ _totalWidth = Convert.ToSingle(value); } } - public bool ShowLegend + public bool ShowLegend { get{ return _displayLegend; } set{ _displayLegend = value; } } - public bool ShowData + public bool ShowData { get{ return _displayBarData; } set{ _displayBarData = value; } } - public int TopBuffer + public int TopBuffer { set { _topBuffer = Convert.ToSingle(value); } } - public string VerticalLabel + public string VerticalLabel { get{ return _yLabel; } set{ _yLabel = value; } } - public int VerticalTickCount + public int VerticalTickCount { get{ return _yTickCount; } set{ _yTickCount = value; } @@ -160,7 +160,7 @@ namespace Server.Engines.Reports //********************************************************************* // - // This method collects all data points and calculate all the necessary dimensions + // This method collects all data points and calculate all the necessary dimensions // to draw the bar graph. It is the method called before invoking the Draw() method. // labels is the x values. // values is the y values. @@ -169,7 +169,7 @@ namespace Server.Engines.Reports public void CollectDataPoints(string[] labels, string[] values) { - if (labels.Length == values.Length) + if (labels.Length == values.Length) { for(int i=0; i 2) + if (text.Length > 2) { int midPostition = Convert.ToInt32(Math.Floor(text.Length/2.0)); label = text.Substring(0,1) + text.Substring(midPostition, 1) + text.Substring(text.Length-1,1); @@ -877,7 +877,7 @@ namespace Server.Engines.Reports { // This implementation does not support negative value if (item.Value >= 0) item.SweepSize = item.Value/_scaleFactor; - + // (_spaceBtwBars/2) makes half white space for the first bar item.StartPos = (_spaceBtwBars/2) + i * (_barWidth+_spaceBtwBars); i++; @@ -893,14 +893,14 @@ namespace Server.Engines.Reports private void CalculateBarWidth(int dataCount, float barGraphWidth) { // White space between each bar is the same as bar width itself - _barWidth = barGraphWidth / (dataCount * 2); // Each bar has 1 white space + _barWidth = barGraphWidth / (dataCount * 2); // Each bar has 1 white space //_barWidth =/* (float)Math.Floor(*/_barWidth/*)*/; _spaceBtwBars = _barWidth; } //********************************************************************* // - // This method assigns default value to the bar graph properties and is only + // This method assigns default value to the bar graph properties and is only // called from BarGraph constructors // //********************************************************************* @@ -920,4 +920,4 @@ namespace Server.Engines.Reports _displayBarData = false; } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Spawner/Spawner.cs b/Scripts/Engines/Spawner/Spawner.cs index e12d33900..bab1598b3 100644 --- a/Scripts/Engines/Spawner/Spawner.cs +++ b/Scripts/Engines/Spawner/Spawner.cs @@ -512,7 +512,7 @@ namespace Server.Mobiles int walkrange = GetWalkingRange(); - if( walkrange >= 0 ) + if ( walkrange >= 0 ) c.RangeHome = walkrange; else c.RangeHome = m_HomeRange; diff --git a/Scripts/Engines/Treasures of Tokuno/BasePigmentsOfTokuno.cs b/Scripts/Engines/Treasures of Tokuno/BasePigmentsOfTokuno.cs index a5ba9c172..64370fa9e 100644 --- a/Scripts/Engines/Treasures of Tokuno/BasePigmentsOfTokuno.cs +++ b/Scripts/Engines/Treasures of Tokuno/BasePigmentsOfTokuno.cs @@ -100,7 +100,7 @@ namespace Server.Items { base.GetProperties( list ); - if( m_Label != null && m_Label > 0 ) + if ( m_Label != null && m_Label > 0 ) TextDefinition.AddTo( list, m_Label ); list.Add( 1060584, m_UsesRemaining.ToString() ); // uses remaining: ~1_val~ @@ -108,7 +108,7 @@ namespace Server.Items public override void OnDoubleClick( Mobile from ) { - if( IsAccessibleTo( from ) && from.InRange( GetWorldLocation(), 3 ) ) + if ( IsAccessibleTo( from ) && from.InRange( GetWorldLocation(), 3 ) ) { from.SendLocalizedMessage( 1070929 ); // Select the artifact or enhanced magic item to dye. from.BeginTarget( 3, false, Server.Targeting.TargetFlags.None, new TargetStateCallback( InternalCallback ), this ); @@ -121,35 +121,35 @@ namespace Server.Items { BasePigmentsOfTokuno pigment = (BasePigmentsOfTokuno)state; - if( pigment.Deleted || pigment.UsesRemaining <= 0 || !from.InRange( pigment.GetWorldLocation(), 3 ) || !pigment.IsAccessibleTo( from )) + if ( pigment.Deleted || pigment.UsesRemaining <= 0 || !from.InRange( pigment.GetWorldLocation(), 3 ) || !pigment.IsAccessibleTo( from )) return; Item i = targeted as Item; - if( i == null ) + if ( i == null ) from.SendLocalizedMessage( 1070931 ); // You can only dye artifacts and enhanced magic items with this tub. - else if( !from.InRange( i.GetWorldLocation(), 3 ) || !IsAccessibleTo( from ) ) + else if ( !from.InRange( i.GetWorldLocation(), 3 ) || !IsAccessibleTo( from ) ) from.SendLocalizedMessage( 502436 ); // That is not accessible. - else if( from.Items.Contains( i ) ) + else if ( from.Items.Contains( i ) ) from.SendLocalizedMessage( 1070930 ); // Can't dye artifacts or enhanced magic items that are being worn. - else if( i.IsLockedDown ) + else if ( i.IsLockedDown ) from.SendLocalizedMessage( 1070932 ); // You may not dye artifacts and enhanced magic items which are locked down. - else if( i.QuestItem ) + else if ( i.QuestItem ) from.SendLocalizedMessage( 1151836 ); // You may not dye toggled quest items. - else if( i is MetalPigmentsOfTokuno ) + else if ( i is MetalPigmentsOfTokuno ) from.SendLocalizedMessage( 1042417 ); // You cannot dye that. - else if( i is LesserPigmentsOfTokuno ) + else if ( i is LesserPigmentsOfTokuno ) from.SendLocalizedMessage( 1042417 ); // You cannot dye that. - else if( i is PigmentsOfTokuno ) + else if ( i is PigmentsOfTokuno ) from.SendLocalizedMessage( 1042417 ); // You cannot dye that. - else if( !IsValidItem( i ) ) + else if ( !IsValidItem( i ) ) from.SendLocalizedMessage( 1070931 ); // You can only dye artifacts and enhanced magic items with this tub. //Yes, it says tub on OSI. Don't ask me why ;p else { //Notes: on OSI there IS no hue check to see if it's already hued. and no messages on successful hue either i.Hue = Hue; - if( --pigment.UsesRemaining <= 0 ) + if ( --pigment.UsesRemaining <= 0 ) pigment.Delete(); from.PlaySound(0x23E); // As per OSI TC1 @@ -158,21 +158,21 @@ namespace Server.Items public static bool IsValidItem( Item i ) { - if( i is BasePigmentsOfTokuno ) + if ( i is BasePigmentsOfTokuno ) return false; Type t = i.GetType(); CraftResource resource = CraftResource.None; - if( i is BaseWeapon ) + if ( i is BaseWeapon ) resource = ((BaseWeapon)i).Resource; - else if( i is BaseArmor ) + else if ( i is BaseArmor ) resource = ((BaseArmor)i).Resource; else if (i is BaseClothing) resource = ((BaseClothing)i).Resource; - if( !CraftResources.IsStandard( resource ) ) + if ( !CraftResources.IsStandard( resource ) ) return true; if ( i is ITokunoDyable ) @@ -198,7 +198,7 @@ namespace Server.Items { for( int i = 0; i < list.Length; i++ ) { - if( list[i] == t ) return true; + if ( list[i] == t ) return true; } return false; diff --git a/Scripts/Engines/Treasures of Tokuno/GreaterArtifacts.cs b/Scripts/Engines/Treasures of Tokuno/GreaterArtifacts.cs index ef3211325..055c20cb6 100644 --- a/Scripts/Engines/Treasures of Tokuno/GreaterArtifacts.cs +++ b/Scripts/Engines/Treasures of Tokuno/GreaterArtifacts.cs @@ -88,7 +88,7 @@ namespace Server.Items HitPoints = 255; } - if( version == 0 ) + if ( version == 0 ) LootType = LootType.Regular; } @@ -427,7 +427,7 @@ namespace Server.Items { int v = (int)type; - if( v < 0 || v >= m_Table.Length ) + if ( v < 0 || v >= m_Table.Length ) v = 0; return m_Table[v]; diff --git a/Scripts/Engines/Treasures of Tokuno/LesserArtifacts.cs b/Scripts/Engines/Treasures of Tokuno/LesserArtifacts.cs index ee1c8c0e7..fd25e9495 100644 --- a/Scripts/Engines/Treasures of Tokuno/LesserArtifacts.cs +++ b/Scripts/Engines/Treasures of Tokuno/LesserArtifacts.cs @@ -46,7 +46,7 @@ namespace Server.Items HitPoints = 255; } - if( version == 0 ) + if ( version == 0 ) SkillBonuses.SetValues( 0, SkillName.AnimalLore, 5.0 ); } } @@ -840,9 +840,9 @@ namespace Server.Items armor.Durability = (ArmorDurabilityLevel)Utility.Random( 6 ); } } - else if( item is BaseHat && Core.AOS ) + else if ( item is BaseHat && Core.AOS ) BaseRunicTool.ApplyAttributesTo( (BaseHat)item, attributeCount, min, max ); - else if( item is BaseJewel && Core.AOS ) + else if ( item is BaseJewel && Core.AOS ) BaseRunicTool.ApplyAttributesTo( (BaseJewel)item, attributeCount, min, max ); DropItem( item ); @@ -900,7 +900,7 @@ namespace Server.Items int version = reader.ReadInt(); - if( version == 0 && Slayer == SlayerName.Fey ) + if ( version == 0 && Slayer == SlayerName.Fey ) Slayer = SlayerGroup.Groups[Utility.Random( SlayerGroup.Groups.Length - 1 )].Super.Name; } } @@ -943,7 +943,7 @@ namespace Server.Items { int v = (int)type; - if( v < 0 || v >= m_Table.Length ) + if ( v < 0 || v >= m_Table.Length ) v = 0; return m_Table[v]; diff --git a/Scripts/Engines/Treasures of Tokuno/TreasuresOfTokuno.cs b/Scripts/Engines/Treasures of Tokuno/TreasuresOfTokuno.cs index cd830c8ce..eadd9b4a7 100644 --- a/Scripts/Engines/Treasures of Tokuno/TreasuresOfTokuno.cs +++ b/Scripts/Engines/Treasures of Tokuno/TreasuresOfTokuno.cs @@ -89,7 +89,7 @@ namespace Server.Misc { get { - if( m_GreaterArtifacts == null ) + if ( m_GreaterArtifacts == null ) { m_GreaterArtifacts = new Type[ToTRedeemGump.NormalRewards.Length][]; @@ -112,11 +112,11 @@ namespace Server.Misc { Region r = m.Region; - if( r.IsPartOf( typeof( Server.Regions.HouseRegion ) ) || Server.Multis.BaseBoat.FindBoatAt( m, m.Map ) != null ) + if ( r.IsPartOf( typeof( Server.Regions.HouseRegion ) ) || Server.Multis.BaseBoat.FindBoatAt( m, m.Map ) != null ) return false; //TODO: a CanReach of something check as opposed to above? - if( r.IsPartOf( "Yomotsu Mines" ) || r.IsPartOf( "Fan Dancer's Dojo" ) ) + if ( r.IsPartOf( "Yomotsu Mines" ) || r.IsPartOf( "Fan Dancer's Dojo" ) ) return true; return (m.Map == Map.Tokuno); @@ -127,10 +127,10 @@ namespace Server.Misc PlayerMobile pm = killer as PlayerMobile; BaseCreature bc = victim as BaseCreature; - if( DropEra == TreasuresOfTokunoEra.None || pm == null || bc == null || !CheckLocation( bc ) || !CheckLocation( pm )|| !killer.InRange( victim, 18 )) + if ( DropEra == TreasuresOfTokunoEra.None || pm == null || bc == null || !CheckLocation( bc ) || !CheckLocation( pm )|| !killer.InRange( victim, 18 )) return; - if( bc.Controlled || bc.Owners.Count > 0 || bc.Fame <= 0 ) + if ( bc.Controlled || bc.Owners.Count > 0 || bc.Fame <= 0 ) return; //25000 for 1/100 chance, 10 hyrus @@ -150,7 +150,7 @@ namespace Server.Misc double chance = A * Math.Pow( 10, B * x ); - if( chance > Utility.RandomDouble() ) + if ( chance > Utility.RandomDouble() ) { Item i = null; @@ -161,13 +161,13 @@ namespace Server.Misc catch { } - if( i != null ) + if ( i != null ) { pm.SendLocalizedMessage( 1062317 ); // For your valor in combating the fallen beast, a special artifact has been bestowed on you. - if( !pm.PlaceInBackpack( i ) ) + if ( !pm.PlaceInBackpack( i ) ) { - if( pm.BankBox != null && pm.BankBox.TryDropItem( killer, i, false ) ) + if ( pm.BankBox != null && pm.BankBox.TryDropItem( killer, i, false ) ) pm.SendLocalizedMessage( 1079730 ); // The item has been placed into your bank box. else { @@ -246,40 +246,40 @@ namespace Server.Mobiles public override void OnMovement( Mobile m, Point3D oldLocation ) { - if( m.Alive && m is PlayerMobile ) + if ( m.Alive && m is PlayerMobile ) { PlayerMobile pm = (PlayerMobile)m; int range = 3; - if( m.Alive && Math.Abs( Z - m.Z ) < 16 && InRange( m, range ) && !InRange( oldLocation, range ) ) + if ( m.Alive && Math.Abs( Z - m.Z ) < 16 && InRange( m, range ) && !InRange( oldLocation, range ) ) { - if( pm.ToTItemsTurnedIn >= TreasuresOfTokuno.ItemsPerReward ) + if ( pm.ToTItemsTurnedIn >= TreasuresOfTokuno.ItemsPerReward ) { SayTo( pm, 1070980 ); // Congratulations! You have turned in enough minor treasures to earn a greater reward. pm.CloseGump( typeof( ToTTurnInGump ) ); //Sanity - if( !pm.HasGump( typeof( ToTRedeemGump ) ) ) + if ( !pm.HasGump( typeof( ToTRedeemGump ) ) ) pm.SendGump( new ToTRedeemGump( this, false ) ); } else { - if( pm.ToTItemsTurnedIn == 0 ) + if ( pm.ToTItemsTurnedIn == 0 ) SayTo( pm, 1071013 ); // Bring me 10 of the lost treasures of Tokuno and I will reward you with a valuable item. else SayTo( pm, 1070981, String.Format( "{0}\t{1}", pm.ToTItemsTurnedIn, TreasuresOfTokuno.ItemsPerReward ) ); // You have turned in ~1_COUNT~ minor artifacts. Turn in ~2_NUM~ to receive a reward. ArrayList buttons = ToTTurnInGump.FindRedeemableItems( pm ); - if( buttons.Count > 0 && !pm.HasGump( typeof( ToTTurnInGump ) ) ) + if ( buttons.Count > 0 && !pm.HasGump( typeof( ToTTurnInGump ) ) ) pm.SendGump( new ToTTurnInGump( this, buttons ) ); } } int leaveRange = 7; - if( !InRange( m, leaveRange ) && InRange( oldLocation, leaveRange ) ) + if ( !InRange( m, leaveRange ) && InRange( oldLocation, leaveRange ) ) { pm.CloseGump( typeof( ToTRedeemGump ) ); pm.CloseGump( typeof( ToTTurnInGump ) ); @@ -314,7 +314,7 @@ namespace Server.Gumps public static ArrayList FindRedeemableItems( Mobile m ) { Backpack pack = (Backpack)m.Backpack; - if( pack == null ) + if ( pack == null ) return new ArrayList(); ArrayList items = new ArrayList( pack.FindItemsByType( TreasuresOfTokuno.LesserArtifactsTotal ) ); @@ -323,13 +323,13 @@ namespace Server.Gumps for( int i = 0; i < items.Count; i++ ) { Item item = (Item)items[i]; - if( item is ChestOfHeirlooms && !((ChestOfHeirlooms)item).Locked ) + if ( item is ChestOfHeirlooms && !((ChestOfHeirlooms)item).Locked ) continue; - if( item is ChestOfHeirlooms && ((ChestOfHeirlooms)item).TrapLevel != 10 ) + if ( item is ChestOfHeirlooms && ((ChestOfHeirlooms)item).TrapLevel != 10 ) continue; - if( item is PigmentsOfTokuno && ((PigmentsOfTokuno)item).Type != PigmentType.None ) + if ( item is PigmentsOfTokuno && ((PigmentsOfTokuno)item).Type != PigmentType.None ) continue; buttons.Add( new ItemTileButtonInfo( item ) ); @@ -356,18 +356,18 @@ namespace Server.Gumps Item item = ((ItemTileButtonInfo)buttonInfo).Item; - if( !( pm != null && item.IsChildOf( pm.Backpack ) && pm.InRange( m_Collector.Location, 7 )) ) + if ( !( pm != null && item.IsChildOf( pm.Backpack ) && pm.InRange( m_Collector.Location, 7 )) ) return; item.Delete(); - if( ++pm.ToTItemsTurnedIn >= TreasuresOfTokuno.ItemsPerReward ) + if ( ++pm.ToTItemsTurnedIn >= TreasuresOfTokuno.ItemsPerReward ) { m_Collector.SayTo( pm, 1070980 ); // Congratulations! You have turned in enough minor treasures to earn a greater reward. pm.CloseGump( typeof( ToTTurnInGump ) ); //Sanity - if( !pm.HasGump( typeof( ToTRedeemGump ) ) ) + if ( !pm.HasGump( typeof( ToTRedeemGump ) ) ) pm.SendGump( new ToTRedeemGump( m_Collector, false ) ); } else @@ -378,7 +378,7 @@ namespace Server.Gumps pm.CloseGump( typeof( ToTTurnInGump ) ); //Sanity - if( buttons.Count > 0 ) + if ( buttons.Count > 0 ) pm.SendGump( new ToTTurnInGump( m_Collector, buttons ) ); } } @@ -387,12 +387,12 @@ namespace Server.Gumps { PlayerMobile pm = sender.Mobile as PlayerMobile; - if( pm == null || !pm.InRange( m_Collector.Location, 7 ) ) + if ( pm == null || !pm.InRange( m_Collector.Location, 7 ) ) return; - if( pm.ToTItemsTurnedIn == 0 ) + if ( pm.ToTItemsTurnedIn == 0 ) m_Collector.SayTo( pm, 1071013 ); // Bring me 10 of the lost treasures of Tokuno and I will reward you with a valuable item. - else if( pm.ToTItemsTurnedIn < TreasuresOfTokuno.ItemsPerReward ) //This case should ALWAYS be true with this gump, jsut a sanity check + else if ( pm.ToTItemsTurnedIn < TreasuresOfTokuno.ItemsPerReward ) //This case should ALWAYS be true with this gump, jsut a sanity check m_Collector.SayTo( pm, 1070981, String.Format( "{0}\t{1}", pm.ToTItemsTurnedIn, TreasuresOfTokuno.ItemsPerReward ) ); // You have turned in ~1_COUNT~ minor artifacts. Turn in ~2_NUM~ to receive a reward. else m_Collector.SayTo( pm, 1070982 ); // When you wish to choose your reward, you have but to approach me again. @@ -557,14 +557,14 @@ namespace Server.Gumps { PlayerMobile pm = sender.Mobile as PlayerMobile; - if( pm == null || !pm.InRange( m_Collector.Location, 7 ) || !(pm.ToTItemsTurnedIn >= TreasuresOfTokuno.ItemsPerReward) ) + if ( pm == null || !pm.InRange( m_Collector.Location, 7 ) || !(pm.ToTItemsTurnedIn >= TreasuresOfTokuno.ItemsPerReward) ) return; bool pigments = (buttonInfo is PigmentsTileButtonInfo); Item item = null; - if( pigments ) + if ( pigments ) { PigmentsTileButtonInfo p = buttonInfo as PigmentsTileButtonInfo; @@ -574,7 +574,7 @@ namespace Server.Gumps { TypeTileButtonInfo t = buttonInfo as TypeTileButtonInfo; - if( t.Type == typeof( PigmentsOfTokuno ) ) //Special case of course. + if ( t.Type == typeof( PigmentsOfTokuno ) ) //Special case of course. { pm.CloseGump( typeof( ToTTurnInGump ) ); //Sanity pm.CloseGump( typeof( ToTRedeemGump ) ); @@ -591,10 +591,10 @@ namespace Server.Gumps catch { } } - if( item == null ) + if ( item == null ) return; //Sanity - if( pm.AddToBackpack( item ) ) + if ( pm.AddToBackpack( item ) ) { pm.ToTItemsTurnedIn -= TreasuresOfTokuno.ItemsPerReward; m_Collector.SayTo( pm, 1070984, (item.Name == null || item.Name.Length <= 0)? String.Format( "#{0}", item.LabelNumber ) : item.Name ); // You have earned the gratitude of the Empire. I have placed the ~1_OBJTYPE~ in your backpack. @@ -612,12 +612,12 @@ namespace Server.Gumps { PlayerMobile pm = sender.Mobile as PlayerMobile; - if( pm == null || !pm.InRange( m_Collector.Location, 7 ) ) + if ( pm == null || !pm.InRange( m_Collector.Location, 7 ) ) return; - if( pm.ToTItemsTurnedIn == 0 ) + if ( pm.ToTItemsTurnedIn == 0 ) m_Collector.SayTo( pm, 1071013 ); // Bring me 10 of the lost treasures of Tokuno and I will reward you with a valuable item. - else if( pm.ToTItemsTurnedIn < TreasuresOfTokuno.ItemsPerReward ) //This and above case should ALWAYS be FALSE with this gump, jsut a sanity check + else if ( pm.ToTItemsTurnedIn < TreasuresOfTokuno.ItemsPerReward ) //This and above case should ALWAYS be FALSE with this gump, jsut a sanity check m_Collector.SayTo( pm, 1070981, String.Format( "{0}\t{1}", pm.ToTItemsTurnedIn, TreasuresOfTokuno.ItemsPerReward ) ); // You have turned in ~1_COUNT~ minor artifacts. Turn in ~2_NUM~ to receive a reward. else m_Collector.SayTo( pm, 1070982 ); // When you wish to choose your reward, you have but to approach me again. diff --git a/Scripts/Engines/VeteranRewards/Character Statue Maker/CharacterStatue.cs b/Scripts/Engines/VeteranRewards/Character Statue Maker/CharacterStatue.cs index b031750df..9e91f90af 100644 --- a/Scripts/Engines/VeteranRewards/Character Statue Maker/CharacterStatue.cs +++ b/Scripts/Engines/VeteranRewards/Character Statue Maker/CharacterStatue.cs @@ -232,7 +232,7 @@ namespace Server.Mobiles Frozen = true; - if( m_SculptedBy == null || Map == Map.Internal ) // Remove preview statues + if ( m_SculptedBy == null || Map == Map.Internal ) // Remove preview statues { Timer.DelayCall( TimeSpan.Zero, new TimerCallback( Delete ) ); } @@ -370,7 +370,7 @@ namespace Server.Mobiles break; } - if( Map != null ) + if ( Map != null ) { ProcessDelta(); @@ -382,7 +382,7 @@ namespace Server.Mobiles { state.Mobile.ProcessDelta(); - if( p == null ) + if ( p == null ) p = Packet.Acquire( new UpdateStatueAnimation( this, 1, m_Animation, m_Frames ) ); state.Send( p ); diff --git a/Scripts/Engines/VeteranRewards/Character Statue Maker/CharacterStatuePlinth.cs b/Scripts/Engines/VeteranRewards/Character Statue Maker/CharacterStatuePlinth.cs index 40f68c5de..38bc01358 100644 --- a/Scripts/Engines/VeteranRewards/Character Statue Maker/CharacterStatuePlinth.cs +++ b/Scripts/Engines/VeteranRewards/Character Statue Maker/CharacterStatuePlinth.cs @@ -69,7 +69,7 @@ namespace Server.Items m_Statue = reader.ReadMobile() as CharacterStatue; - if( m_Statue == null || m_Statue.SculptedBy == null || Map == Map.Internal ) + if ( m_Statue == null || m_Statue.SculptedBy == null || Map == Map.Internal ) { Timer.DelayCall( TimeSpan.Zero, new TimerCallback( Delete ) ); } diff --git a/Scripts/Engines/Virtues/Honor.cs b/Scripts/Engines/Virtues/Honor.cs index 8d483e4bb..9a86fc4d7 100644 --- a/Scripts/Engines/Virtues/Honor.cs +++ b/Scripts/Engines/Virtues/Honor.cs @@ -9,8 +9,8 @@ namespace Server { public class HonorVirtue { - - private static readonly TimeSpan UseDelay = TimeSpan.FromMinutes( 5.0 ); + + private static readonly TimeSpan UseDelay = TimeSpan.FromMinutes( 5.0 ); public static void Initialize() { @@ -88,9 +88,9 @@ namespace Server pm.SendLocalizedMessage( 1063240, remainingMinutes.ToString() ); // You must wait ~1_HONOR_WAIT~ minutes before embracing honor again return; } - + pm.SendGump( new HonorSelf( pm ) ); - + } public static void ActivateEmbrace( PlayerMobile pm ) @@ -111,7 +111,7 @@ namespace Server pm.SendLocalizedMessage( 1063235 ); // You embrace your honor Timer.DelayCall( TimeSpan.FromSeconds( duration ), - delegate() { + delegate { pm.HonorActive = false; pm.LastHonorUse = DateTime.UtcNow; pm.SendLocalizedMessage( 1063236 ); // You no longer embrace your honor @@ -149,8 +149,8 @@ namespace Server if ( target.Body.IsHuman && (cret == null || (!cret.AlwaysAttackable && !cret.AlwaysMurderer)) ) { - if( reg == null || reg.IsDisabled() ) - { + if ( reg == null || reg.IsDisabled() ) + { //Allow honor on blue if Out of guardzone } else if ( map != null && (map.Rules & MapRules.HarmfulRestrictions) == 0 ) @@ -164,7 +164,7 @@ namespace Server } } - if( Core.ML && target is PlayerMobile ) + if ( Core.ML && target is PlayerMobile ) { source.SendLocalizedMessage( 1075614 ); // You cannot honor other players. return; @@ -234,7 +234,7 @@ namespace Server source.m_hontime = (DateTime.UtcNow + TimeSpan.FromMinutes( 40 )); Timer.DelayCall( TimeSpan.FromMinutes( 40 ), - delegate() { + delegate { if (source.m_hontime < DateTime.UtcNow && source.SentHonorContext != null) { Cancel(); @@ -430,4 +430,4 @@ namespace Server } } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Virtues/Sacrifice.cs b/Scripts/Engines/Virtues/Sacrifice.cs index 2860a86ed..00e3b76b3 100644 --- a/Scripts/Engines/Virtues/Sacrifice.cs +++ b/Scripts/Engines/Virtues/Sacrifice.cs @@ -27,7 +27,7 @@ namespace Server else Resurrect( from ); } - else + else from.SendLocalizedMessage( 1052015 ); // You cannot do that while hidden. } @@ -132,9 +132,9 @@ namespace Server { int toGain; - if( from.Fame < 5000 ) + if ( from.Fame < 5000 ) toGain = 500; - else if( from.Fame < 10000 ) + else if ( from.Fame < 10000 ) toGain = 1000; else toGain = 2000; @@ -191,4 +191,4 @@ namespace Server } } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Virtues/Valor.cs b/Scripts/Engines/Virtues/Valor.cs index 687ee154b..8581c103c 100644 --- a/Scripts/Engines/Virtues/Valor.cs +++ b/Scripts/Engines/Virtues/Valor.cs @@ -21,7 +21,7 @@ namespace Server public static void OnVirtueUsed( Mobile from ) { - if( from.Alive ) + if ( from.Alive ) { from.SendLocalizedMessage( 1054034 ); // Target the Champion Idol of the Champion you wish to challenge!. from.Target = new InternalTarget(); @@ -32,14 +32,14 @@ namespace Server { PlayerMobile pm = from as PlayerMobile; - if( pm == null ) + if ( pm == null ) return; try { - if( (pm.LastValorLoss + LossDelay) < DateTime.UtcNow ) + if ( (pm.LastValorLoss + LossDelay) < DateTime.UtcNow ) { - if( VirtueHelper.Atrophy( from, VirtueName.Valor, LossAmount ) ) + if ( VirtueHelper.Atrophy( from, VirtueName.Valor, LossAmount ) ) from.SendLocalizedMessage( 1054040 ); // You have lost some Valor. pm.LastValorLoss = DateTime.UtcNow; @@ -54,18 +54,18 @@ namespace Server { IdolOfTheChampion idol = targ as IdolOfTheChampion; - if( idol == null || idol.Deleted || idol.Spawn == null || idol.Spawn.Deleted ) + if ( idol == null || idol.Deleted || idol.Spawn == null || idol.Spawn.Deleted ) from.SendLocalizedMessage( 1054035 ); // You must target a Champion Idol to challenge the Champion's spawn! - else if( from.Hidden ) + else if ( from.Hidden ) from.SendLocalizedMessage( 1052015 ); // You cannot do that while hidden. - else if( idol.Spawn.HasBeenAdvanced ) + else if ( idol.Spawn.HasBeenAdvanced ) from.SendLocalizedMessage( 1054038 ); // The Champion of this region has already been challenged! else { VirtueLevel vl = VirtueHelper.GetLevel( from, VirtueName.Valor ); - if( idol.Spawn.Active ) + if ( idol.Spawn.Active ) { - if( idol.Spawn.Champion != null ) //TODO: Message? + if ( idol.Spawn.Champion != null ) //TODO: Message? return; int needed, consumed; @@ -95,7 +95,7 @@ namespace Server } } - if( from.Virtues.GetValue( (int)VirtueName.Valor ) >= needed ) + if ( from.Virtues.GetValue( (int)VirtueName.Valor ) >= needed ) { VirtueHelper.Atrophy( from, VirtueName.Valor, consumed ); from.SendLocalizedMessage( 1054037 ); // Your challenge is heard by the Champion of this region! Beware its wrath! @@ -107,7 +107,7 @@ namespace Server } else { - if( vl == VirtueLevel.Knight ) + if ( vl == VirtueLevel.Knight ) { VirtueHelper.Atrophy( from, VirtueName.Valor, 11000 ); from.SendLocalizedMessage( 1054037 ); // Your challenge is heard by the Champion of this region! Beware its wrath! @@ -135,4 +135,4 @@ namespace Server } } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Virtues/VirtueGump.cs b/Scripts/Engines/Virtues/VirtueGump.cs index 05bb293d2..8210afe6f 100644 --- a/Scripts/Engines/Virtues/VirtueGump.cs +++ b/Scripts/Engines/Virtues/VirtueGump.cs @@ -133,19 +133,19 @@ namespace Server if ( value < 4000 ) return 2402; - if( value >= 30000 ) + if ( value >= 30000 ) value = 20000; //Sanity int vl; - if( value < 10000 ) + if ( value < 10000 ) vl = 0; - else if( value >= 20000 && index == 5) + else if ( value >= 20000 && index == 5) vl = 2; - else if( value >= 21000 && index != 1) + else if ( value >= 21000 && index != 1) vl = 2; - else if( value >= 22000 && index == 1) + else if ( value >= 22000 && index == 1) vl = 2; else vl = 1; diff --git a/Scripts/Engines/Virtues/VirtueHelper.cs b/Scripts/Engines/Virtues/VirtueHelper.cs index 95cfb84c7..23c96b9ef 100644 --- a/Scripts/Engines/Virtues/VirtueHelper.cs +++ b/Scripts/Engines/Virtues/VirtueHelper.cs @@ -53,10 +53,10 @@ namespace Server public static int GetMaxAmount( VirtueName virtue ) { - if( virtue == VirtueName.Honor ) + if ( virtue == VirtueName.Honor ) return 20000; - if( virtue == VirtueName.Sacrifice ) + if ( virtue == VirtueName.Sacrifice ) return 22000; return 21000; @@ -71,7 +71,7 @@ namespace Server if ( current >= maxAmount ) return false; - if( (current + amount) >= maxAmount ) + if ( (current + amount) >= maxAmount ) amount = maxAmount - current; VirtueLevel oldLevel = GetLevel( from, virtue ); @@ -92,7 +92,7 @@ namespace Server { int current = from.Virtues.GetValue( (int)virtue ); - if( (current - amount) >= 0 ) + if ( (current - amount) >= 0 ) from.Virtues.SetValue( (int)virtue, current - amount ); else from.Virtues.SetValue( (int)virtue, 0 ); diff --git a/Scripts/Engines/Virtues/VirtueInfoGump.cs b/Scripts/Engines/Virtues/VirtueInfoGump.cs index c9b663df0..193ea372c 100644 --- a/Scripts/Engines/Virtues/VirtueInfoGump.cs +++ b/Scripts/Engines/Virtues/VirtueInfoGump.cs @@ -41,11 +41,11 @@ namespace Server int valueDesc; int dots; - if( value < 4000 ) + if ( value < 4000 ) dots = value / 400; - else if( value < 10000 ) + else if ( value < 10000 ) dots = (value - 4000) / 600; - else if( value < maxValue ) + else if ( value < maxValue ) dots = (value - 10000) / ((maxValue-10000)/10); else dots = 10; @@ -54,21 +54,21 @@ namespace Server AddImage( 95 + (i * 17), 50, i < dots ? 2362 : 2360 ); - if( value < 1 ) + if ( value < 1 ) valueDesc = 1052044; // You have not started on the path of this Virtue. - else if( value < 400 ) + else if ( value < 400 ) valueDesc = 1052045; // You have barely begun your journey through the path of this Virtue. - else if( value < 2000 ) + else if ( value < 2000 ) valueDesc = 1052046; // You have progressed in this Virtue, but still have much to do. - else if( value < 3600 ) + else if ( value < 3600 ) valueDesc = 1052047; // Your journey through the path of this Virtue is going well. - else if( value < 4000 ) + else if ( value < 4000 ) valueDesc = 1052048; // You feel very close to achieving your next path in this Virtue. - else if( dots < 1 ) + else if ( dots < 1 ) valueDesc = 1052049; // You have achieved a path in this Virtue. - else if( dots < 9 ) + else if ( dots < 9 ) valueDesc = 1052047; // Your journey through the path of this Virtue is going well. - else if( dots < 10 ) + else if ( dots < 10 ) valueDesc = 1052048; // You feel very close to achieving your next path in this Virtue. else valueDesc = 1052050; // You have achieved the highest path in this Virtue. @@ -95,7 +95,7 @@ namespace Server { m_Beholder.SendGump( new VirtueInfoGump( m_Beholder, m_Virtue, m_Desc, m_Page ) ); - if( m_Page != null ) + if ( m_Page != null ) state.Send( new LaunchBrowser( m_Page ) ); //No message about web browser starting on OSI break; } @@ -107,4 +107,4 @@ namespace Server } } } -} \ No newline at end of file +} diff --git a/Scripts/Gumps/AdminGump.cs b/Scripts/Gumps/AdminGump.cs index 77f355f8f..dd0852bf5 100644 --- a/Scripts/Gumps/AdminGump.cs +++ b/Scripts/Gumps/AdminGump.cs @@ -351,7 +351,7 @@ namespace Server.Gumps } } - + AddLabel( 20, 200, LabelHue, "Pooling:" ); AddHtml( 20, 220, 380, 150, sb.ToString(), true, true ); @@ -1223,7 +1223,7 @@ namespace Server.Gumps for( int i = 0; !contains && i < loginList.Length; ++i ) { - if( ((Firewall.IFirewallEntry)state).IsBlocked( loginList[i] ) ) + if ( ((Firewall.IFirewallEntry)state).IsBlocked( loginList[i] ) ) { m_List.Add( acct ); break; @@ -1266,7 +1266,7 @@ namespace Server.Gumps if ( online ) AddLabelCropped( 252, offset, 120, 20, GreenHue, "Online" ); - else if( a.Banned ) + else if ( a.Banned ) AddLabelCropped( 252, offset, 120, 20, RedHue, "Banned" ); else AddLabelCropped( 252, offset, 120, 20, RedHue, "Offline" ); @@ -3048,4 +3048,4 @@ namespace Server.Gumps } } } -} \ No newline at end of file +} diff --git a/Scripts/Gumps/BaseImageTileButtonsGump.cs b/Scripts/Gumps/BaseImageTileButtonsGump.cs index 7c3fa0b88..e50ddec9b 100644 --- a/Scripts/Gumps/BaseImageTileButtonsGump.cs +++ b/Scripts/Gumps/BaseImageTileButtonsGump.cs @@ -90,7 +90,7 @@ namespace Server.Gumps int pageNum = i / itemsPerPage + 1; - if( position == 0 && i != 0 ) + if ( position == 0 && i != 0 ) { AddButton( x-100, y+54, 0xFA5, 0xFA7, 0, GumpButtonType.Page, pageNum ); AddHtmlLocalized( x-60, y+56, 60, 20, 1043353, 0x7FFF, false, false ); // Next @@ -113,7 +113,7 @@ namespace Server.Gumps { int adjustedID = info.ButtonID - 100; - if( adjustedID >= 0 && adjustedID < Buttons.Length ) + if ( adjustedID >= 0 && adjustedID < Buttons.Length ) HandleButtonResponse( sender, adjustedID, Buttons[adjustedID] ); else HandleCancel( sender ); @@ -128,4 +128,4 @@ namespace Server.Gumps { } } -} \ No newline at end of file +} diff --git a/Scripts/Gumps/CategorizedAddGump.cs b/Scripts/Gumps/CategorizedAddGump.cs index e370febb8..a55a03098 100644 --- a/Scripts/Gumps/CategorizedAddGump.cs +++ b/Scripts/Gumps/CategorizedAddGump.cs @@ -105,7 +105,7 @@ namespace Server.Gumps nodes.Add( new CAGObject( this, xml ) ); else if ( xml.NodeType == XmlNodeType.Element && xml.Name == "category" ) { - if( !xml.IsEmptyElement ) + if ( !xml.IsEmptyElement ) nodes.Add( new CAGCategory( this, xml ) ); } else diff --git a/Scripts/Gumps/ConfirmHouseResize.cs b/Scripts/Gumps/ConfirmHouseResize.cs index 1035f217c..25ec26fd5 100644 --- a/Scripts/Gumps/ConfirmHouseResize.cs +++ b/Scripts/Gumps/ConfirmHouseResize.cs @@ -31,15 +31,15 @@ namespace Server.Gumps AddImageTiled( 10, 40, 400, 200, 0xA40 ); AddAlphaRegion( 10, 40, 400, 200 ); - /* You are attempting to resize your house. You will be refunded the house's - value directly to your bank box. All items in the house will *remain behind* - and can be *freely picked up by anyone*. Once the house is demolished, however, - only this account will be able to place on the land for one hour. This *will* - circumvent the normal 7-day waiting period (if it applies to you). This action - will not un-condemn any other houses on your account. If you have other, - grandfathered houses, this action *WILL* condemn them. Are you sure you wish + /* You are attempting to resize your house. You will be refunded the house's + value directly to your bank box. All items in the house will *remain behind* + and can be *freely picked up by anyone*. Once the house is demolished, however, + only this account will be able to place on the land for one hour. This *will* + circumvent the normal 7-day waiting period (if it applies to you). This action + will not un-condemn any other houses on your account. If you have other, + grandfathered houses, this action *WILL* condemn them. Are you sure you wish to continue?*/ - AddHtmlLocalized( 10, 40, 400, 200, 1080196, 0x7F00, false, true ); + AddHtmlLocalized( 10, 40, 400, 200, 1080196, 0x7F00, false, true ); AddImageTiled( 10, 250, 400, 20, 0xA40 ); AddAlphaRegion( 10, 250, 400, 20 ); @@ -61,7 +61,7 @@ namespace Server.Gumps m_Mobile.SendLocalizedMessage( 1080455 ); // You can not resize your house at this time. Please remove all items fom the moving crate and try again. return; } - else if( !Guilds.Guild.NewGuildSystem && m_House.FindGuildstone() != null ) + else if ( !Guilds.Guild.NewGuildSystem && m_House.FindGuildstone() != null ) { m_Mobile.SendLocalizedMessage( 501389 ); // You cannot redeed a house with a guildstone inside. return; diff --git a/Scripts/Gumps/Guilds/GuildDeclareWarGump.cs b/Scripts/Gumps/Guilds/GuildDeclareWarGump.cs index 846b8ad8c..c4ccbb36f 100644 --- a/Scripts/Gumps/Guilds/GuildDeclareWarGump.cs +++ b/Scripts/Gumps/Guilds/GuildDeclareWarGump.cs @@ -53,7 +53,7 @@ namespace Server.Gumps { m_Mobile.SendLocalizedMessage( 501183 ); // You are already at war with that guild. } - else if( Faction.Find( m_Guild.Leader ) != null ) + else if ( Faction.Find( m_Guild.Leader ) != null ) { m_Mobile.SendLocalizedMessage( 1005288 ); // You cannot declare war while you are in a faction } @@ -85,4 +85,4 @@ namespace Server.Gumps } } } -} \ No newline at end of file +} diff --git a/Scripts/Gumps/Guilds/New Guild System/AdvancedSearch.cs b/Scripts/Gumps/Guilds/New Guild System/AdvancedSearch.cs index 3e4df3cc3..7b4cb2b2f 100644 --- a/Scripts/Gumps/Guilds/New Guild System/AdvancedSearch.cs +++ b/Scripts/Gumps/Guilds/New Guild System/AdvancedSearch.cs @@ -53,16 +53,16 @@ namespace Server.Guilds PlayerMobile pm = sender.Mobile as PlayerMobile; - if( pm == null || !IsMember( pm, guild ) ) + if ( pm == null || !IsMember( pm, guild ) ) return; GuildDisplayType display = m_Display; - if( info.ButtonID == 5 ) + if ( info.ButtonID == 5 ) { for( int i = 0; i < 3; i++ ) { - if( info.IsSwitched( i ) ) + if ( info.IsSwitched( i ) ) { display = (GuildDisplayType)i; m_Callback( display ); @@ -72,4 +72,4 @@ namespace Server.Guilds } } } -} \ No newline at end of file +} diff --git a/Scripts/Gumps/Guilds/New Guild System/BaseGuildGump.cs b/Scripts/Gumps/Guilds/New Guild System/BaseGuildGump.cs index 9329e96da..dcc9ffaf5 100644 --- a/Scripts/Gumps/Guilds/New Guild System/BaseGuildGump.cs +++ b/Scripts/Gumps/Guilds/New Guild System/BaseGuildGump.cs @@ -24,7 +24,7 @@ namespace Server.Guilds { m_Guild = g; m_Player = pm; - + pm.CloseGump( typeof( BaseGuildGump ) ); } @@ -51,7 +51,7 @@ namespace Server.Guilds { PlayerMobile pm = sender.Mobile as PlayerMobile; - if( !IsMember( pm, guild ) ) + if ( !IsMember( pm, guild ) ) return; switch( info.ButtonID ) @@ -93,7 +93,7 @@ namespace Server.Guilds //return NameVerification.Validate( s, 1, 50, true, true, false, int.MaxValue, ProfanityProtection.Exceptions, ProfanityProtection.Disallowed, ProfanityProtection.StartDisallowed ); //What am I doing wrong, this still allows chars like the <3 symbol... 3 AM. someone change this to use this //With testing on OSI, Guild stuff seems to follow a 'simpler' method of profanity protection - if( s.Length < 1 || s.Length > maxLength ) + if ( s.Length < 1 || s.Length > maxLength ) return false; char[] exceptions = ProfanityProtection.Exceptions; @@ -109,10 +109,10 @@ namespace Server.Guilds bool except = false; for( int j = 0; !except && j < exceptions.Length; j++ ) - if( c == exceptions[j] ) + if ( c == exceptions[j] ) except = true; - if( !except ) + if ( !except ) return false; } } @@ -125,7 +125,7 @@ namespace Server.Guilds return false; } - return true; + return true; } public void AddHtmlText( int x, int y, int width, int height, TextDefinition text, bool back, bool scroll ) @@ -141,4 +141,4 @@ namespace Server.Guilds return String.Format( "{1}", color, text ); } } -} \ No newline at end of file +} diff --git a/Scripts/Gumps/Guilds/New Guild System/BaseGuildListGump.cs b/Scripts/Gumps/Guilds/New Guild System/BaseGuildListGump.cs index 2d4da30d5..e9d0597e2 100644 --- a/Scripts/Gumps/Guilds/New Guild System/BaseGuildListGump.cs +++ b/Scripts/Gumps/Guilds/New Guild System/BaseGuildListGump.cs @@ -38,12 +38,12 @@ namespace Server.Guilds base.PopulateGump(); List list = m_List; - if( WillFilter ) + if ( WillFilter ) { m_List = new List(); for( int i = 0; i < list.Count; i++ ) { - if( !IsFiltered( list[i], m_Filter ) ) + if ( !IsFiltered( list[i], m_Filter ) ) m_List.Add( list[i] ); } } @@ -79,12 +79,12 @@ namespace Server.Guilds width += (f.Width + 12); } - if( m_StartNumber <= 0 ) + if ( m_StartNumber <= 0 ) AddButton( 65, 80, 0x15E3, 0x15E7, 0, GumpButtonType.Page, 0 ); else AddButton( 65, 80, 0x15E3, 0x15E7, 6, GumpButtonType.Reply, 0 ); // Back - if( m_StartNumber + itemsPerPage > m_List.Count ) + if ( m_StartNumber + itemsPerPage > m_List.Count ) AddButton( 95, 80, 0x15E1, 0x15E5, 0, GumpButtonType.Page, 0 ); else AddButton( 95, 80, 0x15E1, 0x15E5, 7, GumpButtonType.Reply, 0 ); // Forward @@ -93,7 +93,7 @@ namespace Server.Guilds int itemNumber = 0; - if( m_Ascending ) + if ( m_Ascending ) for( int i = m_StartNumber; i < m_StartNumber + itemsPerPage && i < m_List.Count; i++ ) DrawEntry( m_List[i], i, itemNumber++ ); else //descending, go from bottom of list to the top @@ -126,7 +126,7 @@ namespace Server.Guilds width += (f.Width + 12); } - if( HasRelationship( o ) ) + if ( HasRelationship( o ) ) AddButton( 40, 143 + itemNumber * 28, 0x8AF, 0x8AF, 200 + index, GumpButtonType.Reply, 0 ); //Info Button else AddButton( 40, 143 + itemNumber * 28, 0x4B9, 0x4BA, 200 + index, GumpButtonType.Reply, 0 ); //Info Button @@ -141,7 +141,7 @@ namespace Server.Guilds PlayerMobile pm = sender.Mobile as PlayerMobile; - if( pm == null || !IsMember( pm, guild ) ) + if ( pm == null || !IsMember( pm, guild ) ) return; int id = info.ButtonID; @@ -166,16 +166,16 @@ namespace Server.Guilds } } - if( id >= 100 && id < (100 + m_Fields.Length) ) + if ( id >= 100 && id < (100 + m_Fields.Length) ) { IComparer comparer = m_Fields[id-100].Comparer; - if( m_Comparer.GetType() == comparer.GetType() ) + if ( m_Comparer.GetType() == comparer.GetType() ) m_Ascending = !m_Ascending; pm.SendGump( GetResentGump( player, guild, comparer, m_Ascending, m_Filter, 0 ) ); } - else if( id >= 200 && id < ( 200 + m_List.Count ) ) + else if ( id >= 200 && id < ( 200 + m_List.Count ) ) { pm.SendGump( GetObjectInfoGump( player, guild, m_List[id - 200] ) ); } diff --git a/Scripts/Gumps/Guilds/New Guild System/Create Guild Gump.cs b/Scripts/Gumps/Guilds/New Guild System/Create Guild Gump.cs index 9d491f2d0..bdb426565 100644 --- a/Scripts/Gumps/Guilds/New Guild System/Create Guild Gump.cs +++ b/Scripts/Gumps/Guilds/New Guild System/Create Guild Gump.cs @@ -24,7 +24,7 @@ namespace Server.Guilds AddHtmlLocalized( 25, 60, 450, 60, 1062940, 0x0, false, false ); // As you are not a member of any guild, you can create your own by providing a unique guild name and paying the standard guild registration fee. AddHtmlLocalized( 25, 135, 120, 25, 1062941, 0x0, false, false ); // Registration Fee: AddLabel( 155, 135, 0x481, Guild.RegistrationFee.ToString() ); - AddHtmlLocalized( 25, 165, 120, 25, 1011140, 0x0, false, false ); // Enter Guild Name: + AddHtmlLocalized( 25, 165, 120, 25, 1011140, 0x0, false, false ); // Enter Guild Name: AddBackground( 155, 160, 320, 26, 0xBB8 ); AddTextEntry( 160, 163, 315, 21, 0x481, 5, guildName ); AddHtmlLocalized( 25, 191, 120, 26, 1063035, 0x0, false, false ); // Abbreviation: @@ -33,7 +33,7 @@ namespace Server.Guilds AddButton( 415, 217, 0xF7, 0xF8, 1, GumpButtonType.Reply, 0 ); AddButton( 345, 217, 0xF2, 0xF1, 0, GumpButtonType.Reply, 0 ); - if( pm.AcceptGuildInvites ) + if ( pm.AcceptGuildInvites ) AddButton( 20, 260, 0xD2, 0xD3, 2, GumpButtonType.Reply, 0 ); else AddButton( 20, 260, 0xD3, 0xD2, 2, GumpButtonType.Reply, 0 ); @@ -45,7 +45,7 @@ namespace Server.Guilds { PlayerMobile pm = sender.Mobile as PlayerMobile; - if( pm == null || pm.Guild != null ) + if ( pm == null || pm.Guild != null ) return; //Sanity switch( info.ButtonID ) @@ -61,19 +61,19 @@ namespace Server.Guilds guildName = Utility.FixHtml( guildName.Trim() ); guildAbbrev = Utility.FixHtml( guildAbbrev.Trim() ); - if( guildName.Length <= 0 ) + if ( guildName.Length <= 0 ) pm.SendLocalizedMessage( 1070884 ); // Guild name cannot be blank. - else if( guildAbbrev.Length <= 0 ) + else if ( guildAbbrev.Length <= 0 ) pm.SendLocalizedMessage( 1070885 ); // You must provide a guild abbreviation. - else if( guildName.Length > Guild.NameLimit ) + else if ( guildName.Length > Guild.NameLimit ) pm.SendLocalizedMessage( 1063036, Guild.NameLimit.ToString() ); // A guild name cannot be more than ~1_val~ characters in length. - else if( guildAbbrev.Length > Guild.AbbrevLimit ) + else if ( guildAbbrev.Length > Guild.AbbrevLimit ) pm.SendLocalizedMessage( 1063037, Guild.AbbrevLimit.ToString() ); // An abbreviation cannot exceed ~1_val~ characters in length. - else if( Guild.FindByAbbrev( guildAbbrev ) != null || !BaseGuildGump.CheckProfanity( guildAbbrev ) ) + else if ( Guild.FindByAbbrev( guildAbbrev ) != null || !BaseGuildGump.CheckProfanity( guildAbbrev ) ) pm.SendLocalizedMessage( 501153 ); // That abbreviation is not available. - else if( Guild.FindByName( guildName ) != null || !BaseGuildGump.CheckProfanity( guildName ) ) + else if ( Guild.FindByName( guildName ) != null || !BaseGuildGump.CheckProfanity( guildName ) ) pm.SendLocalizedMessage( 1063000 ); // That guild name is not available. - else if( !Banker.Withdraw( pm, Guild.RegistrationFee ) ) + else if ( !Banker.Withdraw( pm, Guild.RegistrationFee ) ) pm.SendLocalizedMessage( 1063001, Guild.RegistrationFee.ToString() ); // You do not possess the ~1_val~ gold piece fee required to create a guild. else { @@ -88,7 +88,7 @@ namespace Server.Guilds { pm.AcceptGuildInvites = !pm.AcceptGuildInvites; - if( pm.AcceptGuildInvites ) + if ( pm.AcceptGuildInvites ) pm.SendLocalizedMessage( 1070699 ); // You are now accepting guild invitations. else pm.SendLocalizedMessage( 1070698 ); // You are now ignoring guild invitations. @@ -98,4 +98,4 @@ namespace Server.Guilds } } } -} \ No newline at end of file +} diff --git a/Scripts/Gumps/Guilds/New Guild System/DiplomacyGump.cs b/Scripts/Gumps/Guilds/New Guild System/DiplomacyGump.cs index 4b9312784..f4b415c93 100644 --- a/Scripts/Gumps/Guilds/New Guild System/DiplomacyGump.cs +++ b/Scripts/Gumps/Guilds/New Guild System/DiplomacyGump.cs @@ -62,19 +62,19 @@ namespace Server.Guilds return -1; else if ( y == null ) return 1; - + GuildCompareStatus aStatus = GuildCompareStatus.Peace; GuildCompareStatus bStatus = GuildCompareStatus.Peace; - if( m_Guild.IsAlly( x ) ) + if ( m_Guild.IsAlly( x ) ) aStatus = GuildCompareStatus.Ally; - else if( m_Guild.IsWar( x ) ) + else if ( m_Guild.IsWar( x ) ) aStatus = GuildCompareStatus.War; - - if( m_Guild.IsAlly( y ) ) + + if ( m_Guild.IsAlly( y ) ) bStatus = GuildCompareStatus.Ally; - else if( m_Guild.IsWar( y ) ) + else if ( m_Guild.IsWar( y ) ) bStatus = GuildCompareStatus.War; return ((int)aStatus).CompareTo( (int)bStatus ); @@ -106,7 +106,7 @@ namespace Server.Guilds GuildDisplayType m_Display; TextDefinition m_LowerText; - public GuildDiplomacyGump( PlayerMobile pm, Guild g ) + public GuildDiplomacyGump( PlayerMobile pm, Guild g ) : this( pm, g, GuildDiplomacyGump.NameComparer.Instance, true, "", 0, GuildDisplayType.All, Utility.CastConvertList( new List( Guild.List.Values ) ), (1063136 + (int)GuildDisplayType.All) ) { } @@ -121,7 +121,7 @@ namespace Server.Guilds { } - public GuildDiplomacyGump( PlayerMobile pm, Guild g, bool ascending, string filter, int startNumber, List list, TextDefinition lowerText ) + public GuildDiplomacyGump( PlayerMobile pm, Guild g, bool ascending, string filter, int startNumber, List list, TextDefinition lowerText ) : this( pm, g, GuildDiplomacyGump.NameComparer.Instance, ascending, filter, startNumber, GuildDisplayType.All, list, lowerText ) { } @@ -145,7 +145,7 @@ namespace Server.Guilds { base.PopulateGump(); - AddHtmlLocalized( 431, 43, 110, 26, 1062978, 0xF, false, false ); // Diplomacy + AddHtmlLocalized( 431, 43, 110, 26, 1062978, 0xF, false, false ); // Diplomacy } protected override TextDefinition[] GetValuesFor( Guild g, int aryLength ) @@ -158,14 +158,14 @@ namespace Server.Guilds defs[2] = 3000085; //Peace - if( guild.IsAlly( g ) ) + if ( guild.IsAlly( g ) ) { - if( guild.Alliance.Leader == g ) + if ( guild.Alliance.Leader == g ) defs[2] = 1063237; // Alliance Leader else defs[2] = 1062964; // Ally } - else if( guild.IsWar( g ) ) + else if ( guild.IsWar( g ) ) { defs[2] = 3000086; // War } @@ -175,18 +175,18 @@ namespace Server.Guilds public override bool HasRelationship( Guild g ) { - if( g == guild ) + if ( g == guild ) return false; - if( guild.FindPendingWar( g ) != null ) + if ( guild.FindPendingWar( g ) != null ) return true; AllianceInfo alliance = guild.Alliance; - if( alliance != null ) + if ( alliance != null ) { Guild leader = alliance.Leader; - + if ( leader != null ) { if ( guild == leader && alliance.IsPendingMember( g ) || g == leader && alliance.IsPendingMember( guild ) ) @@ -209,7 +209,7 @@ namespace Server.Guilds else if ( m_LowerText != null && m_LowerText.String != null ) AddHtml( 66, 153 + itemNumber * 28, 280, 26, Color( m_LowerText.String, 0x99 ), false, false ); - if( AllowAdvancedSearch ) + if ( AllowAdvancedSearch ) { AddBackground( 350, 148 + itemNumber * 28, 200, 26, 0x2486 ); AddButton( 355, 153 + itemNumber * 28, 0x845, 0x846, 8, GumpButtonType.Reply, 0 ); @@ -220,18 +220,18 @@ namespace Server.Guilds protected override bool IsFiltered( Guild g, string filter ) { - if( g == null ) + if ( g == null ) return true; switch( m_Display ) { case GuildDisplayType.Relations: { - //if( !( guild.IsWar( g ) || guild.IsAlly( g ) ) ) + //if ( !( guild.IsWar( g ) || guild.IsAlly( g ) ) ) - if( !( guild.FindActiveWar( g ) != null || guild.IsAlly( g ) ) ) //As per OSI, only the guild leader wars show up under the sorting by relation + if ( !( guild.FindActiveWar( g ) != null || guild.IsAlly( g ) ) ) //As per OSI, only the guild leader wars show up under the sorting by relation return true; - + return false; } case GuildDisplayType.AwaitingAction: @@ -247,7 +247,7 @@ namespace Server.Guilds { get { - if( m_Display == GuildDisplayType.All ) + if ( m_Display == GuildDisplayType.All ) return base.WillFilter; return true; @@ -262,7 +262,7 @@ namespace Server.Guilds public override Gump GetObjectInfoGump( PlayerMobile pm, Guild g, Guild o ) { - if( guild == o ) + if ( guild == o ) return new GuildInfoGump( pm, g ); return new OtherGuildInfo( pm, g, (Guild)o ) ; @@ -274,10 +274,10 @@ namespace Server.Guilds PlayerMobile pm = sender.Mobile as PlayerMobile; - if( pm == null || !IsMember( pm, guild ) ) + if ( pm == null || !IsMember( pm, guild ) ) return; - if( AllowAdvancedSearch && info.ButtonID == 8 ) + if ( AllowAdvancedSearch && info.ButtonID == 8 ) pm.SendGump( new GuildAdvancedSearchGump( pm, guild, m_Display, new SearchSelectionCallback( AdvancedSearch_Callback ) )); } @@ -288,4 +288,4 @@ namespace Server.Guilds ResendGump(); } } -} \ No newline at end of file +} diff --git a/Scripts/Gumps/Guilds/New Guild System/GuildInfoGump.cs b/Scripts/Gumps/Guilds/New Guild System/GuildInfoGump.cs index f3f4af0b6..21c60c832 100644 --- a/Scripts/Gumps/Guilds/New Guild System/GuildInfoGump.cs +++ b/Scripts/Gumps/Guilds/New Guild System/GuildInfoGump.cs @@ -37,13 +37,13 @@ namespace Server.Guilds AddImageTiled( 67, 116, 156, 22, 0xBBC ); AddHtmlLocalized( 70, 117, 150, 20, 1063025, 0x0, false, false ); // Alliance - if( guild.Alliance != null && guild.Alliance.IsMember( guild ) ) + if ( guild.Alliance != null && guild.Alliance.IsMember( guild ) ) { AddHtml( 233, 118, 320, 26, guild.Alliance.Name, false, false ); AddButton( 40, 120, 0x4B9, 0x4BA, 6, GumpButtonType.Reply, 0 ); //Alliance Roster } - if( Guild.OrderChaos && isLeader ) + if ( Guild.OrderChaos && isLeader ) AddButton( 40, 154, 0x4B9, 0x4BA, 100, GumpButtonType.Reply, 0 ); // Guild Faction AddImageTiled( 65, 148, 160, 26, 0xA40 ); @@ -53,27 +53,27 @@ namespace Server.Guilds GuildType gt; Faction f; - if( ( gt = guild.Type ) != GuildType.Regular ) + if ( ( gt = guild.Type ) != GuildType.Regular ) AddHtml( 233, 152, 320, 26, gt.ToString(), false, false ); - else if( ( f = Faction.Find( guild.Leader ) ) != null ) + else if ( ( f = Faction.Find( guild.Leader ) ) != null ) AddHtml( 233, 152, 320, 26, f.ToString(), false, false ); AddImageTiled( 65, 196, 480, 4, 0x238D ); string s = guild.Charter; - if( String.IsNullOrEmpty( s ) ) + if ( String.IsNullOrEmpty( s ) ) s = "The guild leader has not yet set the guild charter."; AddHtml( 65, 216, 480, 80, s, true, true ); - if( isLeader ) + if ( isLeader ) AddButton( 40, 251, 0x4B9, 0x4BA, 4, GumpButtonType.Reply, 0 ); //Charter Edit button s = guild.Website; - if( string.IsNullOrEmpty( s ) ) + if ( string.IsNullOrEmpty( s ) ) s = "Guild website not yet set."; AddHtml( 65, 306, 480, 30, s, true, false ); - if( isLeader ) + if ( isLeader ) AddButton( 40, 313, 0x4B9, 0x4BA, 5, GumpButtonType.Reply, 0 ); //Website Edit button AddCheck( 65, 370, 0xD2, 0xD3, player.DisplayGuildTitle, 0 ); @@ -90,18 +90,18 @@ namespace Server.Guilds PlayerMobile pm = sender.Mobile as PlayerMobile; - if( !IsMember( pm, guild ) ) + if ( !IsMember( pm, guild ) ) return; - + pm.DisplayGuildTitle = info.IsSwitched( 0 ); - + switch( info.ButtonID ) { //1-3 handled by base.OnResponse case 4: { - if( IsLeader( pm, guild ) ) + if ( IsLeader( pm, guild ) ) { pm.SendLocalizedMessage( 1013071 ); // Enter the new guild charter (50 characters max): @@ -111,7 +111,7 @@ namespace Server.Guilds } case 5: { - if( IsLeader( pm, guild ) ) + if ( IsLeader( pm, guild ) ) { pm.SendLocalizedMessage( 1013072 ); // Enter the new website for the guild (50 characters max): pm.BeginPrompt( new PromptCallback( SetWebsite_Callback ), true ); //Have the same callback handle both canceling and deletion cause the 2nd callback would just get a text of "" @@ -121,7 +121,7 @@ namespace Server.Guilds case 6: { //Alliance Roster - if( guild.Alliance != null && guild.Alliance.IsMember( guild ) ) + if ( guild.Alliance != null && guild.Alliance.IsMember( guild ) ) pm.SendGump( new AllianceInfo.AllianceRosterGump( pm, guild, guild.Alliance ) ); break; @@ -129,7 +129,7 @@ namespace Server.Guilds case 7: { //Resign - if( !m_IsResigning ) + if ( !m_IsResigning ) { pm.SendLocalizedMessage( 1063332 ); // Are you sure you wish to resign from your guild? pm.SendGump( new GuildInfoGump( pm, guild, true ) ); @@ -143,7 +143,7 @@ namespace Server.Guilds case 100: // Custom code to support Order/Chaos in the new guild system { // Guild Faction - if( Guild.OrderChaos && IsLeader( pm, guild ) ) + if ( Guild.OrderChaos && IsLeader( pm, guild ) ) { pm.CloseGump( typeof( GuildChangeTypeGump ) ); pm.SendGump( new GuildChangeTypeGump( pm, guild ) ); @@ -155,12 +155,12 @@ namespace Server.Guilds public void SetCharter_Callback( Mobile from, string text ) { - if( !IsLeader( from, guild ) ) + if ( !IsLeader( from, guild ) ) return; string charter = Utility.FixHtml( text.Trim() ); - if( charter.Length > 50 ) + if ( charter.Length > 50 ) { from.SendLocalizedMessage( 1070774, "50" ); // Your guild charter cannot exceed ~1_val~ characters. } @@ -174,12 +174,12 @@ namespace Server.Guilds public void SetWebsite_Callback( Mobile from, string text ) { - if( !IsLeader( from, guild ) ) + if ( !IsLeader( from, guild ) ) return; string site = Utility.FixHtml( text.Trim() ); - if( site.Length > 50 ) + if ( site.Length > 50 ) from.SendLocalizedMessage( 1070777, "50" ); // Your guild website cannot exceed ~1_val~ characters. else { diff --git a/Scripts/Gumps/Guilds/New Guild System/GuildInvitationRequest.cs b/Scripts/Gumps/Guilds/New Guild System/GuildInvitationRequest.cs index 6653f2093..4fb2dfd44 100644 --- a/Scripts/Gumps/Guilds/New Guild System/GuildInvitationRequest.cs +++ b/Scripts/Gumps/Guilds/New Guild System/GuildInvitationRequest.cs @@ -32,7 +32,7 @@ namespace Server.Guilds public override void OnResponse( NetState sender, RelayInfo info ) { - if( guild.Disbanded || player.Guild != null ) + if ( guild.Disbanded || player.Guild != null ) return; switch( info.ButtonID ) @@ -50,7 +50,7 @@ namespace Server.Guilds break; } - case 2: + case 2: { player.AcceptGuildInvites = false; player.SendLocalizedMessage( 1070698 ); // You are now ignoring guild invitations. @@ -60,4 +60,4 @@ namespace Server.Guilds } } } -} \ No newline at end of file +} diff --git a/Scripts/Gumps/Guilds/New Guild System/GuildMemberInfoGump.cs b/Scripts/Gumps/Guilds/New Guild System/GuildMemberInfoGump.cs index d0c7f1d62..b5d73a3e1 100644 --- a/Scripts/Gumps/Guilds/New Guild System/GuildMemberInfoGump.cs +++ b/Scripts/Gumps/Guilds/New Guild System/GuildMemberInfoGump.cs @@ -28,13 +28,13 @@ namespace Server.Guilds AddBackground( 0, 0, 350, 255, 0x242C ); AddHtmlLocalized( 20, 15, 310, 26, 1063018, 0x0, false, false ); //
Guild Member Information
AddImageTiled( 20, 40, 310, 2, 0x2711 ); - + AddHtmlLocalized( 20, 50, 150, 26, 1062955, 0x0, true, false ); // Name AddHtml( 180, 53, 150, 26, m_Member.Name, false, false ); - + AddHtmlLocalized( 20, 80, 150, 26, 1062956, 0x0, true, false ); // Rank AddHtmlLocalized( 180, 83, 150, 26, m_Member.GuildRank.Name, 0x0, false, false ); - + AddHtmlLocalized( 20, 110, 150, 26, 1062953, 0x0, true, false ); // Guild Title AddHtml( 180, 113, 150, 26, m_Member.GuildTitle, false, false ); AddImageTiled( 20, 142, 310, 2, 0x2711 ); @@ -42,19 +42,19 @@ namespace Server.Guilds AddBackground( 20, 150, 310, 26, 0x2486 ); AddButton( 25, 155, 0x845, 0x846, 4, GumpButtonType.Reply, 0 ); AddHtmlLocalized( 50, 153, 270, 26, (m_Member == player.GuildFealty && guild.Leader != m_Member) ? 1063082 : 1062996, 0x0, false, false ); // Clear/Cast Vote For This Member - + AddBackground( 20, 180, 150, 26, 0x2486 ); AddButton( 25, 185, 0x845, 0x846, 1, GumpButtonType.Reply, 0 ); AddHtmlLocalized( 50, 183, 110, 26, 1062993, (m_ToLeader)? 0x990000 : 0, false, false ); // Promote - + AddBackground( 180, 180, 150, 26, 0x2486 ); AddButton( 185, 185, 0x845, 0x846, 3, GumpButtonType.Reply, 0 ); AddHtmlLocalized( 210, 183, 110, 26, 1062995, 0x0, false, false ); // Set Guild Title - + AddBackground( 20, 210, 150, 26, 0x2486 ); AddButton( 25, 215, 0x845, 0x846, 2, GumpButtonType.Reply, 0 ); AddHtmlLocalized( 50, 213, 110, 26, 1062994, 0x0, false, false ); // Demote - + AddBackground( 180, 210, 150, 26, 0x2486 ); AddButton( 185, 215, 0x845, 0x846, 5, GumpButtonType.Reply, 0 ); AddHtmlLocalized( 210, 213, 110, 26, 1062997, (m_toKick)? 0x5000 : 0, false, false ); // Kick @@ -64,7 +64,7 @@ namespace Server.Guilds { PlayerMobile pm = sender.Mobile as PlayerMobile; - if( pm == null || !IsMember( pm, guild ) || !IsMember( m_Member, guild ) ) + if ( pm == null || !IsMember( pm, guild ) || !IsMember( m_Member, guild ) ) return; RankDefinition playerRank = pm.GuildRank; @@ -74,13 +74,13 @@ namespace Server.Guilds { case 1: //Promote { - if( playerRank.GetFlag( RankFlags.CanPromoteDemote ) && ((playerRank.Rank -1 ) > targetRank.Rank || ( playerRank == RankDefinition.Leader && playerRank.Rank > targetRank.Rank )) ) + if ( playerRank.GetFlag( RankFlags.CanPromoteDemote ) && ((playerRank.Rank -1 ) > targetRank.Rank || ( playerRank == RankDefinition.Leader && playerRank.Rank > targetRank.Rank )) ) { targetRank = RankDefinition.Ranks[targetRank.Rank + 1]; - if( targetRank == RankDefinition.Leader ) + if ( targetRank == RankDefinition.Leader ) { - if( m_ToLeader ) + if ( m_ToLeader ) { m_Member.GuildRank = targetRank; pm.SendLocalizedMessage( 1063156, m_Member.Name ); // The guild information for ~1_val~ has been updated. @@ -106,11 +106,11 @@ namespace Server.Guilds } case 2: //Demote { - if( playerRank.GetFlag( RankFlags.CanPromoteDemote ) && playerRank.Rank > targetRank.Rank ) + if ( playerRank.GetFlag( RankFlags.CanPromoteDemote ) && playerRank.Rank > targetRank.Rank ) { - if( targetRank == RankDefinition.Lowest ) + if ( targetRank == RankDefinition.Lowest ) { - if( RankDefinition.Lowest.Name.Number == 1062963 ) + if ( RankDefinition.Lowest.Name.Number == 1062963 ) pm.SendLocalizedMessage( 1063333 ); // You can't demote a ronin. else pm.SendMessage( "You can't demote a {0}.", RankDefinition.Lowest.Name ); @@ -123,19 +123,19 @@ namespace Server.Guilds } else pm.SendLocalizedMessage( 1063146 ); // You don't have permission to demote this member. - + break; } case 3: //Set Guild title { - if( playerRank.GetFlag( RankFlags.CanSetGuildTitle ) && ( playerRank.Rank > targetRank.Rank || m_Member == player)) + if ( playerRank.GetFlag( RankFlags.CanSetGuildTitle ) && ( playerRank.Rank > targetRank.Rank || m_Member == player)) { pm.SendLocalizedMessage( 1011128 ); // Enter the new title for this guild member or 'none' to remove a title: pm.BeginPrompt( new PromptCallback( SetTitle_Callback ) ); } - else if( m_Member.GuildTitle == null || m_Member.GuildTitle.Length <= 0 ) + else if ( m_Member.GuildTitle == null || m_Member.GuildTitle.Length <= 0 ) { pm.SendLocalizedMessage( 1070746 ); // You don't have the permission to set that member's guild title. } @@ -148,13 +148,13 @@ namespace Server.Guilds } case 4: //Vote { - if( m_Member == pm.GuildFealty && guild.Leader != m_Member ) + if ( m_Member == pm.GuildFealty && guild.Leader != m_Member ) pm.SendLocalizedMessage( 1063158 ); // You have cleared your vote for guild leader. - else if( guild.CanVote( m_Member ) )//( playerRank.GetFlag( RankFlags.CanVote ) ) + else if ( guild.CanVote( m_Member ) )//( playerRank.GetFlag( RankFlags.CanVote ) ) { - if( m_Member == guild.Leader ) + if ( m_Member == guild.Leader ) pm.SendLocalizedMessage( 1063424 ); // You can't vote for the current guild leader. - else if( !guild.CanBeVotedFor( m_Member ) ) + else if ( !guild.CanBeVotedFor( m_Member ) ) pm.SendLocalizedMessage( 1063425 ); // You can't vote for an inactive guild member. else { @@ -169,9 +169,9 @@ namespace Server.Guilds } case 5: //Kick { - if( ( playerRank.GetFlag( RankFlags.RemovePlayers ) && playerRank.Rank > targetRank.Rank ) || ( playerRank.GetFlag( RankFlags.RemoveLowestRank ) && targetRank == RankDefinition.Lowest ) ) + if ( ( playerRank.GetFlag( RankFlags.RemovePlayers ) && playerRank.Rank > targetRank.Rank ) || ( playerRank.GetFlag( RankFlags.RemoveLowestRank ) && targetRank == RankDefinition.Lowest ) ) { - if( m_toKick ) + if ( m_toKick ) { guild.RemoveMember( m_Member ); pm.SendLocalizedMessage( 1063157 ); // The member has been removed from your guild. @@ -195,14 +195,14 @@ namespace Server.Guilds PlayerMobile pm = from as PlayerMobile; PlayerMobile targ = m_Member; - if( pm == null || targ == null ) + if ( pm == null || targ == null ) return; Guild g = targ.Guild as Guild; - if( g == null || !IsMember( pm, g ) || !(pm.GuildRank.GetFlag( RankFlags.CanSetGuildTitle ) && (pm.GuildRank.Rank > targ.GuildRank.Rank || pm == targ)) ) + if ( g == null || !IsMember( pm, g ) || !(pm.GuildRank.GetFlag( RankFlags.CanSetGuildTitle ) && (pm.GuildRank.Rank > targ.GuildRank.Rank || pm == targ)) ) { - if( m_Member.GuildTitle == null || m_Member.GuildTitle.Length <= 0 ) + if ( m_Member.GuildTitle == null || m_Member.GuildTitle.Length <= 0 ) pm.SendLocalizedMessage( 1070746 ); // You don't have the permission to set that member's guild title. else pm.SendLocalizedMessage( 1063148 ); // You don't have permission to change this member's guild title. @@ -213,13 +213,13 @@ namespace Server.Guilds string title = Utility.FixHtml( text.Trim() ); - if( title.Length > 20 ) + if ( title.Length > 20 ) from.SendLocalizedMessage( 501178 ); // That title is too long. - else if( !BaseGuildGump.CheckProfanity( title ) ) + else if ( !BaseGuildGump.CheckProfanity( title ) ) from.SendLocalizedMessage( 501179 ); // That title is disallowed. else { - if( Insensitive.Equals( title, "none" ) ) + if ( Insensitive.Equals( title, "none" ) ) targ.GuildTitle = null; else targ.GuildTitle = title; @@ -228,4 +228,4 @@ namespace Server.Guilds } } } -} \ No newline at end of file +} diff --git a/Scripts/Gumps/Guilds/New Guild System/GuildRosterGump.cs b/Scripts/Gumps/Guilds/New Guild System/GuildRosterGump.cs index 738b83603..9713980be 100644 --- a/Scripts/Gumps/Guilds/New Guild System/GuildRosterGump.cs +++ b/Scripts/Gumps/Guilds/New Guild System/GuildRosterGump.cs @@ -108,7 +108,7 @@ namespace Server.Guilds #endregion - private static InfoField[] m_Fields = + private static InfoField[] m_Fields = new InfoField[] { new InfoField( 1062955, 130, GuildRosterGump.NameComparer.Instance ), //Name @@ -147,14 +147,14 @@ namespace Server.Guilds string name = String.Format( "{0}{1}", pm.Name, ( player.GuildFealty == pm && player.GuildFealty != guild.Leader ) ? " *" : "" ); - if( pm == player ) + if ( pm == player ) name = Color( name, 0x006600 ); - else if( pm.NetState != null ) + else if ( pm.NetState != null ) name = Color( name, 0x000066 ); defs[0] = name; defs[1] = pm.GuildRank.Name; - defs[2] = (pm.NetState != null) ? new TextDefinition( 1063015 ): new TextDefinition( pm.LastOnline.ToString( "yyyy-MM-dd" ) ); + defs[2] = (pm.NetState != null) ? new TextDefinition( 1063015 ): new TextDefinition( pm.LastOnline.ToString( "yyyy-MM-dd" ) ); defs[3] = (pm.GuildTitle == null) ? "" : pm.GuildTitle; return defs; @@ -162,7 +162,7 @@ namespace Server.Guilds protected override bool IsFiltered( PlayerMobile pm, string filter ) { - if( pm == null ) + if ( pm == null ) return true; return !Insensitive.Contains( pm.Name, filter ); @@ -184,12 +184,12 @@ namespace Server.Guilds PlayerMobile pm = sender.Mobile as PlayerMobile; - if( pm == null || !IsMember( pm, guild ) ) + if ( pm == null || !IsMember( pm, guild ) ) return; - if( info.ButtonID == 8 ) + if ( info.ButtonID == 8 ) { - if( pm.GuildRank.GetFlag( RankFlags.CanInvitePlayer ) ) + if ( pm.GuildRank.GetFlag( RankFlags.CanInvitePlayer ) ) { pm.SendLocalizedMessage( 1063048 ); // Whom do you wish to invite into your guild? pm.BeginTarget( -1, false, Targeting.TargetFlags.None, new TargetStateCallback( InvitePlayer_Callback ), guild ); @@ -212,32 +212,32 @@ namespace Server.Guilds Faction guildFaction = ( guildState == null ? null : guildState.Faction ); Faction targetFaction = ( targetState == null ? null : targetState.Faction ); - if( pm == null || !IsMember( pm, guild ) || !pm.GuildRank.GetFlag( RankFlags.CanInvitePlayer ) ) + if ( pm == null || !IsMember( pm, guild ) || !pm.GuildRank.GetFlag( RankFlags.CanInvitePlayer ) ) { pm.SendLocalizedMessage( 503301 ); // You don't have permission to do that. } - else if( targ == null ) + else if ( targ == null ) { pm.SendLocalizedMessage( 1063334 ); // That isn't a valid player. } - else if( !targ.AcceptGuildInvites ) + else if ( !targ.AcceptGuildInvites ) { pm.SendLocalizedMessage( 1063049, targ.Name ); // ~1_val~ is not accepting guild invitations. } - else if( g.IsMember( targ ) ) + else if ( g.IsMember( targ ) ) { pm.SendLocalizedMessage( 1063050, targ.Name ); // ~1_val~ is already a member of your guild! } - else if( targ.Guild != null ) + else if ( targ.Guild != null ) { pm.SendLocalizedMessage( 1063051, targ.Name ); // ~1_val~ is already a member of a guild. } - else if( targ.HasGump( typeof( BaseGuildGump ) ) || targ.HasGump( typeof( CreateGuildGump ) )) //TODO: Check message if CreateGuildGump Open + else if ( targ.HasGump( typeof( BaseGuildGump ) ) || targ.HasGump( typeof( CreateGuildGump ) )) //TODO: Check message if CreateGuildGump Open { pm.SendLocalizedMessage( 1063052, targ.Name ); // ~1_val~ is currently considering another guild invitation. } #region Factions - else if( targ.Young && guildFaction != null ) + else if ( targ.Young && guildFaction != null ) { pm.SendLocalizedMessage( 1070766 ); // You cannot invite a young player to your faction-aligned guild. } @@ -263,4 +263,4 @@ namespace Server.Guilds } } } -} \ No newline at end of file +} diff --git a/Scripts/Gumps/Guilds/New Guild System/OtherGuildInfo.cs b/Scripts/Gumps/Guilds/New Guild System/OtherGuildInfo.cs index a75dc70cb..d8a6966e1 100644 --- a/Scripts/Gumps/Guilds/New Guild System/OtherGuildInfo.cs +++ b/Scripts/Gumps/Guilds/New Guild System/OtherGuildInfo.cs @@ -16,7 +16,7 @@ namespace Server.Guilds m_Other = otherGuild; g.CheckExpiredWars(); - + PopulateGump(); } @@ -31,7 +31,7 @@ namespace Server.Guilds { Guild g = Guild.GetAllianceLeader( guild ); Guild other = Guild.GetAllianceLeader( m_Other ); - + WarDeclaration war = g.FindPendingWar( other ); WarDeclaration activeWar = g.FindActiveWar( other ); @@ -51,14 +51,14 @@ namespace Server.Guilds AddHtmlLocalized( 20, 80, 120, 26, 1063025, 0x0, true, false ); // Alliance - if( otherAlliance != null ) + if ( otherAlliance != null ) { - if( otherAlliance.IsMember( m_Other )) + if ( otherAlliance.IsMember( m_Other )) { AddHtml( 150, 83, 360, 26, otherAlliance.Name, false, false ); } - //else if( otherAlliance.Leader == guild && ( otherAlliance.IsPendingMember( m_Other ) || otherAlliance.IsPendingMember( guild ) ) ) - /* else if( (otherAlliance.Leader == guild && otherAlliance.IsPendingMember( m_Other ) ) || ( otherAlliance.Leader == m_Other && otherAlliance.IsPendingMember( guild ) ) ) + //else if ( otherAlliance.Leader == guild && ( otherAlliance.IsPendingMember( m_Other ) || otherAlliance.IsPendingMember( guild ) ) ) + /* else if ( (otherAlliance.Leader == guild && otherAlliance.IsPendingMember( m_Other ) ) || ( otherAlliance.Leader == m_Other && otherAlliance.IsPendingMember( guild ) ) ) { AddHtml( 150, 83, 360, 26, Color( alliance.Name, 0xF), false, false ); } @@ -74,33 +74,33 @@ namespace Server.Guilds string kills = "0/0"; string time = "00:00"; string otherKills = "0/0"; - + WarDeclaration otherWar; - if( ActiveWar ) + if ( ActiveWar ) { kills = String.Format( "{0}/{1}", activeWar.Kills, activeWar.MaxKills ); TimeSpan timeRemaining = TimeSpan.Zero; - if( activeWar.WarLength != TimeSpan.Zero && (activeWar.WarBeginning + activeWar.WarLength) > DateTime.UtcNow ) + if ( activeWar.WarLength != TimeSpan.Zero && (activeWar.WarBeginning + activeWar.WarLength) > DateTime.UtcNow ) timeRemaining = (activeWar.WarBeginning + activeWar.WarLength) - DateTime.UtcNow; //time = String.Format( "{0:D2}:{1:D2}", timeRemaining.Hours.ToString(), timeRemaining.Subtract( TimeSpan.FromHours( timeRemaining.Hours ) ).Minutes ); //Is there a formatter for htis? it's 2AM and I'm tired and can't find it time = String.Format( "{0:D2}:{1:mm}", timeRemaining.Hours, DateTime.MinValue + timeRemaining ); otherWar = m_Other.FindActiveWar( guild ); - if( otherWar != null ) + if ( otherWar != null ) otherKills = String.Format( "{0}/{1}", otherWar.Kills, otherWar.MaxKills ); } - else if( PendingWar ) + else if ( PendingWar ) { kills = Color( String.Format( "{0}/{1}", war.Kills, war.MaxKills ), 0x990000 ); //time = Color( String.Format( "{0}:{1}", war.WarLength.Hours, ((TimeSpan)(war.WarLength - TimeSpan.FromHours( war.WarLength.Hours ))).Minutes ), 0xFF0000 ); time = Color( String.Format( "{0:D2}:{1:mm}", war.WarLength.Hours, DateTime.MinValue + war.WarLength ), 0x990000 ); otherWar = m_Other.FindPendingWar( guild ); - if( otherWar != null ) + if ( otherWar != null ) otherKills = Color( String.Format( "{0}/{1}", otherWar.Kills, otherWar.MaxKills ), 0x990000 ); } @@ -116,11 +116,11 @@ namespace Server.Guilds AddImageTiled( 20, 172, 480, 2, 0x2711 ); int number = 1062973;//
You are at peace with this guild.
- - if( PendingWar ) + + if ( PendingWar ) { - if( war.WarRequester ) + if ( war.WarRequester ) { number = 1063027; //
You have challenged this guild to war!
} @@ -134,18 +134,18 @@ namespace Server.Guilds AddButtonAndBackground( 20, 290, 7, 1062982 ); // Dismiss Challenge } - else if( ActiveWar ) + else if ( ActiveWar ) { number = 1062965; //
You are at war with this guild!
AddButtonAndBackground( 20, 290, 8, 1062980 ); // Surrender } else if ( alliance != null && alliance == otherAlliance ) //alliance, Same Alliance { - if( alliance.IsMember( guild ) && alliance.IsMember( m_Other ) ) //Both in Same alliance, full members + if ( alliance.IsMember( guild ) && alliance.IsMember( m_Other ) ) //Both in Same alliance, full members { number = 1062970; //
You are allied with this guild.
- if( alliance.Leader == guild ) + if ( alliance.Leader == guild ) { AddButtonAndBackground( 20, 260, 12, 1062984 ); // Remove Guild from Alliance AddButtonAndBackground( 275, 260, 13, 1063433 ); // Promote to Alliance Leader //Note: No 'confirmation' like the other leader guild promotion things @@ -157,7 +157,7 @@ namespace Server.Guilds //Leave Alliance AddButtonAndBackground( 20, 290, 11, 1062985 ); // Leave Alliance } - else if( alliance.Leader == guild && alliance.IsPendingMember( m_Other ) ) + else if ( alliance.Leader == guild && alliance.IsPendingMember( m_Other ) ) { number = 1062971; //
You have requested an alliance with this guild.
@@ -168,7 +168,7 @@ namespace Server.Guilds AddHtml( 150, 83, 360, 26, Color( alliance.Name, 0x99 ), false, false ); } - else if( alliance.Leader == m_Other && alliance.IsPendingMember( guild ) ) + else if ( alliance.Leader == m_Other && alliance.IsPendingMember( guild ) ) { number = 1062972; //
This guild has requested an alliance.
@@ -184,7 +184,7 @@ namespace Server.Guilds } else { - AddButtonAndBackground( 20, 260, 2, 1062990 ); // Request Alliance + AddButtonAndBackground( 20, 260, 2, 1062990 ); // Request Alliance AddButtonAndBackground( 20, 290, 1, 1062989 ); // Declare War! } @@ -199,11 +199,11 @@ namespace Server.Guilds { PlayerMobile pm = sender.Mobile as PlayerMobile; - if( !IsMember( pm, guild ) ) + if ( !IsMember( pm, guild ) ) return; RankDefinition playerRank = pm.GuildRank; - + Guild guildLeader = Guild.GetAllianceLeader( guild ); Guild otherGuild = Guild.GetAllianceLeader( m_Other ); @@ -219,13 +219,13 @@ namespace Server.Guilds #region War case 5: //Accept the war { - if( war != null && !war.WarRequester && activeWar == null ) + if ( war != null && !war.WarRequester && activeWar == null ) { - if( !playerRank.GetFlag( RankFlags.ControlWarStatus ) ) + if ( !playerRank.GetFlag( RankFlags.ControlWarStatus ) ) { pm.SendLocalizedMessage( 1063440 ); // You don't have permission to negotiate wars. } - else if( alliance != null && alliance.Leader != guild ) + else if ( alliance != null && alliance.Leader != guild ) { pm.SendLocalizedMessage( 1063239, String.Format( "{0}\t{1}", guild.Name, alliance.Name ) ); // ~1_val~ is not the leader of the ~2_val~ alliance. pm.SendLocalizedMessage( 1070707, alliance.Leader.Name ); // You need to negotiate via ~1_val~ instead. @@ -237,7 +237,7 @@ namespace Server.Guilds war.WarBeginning = DateTime.UtcNow; guild.AcceptedWars.Add( war ); - if( alliance != null && alliance.IsMember( guild ) ) + if ( alliance != null && alliance.IsMember( guild ) ) { alliance.AllianceMessage( 1070769, ((otherAlliance != null) ? otherAlliance.Name : otherGuild.Name) ); // Guild Message: Your guild is now at war with ~1_GUILDNAME~ alliance.InvalidateMemberProperties(); @@ -253,7 +253,7 @@ namespace Server.Guilds otherWar.WarBeginning = DateTime.UtcNow; otherGuild.AcceptedWars.Add( otherWar ); - if( otherAlliance != null && m_Other.Alliance.IsMember( m_Other ) ) + if ( otherAlliance != null && m_Other.Alliance.IsMember( m_Other ) ) { otherAlliance.AllianceMessage( 1070769, ((alliance != null) ? alliance.Name : guild.Name) ); // Guild Message: Your guild is now at war with ~1_GUILDNAME~ otherAlliance.InvalidateMemberProperties(); @@ -270,13 +270,13 @@ namespace Server.Guilds } case 6: //Modify war terms { - if( war != null && !war.WarRequester && activeWar == null ) + if ( war != null && !war.WarRequester && activeWar == null ) { - if( !playerRank.GetFlag( RankFlags.ControlWarStatus ) ) + if ( !playerRank.GetFlag( RankFlags.ControlWarStatus ) ) { pm.SendLocalizedMessage( 1063440 ); // You don't have permission to negotiate wars. } - else if( alliance != null && alliance.Leader != guild ) + else if ( alliance != null && alliance.Leader != guild ) { pm.SendLocalizedMessage( 1063239, String.Format( "{0}\t{1}", guild.Name, alliance.Name ) ); // ~1_val~ is not the leader of the ~2_val~ alliance. pm.SendLocalizedMessage( 1070707, alliance.Leader.Name ); // You need to negotiate via ~1_val~ instead. @@ -290,19 +290,19 @@ namespace Server.Guilds } case 7: //Dismiss war { - if( war != null ) + if ( war != null ) { - if( !playerRank.GetFlag( RankFlags.ControlWarStatus ) ) + if ( !playerRank.GetFlag( RankFlags.ControlWarStatus ) ) { pm.SendLocalizedMessage( 1063440 ); // You don't have permission to negotiate wars. } - else if( alliance != null && alliance.Leader != guild ) + else if ( alliance != null && alliance.Leader != guild ) { pm.SendLocalizedMessage( 1063239, String.Format( "{0}\t{1}", guild.Name, alliance.Name ) ); // ~1_val~ is not the leader of the ~2_val~ alliance. pm.SendLocalizedMessage( 1070707, alliance.Leader.Name ); // You need to negotiate via ~1_val~ instead. } else - { + { //Dismiss the war guild.PendingWars.Remove( war ); otherGuild.PendingWars.Remove( otherWar ); @@ -314,20 +314,20 @@ namespace Server.Guilds } case 8: //Surrender { - if( !playerRank.GetFlag( RankFlags.ControlWarStatus ) ) + if ( !playerRank.GetFlag( RankFlags.ControlWarStatus ) ) { pm.SendLocalizedMessage( 1063440 ); // You don't have permission to negotiate wars. } - else if( alliance != null && alliance.Leader != guild ) + else if ( alliance != null && alliance.Leader != guild ) { pm.SendLocalizedMessage( 1063239, String.Format( "{0}\t{1}", guild.Name, alliance.Name ) ); // ~1_val~ is not the leader of the ~2_val~ alliance. pm.SendLocalizedMessage( 1070707, alliance.Leader.Name ); // You need to negotiate via ~1_val~ instead. } else { - if( activeWar != null ) + if ( activeWar != null ) { - if( alliance != null && alliance.IsMember( guild ) ) + if ( alliance != null && alliance.IsMember( guild ) ) { alliance.AllianceMessage( 1070740, ((otherAlliance != null) ? otherAlliance.Name : otherGuild.Name) );// You have lost the war with ~1_val~. alliance.InvalidateMemberProperties(); @@ -337,10 +337,10 @@ namespace Server.Guilds guild.GuildMessage( 1070740, ((otherAlliance != null) ? otherAlliance.Name : otherGuild.Name) );// You have lost the war with ~1_val~. guild.InvalidateMemberProperties(); } - + guild.AcceptedWars.Remove( activeWar ); - - if( otherAlliance != null && otherAlliance.IsMember( otherGuild ) ) + + if ( otherAlliance != null && otherAlliance.IsMember( otherGuild ) ) { otherAlliance.AllianceMessage( 1070739, ((guild.Alliance != null) ? guild.Alliance.Name : guild.Name) );// You have won the war against ~1_val~! otherAlliance.InvalidateMemberProperties(); @@ -350,7 +350,7 @@ namespace Server.Guilds otherGuild.GuildMessage( 1070739, ((guild.Alliance != null) ? guild.Alliance.Name : guild.Name) );// You have won the war against ~1_val~! otherGuild.InvalidateMemberProperties(); } - + otherGuild.AcceptedWars.Remove( otherGuild.FindActiveWar( guild ) ); } } @@ -358,18 +358,18 @@ namespace Server.Guilds } case 1: //Declare War { - if( war == null && activeWar == null ) + if ( war == null && activeWar == null ) { - if( !playerRank.GetFlag( RankFlags.ControlWarStatus ) ) + if ( !playerRank.GetFlag( RankFlags.ControlWarStatus ) ) { pm.SendLocalizedMessage( 1063440 ); // You don't have permission to negotiate wars. } - else if( alliance != null && alliance.Leader != guild ) + else if ( alliance != null && alliance.Leader != guild ) { pm.SendLocalizedMessage( 1063239, String.Format( "{0}\t{1}", guild.Name, alliance.Name ) ); // ~1_val~ is not the leader of the ~2_val~ alliance. pm.SendLocalizedMessage( 1070707, alliance.Leader.Name ); // You need to negotiate via ~1_val~ instead. } - else if( otherAlliance != null && otherAlliance.Leader != m_Other ) + else if ( otherAlliance != null && otherAlliance.Leader != m_Other ) { pm.SendLocalizedMessage( 1063239, String.Format( "{0}\t{1}", m_Other.Name, otherAlliance.Name ) ); // ~1_val~ is not the leader of the ~2_val~ alliance. pm.SendLocalizedMessage( 1070707, otherAlliance.Leader.Name ); // You need to negotiate via ~1_val~ instead. @@ -385,28 +385,28 @@ namespace Server.Guilds case 2: //Request Alliance { #region New alliance - if( alliance == null ) + if ( alliance == null ) { - if( !playerRank.GetFlag( RankFlags.AllianceControl ) ) + if ( !playerRank.GetFlag( RankFlags.AllianceControl ) ) { pm.SendLocalizedMessage( 1070747 ); // You don't have permission to create an alliance. } - else if( Faction.Find( guild.Leader ) != Faction.Find( m_Other.Leader ) ) + else if ( Faction.Find( guild.Leader ) != Faction.Find( m_Other.Leader ) ) { pm.SendLocalizedMessage( 1070758 ); // You cannot propose an alliance to a guild with a different faction allegiance. } - else if( otherAlliance != null ) + else if ( otherAlliance != null ) { - if( otherAlliance.IsPendingMember( m_Other ) ) + if ( otherAlliance.IsPendingMember( m_Other ) ) pm.SendLocalizedMessage( 1063416, m_Other.Name ); // ~1_val~ is currently considering another alliance proposal. else pm.SendLocalizedMessage( 1063426, m_Other.Name ); // ~1_val~ already belongs to an alliance. } - else if( m_Other.AcceptedWars.Count > 0 || m_Other.PendingWars.Count > 0 ) + else if ( m_Other.AcceptedWars.Count > 0 || m_Other.PendingWars.Count > 0 ) { pm.SendLocalizedMessage( 1063427, m_Other.Name ); // ~1_val~ is currently involved in a guild war. } - else if( guild.AcceptedWars.Count > 0 || guild.PendingWars.Count > 0 ) + else if ( guild.AcceptedWars.Count > 0 || guild.PendingWars.Count > 0 ) { pm.SendLocalizedMessage( 1063427, guild.Name ); // ~1_val~ is currently involved in a guild war. } @@ -420,34 +420,34 @@ namespace Server.Guilds #region Existing Alliance else { - if( !playerRank.GetFlag( RankFlags.AllianceControl ) ) + if ( !playerRank.GetFlag( RankFlags.AllianceControl ) ) { pm.SendLocalizedMessage( 1063436 ); // You don't have permission to negotiate an alliance. } - else if( alliance.Leader != guild ) + else if ( alliance.Leader != guild ) { pm.SendLocalizedMessage( 1063239, String.Format( "{0}\t{1}", guild.Name, alliance.Name ) ); // ~1_val~ is not the leader of the ~2_val~ alliance. } - else if( otherAlliance != null ) + else if ( otherAlliance != null ) { - if( otherAlliance.IsPendingMember( m_Other ) ) + if ( otherAlliance.IsPendingMember( m_Other ) ) pm.SendLocalizedMessage( 1063416, m_Other.Name ); // ~1_val~ is currently considering another alliance proposal. else pm.SendLocalizedMessage( 1063426, m_Other.Name ); // ~1_val~ already belongs to an alliance. } - else if( alliance.IsPendingMember( guild ) ) + else if ( alliance.IsPendingMember( guild ) ) { pm.SendLocalizedMessage( 1063416, guild.Name ); // ~1_val~ is currently considering another alliance proposal. } - else if( m_Other.AcceptedWars.Count > 0 || m_Other.PendingWars.Count > 0 ) + else if ( m_Other.AcceptedWars.Count > 0 || m_Other.PendingWars.Count > 0 ) { pm.SendLocalizedMessage( 1063427, m_Other.Name ); // ~1_val~ is currently involved in a guild war. } - else if( guild.AcceptedWars.Count > 0 || guild.PendingWars.Count > 0 ) + else if ( guild.AcceptedWars.Count > 0 || guild.PendingWars.Count > 0 ) { pm.SendLocalizedMessage( 1063427, guild.Name ); // ~1_val~ is currently involved in a guild war. } - else if( Faction.Find( guild.Leader ) != Faction.Find( m_Other.Leader ) ) + else if ( Faction.Find( guild.Leader ) != Faction.Find( m_Other.Leader ) ) { pm.SendLocalizedMessage( 1070758 ); // You cannot propose an alliance to a guild with a different faction allegiance. } @@ -466,60 +466,60 @@ namespace Server.Guilds } case 10: //Show Alliance Roster { - if( alliance != null && alliance == otherAlliance ) + if ( alliance != null && alliance == otherAlliance ) pm.SendGump( new AllianceInfo.AllianceRosterGump( pm, guild, alliance ) ); break; } case 11: //Leave Alliance { - if( !playerRank.GetFlag( RankFlags.AllianceControl ) ) + if ( !playerRank.GetFlag( RankFlags.AllianceControl ) ) { pm.SendLocalizedMessage( 1063436 ); // You don't have permission to negotiate an alliance. } - else if( alliance != null && alliance.IsMember( guild ) ) + else if ( alliance != null && alliance.IsMember( guild ) ) { guild.Alliance = null; //Calls alliance.Removeguild // alliance.RemoveGuild( guild ); - + m_Other.InvalidateWarNotoriety(); - + guild.InvalidateMemberNotoriety(); } break; } case 12: //Remove Guild from alliance { - if( !playerRank.GetFlag( RankFlags.AllianceControl ) ) + if ( !playerRank.GetFlag( RankFlags.AllianceControl ) ) { pm.SendLocalizedMessage( 1063436 ); // You don't have permission to negotiate an alliance. } - else if( alliance != null && alliance.Leader != guild ) + else if ( alliance != null && alliance.Leader != guild ) { pm.SendLocalizedMessage( 1063239, String.Format( "{0}\t{1}", guild.Name, alliance.Name ) ); // ~1_val~ is not the leader of the ~2_val~ alliance. } - else if( alliance != null && alliance.IsMember( guild ) && alliance.IsMember( m_Other ) ) + else if ( alliance != null && alliance.IsMember( guild ) && alliance.IsMember( m_Other ) ) { m_Other.Alliance = null; - + m_Other.InvalidateMemberNotoriety(); - + guild.InvalidateWarNotoriety(); } break; } case 13: //Promote to Alliance leader { - if( !playerRank.GetFlag( RankFlags.AllianceControl ) ) + if ( !playerRank.GetFlag( RankFlags.AllianceControl ) ) { pm.SendLocalizedMessage( 1063436 ); // You don't have permission to negotiate an alliance. } - else if( alliance != null && alliance.Leader != guild ) + else if ( alliance != null && alliance.Leader != guild ) { pm.SendLocalizedMessage( 1063239, String.Format( "{0}\t{1}", guild.Name, alliance.Name ) ); // ~1_val~ is not the leader of the ~2_val~ alliance. } - else if( alliance != null && alliance.IsMember( guild ) && alliance.IsMember( m_Other ) ) - { + else if ( alliance != null && alliance.IsMember( guild ) && alliance.IsMember( m_Other ) ) + { pm.SendLocalizedMessage( 1063434, String.Format( "{0}\t{1}", m_Other.Name, alliance.Name ) ); // ~1_val~ is now the leader of ~2_val~. alliance.Leader = m_Other; @@ -528,11 +528,11 @@ namespace Server.Guilds } case 14: //Withdraw Request { - if( !playerRank.GetFlag( RankFlags.AllianceControl ) ) + if ( !playerRank.GetFlag( RankFlags.AllianceControl ) ) { pm.SendLocalizedMessage( 1063436 ); // You don't have permission to negotiate an alliance. } - else if( alliance != null && alliance.Leader == guild && alliance.IsPendingMember( m_Other ) ) + else if ( alliance != null && alliance.Leader == guild && alliance.IsPendingMember( m_Other ) ) { m_Other.Alliance = null; pm.SendLocalizedMessage( 1070752 ); // The proposal has been updated. @@ -541,11 +541,11 @@ namespace Server.Guilds } case 15: //Deny Alliance Request { - if( !playerRank.GetFlag( RankFlags.AllianceControl ) ) + if ( !playerRank.GetFlag( RankFlags.AllianceControl ) ) { pm.SendLocalizedMessage( 1063436 ); // You don't have permission to negotiate an alliance. } - else if( alliance != null && otherAlliance != null && alliance.Leader == m_Other && otherAlliance.IsPendingMember( guild ) ) + else if ( alliance != null && otherAlliance != null && alliance.Leader == m_Other && otherAlliance.IsPendingMember( guild ) ) { pm.SendLocalizedMessage( 1070752 ); // The proposal has been updated. //m_Other.GuildMessage( 1070782 ); // ~1_val~ has responded to your proposal. //Per OSI commented out. @@ -556,11 +556,11 @@ namespace Server.Guilds } case 16: //Accept Alliance Request { - if( !playerRank.GetFlag( RankFlags.AllianceControl ) ) + if ( !playerRank.GetFlag( RankFlags.AllianceControl ) ) { pm.SendLocalizedMessage( 1063436 ); // You don't have permission to negotiate an alliance. } - else if( otherAlliance != null && otherAlliance.Leader == m_Other && otherAlliance.IsPendingMember( guild ) ) + else if ( otherAlliance != null && otherAlliance.Leader == m_Other && otherAlliance.IsPendingMember( guild ) ) { pm.SendLocalizedMessage( 1070752 ); // The proposal has been updated. @@ -574,41 +574,41 @@ namespace Server.Guilds } public void CreateAlliance_Callback( Mobile from, string text ) - { + { PlayerMobile pm = from as PlayerMobile; - + AllianceInfo alliance = guild.Alliance; AllianceInfo otherAlliance = m_Other.Alliance; - if( !IsMember( from, guild ) || alliance != null ) + if ( !IsMember( from, guild ) || alliance != null ) return; - + RankDefinition playerRank = pm.GuildRank; - if( !playerRank.GetFlag( RankFlags.AllianceControl ) ) + if ( !playerRank.GetFlag( RankFlags.AllianceControl ) ) { pm.SendLocalizedMessage( 1070747 ); // You don't have permission to create an alliance. } - else if( Faction.Find( guild.Leader ) != Faction.Find( m_Other.Leader ) ) + else if ( Faction.Find( guild.Leader ) != Faction.Find( m_Other.Leader ) ) { - //Notes about this: OSI only cares/checks when proposing, you can change your faction all you want later. + //Notes about this: OSI only cares/checks when proposing, you can change your faction all you want later. pm.SendLocalizedMessage( 1070758 ); // You cannot propose an alliance to a guild with a different faction allegiance. } - else if( otherAlliance != null ) + else if ( otherAlliance != null ) { - if( otherAlliance.IsPendingMember( m_Other ) ) + if ( otherAlliance.IsPendingMember( m_Other ) ) pm.SendLocalizedMessage( 1063416, m_Other.Name ); // ~1_val~ is currently considering another alliance proposal. else pm.SendLocalizedMessage( 1063426, m_Other.Name ); // ~1_val~ already belongs to an alliance. } - else if( m_Other.AcceptedWars.Count > 0 || m_Other.PendingWars.Count > 0 ) + else if ( m_Other.AcceptedWars.Count > 0 || m_Other.PendingWars.Count > 0 ) { pm.SendLocalizedMessage( 1063427, m_Other.Name ); // ~1_val~ is currently involved in a guild war. } - else if( guild.AcceptedWars.Count > 0 || guild.PendingWars.Count > 0 ) + else if ( guild.AcceptedWars.Count > 0 || guild.PendingWars.Count > 0 ) { pm.SendLocalizedMessage( 1063427, guild.Name ); // ~1_val~ is currently involved in a guild war. } @@ -616,21 +616,21 @@ namespace Server.Guilds { string name = Utility.FixHtml( text.Trim() ); - if( !BaseGuildGump.CheckProfanity( name ) ) + if ( !BaseGuildGump.CheckProfanity( name ) ) pm.SendLocalizedMessage( 1070886 ); // That alliance name is not allowed. - else if( name.Length > Guild.NameLimit ) + else if ( name.Length > Guild.NameLimit ) pm.SendLocalizedMessage( 1070887, Guild.NameLimit.ToString() ); // An alliance name cannot exceed ~1_val~ characters in length. - else if( AllianceInfo.Alliances.ContainsKey( name.ToLower() ) ) + else if ( AllianceInfo.Alliances.ContainsKey( name.ToLower() ) ) pm.SendLocalizedMessage( 1063428 ); // That alliance name is not available. else { pm.SendLocalizedMessage( 1070750, m_Other.Name ); // An invitation to join your alliance has been sent to ~1_val~. m_Other.GuildMessage( 1070780, guild.Name ); // ~1_val~ has proposed an alliance. - + new AllianceInfo( guild, name, m_Other ); } } } } -} \ No newline at end of file +} diff --git a/Scripts/Gumps/Guilds/New Guild System/War Declaration gump.cs b/Scripts/Gumps/Guilds/New Guild System/War Declaration gump.cs index d08deae4f..0ad9bf735 100644 --- a/Scripts/Gumps/Guilds/New Guild System/War Declaration gump.cs +++ b/Scripts/Gumps/Guilds/New Guild System/War Declaration gump.cs @@ -39,10 +39,10 @@ namespace Server.Guilds public override void OnResponse( NetState sender, RelayInfo info ) { - + PlayerMobile pm = sender.Mobile as PlayerMobile; - if( !IsMember( pm, guild ) ) + if ( !IsMember( pm, guild ) ) return; RankDefinition playerRank = pm.GuildRank; @@ -52,18 +52,18 @@ namespace Server.Guilds case 1: { AllianceInfo alliance = guild.Alliance; - AllianceInfo otherAlliance = m_Other.Alliance; + AllianceInfo otherAlliance = m_Other.Alliance; - if( !playerRank.GetFlag( RankFlags.ControlWarStatus ) ) + if ( !playerRank.GetFlag( RankFlags.ControlWarStatus ) ) { pm.SendLocalizedMessage( 1063440 ); // You don't have permission to negotiate wars. } - else if( alliance != null && alliance.Leader != guild ) + else if ( alliance != null && alliance.Leader != guild ) { pm.SendLocalizedMessage( 1063239, String.Format( "{0}\t{1}", guild.Name, alliance.Name ) ); // ~1_val~ is not the leader of the ~2_val~ alliance. pm.SendLocalizedMessage( 1070707, alliance.Leader.Name ); // You need to negotiate via ~1_val~ instead. } - else if( otherAlliance != null && otherAlliance.Leader != m_Other ) + else if ( otherAlliance != null && otherAlliance.Leader != m_Other ) { pm.SendLocalizedMessage( 1063239, String.Format( "{0}\t{1}", m_Other.Name, otherAlliance.Name ) ); // ~1_val~ is not the leader of the ~2_val~ alliance. pm.SendLocalizedMessage( 1070707, otherAlliance.Leader.Name ); // You need to negotiate via ~1_val~ instead. @@ -72,7 +72,7 @@ namespace Server.Guilds { WarDeclaration activeWar = guild.FindActiveWar( m_Other ); - if( activeWar == null ) + if ( activeWar == null ) { WarDeclaration war = guild.FindPendingWar( m_Other ); WarDeclaration otherWar = m_Other.FindPendingWar( guild ); @@ -84,7 +84,7 @@ namespace Server.Guilds int maxKills = (tKills == null)? 0 : Math.Max( Math.Min( Utility.ToInt32( info.GetTextEntry( 11 ).Text ), 0xFFFF ), 0 ); TimeSpan warLength = TimeSpan.FromHours( (tWarLength == null) ? 0 : Math.Max( Math.Min( Utility.ToInt32( info.GetTextEntry( 10 ).Text ), 0xFFFF ), 0 ) ); - if( war != null ) + if ( war != null ) { war.MaxKills = maxKills; war.WarLength = warLength; @@ -95,7 +95,7 @@ namespace Server.Guilds guild.PendingWars.Add( new WarDeclaration( guild, m_Other, maxKills, warLength, true ) ); } - if( otherWar != null ) + if ( otherWar != null ) { otherWar.MaxKills = maxKills; otherWar.WarLength = warLength; @@ -106,7 +106,7 @@ namespace Server.Guilds m_Other.PendingWars.Add( new WarDeclaration( m_Other, guild, maxKills, warLength, false ) ); } - if( war != null ) + if ( war != null ) { pm.SendLocalizedMessage( 1070752 ); // The proposal has been updated. //m_Other.GuildMessage( 1070782 ); // ~1_val~ has responded to your proposal. @@ -127,4 +127,4 @@ namespace Server.Guilds } } } -} \ No newline at end of file +} diff --git a/Scripts/Gumps/HouseDemolishGump.cs b/Scripts/Gumps/HouseDemolishGump.cs index 327b58890..0fc4728d5 100644 --- a/Scripts/Gumps/HouseDemolishGump.cs +++ b/Scripts/Gumps/HouseDemolishGump.cs @@ -63,7 +63,7 @@ namespace Server.Gumps { return; } - else if( !Guilds.Guild.NewGuildSystem && m_House.FindGuildstone() != null ) + else if ( !Guilds.Guild.NewGuildSystem && m_House.FindGuildstone() != null ) { m_Mobile.SendLocalizedMessage( 501389 ); // You cannot redeed a house with a guildstone inside. return; @@ -163,4 +163,4 @@ namespace Server.Gumps } } } -} \ No newline at end of file +} diff --git a/Scripts/Gumps/HouseGumpAOS.cs b/Scripts/Gumps/HouseGumpAOS.cs index bb1152a7b..533538f8e 100644 --- a/Scripts/Gumps/HouseGumpAOS.cs +++ b/Scripts/Gumps/HouseGumpAOS.cs @@ -176,7 +176,7 @@ namespace Server.Gumps private static int[] m_FoundationNumbers = (Core.ML ? new int[] { 20, 189, 765, 65, 101, 0x2DF7, 0x2DFB, 0x3672, 0x3676 - }: + }: new int[] { 20, 189, 765, 65, 101 @@ -279,7 +279,7 @@ namespace Server.Gumps { case HouseGumpPageAOS.Information: { - AddHtmlLocalized( 20, 130, 200, 20, 1011242, LabelColor, false, false ); // Owned By: + AddHtmlLocalized( 20, 130, 200, 20, 1011242, LabelColor, false, false ); // Owned By: AddLabel( 210, 130, LabelHue, GetOwnerName() ); AddHtmlLocalized( 20, 170, 380, 20, 1018032, SelectedColor, false, false ); // This house is properly placed. @@ -316,7 +316,7 @@ namespace Server.Gumps AddHtmlLocalized( 20, 330, 200, 20, 1061793, SelectedColor, false, false ); // House Value AddLabel( 250, 330, LabelHue, house.Price.ToString() ); - AddHtmlLocalized( 20, 360, 300, 20, 1011241, SelectedColor, false, false ); // Number of visits this building has had: + AddHtmlLocalized( 20, 360, 300, 20, 1011241, SelectedColor, false, false ); // Number of visits this building has had: AddLabel( 350, 360, LabelHue, house.Visits.ToString() ); break; @@ -382,7 +382,7 @@ namespace Server.Gumps int bonusStorage = (int)((house.BonusStorageScalar * 100)-100); - if( bonusStorage > 0 ) + if ( bonusStorage > 0 ) { AddHtmlLocalized( 10, 150, 300, 20, 1072519, LabelColor, false, false ); // Increased Storage AddLabel( 310, 150, LabelHue, String.Format( "{0}%", bonusStorage ) ); @@ -489,7 +489,7 @@ namespace Server.Gumps case HouseGumpPageAOS.ChangeSign: { int index = 0; - + if ( _HouseSigns.Count == 0 ) { // Add standard signs @@ -502,7 +502,7 @@ namespace Server.Gumps _HouseSigns.Add( 2966 ); _HouseSigns.Add( 3140 ); } - + int signsPerPage = Core.ML ? 24 : 18; int totalSigns = Core.ML ? 56 : 54; int pages = (int) Math.Ceiling( (double) totalSigns / signsPerPage ); @@ -769,7 +769,7 @@ namespace Server.Gumps ((PlayerBarkeeper)mobile).House = newHouse; } - if( house.MovingCrate != null ) + if ( house.MovingCrate != null ) { newHouse.MovingCrate = house.MovingCrate; newHouse.MovingCrate.House = newHouse; @@ -1146,7 +1146,7 @@ namespace Server.Gumps #region Mondain's Legacy else if ( m_House.HasAddonContainers ) { - // The house can not be customized when add-on containers such as aquariums, elven furniture containers, vanities, and boiling cauldrons + // The house can not be customized when add-on containers such as aquariums, elven furniture containers, vanities, and boiling cauldrons // are present in the house. Please re-deed the add-on containers before customizing the house. from.SendGump( new NoticeGump( 1060637, 30720, 1074863, 32512, 320, 180, new NoticeGumpCallback( CustomizeNotice_Callback ), m_House ) ); } @@ -1228,7 +1228,7 @@ namespace Server.Gumps { if ( isOwner && m_House.MovingCrate == null && m_House.InternalizedVendors.Count == 0 ) { - if( !Guilds.Guild.NewGuildSystem && m_House.FindGuildstone() != null ) + if ( !Guilds.Guild.NewGuildSystem && m_House.FindGuildstone() != null ) { from.SendLocalizedMessage( 501389 ); // You cannot redeed a house with a guildstone inside. } @@ -1236,7 +1236,7 @@ namespace Server.Gumps { from.SendLocalizedMessage( 1080178 ); // You must wait one hour between each house demolition. } - else + else { from.CloseGump( typeof( HouseDemolishGump ) ); from.SendGump( new HouseDemolishGump( from, m_House ) ); @@ -1292,14 +1292,14 @@ namespace Server.Gumps { FoundationType newType; - if( Core.ML && index >= 5 ) + if ( Core.ML && index >= 5 ) { switch( index ) { case 5: newType = FoundationType.ElvenGrey; break; case 6: newType = FoundationType.ElvenNatural; break; case 7: newType = FoundationType.Crystal; break; - case 8: newType = FoundationType.Shadow; break; + case 8: newType = FoundationType.Shadow; break; default: return; } } @@ -1477,4 +1477,4 @@ namespace Server.Gumps return list; } } -} \ No newline at end of file +} diff --git a/Scripts/Gumps/PetResurrectGump.cs b/Scripts/Gumps/PetResurrectGump.cs index 0c874cf9c..794ee66af 100644 --- a/Scripts/Gumps/PetResurrectGump.cs +++ b/Scripts/Gumps/PetResurrectGump.cs @@ -55,7 +55,7 @@ namespace Server.Gumps from.SendLocalizedMessage( 503256 ); // You fail to resurrect the creature. return; } - else if( m_Pet.Region != null && m_Pet.Region.IsPartOf( "Khaldun" ) ) //TODO: Confirm for pets, as per Bandage's script. + else if ( m_Pet.Region != null && m_Pet.Region.IsPartOf( "Khaldun" ) ) //TODO: Confirm for pets, as per Bandage's script. { from.SendLocalizedMessage( 1010395 ); // The veil of death in this area is too strong and resists thy efforts to restore life. return; @@ -67,7 +67,7 @@ namespace Server.Gumps double decreaseAmount; - if( from == m_Pet.ControlMaster ) + if ( from == m_Pet.ControlMaster ) decreaseAmount = 0.1; else decreaseAmount = 0.2; @@ -75,10 +75,10 @@ namespace Server.Gumps for ( int i = 0; i < m_Pet.Skills.Length; ++i ) //Decrease all skills on pet. m_Pet.Skills[i].Base -= decreaseAmount; - if( !m_Pet.IsDeadPet && m_HitsScalar > 0 ) + if ( !m_Pet.IsDeadPet && m_HitsScalar > 0 ) m_Pet.Hits = (int)(m_Pet.HitsMax * m_HitsScalar); } } } -} \ No newline at end of file +} diff --git a/Scripts/Gumps/Props/PropsGump.cs b/Scripts/Gumps/Props/PropsGump.cs index 982537a8a..ff706c71a 100644 --- a/Scripts/Gumps/Props/PropsGump.cs +++ b/Scripts/Gumps/Props/PropsGump.cs @@ -326,7 +326,7 @@ namespace Server.Gumps from.SendGump( new PropertiesGump( from, m_Object, m_Stack, m_List, m_Page ) ); from.SendGump( new SkillsGump( from, (Mobile)m_Object ) ); } - else if( HasAttribute( type, typeofPropertyObject, true ) ) + else if ( HasAttribute( type, typeofPropertyObject, true ) ) { object obj = prop.GetValue( m_Object, null ); @@ -777,4 +777,4 @@ namespace Server.Gumps } } } -} \ No newline at end of file +} diff --git a/Scripts/Gumps/Props/SetBodyGump.cs b/Scripts/Gumps/Props/SetBodyGump.cs index bca39b6a3..37fccf90e 100644 --- a/Scripts/Gumps/Props/SetBodyGump.cs +++ b/Scripts/Gumps/Props/SetBodyGump.cs @@ -79,11 +79,11 @@ namespace Server.Gumps AddImage( 480, 12, 0x25EA ); AddImage( 497, 12, 0x25E6 ); - if( ourList == null ) + if ( ourList == null ) { AddLabel( 15, 40, 0x480, "Choose a body type above." ); } - else if( ourList.Count == 0 ) + else if ( ourList.Count == 0 ) { AddLabel( 15, 40, 0x480, "The server must have UO:3D installed to use this feature." ); } @@ -112,10 +112,10 @@ namespace Server.Gumps AddHtml( x + 0, y + 0, 108, 21, Color( Center( entry.DisplayName ), TextColor32 ), false, false ); } - if( ourPage > 0 ) + if ( ourPage > 0 ) AddButton( 480, 12, 0x15E3, 0x15E7, 5, GumpButtonType.Reply, 0 ); - if( (ourPage + 1) * 12 < ourList.Count ) + if ( (ourPage + 1) * 12 < ourList.Count ) AddButton( 497, 12, 0x15E1, 0x15E5, 6, GumpButtonType.Reply, 0 ); } } @@ -124,13 +124,13 @@ namespace Server.Gumps { int index = info.ButtonID - 1; - if( index == -1 ) + if ( index == -1 ) { m_Mobile.SendGump( new PropertiesGump( m_Mobile, m_Object, m_Stack, m_List, m_Page ) ); } - else if( index >= 0 && index < 4 ) + else if ( index >= 0 && index < 4 ) { - if( m_Monster == null ) + if ( m_Monster == null ) LoadLists(); ModelBodyType type; @@ -147,15 +147,15 @@ namespace Server.Gumps m_Mobile.SendGump( new SetBodyGump( m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List, 0, list, type ) ); } - else if( m_OurList != null ) + else if ( m_OurList != null ) { index -= 4; - if( index == 0 && m_OurPage > 0 ) + if ( index == 0 && m_OurPage > 0 ) { m_Mobile.SendGump( new SetBodyGump( m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List, m_OurPage - 1, m_OurList, m_OurType ) ); } - else if( index == 1 && ((m_OurPage + 1) * 12) < m_OurList.Count ) + else if ( index == 1 && ((m_OurPage + 1) * 12) < m_OurList.Count ) { m_Mobile.SendGump( new SetBodyGump( m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List, m_OurPage + 1, m_OurList, m_OurType ) ); } @@ -163,7 +163,7 @@ namespace Server.Gumps { index -= 2; - if( index >= 0 && index < m_OurList.Count ) + if ( index >= 0 && index < m_OurList.Count ) { try { @@ -200,7 +200,7 @@ namespace Server.Gumps BodyEntry oldEntry = (BodyEntry)entries[i]; int bodyID = oldEntry.Body.BodyID; - if( ((Body)bodyID).IsEmpty ) + if ( ((Body)bodyID).IsEmpty ) continue; ArrayList list = null; @@ -213,12 +213,12 @@ namespace Server.Gumps case ModelBodyType.Human: list = m_Human; break; } - if( list == null ) + if ( list == null ) continue; int itemID = ShrinkTable.Lookup( bodyID, -1 ); - if( itemID != -1 ) + if ( itemID != -1 ) list.Add( new InternalEntry( bodyID, itemID, oldEntry.Name ) ); } @@ -269,7 +269,7 @@ namespace Server.Gumps for( int i = 0; i < m_GroupNames.Length; ++i ) { - if( m_DisplayName.StartsWith( m_GroupNames[i] ) ) + if ( m_DisplayName.StartsWith( m_GroupNames[i] ) ) { m_DisplayName = m_DisplayName.Substring( m_GroupNames[i].Length ); break; @@ -285,7 +285,7 @@ namespace Server.Gumps int v = m_Name.CompareTo( comp.m_Name ); - if( v == 0 ) + if ( v == 0 ) m_Body.CompareTo( comp.m_Body ); return v; diff --git a/Scripts/Gumps/Props/SetTimeSpanGump.cs b/Scripts/Gumps/Props/SetTimeSpanGump.cs index bc74de02f..fcf122189 100644 --- a/Scripts/Gumps/Props/SetTimeSpanGump.cs +++ b/Scripts/Gumps/Props/SetTimeSpanGump.cs @@ -126,7 +126,7 @@ namespace Server.Gumps case 2: // From H:M:S { bool successfulParse = false; - if( h != null && m != null && s != null ) + if ( h != null && m != null && s != null ) { successfulParse = TimeSpan.TryParse( h.Text + ":" + m.Text + ":" + s.Text, out toSet ); } @@ -236,4 +236,4 @@ namespace Server.Gumps m_Mobile.SendGump( new PropertiesGump( m_Mobile, m_Object, m_Stack, m_List, m_Page ) ); } } -} \ No newline at end of file +} diff --git a/Scripts/Gumps/ResurrectGump.cs b/Scripts/Gumps/ResurrectGump.cs index f8182e129..31307316a 100644 --- a/Scripts/Gumps/ResurrectGump.cs +++ b/Scripts/Gumps/ResurrectGump.cs @@ -145,19 +145,19 @@ namespace Server.Gumps from.CloseGump( typeof( ResurrectGump ) ); - if( info.ButtonID == 1 || info.ButtonID == 2 ) + if ( info.ButtonID == 1 || info.ButtonID == 2 ) { - if( from.Map == null || !from.Map.CanFit( from.Location, 16, false, false ) ) + if ( from.Map == null || !from.Map.CanFit( from.Location, 16, false, false ) ) { from.SendLocalizedMessage( 502391 ); // Thou can not be resurrected there! return; } - if( m_Price > 0 ) + if ( m_Price > 0 ) { - if( info.IsSwitched( 1 ) ) + if ( info.IsSwitched( 1 ) ) { - if( Banker.Withdraw( from, m_Price ) ) + if ( Banker.Withdraw( from, m_Price ) ) { from.SendLocalizedMessage( 1060398, m_Price.ToString() ); // ~1_AMOUNT~ gold has been withdrawn from your bank box. from.SendLocalizedMessage( 1060022, Banker.GetBalance( from ).ToString() ); // You have ~1_AMOUNT~ gold in cash remaining in your bank box. @@ -180,7 +180,7 @@ namespace Server.Gumps from.Resurrect(); - if( m_Healer != null && from != m_Healer ) + if ( m_Healer != null && from != m_Healer ) { VirtueLevel level = VirtueHelper.GetLevel( m_Healer, VirtueName.Compassion ); @@ -192,14 +192,14 @@ namespace Server.Gumps } } - if( m_FromSacrifice && from is PlayerMobile ) + if ( m_FromSacrifice && from is PlayerMobile ) { ((PlayerMobile)from).AvailableResurrects -= 1; Container pack = from.Backpack; Container corpse = from.Corpse; - if( pack != null && corpse != null ) + if ( pack != null && corpse != null ) { List items = new List( corpse.Items ); @@ -207,45 +207,45 @@ namespace Server.Gumps { Item item = items[i]; - if( item.Layer != Layer.Hair && item.Layer != Layer.FacialHair && item.Movable ) + if ( item.Layer != Layer.Hair && item.Layer != Layer.FacialHair && item.Movable ) pack.DropItem( item ); } } } - if( from.Fame > 0 ) + if ( from.Fame > 0 ) { int amount = from.Fame / 10; Misc.Titles.AwardFame( from, -amount, true ); } - if( !Core.AOS && from.ShortTermMurders >= 5 ) + if ( !Core.AOS && from.ShortTermMurders >= 5 ) { double loss = (100.0 - (4.0 + (from.ShortTermMurders / 5.0))) / 100.0; // 5 to 15% loss - if( loss < 0.85 ) + if ( loss < 0.85 ) loss = 0.85; - else if( loss > 0.95 ) + else if ( loss > 0.95 ) loss = 0.95; - if( from.RawStr * loss > 10 ) + if ( from.RawStr * loss > 10 ) from.RawStr = (int)(from.RawStr * loss); - if( from.RawInt * loss > 10 ) + if ( from.RawInt * loss > 10 ) from.RawInt = (int)(from.RawInt * loss); - if( from.RawDex * loss > 10 ) + if ( from.RawDex * loss > 10 ) from.RawDex = (int)(from.RawDex * loss); for( int s = 0; s < from.Skills.Length; s++ ) { - if( from.Skills[s].Base * loss > 35 ) + if ( from.Skills[s].Base * loss > 35 ) from.Skills[s].Base *= loss; } } - if( from.Alive && m_HitsScalar > 0 ) + if ( from.Alive && m_HitsScalar > 0 ) from.Hits = (int)(from.HitsMax * m_HitsScalar); } } } -} \ No newline at end of file +} diff --git a/Scripts/Gumps/SetSecureLevelGump.cs b/Scripts/Gumps/SetSecureLevelGump.cs index 779d6e700..2589b84ad 100644 --- a/Scripts/Gumps/SetSecureLevelGump.cs +++ b/Scripts/Gumps/SetSecureLevelGump.cs @@ -46,7 +46,7 @@ namespace Server.Gumps AddHtmlLocalized( 45, 110, 150, 20, 1061279, GetColor( SecureLevel.Friends ), false, false ); // Friends Mobile houseOwner = house.Owner; - if( Guild.NewGuildSystem && house != null && houseOwner != null && houseOwner.Guild != null && ((Guild)houseOwner.Guild).Leader == houseOwner ) //Only the actual House owner AND guild master can set guild secures + if ( Guild.NewGuildSystem && house != null && houseOwner != null && houseOwner.Guild != null && ((Guild)houseOwner.Guild).Leader == houseOwner ) //Only the actual House owner AND guild master can set guild secures { AddButton( 10, 130, GetFirstID( SecureLevel.Guild ), 4007, 5, GumpButtonType.Reply, 0 ); AddHtmlLocalized( 45, 130, 150, 20, 1063455, GetColor( SecureLevel.Guild ), false, false ); // Guild Members @@ -90,4 +90,4 @@ namespace Server.Gumps } } } -} \ No newline at end of file +} diff --git a/Scripts/Gumps/WarningGump.cs b/Scripts/Gumps/WarningGump.cs index 55ce10157..82f4b5151 100644 --- a/Scripts/Gumps/WarningGump.cs +++ b/Scripts/Gumps/WarningGump.cs @@ -46,7 +46,7 @@ namespace Server.Gumps AddButton( 10, height - 30, 4005, 4007, 1, GumpButtonType.Reply, 0 ); AddHtmlLocalized( 40, height - 30, 170, 20, 1011036, 32767, false, false ); // OKAY - if( m_CancelButton ) + if ( m_CancelButton ) { AddButton( 10 + ((width - 20) / 2), height - 30, 4005, 4007, 0, GumpButtonType.Reply, 0 ); AddHtmlLocalized( 40 + ((width - 20) / 2), height - 30, 170, 20, 1011012, 32767, false, false ); // CANCEL @@ -61,4 +61,4 @@ namespace Server.Gumps m_Callback( sender.Mobile, false, m_State ); } } -} \ No newline at end of file +} diff --git a/Scripts/Holiday Stuff/Christmas/2010/Addons/FireFliesDeed.cs b/Scripts/Holiday Stuff/Christmas/2010/Addons/FireFliesDeed.cs index 67ebcf83f..5df7ecc72 100644 --- a/Scripts/Holiday Stuff/Christmas/2010/Addons/FireFliesDeed.cs +++ b/Scripts/Holiday Stuff/Christmas/2010/Addons/FireFliesDeed.cs @@ -26,7 +26,7 @@ namespace Server.Items { get { - if( ItemID == 0x2336 ) + if ( ItemID == 0x2336 ) return true; return false; @@ -54,11 +54,11 @@ namespace Server.Items public override void OnDoubleClick( Mobile from ) { - if( from.InRange( Location, 3 ) ) + if ( from.InRange( Location, 3 ) ) { BaseHouse house = BaseHouse.FindHouseAt( this ); - if( house != null && house.IsOwner( from ) ) + if ( house != null && house.IsOwner( from ) ) { from.CloseGump( typeof( RewardDemolitionGump ) ); from.SendGump( new RewardDemolitionGump( this, 1049783 ) ); // Do you wish to re-deed this decoration? @@ -86,10 +86,10 @@ namespace Server.Items public bool CouldFit( IPoint3D p, Map map ) { - if( map == null || !map.CanFit( p.X, p.Y, p.Z, ItemData.Height ) ) + if ( map == null || !map.CanFit( p.X, p.Y, p.Z, ItemData.Height ) ) return false; - if( FacingSouth ) + if ( FacingSouth ) return BaseAddon.IsWall( p.X, p.Y - 1, p.Z, map ); // north wall else return BaseAddon.IsWall( p.X - 1, p.Y, p.Z, map ); // west wall @@ -115,15 +115,15 @@ namespace Server.Items public override void OnDoubleClick( Mobile from ) { - if( IsChildOf( from.Backpack ) ) + if ( IsChildOf( from.Backpack ) ) { BaseHouse house = BaseHouse.FindHouseAt( from ); - if( house != null && house.IsOwner( from ) ) + if ( house != null && house.IsOwner( from ) ) { from.CloseGump( typeof( FacingGump ) ); - if( !from.SendGump( new FacingGump( this, from ) ) ) + if ( !from.SendGump( new FacingGump( this, from ) ) ) { from.SendLocalizedMessage( 1150062 ); // You fail to re-deed the holiday fireflies. } @@ -213,29 +213,29 @@ namespace Server.Items protected override void OnTarget( Mobile from, object targeted ) { - if( m_FirefliesDeed == null || m_FirefliesDeed.Deleted ) + if ( m_FirefliesDeed == null || m_FirefliesDeed.Deleted ) return; - if( m_FirefliesDeed.IsChildOf( from.Backpack ) ) + if ( m_FirefliesDeed.IsChildOf( from.Backpack ) ) { BaseHouse house = BaseHouse.FindHouseAt( from ); - if( house != null && house.IsOwner( from ) ) + if ( house != null && house.IsOwner( from ) ) { IPoint3D p = targeted as IPoint3D; Map map = from.Map; - if( p == null || map == null || map == Map.Internal ) + if ( p == null || map == null || map == Map.Internal ) return; Point3D p3d = new Point3D( p ); ItemData id = TileData.ItemTable[ m_ItemID & TileData.MaxItemValue ]; - if( map.CanFit( p3d, id.Height ) ) + if ( map.CanFit( p3d, id.Height ) ) { house = BaseHouse.FindHouseAt( p3d, map, id.Height ); - if( house != null && house.IsOwner( from ) ) + if ( house != null && house.IsOwner( from ) ) { bool north = BaseAddon.IsWall( p3d.X, p3d.Y - 1, p3d.Z, map ); bool west = BaseAddon.IsWall( p3d.X - 1, p3d.Y, p3d.Z, map ); @@ -244,13 +244,13 @@ namespace Server.Items foreach( Item item in Map.Malas.GetItemsInRange( p3d, 0 ) ) { - if( item is Fireflies ) + if ( item is Fireflies ) { isclear = false; } } - if( ( ( m_ItemID == 0x2336 && north ) || ( m_ItemID == 0x2332 && west ) ) && isclear ) + if ( ( ( m_ItemID == 0x2336 && north ) || ( m_ItemID == 0x2332 && west ) ) && isclear ) { Fireflies flies = new Fireflies( m_ItemID ); diff --git a/Scripts/Holiday Stuff/Easter/2011/Items/DragonEasterEgg.cs b/Scripts/Holiday Stuff/Easter/2011/Items/DragonEasterEgg.cs index 277868a22..b5910af79 100644 --- a/Scripts/Holiday Stuff/Easter/2011/Items/DragonEasterEgg.cs +++ b/Scripts/Holiday Stuff/Easter/2011/Items/DragonEasterEgg.cs @@ -33,7 +33,7 @@ namespace Server.Items public bool Dye( Mobile from, DyeTub sender ) { - if( Deleted || !sender.AllowDyables ) + if ( Deleted || !sender.AllowDyables ) return false; Hue = sender.DyedHue; diff --git a/Scripts/Holiday Stuff/Halloween/2006/Engines/TrickOrTreat.cs b/Scripts/Holiday Stuff/Halloween/2006/Engines/TrickOrTreat.cs index c48a3b9f3..cb0c3f09e 100644 --- a/Scripts/Holiday Stuff/Halloween/2006/Engines/TrickOrTreat.cs +++ b/Scripts/Holiday Stuff/Halloween/2006/Engines/TrickOrTreat.cs @@ -15,7 +15,7 @@ namespace Server.Engines.Events { DateTime now = DateTime.UtcNow; - if( DateTime.UtcNow >= HolidaySettings.StartHalloween && DateTime.UtcNow <= HolidaySettings.FinishHalloween ) + if ( DateTime.UtcNow >= HolidaySettings.StartHalloween && DateTime.UtcNow <= HolidaySettings.FinishHalloween ) { EventSink.Speech += new SpeechEventHandler( EventSink_Speech ); } @@ -24,7 +24,7 @@ namespace Server.Engines.Events private static void EventSink_Speech( SpeechEventArgs e ) { - if( Insensitive.Contains( e.Speech, "trick or treat" ) ) + if ( Insensitive.Contains( e.Speech, "trick or treat" ) ) { e.Mobile.Target = new TrickOrTreatTarget(); @@ -41,14 +41,14 @@ namespace Server.Engines.Events protected override void OnTarget( Mobile from, object targ ) { - if( targ != null && CheckMobile( from ) ) + if ( targ != null && CheckMobile( from ) ) { - if( !( targ is Mobile ) ) + if ( !( targ is Mobile ) ) { from.SendLocalizedMessage( 1076781 ); /* There is little chance of getting candy from that! */ return; } - if( !( targ is BaseVendor ) || ( ( BaseVendor )targ ).Deleted ) + if ( !( targ is BaseVendor ) || ( ( BaseVendor )targ ).Deleted ) { from.SendLocalizedMessage( 1076765 ); /* That doesn't look friendly. */ return; @@ -58,9 +58,9 @@ namespace Server.Engines.Events BaseVendor m_Begged = targ as BaseVendor; - if( CheckMobile( m_Begged ) ) + if ( CheckMobile( m_Begged ) ) { - if( m_Begged.NextTrickOrTreat > now ) + if ( m_Begged.NextTrickOrTreat > now ) { from.SendLocalizedMessage( 1076767 ); /* That doesn't appear to have any more candy. */ return; @@ -68,9 +68,9 @@ namespace Server.Engines.Events m_Begged.NextTrickOrTreat = now + TimeSpan.FromMinutes( Utility.RandomMinMax( 5, 10 ) ); - if( from.Backpack != null && !from.Backpack.Deleted ) + if ( from.Backpack != null && !from.Backpack.Deleted ) { - if( Utility.RandomDouble() > .10 ) + if ( Utility.RandomDouble() > .10 ) { switch( Utility.Random( 3 ) ) { @@ -80,7 +80,7 @@ namespace Server.Engines.Events default: break; } - if( Utility.RandomDouble() <= .01 && from.Skills.Begging.Value >= 100 ) + if ( Utility.RandomDouble() <= .01 && from.Skills.Begging.Value >= 100 ) { from.AddToBackpack( HolidaySettings.RandomGMBeggerItem ); @@ -99,11 +99,11 @@ namespace Server.Engines.Events int m_Action = Utility.Random( 4 ); - if( m_Action == 0 ) + if ( m_Action == 0 ) { Timer.DelayCall( OneSecond, OneSecond, 10, new TimerStateCallback( Bleeding ), from ); } - else if( m_Action == 1 ) + else if ( m_Action == 1 ) { Timer.DelayCall( TimeSpan.FromSeconds( 2 ), new TimerStateCallback( SolidHueMobile ), from ); } @@ -120,9 +120,9 @@ namespace Server.Engines.Events public static void Bleeding( Mobile m_From ) { - if( TrickOrTreat.CheckMobile( m_From ) ) + if ( TrickOrTreat.CheckMobile( m_From ) ) { - if( m_From.Location != Point3D.Zero ) + if ( m_From.Location != Point3D.Zero ) { int amount = Utility.RandomMinMax( 3, 7 ); @@ -136,7 +136,7 @@ namespace Server.Engines.Events public static void RemoveHueMod( Mobile target ) { - if( target != null && !target.Deleted ) + if ( target != null && !target.Deleted ) { target.SolidHueOverride = -1; } @@ -144,7 +144,7 @@ namespace Server.Engines.Events public static void SolidHueMobile( Mobile target ) { - if( CheckMobile( target ) ) + if ( CheckMobile( target ) ) { target.SolidHueOverride = Utility.RandomMinMax( 2501, 2644 ); @@ -156,21 +156,21 @@ namespace Server.Engines.Events { List m_Items = new List(); - if( CheckMobile( m_From ) ) + if ( CheckMobile( m_From ) ) { Mobile twin = new NaughtyTwin( m_From ); - if( twin != null && !twin.Deleted ) + if ( twin != null && !twin.Deleted ) { foreach( Item item in m_From.Items ) { - if( item.Layer != Layer.Backpack && item.Layer != Layer.Mount && item.Layer != Layer.Bank ) + if ( item.Layer != Layer.Backpack && item.Layer != Layer.Mount && item.Layer != Layer.Bank ) { m_Items.Add( item ); } } - if( m_Items.Count > 0 ) + if ( m_Items.Count > 0 ) { for( int i = 0; i < m_Items.Count; i++ ) /* dupe exploits start out like this ... */ { @@ -179,7 +179,7 @@ namespace Server.Engines.Events foreach( Item item in twin.Items ) /* ... and end like this */ { - if( item.Layer != Layer.Backpack && item.Layer != Layer.Mount && item.Layer != Layer.Bank ) + if ( item.Layer != Layer.Backpack && item.Layer != Layer.Mount && item.Layer != Layer.Bank ) { item.Movable = false; } @@ -201,7 +201,7 @@ namespace Server.Engines.Events public static void DeleteTwin( Mobile m_Twin ) { - if( TrickOrTreat.CheckMobile( m_Twin ) ) + if ( TrickOrTreat.CheckMobile( m_Twin ) ) { m_Twin.Delete(); } @@ -267,7 +267,7 @@ namespace Server.Engines.Events public NaughtyTwin( Mobile from ) : base( AIType.AI_Melee, FightMode.None, 10, 1, 0.2, 0.4 ) { - if( TrickOrTreat.CheckMobile( from ) ) + if ( TrickOrTreat.CheckMobile( from ) ) { Body = from.Body; @@ -280,7 +280,7 @@ namespace Server.Engines.Events public override void OnThink() { - if( m_From == null || m_From.Deleted ) + if ( m_From == null || m_From.Deleted ) { Delete(); } @@ -290,13 +290,13 @@ namespace Server.Engines.Events { Type[] types = { typeof( WrappedCandy ), typeof( Lollipops ), typeof( NougatSwirl ), typeof( Taffy ), typeof( JellyBeans ) }; - if( TrickOrTreat.CheckMobile( target ) ) + if ( TrickOrTreat.CheckMobile( target ) ) { for( int i = 0; i < types.Length; i++ ) { Item item = target.Backpack.FindItemByType( types[ i ] ); - if( item != null ) + if ( item != null ) { return item; } @@ -307,13 +307,13 @@ namespace Server.Engines.Events public static void StealCandy( Mobile target ) { - if( TrickOrTreat.CheckMobile( target ) ) + if ( TrickOrTreat.CheckMobile( target ) ) { Item item = FindCandyTypes( target ); target.SendLocalizedMessage( 1113967 ); /* Your naughty twin steals some of your candy. */ - if( item != null && !item.Deleted ) + if ( item != null && !item.Deleted ) { item.Delete(); } @@ -322,7 +322,7 @@ namespace Server.Engines.Events public static void ToGate( Mobile target ) { - if( TrickOrTreat.CheckMobile( target ) ) + if ( TrickOrTreat.CheckMobile( target ) ) { target.SendLocalizedMessage( 1113972 ); /* Your naughty twin teleports you away with a naughty laugh! */ @@ -360,4 +360,4 @@ namespace Server.Engines.Events int version = reader.ReadInt(); } } -} \ No newline at end of file +} diff --git a/Scripts/Holiday Stuff/Halloween/2009/Engines/PumpkinPatch.cs b/Scripts/Holiday Stuff/Halloween/2009/Engines/PumpkinPatch.cs index f9dcb7c70..5f43cc2ce 100644 --- a/Scripts/Holiday Stuff/Halloween/2009/Engines/PumpkinPatch.cs +++ b/Scripts/Holiday Stuff/Halloween/2009/Engines/PumpkinPatch.cs @@ -24,7 +24,7 @@ namespace Server.Engines.Events { DateTime now = DateTime.UtcNow; - if( DateTime.UtcNow >= HolidaySettings.StartHalloween && DateTime.UtcNow <= HolidaySettings.FinishHalloween ) + if ( DateTime.UtcNow >= HolidaySettings.StartHalloween && DateTime.UtcNow <= HolidaySettings.FinishHalloween ) { m_Timer = Timer.DelayCall( TimeSpan.Zero, TimeSpan.FromMinutes( .50 ), 0, new TimerCallback( PumpkinPatchSpawnerCallback )); } @@ -47,13 +47,13 @@ namespace Server.Engines.Events foreach( Item item in map.GetItemsInBounds( rect ) ) { - if( item is HalloweenPumpkin ) + if ( item is HalloweenPumpkin ) { pumpkins++; } } - if( spawncount > pumpkins ) + if ( spawncount > pumpkins ) { Item item = new HalloweenPumpkin(); @@ -71,4 +71,4 @@ namespace Server.Engines.Events return new Point3D( x, y, z ); } } -} \ No newline at end of file +} diff --git a/Scripts/Holiday Stuff/Halloween/2011/Items/BasePaintedMask.cs b/Scripts/Holiday Stuff/Halloween/2011/Items/BasePaintedMask.cs index 7d1e828d9..e11b59d27 100644 --- a/Scripts/Holiday Stuff/Halloween/2011/Items/BasePaintedMask.cs +++ b/Scripts/Holiday Stuff/Halloween/2011/Items/BasePaintedMask.cs @@ -11,7 +11,7 @@ namespace Server.Items.Holiday { get { - if( m_Staffer != null ) + if ( m_Staffer != null ) { return String.Format( "{0} hand painted by {1}", MaskName, m_Staffer ); } @@ -24,7 +24,7 @@ namespace Server.Items.Holiday private string m_Staffer; - private static string[] m_Staffers = + private static string[] m_Staffers = { "Ryan", "Mark", @@ -68,7 +68,7 @@ namespace Server.Items.Holiday int version = reader.ReadInt(); - if( version == 1 ) + if ( version == 1 ) { m_Staffer = Utility.Intern( reader.ReadString() ); } diff --git a/Scripts/Holiday Stuff/Halloween/2011/Mobiles/PumpkinHead.cs b/Scripts/Holiday Stuff/Halloween/2011/Mobiles/PumpkinHead.cs index 0abe40098..281d32248 100644 --- a/Scripts/Holiday Stuff/Halloween/2011/Mobiles/PumpkinHead.cs +++ b/Scripts/Holiday Stuff/Halloween/2011/Mobiles/PumpkinHead.cs @@ -58,7 +58,7 @@ namespace Server.Mobiles public override void GenerateLoot() { - if( Utility.RandomDouble() < .05 ) + if ( Utility.RandomDouble() < .05 ) { //PackItem( new TwilightLantern() ); OLD Halloween @@ -79,7 +79,7 @@ namespace Server.Mobiles public virtual void Lifted_Callback( Mobile from ) { - if( from != null && !from.Deleted && from is PlayerMobile ) + if ( from != null && !from.Deleted && from is PlayerMobile ) { Combatant = from; @@ -100,9 +100,9 @@ namespace Server.Mobiles public override void OnDamage( int amount, Mobile from, bool willKill ) { - if( Utility.RandomBool() ) + if ( Utility.RandomBool() ) { - if( from != null && from.Map != null && Map != Map.Internal && Map == from.Map && from.InRange( this, 12 ) ) + if ( from != null && from.Map != null && Map != Map.Internal && Map == from.Map && from.InRange( this, 12 ) ) { SpillAcid( ( willKill ) ? this : from, ( willKill ) ? 3 : 1 ); } diff --git a/Scripts/Holiday Stuff/Halloween/2012/Engines/PlayerZombies.cs b/Scripts/Holiday Stuff/Halloween/2012/Engines/PlayerZombies.cs index 61f0968d8..03a00d5b2 100644 --- a/Scripts/Holiday Stuff/Halloween/2012/Engines/PlayerZombies.cs +++ b/Scripts/Holiday Stuff/Halloween/2012/Engines/PlayerZombies.cs @@ -57,7 +57,7 @@ namespace Server.Engines.Events m_ReAnimated = new Dictionary(); m_DeathQueue = new List(); - if( today >= HolidaySettings.StartHalloween && today <= HolidaySettings.FinishHalloween ) + if ( today >= HolidaySettings.StartHalloween && today <= HolidaySettings.FinishHalloween ) { m_Timer = Timer.DelayCall( tick, tick, new TimerCallback( Timer_Callback ) ); @@ -69,13 +69,13 @@ namespace Server.Engines.Events public static void EventSink_PlayerDeath( PlayerDeathEventArgs e ) { - if( e.Mobile != null && !e.Mobile.Deleted ) /* not sure .. better safe than sorry? */ + if ( e.Mobile != null && !e.Mobile.Deleted ) /* not sure .. better safe than sorry? */ { - if( e.Mobile is PlayerMobile ) + if ( e.Mobile is PlayerMobile ) { PlayerMobile player = e.Mobile as PlayerMobile; - if( m_Timer.Running && !m_DeathQueue.Contains( player ) && m_DeathQueue.Count < m_DeathQueueLimit ) + if ( m_Timer.Running && !m_DeathQueue.Contains( player ) && m_DeathQueue.Count < m_DeathQueueLimit ) { m_DeathQueue.Add( player ); } @@ -89,7 +89,7 @@ namespace Server.Engines.Events m_DeathQueue.Clear(); - if( DateTime.UtcNow <= HolidaySettings.FinishHalloween ) + if ( DateTime.UtcNow <= HolidaySettings.FinishHalloween ) { m_ClearTimer.Stop(); } @@ -99,11 +99,11 @@ namespace Server.Engines.Events { PlayerMobile player = null; - if( DateTime.UtcNow <= HolidaySettings.FinishHalloween ) + if ( DateTime.UtcNow <= HolidaySettings.FinishHalloween ) { for( int index = 0; m_DeathQueue.Count > 0 && index < m_DeathQueue.Count; index++ ) { - if( !m_ReAnimated.ContainsKey( m_DeathQueue[ index ] ) ) + if ( !m_ReAnimated.ContainsKey( m_DeathQueue[ index ] ) ) { player = m_DeathQueue[ index ]; @@ -111,13 +111,13 @@ namespace Server.Engines.Events } } - if( player != null && !player.Deleted && m_ReAnimated.Count < m_TotalZombieLimit ) + if ( player != null && !player.Deleted && m_ReAnimated.Count < m_TotalZombieLimit ) { Map map = Utility.RandomBool() ? Map.Trammel : Map.Felucca; Point3D home = ( GetRandomPointInRect( m_Cemetaries[ Utility.Random( m_Cemetaries.Length ) ], map )); - if( map.CanSpawnMobile( home ) ) + if ( map.CanSpawnMobile( home ) ) { ZombieSkeleton zombieskel = new ZombieSkeleton( player ); @@ -241,7 +241,7 @@ namespace Server.Engines.Events case 2: PackItem( new Torso() ); break; case 3: PackItem( new Bone() ); break; case 4: PackItem( new RibCage() ); break; - case 5: if( m_DeadPlayer != null && !m_DeadPlayer.Deleted ) { PackItem( new PlayerBones( m_DeadPlayer.Name ) ); } break; + case 5: if ( m_DeadPlayer != null && !m_DeadPlayer.Deleted ) { PackItem( new PlayerBones( m_DeadPlayer.Name ) ); } break; default: break; } @@ -259,11 +259,11 @@ namespace Server.Engines.Events public override void OnDelete() { - if( HalloweenHauntings.ReAnimated != null ) + if ( HalloweenHauntings.ReAnimated != null ) { - if( m_DeadPlayer != null && !m_DeadPlayer.Deleted ) + if ( m_DeadPlayer != null && !m_DeadPlayer.Deleted ) { - if( HalloweenHauntings.ReAnimated.Count > 0 && HalloweenHauntings.ReAnimated.ContainsKey( m_DeadPlayer ) ) + if ( HalloweenHauntings.ReAnimated.Count > 0 && HalloweenHauntings.ReAnimated.ContainsKey( m_DeadPlayer ) ) { HalloweenHauntings.ReAnimated.Remove( m_DeadPlayer ); } diff --git a/Scripts/Items/Addons/JackOLantern.cs b/Scripts/Items/Addons/JackOLantern.cs index 73bb88421..d19388c53 100644 --- a/Scripts/Items/Addons/JackOLantern.cs +++ b/Scripts/Items/Addons/JackOLantern.cs @@ -72,7 +72,7 @@ namespace Server.Items if ( version == 0 ) { - Timer.DelayCall( TimeSpan.Zero, delegate() + Timer.DelayCall( TimeSpan.Zero, delegate { for ( int i = 0; i < Components.Count; ++i ) { @@ -86,7 +86,7 @@ namespace Server.Items if ( version <= 1 ) { - Timer.DelayCall( TimeSpan.Zero, delegate() + Timer.DelayCall( TimeSpan.Zero, delegate { for ( int i = 0; i < Components.Count; ++i ) { diff --git a/Scripts/Items/Armor/Artifacts/LeggingsOfBane.cs b/Scripts/Items/Armor/Artifacts/LeggingsOfBane.cs index 0f4c9a82f..3d370ae54 100644 --- a/Scripts/Items/Armor/Artifacts/LeggingsOfBane.cs +++ b/Scripts/Items/Armor/Artifacts/LeggingsOfBane.cs @@ -40,9 +40,9 @@ namespace Server.Items int version = reader.ReadInt(); - if( version <= 1 ) + if ( version <= 1 ) { - if( this.HitPoints > 255 || this.MaxHitPoints > 255 ) + if ( this.HitPoints > 255 || this.MaxHitPoints > 255 ) this.HitPoints = this.MaxHitPoints = 255; } diff --git a/Scripts/Items/Armor/BaseArmor.cs b/Scripts/Items/Armor/BaseArmor.cs index 2b6580105..25cc81a8c 100644 --- a/Scripts/Items/Armor/BaseArmor.cs +++ b/Scripts/Items/Armor/BaseArmor.cs @@ -613,9 +613,9 @@ namespace Server.Items { BaseArmor armor = (BaseArmor)item; - if( armor.RequiredRace != null && m.Race != armor.RequiredRace ) + if ( armor.RequiredRace != null && m.Race != armor.RequiredRace ) { - if( armor.RequiredRace == Race.Elf ) + if ( armor.RequiredRace == Race.Elf ) m.SendLocalizedMessage( 1072203 ); // Only Elves may use this. else m.SendMessage( "Only {0} may use this.", armor.RequiredRace.PluralName ); @@ -1167,32 +1167,32 @@ namespace Server.Items public override bool CanEquip( Mobile from ) { - if( !Ethics.Ethic.CheckEquip( from, this ) ) + if ( !Ethics.Ethic.CheckEquip( from, this ) ) return false; - if( from.AccessLevel < AccessLevel.GameMaster ) + if ( from.AccessLevel < AccessLevel.GameMaster ) { - if( RequiredRace != null && from.Race != RequiredRace ) + if ( RequiredRace != null && from.Race != RequiredRace ) { - if( RequiredRace == Race.Elf ) + if ( RequiredRace == Race.Elf ) from.SendLocalizedMessage( 1072203 ); // Only Elves may use this. else from.SendMessage( "Only {0} may use this.", RequiredRace.PluralName ); return false; } - else if( !AllowMaleWearer && !from.Female ) + else if ( !AllowMaleWearer && !from.Female ) { - if( AllowFemaleWearer ) + if ( AllowFemaleWearer ) from.SendLocalizedMessage( 1010388 ); // Only females can wear this. else from.SendMessage( "You may not wear this." ); return false; } - else if( !AllowFemaleWearer && from.Female ) + else if ( !AllowFemaleWearer && from.Female ) { - if( AllowMaleWearer ) + if ( AllowMaleWearer ) from.SendLocalizedMessage( 1063343 ); // Only males can wear this. else from.SendMessage( "You may not wear this." ); @@ -1205,17 +1205,17 @@ namespace Server.Items int dexBonus = ComputeStatBonus( StatType.Dex ), dexReq = ComputeStatReq( StatType.Dex ); int intBonus = ComputeStatBonus( StatType.Int ), intReq = ComputeStatReq( StatType.Int ); - if( from.Dex < dexReq || (from.Dex + dexBonus) < 1 ) + if ( from.Dex < dexReq || (from.Dex + dexBonus) < 1 ) { from.SendLocalizedMessage( 502077 ); // You do not have enough dexterity to equip this item. return false; } - else if( from.Str < strReq || (from.Str + strBonus) < 1 ) + else if ( from.Str < strReq || (from.Str + strBonus) < 1 ) { from.SendLocalizedMessage( 500213 ); // You are not strong enough to equip that. return false; } - else if( from.Int < intReq || (from.Int + intBonus) < 1 ) + else if ( from.Int < intReq || (from.Int + intBonus) < 1 ) { from.SendMessage( "You are not smart enough to equip that." ); return false; @@ -1443,7 +1443,7 @@ namespace Server.Items list.Add( 1041350 ); // faction item #endregion - if( RequiredRace == Race.Elf ) + if ( RequiredRace == Race.Elf ) list.Add( 1075086 ); // Elves Only m_AosSkillBonuses.GetProperties( list ); @@ -1619,12 +1619,12 @@ namespace Server.Items if ( context != null && context.DoNotColor ) Hue = 0; - if( Quality == ArmorQuality.Exceptional ) + if ( Quality == ArmorQuality.Exceptional ) { if ( !( Core.ML && this is BaseShield )) // Guessed Core.ML removed exceptional resist bonuses from crafted shields DistributeBonuses( (tool is BaseRunicTool ? 6 : Core.SE ? 15 : 14) ); // Not sure since when, but right now 15 points are added, not 14. - if( Core.ML && !(this is BaseShield) ) + if ( Core.ML && !(this is BaseShield) ) { int bonus = (int)(from.Skills.ArmsLore.Value / 20); diff --git a/Scripts/Items/Armor/Helmets/ChainCoif.cs b/Scripts/Items/Armor/Helmets/ChainCoif.cs index 9899de2bd..a9c5d2253 100644 --- a/Scripts/Items/Armor/Helmets/ChainCoif.cs +++ b/Scripts/Items/Armor/Helmets/ChainCoif.cs @@ -23,12 +23,12 @@ namespace Server.Items public override ArmorMaterialType MaterialType => ArmorMaterialType.Chainmail; [Constructible] - public ChainCoif() : base( 0x13BB ) + public ChainCoif () : base( 0x13BB ) { Weight = 1.0; } - public ChainCoif( Serial serial ) : base( serial ) + public ChainCoif ( Serial serial ) : base( serial ) { } diff --git a/Scripts/Items/Armor/Helmets/OrcHelm.cs b/Scripts/Items/Armor/Helmets/OrcHelm.cs index db78f0a92..d2b9403f0 100644 --- a/Scripts/Items/Armor/Helmets/OrcHelm.cs +++ b/Scripts/Items/Armor/Helmets/OrcHelm.cs @@ -46,7 +46,7 @@ namespace Server.Items base.Deserialize( reader ); int version = reader.ReadInt(); - if( version == 0 && ( Weight == 1 || Weight == 5 ) ) + if ( version == 0 && ( Weight == 1 || Weight == 5 ) ) { Weight = -1; } diff --git a/Scripts/Items/Armor/Plate/WoodlandGorget.cs b/Scripts/Items/Armor/Plate/WoodlandGorget.cs index db561a00d..6a7dd9336 100644 --- a/Scripts/Items/Armor/Plate/WoodlandGorget.cs +++ b/Scripts/Items/Armor/Plate/WoodlandGorget.cs @@ -45,7 +45,7 @@ namespace Server.Items int version = reader.ReadEncodedInt(); - if( version == 0 ) + if ( version == 0 ) Weight = -1; } } diff --git a/Scripts/Items/Champion Artifacts/Unique/OrcChieftainHelm.cs b/Scripts/Items/Champion Artifacts/Unique/OrcChieftainHelm.cs index 008dcd211..8689061c8 100644 --- a/Scripts/Items/Champion Artifacts/Unique/OrcChieftainHelm.cs +++ b/Scripts/Items/Champion Artifacts/Unique/OrcChieftainHelm.cs @@ -26,7 +26,7 @@ namespace Server.Items Attributes.Luck = 100; Attributes.RegenHits = 3; - if( Utility.RandomBool() ) + if ( Utility.RandomBool() ) Attributes.BonusHits = 30; else Attributes.AttackChance = 30; diff --git a/Scripts/Items/Clothing/BaseClothing.cs b/Scripts/Items/Clothing/BaseClothing.cs index be32e0c44..76912a428 100644 --- a/Scripts/Items/Clothing/BaseClothing.cs +++ b/Scripts/Items/Clothing/BaseClothing.cs @@ -184,29 +184,29 @@ namespace Server.Items if ( !Ethics.Ethic.CheckEquip( from, this ) ) return false; - if( from.AccessLevel < AccessLevel.GameMaster ) + if ( from.AccessLevel < AccessLevel.GameMaster ) { - if( RequiredRace != null && from.Race != RequiredRace ) + if ( RequiredRace != null && from.Race != RequiredRace ) { - if( RequiredRace == Race.Elf ) + if ( RequiredRace == Race.Elf ) from.SendLocalizedMessage( 1072203 ); // Only Elves may use this. else from.SendMessage( "Only {0} may use this.", RequiredRace.PluralName ); return false; } - else if( !AllowMaleWearer && !from.Female ) + else if ( !AllowMaleWearer && !from.Female ) { - if( AllowFemaleWearer ) + if ( AllowFemaleWearer ) from.SendLocalizedMessage( 1010388 ); // Only females can wear this. else from.SendMessage( "You may not wear this." ); return false; } - else if( !AllowFemaleWearer && from.Female ) + else if ( !AllowFemaleWearer && from.Female ) { - if( AllowMaleWearer ) + if ( AllowMaleWearer ) from.SendLocalizedMessage( 1063343 ); // Only males can wear this. else from.SendMessage( "You may not wear this." ); @@ -218,7 +218,7 @@ namespace Server.Items int strBonus = ComputeStatBonus( StatType.Str ); int strReq = ComputeStatReq( StatType.Str ); - if( from.Str < strReq || (from.Str + strBonus) < 1 ) + if ( from.Str < strReq || (from.Str + strBonus) < 1 ) { from.SendLocalizedMessage( 500213 ); // You are not strong enough to equip that. return false; @@ -296,9 +296,9 @@ namespace Server.Items { BaseClothing clothing = (BaseClothing)item; - if( clothing.RequiredRace != null && m.Race != clothing.RequiredRace ) + if ( clothing.RequiredRace != null && m.Race != clothing.RequiredRace ) { - if( clothing.RequiredRace == Race.Elf ) + if ( clothing.RequiredRace == Race.Elf ) m.SendLocalizedMessage( 1072203 ); // Only Elves may use this. else m.SendMessage( "Only {0} may use this.", clothing.RequiredRace.PluralName ); @@ -568,7 +568,7 @@ namespace Server.Items if ( m_Quality == ClothingQuality.Exceptional ) list.Add( 1060636 ); // exceptional - if( RequiredRace == Race.Elf ) + if ( RequiredRace == Race.Elf ) list.Add( 1075086 ); // Elves Only if ( m_AosSkillBonuses != null ) diff --git a/Scripts/Items/Clothing/Hats.cs b/Scripts/Items/Clothing/Hats.cs index af54fb64a..5a58e2d48 100644 --- a/Scripts/Items/Clothing/Hats.cs +++ b/Scripts/Items/Clothing/Hats.cs @@ -57,7 +57,7 @@ namespace Server.Items { base.AddEquipInfoAttributes( from, attrs ); - if( m_IsShipwreckedItem ) + if ( m_IsShipwreckedItem ) attrs.Add( new EquipInfoAttribute( 1041645 ) ); // recovered from a shipwreck } @@ -73,7 +73,7 @@ namespace Server.Items { Quality = (ClothingQuality)quality; - if( Quality == ClothingQuality.Exceptional ) + if ( Quality == ClothingQuality.Exceptional ) DistributeBonuses( (tool is BaseRunicTool ? 6 : (Core.SE ? 15 : 14)) ); //BLAME OSI. (We can't confirm it's an OSI bug yet.) return base.OnCraft( quality, makersMark, from, craftSystem, typeRes, tool, craftItem, resHue ); diff --git a/Scripts/Items/Clothing/OuterTorso.cs b/Scripts/Items/Clothing/OuterTorso.cs index c11eefefb..5224f3815 100644 --- a/Scripts/Items/Clothing/OuterTorso.cs +++ b/Scripts/Items/Clothing/OuterTorso.cs @@ -197,7 +197,7 @@ namespace Server.Items writer.Write( m_DecayTimer != null ); - if( m_DecayTimer != null ) + if ( m_DecayTimer != null ) writer.WriteDeltaTime( m_DecayTime ); } @@ -211,7 +211,7 @@ namespace Server.Items { case 2: { - if( reader.ReadBool() ) + if ( reader.ReadBool() ) { m_DecayTime = reader.ReadDeltaTime(); BeginDecay( m_DecayTime - DateTime.UtcNow ); diff --git a/Scripts/Items/Clothing/Shoes.cs b/Scripts/Items/Clothing/Shoes.cs index 53cf7c3e3..eea9953f8 100644 --- a/Scripts/Items/Clothing/Shoes.cs +++ b/Scripts/Items/Clothing/Shoes.cs @@ -18,7 +18,7 @@ namespace Server.Items public override bool Scissor( Mobile from, Scissors scissors ) { - if( DefaultResource == CraftResource.None ) + if ( DefaultResource == CraftResource.None ) return base.Scissor( from, scissors ); from.SendLocalizedMessage( 502440 ); // Scissors can not be used on that to produce anything. diff --git a/Scripts/Items/Construction/Ankhs.cs b/Scripts/Items/Construction/Ankhs.cs index 2c00821d8..1327a746b 100644 --- a/Scripts/Items/Construction/Ankhs.cs +++ b/Scripts/Items/Construction/Ankhs.cs @@ -32,7 +32,7 @@ namespace Server.Items if ( !m.InRange( item.GetWorldLocation(), ResurrectRange ) ) m.SendLocalizedMessage( 500446 ); // That is too far away. - else if( m.Map != null && m.Map.CanFit( m.Location, 16, false, false ) ) + else if ( m.Map != null && m.Map.CanFit( m.Location, 16, false, false ) ) { m.CloseGump( typeof( ResurrectGump ) ); m.SendGump( new ResurrectGump( m, ResurrectMessage.VirtueShrine ) ); diff --git a/Scripts/Items/Containers/BaseTreasureChest.cs b/Scripts/Items/Containers/BaseTreasureChest.cs index dbad61b42..85022880b 100644 --- a/Scripts/Items/Containers/BaseTreasureChest.cs +++ b/Scripts/Items/Containers/BaseTreasureChest.cs @@ -58,7 +58,7 @@ namespace Server.Items set { if ( base.Locked != value ) { base.Locked = value; - + if ( !value ) StartResetTimer(); } @@ -119,7 +119,7 @@ namespace Server.Items m_MinSpawnTime = reader.ReadShort(); m_MaxSpawnTime = reader.ReadShort(); - if( !Locked ) + if ( !Locked ) StartResetTimer(); } @@ -155,7 +155,7 @@ namespace Server.Items private void StartResetTimer() { - if( m_ResetTimer == null ) + if ( m_ResetTimer == null ) m_ResetTimer = new TreasureResetTimer( this ); else m_ResetTimer.Delay = TimeSpan.FromMinutes( Utility.Random( m_MinSpawnTime, m_MaxSpawnTime )); @@ -215,9 +215,9 @@ namespace Server.Items public void Reset() { - if( m_ResetTimer != null ) + if ( m_ResetTimer != null ) { - if( m_ResetTimer.Running ) + if ( m_ResetTimer.Running ) m_ResetTimer.Stop(); } @@ -228,13 +228,13 @@ namespace Server.Items public enum TreasureLevel { - Level1, - Level2, - Level3, - Level4, + Level1, + Level2, + Level3, + Level4, Level5, Level6, - }; + }; private class TreasureResetTimer : Timer { @@ -252,4 +252,4 @@ namespace Server.Items } } } -} \ No newline at end of file +} diff --git a/Scripts/Items/Containers/FillableContainers.cs b/Scripts/Items/Containers/FillableContainers.cs index df34642cb..459b90fc4 100644 --- a/Scripts/Items/Containers/FillableContainers.cs +++ b/Scripts/Items/Containers/FillableContainers.cs @@ -35,14 +35,14 @@ namespace Server.Items get { return m_Content; } set { - if( m_Content == value ) + if ( m_Content == value ) return; m_Content = value; for( int i = Items.Count - 1; i >= 0; --i ) { - if( i < Items.Count ) + if ( i < Items.Count ) Items[ i ].Delete(); } @@ -70,12 +70,12 @@ namespace Server.Items public virtual void AcquireContent() { - if( m_Content != null ) + if ( m_Content != null ) return; m_Content = FillableContent.Acquire( this.GetWorldLocation(), this.Map ); - if( m_Content != null ) + if ( m_Content != null ) Respawn(); } @@ -88,7 +88,7 @@ namespace Server.Items { base.OnAfterDelete(); - if( m_RespawnTimer != null ) + if ( m_RespawnTimer != null ) { m_RespawnTimer.Stop(); m_RespawnTimer = null; @@ -111,9 +111,9 @@ namespace Server.Items { bool canSpawn = ( m_Content != null && !Deleted && GetItemsCount() <= SpawnThreshold && !Movable && Parent == null && !IsLockedDown && !IsSecure ); - if( canSpawn ) + if ( canSpawn ) { - if( m_RespawnTimer == null ) + if ( m_RespawnTimer == null ) { int mins = Utility.RandomMinMax( this.MinRespawnMinutes, this.MaxRespawnMinutes ); TimeSpan delay = TimeSpan.FromMinutes( mins ); @@ -122,7 +122,7 @@ namespace Server.Items m_RespawnTimer = Timer.DelayCall( delay, new TimerCallback( Respawn ) ); } } - else if( m_RespawnTimer != null ) + else if ( m_RespawnTimer != null ) { m_RespawnTimer.Stop(); m_RespawnTimer = null; @@ -131,18 +131,18 @@ namespace Server.Items public void Respawn() { - if( m_RespawnTimer != null ) + if ( m_RespawnTimer != null ) { m_RespawnTimer.Stop(); m_RespawnTimer = null; } - if( m_Content == null || Deleted ) + if ( m_Content == null || Deleted ) return; GenerateContent(); - if( IsLockable ) + if ( IsLockable ) { Locked = true; @@ -153,9 +153,9 @@ namespace Server.Items RequiredSkill = difficulty; } - if( IsTrappable && ( m_Content.Level > 1 || 4 > Utility.Random( 5 ) ) ) + if ( IsTrappable && ( m_Content.Level > 1 || 4 > Utility.Random( 5 ) ) ) { - if( m_Content.Level > Utility.Random( 5 ) ) + if ( m_Content.Level > Utility.Random( 5 ) ) TrapType = TrapType.PoisonTrap; else TrapType = TrapType.ExplosionTrap; @@ -177,7 +177,7 @@ namespace Server.Items { int itemsCount = GetItemsCount(); - if( itemsCount > SpawnThreshold ) + if ( itemsCount > SpawnThreshold ) return 0; int maxSpawnCount = ( 1 + SpawnThreshold - itemsCount ) * 2; @@ -187,7 +187,7 @@ namespace Server.Items public virtual void GenerateContent() { - if( m_Content == null || Deleted ) + if ( m_Content == null || Deleted ) return; int toSpawn = GetSpawnCount(); @@ -196,7 +196,7 @@ namespace Server.Items { Item item = m_Content.Construct(); - if( item != null ) + if ( item != null ) { List list = this.Items; @@ -204,11 +204,11 @@ namespace Server.Items { Item subItem = list[ j ]; - if( !( subItem is Container ) && subItem.StackWith( null, item, false ) ) + if ( !( subItem is Container ) && subItem.StackWith( null, item, false ) ) break; } - if( item != null && !item.Deleted ) + if ( item != null && !item.Deleted ) DropItem( item ); } } @@ -227,7 +227,7 @@ namespace Server.Items writer.Write( (int)ContentType ); - if( m_RespawnTimer != null ) + if ( m_RespawnTimer != null ) { writer.Write( true ); writer.WriteDeltaTime( (DateTime)m_NextRespawnTime ); @@ -253,7 +253,7 @@ namespace Server.Items } case 0: { - if( reader.ReadBool() ) + if ( reader.ReadBool() ) { m_NextRespawnTime = reader.ReadDeltaTime(); @@ -284,12 +284,12 @@ namespace Server.Items public override void AcquireContent() { - if( m_Content != null ) + if ( m_Content != null ) return; m_Content = FillableContent.Library; - if( m_Content != null ) + if ( m_Content != null ) Respawn(); } @@ -318,7 +318,7 @@ namespace Server.Items int version = reader.ReadEncodedInt(); - if( version == 0 && m_Content == null ) + if ( version == 0 && m_Content == null ) Timer.DelayCall( TimeSpan.Zero, new TimerCallback( AcquireContent ) ); } } @@ -440,7 +440,7 @@ namespace Server.Items int version = reader.ReadEncodedInt(); - if( version == 0 && Weight == 3 ) + if ( version == 0 && Weight == 3 ) Weight = -1; } } @@ -473,7 +473,7 @@ namespace Server.Items int version = reader.ReadEncodedInt(); - if( version == 0 && Weight == 25 ) + if ( version == 0 && Weight == 25 ) Weight = -1; } } @@ -505,7 +505,7 @@ namespace Server.Items int version = reader.ReadInt(); - if( version == 0 && Weight == 25 ) + if ( version == 0 && Weight == 25 ) Weight = -1; } } @@ -537,7 +537,7 @@ namespace Server.Items int version = reader.ReadInt(); - if( version == 0 && Weight == 25 ) + if ( version == 0 && Weight == 25 ) Weight = -1; } } @@ -569,7 +569,7 @@ namespace Server.Items int version = reader.ReadInt(); - if( version == 0 && Weight == 2 ) + if ( version == 0 && Weight == 2 ) Weight = -1; } } @@ -616,11 +616,11 @@ namespace Server.Items { Item item = Loot.Construct( m_Types ); - if( item is Key ) + if ( item is Key ) ( (Key)item ).ItemID = Utility.RandomList( (int)KeyType.Copper, (int)KeyType.Gold, (int)KeyType.Iron, (int)KeyType.Rusty ); - else if( item is Arrow || item is Bolt ) + else if ( item is Arrow || item is Bolt ) item.Amount = Utility.RandomMinMax( 2, 6 ); - else if( item is Bandage || item is Lockpick ) + else if ( item is Bandage || item is Lockpick ) item.Amount = Utility.RandomMinMax( 1, 3 ); return item; @@ -650,11 +650,11 @@ namespace Server.Items int index = Utility.Random( m_Types.Length ); - if( m_Types[ index ] == typeof( BeverageBottle ) ) + if ( m_Types[ index ] == typeof( BeverageBottle ) ) { item = new BeverageBottle( m_Content ); } - else if( m_Types[ index ] == typeof( Jug ) ) + else if ( m_Types[ index ] == typeof( Jug ) ) { item = new Jug( m_Content ); } @@ -662,7 +662,7 @@ namespace Server.Items { item = base.Construct(); - if( item is BaseBeverage ) + if ( item is BaseBeverage ) { BaseBeverage bev = (BaseBeverage)item; @@ -723,7 +723,7 @@ namespace Server.Items { FillableEntry entry = m_Entries[ i ]; - if( index < entry.Weight ) + if ( index < entry.Weight ) return entry.Construct(); index -= entry.Weight; @@ -1456,7 +1456,7 @@ namespace Server.Items { int v = (int)type; - if( v >= 0 && v < m_ContentTypes.Length ) + if ( v >= 0 && v < m_ContentTypes.Length ) return m_ContentTypes[ v ]; return null; @@ -1464,7 +1464,7 @@ namespace Server.Items public static FillableContentType Lookup( FillableContent content ) { - if( content == null ) + if ( content == null ) return FillableContentType.None; return (FillableContentType)Array.IndexOf( m_ContentTypes, content ); @@ -1490,10 +1490,10 @@ namespace Server.Items public static FillableContent Acquire( Point3D loc, Map map ) { - if( map == null || map == Map.Internal ) + if ( map == null || map == Map.Internal ) return null; - if( m_AcquireTable == null ) + if ( m_AcquireTable == null ) { m_AcquireTable = new Hashtable(); @@ -1511,12 +1511,12 @@ namespace Server.Items foreach( Mobile mob in map.GetMobilesInRange( loc, 20 ) ) { - if( nearest != null && mob.GetDistanceToSqrt( loc ) > nearest.GetDistanceToSqrt( loc ) && !( nearest is Cobbler && mob is Provisioner ) ) + if ( nearest != null && mob.GetDistanceToSqrt( loc ) > nearest.GetDistanceToSqrt( loc ) && !( nearest is Cobbler && mob is Provisioner ) ) continue; FillableContent check = m_AcquireTable[ mob.GetType() ] as FillableContent; - if( check != null ) + if ( check != null ) { nearest = mob; content = check; diff --git a/Scripts/Items/Containers/ParagonChest.cs b/Scripts/Items/Containers/ParagonChest.cs index d39d5f116..d9a8ce9d4 100644 --- a/Scripts/Items/Containers/ParagonChest.cs +++ b/Scripts/Items/Containers/ParagonChest.cs @@ -19,7 +19,7 @@ namespace Server.Items private static int[] m_Hues = new int[] { - 0x0, 0x455, 0x47E, 0x89F, 0x8A5, 0x8AB, + 0x0, 0x455, 0x47E, 0x89F, 0x8A5, 0x8AB, 0x966, 0x96D, 0x972, 0x973, 0x979 }; @@ -76,14 +76,14 @@ namespace Server.Items min = 10; max = 20; } } - + public void Flip() { switch ( ItemID ) { case 0x9AB : ItemID = 0xE7C; break; case 0xE7C : ItemID = 0x9AB; break; - + case 0xE40 : ItemID = 0xE41; break; case 0xE41 : ItemID = 0xE40; break; } @@ -165,11 +165,11 @@ namespace Server.Items DropItem( item ); } - else if( item is BaseHat ) + else if ( item is BaseHat ) { BaseHat hat = (BaseHat)item; - if( Core.AOS ) + if ( Core.AOS ) { int attributeCount; int min, max; @@ -181,7 +181,7 @@ namespace Server.Items DropItem( item ); } - else if( item is BaseJewel ) + else if ( item is BaseJewel ) { int attributeCount; int min, max; diff --git a/Scripts/Items/Containers/SalvageBag.cs b/Scripts/Items/Containers/SalvageBag.cs index 496a5e10c..6b0b69ddc 100644 --- a/Scripts/Items/Containers/SalvageBag.cs +++ b/Scripts/Items/Containers/SalvageBag.cs @@ -32,7 +32,7 @@ namespace Server.Items { base.GetContextMenuEntries( from, list ); - if( from.Alive ) + if ( from.Alive ) { list.Add( new SalvageIngotsEntry( this, IsChildOf( from.Backpack ) && Resmeltables() ) ); list.Add( new SalvageClothEntry( this, IsChildOf( from.Backpack ) && Scissorables() ) ); @@ -45,19 +45,19 @@ namespace Server.Items { foreach( Item i in Items ) { - if( i != null && !i.Deleted ) + if ( i != null && !i.Deleted ) { - if( i is BaseWeapon ) + if ( i is BaseWeapon ) { - if( CraftResources.GetType( ( (BaseWeapon)i ).Resource ) == CraftResourceType.Metal ) + if ( CraftResources.GetType( ( (BaseWeapon)i ).Resource ) == CraftResourceType.Metal ) return true; } - if( i is BaseArmor ) + if ( i is BaseArmor ) { - if( CraftResources.GetType( ( (BaseArmor)i ).Resource ) == CraftResourceType.Metal ) + if ( CraftResources.GetType( ( (BaseArmor)i ).Resource ) == CraftResourceType.Metal ) return true; } - if( i is DragonBardingDeed ) + if ( i is DragonBardingDeed ) return true; } } @@ -68,18 +68,18 @@ namespace Server.Items { foreach( Item i in Items ) { - if( i != null && !i.Deleted ) + if ( i != null && !i.Deleted ) { - if( i is IScissorable ) + if ( i is IScissorable ) { - if( i is BaseClothing ) + if ( i is BaseClothing ) return true; - if( i is BaseArmor ) + if ( i is BaseArmor ) { - if( CraftResources.GetType( ( (BaseArmor)i ).Resource ) == CraftResourceType.Leather ) + if ( CraftResources.GetType( ( (BaseArmor)i ).Resource ) == CraftResourceType.Leather ) return true; } - if( ( i is Cloth ) || ( i is BoltOfCloth ) || ( i is Hides ) || ( i is BonePile ) ) + if ( ( i is Cloth ) || ( i is BoltOfCloth ) || ( i is Hides ) || ( i is BonePile ) ) return true; } } @@ -93,22 +93,22 @@ namespace Server.Items { try { - if( CraftResources.GetType( resource ) != CraftResourceType.Metal ) + if ( CraftResources.GetType( resource ) != CraftResourceType.Metal ) return false; CraftResourceInfo info = CraftResources.GetInfo( resource ); - if( info == null || info.ResourceTypes.Length == 0 ) + if ( info == null || info.ResourceTypes.Length == 0 ) return false; CraftItem craftItem = DefBlacksmithy.CraftSystem.CraftItems.SearchFor( item.GetType() ); - if( craftItem == null || craftItem.Resources.Count == 0 ) + if ( craftItem == null || craftItem.Resources.Count == 0 ) return false; CraftRes craftResource = craftItem.Resources.GetAt( 0 ); - if( craftResource.Amount < 2 ) + if ( craftResource.Amount < 2 ) return false; // Not enough metal to resmelt double difficulty = 0.0; @@ -128,13 +128,13 @@ namespace Server.Items Type resourceType = info.ResourceTypes[ 0 ]; Item ingot = (Item)Activator.CreateInstance( resourceType ); - if( item is DragonBardingDeed || ( item is BaseArmor && ( (BaseArmor)item ).PlayerConstructed ) || ( item is BaseWeapon && ( (BaseWeapon)item ).PlayerConstructed ) || ( item is BaseClothing && ( (BaseClothing)item ).PlayerConstructed ) ) + if ( item is DragonBardingDeed || ( item is BaseArmor && ( (BaseArmor)item ).PlayerConstructed ) || ( item is BaseWeapon && ( (BaseWeapon)item ).PlayerConstructed ) || ( item is BaseClothing && ( (BaseClothing)item ).PlayerConstructed ) ) { double mining = from.Skills[ SkillName.Mining ].Value; - if( mining > 100.0 ) + if ( mining > 100.0 ) mining = 100.0; double amount = ( ( ( 4 + mining ) * craftResource.Amount - 4 ) * 0.0068 ); - if( amount < 2 ) + if ( amount < 2 ) ingot.Amount = 2; else ingot.Amount = (int)amount; @@ -176,11 +176,11 @@ namespace Server.Items bool ToolFound = false; foreach( Item tool in tools ) { - if( tool is BaseTool && ( (BaseTool)tool ).CraftSystem == DefBlacksmithy.CraftSystem ) + if ( tool is BaseTool && ( (BaseTool)tool ).CraftSystem == DefBlacksmithy.CraftSystem ) ToolFound = true; } - if( !ToolFound ) + if ( !ToolFound ) { from.SendLocalizedMessage( 1079822 ); // You need a blacksmithing tool in order to salvage ingots. return; @@ -189,7 +189,7 @@ namespace Server.Items bool anvil, forge; DefBlacksmithy.CheckAnvilAndForge( from, 2, out anvil, out forge ); - if( !forge ) + if ( !forge ) { from.SendLocalizedMessage( 1044265 ); // You must be near a forge. return; @@ -206,30 +206,30 @@ namespace Server.Items { Item item = Smeltables[ i ]; - if( item is BaseArmor ) + if ( item is BaseArmor ) { - if( Resmelt( from, item, ( (BaseArmor)item ).Resource ) ) + if ( Resmelt( from, item, ( (BaseArmor)item ).Resource ) ) salvaged++; else notSalvaged++; } - else if( item is BaseWeapon ) + else if ( item is BaseWeapon ) { - if( Resmelt( from, item, ( (BaseWeapon)item ).Resource ) ) + if ( Resmelt( from, item, ( (BaseWeapon)item ).Resource ) ) salvaged++; else notSalvaged++; } - else if( item is DragonBardingDeed ) + else if ( item is DragonBardingDeed ) { - if( Resmelt( from, item, ( (DragonBardingDeed)item ).Resource ) ) + if ( Resmelt( from, item, ( (DragonBardingDeed)item ).Resource ) ) salvaged++; else notSalvaged++; } } - if( m_Failure ) + if ( m_Failure ) { from.SendLocalizedMessage( 1079975 ); // You failed to smelt some metal for lack of skill. m_Failure = false; @@ -241,7 +241,7 @@ namespace Server.Items private void SalvageCloth( Mobile from ) { Scissors scissors = from.Backpack.FindItemByType( typeof( Scissors ) ) as Scissors; - if( scissors == null ) + if ( scissors == null ) { from.SendLocalizedMessage( 1079823 ); // You need scissors in order to salvage cloth. return; @@ -275,7 +275,7 @@ namespace Server.Items foreach (Item i in ((Container)this).FindItemsByType(typeof(Item), true)) { - if( ( i is Leather ) || ( i is Cloth ) || ( i is SpinedLeather ) || ( i is HornedLeather ) || ( i is BarbedLeather ) || ( i is Bandage ) || ( i is Bone ) ) + if ( ( i is Leather ) || ( i is Cloth ) || ( i is SpinedLeather ) || ( i is HornedLeather ) || ( i is BarbedLeather ) || ( i is Bandage ) || ( i is Bone ) ) { from.AddToBackpack( i ); } @@ -300,18 +300,18 @@ namespace Server.Items { m_Bag = bag; - if( !enabled ) + if ( !enabled ) Flags |= CMEFlags.Disabled; } public override void OnClick() { - if( m_Bag.Deleted ) + if ( m_Bag.Deleted ) return; Mobile from = Owner.From; - if( from.CheckAlive() ) + if ( from.CheckAlive() ) m_Bag.SalvageAll( from ); } } @@ -325,18 +325,18 @@ namespace Server.Items { m_Bag = bag; - if( !enabled ) + if ( !enabled ) Flags |= CMEFlags.Disabled; } public override void OnClick() { - if( m_Bag.Deleted ) + if ( m_Bag.Deleted ) return; Mobile from = Owner.From; - if( from.CheckAlive() ) + if ( from.CheckAlive() ) m_Bag.SalvageIngots( from ); } } @@ -350,18 +350,18 @@ namespace Server.Items { m_Bag = bag; - if( !enabled ) + if ( !enabled ) Flags |= CMEFlags.Disabled; } public override void OnClick() { - if( m_Bag.Deleted ) + if ( m_Bag.Deleted ) return; Mobile from = Owner.From; - if( from.CheckAlive() ) + if ( from.CheckAlive() ) m_Bag.SalvageCloth( from ); } } diff --git a/Scripts/Items/Containers/TrappableContainer.cs b/Scripts/Items/Containers/TrappableContainer.cs index 71e7c1fe4..843d65ab8 100644 --- a/Scripts/Items/Containers/TrappableContainer.cs +++ b/Scripts/Items/Containers/TrappableContainer.cs @@ -207,7 +207,7 @@ namespace Server.Items Effects.SendLocationParticles( EffectItem.Create( Location, Map, EffectItem.DefaultDuration ), 0x376A, 9, 32, 5022 ); Effects.PlaySound( Location, Map, 0x1F5 ); - if( this.TrapOnOpen ) + if ( this.TrapOnOpen ) { ExecuteTrap( from ); } @@ -257,4 +257,4 @@ namespace Server.Items } } } -} \ No newline at end of file +} diff --git a/Scripts/Items/Containers/TreasureMapChest.cs b/Scripts/Items/Containers/TreasureMapChest.cs index 7d31fc2f8..906826242 100644 --- a/Scripts/Items/Containers/TreasureMapChest.cs +++ b/Scripts/Items/Containers/TreasureMapChest.cs @@ -241,11 +241,11 @@ namespace Server.Items cont.DropItem( item ); } - else if( item is BaseHat ) + else if ( item is BaseHat ) { BaseHat hat = (BaseHat)item; - if( Core.AOS ) + if ( Core.AOS ) { int attributeCount; int min, max; @@ -257,7 +257,7 @@ namespace Server.Items cont.DropItem( item ); } - else if( item is BaseJewel ) + else if ( item is BaseJewel ) { int attributeCount; int min, max; diff --git a/Scripts/Items/Decoration Artifacts/StealableArtifactsSpawner.cs b/Scripts/Items/Decoration Artifacts/StealableArtifactsSpawner.cs index 6bc876657..4e153e0ee 100644 --- a/Scripts/Items/Decoration Artifacts/StealableArtifactsSpawner.cs +++ b/Scripts/Items/Decoration Artifacts/StealableArtifactsSpawner.cs @@ -166,7 +166,7 @@ namespace Server.Items { get { - if( m_TypesOfEntries == null ) + if ( m_TypesOfEntries == null ) { m_TypesOfEntries = new Type[m_Entries.Length]; @@ -417,4 +417,4 @@ namespace Server.Items m_RespawnTimer = Timer.DelayCall( TimeSpan.Zero, TimeSpan.FromMinutes( 15.0 ), new TimerCallback( CheckRespawn ) ); } } -} \ No newline at end of file +} diff --git a/Scripts/Items/Deeds/CommodityDeed.cs b/Scripts/Items/Deeds/CommodityDeed.cs index 964312757..f707e147f 100644 --- a/Scripts/Items/Deeds/CommodityDeed.cs +++ b/Scripts/Items/Deeds/CommodityDeed.cs @@ -173,7 +173,7 @@ namespace Server.Items } else { - if( Core.ML ) + if ( Core.ML ) { number = 1080526; // That must be in your bank box or commodity deed box to use it. } @@ -189,7 +189,7 @@ namespace Server.Items } else if ( ( box == null || !IsChildOf( box ) ) && cox == null ) { - if( Core.ML ) + if ( Core.ML ) { number = 1080526; // That must be in your bank box or commodity deed box to use it. } @@ -249,7 +249,7 @@ namespace Server.Items } else { - if( Core.ML ) + if ( Core.ML ) { number = 1080526; // That must be in your bank box or commodity deed box to use it. } diff --git a/Scripts/Items/Deeds/HairRestylingDeed.cs b/Scripts/Items/Deeds/HairRestylingDeed.cs index 883e0f573..55c8591ee 100644 --- a/Scripts/Items/Deeds/HairRestylingDeed.cs +++ b/Scripts/Items/Deeds/HairRestylingDeed.cs @@ -83,7 +83,7 @@ namespace Server.Items public override void OnResponse( NetState sender, RelayInfo info ) { - if( m_From == null || !m_From.Alive ) + if ( m_From == null || !m_From.Alive ) return; if ( m_Deed.Deleted ) diff --git a/Scripts/Items/Facial/Hair.cs b/Scripts/Items/Facial/Hair.cs index e0542ddc3..f5cf8d3e8 100644 --- a/Scripts/Items/Facial/Hair.cs +++ b/Scripts/Items/Facial/Hair.cs @@ -13,7 +13,7 @@ namespace Server.Items public static Hair GetRandomHair( bool female, int hairHue ) { - if( female ) + if ( female ) { switch ( Utility.Random( 9 ) ) { diff --git a/Scripts/Items/Food/Beverage.cs b/Scripts/Items/Food/Beverage.cs index 57f3c651a..ea3f7ed22 100644 --- a/Scripts/Items/Food/Beverage.cs +++ b/Scripts/Items/Food/Beverage.cs @@ -40,7 +40,7 @@ namespace Server.Items public override int ComputeItemID() { - if( !IsEmpty ) + if ( !IsEmpty ) { switch( Content ) { @@ -85,17 +85,17 @@ namespace Server.Items { case 0: { - if( CheckType( "BottleAle" ) ) + if ( CheckType( "BottleAle" ) ) { Quantity = MaxQuantity; Content = BeverageType.Ale; } - else if( CheckType( "BottleLiquor" ) ) + else if ( CheckType( "BottleLiquor" ) ) { Quantity = MaxQuantity; Content = BeverageType.Liquor; } - else if( CheckType( "BottleWine" ) ) + else if ( CheckType( "BottleWine" ) ) { Quantity = MaxQuantity; Content = BeverageType.Wine; @@ -119,7 +119,7 @@ namespace Server.Items public override int ComputeItemID() { - if( !IsEmpty ) + if ( !IsEmpty ) return 0x9C8; return 0; @@ -159,9 +159,9 @@ namespace Server.Items public override int ComputeItemID() { - if( ItemID >= 0x995 && ItemID <= 0x999 ) + if ( ItemID >= 0x995 && ItemID <= 0x999 ) return ItemID; - else if( ItemID == 0x9CA ) + else if ( ItemID == 0x9CA ) return ItemID; return 0x995; @@ -207,7 +207,7 @@ namespace Server.Items public override int ComputeItemID() { - if( ItemID >= 0xFFF && ItemID <= 0x1002 ) + if ( ItemID >= 0xFFF && ItemID <= 0x1002 ) return ItemID; return 0xFFF; @@ -253,7 +253,7 @@ namespace Server.Items public override int ComputeItemID() { - if( ItemID == 0x99A || ItemID == 0x9B3 || ItemID == 0x9BF || ItemID == 0x9CB ) + if ( ItemID == 0x99A || ItemID == 0x9B3 || ItemID == 0x9BF || ItemID == 0x9CB ) return ItemID; return 0x99A; @@ -302,7 +302,7 @@ namespace Server.Items public override int ComputeItemID() { - if( IsEmpty ) + if ( IsEmpty ) return ( ItemID >= 0x1F81 && ItemID <= 0x1F84 ? ItemID : 0x1F81 ); switch( Content ) @@ -353,32 +353,32 @@ namespace Server.Items { case 0: { - if( CheckType( "MugAle" ) ) + if ( CheckType( "MugAle" ) ) { Quantity = MaxQuantity; Content = BeverageType.Ale; } - else if( CheckType( "GlassCider" ) ) + else if ( CheckType( "GlassCider" ) ) { Quantity = MaxQuantity; Content = BeverageType.Cider; } - else if( CheckType( "GlassLiquor" ) ) + else if ( CheckType( "GlassLiquor" ) ) { Quantity = MaxQuantity; Content = BeverageType.Liquor; } - else if( CheckType( "GlassMilk" ) ) + else if ( CheckType( "GlassMilk" ) ) { Quantity = MaxQuantity; Content = BeverageType.Milk; } - else if( CheckType( "GlassWine" ) ) + else if ( CheckType( "GlassWine" ) ) { Quantity = MaxQuantity; Content = BeverageType.Wine; } - else if( CheckType( "GlassWater" ) ) + else if ( CheckType( "GlassWater" ) ) { Quantity = MaxQuantity; Content = BeverageType.Water; @@ -404,9 +404,9 @@ namespace Server.Items public override int ComputeItemID() { - if( IsEmpty ) + if ( IsEmpty ) { - if( ItemID == 0x9A7 || ItemID == 0xFF7 ) + if ( ItemID == 0x9A7 || ItemID == 0xFF7 ) return ItemID; return 0xFF6; @@ -416,42 +416,42 @@ namespace Server.Items { case BeverageType.Ale: { - if( ItemID == 0x1F96 ) + if ( ItemID == 0x1F96 ) return ItemID; return 0x1F95; } case BeverageType.Cider: { - if( ItemID == 0x1F98 ) + if ( ItemID == 0x1F98 ) return ItemID; return 0x1F97; } case BeverageType.Liquor: { - if( ItemID == 0x1F9A ) + if ( ItemID == 0x1F9A ) return ItemID; return 0x1F99; } case BeverageType.Milk: { - if( ItemID == 0x9AD ) + if ( ItemID == 0x9AD ) return ItemID; return 0x9F0; } case BeverageType.Wine: { - if( ItemID == 0x1F9C ) + if ( ItemID == 0x1F9C ) return ItemID; return 0x1F9B; } case BeverageType.Water: { - if( ItemID == 0xFF8 || ItemID == 0xFF9 || ItemID == 0x1F9E ) + if ( ItemID == 0xFF8 || ItemID == 0xFF9 || ItemID == 0x1F9E ) return ItemID; return 0x1F9D; @@ -488,7 +488,7 @@ namespace Server.Items public override void Deserialize( GenericReader reader ) { - if( CheckType( "PitcherWater" ) || CheckType( "GlassPitcher" ) ) + if ( CheckType( "PitcherWater" ) || CheckType( "GlassPitcher" ) ) base.InternalDeserialize( reader, false ); else base.InternalDeserialize( reader, true ); @@ -499,37 +499,37 @@ namespace Server.Items { case 0: { - if( CheckType( "PitcherAle" ) ) + if ( CheckType( "PitcherAle" ) ) { Quantity = MaxQuantity; Content = BeverageType.Ale; } - else if( CheckType( "PitcherCider" ) ) + else if ( CheckType( "PitcherCider" ) ) { Quantity = MaxQuantity; Content = BeverageType.Cider; } - else if( CheckType( "PitcherLiquor" ) ) + else if ( CheckType( "PitcherLiquor" ) ) { Quantity = MaxQuantity; Content = BeverageType.Liquor; } - else if( CheckType( "PitcherMilk" ) ) + else if ( CheckType( "PitcherMilk" ) ) { Quantity = MaxQuantity; Content = BeverageType.Milk; } - else if( CheckType( "PitcherWine" ) ) + else if ( CheckType( "PitcherWine" ) ) { Quantity = MaxQuantity; Content = BeverageType.Wine; } - else if( CheckType( "PitcherWater" ) ) + else if ( CheckType( "PitcherWater" ) ) { Quantity = MaxQuantity; Content = BeverageType.Water; } - else if( CheckType( "GlassPitcher" ) ) + else if ( CheckType( "GlassPitcher" ) ) { Quantity = 0; Content = BeverageType.Water; @@ -558,7 +558,7 @@ namespace Server.Items { int num = BaseLabelNumber; - if( IsEmpty || num == 0 ) + if ( IsEmpty || num == 0 ) return EmptyLabelNumber; return BaseLabelNumber + (int)m_Content; @@ -620,7 +620,7 @@ namespace Server.Items int itemID = ComputeItemID(); - if( itemID > 0 ) + if ( itemID > 0 ) ItemID = itemID; else Delete(); @@ -633,9 +633,9 @@ namespace Server.Items get { return m_Quantity; } set { - if( value < 0 ) + if ( value < 0 ) value = 0; - else if( value > MaxQuantity ) + else if ( value > MaxQuantity ) value = MaxQuantity; m_Quantity = value; @@ -644,7 +644,7 @@ namespace Server.Items int itemID = ComputeItemID(); - if( itemID > 0 ) + if ( itemID > 0 ) ItemID = itemID; else Delete(); @@ -655,11 +655,11 @@ namespace Server.Items { int perc = ( m_Quantity * 100 ) / MaxQuantity; - if( perc <= 0 ) + if ( perc <= 0 ) return 1042975; // It's empty. - else if( perc <= 33 ) + else if ( perc <= 33 ) return 1042974; // It's nearly empty. - else if( perc <= 66 ) + else if ( perc <= 66 ) return 1042973; // It's half full. else return 1042972; // It's full. @@ -669,7 +669,7 @@ namespace Server.Items { base.GetProperties( list ); - if( ShowQuantity ) + if ( ShowQuantity ) list.Add( GetQuantityDescription() ); } @@ -677,31 +677,31 @@ namespace Server.Items { base.OnSingleClick( from ); - if( ShowQuantity ) + if ( ShowQuantity ) LabelTo( from, GetQuantityDescription() ); } public virtual bool ValidateUse( Mobile from, bool message ) { - if( Deleted ) + if ( Deleted ) return false; - if( !Movable && !Fillable ) + if ( !Movable && !Fillable ) { Multis.BaseHouse house = Multis.BaseHouse.FindHouseAt( this ); - if( house == null || !house.IsLockedDown( this ) ) + if ( house == null || !house.IsLockedDown( this ) ) { - if( message ) + if ( message ) from.SendLocalizedMessage( 502946, "", 0x59 ); // That belongs to someone else. return false; } } - if( from.Map != Map || !from.InRange( GetWorldLocation(), 2 ) || !from.InLOS( this ) ) + if ( from.Map != Map || !from.InRange( GetWorldLocation(), 2 ) || !from.InLOS( this ) ) { - if( message ) + if ( message ) from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that. return false; @@ -712,21 +712,21 @@ namespace Server.Items public virtual void Fill_OnTarget( Mobile from, object targ ) { - if( !IsEmpty || !Fillable || !ValidateUse( from, false ) ) + if ( !IsEmpty || !Fillable || !ValidateUse( from, false ) ) return; - if( targ is BaseBeverage ) + if ( targ is BaseBeverage ) { BaseBeverage bev = (BaseBeverage)targ; - if( bev.IsEmpty || !bev.ValidateUse( from, true ) ) + if ( bev.IsEmpty || !bev.ValidateUse( from, true ) ) return; this.Content = bev.Content; this.Poison = bev.Poison; this.Poisoner = bev.Poisoner; - if( bev.Quantity > this.MaxQuantity ) + if ( bev.Quantity > this.MaxQuantity ) { this.Quantity = this.MaxQuantity; bev.Quantity -= this.MaxQuantity; @@ -737,15 +737,15 @@ namespace Server.Items bev.Quantity = 0; } } - else if( targ is BaseWaterContainer ) + else if ( targ is BaseWaterContainer ) { BaseWaterContainer bwc = targ as BaseWaterContainer; - if( Quantity == 0 || ( Content == BeverageType.Water && !IsFull ) ) + if ( Quantity == 0 || ( Content == BeverageType.Water && !IsFull ) ) { int iNeed = Math.Min( ( MaxQuantity - Quantity ), bwc.Quantity ); - if( iNeed > 0 && !bwc.IsEmpty && !IsFull ) + if ( iNeed > 0 && !bwc.IsEmpty && !IsFull ) { bwc.Quantity -= iNeed; Quantity += iNeed; @@ -755,20 +755,20 @@ namespace Server.Items } } } - else if( targ is Item ) + else if ( targ is Item ) { Item item = (Item)targ; IWaterSource src; src = ( item as IWaterSource ); - if( src == null && item is AddonComponent ) + if ( src == null && item is AddonComponent ) src = ( ( (AddonComponent)item ).Addon as IWaterSource ); - if( src == null || src.Quantity <= 0 ) + if ( src == null || src.Quantity <= 0 ) return; - if( from.Map != item.Map || !from.InRange( item.GetWorldLocation(), 2 ) || !from.InLOS( item ) ) + if ( from.Map != item.Map || !from.InRange( item.GetWorldLocation(), 2 ) || !from.InLOS( item ) ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that. return; @@ -778,7 +778,7 @@ namespace Server.Items this.Poison = null; this.Poisoner = null; - if( src.Quantity > this.MaxQuantity ) + if ( src.Quantity > this.MaxQuantity ) { this.Quantity = this.MaxQuantity; src.Quantity -= this.MaxQuantity; @@ -791,39 +791,39 @@ namespace Server.Items from.SendLocalizedMessage( 1010089 ); // You fill the container with water. } - else if( targ is Cow ) + else if ( targ is Cow ) { Cow cow = (Cow)targ; - if( cow.TryMilk( from ) ) + if ( cow.TryMilk( from ) ) { Content = BeverageType.Milk; Quantity = MaxQuantity; from.SendLocalizedMessage( 1080197 ); // You fill the container with milk. } } - else if( targ is LandTarget ) + else if ( targ is LandTarget ) { int tileID = ( (LandTarget)targ ).TileID; PlayerMobile player = from as PlayerMobile; - if( player != null ) + if ( player != null ) { QuestSystem qs = player.Quest; - if( qs is WitchApprenticeQuest ) + if ( qs is WitchApprenticeQuest ) { FindIngredientObjective obj = qs.FindObjective( typeof( FindIngredientObjective ) ) as FindIngredientObjective; - if( obj != null && !obj.Completed && obj.Ingredient == Ingredient.SwampWater ) + if ( obj != null && !obj.Completed && obj.Ingredient == Ingredient.SwampWater ) { bool contains = false; for( int i = 0; !contains && i < m_SwampTiles.Length; i += 2 ) contains = ( tileID >= m_SwampTiles[ i ] && tileID <= m_SwampTiles[ i + 1 ] ); - if( contains ) + if ( contains ) { Delete(); @@ -862,13 +862,13 @@ namespace Server.Items public static void CheckHeaveTimer( Mobile from ) { - if( from.BAC > 0 && from.Map != Map.Internal && !from.Deleted ) + if ( from.BAC > 0 && from.Map != Map.Internal && !from.Deleted ) { Timer t = (Timer)m_Table[ from ]; - if( t == null ) + if ( t == null ) { - if( from.BAC > 60 ) + if ( from.BAC > 60 ) from.BAC = 60; t = new HeaveTimer( from ); @@ -881,7 +881,7 @@ namespace Server.Items { Timer t = (Timer)m_Table[ from ]; - if( t != null ) + if ( t != null ) { t.Stop(); m_Table.Remove( from ); @@ -905,27 +905,27 @@ namespace Server.Items protected override void OnTick() { - if( m_Drunk.Deleted || m_Drunk.Map == Map.Internal ) + if ( m_Drunk.Deleted || m_Drunk.Map == Map.Internal ) { Stop(); m_Table.Remove( m_Drunk ); } - else if( m_Drunk.Alive ) + else if ( m_Drunk.Alive ) { - if( m_Drunk.BAC > 60 ) + if ( m_Drunk.BAC > 60 ) m_Drunk.BAC = 60; // chance to get sober - if( 10 > Utility.Random( 100 ) ) + if ( 10 > Utility.Random( 100 ) ) --m_Drunk.BAC; // lose some stats m_Drunk.Stam -= 1; m_Drunk.Mana -= 1; - if( Utility.Random( 1, 4 ) == 1 ) + if ( Utility.Random( 1, 4 ) == 1 ) { - if( !m_Drunk.Mounted ) + if ( !m_Drunk.Mounted ) { // turn in a random direction m_Drunk.Direction = (Direction)Utility.Random( 8 ); @@ -938,7 +938,7 @@ namespace Server.Items m_Drunk.PublicOverheadMessage( Network.MessageType.Regular, 0x3B2, 500849 ); } - if( m_Drunk.BAC <= 0 ) + if ( m_Drunk.BAC <= 0 ) { Stop(); m_Table.Remove( m_Drunk ); @@ -953,21 +953,21 @@ namespace Server.Items public virtual void Pour_OnTarget( Mobile from, object targ ) { - if( IsEmpty || !Pourable || !ValidateUse( from, false ) ) + if ( IsEmpty || !Pourable || !ValidateUse( from, false ) ) return; - if( targ is BaseBeverage ) + if ( targ is BaseBeverage ) { BaseBeverage bev = (BaseBeverage)targ; - if( !bev.ValidateUse( from, true ) ) + if ( !bev.ValidateUse( from, true ) ) return; - if( bev.IsFull && bev.Content == this.Content ) + if ( bev.IsFull && bev.Content == this.Content ) { from.SendLocalizedMessage( 500848 ); // Couldn't pour it there. It was already full. } - else if( !bev.IsEmpty ) + else if ( !bev.IsEmpty ) { from.SendLocalizedMessage( 500846 ); // Can't pour it there. } @@ -977,7 +977,7 @@ namespace Server.Items bev.Poison = this.Poison; bev.Poisoner = this.Poisoner; - if( this.Quantity > bev.MaxQuantity ) + if ( this.Quantity > bev.MaxQuantity ) { bev.Quantity = bev.MaxQuantity; this.Quantity -= bev.MaxQuantity; @@ -991,12 +991,12 @@ namespace Server.Items from.PlaySound( 0x4E ); } } - else if( from == targ ) + else if ( from == targ ) { - if( from.Thirst < 20 ) + if ( from.Thirst < 20 ) from.Thirst += 1; - if( ContainsAlchohol ) + if ( ContainsAlchohol ) { int bac = 0; @@ -1010,7 +1010,7 @@ namespace Server.Items from.BAC += bac; - if( from.BAC > 60 ) + if ( from.BAC > 60 ) from.BAC = 60; CheckHeaveTimer( from ); @@ -1018,20 +1018,20 @@ namespace Server.Items from.PlaySound( Utility.RandomList( 0x30, 0x2D6 ) ); - if( m_Poison != null ) + if ( m_Poison != null ) from.ApplyPoison( m_Poisoner, m_Poison ); --Quantity; } - else if( targ is BaseWaterContainer ) + else if ( targ is BaseWaterContainer ) { BaseWaterContainer bwc = targ as BaseWaterContainer; - if( Content != BeverageType.Water ) + if ( Content != BeverageType.Water ) { from.SendLocalizedMessage( 500842 ); // Can't pour that in there. } - else if( bwc.Items.Count != 0 ) + else if ( bwc.Items.Count != 0 ) { from.SendLocalizedMessage( 500841 ); // That has something in it. } @@ -1039,7 +1039,7 @@ namespace Server.Items { int itNeeds = Math.Min( ( bwc.MaxQuantity - bwc.Quantity ), Quantity ); - if( itNeeds > 0 ) + if ( itNeeds > 0 ) { bwc.Quantity += itNeeds; Quantity -= itNeeds; @@ -1048,32 +1048,32 @@ namespace Server.Items } } } - else if( targ is PlantItem ) + else if ( targ is PlantItem ) { ( (PlantItem)targ ).Pour( from, this ); } - else if( targ is AddonComponent && + else if ( targ is AddonComponent && ( ( (AddonComponent)targ ).Addon is WaterVatEast || ( (AddonComponent)targ ).Addon is WaterVatSouth ) && this.Content == BeverageType.Water ) { PlayerMobile player = from as PlayerMobile; - if( player != null ) + if ( player != null ) { SolenMatriarchQuest qs = player.Quest as SolenMatriarchQuest; - if( qs != null ) + if ( qs != null ) { QuestObjective obj = qs.FindObjective( typeof( GatherWaterObjective ) ); - if( obj != null && !obj.Completed ) + if ( obj != null && !obj.Completed ) { BaseAddon vat = ( (AddonComponent)targ ).Addon; - if( vat.X > 5784 && vat.X < 5814 && vat.Y > 1903 && vat.Y < 1934 && + if ( vat.X > 5784 && vat.X < 5814 && vat.Y > 1903 && vat.Y < 1934 && ( ( qs.RedSolen && vat.Map == Map.Trammel ) || ( !qs.RedSolen && vat.Map == Map.Felucca ) ) ) { - if( obj.CurProgress + Quantity > obj.MaxProgress ) + if ( obj.CurProgress + Quantity > obj.MaxProgress ) { int delta = obj.MaxProgress - obj.CurProgress; @@ -1098,15 +1098,15 @@ namespace Server.Items public override void OnDoubleClick( Mobile from ) { - if( IsEmpty ) + if ( IsEmpty ) { - if( !Fillable || !ValidateUse( from, true ) ) + if ( !Fillable || !ValidateUse( from, true ) ) return; from.BeginTarget( -1, true, TargetFlags.None, new TargetCallback( Fill_OnTarget ) ); SendLocalizedMessageTo( from, 500837 ); // Fill from what? } - else if( Pourable && ValidateUse( from, true ) ) + else if ( Pourable && ValidateUse( from, true ) ) { from.BeginTarget( -1, true, TargetFlags.None, new TargetCallback( Pour_OnTarget ) ); from.SendLocalizedMessage( 1010086 ); // What do you want to use this on? @@ -1129,11 +1129,11 @@ namespace Server.Items { BaseBeverage bev = items[ i ] as BaseBeverage; - if( bev != null && bev.Content == content && !bev.IsEmpty ) + if ( bev != null && bev.Content == content && !bev.IsEmpty ) total += bev.Quantity; } - if( total >= quantity ) + if ( total >= quantity ) { // We've enough, so consume it @@ -1143,12 +1143,12 @@ namespace Server.Items { BaseBeverage bev = items[ i ] as BaseBeverage; - if( bev == null || bev.Content != content || bev.IsEmpty ) + if ( bev == null || bev.Content != content || bev.IsEmpty ) continue; int theirQuantity = bev.Quantity; - if( theirQuantity < need ) + if ( theirQuantity < need ) { bev.Quantity = 0; need -= theirQuantity; @@ -1208,7 +1208,7 @@ namespace Server.Items { base.Deserialize( reader ); - if( !read ) + if ( !read ) return; int version = reader.ReadInt(); diff --git a/Scripts/Items/Guilds/GuildDeed.cs b/Scripts/Items/Guilds/GuildDeed.cs index 74bda5c54..873723a5a 100644 --- a/Scripts/Items/Guilds/GuildDeed.cs +++ b/Scripts/Items/Guilds/GuildDeed.cs @@ -40,7 +40,7 @@ namespace Server.Items public override void OnDoubleClick( Mobile from ) { - if( Guild.NewGuildSystem ) + if ( Guild.NewGuildSystem ) return; if ( !IsChildOf( from.Backpack ) ) diff --git a/Scripts/Items/Guilds/GuildTeleporter.cs b/Scripts/Items/Guilds/GuildTeleporter.cs index fe98f377a..bb0c2c8da 100644 --- a/Scripts/Items/Guilds/GuildTeleporter.cs +++ b/Scripts/Items/Guilds/GuildTeleporter.cs @@ -64,7 +64,7 @@ namespace Server.Items public override void OnDoubleClick( Mobile from ) { - if( Guild.NewGuildSystem ) + if ( Guild.NewGuildSystem ) return; Guildstone stone = m_Stone as Guildstone; @@ -89,7 +89,7 @@ namespace Server.Items { from.SendLocalizedMessage( 501141 ); // You can only place a guildstone in a house you own! } - else if( house.FindGuildstone() != null ) + else if ( house.FindGuildstone() != null ) { from.SendLocalizedMessage( 501142 );//Only one guildstone may reside in a given house. } diff --git a/Scripts/Items/Guilds/Guildstone.cs b/Scripts/Items/Guilds/Guildstone.cs index efaa2314d..d547684c1 100644 --- a/Scripts/Items/Guilds/Guildstone.cs +++ b/Scripts/Items/Guilds/Guildstone.cs @@ -60,7 +60,7 @@ namespace Server.Items { base.Serialize( writer ); - if( m_Guild != null && !m_Guild.Disbanded ) + if ( m_Guild != null && !m_Guild.Disbanded ) { m_GuildName = m_Guild.Name; m_GuildAbbrev = m_Guild.Abbreviation; @@ -109,16 +109,16 @@ namespace Server.Items } } - if( Guild.NewGuildSystem && ItemID == 0xED4 ) + if ( Guild.NewGuildSystem && ItemID == 0xED4 ) ItemID = 0xED6; - if( version <= 2 ) + if ( version <= 2 ) m_BeforeChangeover = true; - if( Guild.NewGuildSystem && m_BeforeChangeover ) + if ( Guild.NewGuildSystem && m_BeforeChangeover ) Timer.DelayCall( TimeSpan.Zero, new TimerCallback( AddToHouse ) ); - if( !Guild.NewGuildSystem && m_Guild == null ) + if ( !Guild.NewGuildSystem && m_Guild == null ) this.Delete(); } @@ -126,7 +126,7 @@ namespace Server.Items { BaseHouse house = BaseHouse.FindHouseAt( this ); - if( Guild.NewGuildSystem && m_BeforeChangeover && house != null && !house.Addons.Contains( this ) ) + if ( Guild.NewGuildSystem && m_BeforeChangeover && house != null && !house.Addons.Contains( this ) ) { house.Addons.Add( this ); m_BeforeChangeover = false; @@ -137,21 +137,21 @@ namespace Server.Items { base.GetProperties( list ); - if( m_Guild != null && !m_Guild.Disbanded ) + if ( m_Guild != null && !m_Guild.Disbanded ) { string name; string abbr; - if( (name = m_Guild.Name) == null || (name = name.Trim()).Length <= 0 ) + if ( (name = m_Guild.Name) == null || (name = name.Trim()).Length <= 0 ) name = "(unnamed)"; - if( (abbr = m_Guild.Abbreviation) == null || (abbr = abbr.Trim()).Length <= 0 ) + if ( (abbr = m_Guild.Abbreviation) == null || (abbr = abbr.Trim()).Length <= 0 ) abbr = ""; //list.Add( 1060802, Utility.FixHtml( name ) ); // Guild name: ~1_val~ list.Add( 1060802, String.Format( "{0} [{1}]", Utility.FixHtml( name ), Utility.FixHtml( abbr ) ) ); } - else if( m_GuildName != null && m_GuildAbbrev != null ) + else if ( m_GuildName != null && m_GuildAbbrev != null ) { list.Add( 1060802, String.Format( "{0} [{1}]", Utility.FixHtml( m_GuildName ), Utility.FixHtml( m_GuildAbbrev ) ) ); } @@ -161,16 +161,16 @@ namespace Server.Items { base.OnSingleClick( from ); - if( m_Guild != null && !m_Guild.Disbanded ) + if ( m_Guild != null && !m_Guild.Disbanded ) { string name; - if( (name = m_Guild.Name) == null || (name = name.Trim()).Length <= 0 ) + if ( (name = m_Guild.Name) == null || (name = name.Trim()).Length <= 0 ) name = "(unnamed)"; this.LabelTo( from, name ); } - else if( m_GuildName != null ) + else if ( m_GuildName != null ) { this.LabelTo( from, m_GuildName ); } @@ -178,24 +178,24 @@ namespace Server.Items public override void OnAfterDelete() { - if( !Guild.NewGuildSystem && m_Guild != null && !m_Guild.Disbanded ) + if ( !Guild.NewGuildSystem && m_Guild != null && !m_Guild.Disbanded ) m_Guild.Disband(); } public override void OnDoubleClick( Mobile from ) { - if( Guild.NewGuildSystem ) + if ( Guild.NewGuildSystem ) return; - if( m_Guild == null || m_Guild.Disbanded ) + if ( m_Guild == null || m_Guild.Disbanded ) { Delete(); } - else if( !from.InRange( GetWorldLocation(), 2 ) ) + else if ( !from.InRange( GetWorldLocation(), 2 ) ) { from.SendLocalizedMessage( 500446 ); // That is too far away. } - else if( m_Guild.Accepted.Contains( from ) ) + else if ( m_Guild.Accepted.Contains( from ) ) { #region Factions PlayerState guildState = PlayerState.Find( m_Guild.Leader ); @@ -204,10 +204,10 @@ namespace Server.Items Faction guildFaction = (guildState == null ? null : guildState.Faction); Faction targetFaction = (targetState == null ? null : targetState.Faction); - if( guildFaction != targetFaction || (targetState != null && targetState.IsLeaving) ) + if ( guildFaction != targetFaction || (targetState != null && targetState.IsLeaving) ) return; - if( guildState != null && targetState != null ) + if ( guildState != null && targetState != null ) targetState.Leaving = guildState.Leaving; #endregion @@ -217,7 +217,7 @@ namespace Server.Items GuildGump.EnsureClosed( from ); from.SendGump( new GuildGump( from, m_Guild ) ); } - else if( from.AccessLevel < AccessLevel.GameMaster && !m_Guild.IsMember( from ) ) + else if ( from.AccessLevel < AccessLevel.GameMaster && !m_Guild.IsMember( from ) ) { from.Send( new MessageLocalized( Serial, ItemID, MessageType.Regular, 0x3B2, 3, 501158, "", "" ) ); // You are not a member ... } @@ -245,24 +245,24 @@ namespace Server.Items public void OnChop( Mobile from ) { - if( !Guild.NewGuildSystem ) + if ( !Guild.NewGuildSystem ) return; BaseHouse house = BaseHouse.FindHouseAt( this ); - if( ( house == null && m_BeforeChangeover ) || ( house != null && house.IsOwner( from ) && house.Addons.Contains( this ) )) + if ( ( house == null && m_BeforeChangeover ) || ( house != null && house.IsOwner( from ) && house.Addons.Contains( this ) )) { Effects.PlaySound( GetWorldLocation(), Map, 0x3B3 ); from.SendLocalizedMessage( 500461 ); // You destroy the item. Delete(); - if( house != null && house.Addons.Contains( this ) ) + if ( house != null && house.Addons.Contains( this ) ) house.Addons.Remove( this ); Item deed = Deed; - if( deed != null ) + if ( deed != null ) { from.AddToBackpack( deed ); } @@ -331,7 +331,7 @@ namespace Server.Items { base.Serialize( writer ); - if( m_Guild != null && !m_Guild.Disbanded ) + if ( m_Guild != null && !m_Guild.Disbanded ) { m_GuildName = m_Guild.Name; m_GuildAbbrev = m_Guild.Abbreviation; @@ -369,21 +369,21 @@ namespace Server.Items { base.GetProperties( list ); - if( m_Guild != null && !m_Guild.Disbanded ) + if ( m_Guild != null && !m_Guild.Disbanded ) { string name; string abbr; - if( (name = m_Guild.Name) == null || (name = name.Trim()).Length <= 0 ) + if ( (name = m_Guild.Name) == null || (name = name.Trim()).Length <= 0 ) name = "(unnamed)"; - if( (abbr = m_Guild.Abbreviation) == null || (abbr = abbr.Trim()).Length <= 0 ) + if ( (abbr = m_Guild.Abbreviation) == null || (abbr = abbr.Trim()).Length <= 0 ) abbr = ""; //list.Add( 1060802, Utility.FixHtml( name ) ); // Guild name: ~1_val~ list.Add( 1060802, String.Format( "{0} [{1}]", Utility.FixHtml( name ), Utility.FixHtml( abbr ) ) ); } - else if( m_GuildName != null && m_GuildAbbrev != null ) + else if ( m_GuildName != null && m_GuildAbbrev != null ) { list.Add( 1060802, String.Format( "{0} [{1}]", Utility.FixHtml( m_GuildName ), Utility.FixHtml( m_GuildAbbrev ) ) ); } @@ -391,11 +391,11 @@ namespace Server.Items public override void OnDoubleClick( Mobile from ) { - if( IsChildOf( from.Backpack ) ) + if ( IsChildOf( from.Backpack ) ) { BaseHouse house = BaseHouse.FindHouseAt( from ); - if( house != null && house.IsOwner( from ) ) + if ( house != null && house.IsOwner( from ) ) { from.SendLocalizedMessage( 1062838 ); // Where would you like to place this decoration? from.BeginTarget( -1, true, Targeting.TargetFlags.None, new TargetStateCallback( Placement_OnTarget ), null ); @@ -415,16 +415,16 @@ namespace Server.Items { IPoint3D p = targeted as IPoint3D; - if( p == null || Deleted ) + if ( p == null || Deleted ) return; Point3D loc = new Point3D( p ); BaseHouse house = BaseHouse.FindHouseAt( loc, from.Map, 16 ); - if( IsChildOf( from.Backpack ) ) + if ( IsChildOf( from.Backpack ) ) { - if( house != null && house.IsOwner( from ) ) + if ( house != null && house.IsOwner( from ) ) { Item addon = new Guildstone( m_Guild, m_GuildName, m_GuildAbbrev ); diff --git a/Scripts/Items/Minor Artifacts/CaptainQuacklebushsCutlass.cs b/Scripts/Items/Minor Artifacts/CaptainQuacklebushsCutlass.cs index 420c8e59d..8bd36bb23 100644 --- a/Scripts/Items/Minor Artifacts/CaptainQuacklebushsCutlass.cs +++ b/Scripts/Items/Minor Artifacts/CaptainQuacklebushsCutlass.cs @@ -38,7 +38,7 @@ namespace Server.Items int version = reader.ReadInt(); - if( Attributes.AttackChance == 50 ) + if ( Attributes.AttackChance == 50 ) Attributes.AttackChance = 10; } } diff --git a/Scripts/Items/Minor Artifacts/GhostShipAnchor.cs b/Scripts/Items/Minor Artifacts/GhostShipAnchor.cs index 8af480e28..92ef95192 100644 --- a/Scripts/Items/Minor Artifacts/GhostShipAnchor.cs +++ b/Scripts/Items/Minor Artifacts/GhostShipAnchor.cs @@ -30,7 +30,7 @@ namespace Server.Items int version = reader.ReadInt(); - if( ItemID == 0x1F47 ) + if ( ItemID == 0x1F47 ) ItemID = 0x14F7; } } diff --git a/Scripts/Items/Misc/AcidSlime.cs b/Scripts/Items/Misc/AcidSlime.cs index 172289e68..683b0f781 100644 --- a/Scripts/Items/Misc/AcidSlime.cs +++ b/Scripts/Items/Misc/AcidSlime.cs @@ -38,7 +38,7 @@ namespace Server.Items public override void OnAfterDelete() { - if( m_Timer != null ) + if ( m_Timer != null ) m_Timer.Stop(); } @@ -47,10 +47,10 @@ namespace Server.Items DateTime now = DateTime.UtcNow; TimeSpan age = now - m_Created; - if( age > m_Duration ) { + if ( age > m_Duration ) { Delete(); } else { - if( !m_Drying && age > (m_Duration - age) ) + if ( !m_Drying && age > (m_Duration - age) ) { m_Drying = true; ItemID = 0x122B; @@ -61,7 +61,7 @@ namespace Server.Items foreach( Mobile m in GetMobilesInRange( 0 ) ) { BaseCreature bc = m as BaseCreature; - if( m.Alive && !m.IsDeadBondedPet && (bc == null || bc.Controlled || bc.Summoned) ) + if ( m.Alive && !m.IsDeadBondedPet && (bc == null || bc.Controlled || bc.Summoned) ) { toDamage.Add( m ); } diff --git a/Scripts/Items/Misc/ArcaneGem.cs b/Scripts/Items/Misc/ArcaneGem.cs index d6aee9563..adcec6b4e 100644 --- a/Scripts/Items/Misc/ArcaneGem.cs +++ b/Scripts/Items/Misc/ArcaneGem.cs @@ -64,11 +64,11 @@ namespace Server.Items Item item = (Item)obj; CraftResource resource = CraftResource.None; - if( item is BaseClothing ) + if ( item is BaseClothing ) resource = ((BaseClothing)item).Resource; - else if( item is BaseArmor ) + else if ( item is BaseArmor ) resource = ((BaseArmor)item).Resource; - else if( item is BaseWeapon ) // Sanity, weapons cannot receive gems... + else if ( item is BaseWeapon ) // Sanity, weapons cannot receive gems... resource = ((BaseWeapon)item).Resource; IArcaneEquip eq = (IArcaneEquip)obj; diff --git a/Scripts/Items/Misc/Corpses/Corpse.cs b/Scripts/Items/Misc/Corpses/Corpse.cs index 4d723c55e..06f4e53ef 100644 --- a/Scripts/Items/Misc/Corpses/Corpse.cs +++ b/Scripts/Items/Misc/Corpses/Corpse.cs @@ -458,7 +458,7 @@ namespace Server.Items // shouldFillCorpse = !((BaseCreature)owner).IsBonded; Corpse c; - if( owner is MilitiaFighter ) + if ( owner is MilitiaFighter ) c = new MilitiaFighterCorpse( owner, hair, facialhair, shouldFillCorpse ? equipItems : new List() ); else c = new Corpse( owner, hair, facialhair, shouldFillCorpse ? equipItems : new List() ); @@ -591,7 +591,7 @@ namespace Server.Items BaseCreature bc = (BaseCreature)owner; Mobile master = bc.GetMaster(); - if( master != null ) + if ( master != null ) m_Aggressors.Add( master ); List rights = BaseCreature.GetLootingRights( bc.DamageEntries, bc.HitsMax ); @@ -716,13 +716,13 @@ namespace Server.Items { Item item = reader.ReadItem(); - if( reader.ReadBool() ) + if ( reader.ReadBool() ) SetRestoreInfo( item, reader.ReadPoint3D() ); - else if( item != null ) + else if ( item != null ) SetRestoreInfo( item, item.Location ); } - if( reader.ReadBool() ) + if ( reader.ReadBool() ) BeginDecay( reader.ReadDeltaTime() - DateTime.UtcNow ); m_Looters = reader.ReadStrongMobileList(); @@ -840,7 +840,7 @@ namespace Server.Items public bool DevourCorpse() { - if( Devoured || Deleted || m_Killer == null || m_Killer.Deleted || !m_Killer.Alive || !(m_Killer is IDevourer) || m_Owner == null || m_Owner.Deleted ) + if ( Devoured || Deleted || m_Killer == null || m_Killer.Deleted || !m_Killer.Alive || !(m_Killer is IDevourer) || m_Owner == null || m_Owner.Deleted ) return false; m_Devourer = (IDevourer)m_Killer; // Set the devourer the killer diff --git a/Scripts/Items/Misc/Corpses/Packets.cs b/Scripts/Items/Misc/Corpses/Packets.cs index b031d0ce7..897e3911e 100644 --- a/Scripts/Items/Misc/Corpses/Packets.cs +++ b/Scripts/Items/Misc/Corpses/Packets.cs @@ -14,9 +14,9 @@ namespace Server.Network List list = beheld.EquipItems; int count = list.Count; - if( beheld.Hair != null && beheld.Hair.ItemID > 0 ) + if ( beheld.Hair != null && beheld.Hair.ItemID > 0 ) count++; - if( beheld.FacialHair != null && beheld.FacialHair.ItemID > 0 ) + if ( beheld.FacialHair != null && beheld.FacialHair.ItemID > 0 ) count++; EnsureCapacity( 8 + (count * 5) ); @@ -34,13 +34,13 @@ namespace Server.Network } } - if( beheld.Hair != null && beheld.Hair.ItemID > 0 ) + if ( beheld.Hair != null && beheld.Hair.ItemID > 0 ) { m_Stream.Write( (byte)(Layer.Hair + 1) ); m_Stream.Write( (int)HairInfo.FakeSerial( beheld.Owner ) - 2 ); } - if( beheld.FacialHair != null && beheld.FacialHair.ItemID > 0 ) + if ( beheld.FacialHair != null && beheld.FacialHair.ItemID > 0 ) { m_Stream.Write( (byte)(Layer.FacialHair + 1) ); m_Stream.Write( (int)FacialHairInfo.FakeSerial( beheld.Owner ) - 2 ); @@ -58,9 +58,9 @@ namespace Server.Network List items = beheld.EquipItems; int count = items.Count; - if( beheld.Hair != null && beheld.Hair.ItemID > 0 ) + if ( beheld.Hair != null && beheld.Hair.ItemID > 0 ) count++; - if( beheld.FacialHair != null && beheld.FacialHair.ItemID > 0 ) + if ( beheld.FacialHair != null && beheld.FacialHair.ItemID > 0 ) count++; EnsureCapacity( 5 + (count * 19) ); @@ -75,7 +75,7 @@ namespace Server.Network { Item child = items[i]; - if( !child.Deleted && child.Parent == beheld && beholder.CanSee( child ) ) + if ( !child.Deleted && child.Parent == beheld && beholder.CanSee( child ) ) { m_Stream.Write( (int)child.Serial ); m_Stream.Write( (ushort)child.ItemID ); @@ -90,7 +90,7 @@ namespace Server.Network } } - if( beheld.Hair != null && beheld.Hair.ItemID > 0 ) + if ( beheld.Hair != null && beheld.Hair.ItemID > 0 ) { m_Stream.Write( (int)HairInfo.FakeSerial( beheld.Owner ) - 2 ); m_Stream.Write( (ushort)beheld.Hair.ItemID ); @@ -104,7 +104,7 @@ namespace Server.Network ++written; } - if( beheld.FacialHair != null && beheld.FacialHair.ItemID > 0 ) + if ( beheld.FacialHair != null && beheld.FacialHair.ItemID > 0 ) { m_Stream.Write( (int)FacialHairInfo.FakeSerial( beheld.Owner ) - 2 ); m_Stream.Write( (ushort)beheld.FacialHair.ItemID ); @@ -198,4 +198,4 @@ namespace Server.Network m_Stream.Write((ushort)written); } } -} \ No newline at end of file +} diff --git a/Scripts/Items/Misc/DeceitBrazier.cs b/Scripts/Items/Misc/DeceitBrazier.cs index 53edabd44..373d986b1 100644 --- a/Scripts/Items/Misc/DeceitBrazier.cs +++ b/Scripts/Items/Misc/DeceitBrazier.cs @@ -116,7 +116,7 @@ namespace Server.Items int version = reader.ReadInt(); - if( version >= 0 ) + if ( version >= 0 ) { m_SpawnRange = reader.ReadInt(); m_NextSpawnDelay = reader.ReadTimeSpan(); @@ -134,11 +134,11 @@ namespace Server.Items public override void OnMovement( Mobile m, Point3D oldLocation ) { - if( m_NextSpawn < DateTime.UtcNow ) // means we haven't spawned anything if the next spawn is below + if ( m_NextSpawn < DateTime.UtcNow ) // means we haven't spawned anything if the next spawn is below { - if( Utility.InRange( m.Location, Location, 1 ) && !Utility.InRange( oldLocation, Location, 1 ) && m.Player && !(m.AccessLevel > AccessLevel.Player || m.Hidden) ) + if ( Utility.InRange( m.Location, Location, 1 ) && !Utility.InRange( oldLocation, Location, 1 ) && m.Player && !(m.AccessLevel > AccessLevel.Player || m.Hidden) ) { - if( m_Timer == null || !m_Timer.Running ) + if ( m_Timer == null || !m_Timer.Running ) m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 2 ), new TimerCallback( HeedWarning ) ); } } @@ -150,7 +150,7 @@ namespace Server.Items { Map map = Map; - if( map == null ) + if ( map == null ) return Location; // Try 10 times to find a Spawnable location. @@ -160,9 +160,9 @@ namespace Server.Items int y = Location.Y + (Utility.Random( (m_SpawnRange * 2) + 1 ) - m_SpawnRange); int z = Map.GetAverageZ( x, y ); - if( Map.CanSpawnMobile( new Point2D( x, y ), this.Z ) ) + if ( Map.CanSpawnMobile( new Point2D( x, y ), this.Z ) ) return new Point3D( x, y, this.Z ); - else if( Map.CanSpawnMobile( new Point2D( x, y ), z ) ) + else if ( Map.CanSpawnMobile( new Point2D( x, y ), z ) ) return new Point3D( x, y, z ); } @@ -177,22 +177,22 @@ namespace Server.Items public override void OnDoubleClick( Mobile from ) { - if( Utility.InRange( from.Location, Location, 2 ) ) + if ( Utility.InRange( from.Location, Location, 2 ) ) { try { - if( m_NextSpawn < DateTime.UtcNow ) + if ( m_NextSpawn < DateTime.UtcNow ) { Map map = this.Map; BaseCreature bc = (BaseCreature)Activator.CreateInstance( m_Creatures[Utility.Random( m_Creatures.Length )] ); - if( bc != null ) + if ( bc != null ) { Point3D spawnLoc = GetSpawnPosition(); DoEffect( spawnLoc, map ); - Timer.DelayCall( TimeSpan.FromSeconds( 1 ), delegate() + Timer.DelayCall( TimeSpan.FromSeconds( 1 ), delegate { bc.Home = Location; bc.RangeHome = m_SpawnRange; diff --git a/Scripts/Items/Misc/FlippableAttribute.cs b/Scripts/Items/Misc/FlippableAttribute.cs index 87e4d5b1f..273238be6 100644 --- a/Scripts/Items/Misc/FlippableAttribute.cs +++ b/Scripts/Items/Misc/FlippableAttribute.cs @@ -29,18 +29,18 @@ namespace Server.Items protected override void OnTarget( Mobile from, object targeted ) { - if( targeted is Item ) + if ( targeted is Item ) { Item item = (Item)targeted; - if( item.Movable == false && from.AccessLevel == AccessLevel.Player ) + if ( item.Movable == false && from.AccessLevel == AccessLevel.Player ) return; Type type = targeted.GetType(); FlippableAttribute[] AttributeArray = (FlippableAttribute[])type.GetCustomAttributes( typeof( FlippableAttribute ), false ); - if( AttributeArray.Length == 0 ) + if ( AttributeArray.Length == 0 ) { return; } @@ -83,12 +83,12 @@ namespace Server.Items public virtual void Flip( Item item ) { - if( m_ItemIDs == null ) + if ( m_ItemIDs == null ) { try { MethodInfo flipMethod = item.GetType().GetMethod( "Flip", Type.EmptyTypes ); - if( flipMethod != null ) + if ( flipMethod != null ) flipMethod.Invoke( item, new object[0] ); } catch @@ -101,14 +101,14 @@ namespace Server.Items int index = 0; for( int i = 0; i < m_ItemIDs.Length; i++ ) { - if( item.ItemID == m_ItemIDs[i] ) + if ( item.ItemID == m_ItemIDs[i] ) { index = i + 1; break; } } - if( index > m_ItemIDs.Length - 1 ) + if ( index > m_ItemIDs.Length - 1 ) index = 0; item.ItemID = m_ItemIDs[index]; diff --git a/Scripts/Items/Misc/HairDye.cs b/Scripts/Items/Misc/HairDye.cs index 3cd725446..5d76a33f6 100644 --- a/Scripts/Items/Misc/HairDye.cs +++ b/Scripts/Items/Misc/HairDye.cs @@ -155,7 +155,7 @@ namespace Server.Items if ( info.ButtonID != 0 && switches.Length > 0 ) { - if( m.HairItemID == 0 && m.FacialHairItemID == 0 ) + if ( m.HairItemID == 0 && m.FacialHairItemID == 0 ) { m.SendLocalizedMessage( 502623 ); // You have no hair to dye and cannot use this } diff --git a/Scripts/Items/Misc/Origami.cs b/Scripts/Items/Misc/Origami.cs index 0c692a94e..6ca32760a 100644 --- a/Scripts/Items/Misc/Origami.cs +++ b/Scripts/Items/Misc/Origami.cs @@ -39,7 +39,7 @@ namespace Server.Items case 5: i = new OrigamiFish(); break; } - if( i != null ) + if ( i != null ) from.AddToBackpack( i ); from.SendLocalizedMessage( 1070822 ); // You fold the paper into an interesting shape. diff --git a/Scripts/Items/Misc/PoolOfAcid.cs b/Scripts/Items/Misc/PoolOfAcid.cs index 789543de0..c861f4126 100644 --- a/Scripts/Items/Misc/PoolOfAcid.cs +++ b/Scripts/Items/Misc/PoolOfAcid.cs @@ -40,7 +40,7 @@ namespace Server.Items public override void OnAfterDelete() { - if( m_Timer != null ) + if ( m_Timer != null ) m_Timer.Stop(); } @@ -49,10 +49,10 @@ namespace Server.Items DateTime now = DateTime.UtcNow; TimeSpan age = now - m_Created; - if( age > m_Duration ) { + if ( age > m_Duration ) { Delete(); } else { - if( !m_Drying && age > (m_Duration - age) ) + if ( !m_Drying && age > (m_Duration - age) ) { m_Drying = true; ItemID = 0x122B; @@ -64,7 +64,7 @@ namespace Server.Items { BaseCreature bc = m as BaseCreature; - if( m.Alive && !m.IsDeadBondedPet && (bc == null || bc.Controlled || bc.Summoned) ) + if ( m.Alive && !m.IsDeadBondedPet && (bc == null || bc.Controlled || bc.Summoned) ) { toDamage.Add( m ); } diff --git a/Scripts/Items/Misc/PromotionalToken.cs b/Scripts/Items/Misc/PromotionalToken.cs index 1e13914f5..8cbf69379 100644 --- a/Scripts/Items/Misc/PromotionalToken.cs +++ b/Scripts/Items/Misc/PromotionalToken.cs @@ -33,7 +33,7 @@ namespace Server.Items public override void OnDoubleClick( Mobile from ) { - if( !IsChildOf( from.Backpack ) ) + if ( !IsChildOf( from.Backpack ) ) { from.SendLocalizedMessage( 1062334 ); // This item must be in your backpack to be used. } @@ -48,12 +48,12 @@ namespace Server.Items { Mobile m = null; - if( parent is Item ) + if ( parent is Item ) m = ((Item)parent).RootParent as Mobile; - else if( parent is Mobile ) + else if ( parent is Mobile ) m = (Mobile)parent; - if( m != null ) + if ( m != null ) m.CloseGump( typeof( PromotionalTokenGump ) ); } @@ -94,12 +94,12 @@ namespace Server.Items public override void OnResponse( NetState sender, RelayInfo info ) { - if( info.ButtonID != 1 ) + if ( info.ButtonID != 1 ) return; Mobile from = sender.Mobile; - if( !m_Token.IsChildOf( from.Backpack ) ) + if ( !m_Token.IsChildOf( from.Backpack ) ) { from.SendLocalizedMessage( 1062334 ); // This item must be in your backpack to be used. } @@ -107,7 +107,7 @@ namespace Server.Items { Item i = m_Token.CreateItemFor( from ); - if( i != null ) + if ( i != null ) { from.BankBox.AddItem( i ); TextDefinition.SendMessageTo( from, m_Token.ItemReceiveMessage ); @@ -123,7 +123,7 @@ namespace Server.Items public override Item CreateItemFor( Mobile from ) { - if( from != null && from.Account != null ) + if ( from != null && from.Account != null ) return new SoulstoneFragment( from.Account.ToString() ); else return null; diff --git a/Scripts/Items/Misc/SpecialBeardDye.cs b/Scripts/Items/Misc/SpecialBeardDye.cs index 3af6707e3..b73c5927d 100644 --- a/Scripts/Items/Misc/SpecialBeardDye.cs +++ b/Scripts/Items/Misc/SpecialBeardDye.cs @@ -149,7 +149,7 @@ namespace Server.Items if ( info.ButtonID != 0 && switches.Length > 0 ) { - if( m.FacialHairItemID == 0 ) + if ( m.FacialHairItemID == 0 ) { m.SendLocalizedMessage( 502623 ); // You have no hair to dye and cannot use this } diff --git a/Scripts/Items/Misc/SpecialHairDye.cs b/Scripts/Items/Misc/SpecialHairDye.cs index cfc0ec677..9d0959c9d 100644 --- a/Scripts/Items/Misc/SpecialHairDye.cs +++ b/Scripts/Items/Misc/SpecialHairDye.cs @@ -47,8 +47,8 @@ namespace Server.Items else { from.LocalOverheadMessage( MessageType.Regular, 906, 1019045 ); // I can't reach that. - } - + } + } } @@ -145,7 +145,7 @@ namespace Server.Items Mobile m = from.Mobile; int[] switches = info.Switches; - if ( !m_SpecialHairDye.IsChildOf( m.Backpack ) ) + if ( !m_SpecialHairDye.IsChildOf( m.Backpack ) ) { m.SendLocalizedMessage( 1042010 ); //You must have the objectin your backpack to use it. return; @@ -153,7 +153,7 @@ namespace Server.Items if ( info.ButtonID != 0 && switches.Length > 0 ) { - if( m.HairItemID == 0 ) + if ( m.HairItemID == 0 ) { m.SendLocalizedMessage( 502623 ); // You have no hair to dye and cannot use this } @@ -175,7 +175,7 @@ namespace Server.Items int hue = e.HueStart + hueOffset; m.HairHue = hue; - + m.SendLocalizedMessage( 501199 ); // You dye your hair m.PlaySound( 0x4E ); } @@ -188,4 +188,4 @@ namespace Server.Items } } } -} \ No newline at end of file +} diff --git a/Scripts/Items/Misc/TribalPaint.cs b/Scripts/Items/Misc/TribalPaint.cs index 69764c824..cd27d52bb 100644 --- a/Scripts/Items/Misc/TribalPaint.cs +++ b/Scripts/Items/Misc/TribalPaint.cs @@ -37,7 +37,7 @@ namespace Server.Items { from.SendLocalizedMessage( 501699 ); // You cannot disguise yourself while polymorphed. } - else if( TransformationSpellHelper.UnderTransformation( from ) ) + else if ( TransformationSpellHelper.UnderTransformation( from ) ) { from.SendLocalizedMessage( 501699 ); // You cannot disguise yourself while polymorphed. } diff --git a/Scripts/Items/Resources/MiscMLResources.cs b/Scripts/Items/Resources/MiscMLResources.cs index 33a0c64b9..b0c0f05e7 100644 --- a/Scripts/Items/Resources/MiscMLResources.cs +++ b/Scripts/Items/Resources/MiscMLResources.cs @@ -453,7 +453,7 @@ namespace Server.Items int version = reader.ReadInt(); - if( version <= 0 && ItemID == 0x318F ) + if ( version <= 0 && ItemID == 0x318F ) ItemID = 0x318C; } } @@ -981,7 +981,7 @@ namespace Server.Items public PristineDreadHorn() : base( 0x315A ) { - + } public PristineDreadHorn( Serial serial ) diff --git a/Scripts/Items/Shields/BaseShield.cs b/Scripts/Items/Shields/BaseShield.cs index bd5db7cc3..2c9047d1a 100644 --- a/Scripts/Items/Shields/BaseShield.cs +++ b/Scripts/Items/Shields/BaseShield.cs @@ -60,9 +60,9 @@ namespace Server.Items public override int OnHit( BaseWeapon weapon, int damage ) { - if( Core.AOS ) + if ( Core.AOS ) { - if( ArmorAttributes.SelfRepair > Utility.Random( 10 ) ) + if ( ArmorAttributes.SelfRepair > Utility.Random( 10 ) ) { HitPoints += 2; } @@ -71,19 +71,19 @@ namespace Server.Items double halfArmor = ArmorRating / 2.0; int absorbed = (int)(halfArmor + (halfArmor*Utility.RandomDouble())); - if( absorbed < 2 ) + if ( absorbed < 2 ) absorbed = 2; int wear; - if( weapon.Type == WeaponType.Bashing ) + if ( weapon.Type == WeaponType.Bashing ) wear = (absorbed / 2); else wear = Utility.Random( 2 ); - if( wear > 0 && MaxHitPoints > 0 ) + if ( wear > 0 && MaxHitPoints > 0 ) { - if( HitPoints >= wear ) + if ( HitPoints >= wear ) { HitPoints -= wear; wear = 0; @@ -94,13 +94,13 @@ namespace Server.Items HitPoints = 0; } - if( wear > 0 ) + if ( wear > 0 ) { - if( MaxHitPoints > wear ) + if ( MaxHitPoints > wear ) { MaxHitPoints -= wear; - if( Parent is Mobile ) + if ( Parent is Mobile ) ((Mobile)Parent).LocalOverheadMessage( MessageType.Regular, 0x3B2, 1061121 ); // Your equipment is severely damaged. } else @@ -116,13 +116,13 @@ namespace Server.Items else { Mobile owner = this.Parent as Mobile; - if( owner == null ) + if ( owner == null ) return damage; double ar = this.ArmorRating; double chance = (owner.Skills[SkillName.Parry].Value - (ar * 2.0)) / 100.0; - if( chance < 0.01 ) + if ( chance < 0.01 ) chance = 0.01; /* FORMULA: Displayed AR = ((Parrying Skill * Base AR of Shield) � 200) + 1 @@ -131,25 +131,25 @@ namespace Server.Items FORMULA: Melee Damage Absorbed = (AR of Shield) / 2 | Archery Damage Absorbed = AR of Shield */ - if( owner.CheckSkill( SkillName.Parry, chance ) ) + if ( owner.CheckSkill( SkillName.Parry, chance ) ) { - if( weapon.Skill == SkillName.Archery ) + if ( weapon.Skill == SkillName.Archery ) damage -= (int)ar; else damage -= (int)(ar / 2.0); - if( damage < 0 ) + if ( damage < 0 ) damage = 0; owner.FixedEffect( 0x37B9, 10, 16 ); - if( 25 > Utility.Random( 100 ) ) // 25% chance to lower durability + if ( 25 > Utility.Random( 100 ) ) // 25% chance to lower durability { int wear = Utility.Random( 2 ); - if( wear > 0 && MaxHitPoints > 0 ) + if ( wear > 0 && MaxHitPoints > 0 ) { - if( HitPoints >= wear ) + if ( HitPoints >= wear ) { HitPoints -= wear; wear = 0; @@ -160,13 +160,13 @@ namespace Server.Items HitPoints = 0; } - if( wear > 0 ) + if ( wear > 0 ) { - if( MaxHitPoints > wear ) + if ( MaxHitPoints > wear ) { MaxHitPoints -= wear; - if( Parent is Mobile ) + if ( Parent is Mobile ) ((Mobile)Parent).LocalOverheadMessage( MessageType.Regular, 0x3B2, 1061121 ); // Your equipment is severely damaged. } else diff --git a/Scripts/Items/Skill Items/Fishing/Misc/MessageInABottle.cs b/Scripts/Items/Skill Items/Fishing/Misc/MessageInABottle.cs index 53602f50e..306a7f79f 100644 --- a/Scripts/Items/Skill Items/Fishing/Misc/MessageInABottle.cs +++ b/Scripts/Items/Skill Items/Fishing/Misc/MessageInABottle.cs @@ -94,7 +94,7 @@ namespace Server.Items if ( version < 2 ) m_Level = GetRandomLevel(); - if( version < 3 && m_TargetMap == Map.Tokuno ) + if ( version < 3 && m_TargetMap == Map.Tokuno ) m_TargetMap = Map.Trammel; } diff --git a/Scripts/Items/Skill Items/Fishing/Misc/SOS.cs b/Scripts/Items/Skill Items/Fishing/Misc/SOS.cs index 83cbda359..cd6b67ed8 100644 --- a/Scripts/Items/Skill Items/Fishing/Misc/SOS.cs +++ b/Scripts/Items/Skill Items/Fishing/Misc/SOS.cs @@ -153,10 +153,10 @@ namespace Server.Items if ( version < 3 ) UpdateHue(); - if( version < 4 && m_TargetMap == Map.Tokuno ) + if ( version < 4 && m_TargetMap == Map.Tokuno ) m_TargetMap = Map.Trammel; } - + public override void OnDoubleClick( Mobile from ) { if ( IsChildOf( from.Backpack ) ) @@ -338,4 +338,4 @@ namespace Server.Items } } } -} \ No newline at end of file +} diff --git a/Scripts/Items/Skill Items/Magical/BookOfBushido.cs b/Scripts/Items/Skill Items/Magical/BookOfBushido.cs index 84c9982f1..065ea7b8b 100644 --- a/Scripts/Items/Skill Items/Magical/BookOfBushido.cs +++ b/Scripts/Items/Skill Items/Magical/BookOfBushido.cs @@ -38,7 +38,7 @@ namespace Server.Items int version = reader.ReadInt(); - if( version == 0 && Core.ML ) + if ( version == 0 && Core.ML ) Layer = Layer.OneHanded; } } diff --git a/Scripts/Items/Skill Items/Magical/BookOfChivalry.cs b/Scripts/Items/Skill Items/Magical/BookOfChivalry.cs index 62636f4ad..7f933178a 100644 --- a/Scripts/Items/Skill Items/Magical/BookOfChivalry.cs +++ b/Scripts/Items/Skill Items/Magical/BookOfChivalry.cs @@ -38,7 +38,7 @@ namespace Server.Items int version = reader.ReadInt(); - if( version == 0 && Core.ML ) + if ( version == 0 && Core.ML ) Layer = Layer.OneHanded; } } diff --git a/Scripts/Items/Skill Items/Magical/BookOfNinjitsu.cs b/Scripts/Items/Skill Items/Magical/BookOfNinjitsu.cs index c4b24fad9..a37c911e2 100644 --- a/Scripts/Items/Skill Items/Magical/BookOfNinjitsu.cs +++ b/Scripts/Items/Skill Items/Magical/BookOfNinjitsu.cs @@ -39,7 +39,7 @@ namespace Server.Items int version = reader.ReadInt(); - if( version == 0 && Core.ML ) + if ( version == 0 && Core.ML ) Layer = Layer.OneHanded; } } diff --git a/Scripts/Items/Skill Items/Magical/Misc/PotionKeg.cs b/Scripts/Items/Skill Items/Magical/Misc/PotionKeg.cs index 67b8a37fc..43d58a34f 100644 --- a/Scripts/Items/Skill Items/Magical/Misc/PotionKeg.cs +++ b/Scripts/Items/Skill Items/Magical/Misc/PotionKeg.cs @@ -91,16 +91,16 @@ namespace Server.Items } public override int LabelNumber - { + { get { - if( m_Held > 0 && ( int )m_Type >= ( int )PotionEffect.Conflagration ) + if ( m_Held > 0 && ( int )m_Type >= ( int )PotionEffect.Conflagration ) { return 1072658 + ( int )m_Type - ( int )PotionEffect.Conflagration; } - return (m_Held > 0 ? 1041620 + (int)m_Type : 1041641); - } + return (m_Held > 0 ? 1041620 + (int)m_Type : 1041641); + } } public override void GetProperties( ObjectPropertyList list ) @@ -248,7 +248,7 @@ namespace Server.Items item.Consume( toHold ); - if( !item.Deleted ) + if ( !item.Deleted ) item.Bounce( from ); return true; @@ -276,7 +276,7 @@ namespace Server.Items item.Consume( toHold ); - if( !item.Deleted ) + if ( !item.Deleted ) item.Bounce( from ); return true; @@ -342,7 +342,7 @@ namespace Server.Items case PotionEffect.ExplosionLesser: return new LesserExplosionPotion(); case PotionEffect.Explosion: return new ExplosionPotion(); case PotionEffect.ExplosionGreater: return new GreaterExplosionPotion(); - + case PotionEffect.Conflagration: return new ConflagrationPotion(); case PotionEffect.ConflagrationGreater: return new GreaterConflagrationPotion(); @@ -356,4 +356,4 @@ namespace Server.Items TileData.ItemTable[0x1940].Height = 4; } } -} \ No newline at end of file +} diff --git a/Scripts/Items/Skill Items/Magical/Misc/RecallRune.cs b/Scripts/Items/Skill Items/Magical/Misc/RecallRune.cs index 9f9d9a676..929f8128f 100644 --- a/Scripts/Items/Skill Items/Magical/Misc/RecallRune.cs +++ b/Scripts/Items/Skill Items/Magical/Misc/RecallRune.cs @@ -203,7 +203,7 @@ namespace Server.Items m_TargetMap = m.Map; } - if( !setDesc ) + if ( !setDesc ) m_Description = BaseRegion.GetRuneNameFor( Region.Find( m_Target, m_TargetMap ) ); CalculateHue(); @@ -318,4 +318,4 @@ namespace Server.Items { } } -} \ No newline at end of file +} diff --git a/Scripts/Items/Skill Items/Magical/NecromancerSpellbook.cs b/Scripts/Items/Skill Items/Magical/NecromancerSpellbook.cs index d29c7e695..deec6672d 100644 --- a/Scripts/Items/Skill Items/Magical/NecromancerSpellbook.cs +++ b/Scripts/Items/Skill Items/Magical/NecromancerSpellbook.cs @@ -38,7 +38,7 @@ namespace Server.Items int version = reader.ReadInt(); - if( version == 0 && Core.ML ) + if ( version == 0 && Core.ML ) Layer = Layer.OneHanded; } } diff --git a/Scripts/Items/Skill Items/Magical/Potions/BasePotion.cs b/Scripts/Items/Skill Items/Magical/Potions/BasePotion.cs index 5a06650b7..22c2d1f6f 100644 --- a/Scripts/Items/Skill Items/Magical/Potions/BasePotion.cs +++ b/Scripts/Items/Skill Items/Magical/Potions/BasePotion.cs @@ -161,7 +161,7 @@ namespace Server.Items } } - if( version == 0 ) + if ( version == 0 ) Stackable = Core.ML; } @@ -223,7 +223,7 @@ namespace Server.Items public override bool StackWith( Mobile from, Item dropped, bool playSound ) { - if( dropped is BasePotion && ((BasePotion)dropped).m_PotionEffect == m_PotionEffect ) + if ( dropped is BasePotion && ((BasePotion)dropped).m_PotionEffect == m_PotionEffect ) return base.StackWith( from, dropped, playSound ); return false; diff --git a/Scripts/Items/Skill Items/Magical/Potions/Conflagration Potions/BaseConflagrationPotion.cs b/Scripts/Items/Skill Items/Magical/Potions/Conflagration Potions/BaseConflagrationPotion.cs index 421436f9e..82c5aec5a 100644 --- a/Scripts/Items/Skill Items/Magical/Potions/Conflagration Potions/BaseConflagrationPotion.cs +++ b/Scripts/Items/Skill Items/Magical/Potions/Conflagration Potions/BaseConflagrationPotion.cs @@ -242,7 +242,7 @@ namespace Server.Items m_MinDamage = min; m_MaxDamage = max; - if( m_From == null ) + if ( m_From == null ) return; int alchemySkill = m_From.Skills.Alchemy.Fixed; diff --git a/Scripts/Items/Skill Items/Magical/Potions/Explosion Potions/BaseExplosionPotion.cs b/Scripts/Items/Skill Items/Magical/Potions/Explosion Potions/BaseExplosionPotion.cs index e9c73725f..c478fb586 100644 --- a/Scripts/Items/Skill Items/Magical/Potions/Explosion Potions/BaseExplosionPotion.cs +++ b/Scripts/Items/Skill Items/Magical/Potions/Explosion Potions/BaseExplosionPotion.cs @@ -94,7 +94,7 @@ namespace Server.Items { from.SendLocalizedMessage( 500236 ); // You should throw it now! - if( Core.ML ) + if ( Core.ML ) m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), TimeSpan.FromSeconds( 1.25 ), 5, new TimerStateCallback( Detonate_OnTick ), new object[]{ from, 3 } ); // 3.6 seconds explosion delay else m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 0.75 ), TimeSpan.FromSeconds( 1.0 ), 4, new TimerStateCallback( Detonate_OnTick ), new object[]{ from, 3 } ); // 2.6 seconds explosion delay @@ -205,9 +205,9 @@ namespace Server.Items to = new Entity( Serial.Zero, new Point3D( p ), map ); - if( p is Mobile ) + if ( p is Mobile ) { - if( !RelativeLocation ) // explosion location = current mob location. + if ( !RelativeLocation ) // explosion location = current mob location. p = ((Mobile)p).Location; else to = (Mobile)p; @@ -215,7 +215,7 @@ namespace Server.Items Effects.SendMovingEffect( from, to, m_Potion.ItemID, 7, 0, false, false, m_Potion.Hue, 0 ); - if( m_Potion.Amount > 1 ) + if ( m_Potion.Amount > 1 ) { Mobile.LiftItemDupe( m_Potion, 1 ); } diff --git a/Scripts/Items/Skill Items/Magical/Runebook.cs b/Scripts/Items/Skill Items/Magical/Runebook.cs index a1db5bdd3..c2db026cf 100644 --- a/Scripts/Items/Skill Items/Magical/Runebook.cs +++ b/Scripts/Items/Skill Items/Magical/Runebook.cs @@ -203,7 +203,7 @@ namespace Server.Items LootType = LootType.Blessed; - if( Core.SE && Weight == 3.0 ) + if ( Core.SE && Weight == 3.0 ) Weight = 1.0; int version = reader.ReadInt(); diff --git a/Scripts/Items/Skill Items/Magical/Spellbook.cs b/Scripts/Items/Skill Items/Magical/Spellbook.cs index 69c5ab642..f631aacf2 100644 --- a/Scripts/Items/Skill Items/Magical/Spellbook.cs +++ b/Scripts/Items/Skill Items/Magical/Spellbook.cs @@ -158,9 +158,9 @@ namespace Server.Items return SpellbookType.Necromancer; else if ( spellID >= 200 && spellID < 210 ) return SpellbookType.Paladin; - else if( spellID >= 400 && spellID < 406 ) + else if ( spellID >= 400 && spellID < 406 ) return SpellbookType.Samurai; - else if( spellID >= 500 && spellID < 508 ) + else if ( spellID >= 500 && spellID < 508 ) return SpellbookType.Ninja; else if ( spellID >= 600 && spellID < 617 ) return SpellbookType.Arcanist; @@ -597,17 +597,17 @@ namespace Server.Items m_AosSkillBonuses.GetProperties( list ); - if( m_Slayer != SlayerName.None ) + if ( m_Slayer != SlayerName.None ) { SlayerEntry entry = SlayerGroup.GetEntryByName( m_Slayer ); - if( entry != null ) + if ( entry != null ) list.Add( entry.Title ); } - if( m_Slayer2 != SlayerName.None ) + if ( m_Slayer2 != SlayerName.None ) { SlayerEntry entry = SlayerGroup.GetEntryByName( m_Slayer2 ); - if( entry != null ) + if ( entry != null ) list.Add( entry.Title ); } @@ -879,9 +879,9 @@ namespace Server.Items if ( magery >= 1000 ) { - if( magery >= 1200 ) + if ( magery >= 1200 ) propertyCounts = m_LegendPropertyCounts; - else if( magery >= 1100 ) + else if ( magery >= 1100 ) propertyCounts = m_ElderPropertyCounts; else propertyCounts = m_GrandPropertyCounts; diff --git a/Scripts/Items/Skill Items/Misc/Bandage.cs b/Scripts/Items/Skill Items/Misc/Bandage.cs index 63b74fdf1..148bb686b 100644 --- a/Scripts/Items/Skill Items/Misc/Bandage.cs +++ b/Scripts/Items/Skill Items/Misc/Bandage.cs @@ -280,7 +280,7 @@ namespace Server.Items { Mobile master = petPatient.ControlMaster; - if( master != null && m_Healer == master ) + if ( master != null && m_Healer == master ) { petPatient.ResurrectPet(); diff --git a/Scripts/Items/Skill Items/Misc/RecipeScroll.cs b/Scripts/Items/Skill Items/Misc/RecipeScroll.cs index 269ef7ec3..05731acc2 100644 --- a/Scripts/Items/Skill Items/Misc/RecipeScroll.cs +++ b/Scripts/Items/Skill Items/Misc/RecipeScroll.cs @@ -36,7 +36,7 @@ namespace Server.Items Recipe r = this.Recipe; - if( r != null ) + if ( r != null ) list.Add( 1049644, r.TextDefinition.ToString() ); // [~1_stuff~] } @@ -59,7 +59,7 @@ namespace Server.Items public override void OnDoubleClick( Mobile from ) { - if( !from.InRange( this.GetWorldLocation(), 2 ) ) + if ( !from.InRange( this.GetWorldLocation(), 2 ) ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that. return; @@ -67,11 +67,11 @@ namespace Server.Items Recipe r = this.Recipe; - if( r != null && from is PlayerMobile ) + if ( r != null && from is PlayerMobile ) { PlayerMobile pm = from as PlayerMobile; - if( !pm.HasRecipe( r ) ) + if ( !pm.HasRecipe( r ) ) { bool allRequiredSkills = true; double chance = r.CraftItem.GetSuccessChance( from, null, r.CraftSystem, false, ref allRequiredSkills ); diff --git a/Scripts/Items/Skill Items/Misc/RepairDeed.cs b/Scripts/Items/Skill Items/Misc/RepairDeed.cs index 1f5176e90..fa7677130 100644 --- a/Scripts/Items/Skill Items/Misc/RepairDeed.cs +++ b/Scripts/Items/Skill Items/Misc/RepairDeed.cs @@ -49,7 +49,7 @@ namespace Server.Items { int v = (int)type; - if( v < 0 || v >= m_Table.Length ) + if ( v < 0 || v >= m_Table.Length ) v = 0; return m_Table[v]; @@ -101,7 +101,7 @@ namespace Server.Items { base.GetProperties( list ); - if( m_Crafter != null ) + if ( m_Crafter != null ) list.Add( 1050043, m_Crafter.Name ); // crafted by ~1_NAME~ //On OSI it says it's exceptional. Intentional difference. @@ -114,7 +114,7 @@ namespace Server.Items this.LabelTo( from, 1061133, String.Format( "{0}\t{1}", GetSkillTitle( m_SkillLevel ).ToString(), RepairSkillInfo.GetInfo( m_Skill ).Name ) ); // A repair service contract from ~1_SKILL_TITLE~ ~2_SKILL_NAME~. - if( m_Crafter != null ) + if ( m_Crafter != null ) this.LabelTo( from, 1050043, m_Crafter.Name ); // crafted by ~1_NAME~ } @@ -139,7 +139,7 @@ namespace Server.Items public RepairDeed( RepairSkillType skill, double level, Mobile crafter, bool normalizeLevel ) : base( 0x14F0 ) { - if( normalizeLevel ) + if ( normalizeLevel ) SkillLevel = (int)(level/10)*10; else SkillLevel = level; @@ -158,9 +158,9 @@ namespace Server.Items { int skill = (int)(skillLevel/10); - if( skill >= 11 ) + if ( skill >= 11 ) return (1062008 + skill-11); - else if( skill >=5 ) + else if ( skill >=5 ) return (1061123 + skill-5); switch( skill ) @@ -178,7 +178,7 @@ namespace Server.Items { for( int i = 0; i < RepairSkillInfo.Table.Length; i++ ) { - if( RepairSkillInfo.Table[i].System == s ) + if ( RepairSkillInfo.Table[i].System == s ) return (RepairSkillType)i; } @@ -187,15 +187,15 @@ namespace Server.Items public override void OnDoubleClick( Mobile from ) { - if( Check( from ) ) + if ( Check( from ) ) Repair.Do( from, RepairSkillInfo.GetInfo( m_Skill ).System, this ); } public bool Check( Mobile from ) { - if( !IsChildOf( from.Backpack ) ) + if ( !IsChildOf( from.Backpack ) ) from.SendLocalizedMessage( 1047012 ); // The contract must be in your backpack to use it. - else if( !VerifyRegion( from ) ) + else if ( !VerifyRegion( from ) ) TextDefinition.SendMessageTo( from, RepairSkillInfo.GetInfo( m_Skill ).NotNearbyMessage ); else return true; @@ -207,7 +207,7 @@ namespace Server.Items { //TODO: When the entire region system data is in, convert to that instead of a proximity thing. - if( !m.Region.IsPartOf( typeof( TownRegion ) ) ) + if ( !m.Region.IsPartOf( typeof( TownRegion ) ) ) return false; return Server.Factions.Faction.IsNearType( m, RepairSkillInfo.GetInfo( m_Skill ).NearbyTypes, 6 ); diff --git a/Scripts/Items/Skill Items/Musical Instruments/BaseInstrument.cs b/Scripts/Items/Skill Items/Musical Instruments/BaseInstrument.cs index 379ad407a..f5c2a6c73 100644 --- a/Scripts/Items/Skill Items/Musical Instruments/BaseInstrument.cs +++ b/Scripts/Items/Skill Items/Musical Instruments/BaseInstrument.cs @@ -93,12 +93,12 @@ namespace Server.Items public bool ReplenishesCharges { get { return m_ReplenishesCharges; } - set + set { - if( value != m_ReplenishesCharges && value ) + if ( value != m_ReplenishesCharges && value ) m_LastReplenished = DateTime.UtcNow; - m_ReplenishesCharges = value; + m_ReplenishesCharges = value; } } @@ -109,17 +109,17 @@ namespace Server.Items public void CheckReplenishUses( bool invalidate ) { - if( !m_ReplenishesCharges || m_UsesRemaining >= InitMaxUses ) + if ( !m_ReplenishesCharges || m_UsesRemaining >= InitMaxUses ) return; - if( m_LastReplenished + ChargeReplenishRate < DateTime.UtcNow ) + if ( m_LastReplenished + ChargeReplenishRate < DateTime.UtcNow ) { TimeSpan timeDifference = DateTime.UtcNow - m_LastReplenished; m_UsesRemaining = Math.Min( m_UsesRemaining + (int)( timeDifference.Ticks / ChargeReplenishRate.Ticks), InitMaxUses ); //How rude of TimeSpan to not allow timespan division. m_LastReplenished = DateTime.UtcNow; - if( invalidate ) + if ( invalidate ) InvalidateProperties(); } @@ -354,24 +354,24 @@ namespace Server.Items list.Add( 1060584, m_UsesRemaining.ToString() ); // uses remaining: ~1_val~ - if( m_ReplenishesCharges ) + if ( m_ReplenishesCharges ) list.Add( 1070928 ); // Replenish Charges - if( m_Slayer != SlayerName.None ) + if ( m_Slayer != SlayerName.None ) { SlayerEntry entry = SlayerGroup.GetEntryByName( m_Slayer ); - if( entry != null ) + if ( entry != null ) list.Add( entry.Title ); } - if( m_Slayer2 != SlayerName.None ) + if ( m_Slayer2 != SlayerName.None ) { SlayerEntry entry = SlayerGroup.GetEntryByName( m_Slayer2 ); - if( entry != null ) + if ( entry != null ) list.Add( entry.Title ); } - if( m_UsesRemaining != oldUses ) + if ( m_UsesRemaining != oldUses ) Timer.DelayCall( TimeSpan.Zero, new TimerCallback( InvalidateProperties ) ); } @@ -390,21 +390,21 @@ namespace Server.Items if ( m_Quality == InstrumentQuality.Exceptional ) attrs.Add( new EquipInfoAttribute( 1018305 - (int)m_Quality ) ); - if( m_ReplenishesCharges ) + if ( m_ReplenishesCharges ) attrs.Add( new EquipInfoAttribute( 1070928 ) ); // Replenish Charges // TODO: Must this support item identification? - if( m_Slayer != SlayerName.None ) + if ( m_Slayer != SlayerName.None ) { SlayerEntry entry = SlayerGroup.GetEntryByName( m_Slayer ); - if( entry != null ) + if ( entry != null ) attrs.Add( new EquipInfoAttribute( entry.Title ) ); } - if( m_Slayer2 != SlayerName.None ) + if ( m_Slayer2 != SlayerName.None ) { SlayerEntry entry = SlayerGroup.GetEntryByName( m_Slayer2 ); - if( entry != null ) + if ( entry != null ) attrs.Add( new EquipInfoAttribute( entry.Title ) ); } @@ -439,7 +439,7 @@ namespace Server.Items writer.Write( (int) 3 ); // version writer.Write( m_ReplenishesCharges ); - if( m_ReplenishesCharges ) + if ( m_ReplenishesCharges ) writer.Write( m_LastReplenished ); @@ -467,7 +467,7 @@ namespace Server.Items { m_ReplenishesCharges = reader.ReadBool(); - if( m_ReplenishesCharges ) + if ( m_ReplenishesCharges ) m_LastReplenished = reader.ReadDateTime(); goto case 2; @@ -484,7 +484,7 @@ namespace Server.Items m_WellSound = reader.ReadEncodedInt(); m_BadlySound = reader.ReadEncodedInt(); - + break; } case 1: @@ -584,4 +584,4 @@ namespace Server.Items #endregion } -} \ No newline at end of file +} diff --git a/Scripts/Items/Skill Items/Tailor Items/Dyetubs/MetallicHuePicker.cs b/Scripts/Items/Skill Items/Tailor Items/Dyetubs/MetallicHuePicker.cs index 3027e0acb..98baee174 100644 --- a/Scripts/Items/Skill Items/Tailor Items/Dyetubs/MetallicHuePicker.cs +++ b/Scripts/Items/Skill Items/Tailor Items/Dyetubs/MetallicHuePicker.cs @@ -64,7 +64,7 @@ namespace Server.Items { case 1: // Okay { - if( info.Switches.Length > 0 ) + if ( info.Switches.Length > 0 ) { m_Callback( m_From, m_State, info.Switches[ 0 ] ); } @@ -79,4 +79,4 @@ namespace Server.Items } } } -} \ No newline at end of file +} diff --git a/Scripts/Items/Skill Items/Tailor Items/Misc/Dyes.cs b/Scripts/Items/Skill Items/Tailor Items/Misc/Dyes.cs index f34a57a79..6f3eedd86 100644 --- a/Scripts/Items/Skill Items/Tailor Items/Misc/Dyes.cs +++ b/Scripts/Items/Skill Items/Tailor Items/Misc/Dyes.cs @@ -77,7 +77,7 @@ namespace Server.Items public virtual void SetTubHue( Mobile from, object state, int hue ) { - if( state is DyeTub ) + if ( state is DyeTub ) { DyeTub tub = state as DyeTub; @@ -95,11 +95,11 @@ namespace Server.Items if ( tub.Redyable ) { - if( tub.MetallicHues ) /* OSI has three metallic tubs now */ + if ( tub.MetallicHues ) /* OSI has three metallic tubs now */ { from.SendGump( new MetallicHuePicker( from, new MetallicHuePicker.MetallicHuePickerCallback( SetTubHue ), tub ) ); } - else if( tub.CustomHuePicker != null ) + else if ( tub.CustomHuePicker != null ) { from.SendGump( new CustomHuePickerGump( from, tub.CustomHuePicker, new CustomHuePickerCallback( SetTubHue ), tub ) ); } @@ -124,4 +124,4 @@ namespace Server.Items } } } -} \ No newline at end of file +} diff --git a/Scripts/Items/Skill Items/Tailor Items/Misc/Scissors.cs b/Scripts/Items/Skill Items/Tailor Items/Misc/Scissors.cs index 581b516ce..f176cb7f1 100644 --- a/Scripts/Items/Skill Items/Tailor Items/Misc/Scissors.cs +++ b/Scripts/Items/Skill Items/Tailor Items/Misc/Scissors.cs @@ -63,7 +63,7 @@ namespace Server.Items from.SendLocalizedMessage( 502440 ); // Scissors can not be used on that to produce anything. } else */ - if( Core.AOS && targeted == from ) + if ( Core.AOS && targeted == from ) { from.SendLocalizedMessage( 1062845 + Utility.Random( 3 ) ); //"That doesn't seem like the smartest thing to do." / "That was an encounter you don't wish to repeat." / "Ha! You missed!" } @@ -71,9 +71,9 @@ namespace Server.Items { from.SendLocalizedMessage( 1063305 ); // Didn't your parents ever tell you not to run with scissors in your hand?! } - else if( targeted is Item && !((Item)targeted).Movable ) + else if ( targeted is Item && !((Item)targeted).Movable ) { - if( targeted is IScissorable && ( targeted is PlagueBeastInnard || targeted is PlagueBeastMutationCore ) ) + if ( targeted is IScissorable && ( targeted is PlagueBeastInnard || targeted is PlagueBeastMutationCore ) ) { IScissorable obj = (IScissorable) targeted; diff --git a/Scripts/Items/Skill Items/Tools/BaseRunicTool.cs b/Scripts/Items/Skill Items/Tools/BaseRunicTool.cs index b18a0b75c..255e2ee20 100644 --- a/Scripts/Items/Skill Items/Tools/BaseRunicTool.cs +++ b/Scripts/Items/Skill Items/Tools/BaseRunicTool.cs @@ -365,7 +365,7 @@ namespace Server.Items AosElementAttribute.Poison }; - if( randomizeOrder ) + if ( randomizeOrder ) { for( int i = 0; i < attrs.Length; i++ ) { @@ -399,7 +399,7 @@ namespace Server.Items private static int AssignElementalDamage( BaseWeapon weapon, AosElementAttribute attr, int totalDamage ) { - if( totalDamage <= 0 ) + if ( totalDamage <= 0 ) return 0; int random = Utility.Random( (int)(totalDamage/10) + 1 ) * 10; diff --git a/Scripts/Items/Special/8th Anniversary Items/FountainOfLife.cs b/Scripts/Items/Special/8th Anniversary Items/FountainOfLife.cs index 846c7faa6..6a8030c5f 100644 --- a/Scripts/Items/Special/8th Anniversary Items/FountainOfLife.cs +++ b/Scripts/Items/Special/8th Anniversary Items/FountainOfLife.cs @@ -109,11 +109,11 @@ namespace Server.Items public override bool OnDragDrop( Mobile from, Item dropped ) { - if( dropped is Bandage ) + if ( dropped is Bandage ) { bool allow = base.OnDragDrop( from, dropped ); - if( allow ) + if ( allow ) Enhance( from ); return allow; @@ -127,11 +127,11 @@ namespace Server.Items public override bool OnDragDropInto( Mobile from, Item item, Point3D p ) { - if( item is Bandage ) + if ( item is Bandage ) { bool allow = base.OnDragDropInto( from, item, p ); - if( allow ) + if ( allow ) Enhance( from ); return allow; @@ -152,7 +152,7 @@ namespace Server.Items public override void OnDelete() { - if( m_Timer != null ) + if ( m_Timer != null ) m_Timer.Stop(); base.OnDelete(); @@ -178,7 +178,7 @@ namespace Server.Items DateTime next = reader.ReadDateTime(); - if( next < DateTime.UtcNow ) + if ( next < DateTime.UtcNow ) m_Timer = Timer.DelayCall( TimeSpan.Zero, RechargeTime, new TimerCallback( Recharge ) ); else m_Timer = Timer.DelayCall( next - DateTime.UtcNow, RechargeTime, new TimerCallback( Recharge ) ); @@ -200,11 +200,11 @@ namespace Server.Items Bandage bandage = Items[i] as Bandage; - if( bandage != null ) + if ( bandage != null ) { Item enhanced; - if( bandage.Amount > m_Charges ) + if ( bandage.Amount > m_Charges ) { bandage.Amount -= m_Charges; enhanced = new EnhancedBandage( m_Charges ); diff --git a/Scripts/Items/Special/Evil Home Decor Collection/BedOfNails.cs b/Scripts/Items/Special/Evil Home Decor Collection/BedOfNails.cs index 82c8e27e5..087c88d52 100644 --- a/Scripts/Items/Special/Evil Home Decor Collection/BedOfNails.cs +++ b/Scripts/Items/Special/Evil Home Decor Collection/BedOfNails.cs @@ -20,7 +20,7 @@ namespace Server.Items { bool allow = base.OnMoveOver( m ); - if( allow && Addon is BedOfNailsAddon ) + if ( allow && Addon is BedOfNailsAddon ) ( (BedOfNailsAddon)Addon ).OnMoveOver( m ); return allow; @@ -64,17 +64,17 @@ namespace Server.Items public override bool OnMoveOver( Mobile m ) { - if( m.Alive && ( m.AccessLevel == AccessLevel.Player || !m.Hidden ) ) + if ( m.Alive && ( m.AccessLevel == AccessLevel.Player || !m.Hidden ) ) { - if( m.Player ) + if ( m.Player ) { - if( m.Female ) + if ( m.Female ) Effects.PlaySound( Location, Map, Utility.RandomMinMax( 0x53B, 0x53D ) ); else Effects.PlaySound( Location, Map, Utility.RandomMinMax( 0x53E, 0x540 ) ); } - if( m_Timer == null || !m_Timer.Running ) + if ( m_Timer == null || !m_Timer.Running ) ( m_Timer = new InternalTimer( m ) ).Start(); } @@ -124,13 +124,13 @@ namespace Server.Items protected override void OnTick() { - if( m_Mobile == null || m_Mobile.Map == null || m_Mobile.Deleted || !m_Mobile.Alive || m_Mobile.Map == Map.Internal ) + if ( m_Mobile == null || m_Mobile.Map == null || m_Mobile.Deleted || !m_Mobile.Alive || m_Mobile.Map == Map.Internal ) { Stop(); } else { - if( m_Location != m_Mobile.Location ) + if ( m_Location != m_Mobile.Location ) { int amount = Utility.RandomMinMax( 0, 7 ); @@ -140,11 +140,11 @@ namespace Server.Items int y = m_Mobile.Y + Utility.RandomMinMax( -1, 1 ); int z = m_Mobile.Z; - if( !m_Mobile.Map.CanFit( x, y, z, 1, false, false, true ) ) + if ( !m_Mobile.Map.CanFit( x, y, z, 1, false, false, true ) ) { z = m_Mobile.Map.GetAverageZ( x, y ); - if( !m_Mobile.Map.CanFit( x, y, z, 1, false, false, true ) ) + if ( !m_Mobile.Map.CanFit( x, y, z, 1, false, false, true ) ) { continue; } diff --git a/Scripts/Items/Special/ML/GrizzledMareStatuette.cs b/Scripts/Items/Special/ML/GrizzledMareStatuette.cs index a8cf9b196..2491be816 100644 --- a/Scripts/Items/Special/ML/GrizzledMareStatuette.cs +++ b/Scripts/Items/Special/ML/GrizzledMareStatuette.cs @@ -73,7 +73,7 @@ namespace Server.Mobiles int version = reader.ReadInt(); - if( version < 1 ) + if ( version < 1 ) { Timer.DelayCall( TimeSpan.FromSeconds( 0 ), new TimerCallback( OnAfterDeserialize_Callback ) ); } diff --git a/Scripts/Items/Special/MonsterStatuette.cs b/Scripts/Items/Special/MonsterStatuette.cs index 88b15ed88..d66b19f51 100644 --- a/Scripts/Items/Special/MonsterStatuette.cs +++ b/Scripts/Items/Special/MonsterStatuette.cs @@ -160,11 +160,11 @@ namespace Server.Items m_Type = value; ItemID = MonsterStatuetteInfo.GetInfo( m_Type ).ItemID; - if( m_Type == MonsterStatuetteType.Slime ) + if ( m_Type == MonsterStatuetteType.Slime ) Hue = Utility.RandomSlimeHue(); - else if( m_Type == MonsterStatuetteType.RedDeath ) + else if ( m_Type == MonsterStatuetteType.RedDeath ) Hue = 0x21; - else if( m_Type == MonsterStatuetteType.HalloweenGhoul ) + else if ( m_Type == MonsterStatuetteType.HalloweenGhoul ) Hue = 0xF4; else Hue = 0; @@ -195,11 +195,11 @@ namespace Server.Items m_Type = type; - if( m_Type == MonsterStatuetteType.Slime ) + if ( m_Type == MonsterStatuetteType.Slime ) Hue = Utility.RandomSlimeHue(); - else if( m_Type == MonsterStatuetteType.RedDeath ) + else if ( m_Type == MonsterStatuetteType.RedDeath ) Hue = 0x21; - else if( m_Type == MonsterStatuetteType.HalloweenGhoul ) + else if ( m_Type == MonsterStatuetteType.HalloweenGhoul ) Hue = 0xF4; } @@ -211,7 +211,7 @@ namespace Server.Items { int[] sounds = MonsterStatuetteInfo.GetInfo( m_Type ).Sounds; - if( sounds.Length > 0 ) + if ( sounds.Length > 0 ) Effects.PlaySound( this.Location, this.Map, sounds[Utility.Random( sounds.Length )] ); } diff --git a/Scripts/Items/Special/Rares/Containers/BaseWaterContainer.cs b/Scripts/Items/Special/Rares/Containers/BaseWaterContainer.cs index e85622279..d072d7b01 100644 --- a/Scripts/Items/Special/Rares/Containers/BaseWaterContainer.cs +++ b/Scripts/Items/Special/Rares/Containers/BaseWaterContainer.cs @@ -23,7 +23,7 @@ } set { - if( value != m_Quantity ) + if ( value != m_Quantity ) { m_Quantity = ( value < 1 ) ? 0 : ( value > MaxQuantity ) ? MaxQuantity : value; @@ -31,11 +31,11 @@ ItemID = ( IsEmpty ) ? voidItem_ID : fullItem_ID; - if( !IsEmpty ) + if ( !IsEmpty ) { IEntity rootParent = RootParent; - if( rootParent != null && rootParent.Map != null && rootParent.Map != Map.Internal ) + if ( rootParent != null && rootParent.Map != null && rootParent.Map != Map.Internal ) MoveToWorld( rootParent.Location, rootParent.Map ); } @@ -54,7 +54,7 @@ public override void OnDoubleClick( Mobile from ) { - if( IsEmpty ) + if ( IsEmpty ) { base.OnDoubleClick( from ); } @@ -62,13 +62,13 @@ public override void OnSingleClick( Mobile from ) { - if( IsEmpty ) + if ( IsEmpty ) { base.OnSingleClick( from ); } else { - if( Name == null ) + if ( Name == null ) LabelTo( from, LabelNumber ); else LabelTo( from, Name ); @@ -77,13 +77,13 @@ public override void OnAosSingleClick( Mobile from ) { - if( IsEmpty ) + if ( IsEmpty ) { base.OnAosSingleClick( from ); } else { - if( Name == null ) + if ( Name == null ) LabelTo( from, LabelNumber ); else LabelTo( from, Name ); @@ -92,7 +92,7 @@ public override void GetProperties( ObjectPropertyList list ) { - if( IsEmpty ) + if ( IsEmpty ) { base.GetProperties( list ); } @@ -100,7 +100,7 @@ public override bool OnDragDropInto( Mobile from, Item item, Point3D p ) { - if( !IsEmpty ) + if ( !IsEmpty ) { return false; } diff --git a/Scripts/Items/Special/Solen Items/BagOfSending.cs b/Scripts/Items/Special/Solen Items/BagOfSending.cs index 0ad74ba89..7ef1d54c6 100644 --- a/Scripts/Items/Special/Solen Items/BagOfSending.cs +++ b/Scripts/Items/Special/Solen Items/BagOfSending.cs @@ -155,15 +155,15 @@ namespace Server.Items public override void OnDoubleClick( Mobile from ) { - if( from.Region.IsPartOf( typeof( Regions.Jail ) ) ) + if ( from.Region.IsPartOf( typeof( Regions.Jail ) ) ) { from.SendMessage( "You may not do that in jail." ); } - else if( !this.IsChildOf( from.Backpack ) ) + else if ( !this.IsChildOf( from.Backpack ) ) { MessageHelper.SendLocalizedMessageTo(this, from, 1062334, 0x59); // The bag of sending must be in your backpack. } - else if( this.Charges == 0 ) + else if ( this.Charges == 0 ) { MessageHelper.SendLocalizedMessageTo( this, from, 1042544, 0x59 ); // This item is out of charges. } @@ -187,11 +187,11 @@ namespace Server.Items if ( m_Bag.Deleted ) return; - if( from.Region.IsPartOf( typeof( Regions.Jail ) ) ) + if ( from.Region.IsPartOf( typeof( Regions.Jail ) ) ) { from.SendMessage( "You may not do that in jail." ); } - else if( !m_Bag.IsChildOf( from.Backpack ) ) + else if ( !m_Bag.IsChildOf( from.Backpack ) ) { MessageHelper.SendLocalizedMessageTo(m_Bag, from, 1062334, 0x59); // The bag of sending must be in your backpack. 1054107 is gone from client, using generic response } diff --git a/Scripts/Items/Special/Solen Items/BallOfSummoning.cs b/Scripts/Items/Special/Solen Items/BallOfSummoning.cs index 7fbcbd3c6..f0a1b6f7c 100644 --- a/Scripts/Items/Special/Solen Items/BallOfSummoning.cs +++ b/Scripts/Items/Special/Solen Items/BallOfSummoning.cs @@ -154,7 +154,7 @@ namespace Server.Items AnimalFormContext animalContext = AnimalForm.GetContext( from ); - if( Core.ML && animalContext != null ) + if ( Core.ML && animalContext != null ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1080073 ); // You cannot use a Crystal Ball of Pet Summoning while in animal form. return; @@ -266,7 +266,7 @@ namespace Server.Items } else { - if( Core.ML ) + if ( Core.ML ) new PetSummoningSpell( this, from ).Cast(); else SummonPet( from ); @@ -436,7 +436,7 @@ namespace Server.Items public override bool CheckDisturb( DisturbType type, bool checkFirst, bool resistable ) { - if( type == DisturbType.EquipRequest || type == DisturbType.UseRequest/* || type == DisturbType.Hurt*/ ) + if ( type == DisturbType.EquipRequest || type == DisturbType.UseRequest/* || type == DisturbType.Hurt*/ ) return false; return true; @@ -444,19 +444,19 @@ namespace Server.Items public override void DoHurtFizzle() { - if( !m_Stop ) + if ( !m_Stop ) base.DoHurtFizzle(); } public override void DoFizzle() { - if( !m_Stop ) + if ( !m_Stop ) base.DoFizzle(); } public override void OnDisturb( DisturbType type, bool message ) { - if( message && !m_Stop ) + if ( message && !m_Stop ) Caster.SendLocalizedMessage( 1080074 ); // You have been disrupted while attempting to summon your pet! } diff --git a/Scripts/Items/Special/SoulStone.cs b/Scripts/Items/Special/SoulStone.cs index c42f75837..023c3e002 100644 --- a/Scripts/Items/Special/SoulStone.cs +++ b/Scripts/Items/Special/SoulStone.cs @@ -33,7 +33,7 @@ namespace Server.Items { m_ActiveItemID = value; - if( !IsEmpty ) + if ( !IsEmpty ) this.ItemID = m_ActiveItemID; } } @@ -46,7 +46,7 @@ namespace Server.Items { m_InactiveItemID = value; - if( IsEmpty ) + if ( IsEmpty ) this.ItemID = m_InactiveItemID; } } @@ -642,11 +642,11 @@ namespace Server.Items Effects.SendTargetParticles( from, 0x375A, 35, 90, 0x00, 0x00, 9502, (EffectLayer)255, 0x100 ); - if( m_Stone is SoulstoneFragment ) + if ( m_Stone is SoulstoneFragment ) { SoulstoneFragment frag = m_Stone as SoulstoneFragment; - if( --frag.UsesRemaining <= 0 ) + if ( --frag.UsesRemaining <= 0 ) from.SendLocalizedMessage( 1070974 ); // You have used up your soulstone fragment. } } @@ -807,7 +807,7 @@ namespace Server.Items } } - if( version == 0 ) + if ( version == 0 ) { m_ActiveItemID = 0x2A94; m_InactiveItemID = 0x2A93; @@ -879,9 +879,9 @@ namespace Server.Items m_UsesRemaining = reader.ReadEncodedInt(); - if( version <= 1 ) + if ( version <= 1 ) { - if( ItemID == 0x2A93 || ItemID == 0x2A94 ) + if ( ItemID == 0x2A93 || ItemID == 0x2A94 ) { ActiveItemID = Utility.Random( 0x2AA1, 9 ); } @@ -905,9 +905,9 @@ namespace Server.Items { bool canUse = base.CheckUse( from ); - if( canUse ) + if ( canUse ) { - if( m_UsesRemaining <= 0 ) + if ( m_UsesRemaining <= 0 ) { from.SendLocalizedMessage( 1070975 ); // That soulstone fragment has no more uses. return false; diff --git a/Scripts/Items/Special/Veteran Rewards/AnkhOfSacrifice.cs b/Scripts/Items/Special/Veteran Rewards/AnkhOfSacrifice.cs index a6ab148a8..4757b8440 100644 --- a/Scripts/Items/Special/Veteran Rewards/AnkhOfSacrifice.cs +++ b/Scripts/Items/Special/Veteran Rewards/AnkhOfSacrifice.cs @@ -132,9 +132,9 @@ namespace Server.Items { Mobile from = state.Mobile; - if( info.ButtonID == 1 || info.ButtonID == 2 ) + if ( info.ButtonID == 1 || info.ButtonID == 2 ) { - if( from.Map == null || !from.Map.CanFit( from.Location, 16, false, false ) ) + if ( from.Map == null || !from.Map.CanFit( from.Location, 16, false, false ) ) { from.SendLocalizedMessage( 502391 ); // Thou can not be resurrected there! return; diff --git a/Scripts/Items/Special/Veteran Rewards/WeaponEngravingTool.cs b/Scripts/Items/Special/Veteran Rewards/WeaponEngravingTool.cs index 6cdfe2a7c..82dd6597e 100644 --- a/Scripts/Items/Special/Veteran Rewards/WeaponEngravingTool.cs +++ b/Scripts/Items/Special/Veteran Rewards/WeaponEngravingTool.cs @@ -258,7 +258,7 @@ namespace Server.Items } else { - if( relay.Text.Length > 64 ) + if ( relay.Text.Length > 64 ) m_Target.EngravedText = Utility.FixHtml( relay.Text.Substring( 0, 64 ) ); else m_Target.EngravedText = Utility.FixHtml( relay.Text ); diff --git a/Scripts/Items/TreasureChests/TreasureChestLevel1.cs b/Scripts/Items/TreasureChests/TreasureChestLevel1.cs index b8a84f1bd..43a99b701 100644 --- a/Scripts/Items/TreasureChests/TreasureChestLevel1.cs +++ b/Scripts/Items/TreasureChests/TreasureChestLevel1.cs @@ -75,7 +75,7 @@ namespace Server.Items //DropItem( new Bolt( 10 ) ); // Gems - if( Utility.RandomBool() == true ) + if ( Utility.RandomBool() == true ) { Item GemLoot = Loot.RandomGem(); GemLoot.Amount = Utility.Random( 1, 3 ); @@ -83,19 +83,19 @@ namespace Server.Items } // Weapon - if( Utility.RandomBool() == true ) + if ( Utility.RandomBool() == true ) DropItem( Loot.RandomWeapon() ); // Armour - if( Utility.RandomBool() == true ) + if ( Utility.RandomBool() == true ) DropItem( Loot.RandomArmorOrShield() ); // Clothing - if( Utility.RandomBool() == true ) + if ( Utility.RandomBool() == true ) DropItem( Loot.RandomClothing() ); // Jewelry - if( Utility.RandomBool() == true ) + if ( Utility.RandomBool() == true ) DropItem( Loot.RandomJewelry() ); } diff --git a/Scripts/Items/TreasureChests/TreasureChestLevel3.cs b/Scripts/Items/TreasureChests/TreasureChestLevel3.cs index 65c3bbe7a..8433177e0 100644 --- a/Scripts/Items/TreasureChests/TreasureChestLevel3.cs +++ b/Scripts/Items/TreasureChests/TreasureChestLevel3.cs @@ -117,7 +117,7 @@ namespace Server.Items { Item item = Loot.RandomArmorOrShieldOrWeapon(); - if( item is BaseWeapon ) + if ( item is BaseWeapon ) { BaseWeapon weapon = ( BaseWeapon )item; weapon.DamageLevel = ( WeaponDamageLevel )Utility.Random( m_Level ); @@ -125,7 +125,7 @@ namespace Server.Items weapon.DurabilityLevel = ( WeaponDurabilityLevel )Utility.Random( m_Level ); weapon.Quality = WeaponQuality.Regular; } - else if( item is BaseArmor ) + else if ( item is BaseArmor ) { BaseArmor armor = ( BaseArmor )item; armor.ProtectionLevel = ( ArmorProtectionLevel )Utility.Random( m_Level ); diff --git a/Scripts/Items/TreasureChests/TreasureChestLevel4.cs b/Scripts/Items/TreasureChests/TreasureChestLevel4.cs index 49e89ec54..c8b99b428 100644 --- a/Scripts/Items/TreasureChests/TreasureChestLevel4.cs +++ b/Scripts/Items/TreasureChests/TreasureChestLevel4.cs @@ -124,7 +124,7 @@ namespace Server.Items { Item item = Loot.RandomArmorOrShieldOrWeapon(); - if( item is BaseWeapon ) + if ( item is BaseWeapon ) { BaseWeapon weapon = ( BaseWeapon )item; weapon.DamageLevel = ( WeaponDamageLevel )Utility.Random( m_Level ); @@ -132,7 +132,7 @@ namespace Server.Items weapon.DurabilityLevel = ( WeaponDurabilityLevel )Utility.Random( m_Level ); weapon.Quality = WeaponQuality.Regular; } - else if( item is BaseArmor ) + else if ( item is BaseArmor ) { BaseArmor armor = ( BaseArmor )item; armor.ProtectionLevel = ( ArmorProtectionLevel )Utility.Random( m_Level ); diff --git a/Scripts/Items/Weapons/Abilities/ArmorPierce.cs b/Scripts/Items/Weapons/Abilities/ArmorPierce.cs index 0a4559d41..2fc5fa323 100644 --- a/Scripts/Items/Weapons/Abilities/ArmorPierce.cs +++ b/Scripts/Items/Weapons/Abilities/ArmorPierce.cs @@ -14,7 +14,7 @@ namespace Server.Items public override bool CheckSkills( Mobile from ) { - if( GetSkill( from, SkillName.Ninjitsu ) < 50.0 && GetSkill( from, SkillName.Bushido ) < 50.0 ) + if ( GetSkill( from, SkillName.Ninjitsu ) < 50.0 && GetSkill( from, SkillName.Bushido ) < 50.0 ) { from.SendLocalizedMessage( 1063347, "50" ); // You need ~1_SKILL_REQUIREMENT~ Bushido or Ninjitsu skill to perform that attack! return false; diff --git a/Scripts/Items/Weapons/Abilities/Block.cs b/Scripts/Items/Weapons/Abilities/Block.cs index 7d8e107d9..82eef4b1c 100644 --- a/Scripts/Items/Weapons/Abilities/Block.cs +++ b/Scripts/Items/Weapons/Abilities/Block.cs @@ -17,7 +17,7 @@ namespace Server.Items public override bool CheckSkills( Mobile from ) { - if( GetSkill( from, SkillName.Ninjitsu ) < 50.0 && GetSkill( from, SkillName.Bushido ) < 50.0 ) + if ( GetSkill( from, SkillName.Ninjitsu ) < 50.0 && GetSkill( from, SkillName.Bushido ) < 50.0 ) { from.SendLocalizedMessage( 1063347, "50" ); // You need ~1_SKILL_REQUIREMENT~ Bushido or Ninjitsu skill to perform that attack! return false; diff --git a/Scripts/Items/Weapons/Abilities/DefenseMastery.cs b/Scripts/Items/Weapons/Abilities/DefenseMastery.cs index 814b7e1dc..f91f64ad8 100644 --- a/Scripts/Items/Weapons/Abilities/DefenseMastery.cs +++ b/Scripts/Items/Weapons/Abilities/DefenseMastery.cs @@ -15,7 +15,7 @@ namespace Server.Items public override bool CheckSkills( Mobile from ) { - if( GetSkill( from, SkillName.Ninjitsu ) < 50.0 && GetSkill( from, SkillName.Bushido ) < 50.0 ) + if ( GetSkill( from, SkillName.Ninjitsu ) < 50.0 && GetSkill( from, SkillName.Bushido ) < 50.0 ) { from.SendLocalizedMessage( 1063347, "50" ); // You need ~1_SKILL_REQUIREMENT~ Bushido or Ninjitsu skill to perform that attack! return false; @@ -28,7 +28,7 @@ namespace Server.Items public override void OnHit( Mobile attacker, Mobile defender, int damage ) { - if( !Validate( attacker ) || !CheckMana( attacker, true ) ) + if ( !Validate( attacker ) || !CheckMana( attacker, true ) ) return; ClearCurrentAbility( attacker ); @@ -41,7 +41,7 @@ namespace Server.Items DefenseMasteryInfo info = m_Table[attacker] as DefenseMasteryInfo; - if( info != null ) + if ( info != null ) EndDefense( (object)info ); ResistanceMod mod = new ResistanceMod( ResistanceType.Physical, 50 + modifier ); @@ -76,7 +76,7 @@ namespace Server.Items { DefenseMasteryInfo info = m_Table[targ] as DefenseMasteryInfo; - if( info == null ) + if ( info == null ) return false; damageMalus = info.m_DamageMalus; @@ -87,10 +87,10 @@ namespace Server.Items { DefenseMasteryInfo info = (DefenseMasteryInfo)state; - if( info.m_Mod != null ) + if ( info.m_Mod != null ) info.m_From.RemoveResistanceMod( info.m_Mod ); - if( info.m_Timer != null ) + if ( info.m_Timer != null ) info.m_Timer.Stop(); // No message is sent to the player. diff --git a/Scripts/Items/Weapons/Abilities/Dismount.cs b/Scripts/Items/Weapons/Abilities/Dismount.cs index af682d681..179cb487d 100644 --- a/Scripts/Items/Weapons/Abilities/Dismount.cs +++ b/Scripts/Items/Weapons/Abilities/Dismount.cs @@ -90,15 +90,15 @@ namespace Server.Items defender.Mount.Rider = null; } - if( attacker is PlayerMobile ) + if ( attacker is PlayerMobile ) { (attacker as PlayerMobile).SetMountBlock(BlockMountType.DismountRecovery, RemountDelay, true ); } - else if( Core.ML && attacker is BaseCreature ) + else if ( Core.ML && attacker is BaseCreature ) { BaseCreature bc = attacker as BaseCreature; - if( bc.ControlMaster is PlayerMobile ) + if ( bc.ControlMaster is PlayerMobile ) { PlayerMobile pm = bc.ControlMaster as PlayerMobile; diff --git a/Scripts/Items/Weapons/Abilities/DoubleShot.cs b/Scripts/Items/Weapons/Abilities/DoubleShot.cs index 6ba15d80c..6e6b021e1 100644 --- a/Scripts/Items/Weapons/Abilities/DoubleShot.cs +++ b/Scripts/Items/Weapons/Abilities/DoubleShot.cs @@ -16,7 +16,7 @@ namespace Server.Items public override bool CheckSkills( Mobile from ) { - if( GetSkill( from, SkillName.Ninjitsu ) < 50.0 && GetSkill( from, SkillName.Bushido ) < 50.0 ) + if ( GetSkill( from, SkillName.Ninjitsu ) < 50.0 && GetSkill( from, SkillName.Bushido ) < 50.0 ) { from.SendLocalizedMessage( 1063347, "50" ); // You need ~1_SKILL_REQUIREMENT~ Bushido or Ninjitsu skill to perform that attack! return false; @@ -37,9 +37,9 @@ namespace Server.Items public override bool Validate( Mobile from ) { - if( base.Validate( from ) ) + if ( base.Validate( from ) ) { - if( from.Mounted ) + if ( from.Mounted ) return true; else { @@ -53,7 +53,7 @@ namespace Server.Items public void Use( Mobile attacker, Mobile defender ) { - if( !Validate( attacker ) || !CheckMana( attacker, true ) || attacker.Weapon == null ) //sanity + if ( !Validate( attacker ) || !CheckMana( attacker, true ) || attacker.Weapon == null ) //sanity return; ClearCurrentAbility( attacker ); diff --git a/Scripts/Items/Weapons/Abilities/DualWield.cs b/Scripts/Items/Weapons/Abilities/DualWield.cs index 60e2b077b..f59be5ab1 100644 --- a/Scripts/Items/Weapons/Abilities/DualWield.cs +++ b/Scripts/Items/Weapons/Abilities/DualWield.cs @@ -21,7 +21,7 @@ namespace Server.Items public override bool CheckSkills( Mobile from ) { - if( GetSkill( from, SkillName.Ninjitsu ) < 50.0 ) + if ( GetSkill( from, SkillName.Ninjitsu ) < 50.0 ) { from.SendLocalizedMessage( 1063352, "50" ); // You need ~1_SKILL_REQUIREMENT~ Ninjitsu skill to perform that attack! return false; @@ -32,10 +32,10 @@ namespace Server.Items public override void OnHit( Mobile attacker, Mobile defender, int damage ) { - if( !Validate( attacker ) || !CheckMana( attacker, true ) ) + if ( !Validate( attacker ) || !CheckMana( attacker, true ) ) return; - if( Registry.Contains( attacker ) ) + if ( Registry.Contains( attacker ) ) { DualWieldTimer existingtimer = (DualWieldTimer)Registry[attacker]; existingtimer.Stop(); diff --git a/Scripts/Items/Weapons/Abilities/Feint.cs b/Scripts/Items/Weapons/Abilities/Feint.cs index 50c3b76da..204b6ced7 100644 --- a/Scripts/Items/Weapons/Abilities/Feint.cs +++ b/Scripts/Items/Weapons/Abilities/Feint.cs @@ -21,7 +21,7 @@ namespace Server.Items public override bool CheckSkills( Mobile from ) { - if( GetSkill( from, SkillName.Ninjitsu ) < 50.0 && GetSkill( from, SkillName.Bushido ) < 50.0 ) + if ( GetSkill( from, SkillName.Ninjitsu ) < 50.0 && GetSkill( from, SkillName.Bushido ) < 50.0 ) { from.SendLocalizedMessage( 1063347, "50" ); // You need ~1_SKILL_REQUIREMENT~ Bushido or Ninjitsu skill to perform that attack! return false; @@ -32,10 +32,10 @@ namespace Server.Items public override void OnHit( Mobile attacker, Mobile defender, int damage ) { - if( !Validate( attacker ) || !CheckMana( attacker, true ) ) + if ( !Validate( attacker ) || !CheckMana( attacker, true ) ) return; - if( Registry.Contains( defender ) ) + if ( Registry.Contains( defender ) ) { FeintTimer existingtimer = (FeintTimer)Registry[defender]; existingtimer.Stop(); diff --git a/Scripts/Items/Weapons/Abilities/FrenziedWhirlwind.cs b/Scripts/Items/Weapons/Abilities/FrenziedWhirlwind.cs index 4035461f7..20b0da9c2 100644 --- a/Scripts/Items/Weapons/Abilities/FrenziedWhirlwind.cs +++ b/Scripts/Items/Weapons/Abilities/FrenziedWhirlwind.cs @@ -17,7 +17,7 @@ namespace Server.Items public override bool CheckSkills( Mobile from ) { - if( GetSkill( from, SkillName.Ninjitsu ) < 50.0 && GetSkill( from, SkillName.Bushido ) < 50.0 ) + if ( GetSkill( from, SkillName.Ninjitsu ) < 50.0 && GetSkill( from, SkillName.Bushido ) < 50.0 ) { from.SendLocalizedMessage( 1063347, "50" ); // You need ~1_SKILL_REQUIREMENT~ Bushido or Ninjitsu skill to perform that attack! return false; @@ -33,19 +33,19 @@ namespace Server.Items public override void OnHit( Mobile attacker, Mobile defender, int damage ) { - if( !Validate( attacker ) ) //Mana check after check that there are targets + if ( !Validate( attacker ) ) //Mana check after check that there are targets return; ClearCurrentAbility( attacker ); Map map = attacker.Map; - if( map == null ) + if ( map == null ) return; BaseWeapon weapon = attacker.Weapon as BaseWeapon; - if( weapon == null ) + if ( weapon == null ) return; ArrayList list = new ArrayList(); @@ -59,22 +59,22 @@ namespace Server.Items { Mobile m = (Mobile)list[i]; - if( m != defender && m != attacker && SpellHelper.ValidIndirectTarget( attacker, m ) ) + if ( m != defender && m != attacker && SpellHelper.ValidIndirectTarget( attacker, m ) ) { - if( m == null || m.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.CanSee( m ) || !attacker.CanBeHarmful( m ) ) + if ( m == null || m.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.CanSee( m ) || !attacker.CanBeHarmful( m ) ) continue; - if( !attacker.InRange( m, weapon.MaxRange ) ) + if ( !attacker.InRange( m, weapon.MaxRange ) ) continue; - if( attacker.InLOS( m ) ) + if ( attacker.InLOS( m ) ) targets.Add( m ); } } - if( targets.Count > 0 ) + if ( targets.Count > 0 ) { - if( !CheckMana( attacker, true ) ) + if ( !CheckMana( attacker, true ) ) return; attacker.FixedEffect( 0x3728, 10, 15 ); @@ -90,7 +90,7 @@ namespace Server.Items Timer t = Registry[m] as Timer; - if( t != null ) + if ( t != null ) { t.Stop(); Registry.Remove( m ); @@ -136,7 +136,7 @@ namespace Server.Items protected override void OnTick() { - if( !m_Defender.Alive || m_DamageRemaining <= 0 ) + if ( !m_Defender.Alive || m_DamageRemaining <= 0 ) { Stop(); Server.Items.FrenziedWhirlwind.Registry.Remove( m_Defender ); @@ -146,18 +146,18 @@ namespace Server.Items m_DamageRemaining -= DamagePerTick; m_DamageToDo += DamagePerTick; - if( m_DamageRemaining <= 0 && m_DamageToDo < 1 ) + if ( m_DamageRemaining <= 0 && m_DamageToDo < 1 ) m_DamageToDo = 1.0; //Confirm this 'round up' at the end int damage = (int)m_DamageToDo; - if( damage > 0 ) + if ( damage > 0 ) { m_Defender.Damage( damage, m_Attacker ); m_DamageToDo -= damage; } - if( !m_Defender.Alive || m_DamageRemaining <= 0 ) + if ( !m_Defender.Alive || m_DamageRemaining <= 0 ) { Stop(); Server.Items.FrenziedWhirlwind.Registry.Remove( m_Defender ); diff --git a/Scripts/Items/Weapons/Abilities/MortalStrike.cs b/Scripts/Items/Weapons/Abilities/MortalStrike.cs index 9dc0db6ac..784516014 100644 --- a/Scripts/Items/Weapons/Abilities/MortalStrike.cs +++ b/Scripts/Items/Weapons/Abilities/MortalStrike.cs @@ -21,7 +21,7 @@ namespace Server.Items public override void OnHit(Mobile attacker, Mobile defender, int damage) { - if( !Validate( attacker ) || !CheckMana( attacker, true ) ) + if ( !Validate( attacker ) || !CheckMana( attacker, true ) ) { return; } diff --git a/Scripts/Items/Weapons/Abilities/NerveStrike.cs b/Scripts/Items/Weapons/Abilities/NerveStrike.cs index 2ff55cb54..e9f8657da 100644 --- a/Scripts/Items/Weapons/Abilities/NerveStrike.cs +++ b/Scripts/Items/Weapons/Abilities/NerveStrike.cs @@ -16,7 +16,7 @@ namespace Server.Items public override bool CheckSkills( Mobile from ) { - if( GetSkill( from, SkillName.Bushido ) < 50.0 ) + if ( GetSkill( from, SkillName.Bushido ) < 50.0 ) { from.SendLocalizedMessage( 1070768, "50" ); // You need ~1_SKILL_REQUIREMENT~ Bushido skill to perform that attack! return false; @@ -27,7 +27,7 @@ namespace Server.Items public override bool OnBeforeSwing( Mobile attacker, Mobile defender ) { - if( defender.Paralyzed ) + if ( defender.Paralyzed ) { attacker.SendLocalizedMessage( 1061923 ); // The target is already frozen. return false; @@ -38,7 +38,7 @@ namespace Server.Items public override void OnHit( Mobile attacker, Mobile defender, int damage ) { - if( !Validate( attacker ) || !CheckMana( attacker, true ) ) + if ( !Validate( attacker ) || !CheckMana( attacker, true ) ) return; ClearCurrentAbility( attacker ); @@ -70,7 +70,7 @@ namespace Server.Items Server.Items.ParalyzingBlow.BeginImmunity( defender, Server.Items.ParalyzingBlow.FreezeDelayDuration ); } } - else if( !cantpara ) + else if ( !cantpara ) { AOS.Damage( defender, attacker, (int)(15.0 * (attacker.Skills[SkillName.Bushido].Value - 50.0) / 70.0 + 10), true, 100, 0, 0, 0, 0 ); //10-25 defender.Freeze(TimeSpan.FromSeconds(2.0)); diff --git a/Scripts/Items/Weapons/Abilities/ParalyzingBlow.cs b/Scripts/Items/Weapons/Abilities/ParalyzingBlow.cs index 943894a2d..cc198fea2 100644 --- a/Scripts/Items/Weapons/Abilities/ParalyzingBlow.cs +++ b/Scripts/Items/Weapons/Abilities/ParalyzingBlow.cs @@ -50,7 +50,7 @@ namespace Server.Items public override bool OnBeforeSwing( Mobile attacker, Mobile defender ) { - if( defender.Paralyzed ) + if ( defender.Paralyzed ) { attacker.SendLocalizedMessage( 1061923 ); // The target is already frozen. return false; @@ -61,12 +61,12 @@ namespace Server.Items public override void OnHit( Mobile attacker, Mobile defender, int damage ) { - if( !Validate( attacker ) || !CheckMana( attacker, true ) ) + if ( !Validate( attacker ) || !CheckMana( attacker, true ) ) return; ClearCurrentAbility( attacker ); - if( IsImmune( defender ) ) //Intentionally going after Mana consumption + if ( IsImmune( defender ) ) //Intentionally going after Mana consumption { attacker.SendLocalizedMessage( 1070804 ); // Your target resists paralysis. defender.SendLocalizedMessage( 1070813 ); // You resist paralysis. diff --git a/Scripts/Items/Weapons/Abilities/RidingSwipe.cs b/Scripts/Items/Weapons/Abilities/RidingSwipe.cs index 9bc2e4ff9..e60af4aee 100644 --- a/Scripts/Items/Weapons/Abilities/RidingSwipe.cs +++ b/Scripts/Items/Weapons/Abilities/RidingSwipe.cs @@ -22,7 +22,7 @@ namespace Server.Items public override bool CheckSkills( Mobile from ) { - if( GetSkill( from, SkillName.Bushido ) < 50.0 ) + if ( GetSkill( from, SkillName.Bushido ) < 50.0 ) { from.SendLocalizedMessage( 1070768, "50" ); // You need ~1_SKILL_REQUIREMENT~ Bushido skill to perform that attack! return false; @@ -33,24 +33,24 @@ namespace Server.Items public override void OnHit( Mobile attacker, Mobile defender, int damage ) { - if( !defender.Mounted ) + if ( !defender.Mounted ) { attacker.SendLocalizedMessage( 1060848 ); // This attack only works on mounted targets ClearCurrentAbility( attacker ); return; } - if( !Validate( attacker ) || !CheckMana( attacker, true ) ) + if ( !Validate( attacker ) || !CheckMana( attacker, true ) ) return; ClearCurrentAbility( attacker ); - if( !attacker.Mounted ) + if ( !attacker.Mounted ) { Mobile mount = defender.Mount as Mobile; BaseMount.Dismount( defender ); - if( mount != null ) //Ethy mounts don't take damage + if ( mount != null ) //Ethy mounts don't take damage { int amount = 10 + (int)(10.0 * (attacker.Skills[SkillName.Bushido].Value - 50.0) / 70.0 + 5); @@ -65,7 +65,7 @@ namespace Server.Items AOS.Damage( defender, attacker, amount, 100, 0, 0, 0, 0 ); - if( Server.Items.ParalyzingBlow.IsImmune( defender ) ) //Does it still do damage? + if ( Server.Items.ParalyzingBlow.IsImmune( defender ) ) //Does it still do damage? { attacker.SendLocalizedMessage( 1070804 ); // Your target resists paralysis. defender.SendLocalizedMessage( 1070813 ); // You resist paralysis. diff --git a/Scripts/Items/Weapons/Abilities/TalonStrike.cs b/Scripts/Items/Weapons/Abilities/TalonStrike.cs index 930e30b76..f91b304cd 100644 --- a/Scripts/Items/Weapons/Abilities/TalonStrike.cs +++ b/Scripts/Items/Weapons/Abilities/TalonStrike.cs @@ -22,7 +22,7 @@ namespace Server.Items public override bool CheckSkills( Mobile from ) { - if( GetSkill( from, SkillName.Ninjitsu ) < 50.0 ) + if ( GetSkill( from, SkillName.Ninjitsu ) < 50.0 ) { from.SendLocalizedMessage( 1063352, "50" ); // You need ~1_SKILL_REQUIREMENT~ Ninjitsu skill to perform that attack! return false; @@ -33,7 +33,7 @@ namespace Server.Items public override void OnHit( Mobile attacker, Mobile defender, int damage ) { - if( Registry.Contains( defender ) || !Validate( attacker ) || !CheckMana( attacker, true ) ) + if ( Registry.Contains( defender ) || !Validate( attacker ) || !CheckMana( attacker, true ) ) return; ClearCurrentAbility( attacker ); @@ -73,7 +73,7 @@ namespace Server.Items protected override void OnTick() { - if( !m_Defender.Alive || m_DamageRemaining <= 0 ) + if ( !m_Defender.Alive || m_DamageRemaining <= 0 ) { Stop(); Server.Items.TalonStrike.Registry.Remove( m_Defender ); @@ -83,19 +83,19 @@ namespace Server.Items m_DamageRemaining -= DamagePerTick; m_DamageToDo += DamagePerTick; - if( m_DamageRemaining <= 0 && m_DamageToDo < 1 ) + if ( m_DamageRemaining <= 0 && m_DamageToDo < 1 ) m_DamageToDo = 1.0; //Confirm this 'round up' at the end int damage = (int)m_DamageToDo; - if( damage > 0 ) + if ( damage > 0 ) { //m_Defender.Damage( damage, m_Attacker, false ); m_Defender.Hits -= damage; //Don't show damage, don't disrupt m_DamageToDo -= damage; } - if( !m_Defender.Alive || m_DamageRemaining <= 0 ) + if ( !m_Defender.Alive || m_DamageRemaining <= 0 ) { Stop(); Server.Items.TalonStrike.Registry.Remove( m_Defender ); diff --git a/Scripts/Items/Weapons/Abilities/WeaponAbility.cs b/Scripts/Items/Weapons/Abilities/WeaponAbility.cs index 3a07ea83d..139f96a17 100644 --- a/Scripts/Items/Weapons/Abilities/WeaponAbility.cs +++ b/Scripts/Items/Weapons/Abilities/WeaponAbility.cs @@ -141,7 +141,7 @@ namespace Server.Items if ( from.Mana < mana ) { - if( ( from is BaseCreature ) && ( from as BaseCreature ).HasManaOveride ) + if ( ( from is BaseCreature ) && ( from as BaseCreature ).HasManaOveride ) { return true; } @@ -176,7 +176,7 @@ namespace Server.Items if ( state == null ) return false; - if( RequiresSE && !state.SupportsExpansion( Expansion.SE ) ) + if ( RequiresSE && !state.SupportsExpansion( Expansion.SE ) ) { from.SendLocalizedMessage( 1063456 ); // You must upgrade to Samurai Empire in order to use that ability. return false; diff --git a/Scripts/Items/Weapons/BaseWeapon.cs b/Scripts/Items/Weapons/BaseWeapon.cs index aac519c99..a9d4de9eb 100644 --- a/Scripts/Items/Weapons/BaseWeapon.cs +++ b/Scripts/Items/Weapons/BaseWeapon.cs @@ -578,9 +578,9 @@ namespace Server.Items if ( !Ethics.Ethic.CheckEquip( from, this ) ) return false; - if( RequiredRace != null && from.Race != RequiredRace ) + if ( RequiredRace != null && from.Race != RequiredRace ) { - if( RequiredRace == Race.Elf ) + if ( RequiredRace == Race.Elf ) from.SendLocalizedMessage( 1072203 ); // Only Elves may use this. else from.SendMessage( "Only {0} may use this.", RequiredRace.PluralName ); @@ -893,15 +893,15 @@ namespace Server.Items // Bonus granted by successful use of Honorable Execution. bonus += HonorableExecution.GetSwingBonus( m ); - if( DualWield.Registry.Contains( m ) ) + if ( DualWield.Registry.Contains( m ) ) bonus += ((DualWield.DualWieldTimer)DualWield.Registry[m]).BonusSwingSpeed; - if( Feint.Registry.Contains( m ) ) + if ( Feint.Registry.Contains( m ) ) bonus -= ((Feint.FeintTimer)Feint.Registry[m]).SwingSpeedReduction; TransformContext context = TransformationSpellHelper.GetContext( m ); - if( context != null && context.Spell is ReaperFormSpell ) + if ( context != null && context.Spell is ReaperFormSpell ) bonus += ((ReaperFormSpell)context.Spell).SwingSpeedBonus; int discordanceEffect = 0; @@ -910,7 +910,7 @@ namespace Server.Items if ( SkillHandlers.Discordance.GetEffect( m, ref discordanceEffect ) ) bonus -= discordanceEffect; - if( EssenceOfWindSpell.IsDebuffed( m ) ) + if ( EssenceOfWindSpell.IsDebuffed( m ) ) bonus -= EssenceOfWindSpell.GetSSIMalus( m ); if ( bonus > 60 ) @@ -985,12 +985,12 @@ namespace Server.Items { WeaponAbility a = WeaponAbility.GetCurrentAbility( attacker ); - if( a != null && !a.OnBeforeSwing( attacker, defender ) ) + if ( a != null && !a.OnBeforeSwing( attacker, defender ) ) WeaponAbility.ClearCurrentAbility( attacker ); SpecialMove move = SpecialMove.GetCurrentMove( attacker ); - if( move != null && !move.OnBeforeSwing( attacker, defender ) ) + if ( move != null && !move.OnBeforeSwing( attacker, defender ) ) SpecialMove.ClearCurrentMove( attacker ); } @@ -1135,22 +1135,22 @@ namespace Server.Items double aosChance = parry / 800.0; // Parry or Bushido over 100 grant a 5% bonus. - if( parry >= 100.0 ) + if ( parry >= 100.0 ) { chance += 0.05; aosChance += 0.05; } - else if( bushido >= 100.0 ) + else if ( bushido >= 100.0 ) { chance += 0.05; } // Evasion grants a variable bonus post ML. 50% prior. - if( Evasion.IsEvading( defender ) ) + if ( Evasion.IsEvading( defender ) ) chance *= Evasion.GetParryScalar( defender ); // Low dexterity lowers the chance. - if( defender.Dex < 80 ) + if ( defender.Dex < 80 ) chance = chance * (20 + defender.Dex) / 100; if ( chance > aosChance ) @@ -1216,15 +1216,15 @@ namespace Server.Items Item armorItem; - if( positionChance < 0.07 ) + if ( positionChance < 0.07 ) armorItem = defender.NeckArmor; - else if( positionChance < 0.14 ) + else if ( positionChance < 0.14 ) armorItem = defender.HandArmor; - else if( positionChance < 0.28 ) + else if ( positionChance < 0.28 ) armorItem = defender.ArmsArmor; - else if( positionChance < 0.43 ) + else if ( positionChance < 0.43 ) armorItem = defender.HeadArmor; - else if( positionChance < 0.65 ) + else if ( positionChance < 0.65 ) armorItem = defender.LegsArmor; else armorItem = defender.ChestArmor; @@ -1251,15 +1251,15 @@ namespace Server.Items Item armorItem; - if( chance < 0.07 ) + if ( chance < 0.07 ) armorItem = defender.NeckArmor; - else if( chance < 0.14 ) + else if ( chance < 0.14 ) armorItem = defender.HandArmor; - else if( chance < 0.28 ) + else if ( chance < 0.28 ) armorItem = defender.ArmsArmor; - else if( chance < 0.43 ) + else if ( chance < 0.43 ) armorItem = defender.HeadArmor; - else if( chance < 0.65 ) + else if ( chance < 0.65 ) armorItem = defender.LegsArmor; else armorItem = defender.ChestArmor; @@ -1402,12 +1402,12 @@ namespace Server.Items WeaponAbility a = WeaponAbility.GetCurrentAbility( attacker ); SpecialMove move = SpecialMove.GetCurrentMove( attacker ); - if( a != null ) + if ( a != null ) { percentageBonus += (int)(a.DamageScalar * 100) - 100; } - if( move != null ) + if ( move != null ) { percentageBonus += (int)(move.GetDamageScalar( attacker, defender ) * 100) - 100; } @@ -1426,11 +1426,9 @@ namespace Server.Items if ( !attacker.Player ) { - if ( defender is PlayerMobile ) + if ( defender is PlayerMobile pm ) { - PlayerMobile pm = (PlayerMobile)defender; - - if( pm.EnemyOfOneType != null && pm.EnemyOfOneType != attacker.GetType() ) + if ( pm.EnemyOfOneType != null && pm.EnemyOfOneType != attacker.GetType() ) { percentageBonus += 100; } @@ -1459,19 +1457,19 @@ namespace Server.Items int packInstinctBonus = GetPackInstinctBonus( attacker, defender ); - if( packInstinctBonus != 0 ) + if ( packInstinctBonus != 0 ) { percentageBonus += packInstinctBonus; } - if( m_InDoubleStrike ) + if ( m_InDoubleStrike ) { percentageBonus -= 10; } TransformContext context = TransformationSpellHelper.GetContext( defender ); - if( (m_Slayer == SlayerName.Silver || m_Slayer2 == SlayerName.Silver) && context != null && context.Spell is NecromancerSpell && context.Type != typeof( HorrificBeastSpell ) ) + if ( (m_Slayer == SlayerName.Silver || m_Slayer2 == SlayerName.Silver) && context != null && context.Spell is NecromancerSpell && context.Type != typeof( HorrificBeastSpell ) ) { // Every necromancer transformation other than horrific beast takes an additional 25% damage percentageBonus += 25; @@ -1481,12 +1479,12 @@ namespace Server.Items { PlayerMobile pmAttacker = (PlayerMobile) attacker; - if( pmAttacker.HonorActive && pmAttacker.InRange( defender, 1 ) ) + if ( pmAttacker.HonorActive && pmAttacker.InRange( defender, 1 ) ) { percentageBonus += 25; } - if( pmAttacker.SentHonorContext != null && pmAttacker.SentHonorContext.Target == defender ) + if ( pmAttacker.SentHonorContext != null && pmAttacker.SentHonorContext.Target == defender ) { percentageBonus += pmAttacker.SentHonorContext.PerfectionDamageBonus; } @@ -1502,11 +1500,11 @@ namespace Server.Items damage = AOS.Scale( damage, 100 + percentageBonus ); #endregion - if ( attacker is BaseCreature ) - ((BaseCreature)attacker).AlterMeleeDamageTo( defender, ref damage ); + BaseCreature bcAtt = attacker as BaseCreature; + BaseCreature bcDef = defender as BaseCreature; - if ( defender is BaseCreature ) - ((BaseCreature)defender).AlterMeleeDamageFrom( attacker, ref damage ); + bcAtt?.AlterMeleeDamageTo( defender, ref damage ); + bcDef?.AlterMeleeDamageFrom( attacker, ref damage ); damage = AbsorbDamage( attacker, defender, damage ); @@ -1531,9 +1529,7 @@ namespace Server.Items if ( Core.ML && this is BaseRanged ) { - BaseQuiver quiver = attacker.FindItemOnLayer( Layer.Cloak ) as BaseQuiver; - - if ( quiver != null ) + if ( attacker.FindItemOnLayer( Layer.Cloak ) is BaseQuiver quiver ) quiver.AlterBowDamage( ref phys, ref fire, ref cold, ref pois, ref nrgy, ref chaos, ref direct ); } @@ -1661,13 +1657,9 @@ namespace Server.Items } } - if ( attacker is VampireBatFamiliar ) + if ( attacker is VampireBatFamiliar bc ) { - BaseCreature bc = (BaseCreature)attacker; - Mobile caster = bc.ControlMaster; - - if ( caster == null ) - caster = bc.SummonMaster; + Mobile caster = bc.ControlMaster ?? bc.SummonMaster; if ( caster != null && caster.Map == bc.Map && caster.InRange( bc, 2 ) ) caster.Hits += damage; @@ -1729,20 +1721,14 @@ namespace Server.Items DoLowerDefense( attacker, defender ); } - if ( attacker is BaseCreature ) - ((BaseCreature)attacker).OnGaveMeleeAttack( defender ); + bcAtt?.OnGaveMeleeAttack( defender ); + bcDef?.OnGotMeleeAttack( attacker ); - if ( defender is BaseCreature ) - ((BaseCreature)defender).OnGotMeleeAttack( attacker ); + a?.OnHit( attacker, defender, damage ); + move?.OnHit( attacker, defender, damage ); - if ( a != null ) - a.OnHit( attacker, defender, damage ); - - if ( move != null ) - move.OnHit( attacker, defender, damage ); - - if ( defender is IHonorTarget && ((IHonorTarget)defender).ReceivedHonorContext != null ) - ((IHonorTarget)defender).ReceivedHonorContext.OnTargetHit( attacker ); + if ( defender is IHonorTarget it ) + it.ReceivedHonorContext?.OnTargetHit( attacker ); if ( !(this is BaseRanged) ) { @@ -1777,7 +1763,7 @@ namespace Server.Items TransformContext context = TransformationSpellHelper.GetContext( attacker ); - if( context != null && context.Spell is ReaperFormSpell ) + if ( context != null && context.Spell is ReaperFormSpell ) damageBonus += ((ReaperFormSpell)context.Spell).SpellDamageBonus; } @@ -1930,11 +1916,11 @@ namespace Server.Items double scalar = Core.ML ? 1.0 : ( 11 - from.GetDistanceToSqrt( m ) ) / 10; double damage = GetBaseDamage( from ); - if(scalar <= 0) + if (scalar <= 0) { continue; } - else if( scalar < 1.0 ) + else if ( scalar < 1.0 ) { damage *= ( 11 - from.GetDistanceToSqrt( m ) ) / 10; } @@ -1952,7 +1938,7 @@ namespace Server.Items SlayerEntry atkSlayer = SlayerGroup.GetEntryByName( atkWeapon.Slayer ); SlayerEntry atkSlayer2 = SlayerGroup.GetEntryByName( atkWeapon.Slayer2 ); - if( atkWeapon is ButchersWarCleaver && TalismanSlayer.Slays( TalismanSlayerName.Bovine, defender ) ) + if ( atkWeapon is ButchersWarCleaver && TalismanSlayer.Slays( TalismanSlayerName.Bovine, defender ) ) return CheckSlayerResult.Slayer; if ( atkSlayer != null && atkSlayer.Slays( defender ) || atkSlayer2 != null && atkSlayer2.Slays( defender ) ) @@ -1967,15 +1953,15 @@ namespace Server.Items { ISlayer defISlayer = Spellbook.FindEquippedSpellbook( defender ); - if( defISlayer == null ) + if ( defISlayer == null ) defISlayer = defender.Weapon as ISlayer; - if( defISlayer != null ) + if ( defISlayer != null ) { SlayerEntry defSlayer = SlayerGroup.GetEntryByName( defISlayer.Slayer ); SlayerEntry defSlayer2 = SlayerGroup.GetEntryByName( defISlayer.Slayer2 ); - if( defSlayer != null && defSlayer.Group.OppositionSuperSlays( attacker ) || defSlayer2 != null && defSlayer2.Group.OppositionSuperSlays( attacker ) ) + if ( defSlayer != null && defSlayer.Group.OppositionSuperSlays( attacker ) || defSlayer2 != null && defSlayer2.Group.OppositionSuperSlays( attacker ) ) return CheckSlayerResult.Opposition; } } @@ -2003,7 +1989,7 @@ namespace Server.Items public virtual void GetDamageTypes( Mobile wielder, out int phys, out int fire, out int cold, out int pois, out int nrgy, out int chaos, out int direct ) { - if( wielder is BaseCreature ) + if ( wielder is BaseCreature ) { BaseCreature bc = (BaseCreature)wielder; @@ -2028,11 +2014,11 @@ namespace Server.Items CraftResourceInfo resInfo = CraftResources.GetInfo( m_Resource ); - if( resInfo != null ) + if ( resInfo != null ) { CraftAttributeInfo attrInfo = resInfo.AttributeInfo; - if( attrInfo != null ) + if ( attrInfo != null ) { int left = phys; @@ -2051,7 +2037,7 @@ namespace Server.Items private int ApplyCraftAttributeElementDamage( int attrDamage, ref int element, int totalRemaining ) { - if( totalRemaining <= 0 ) + if ( totalRemaining <= 0 ) return 0; if ( attrDamage <= 0 ) @@ -2062,7 +2048,7 @@ namespace Server.Items if ( (appliedDamage + element) > 100 ) appliedDamage = 100 - element; - if( appliedDamage > totalRemaining ) + if ( appliedDamage > totalRemaining ) appliedDamage = totalRemaining; element += appliedDamage; @@ -2241,7 +2227,7 @@ namespace Server.Items int damageBonus = AosAttributes.GetValue( attacker, AosAttribute.WeaponDamage ); // Horrific Beast transformation gives a +25% bonus to damage. - if( TransformationSpellHelper.UnderTransformation( attacker, typeof( HorrificBeastSpell ) ) ) + if ( TransformationSpellHelper.UnderTransformation( attacker, typeof( HorrificBeastSpell ) ) ) damageBonus += 25; // Divine Fury gives a +10% bonus to damage. @@ -2593,10 +2579,10 @@ namespace Server.Items if ( GetSaveFlag( flags, SaveFlag.Slayer2 ) ) writer.Write( (int)m_Slayer2 ); - if( GetSaveFlag( flags, SaveFlag.ElementalDamages ) ) + if ( GetSaveFlag( flags, SaveFlag.ElementalDamages ) ) m_AosElementDamages.Serialize( writer ); - if( GetSaveFlag( flags, SaveFlag.EngravedText ) ) + if ( GetSaveFlag( flags, SaveFlag.EngravedText ) ) writer.Write( (string) m_EngravedText ); } @@ -2801,20 +2787,20 @@ namespace Server.Items if ( GetSaveFlag( flags, SaveFlag.PlayerConstructed ) ) m_PlayerConstructed = true; - if( GetSaveFlag( flags, SaveFlag.SkillBonuses ) ) + if ( GetSaveFlag( flags, SaveFlag.SkillBonuses ) ) m_AosSkillBonuses = new AosSkillBonuses( this, reader ); else m_AosSkillBonuses = new AosSkillBonuses( this ); - if( GetSaveFlag( flags, SaveFlag.Slayer2 ) ) + if ( GetSaveFlag( flags, SaveFlag.Slayer2 ) ) m_Slayer2 = (SlayerName)reader.ReadInt(); - if( GetSaveFlag( flags, SaveFlag.ElementalDamages ) ) + if ( GetSaveFlag( flags, SaveFlag.ElementalDamages ) ) m_AosElementDamages = new AosElementAttributes( this, reader ); else m_AosElementDamages = new AosElementAttributes( this ); - if( GetSaveFlag( flags, SaveFlag.EngravedText ) ) + if ( GetSaveFlag( flags, SaveFlag.EngravedText ) ) m_EngravedText = reader.ReadString(); break; @@ -3020,25 +3006,25 @@ namespace Server.Items int currentMax = 50; int hue = 0; - if( pois >= currentMax ) + if ( pois >= currentMax ) { hue = 1267 + (pois - 50) / 10; currentMax = pois; } - if( fire >= currentMax ) + if ( fire >= currentMax ) { hue = 1255 + (fire - 50) / 10; currentMax = fire; } - if( nrgy >= currentMax ) + if ( nrgy >= currentMax ) { hue = 1273 + (nrgy - 50) / 10; currentMax = nrgy; } - if( cold >= currentMax ) + if ( cold >= currentMax ) { hue = 1261 + (cold - 50) / 10; currentMax = cold; @@ -3145,7 +3131,7 @@ namespace Server.Items if ( m_Quality == WeaponQuality.Exceptional ) list.Add( 1060636 ); // exceptional - if( RequiredRace == Race.Elf ) + if ( RequiredRace == Race.Elf ) list.Add( 1075086 ); // Elves Only if ( ArtifactRarity > 0 ) @@ -3157,17 +3143,17 @@ namespace Server.Items if ( m_Poison != null && m_PoisonCharges > 0 ) list.Add( 1062412 + m_Poison.Level, m_PoisonCharges.ToString() ); - if( m_Slayer != SlayerName.None ) + if ( m_Slayer != SlayerName.None ) { SlayerEntry entry = SlayerGroup.GetEntryByName( m_Slayer ); - if( entry != null ) + if ( entry != null ) list.Add( entry.Title ); } - if( m_Slayer2 != SlayerName.None ) + if ( m_Slayer2 != SlayerName.None ) { SlayerEntry entry = SlayerGroup.GetEntryByName( m_Slayer2 ); - if( entry != null ) + if ( entry != null ) list.Add( entry.Title ); } @@ -3396,17 +3382,17 @@ namespace Server.Items if ( m_Identified || from.AccessLevel >= AccessLevel.GameMaster ) { - if( m_Slayer != SlayerName.None ) + if ( m_Slayer != SlayerName.None ) { SlayerEntry entry = SlayerGroup.GetEntryByName( m_Slayer ); - if( entry != null ) + if ( entry != null ) attrs.Add( new EquipInfoAttribute( entry.Title ) ); } - if( m_Slayer2 != SlayerName.None ) + if ( m_Slayer2 != SlayerName.None ) { SlayerEntry entry = SlayerGroup.GetEntryByName( m_Slayer2 ); - if( entry != null ) + if ( entry != null ) attrs.Add( new EquipInfoAttribute( entry.Title ) ); } @@ -3419,7 +3405,7 @@ namespace Server.Items if ( m_AccuracyLevel != WeaponAccuracyLevel.Regular ) attrs.Add( new EquipInfoAttribute( 1038010 + (int)m_AccuracyLevel ) ); } - else if( m_Slayer != SlayerName.None || m_Slayer2 != SlayerName.None || m_DurabilityLevel != WeaponDurabilityLevel.Regular || m_DamageLevel != WeaponDamageLevel.Regular || m_AccuracyLevel != WeaponAccuracyLevel.Regular ) + else if ( m_Slayer != SlayerName.None || m_Slayer2 != SlayerName.None || m_DurabilityLevel != WeaponDurabilityLevel.Regular || m_DamageLevel != WeaponDamageLevel.Regular || m_AccuracyLevel != WeaponAccuracyLevel.Regular ) attrs.Add( new EquipInfoAttribute( 1038000 ) ); // Unidentified if ( m_Poison != null && m_PoisonCharges > 0 ) @@ -3488,7 +3474,7 @@ namespace Server.Items else Attributes.WeaponDamage = 15; - if( Core.ML ) + if ( Core.ML ) { Attributes.WeaponDamage += (int)(from.Skills.ArmsLore.Value / 20); diff --git a/Scripts/Items/Weapons/SlayerGroup.cs b/Scripts/Items/Weapons/SlayerGroup.cs index 16e616ccb..f355f076d 100644 --- a/Scripts/Items/Weapons/SlayerGroup.cs +++ b/Scripts/Items/Weapons/SlayerGroup.cs @@ -100,10 +100,10 @@ namespace Server.Items abyss.Opposition = new SlayerGroup[]{ elemental, fey }; abyss.FoundOn = new Type[]{ typeof( BloodElemental ) }; - if( Core.AOS ) + if ( Core.AOS ) { abyss.Super = new SlayerEntry( SlayerName.Exorcism, typeof( AbysmalHorror ), typeof( ArcaneDaemon ), typeof( Balron ), typeof( BoneDemon ), typeof( ChaosDaemon ), typeof( Daemon ), typeof( SummonedDaemon ), typeof( DemonKnight ), typeof( Devourer ), typeof( EnslavedGargoyle ), typeof( FanDancer ), typeof( FireGargoyle ), typeof( Gargoyle ), typeof( GargoyleDestroyer ), typeof( GargoyleEnforcer ), typeof( Gibberling ), typeof( HordeMinion ), typeof( IceFiend ), typeof( Imp ), typeof( Impaler ), typeof( Moloch ), typeof( Oni ), typeof( Ravager ), typeof( Semidar ), typeof( StoneGargoyle ), typeof( Succubus ), typeof( TsukiWolf ) ); - + abyss.Entries = new SlayerEntry[] { // Daemon Dismissal & Balron Damnation have been removed and moved up to super slayer on OSI. @@ -204,4 +204,4 @@ namespace Server.Items { } } -} \ No newline at end of file +} diff --git a/Scripts/Misc/AOS.cs b/Scripts/Misc/AOS.cs index 0589377fe..bbc76a1d8 100644 --- a/Scripts/Misc/AOS.cs +++ b/Scripts/Misc/AOS.cs @@ -60,13 +60,13 @@ namespace Server public static int Damage( Mobile m, Mobile from, int damage, bool ignoreArmor, int phys, int fire, int cold, int pois, int nrgy, int chaos, int direct, bool keepAlive, bool archer, bool deathStrike ) { - if( m == null || m.Deleted || !m.Alive || damage <= 0 ) + if ( m == null || m.Deleted || !m.Alive || damage <= 0 ) return 0; - if( phys == 0 && fire == 100 && cold == 0 && pois == 0 && nrgy == 0 ) + if ( phys == 0 && fire == 100 && cold == 0 && pois == 0 && nrgy == 0 ) Mobiles.MeerMage.StopEffect( m, true ); - if( !Core.AOS ) + if ( !Core.AOS ) { m.Damage( damage, from ); return damage; @@ -99,7 +99,7 @@ namespace Server int totalDamage; - if( !ignoreArmor ) + if ( !ignoreArmor ) { // Armor Ignore on OSI ignores all defenses, not just physical. int resPhys = m.PhysicalResistance; @@ -124,10 +124,10 @@ namespace Server totalDamage += totalDamage * quiver.DamageIncrease / 100; } - if( totalDamage < 1 ) + if ( totalDamage < 1 ) totalDamage = 1; } - else if( Core.ML && m is PlayerMobile && from is PlayerMobile ) + else if ( Core.ML && m is PlayerMobile && from is PlayerMobile ) { if ( quiver != null ) damage += damage * quiver.DamageIncrease / 100; @@ -146,11 +146,11 @@ namespace Server } #region Dragon Barding - if( (from == null || !from.Player) && m.Player && m.Mount is SwampDragon ) + if ( (from == null || !from.Player) && m.Player && m.Mount is SwampDragon ) { SwampDragon pet = m.Mount as SwampDragon; - if( pet != null && pet.HasBarding ) + if ( pet != null && pet.HasBarding ) { int percent = (pet.BardingExceptional ? 20 : 10); int absorbed = Scale( totalDamage, percent ); @@ -158,7 +158,7 @@ namespace Server totalDamage -= absorbed; pet.BardingHP -= absorbed; - if( pet.BardingHP < 0 ) + if ( pet.BardingHP < 0 ) { pet.HasBarding = false; pet.BardingHP = 0; @@ -169,16 +169,16 @@ namespace Server } #endregion - if( keepAlive && totalDamage > m.Hits ) + if ( keepAlive && totalDamage > m.Hits ) totalDamage = m.Hits; - if( from != null && !from.Deleted && from.Alive ) + if ( from != null && !from.Deleted && from.Alive ) { int reflectPhys = AosAttributes.GetValue( m, AosAttribute.ReflectPhysical ); - if( reflectPhys != 0 ) + if ( reflectPhys != 0 ) { - if( from is ExodusMinion && ((ExodusMinion)from).FieldActive || from is ExodusOverseer && ((ExodusOverseer)from).FieldActive ) + if ( from is ExodusMinion && ((ExodusMinion)from).FieldActive || from is ExodusOverseer && ((ExodusOverseer)from).FieldActive ) { from.FixedParticles( 0x376A, 20, 10, 0x2530, EffectLayer.Waist ); from.PlaySound( 0x2F4 ); @@ -197,7 +197,7 @@ namespace Server public static void Fix( ref int val ) { - if( val < 0 ) + if ( val < 0 ) val = 0; } @@ -279,7 +279,7 @@ namespace Server public static int GetValue( Mobile m, AosAttribute attribute ) { - if( !Core.AOS ) + if ( !Core.AOS ) return 0; List items = m.Items; @@ -289,52 +289,52 @@ namespace Server { Item obj = items[i]; - if( obj is BaseWeapon ) + if ( obj is BaseWeapon ) { AosAttributes attrs = ((BaseWeapon)obj).Attributes; - if( attrs != null ) + if ( attrs != null ) value += attrs[attribute]; - if( attribute == AosAttribute.Luck ) + if ( attribute == AosAttribute.Luck ) value += ((BaseWeapon)obj).GetLuckBonus(); } - else if( obj is BaseArmor ) + else if ( obj is BaseArmor ) { AosAttributes attrs = ((BaseArmor)obj).Attributes; - if( attrs != null ) + if ( attrs != null ) value += attrs[attribute]; - if( attribute == AosAttribute.Luck ) + if ( attribute == AosAttribute.Luck ) value += ((BaseArmor)obj).GetLuckBonus(); } - else if( obj is BaseJewel ) + else if ( obj is BaseJewel ) { AosAttributes attrs = ((BaseJewel)obj).Attributes; - if( attrs != null ) + if ( attrs != null ) value += attrs[attribute]; } - else if( obj is BaseClothing ) + else if ( obj is BaseClothing ) { AosAttributes attrs = ((BaseClothing)obj).Attributes; - if( attrs != null ) + if ( attrs != null ) value += attrs[attribute]; } - else if( obj is Spellbook ) + else if ( obj is Spellbook ) { AosAttributes attrs = ((Spellbook)obj).Attributes; - if( attrs != null ) + if ( attrs != null ) value += attrs[attribute]; } - else if( obj is BaseQuiver ) + else if ( obj is BaseQuiver ) { AosAttributes attrs = ((BaseQuiver)obj).Attributes; - if( attrs != null ) + if ( attrs != null ) value += attrs[attribute]; } else if ( obj is BaseTalisman ) @@ -516,7 +516,7 @@ namespace Server public static int GetValue( Mobile m, AosWeaponAttribute attribute ) { - if( !Core.AOS ) + if ( !Core.AOS ) return 0; List items = m.Items; @@ -526,18 +526,18 @@ namespace Server { Item obj = items[i]; - if( obj is BaseWeapon ) + if ( obj is BaseWeapon ) { AosWeaponAttributes attrs = ((BaseWeapon)obj).WeaponAttributes; - if( attrs != null ) + if ( attrs != null ) value += attrs[attribute]; } else if ( obj is ElvenGlasses ) { AosWeaponAttributes attrs = ((ElvenGlasses)obj).WeaponAttributes; - if( attrs != null ) + if ( attrs != null ) value += attrs[attribute]; } } @@ -660,7 +660,7 @@ namespace Server public static int GetValue( Mobile m, AosArmorAttribute attribute ) { - if( !Core.AOS ) + if ( !Core.AOS ) return 0; List items = m.Items; @@ -670,18 +670,18 @@ namespace Server { Item obj = items[i]; - if( obj is BaseArmor ) + if ( obj is BaseArmor ) { AosArmorAttributes attrs = ((BaseArmor)obj).ArmorAttributes; - if( attrs != null ) + if ( attrs != null ) value += attrs[attribute]; } - else if( obj is BaseClothing ) + else if ( obj is BaseClothing ) { AosArmorAttributes attrs = ((BaseClothing)obj).ClothingAttributes; - if( attrs != null ) + if ( attrs != null ) value += attrs[attribute]; } } @@ -739,7 +739,7 @@ namespace Server SkillName skill; double bonus; - if( !GetValues( i, out skill, out bonus ) ) + if ( !GetValues( i, out skill, out bonus ) ) continue; list.Add( 1060451 + i, "#{0}\t{1}", GetLabel( skill ), bonus ); @@ -766,10 +766,10 @@ namespace Server SkillName skill; double bonus; - if( !GetValues( i, out skill, out bonus ) ) + if ( !GetValues( i, out skill, out bonus ) ) continue; - if( m_Mods == null ) + if ( m_Mods == null ) m_Mods = new List(); SkillMod sk = new DefaultSkillMod( skill, true, bonus ); @@ -781,7 +781,7 @@ namespace Server public void Remove() { - if( m_Mods == null ) + if ( m_Mods == null ) return; for( int i = 0; i < m_Mods.Count; ++i ) { @@ -1083,17 +1083,17 @@ namespace Server public int GetValue( int bitmask ) { - if( !Core.AOS ) + if ( !Core.AOS ) return 0; uint mask = (uint)bitmask; - if( (m_Names & mask) == 0 ) + if ( (m_Names & mask) == 0 ) return 0; int index = GetIndex( mask ); - if( index >= 0 && index < m_Values.Length ) + if ( index >= 0 && index < m_Values.Length ) return m_Values[index]; return 0; @@ -1101,35 +1101,35 @@ namespace Server public void SetValue( int bitmask, int value ) { - if( (bitmask == (int)AosWeaponAttribute.DurabilityBonus) && (this is AosWeaponAttributes) ) + if ( (bitmask == (int)AosWeaponAttribute.DurabilityBonus) && (this is AosWeaponAttributes) ) { - if( m_Owner is BaseWeapon ) + if ( m_Owner is BaseWeapon ) ((BaseWeapon)m_Owner).UnscaleDurability(); } - else if( (bitmask == (int)AosArmorAttribute.DurabilityBonus) && (this is AosArmorAttributes) ) + else if ( (bitmask == (int)AosArmorAttribute.DurabilityBonus) && (this is AosArmorAttributes) ) { - if( m_Owner is BaseArmor ) + if ( m_Owner is BaseArmor ) ((BaseArmor)m_Owner).UnscaleDurability(); - else if( m_Owner is BaseClothing ) + else if ( m_Owner is BaseClothing ) ((BaseClothing)m_Owner).UnscaleDurability(); } uint mask = (uint)bitmask; - if( value != 0 ) + if ( value != 0 ) { - if( (m_Names & mask) != 0 ) + if ( (m_Names & mask) != 0 ) { int index = GetIndex( mask ); - if( index >= 0 && index < m_Values.Length ) + if ( index >= 0 && index < m_Values.Length ) m_Values[index] = value; } else { int index = GetIndex( mask ); - if( index >= 0 && index <= m_Values.Length ) + if ( index >= 0 && index <= m_Values.Length ) { int[] old = m_Values; m_Values = new int[old.Length + 1]; @@ -1146,15 +1146,15 @@ namespace Server } } } - else if( (m_Names & mask) != 0 ) + else if ( (m_Names & mask) != 0 ) { int index = GetIndex( mask ); - if( index >= 0 && index < m_Values.Length ) + if ( index >= 0 && index < m_Values.Length ) { m_Names &= ~mask; - if( m_Values.Length == 1 ) + if ( m_Values.Length == 1 ) { m_Values = m_Empty; } @@ -1172,20 +1172,20 @@ namespace Server } } - if( (bitmask == (int)AosWeaponAttribute.DurabilityBonus) && (this is AosWeaponAttributes) ) + if ( (bitmask == (int)AosWeaponAttribute.DurabilityBonus) && (this is AosWeaponAttributes) ) { - if( m_Owner is BaseWeapon ) + if ( m_Owner is BaseWeapon ) ((BaseWeapon)m_Owner).ScaleDurability(); } - else if( (bitmask == (int)AosArmorAttribute.DurabilityBonus) && (this is AosArmorAttributes) ) + else if ( (bitmask == (int)AosArmorAttribute.DurabilityBonus) && (this is AosArmorAttributes) ) { - if( m_Owner is BaseArmor ) + if ( m_Owner is BaseArmor ) ((BaseArmor)m_Owner).ScaleDurability(); - else if( m_Owner is BaseClothing ) + else if ( m_Owner is BaseClothing ) ((BaseClothing)m_Owner).ScaleDurability(); } - if( m_Owner.Parent is Mobile ) + if ( m_Owner.Parent is Mobile ) { Mobile m = (Mobile)m_Owner.Parent; @@ -1193,7 +1193,7 @@ namespace Server m.UpdateResistances(); m.Delta( MobileDelta.Stat | MobileDelta.WeaponDamage | MobileDelta.Hits | MobileDelta.Stam | MobileDelta.Mana ); - if( this is AosSkillBonuses ) + if ( this is AosSkillBonuses ) { ((AosSkillBonuses)this).Remove(); ((AosSkillBonuses)this).AddTo( m ); @@ -1211,10 +1211,10 @@ namespace Server while( currentBit != mask ) { - if( (ourNames & currentBit) != 0 ) + if ( (ourNames & currentBit) != 0 ) ++index; - if( currentBit == 0x80000000 ) + if ( currentBit == 0x80000000 ) return -1; currentBit <<= 1; diff --git a/Scripts/Misc/AccountPrompt.cs b/Scripts/Misc/AccountPrompt.cs index 791420fc7..adb69c387 100644 --- a/Scripts/Misc/AccountPrompt.cs +++ b/Scripts/Misc/AccountPrompt.cs @@ -13,7 +13,7 @@ namespace Server.Misc Console.WriteLine( "This server has no accounts." ); Console.Write( "Do you want to create the owner account now? (y/n)" ); - if( Console.ReadKey( true ).Key == ConsoleKey.Y ) + if ( Console.ReadKey( true ).Key == ConsoleKey.Y ) { Console.WriteLine(); @@ -37,4 +37,4 @@ namespace Server.Misc } } } -} \ No newline at end of file +} diff --git a/Scripts/Misc/BuffIcons.cs b/Scripts/Misc/BuffIcons.cs index 24fc44106..e0a6dd23d 100644 --- a/Scripts/Misc/BuffIcons.cs +++ b/Scripts/Misc/BuffIcons.cs @@ -12,13 +12,13 @@ namespace Server public static void Initialize() { - if( Enabled ) + if ( Enabled ) { EventSink.ClientVersionReceived += new ClientVersionReceivedHandler( delegate( ClientVersionReceivedArgs args ) { PlayerMobile pm = args.State.Mobile as PlayerMobile; - if( pm != null ) + if ( pm != null ) Timer.DelayCall( TimeSpan.Zero, pm.ResendBuffs ); } ); } @@ -81,7 +81,7 @@ namespace Server { PlayerMobile pm = m as PlayerMobile; - if( pm == null ) + if ( pm == null ) return; pm.RemoveBuff( this ); @@ -152,7 +152,7 @@ namespace Server { PlayerMobile pm = m as PlayerMobile; - if( pm != null ) + if ( pm != null ) pm.AddBuff( b ); } @@ -160,7 +160,7 @@ namespace Server { PlayerMobile pm = m as PlayerMobile; - if( pm != null ) + if ( pm != null ) pm.RemoveBuff( b ); } @@ -168,7 +168,7 @@ namespace Server { PlayerMobile pm = m as PlayerMobile; - if( pm != null ) + if ( pm != null ) pm.RemoveBuff( b ); } #endregion @@ -257,7 +257,7 @@ namespace Server m_Stream.Fill( 4 ); - if( length < TimeSpan.Zero ) + if ( length < TimeSpan.Zero ) length = TimeSpan.Zero; m_Stream.Write( (short)length.TotalSeconds ); //Time in seconds @@ -266,7 +266,7 @@ namespace Server m_Stream.Write( (int)titleCliloc ); m_Stream.Write( (int)secondaryCliloc ); - if( !hasArgs ) + if ( !hasArgs ) { //m_Stream.Fill( 2 ); m_Stream.Fill( 10 ); diff --git a/Scripts/Misc/CharacterCreation.cs b/Scripts/Misc/CharacterCreation.cs index 890625ef2..14313db8a 100644 --- a/Scripts/Misc/CharacterCreation.cs +++ b/Scripts/Misc/CharacterCreation.cs @@ -361,7 +361,7 @@ namespace Server.Misc PlaceItemIn( bank, 18, 124, cont ); - if( Core.SE ) + if ( Core.SE ) { cont = new Bag(); cont.Hue = 0x501; @@ -391,7 +391,7 @@ namespace Server.Misc PlaceItemIn( bank, 58, 124, cont ); } - if( Core.SE ) //This bag came only after SE. + if ( Core.SE ) //This bag came only after SE. { cont = new Bag(); cont.Name = "Bag of Bows"; @@ -407,7 +407,7 @@ namespace Server.Misc { BaseRanged bow = cont.Items[i] as BaseRanged; - if( bow != null ) + if ( bow != null ) { bow.Attributes.WeaponSpeed = 35; bow.Attributes.WeaponDamage = 35; @@ -590,7 +590,7 @@ namespace Server.Misc private static void AddShoes( Mobile m ) { - if( m.Race == Race.Elf ) + if ( m.Race == Race.Elf ) EquipItem( new ElvenBoots(), true ); else EquipItem( new Shoes( Utility.RandomYellowHue() ), true ); @@ -636,7 +636,7 @@ namespace Server.Misc newChar.Female = args.Female; //newChar.Body = newChar.Female ? 0x191 : 0x190; - if( Core.Expansion >= args.Race.RequiredExpansion ) + if ( Core.Expansion >= args.Race.RequiredExpansion ) newChar.Race = args.Race; //Sets body else newChar.Race = Race.DefaultRace; @@ -667,13 +667,13 @@ namespace Server.Misc Race race = newChar.Race; - if( race.ValidateHair( newChar, args.HairID ) ) + if ( race.ValidateHair( newChar, args.HairID ) ) { newChar.HairItemID = args.HairID; newChar.HairHue = race.ClipHairHue( args.HairHue & 0x3FFF ); } - if( race.ValidateFacialHair( newChar, args.BeardID ) ) + if ( race.ValidateFacialHair( newChar, args.BeardID ) ) { newChar.FacialHairItemID = args.BeardID; newChar.FacialHairHue = race.ClipHairHue( args.BeardHue & 0x3FFF ); @@ -686,7 +686,7 @@ namespace Server.Misc AddShoes( newChar ); } - if( TestCenter.Enabled ) + if ( TestCenter.Enabled ) FillBankbox( newChar ); if ( young ) @@ -742,9 +742,9 @@ namespace Server.Misc private static CityInfo GetStartLocation( CharacterCreatedEventArgs args, bool isYoung ) { - if( Core.ML ) + if ( Core.ML ) { - //if( args.State != null && args.State.NewHaven ) + //if ( args.State != null && args.State.NewHaven ) return m_NewHavenInfo; //We don't get the client Version until AFTER Character creation //return args.City; TODO: Uncomment when the old quest system is actually phased out @@ -765,14 +765,14 @@ namespace Server.Misc } else { - useHaven = true; + useHaven = true; new BadStartMessage( m, 1062205 ); /* - * Unfortunately you are playing on a *NON-Age-Of-Shadows* game - * installation and cannot be transported to Malas. - * You will not be able to take your new player quest in Malas - * without an AOS client. You are now being taken to the city of + * Unfortunately you are playing on a *NON-Age-Of-Shadows* game + * installation and cannot be transported to Malas. + * You will not be able to take your new player quest in Malas + * without an AOS client. You are now being taken to the city of * Haven on the Trammel facet. * */ } @@ -795,10 +795,10 @@ namespace Server.Misc new BadStartMessage( m, 1063487 ); /* - * Unfortunately you are playing on a *NON-Samurai-Empire* game - * installation and cannot be transported to Tokuno. - * You will not be able to take your new player quest in Tokuno - * without an SE client. You are now being taken to the city of + * Unfortunately you are playing on a *NON-Samurai-Empire* game + * installation and cannot be transported to Tokuno. + * You will not be able to take your new player quest in Tokuno + * without an SE client. You are now being taken to the city of * Haven on the Trammel facet. * */ } @@ -817,10 +817,10 @@ namespace Server.Misc new BadStartMessage( m, 1063487 ); /* - * Unfortunately you are playing on a *NON-Samurai-Empire* game - * installation and cannot be transported to Tokuno. - * You will not be able to take your new player quest in Tokuno - * without an SE client. You are now being taken to the city of + * Unfortunately you are playing on a *NON-Samurai-Empire* game + * installation and cannot be transported to Tokuno. + * You will not be able to take your new player quest in Tokuno + * without an SE client. You are now being taken to the city of * Haven on the Trammel facet. * */ } @@ -829,7 +829,7 @@ namespace Server.Misc } } - if( useHaven ) + if ( useHaven ) return m_NewHavenInfo; else return args.City; @@ -1151,12 +1151,12 @@ namespace Server.Misc { addSkillItems = false; EquipItem( new Kasa() ); - + int[] hues = new int[] { 0x1A8, 0xEC, 0x99, 0x90, 0xB5, 0x336, 0x89 }; //TODO: Verify that's ALL the hues for that above. EquipItem( new TattsukeHakama( hues[Utility.Random(hues.Length)] ) ); - + EquipItem( new HakamaShita( 0x2C3 ) ); EquipItem( new NinjaTabi( 0x2C3 ) ); @@ -1351,7 +1351,7 @@ namespace Server.Misc EquipItem( new ElvenCompositeLongbow() ); else EquipItem( new Bow() ); - + break; } case SkillName.ArmsLore: @@ -1442,7 +1442,7 @@ namespace Server.Misc } case SkillName.Chivalry: { - if( Core.ML ) + if ( Core.ML ) PackItem( new BookOfChivalry( (ulong)0x3FF ) ); break; @@ -1566,7 +1566,7 @@ namespace Server.Misc { EquipItem( new Circlet() ); - if( m.Female ) + if ( m.Female ) EquipItem( new FemaleElvenRobe( Utility.RandomBlueHue() ) ); else EquipItem( new MaleElvenRobe( Utility.RandomBlueHue() ) ); @@ -1591,7 +1591,7 @@ namespace Server.Misc } case SkillName.Necromancy: { - if( Core.ML ) + if ( Core.ML ) { Container regs = new BagOfNecroReagents( 50 ); @@ -1707,4 +1707,4 @@ namespace Server.Misc } } } -} \ No newline at end of file +} diff --git a/Scripts/Misc/Cleanup.cs b/Scripts/Misc/Cleanup.cs index 292da49a2..7fcae3581 100644 --- a/Scripts/Misc/Cleanup.cs +++ b/Scripts/Misc/Cleanup.cs @@ -84,7 +84,7 @@ namespace Server.Misc items.Add( item ); continue; } - else if( item.Parent == rootMobile ) + else if ( item.Parent == rootMobile ) { hairCleanup.Add( rootMobile ); continue; @@ -167,4 +167,4 @@ namespace Server.Misc return false; } } -} \ No newline at end of file +} diff --git a/Scripts/Misc/ClientVerification.cs b/Scripts/Misc/ClientVerification.cs index 9c6d72189..cc1027f11 100644 --- a/Scripts/Misc/ClientVerification.cs +++ b/Scripts/Misc/ClientVerification.cs @@ -97,11 +97,11 @@ namespace Server.Misc //ClientVersion.Required = null; //Required = new ClientVersion( "6.0.0.0" ); - if( m_DetectClientRequirement ) + if ( m_DetectClientRequirement ) { string path = Core.FindDataFile( "client.exe" ); - if( File.Exists( path ) ) + if ( File.Exists( path ) ) { FileVersionInfo info = FileVersionInfo.GetVersionInfo( path ); @@ -112,7 +112,7 @@ namespace Server.Misc } } - if( Required != null ) + if ( Required != null ) { Utility.PushColor( ConsoleColor.White ); Console.WriteLine( "Restricting client version to {0}. Action to be taken: {1}", Required, m_OldClientResponse ); @@ -129,53 +129,53 @@ namespace Server.Misc if ( state.Mobile == null || state.Mobile.AccessLevel > AccessLevel.Player ) return; - if( Required != null && version < Required && ( m_OldClientResponse == OldClientResponse.Kick ||( m_OldClientResponse == OldClientResponse.LenientKick && (DateTime.UtcNow - state.Mobile.CreationTime) > m_AgeLeniency && state.Mobile is PlayerMobile && ((PlayerMobile)state.Mobile).GameTime > m_GameTimeLeniency ))) + if ( Required != null && version < Required && ( m_OldClientResponse == OldClientResponse.Kick ||( m_OldClientResponse == OldClientResponse.LenientKick && (DateTime.UtcNow - state.Mobile.CreationTime) > m_AgeLeniency && state.Mobile is PlayerMobile && ((PlayerMobile)state.Mobile).GameTime > m_GameTimeLeniency ))) { kickMessage = String.Format( "This server requires your client version be at least {0}.", Required ); } - else if( !AllowGod || !AllowRegular || !AllowUOTD ) + else if ( !AllowGod || !AllowRegular || !AllowUOTD ) { - if( !AllowGod && version.Type == ClientType.God ) + if ( !AllowGod && version.Type == ClientType.God ) kickMessage = "This server does not allow god clients to connect."; - else if( !AllowRegular && version.Type == ClientType.Regular ) + else if ( !AllowRegular && version.Type == ClientType.Regular ) kickMessage = "This server does not allow regular clients to connect."; - else if( !AllowUOTD && state.IsUOTDClient ) + else if ( !AllowUOTD && state.IsUOTDClient ) kickMessage = "This server does not allow UO:TD clients to connect."; - if( !AllowGod && !AllowRegular && !AllowUOTD ) + if ( !AllowGod && !AllowRegular && !AllowUOTD ) { kickMessage = "This server does not allow any clients to connect."; } - else if( AllowGod && !AllowRegular && !AllowUOTD && version.Type != ClientType.God ) + else if ( AllowGod && !AllowRegular && !AllowUOTD && version.Type != ClientType.God ) { kickMessage = "This server requires you to use the god client."; } - else if( kickMessage != null ) + else if ( kickMessage != null ) { - if( AllowRegular && AllowUOTD ) + if ( AllowRegular && AllowUOTD ) kickMessage += " You can use regular or UO:TD clients."; - else if( AllowRegular ) + else if ( AllowRegular ) kickMessage += " You can use regular clients."; - else if( AllowUOTD ) + else if ( AllowUOTD ) kickMessage += " You can use UO:TD clients."; } } - if( kickMessage != null ) + if ( kickMessage != null ) { state.Mobile.SendMessage( 0x22, kickMessage ); state.Mobile.SendMessage( 0x22, "You will be disconnected in {0} seconds.", KickDelay.TotalSeconds ); Timer.DelayCall( KickDelay, delegate { - if( state.Socket != null ) + if ( state.Socket != null ) { Console.WriteLine( "Client: {0}: Disconnecting, bad version", state ); state.Dispose(); } } ); } - else if( Required != null && version < Required ) + else if ( Required != null && version < Required ) { switch( m_OldClientResponse ) { @@ -197,7 +197,7 @@ namespace Server.Misc private static void SendAnnoyGump( Mobile m ) { - if( m.NetState != null && m.NetState.Version < Required ) + if ( m.NetState != null && m.NetState.Version < Required ) { Gump g = new WarningGump( 1060637, 30720, String.Format( "Your client is out of date. Please update your client.
This server recommends that your client version be at least {0}.

You are currently using version {1}.

To patch, run UOPatch.exe inside your Ultima Online folder.", Required, m.NetState.Version ), 0xFFC000, 480, 360, delegate( Mobile mob, bool selection, object o ) @@ -218,4 +218,4 @@ namespace Server.Misc } } } -} \ No newline at end of file +} diff --git a/Scripts/Misc/DataPath.cs b/Scripts/Misc/DataPath.cs index 364a14bf5..3bb08813d 100644 --- a/Scripts/Misc/DataPath.cs +++ b/Scripts/Misc/DataPath.cs @@ -16,7 +16,7 @@ namespace Server.Misc private static string CustomPath = null; /* The following is a list of files which a required for proper execution: - * + * * Multi.idx * Multi.mul * VerData.mul @@ -39,13 +39,13 @@ namespace Server.Misc string pathSA = GetPath( @"Electronic Arts\EA Games\Ultima Online Stygian Abyss Classic", "InstallDir" ); string pathHS = GetPath( @"Electronic Arts\EA Games\Ultima Online Classic", "InstallDir" ); - if ( CustomPath != null ) - Core.DataDirectories.Add( CustomPath ); + if ( CustomPath != null ) + Core.DataDirectories.Add( CustomPath ); - if ( pathUO != null ) - Core.DataDirectories.Add( pathUO ); + if ( pathUO != null ) + Core.DataDirectories.Add( pathUO ); - if ( pathTD != null ) + if ( pathTD != null ) Core.DataDirectories.Add( pathTD ); if ( pathKR != null ) @@ -72,19 +72,19 @@ namespace Server.Misc { string keyString; - if( Core.Is64Bit ) + if ( Core.Is64Bit ) keyString = @"SOFTWARE\Wow6432Node\{0}"; else keyString = @"SOFTWARE\{0}"; using( RegistryKey key = Registry.LocalMachine.OpenSubKey( String.Format( keyString, subName ) ) ) { - if( key == null ) + if ( key == null ) return null; string v = key.GetValue( keyName ) as string; - if( String.IsNullOrEmpty( v ) ) + if ( String.IsNullOrEmpty( v ) ) return null; if ( keyName == "InstallDir" ) @@ -104,4 +104,4 @@ namespace Server.Misc } } } -} \ No newline at end of file +} diff --git a/Scripts/Misc/Guild.cs b/Scripts/Misc/Guild.cs index 842b19262..4a23b45af 100644 --- a/Scripts/Misc/Guild.cs +++ b/Scripts/Misc/Guild.cs @@ -103,11 +103,11 @@ namespace Server.Guilds public void CheckLeader() { - if( m_Leader == null || m_Leader.Disbanded ) + if ( m_Leader == null || m_Leader.Disbanded ) { CalculateAllianceLeader(); - if( m_Leader == null ) + if ( m_Leader == null ) Disband(); } } @@ -121,19 +121,19 @@ namespace Server.Guilds } set { - if( m_Leader != value && value != null ) + if ( m_Leader != value && value != null ) AllianceMessage( 1070765, value.Name ); // Your Alliance is now led by ~1_GUILDNAME~ m_Leader = value; - if( m_Leader == null ) + if ( m_Leader == null ) CalculateAllianceLeader(); } } public bool IsPendingMember( Guild g ) { - if( g.Alliance != this ) + if ( g.Alliance != this ) return false; return m_PendingMembers.Contains( g ); @@ -141,7 +141,7 @@ namespace Server.Guilds public bool IsMember( Guild g ) { - if( g.Alliance != this ) + if ( g.Alliance != this ) return false; return m_Members.Contains( g ); @@ -158,7 +158,7 @@ namespace Server.Guilds leader.Alliance = this; partner.Alliance = this; - if( !m_Alliances.ContainsKey( m_Name.ToLower() ) ) + if ( !m_Alliances.ContainsKey( m_Name.ToLower() ) ) m_Alliances.Add( m_Name.ToLower(), this ); } @@ -172,7 +172,7 @@ namespace Server.Guilds writer.WriteGuildList( m_Members, true ); writer.WriteGuildList( m_PendingMembers, true ); - if( !m_Alliances.ContainsKey( m_Name.ToLower() ) ) + if ( !m_Alliances.ContainsKey( m_Name.ToLower() ) ) m_Alliances.Add( m_Name.ToLower(), this ); } @@ -197,7 +197,7 @@ namespace Server.Guilds public void AddPendingGuild( Guild g ) { - if( g.Alliance != this || m_PendingMembers.Contains( g ) || m_Members.Contains( g ) ) + if ( g.Alliance != this || m_PendingMembers.Contains( g ) || m_Members.Contains( g ) ) return; m_PendingMembers.Add( g ); @@ -205,7 +205,7 @@ namespace Server.Guilds public void TurnToMember( Guild g ) { - if( g.Alliance != this || !m_PendingMembers.Contains( g ) || m_Members.Contains( g ) ) + if ( g.Alliance != this || !m_PendingMembers.Contains( g ) || m_Members.Contains( g ) ) return; g.GuildMessage( 1070760, this.Name ); // Your Guild has joined the ~1_ALLIANCENAME~ Alliance. @@ -218,12 +218,12 @@ namespace Server.Guilds public void RemoveGuild( Guild g ) { - if( m_PendingMembers.Contains( g ) ) + if ( m_PendingMembers.Contains( g ) ) { m_PendingMembers.Remove( g ); } - if( m_Members.Contains( g ) ) //Sanity, just incase someone with a custom script adds a character to BOTH arrays + if ( m_Members.Contains( g ) ) //Sanity, just incase someone with a custom script adds a character to BOTH arrays { m_Members.Remove( g ); g.InvalidateMemberProperties(); @@ -236,19 +236,19 @@ namespace Server.Guilds //to check on OSI: have 3 guilds, make 2 of them a member, one pending. remove one of the memebers. alliance still exist? //ANSWER: NO - if( g == m_Leader ) + if ( g == m_Leader ) { CalculateAllianceLeader(); /* - if( m_Leader == null ) //only when m_members.count < 2 + if ( m_Leader == null ) //only when m_members.count < 2 Disband(); else AllianceMessage( 1070765, m_Leader.Name ); // Your Alliance is now led by ~1_GUILDNAME~ */ } - if( m_Members.Count < 2 ) + if ( m_Members.Count < 2 ) Disband(); } @@ -264,7 +264,7 @@ namespace Server.Guilds m_Alliances.TryGetValue( m_Name.ToLower(), out AllianceInfo aInfo ); - if( aInfo == this ) + if ( aInfo == this ) m_Alliances.Remove( m_Name.ToLower() ); } @@ -353,9 +353,9 @@ namespace Server.Guilds NetState state = m.NetState; - if( state != null ) + if ( state != null ) { - if( p == null ) + if ( p == null ) p = Packet.Acquire( new UnicodeMessage( from.Serial, from.Body, MessageType.Alliance, hue, 3, from.Language, from.Name, text ) ); state.Send( p ); @@ -397,7 +397,7 @@ namespace Server.Guilds public override void OnResponse( NetState sender, RelayInfo info ) { - if( info.ButtonID != 8 ) //So that they can't get to the AdvancedSearch button + if ( info.ButtonID != 8 ) //So that they can't get to the AdvancedSearch button base.OnResponse( sender, info ); } } @@ -514,34 +514,34 @@ namespace Server.Guilds { get { - if( m_Opponent == null || m_Opponent.Disbanded ) + if ( m_Opponent == null || m_Opponent.Disbanded ) return WarStatus.Win; - if( m_Guild == null || m_Guild.Disbanded ) + if ( m_Guild == null || m_Guild.Disbanded ) return WarStatus.Lose; WarDeclaration w = m_Opponent.FindActiveWar( m_Guild ); - if( m_Opponent.FindPendingWar( m_Guild ) != null && m_Guild.FindPendingWar( m_Opponent ) != null ) + if ( m_Opponent.FindPendingWar( m_Guild ) != null && m_Guild.FindPendingWar( m_Opponent ) != null ) return WarStatus.Pending; - if( w == null ) + if ( w == null ) return WarStatus.Win; - if( m_WarLength != TimeSpan.Zero && (m_WarBeginning + m_WarLength) < DateTime.UtcNow ) + if ( m_WarLength != TimeSpan.Zero && (m_WarBeginning + m_WarLength) < DateTime.UtcNow ) { - if( m_Kills > w.m_Kills ) + if ( m_Kills > w.m_Kills ) return WarStatus.Win; - else if( m_Kills < w.m_Kills ) + else if ( m_Kills < w.m_Kills ) return WarStatus.Lose; else return WarStatus.Draw; } - else if( m_MaxKills > 0 ) + else if ( m_MaxKills > 0 ) { - if( m_Kills >= m_MaxKills ) + if ( m_Kills >= m_MaxKills ) return WarStatus.Win; - else if( w.m_Kills >= w.MaxKills ) + else if ( w.m_Kills >= w.MaxKills ) return WarStatus.Lose; } @@ -556,7 +556,7 @@ namespace Server.Guilds public static void Initialize() { - if( Guild.NewGuildSystem ) + if ( Guild.NewGuildSystem ) new WarTimer().Start(); } @@ -592,7 +592,7 @@ namespace Server.Guilds string arg = e.ArgString.Trim(); Mobile from = e.Mobile; - if( arg.Length == 0 ) + if ( arg.Length == 0 ) { e.Mobile.Target = new GuildPropsTarget(); } @@ -602,14 +602,14 @@ namespace Server.Guilds int id; - if( int.TryParse( arg, out id ) ) + if ( int.TryParse( arg, out id ) ) g = Guild.Find( id ) as Guild; - if( g == null ) + if ( g == null ) { g = Guild.FindByAbbrev( arg ) as Guild; - if( g == null ) + if ( g == null ) g = Guild.FindByName( arg ) as Guild; } @@ -632,7 +632,7 @@ namespace Server.Guilds protected override void OnTarget( Mobile from, object o ) { - if( !BaseCommand.IsAccessible( from, o ) ) + if ( !BaseCommand.IsAccessible( from, o ) ) { from.SendMessage( "That is not accessible." ); return; @@ -640,10 +640,10 @@ namespace Server.Guilds Guild g = null; - if( o is Guildstone ) + if ( o is Guildstone ) { Guildstone stone = o as Guildstone; - if( stone.Guild == null || stone.Guild.Disbanded ) + if ( stone.Guild == null || stone.Guild.Disbanded ) { from.SendMessage( "The guild associated with that Guildstone no longer exists" ); return; @@ -651,16 +651,16 @@ namespace Server.Guilds else g = stone.Guild; } - else if( o is Mobile ) + else if ( o is Mobile ) { g = ((Mobile)o).Guild as Guild; } - if( g != null ) + if ( g != null ) { from.SendGump( new PropertiesGump( from, g ) ); - if( NewGuildSystem && from.AccessLevel >= AccessLevel.GameMaster && from is PlayerMobile ) + if ( NewGuildSystem && from.AccessLevel >= AccessLevel.GameMaster && from is PlayerMobile ) from.SendGump( new GuildInfoGump( (PlayerMobile)from, g ) ); } else @@ -675,10 +675,10 @@ namespace Server.Guilds public static void EventSink_GuildGumpRequest( GuildGumpRequestArgs args ) { PlayerMobile pm = args.Mobile as PlayerMobile; - if( !NewGuildSystem || pm == null ) + if ( !NewGuildSystem || pm == null ) return; - if( pm.Guild == null ) + if ( pm.Guild == null ) pm.SendGump( new CreateGuildGump( pm ) ); else pm.SendGump( new GuildInfoGump( pm, pm.Guild as Guild ) ); @@ -705,7 +705,7 @@ namespace Server.Guilds public AllianceInfo Alliance { get{ - if( m_AllianceInfo != null ) + if ( m_AllianceInfo != null ) return m_AllianceInfo; else if ( m_AllianceLeader != null ) return m_AllianceLeader.m_AllianceInfo; @@ -716,18 +716,18 @@ namespace Server.Guilds { AllianceInfo current = this.Alliance; - if( value == current ) + if ( value == current ) return; - if( current != null ) + if ( current != null ) { current.RemoveGuild( this ); } - if( value != null ) + if ( value != null ) { - if( value.Leader == this ) + if ( value.Leader == this ) m_AllianceInfo = value; else m_AllianceLeader = value.Leader; @@ -748,7 +748,7 @@ namespace Server.Guilds get { AllianceInfo al = this.Alliance; - if( al != null ) + if ( al != null ) return al.Name; return null; @@ -762,7 +762,7 @@ namespace Server.Guilds { AllianceInfo al = this.Alliance; - if( al != null ) + if ( al != null ) return al.Leader; return null; @@ -776,7 +776,7 @@ namespace Server.Guilds { AllianceInfo al = this.Alliance; - if( al != null ) + if ( al != null ) return al.IsMember( this ); return false; @@ -790,7 +790,7 @@ namespace Server.Guilds { AllianceInfo al = this.Alliance; - if( al != null ) + if ( al != null ) return al.IsPendingMember( this ); return false; @@ -827,7 +827,7 @@ namespace Server.Guilds { WarDeclaration w = PendingWars[i]; - if( w.Opponent == g ) + if ( w.Opponent == g ) return w; } @@ -840,7 +840,7 @@ namespace Server.Guilds { WarDeclaration w = AcceptedWars[i]; - if( w.Opponent == g ) + if ( w.Opponent == g ) return w; } @@ -856,7 +856,7 @@ namespace Server.Guilds WarStatus status = w.Status; - if( status != WarStatus.InProgress ) + if ( status != WarStatus.InProgress ) { AllianceInfo myAlliance = this.Alliance; bool inAlliance = ( myAlliance != null && myAlliance.IsMember( this ) ); @@ -864,7 +864,7 @@ namespace Server.Guilds AllianceInfo otherAlliance = ((g != null) ? g.Alliance : null); bool otherInAlliance = ( otherAlliance != null && otherAlliance.IsMember( this ) ); - if( inAlliance ) + if ( inAlliance ) { myAlliance.AllianceMessage( 1070739 + (int)status, (g == null) ? "a deleted opponent" : (otherInAlliance ? otherAlliance.Name : g.Name) ); myAlliance.InvalidateMemberProperties(); @@ -877,12 +877,12 @@ namespace Server.Guilds this.AcceptedWars.Remove( w ); - if( g != null ) + if ( g != null ) { - if( status != WarStatus.Draw ) + if ( status != WarStatus.Draw ) status = (WarStatus)((int)status + 1 % 2); - if( otherInAlliance ) + if ( otherInAlliance ) { otherAlliance.AllianceMessage( 1070739 + (int)status, ( inAlliance ? this.Alliance.Name : this.Name ) ); otherAlliance.InvalidateMemberProperties(); @@ -903,12 +903,12 @@ namespace Server.Guilds WarDeclaration w = PendingWars[i]; Guild g = w.Opponent; - if( w.Status != WarStatus.Pending ) + if ( w.Status != WarStatus.Pending ) { //All sanity in here this.PendingWars.Remove( w ); - if( g != null ) + if ( g != null ) { g.PendingWars.Remove( g.FindPendingWar( this ) ); } @@ -923,13 +923,13 @@ namespace Server.Guilds public static void HandleDeath( Mobile victim, Mobile killer ) { - if( !NewGuildSystem ) + if ( !NewGuildSystem ) return; if ( killer == null ) killer = victim.FindMostRecentDamager( false ); - if( killer == null || victim.Guild == null || killer.Guild == null ) + if ( killer == null || victim.Guild == null || killer.Guild == null ) return; Guild victimGuild = GetAllianceLeader( victim.Guild as Guild ); @@ -937,7 +937,7 @@ namespace Server.Guilds WarDeclaration war = killerGuild.FindActiveWar( victimGuild ); - if( war == null ) + if ( war == null ) return; war.Kills++; @@ -1006,7 +1006,7 @@ namespace Server.Guilds AddMember( m_Leader ); - if( m_Leader is PlayerMobile ) + if ( m_Leader is PlayerMobile ) ((PlayerMobile)m_Leader).GuildRank = RankDefinition.Leader; m_AcceptedWars = new List(); @@ -1082,15 +1082,15 @@ namespace Server.Guilds } set { - if( value != null ) + if ( value != null ) this.AddMember( value ); //Also removes from old guild. - if( m_Leader is PlayerMobile && m_Leader.Guild == this ) + if ( m_Leader is PlayerMobile && m_Leader.Guild == this ) ((PlayerMobile)m_Leader).GuildRank = RankDefinition.Member; m_Leader = value; - if( m_Leader is PlayerMobile ) + if ( m_Leader is PlayerMobile ) ((PlayerMobile)m_Leader).GuildRank = RankDefinition.Leader; } } @@ -1120,7 +1120,7 @@ namespace Server.Guilds { m.SendLocalizedMessage( 502131 ); // Your guild has disbanded. - if( m is PlayerMobile ) + if ( m is PlayerMobile ) ((PlayerMobile)m).GuildRank = RankDefinition.Lowest; m.Guild = null; @@ -1154,7 +1154,7 @@ namespace Server.Guilds public bool IsAlly( Guild g ) { - if( NewGuildSystem ) + if ( NewGuildSystem ) { return (Alliance != null && Alliance.IsMember( this ) && Alliance.IsMember( g )); } @@ -1164,7 +1164,7 @@ namespace Server.Guilds public bool IsEnemy( Guild g ) { - if( Type != GuildType.Regular && g.Type != GuildType.Regular && Type != g.Type ) + if ( Type != GuildType.Regular && g.Type != GuildType.Regular && Type != g.Type ) return true; return IsWar( g ); @@ -1172,10 +1172,10 @@ namespace Server.Guilds public bool IsWar( Guild g ) { - if( g == null ) + if ( g == null ) return false; - if( NewGuildSystem ) + if ( NewGuildSystem ) { Guild guild = GetAllianceLeader( this ); Guild otherGuild = GetAllianceLeader( g ); @@ -1198,7 +1198,7 @@ namespace Server.Guilds CheckExpiredWars(); - if( Alliance != null ) + if ( Alliance != null ) Alliance.CheckLeader(); writer.Write( (int) 5 );//version @@ -1224,7 +1224,7 @@ namespace Server.Guilds bool isAllianceLeader = (m_AllianceLeader == null && m_AllianceInfo != null ); writer.Write( isAllianceLeader ); - if( isAllianceLeader ) + if ( isAllianceLeader ) m_AllianceInfo.Serialize( writer ); else writer.Write( m_AllianceLeader ); @@ -1287,7 +1287,7 @@ namespace Server.Guilds bool isAllianceLeader = reader.ReadBool(); - if( isAllianceLeader ) + if ( isAllianceLeader ) m_AllianceInfo = new AllianceInfo( reader ); else m_AllianceLeader = reader.ReadGuild() as Guild; @@ -1324,7 +1324,7 @@ namespace Server.Guilds { m_Leader = reader.ReadMobile(); - if( m_Leader is PlayerMobile ) + if ( m_Leader is PlayerMobile ) ((PlayerMobile)m_Leader).GuildRank = RankDefinition.Leader; m_Name = reader.ReadString(); @@ -1373,19 +1373,19 @@ namespace Server.Guilds private void VerifyGuild_Callback() { - if( (!NewGuildSystem && m_Guildstone == null) || m_Members.Count == 0 ) + if ( (!NewGuildSystem && m_Guildstone == null) || m_Members.Count == 0 ) Disband(); CheckExpiredWars(); AllianceInfo alliance = this.Alliance; - if( alliance != null ) + if ( alliance != null ) alliance.CheckLeader(); alliance = this.Alliance; //CheckLeader could possibly change the value of this.Alliance - if( alliance != null && !alliance.IsMember( this ) && !alliance.IsPendingMember( this ) ) //This block is there to fix a bug in the code in an older version. + if ( alliance != null && !alliance.IsMember( this ) && !alliance.IsPendingMember( this ) ) //This block is there to fix a bug in the code in an older version. this.Alliance = null; //Will call Alliance.RemoveGuild which will set it null & perform all the pertient checks as far as alliacne disbanding } @@ -1403,12 +1403,12 @@ namespace Server.Guilds m_Members.Add( m ); m.Guild = this; - if( !NewGuildSystem ) + if ( !NewGuildSystem ) m.GuildFealty = m_Leader; else m.GuildFealty = null; - if( m is PlayerMobile ) + if ( m is PlayerMobile ) ((PlayerMobile)m).GuildRank = RankDefinition.Lowest; Guild guild = m.Guild as Guild; @@ -1432,10 +1432,10 @@ namespace Server.Guilds m.Guild = null; - if( m is PlayerMobile ) + if ( m is PlayerMobile ) ((PlayerMobile)m).GuildRank = RankDefinition.Lowest; - if( message > 0 ) + if ( message > 0 ) m.SendLocalizedMessage( message ); if ( m == m_Leader ) @@ -1558,9 +1558,9 @@ namespace Server.Guilds NetState state = m.NetState; - if( state != null ) + if ( state != null ) { - if( p == null ) + if ( p == null ) p = Packet.Acquire( new UnicodeMessage( from.Serial, from.Body, MessageType.Guild, hue, 3, from.Language, from.Name, text ) ); state.Send( p ); @@ -1581,10 +1581,10 @@ namespace Server.Guilds #region Voting public bool CanVote( Mobile m ) { - if( NewGuildSystem ) + if ( NewGuildSystem ) { PlayerMobile pm = m as PlayerMobile; - if( pm == null || !pm.GuildRank.GetFlag( RankFlags.CanVote ) ) + if ( pm == null || !pm.GuildRank.GetFlag( RankFlags.CanVote ) ) return false; } @@ -1592,10 +1592,10 @@ namespace Server.Guilds } public bool CanBeVotedFor( Mobile m ) { - if( NewGuildSystem ) + if ( NewGuildSystem ) { PlayerMobile pm = m as PlayerMobile; - if( pm == null || pm.LastOnline + InactiveTime < DateTime.UtcNow ) + if ( pm == null || pm.LastOnline + InactiveTime < DateTime.UtcNow ) return false; } @@ -1617,7 +1617,7 @@ namespace Server.Guilds Mobile m = memb.GuildFealty; - if( !CanBeVotedFor( m ) ) + if ( !CanBeVotedFor( m ) ) { if ( m_Leader != null && !m_Leader.Deleted && m_Leader.Guild == this ) m = m_Leader; @@ -1628,7 +1628,7 @@ namespace Server.Guilds if ( m == null ) continue; - if( !votes.TryGetValue( m, out int v ) ) + if ( !votes.TryGetValue( m, out int v ) ) votes[m] = 1; else votes[m] = v + 1; @@ -1651,7 +1651,7 @@ namespace Server.Guilds } } - if( NewGuildSystem && (highVotes * 100) / Math.Max( votingMembers, 1 ) < MajorityPercentage && m_Leader != null && winner != m_Leader && !m_Leader.Deleted && m_Leader.Guild == this ) + if ( NewGuildSystem && (highVotes * 100) / Math.Max( votingMembers, 1 ) < MajorityPercentage && m_Leader != null && winner != m_Leader && !m_Leader.Deleted && m_Leader.Guild == this ) winner = m_Leader; if ( m_Leader != winner && winner != null ) @@ -1734,7 +1734,7 @@ namespace Server.Guilds InvalidateMemberProperties( true ); - if( m_Guildstone != null ) + if ( m_Guildstone != null ) m_Guildstone.InvalidateProperties(); } } diff --git a/Scripts/Misc/Keywords.cs b/Scripts/Misc/Keywords.cs index b29c3cefd..70bd8a017 100644 --- a/Scripts/Misc/Keywords.cs +++ b/Scripts/Misc/Keywords.cs @@ -33,7 +33,7 @@ namespace Server.Misc } case 0x0032: // *i must consider my sins* { - if( !Core.SE ) + if ( !Core.SE ) { from.SendMessage( "Short Term Murders : {0}", from.ShortTermMurders ); from.SendMessage( "Long Term Murders : {0}", from.Kills ); @@ -57,4 +57,4 @@ namespace Server.Misc } } } -} \ No newline at end of file +} diff --git a/Scripts/Misc/LootPack.cs b/Scripts/Misc/LootPack.cs index 29b7a8dd0..8589ecd56 100644 --- a/Scripts/Misc/LootPack.cs +++ b/Scripts/Misc/LootPack.cs @@ -17,7 +17,7 @@ namespace Server int luck = killer.Luck; PlayerMobile pmKiller = killer as PlayerMobile; - if( pmKiller != null && pmKiller.SentHonorContext != null && pmKiller.SentHonorContext.Target == victim ) + if ( pmKiller != null && pmKiller.SentHonorContext != null && pmKiller.SentHonorContext.Target == victim ) luck += pmKiller.SentHonorContext.PerfectionLuckBonus; if ( luck < 0 ) @@ -78,7 +78,7 @@ namespace Server { checkLuck = false; - if( LootPack.CheckLuck( luckChance ) ) + if ( LootPack.CheckLuck( luckChance ) ) shouldAdd = ( entry.Chance > Utility.Random( 10000 ) ); } @@ -991,4 +991,4 @@ namespace Server m_Bonus = bonus; } } -} \ No newline at end of file +} diff --git a/Scripts/Misc/Notoriety.cs b/Scripts/Misc/Notoriety.cs index 2e4c321a2..2a4390743 100644 --- a/Scripts/Misc/Notoriety.cs +++ b/Scripts/Misc/Notoriety.cs @@ -36,9 +36,9 @@ namespace Server.Misc private static GuildStatus GetGuildStatus( Mobile m ) { - if( m.Guild == null ) + if ( m.Guild == null ) return GuildStatus.None; - else if( ((Guild)m.Guild).Enemies.Count == 0 && m.Guild.Type == GuildType.Regular ) + else if ( ((Guild)m.Guild).Enemies.Count == 0 && m.Guild.Type == GuildType.Regular ) return GuildStatus.Peaceful; return GuildStatus.Waring; @@ -46,7 +46,7 @@ namespace Server.Misc private static bool CheckBeneficialStatus( GuildStatus from, GuildStatus target ) { - if( from == GuildStatus.Waring || target == GuildStatus.Waring ) + if ( from == GuildStatus.Waring || target == GuildStatus.Waring ) return false; return true; @@ -62,58 +62,58 @@ namespace Server.Misc public static bool Mobile_AllowBeneficial( Mobile from, Mobile target ) { - if( from == null || target == null || from.AccessLevel > AccessLevel.Player || target.AccessLevel > AccessLevel.Player ) + if ( from == null || target == null || from.AccessLevel > AccessLevel.Player || target.AccessLevel > AccessLevel.Player ) return true; #region Dueling PlayerMobile pmFrom = from as PlayerMobile; PlayerMobile pmTarg = target as PlayerMobile; - if( pmFrom == null && from is BaseCreature ) + if ( pmFrom == null && from is BaseCreature ) { BaseCreature bcFrom = (BaseCreature)from; - if( bcFrom.Summoned ) + if ( bcFrom.Summoned ) pmFrom = bcFrom.SummonMaster as PlayerMobile; } - if( pmTarg == null && target is BaseCreature ) + if ( pmTarg == null && target is BaseCreature ) { BaseCreature bcTarg = (BaseCreature)target; - if( bcTarg.Summoned ) + if ( bcTarg.Summoned ) pmTarg = bcTarg.SummonMaster as PlayerMobile; } - if( pmFrom != null && pmTarg != null ) + if ( pmFrom != null && pmTarg != null ) { - if( pmFrom.DuelContext != pmTarg.DuelContext && ((pmFrom.DuelContext != null && pmFrom.DuelContext.Started) || (pmTarg.DuelContext != null && pmTarg.DuelContext.Started)) ) + if ( pmFrom.DuelContext != pmTarg.DuelContext && ((pmFrom.DuelContext != null && pmFrom.DuelContext.Started) || (pmTarg.DuelContext != null && pmTarg.DuelContext.Started)) ) return false; - if( pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && ((pmFrom.DuelContext.StartedReadyCountdown && !pmFrom.DuelContext.Started) || pmFrom.DuelContext.Tied || pmFrom.DuelPlayer.Eliminated || pmTarg.DuelPlayer.Eliminated) ) + if ( pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && ((pmFrom.DuelContext.StartedReadyCountdown && !pmFrom.DuelContext.Started) || pmFrom.DuelContext.Tied || pmFrom.DuelPlayer.Eliminated || pmTarg.DuelPlayer.Eliminated) ) return false; - if( pmFrom.DuelPlayer != null && !pmFrom.DuelPlayer.Eliminated && pmFrom.DuelContext != null && pmFrom.DuelContext.IsSuddenDeath ) + if ( pmFrom.DuelPlayer != null && !pmFrom.DuelPlayer.Eliminated && pmFrom.DuelContext != null && pmFrom.DuelContext.IsSuddenDeath ) return false; - if( pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.m_Tournament != null && pmFrom.DuelContext.m_Tournament.IsNotoRestricted && pmFrom.DuelPlayer != null && pmTarg.DuelPlayer != null && pmFrom.DuelPlayer.Participant != pmTarg.DuelPlayer.Participant ) + if ( pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.m_Tournament != null && pmFrom.DuelContext.m_Tournament.IsNotoRestricted && pmFrom.DuelPlayer != null && pmTarg.DuelPlayer != null && pmFrom.DuelPlayer.Participant != pmTarg.DuelPlayer.Participant ) return false; - if( pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.Started ) + if ( pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.Started ) return true; } - if( (pmFrom != null && pmFrom.DuelContext != null && pmFrom.DuelContext.Started) || (pmTarg != null && pmTarg.DuelContext != null && pmTarg.DuelContext.Started) ) + if ( (pmFrom != null && pmFrom.DuelContext != null && pmFrom.DuelContext.Started) || (pmTarg != null && pmTarg.DuelContext != null && pmTarg.DuelContext.Started) ) return false; Engines.ConPVP.SafeZone sz = from.Region.GetRegion( typeof( Engines.ConPVP.SafeZone ) ) as Engines.ConPVP.SafeZone; - if( sz != null /*&& sz.IsDisabled()*/ ) + if ( sz != null /*&& sz.IsDisabled()*/ ) return false; sz = target.Region.GetRegion( typeof( Engines.ConPVP.SafeZone ) ) as Engines.ConPVP.SafeZone; - if( sz != null /*&& sz.IsDisabled()*/ ) + if ( sz != null /*&& sz.IsDisabled()*/ ) return false; #endregion @@ -122,30 +122,30 @@ namespace Server.Misc #region Factions Faction targetFaction = Faction.Find( target, true ); - if( (!Core.ML || map == Faction.Facet) && targetFaction != null ) + if ( (!Core.ML || map == Faction.Facet) && targetFaction != null ) { - if( Faction.Find( from, true ) != targetFaction ) + if ( Faction.Find( from, true ) != targetFaction ) return false; } #endregion - - if( map != null && (map.Rules & MapRules.BeneficialRestrictions) == 0 ) + + if ( map != null && (map.Rules & MapRules.BeneficialRestrictions) == 0 ) return true; // In felucca, anything goes - if( !from.Player ) + if ( !from.Player ) return true; // NPCs have no restrictions - if( target is BaseCreature && !((BaseCreature)target).Controlled ) + if ( target is BaseCreature && !((BaseCreature)target).Controlled ) return false; // Players cannot heal uncontrolled mobiles - if( from is PlayerMobile && ((PlayerMobile)from).Young && (!(target is PlayerMobile) || !((PlayerMobile)target).Young) ) + if ( from is PlayerMobile && ((PlayerMobile)from).Young && (!(target is PlayerMobile) || !((PlayerMobile)target).Young) ) return false; // Young players cannot perform beneficial actions towards older players Guild fromGuild = from.Guild as Guild; Guild targetGuild = target.Guild as Guild; - if( fromGuild != null && targetGuild != null && (targetGuild == fromGuild || fromGuild.IsAlly( targetGuild )) ) + if ( fromGuild != null && targetGuild != null && (targetGuild == fromGuild || fromGuild.IsAlly( targetGuild )) ) return true; // Guild members can be beneficial return CheckBeneficialStatus( GetGuildStatus( from ), GetGuildStatus( target ) ); @@ -153,68 +153,68 @@ namespace Server.Misc public static bool Mobile_AllowHarmful( Mobile from, Mobile target ) { - if( from == null || target == null || from.AccessLevel > AccessLevel.Player || target.AccessLevel > AccessLevel.Player ) + if ( from == null || target == null || from.AccessLevel > AccessLevel.Player || target.AccessLevel > AccessLevel.Player ) return true; #region Dueling PlayerMobile pmFrom = from as PlayerMobile; PlayerMobile pmTarg = target as PlayerMobile; - if( pmFrom == null && from is BaseCreature ) + if ( pmFrom == null && from is BaseCreature ) { BaseCreature bcFrom = (BaseCreature)from; - if( bcFrom.Summoned ) + if ( bcFrom.Summoned ) pmFrom = bcFrom.SummonMaster as PlayerMobile; } - if( pmTarg == null && target is BaseCreature ) + if ( pmTarg == null && target is BaseCreature ) { BaseCreature bcTarg = (BaseCreature)target; - if( bcTarg.Summoned ) + if ( bcTarg.Summoned ) pmTarg = bcTarg.SummonMaster as PlayerMobile; } - if( pmFrom != null && pmTarg != null ) + if ( pmFrom != null && pmTarg != null ) { - if( pmFrom.DuelContext != pmTarg.DuelContext && ((pmFrom.DuelContext != null && pmFrom.DuelContext.Started) || (pmTarg.DuelContext != null && pmTarg.DuelContext.Started)) ) + if ( pmFrom.DuelContext != pmTarg.DuelContext && ((pmFrom.DuelContext != null && pmFrom.DuelContext.Started) || (pmTarg.DuelContext != null && pmTarg.DuelContext.Started)) ) return false; - if( pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && ((pmFrom.DuelContext.StartedReadyCountdown && !pmFrom.DuelContext.Started) || pmFrom.DuelContext.Tied || pmFrom.DuelPlayer.Eliminated || pmTarg.DuelPlayer.Eliminated) ) + if ( pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && ((pmFrom.DuelContext.StartedReadyCountdown && !pmFrom.DuelContext.Started) || pmFrom.DuelContext.Tied || pmFrom.DuelPlayer.Eliminated || pmTarg.DuelPlayer.Eliminated) ) return false; - if( pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.m_Tournament != null && pmFrom.DuelContext.m_Tournament.IsNotoRestricted && pmFrom.DuelPlayer != null && pmTarg.DuelPlayer != null && pmFrom.DuelPlayer.Participant == pmTarg.DuelPlayer.Participant ) + if ( pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.m_Tournament != null && pmFrom.DuelContext.m_Tournament.IsNotoRestricted && pmFrom.DuelPlayer != null && pmTarg.DuelPlayer != null && pmFrom.DuelPlayer.Participant == pmTarg.DuelPlayer.Participant ) return false; - if( pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.Started ) + if ( pmFrom.DuelContext != null && pmFrom.DuelContext == pmTarg.DuelContext && pmFrom.DuelContext.Started ) return true; } - if( (pmFrom != null && pmFrom.DuelContext != null && pmFrom.DuelContext.Started) || (pmTarg != null && pmTarg.DuelContext != null && pmTarg.DuelContext.Started) ) + if ( (pmFrom != null && pmFrom.DuelContext != null && pmFrom.DuelContext.Started) || (pmTarg != null && pmTarg.DuelContext != null && pmTarg.DuelContext.Started) ) return false; Engines.ConPVP.SafeZone sz = from.Region.GetRegion( typeof( Engines.ConPVP.SafeZone ) ) as Engines.ConPVP.SafeZone; - if( sz != null /*&& sz.IsDisabled()*/ ) + if ( sz != null /*&& sz.IsDisabled()*/ ) return false; sz = target.Region.GetRegion( typeof( Engines.ConPVP.SafeZone ) ) as Engines.ConPVP.SafeZone; - if( sz != null /*&& sz.IsDisabled()*/ ) + if ( sz != null /*&& sz.IsDisabled()*/ ) return false; #endregion Map map = from.Map; - if( map != null && (map.Rules & MapRules.HarmfulRestrictions) == 0 ) + if ( map != null && (map.Rules & MapRules.HarmfulRestrictions) == 0 ) return true; // In felucca, anything goes BaseCreature bc = from as BaseCreature; - if( !from.Player && !(bc != null && bc.GetMaster() != null && bc.GetMaster().AccessLevel == AccessLevel.Player ) ) + if ( !from.Player && !(bc != null && bc.GetMaster() != null && bc.GetMaster().AccessLevel == AccessLevel.Player ) ) { - if( !CheckAggressor( from.Aggressors, target ) && !CheckAggressed( from.Aggressed, target ) && target is PlayerMobile && ((PlayerMobile)target).CheckYoungProtection( from ) ) + if ( !CheckAggressor( from.Aggressors, target ) && !CheckAggressed( from.Aggressed, target ) && target is PlayerMobile && ((PlayerMobile)target).CheckYoungProtection( from ) ) return false; return true; // Uncontrolled NPCs are only restricted by the young system @@ -223,18 +223,18 @@ namespace Server.Misc Guild fromGuild = GetGuildFor( from.Guild as Guild, from ); Guild targetGuild = GetGuildFor( target.Guild as Guild, target ); - if( fromGuild != null && targetGuild != null && (fromGuild == targetGuild || fromGuild.IsAlly( targetGuild ) || fromGuild.IsEnemy( targetGuild )) ) + if ( fromGuild != null && targetGuild != null && (fromGuild == targetGuild || fromGuild.IsAlly( targetGuild ) || fromGuild.IsEnemy( targetGuild )) ) return true; // Guild allies or enemies can be harmful - if( target is BaseCreature && (((BaseCreature)target).Controlled || (((BaseCreature)target).Summoned && from != ((BaseCreature)target).SummonMaster)) ) + if ( target is BaseCreature && (((BaseCreature)target).Controlled || (((BaseCreature)target).Summoned && from != ((BaseCreature)target).SummonMaster)) ) return false; // Cannot harm other controlled mobiles - if( target.Player ) + if ( target.Player ) return false; // Cannot harm other players - if( !(target is BaseCreature && ((BaseCreature)target).InitialInnocent) ) + if ( !(target is BaseCreature && ((BaseCreature)target).InitialInnocent) ) { - if( Notoriety.Compute( from, target ) == Notoriety.Innocent ) + if ( Notoriety.Compute( from, target ) == Notoriety.Innocent ) return false; // Cannot harm innocent mobiles } @@ -247,13 +247,13 @@ namespace Server.Misc BaseCreature c = m as BaseCreature; - if( c != null && c.Controlled && c.ControlMaster != null ) + if ( c != null && c.Controlled && c.ControlMaster != null ) { c.DisplayGuildTitle = false; - if( c.Map != Map.Internal && (Core.AOS || Guild.NewGuildSystem || c.ControlOrder == OrderType.Attack || c.ControlOrder == OrderType.Guard) ) + if ( c.Map != Map.Internal && (Core.AOS || Guild.NewGuildSystem || c.ControlOrder == OrderType.Attack || c.ControlOrder == OrderType.Guard) ) g = (Guild)(c.Guild = c.ControlMaster.Guild); - else if( c.Map == Map.Internal || c.ControlMaster.Guild == null ) + else if ( c.Map == Map.Internal || c.ControlMaster.Guild == null ) g = (Guild)(c.Guild = null); } @@ -262,41 +262,41 @@ namespace Server.Misc public static int CorpseNotoriety( Mobile source, Corpse target ) { - if( target.AccessLevel > AccessLevel.Player ) + if ( target.AccessLevel > AccessLevel.Player ) return Notoriety.CanBeAttacked; Body body = (Body)target.Amount; BaseCreature cretOwner = target.Owner as BaseCreature; - if( cretOwner != null ) + if ( cretOwner != null ) { Guild sourceGuild = GetGuildFor( source.Guild as Guild, source ); Guild targetGuild = GetGuildFor( target.Guild as Guild, target.Owner ); - if( sourceGuild != null && targetGuild != null ) + if ( sourceGuild != null && targetGuild != null ) { - if( sourceGuild == targetGuild || sourceGuild.IsAlly( targetGuild ) ) + if ( sourceGuild == targetGuild || sourceGuild.IsAlly( targetGuild ) ) return Notoriety.Ally; - else if( sourceGuild.IsEnemy( targetGuild ) ) + else if ( sourceGuild.IsEnemy( targetGuild ) ) return Notoriety.Enemy; } Faction srcFaction = Faction.Find( source, true, true ); Faction trgFaction = Faction.Find( target.Owner, true, true ); - if( srcFaction != null && trgFaction != null && srcFaction != trgFaction && source.Map == Faction.Facet ) + if ( srcFaction != null && trgFaction != null && srcFaction != trgFaction && source.Map == Faction.Facet ) return Notoriety.Enemy; - if( CheckHouseFlag( source, target.Owner, target.Location, target.Map ) ) + if ( CheckHouseFlag( source, target.Owner, target.Location, target.Map ) ) return Notoriety.CanBeAttacked; int actual = Notoriety.CanBeAttacked; - if( target.Kills >= 5 || (body.IsMonster && IsSummoned( target.Owner as BaseCreature )) || (target.Owner is BaseCreature && (((BaseCreature)target.Owner).AlwaysMurderer || ((BaseCreature)target.Owner).IsAnimatedDead)) ) + if ( target.Kills >= 5 || (body.IsMonster && IsSummoned( target.Owner as BaseCreature )) || (target.Owner is BaseCreature && (((BaseCreature)target.Owner).AlwaysMurderer || ((BaseCreature)target.Owner).IsAnimatedDead)) ) actual = Notoriety.Murderer; - if( DateTime.UtcNow >= (target.TimeOfDeath + Corpse.MonsterLootRightSacrifice) ) + if ( DateTime.UtcNow >= (target.TimeOfDeath + Corpse.MonsterLootRightSacrifice) ) return actual; Party sourceParty = Party.Get( source ); @@ -305,7 +305,7 @@ namespace Server.Misc for( int i = 0; i < list.Count; ++i ) { - if( list[i] == source || (sourceParty != null && Party.Get( list[i] ) == sourceParty) ) + if ( list[i] == source || (sourceParty != null && Party.Get( list[i] ) == sourceParty) ) return actual; } @@ -313,7 +313,7 @@ namespace Server.Misc } else { - if( target.Kills >= 5 || (body.IsMonster && IsSummoned( target.Owner as BaseCreature )) || (target.Owner is BaseCreature && (((BaseCreature)target.Owner).AlwaysMurderer || ((BaseCreature)target.Owner).IsAnimatedDead)) ) + if ( target.Kills >= 5 || (body.IsMonster && IsSummoned( target.Owner as BaseCreature )) || (target.Owner is BaseCreature && (((BaseCreature)target.Owner).AlwaysMurderer || ((BaseCreature)target.Owner).IsAnimatedDead)) ) return Notoriety.Murderer; if (target.Criminal && target.Map != null && ((target.Map.Rules & MapRules.HarmfulRestrictions) == 0)) @@ -322,42 +322,42 @@ namespace Server.Misc Guild sourceGuild = GetGuildFor( source.Guild as Guild, source ); Guild targetGuild = GetGuildFor( target.Guild as Guild, target.Owner ); - if( sourceGuild != null && targetGuild != null ) + if ( sourceGuild != null && targetGuild != null ) { - if( sourceGuild == targetGuild || sourceGuild.IsAlly( targetGuild ) ) + if ( sourceGuild == targetGuild || sourceGuild.IsAlly( targetGuild ) ) return Notoriety.Ally; - else if( sourceGuild.IsEnemy( targetGuild ) ) + else if ( sourceGuild.IsEnemy( targetGuild ) ) return Notoriety.Enemy; } Faction srcFaction = Faction.Find( source, true, true ); Faction trgFaction = Faction.Find( target.Owner, true, true ); - if( srcFaction != null && trgFaction != null && srcFaction != trgFaction && source.Map == Faction.Facet ) + if ( srcFaction != null && trgFaction != null && srcFaction != trgFaction && source.Map == Faction.Facet ) { List secondList = target.Aggressors; for( int i = 0; i < secondList.Count; ++i ) { - if( secondList[i] == source || secondList[i] is BaseFactionGuard ) + if ( secondList[i] == source || secondList[i] is BaseFactionGuard ) return Notoriety.Enemy; } } - if( target.Owner != null && target.Owner is BaseCreature && ((BaseCreature)target.Owner).AlwaysAttackable ) + if ( target.Owner != null && target.Owner is BaseCreature && ((BaseCreature)target.Owner).AlwaysAttackable ) return Notoriety.CanBeAttacked; - if( CheckHouseFlag( source, target.Owner, target.Location, target.Map ) ) + if ( CheckHouseFlag( source, target.Owner, target.Location, target.Map ) ) return Notoriety.CanBeAttacked; - if( !(target.Owner is PlayerMobile) && !IsPet( target.Owner as BaseCreature ) ) + if ( !(target.Owner is PlayerMobile) && !IsPet( target.Owner as BaseCreature ) ) return Notoriety.CanBeAttacked; List list = target.Aggressors; for( int i = 0; i < list.Count; ++i ) { - if( list[i] == source ) + if ( list[i] == source ) return Notoriety.CanBeAttacked; } @@ -373,20 +373,20 @@ namespace Server.Misc return Notoriety.Invulnerable; #region Dueling - if( source is PlayerMobile && target is PlayerMobile ) + if ( source is PlayerMobile && target is PlayerMobile ) { PlayerMobile pmFrom = (PlayerMobile)source; PlayerMobile pmTarg = (PlayerMobile)target; - if( pmFrom.DuelContext != null && pmFrom.DuelContext.StartedBeginCountdown && !pmFrom.DuelContext.Finished && pmFrom.DuelContext == pmTarg.DuelContext ) + if ( pmFrom.DuelContext != null && pmFrom.DuelContext.StartedBeginCountdown && !pmFrom.DuelContext.Finished && pmFrom.DuelContext == pmTarg.DuelContext ) return pmFrom.DuelContext.IsAlly( pmFrom, pmTarg ) ? Notoriety.Ally : Notoriety.Enemy; } #endregion - if( target.AccessLevel > AccessLevel.Player ) + if ( target.AccessLevel > AccessLevel.Player ) return Notoriety.CanBeAttacked; - if( source.Player && !target.Player && source is PlayerMobile && target is BaseCreature ) + if ( source.Player && !target.Player && source is PlayerMobile && target is BaseCreature ) { BaseCreature bc = (BaseCreature)target; @@ -405,69 +405,69 @@ namespace Server.Misc return MobileNotoriety( source, master ); } - if( !bc.Summoned && !bc.Controlled && ((PlayerMobile)source).EnemyOfOneType == target.GetType() ) + if ( !bc.Summoned && !bc.Controlled && ((PlayerMobile)source).EnemyOfOneType == target.GetType() ) return Notoriety.Enemy; } if ( target.Kills >= 5 || ( target.Body.IsMonster && IsSummoned( target as BaseCreature ) && !( target is BaseFamiliar ) && !( target is ArcaneFey ) && !( target is Golem ) ) || ( target is BaseCreature && ( ( (BaseCreature)target ).AlwaysMurderer || ( (BaseCreature)target ).IsAnimatedDead ) ) ) return Notoriety.Murderer; - if( target.Criminal ) + if ( target.Criminal ) return Notoriety.Criminal; Guild sourceGuild = GetGuildFor( source.Guild as Guild, source ); Guild targetGuild = GetGuildFor( target.Guild as Guild, target ); - if( sourceGuild != null && targetGuild != null ) + if ( sourceGuild != null && targetGuild != null ) { - if( sourceGuild == targetGuild || sourceGuild.IsAlly( targetGuild ) ) + if ( sourceGuild == targetGuild || sourceGuild.IsAlly( targetGuild ) ) return Notoriety.Ally; - else if( sourceGuild.IsEnemy( targetGuild ) ) + else if ( sourceGuild.IsEnemy( targetGuild ) ) return Notoriety.Enemy; } Faction srcFaction = Faction.Find( source, true, true ); Faction trgFaction = Faction.Find( target, true, true ); - if( srcFaction != null && trgFaction != null && srcFaction != trgFaction && source.Map == Faction.Facet ) + if ( srcFaction != null && trgFaction != null && srcFaction != trgFaction && source.Map == Faction.Facet ) return Notoriety.Enemy; - if( SkillHandlers.Stealing.ClassicMode && target is PlayerMobile && ((PlayerMobile)target).PermaFlags.Contains( source ) ) + if ( SkillHandlers.Stealing.ClassicMode && target is PlayerMobile && ((PlayerMobile)target).PermaFlags.Contains( source ) ) return Notoriety.CanBeAttacked; - if( target is BaseCreature && ((BaseCreature)target).AlwaysAttackable ) + if ( target is BaseCreature && ((BaseCreature)target).AlwaysAttackable ) return Notoriety.CanBeAttacked; - if( CheckHouseFlag( source, target, target.Location, target.Map ) ) + if ( CheckHouseFlag( source, target, target.Location, target.Map ) ) return Notoriety.CanBeAttacked; - if( !(target is BaseCreature && ((BaseCreature)target).InitialInnocent) ) //If Target is NOT A baseCreature, OR it's a BC and the BC is initial innocent... + if ( !(target is BaseCreature && ((BaseCreature)target).InitialInnocent) ) //If Target is NOT A baseCreature, OR it's a BC and the BC is initial innocent... { - if( !target.Body.IsHuman && !target.Body.IsGhost && !IsPet( target as BaseCreature ) && !(target is PlayerMobile) || !Core.ML && !target.CanBeginAction( typeof( Server.Spells.Seventh.PolymorphSpell ) ) ) + if ( !target.Body.IsHuman && !target.Body.IsGhost && !IsPet( target as BaseCreature ) && !(target is PlayerMobile) || !Core.ML && !target.CanBeginAction( typeof( Server.Spells.Seventh.PolymorphSpell ) ) ) return Notoriety.CanBeAttacked; } - if( CheckAggressor( source.Aggressors, target ) ) + if ( CheckAggressor( source.Aggressors, target ) ) return Notoriety.CanBeAttacked; - if( CheckAggressed( source.Aggressed, target ) ) + if ( CheckAggressed( source.Aggressed, target ) ) return Notoriety.CanBeAttacked; - if( target is BaseCreature ) + if ( target is BaseCreature ) { BaseCreature bc = (BaseCreature)target; - if( bc.Controlled && bc.ControlOrder == OrderType.Guard && bc.ControlTarget == source ) + if ( bc.Controlled && bc.ControlOrder == OrderType.Guard && bc.ControlTarget == source ) return Notoriety.CanBeAttacked; } - if( source is BaseCreature ) + if ( source is BaseCreature ) { BaseCreature bc = (BaseCreature)source; Mobile master = bc.GetMaster(); - if( master != null ) - if( CheckAggressor( master.Aggressors, target ) || MobileNotoriety( master, target ) == Notoriety.CanBeAttacked || target is BaseCreature ) + if ( master != null ) + if ( CheckAggressor( master.Aggressors, target ) || MobileNotoriety( master, target ) == Notoriety.CanBeAttacked || target is BaseCreature ) return Notoriety.CanBeAttacked; } @@ -478,15 +478,15 @@ namespace Server.Misc { BaseHouse house = BaseHouse.FindHouseAt( p, map, 16 ); - if( house == null || house.Public || !house.IsFriend( from ) ) + if ( house == null || house.Public || !house.IsFriend( from ) ) return false; - if( m != null && house.IsFriend( m ) ) + if ( m != null && house.IsFriend( m ) ) return false; BaseCreature c = m as BaseCreature; - if( c != null && !c.Deleted && c.Controlled && c.ControlMaster != null ) + if ( c != null && !c.Deleted && c.Controlled && c.ControlMaster != null ) return !house.IsFriend( c.ControlMaster ); return true; @@ -505,7 +505,7 @@ namespace Server.Misc public static bool CheckAggressor( List list, Mobile target ) { for( int i = 0; i < list.Count; ++i ) - if( list[i].Attacker == target ) + if ( list[i].Attacker == target ) return true; return false; @@ -517,11 +517,11 @@ namespace Server.Misc { AggressorInfo info = list[i]; - if( !info.CriminalAggression && info.Defender == target ) + if ( !info.CriminalAggression && info.Defender == target ) return true; } return false; } } -} \ No newline at end of file +} diff --git a/Scripts/Misc/RaceDefinitions.cs b/Scripts/Misc/RaceDefinitions.cs index 33bdc3208..a84e50a27 100644 --- a/Scripts/Misc/RaceDefinitions.cs +++ b/Scripts/Misc/RaceDefinitions.cs @@ -8,7 +8,7 @@ namespace Server.Misc public static void Configure() { /* Here we configure all races. Some notes: - * + * * 1) The first 32 races are reserved for core use. * 2) Race 0x7F is reserved for core use. * 3) Race 0xFF is reserved for core use. @@ -35,16 +35,16 @@ namespace Server.Misc public override bool ValidateHair( bool female, int itemID ) { - if( itemID == 0 ) + if ( itemID == 0 ) return true; - if( (female && itemID == 0x2048) || (!female && itemID == 0x2046 ) ) + if ( (female && itemID == 0x2048) || (!female && itemID == 0x2046 ) ) return false; //Buns & Receeding Hair - if( itemID >= 0x203B && itemID <= 0x203D ) + if ( itemID >= 0x203B && itemID <= 0x203D ) return true; - if( itemID >= 0x2044 && itemID <= 0x204A ) + if ( itemID >= 0x2044 && itemID <= 0x204A ) return true; return false; @@ -68,16 +68,16 @@ namespace Server.Misc public override bool ValidateFacialHair( bool female, int itemID ) { - if( itemID == 0 ) + if ( itemID == 0 ) return true; - if( female ) + if ( female ) return false; - if( itemID >= 0x203E && itemID <= 0x2041 ) + if ( itemID >= 0x203E && itemID <= 0x2041 ) return true; - if( itemID >= 0x204B && itemID <= 0x204D ) + if ( itemID >= 0x204B && itemID <= 0x204D ) return true; return false; @@ -85,7 +85,7 @@ namespace Server.Misc public override int RandomFacialHair( bool female ) { - if( female ) + if ( female ) return 0; int rand = Utility.Random( 7 ); @@ -95,9 +95,9 @@ namespace Server.Misc public override int ClipSkinHue( int hue ) { - if( hue < 1002 ) + if ( hue < 1002 ) return 1002; - else if( hue > 1058 ) + else if ( hue > 1058 ) return 1058; else return hue; @@ -110,9 +110,9 @@ namespace Server.Misc public override int ClipHairHue( int hue ) { - if( hue < 1102 ) + if ( hue < 1102 ) return 1102; - else if( hue > 1149 ) + else if ( hue > 1149 ) return 1149; else return hue; @@ -152,16 +152,16 @@ namespace Server.Misc public override bool ValidateHair( bool female, int itemID ) { - if( itemID == 0 ) + if ( itemID == 0 ) return true; - if( (female && (itemID == 0x2FCD || itemID == 0x2FBF)) || (!female && (itemID == 0x2FCC || itemID == 0x2FD0)) ) + if ( (female && (itemID == 0x2FCD || itemID == 0x2FBF)) || (!female && (itemID == 0x2FCC || itemID == 0x2FD0)) ) return false; - if( itemID >= 0x2FBF && itemID <= 0x2FC2 ) + if ( itemID >= 0x2FBF && itemID <= 0x2FC2 ) return true; - if( itemID >= 0x2FCC && itemID <= 0x2FD1 ) + if ( itemID >= 0x2FCC && itemID <= 0x2FD1 ) return true; return false; @@ -195,7 +195,7 @@ namespace Server.Misc public override int ClipSkinHue( int hue ) { for( int i = 0; i < m_SkinHues.Length; i++ ) - if( m_SkinHues[i] == hue ) + if ( m_SkinHues[i] == hue ) return hue; return m_SkinHues[0]; @@ -209,7 +209,7 @@ namespace Server.Misc public override int ClipHairHue( int hue ) { for( int i = 0; i < m_HairHues.Length; i++ ) - if( m_HairHues[i] == hue ) + if ( m_HairHues[i] == hue ) return hue; return m_HairHues[0]; diff --git a/Scripts/Misc/RegenRates.cs b/Scripts/Misc/RegenRates.cs index 5d34f1883..cc383e7b3 100644 --- a/Scripts/Misc/RegenRates.cs +++ b/Scripts/Misc/RegenRates.cs @@ -60,13 +60,13 @@ namespace Server.Misc if ( (from is BaseCreature && ((BaseCreature)from).IsParagon) || from is Leviathan ) points += 40; - if( Core.ML && from.Race == Race.Human ) //Is this affected by the cap? + if ( Core.ML && from.Race == Race.Human ) //Is this affected by the cap? points += 2; if ( points < 0 ) points = 0; - if( Core.ML && from is PlayerMobile ) //does racial bonus go before/after? + if ( Core.ML && from is PlayerMobile ) //does racial bonus go before/after? points = Math.Min( points, 18 ); if ( CheckTransform( from, typeof( HorrificBeastSpell ) ) ) @@ -87,7 +87,7 @@ namespace Server.Misc int points =(int)(from.Skills[SkillName.Focus].Value * 0.1); - if( (from is BaseCreature && ((BaseCreature)from).IsParagon) || from is Leviathan ) + if ( (from is BaseCreature && ((BaseCreature)from).IsParagon) || from is Leviathan ) points += 40; int cappedPoints = AosAttributes.GetValue( from, AosAttribute.RegenStam ); @@ -98,7 +98,7 @@ namespace Server.Misc if ( CheckAnimal( from, typeof( Kirin ) ) ) cappedPoints += 20; - if( Core.ML && from is PlayerMobile ) + if ( Core.ML && from is PlayerMobile ) cappedPoints = Math.Min( cappedPoints, 24 ); points += cappedPoints; @@ -135,7 +135,7 @@ namespace Server.Misc double totalPoints = focusPoints + medPoints + (from.Meditating ? (medPoints > 13.0 ? 13.0 : medPoints) : 0.0); - if( (from is BaseCreature && ((BaseCreature)from).IsParagon) || from is Leviathan ) + if ( (from is BaseCreature && ((BaseCreature)from).IsParagon) || from is Leviathan ) totalPoints += 40; int cappedPoints = AosAttributes.GetValue( from, AosAttribute.RegenMana ); @@ -145,7 +145,7 @@ namespace Server.Misc else if ( CheckTransform( from, typeof( LichFormSpell ) ) ) cappedPoints += 13; - if( Core.ML && from is PlayerMobile ) + if ( Core.ML && from is PlayerMobile ) cappedPoints = Math.Min( cappedPoints, 18 ); totalPoints += cappedPoints; @@ -216,4 +216,4 @@ namespace Server.Misc } } } -} \ No newline at end of file +} diff --git a/Scripts/Misc/RenameRequests.cs b/Scripts/Misc/RenameRequests.cs index c6cb691a6..f1d7ebd25 100644 --- a/Scripts/Misc/RenameRequests.cs +++ b/Scripts/Misc/RenameRequests.cs @@ -20,16 +20,16 @@ namespace Server.Misc { name = name.Trim(); - if( NameVerification.Validate( name, 1, 16, true, false, true, 0, NameVerification.Empty, NameVerification.StartDisallowed, ( Core.ML ? NameVerification.Disallowed : new string[]{} ) ) ) + if ( NameVerification.Validate( name, 1, 16, true, false, true, 0, NameVerification.Empty, NameVerification.StartDisallowed, ( Core.ML ? NameVerification.Disallowed : new string[]{} ) ) ) { - if( Core.ML ) + if ( Core.ML ) { string[] disallowed = ProfanityProtection.Disallowed; for( int i = 0; i < disallowed.Length; i++ ) { - if( name.IndexOf( disallowed[i] ) != -1 ) + if ( name.IndexOf( disallowed[i] ) != -1 ) { from.SendLocalizedMessage( 1072622 ); // That name isn't very polite. return; @@ -48,4 +48,4 @@ namespace Server.Misc } } } -} \ No newline at end of file +} diff --git a/Scripts/Misc/SkillCheck.cs b/Scripts/Misc/SkillCheck.cs index 7dc2dba1c..e64600cbb 100644 --- a/Scripts/Misc/SkillCheck.cs +++ b/Scripts/Misc/SkillCheck.cs @@ -348,7 +348,7 @@ namespace Server.Misc if ( (from.LastStrGain + m_PetStatGainDelay) >= DateTime.UtcNow ) return; } - else if( (from.LastStrGain + m_StatGainDelay) >= DateTime.UtcNow ) + else if ( (from.LastStrGain + m_StatGainDelay) >= DateTime.UtcNow ) return; from.LastStrGain = DateTime.UtcNow; @@ -360,7 +360,7 @@ namespace Server.Misc if ( (from.LastDexGain + m_PetStatGainDelay) >= DateTime.UtcNow ) return; } - else if( (from.LastDexGain + m_StatGainDelay) >= DateTime.UtcNow ) + else if ( (from.LastDexGain + m_StatGainDelay) >= DateTime.UtcNow ) return; from.LastDexGain = DateTime.UtcNow; @@ -373,7 +373,7 @@ namespace Server.Misc return; } - else if( (from.LastIntGain + m_StatGainDelay) >= DateTime.UtcNow ) + else if ( (from.LastIntGain + m_StatGainDelay) >= DateTime.UtcNow ) return; from.LastIntGain = DateTime.UtcNow; @@ -386,4 +386,4 @@ namespace Server.Misc IncreaseStat( from, stat, atrophy ); } } -} \ No newline at end of file +} diff --git a/Scripts/Misc/Titles.cs b/Scripts/Misc/Titles.cs index 96c917519..731affbd4 100644 --- a/Scripts/Misc/Titles.cs +++ b/Scripts/Misc/Titles.cs @@ -172,11 +172,11 @@ namespace Server.Misc title.Append( beheld.Name ); } - if( beheld is PlayerMobile && ((PlayerMobile)beheld).DisplayChampionTitle ) + if ( beheld is PlayerMobile && ((PlayerMobile)beheld).DisplayChampionTitle ) { PlayerMobile.ChampionTitleInfo info = ((PlayerMobile)beheld).ChampionTitles; - if( info.Harrower > 0 ) + if ( info.Harrower > 0 ) title.AppendFormat( ": {0} of Evil", HarrowerTitles[Math.Min( HarrowerTitles.Length, info.Harrower )-1] ); else { @@ -185,7 +185,7 @@ namespace Server.Misc { int v = info.GetValue( i ); - if( v > highestValue ) + if ( v > highestValue ) { highestValue = v; highestType = i; @@ -193,12 +193,12 @@ namespace Server.Misc } int offset = 0; - if( highestValue > 800 ) + if ( highestValue > 800 ) offset = 3; - else if( highestValue > 300 ) + else if ( highestValue > 300 ) offset = (int)(highestValue/300); - if( offset > 0 ) + if ( offset > 0 ) { ChampionSpawnInfo champInfo = ChampionSpawnInfo.GetInfo( (ChampionSpawnType)highestType ); title.AppendFormat( ": {0} of the {1}", champInfo.LevelNames[Math.Min( offset, champInfo.LevelNames.Length ) -1], champInfo.Name ); @@ -397,4 +397,4 @@ namespace Server.Misc m_Title = title; } } -} \ No newline at end of file +} diff --git a/Scripts/Mobiles/AI/BerserkAI.cs b/Scripts/Mobiles/AI/BerserkAI.cs index d5ddbb21b..27c53dc5e 100644 --- a/Scripts/Mobiles/AI/BerserkAI.cs +++ b/Scripts/Mobiles/AI/BerserkAI.cs @@ -10,49 +10,49 @@ namespace Server.Mobiles public BerserkAI(BaseCreature m) : base (m) { } - + public override bool DoActionWander() { m_Mobile.DebugSay( "I have No Combatant" ); - - if( AcquireFocusMob( m_Mobile.RangePerception, FightMode.Closest, false, true, true) ) + + if ( AcquireFocusMob( m_Mobile.RangePerception, FightMode.Closest, false, true, true) ) { if ( m_Mobile.Debug ) m_Mobile.DebugSay( "I have detected " + m_Mobile.FocusMob.Name + " and I will attack" ); m_Mobile.Combatant = m_Mobile.FocusMob; Action = ActionType.Combat; - } + } else { base.DoActionWander(); } - return true; + return true; } - + public override bool DoActionCombat() { - if( m_Mobile.Combatant == null || m_Mobile.Combatant.Deleted ) + if ( m_Mobile.Combatant == null || m_Mobile.Combatant.Deleted ) { m_Mobile.DebugSay("My combatant is deleted"); Action = ActionType.Guard; return true; } - if( WalkMobileRange( m_Mobile.Combatant, 1, true, m_Mobile.RangeFight, m_Mobile.RangeFight ) ) + if ( WalkMobileRange( m_Mobile.Combatant, 1, true, m_Mobile.RangeFight, m_Mobile.RangeFight ) ) { // Be sure to face the combatant m_Mobile.Direction = m_Mobile.GetDirectionTo( m_Mobile.Combatant.Location ); } else { - if( m_Mobile.Combatant != null ) + if ( m_Mobile.Combatant != null ) { if ( m_Mobile.Debug ) m_Mobile.DebugSay("I am still not in range of " + m_Mobile.Combatant.Name); - if( (int) m_Mobile.GetDistanceToSqrt( m_Mobile.Combatant ) > m_Mobile.RangePerception + 1 ) + if ( (int) m_Mobile.GetDistanceToSqrt( m_Mobile.Combatant ) > m_Mobile.RangePerception + 1 ) { if ( m_Mobile.Debug ) m_Mobile.DebugSay( "I have lost " + m_Mobile.Combatant.Name ); @@ -62,10 +62,10 @@ namespace Server.Mobiles } } } - + return true; } - + public override bool DoActionGuard() { if ( AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, true, true ) ) diff --git a/Scripts/Mobiles/AI/MageAI.cs b/Scripts/Mobiles/AI/MageAI.cs index b71204aca..491af179c 100644 --- a/Scripts/Mobiles/AI/MageAI.cs +++ b/Scripts/Mobiles/AI/MageAI.cs @@ -25,10 +25,10 @@ namespace Server.Mobiles public override bool Think() { - if( m_Mobile.Deleted ) + if ( m_Mobile.Deleted ) return false; - if( ProcessTarget() ) + if ( ProcessTarget() ) return true; else return base.Think(); @@ -55,7 +55,7 @@ namespace Server.Mobiles public override bool DoActionWander() { - if( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) ) + if ( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) ) { m_Mobile.DebugSay( "I am going to attack {0}", m_Mobile.FocusMob.Name ); @@ -63,7 +63,7 @@ namespace Server.Mobiles Action = ActionType.Combat; m_NextCastTime = Core.TickCount; } - else if( SmartAI && m_Mobile.Mana < m_Mobile.ManaMax && !m_Mobile.Meditating ) + else if ( SmartAI && m_Mobile.Mana < m_Mobile.ManaMax && !m_Mobile.Meditating ) { m_Mobile.DebugSay( "I am going to meditate" ); @@ -77,11 +77,11 @@ namespace Server.Mobiles base.DoActionWander(); - if( Utility.RandomDouble() < 0.05 ) + if ( Utility.RandomDouble() < 0.05 ) { Spell spell = CheckCastHealingSpell(); - if( spell != null ) + if ( spell != null ) spell.Cast(); } } @@ -92,33 +92,33 @@ namespace Server.Mobiles private Spell CheckCastHealingSpell() { // If I'm poisoned, always attempt to cure. - if( m_Mobile.Poisoned ) + if ( m_Mobile.Poisoned ) return new CureSpell( m_Mobile, null ); // Summoned creatures never heal themselves. - if( m_Mobile.Summoned ) + if ( m_Mobile.Summoned ) return null; - if( m_Mobile.Controlled ) + if ( m_Mobile.Controlled ) { if (Core.TickCount - m_NextHealTime < 0) return null; } - if( !SmartAI ) + if ( !SmartAI ) { - if( ScaleBySkill( HealChance, SkillName.Magery ) < Utility.RandomDouble() ) + if ( ScaleBySkill( HealChance, SkillName.Magery ) < Utility.RandomDouble() ) return null; } else { - if( Utility.Random( 0, 4 + ( m_Mobile.Hits == 0 ? m_Mobile.HitsMax : ( m_Mobile.HitsMax / m_Mobile.Hits ) ) ) < 3 ) + if ( Utility.Random( 0, 4 + ( m_Mobile.Hits == 0 ? m_Mobile.HitsMax : ( m_Mobile.HitsMax / m_Mobile.Hits ) ) ) < 3 ) return null; } Spell spell = null; - if( m_Mobile.Hits < ( m_Mobile.HitsMax - 50 ) ) + if ( m_Mobile.Hits < ( m_Mobile.HitsMax - 50 ) ) { if ( UseNecromancy() ) { @@ -128,18 +128,18 @@ namespace Server.Mobiles { spell = new GreaterHealSpell( m_Mobile, null ); - if( spell == null ) + if ( spell == null ) spell = new HealSpell( m_Mobile, null ); } } - else if( m_Mobile.Hits < ( m_Mobile.HitsMax - 10 ) ) + else if ( m_Mobile.Hits < ( m_Mobile.HitsMax - 10 ) ) { spell = new HealSpell( m_Mobile, null ); } double delay; - if( m_Mobile.Int >= 500 ) + if ( m_Mobile.Int >= 500 ) delay = Utility.RandomMinMax( 7, 10 ); else delay = Math.Sqrt( 600 - m_Mobile.Int ); @@ -151,29 +151,29 @@ namespace Server.Mobiles public void RunTo( Mobile m ) { - if( !SmartAI ) + if ( !SmartAI ) { - if( !MoveTo( m, true, m_Mobile.RangeFight ) ) + if ( !MoveTo( m, true, m_Mobile.RangeFight ) ) OnFailedMove(); return; } - if( m.Paralyzed || m.Frozen ) + if ( m.Paralyzed || m.Frozen ) { - if( m_Mobile.InRange( m, 1 ) ) + if ( m_Mobile.InRange( m, 1 ) ) RunFrom( m ); - else if( !m_Mobile.InRange( m, m_Mobile.RangeFight > 2 ? m_Mobile.RangeFight : 2 ) && !MoveTo( m, true, 1 ) ) + else if ( !m_Mobile.InRange( m, m_Mobile.RangeFight > 2 ? m_Mobile.RangeFight : 2 ) && !MoveTo( m, true, 1 ) ) OnFailedMove(); } else { - if( !m_Mobile.InRange( m, m_Mobile.RangeFight ) ) + if ( !m_Mobile.InRange( m, m_Mobile.RangeFight ) ) { - if( !MoveTo( m, true, 1 ) ) + if ( !MoveTo( m, true, 1 ) ) OnFailedMove(); } - else if( m_Mobile.InRange( m, m_Mobile.RangeFight - 1 ) ) + else if ( m_Mobile.InRange( m, m_Mobile.RangeFight - 1 ) ) { RunFrom( m ); } @@ -187,16 +187,16 @@ namespace Server.Mobiles public void OnFailedMove() { - if( !m_Mobile.DisallowAllMoves && ( SmartAI ? Utility.Random( 4 ) == 0 : ScaleBySkill( TeleportChance, SkillName.Magery ) > Utility.RandomDouble() ) ) + if ( !m_Mobile.DisallowAllMoves && ( SmartAI ? Utility.Random( 4 ) == 0 : ScaleBySkill( TeleportChance, SkillName.Magery ) > Utility.RandomDouble() ) ) { - if( m_Mobile.Target != null ) + if ( m_Mobile.Target != null ) m_Mobile.Target.Cancel( m_Mobile, TargetCancelType.Canceled ); new TeleportSpell( m_Mobile, null ).Cast(); m_Mobile.DebugSay( "I am stuck, I'm going to try teleporting away" ); } - else if( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) ) + else if ( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) ) { m_Mobile.DebugSay( "My move is blocked, so I am going to attack {0}", m_Mobile.FocusMob.Name ); @@ -211,12 +211,12 @@ namespace Server.Mobiles public void Run( Direction d ) { - if( ( m_Mobile.Spell != null && m_Mobile.Spell.IsCasting ) || m_Mobile.Paralyzed || m_Mobile.Frozen || m_Mobile.DisallowAllMoves ) + if ( ( m_Mobile.Spell != null && m_Mobile.Spell.IsCasting ) || m_Mobile.Paralyzed || m_Mobile.Frozen || m_Mobile.DisallowAllMoves ) return; m_Mobile.Direction = d | Direction.Running; - if( !DoMove( m_Mobile.Direction, true ) ) + if ( !DoMove( m_Mobile.Direction, true ) ) OnFailedMove(); } @@ -251,9 +251,9 @@ namespace Server.Mobiles { int maxCircle = (int)( ( m_Mobile.Skills[ SkillName.Magery ].Value + 20.0 ) / ( 100.0 / 7.0 ) ); - if( maxCircle < 1 ) + if ( maxCircle < 1 ) maxCircle = 1; - else if( maxCircle > 8 ) + else if ( maxCircle > 8 ) maxCircle = 8; switch( Utility.Random( maxCircle * 2 ) ) @@ -292,7 +292,7 @@ namespace Server.Mobiles public virtual Spell GetRandomCurseSpellMage() { - if( m_Mobile.Skills[ SkillName.Magery ].Value >= 40.0 && Utility.Random( 4 ) == 0 ) + if ( m_Mobile.Skills[ SkillName.Magery ].Value >= 40.0 && Utility.Random( 4 ) == 0 ) return new CurseSpell( m_Mobile, null ); switch( Utility.Random( 3 ) ) @@ -305,7 +305,7 @@ namespace Server.Mobiles public virtual Spell GetRandomManaDrainSpell() { - if( m_Mobile.Skills[ SkillName.Magery ].Value >= 80.0 && Utility.RandomBool() ) + if ( m_Mobile.Skills[ SkillName.Magery ].Value >= 80.0 && Utility.RandomBool() ) return new ManaVampireSpell( m_Mobile, null ); return new ManaDrainSpell( m_Mobile, null ); @@ -313,9 +313,9 @@ namespace Server.Mobiles public virtual Spell DoDispel( Mobile toDispel ) { - if( !SmartAI ) + if ( !SmartAI ) { - if( ScaleBySkill( DispelChance, SkillName.Magery ) > Utility.RandomDouble() ) + if ( ScaleBySkill( DispelChance, SkillName.Magery ) > Utility.RandomDouble() ) return new DispelSpell( m_Mobile, null ); return ChooseSpell( toDispel ); @@ -323,11 +323,11 @@ namespace Server.Mobiles Spell spell = CheckCastHealingSpell(); - if( spell == null ) + if ( spell == null ) { - if( !m_Mobile.DisallowAllMoves && Utility.Random( (int)m_Mobile.GetDistanceToSqrt( toDispel ) ) == 0 ) + if ( !m_Mobile.DisallowAllMoves && Utility.Random( (int)m_Mobile.GetDistanceToSqrt( toDispel ) ) == 0 ) spell = new TeleportSpell( m_Mobile, null ); - else if( Utility.Random( 3 ) == 0 && !m_Mobile.InRange( toDispel, 3 ) && !toDispel.Paralyzed && !toDispel.Frozen ) + else if ( Utility.Random( 3 ) == 0 && !m_Mobile.InRange( toDispel, 3 ) && !toDispel.Paralyzed && !toDispel.Frozen ) spell = new ParalyzeSpell( m_Mobile, null ); else spell = new DispelSpell( m_Mobile, null ); @@ -340,18 +340,18 @@ namespace Server.Mobiles { Spell spell = null; - if( !SmartAI ) + if ( !SmartAI ) { spell = CheckCastHealingSpell(); - if( spell != null ) + if ( spell != null ) return spell; - if( IsNecromancer ) + if ( IsNecromancer ) { double psDamage = ( ( m_Mobile.Skills[ SkillName.SpiritSpeak ].Value - c.Skills[ SkillName.MagicResist ].Value ) / 10 ) + ( c.Player ? 18 : 30 ); - if( psDamage > c.Hits ) + if ( psDamage > c.Hits ) return new PainSpikeSpell( m_Mobile, null ); } @@ -424,14 +424,14 @@ namespace Server.Mobiles spell = CheckCastHealingSpell(); - if( spell != null ) + if ( spell != null ) return spell; switch( Utility.Random( 3 ) ) { case 0: // Poison them { - if( c.Poisoned ) + if ( c.Poisoned ) goto case 1; spell = new PoisonSpell( m_Mobile, null ); @@ -445,22 +445,22 @@ namespace Server.Mobiles } default: // Set up a combo { - if( m_Mobile.Mana > 15 && m_Mobile.Mana < 40 ) + if ( m_Mobile.Mana > 15 && m_Mobile.Mana < 40 ) { - if( c.Paralyzed && !c.Poisoned && !m_Mobile.Meditating ) + if ( c.Paralyzed && !c.Poisoned && !m_Mobile.Meditating ) { m_Mobile.DebugSay( "I am going to meditate" ); m_Mobile.UseSkill( SkillName.Meditation ); } - else if( !c.Poisoned ) + else if ( !c.Poisoned ) { spell = new ParalyzeSpell( m_Mobile, null ); } } - else if( m_Mobile.Mana > 60 ) + else if ( m_Mobile.Mana > 60 ) { - if( Utility.RandomBool() && !c.Paralyzed && !c.Frozen && !c.Poisoned ) + if ( Utility.RandomBool() && !c.Paralyzed && !c.Frozen && !c.Poisoned ) { m_Combo = 0; spell = new ParalyzeSpell( m_Mobile, null ); @@ -485,19 +485,19 @@ namespace Server.Mobiles { Spell spell = null; - if( m_Combo == 0 ) + if ( m_Combo == 0 ) { spell = new ExplosionSpell( m_Mobile, null ); ++m_Combo; // Move to next spell } - else if( m_Combo == 1 ) + else if ( m_Combo == 1 ) { spell = new WeakenSpell( m_Mobile, null ); ++m_Combo; // Move to next spell } - else if( m_Combo == 2 ) + else if ( m_Combo == 2 ) { - if( !c.Poisoned ) + if ( !c.Poisoned ) spell = new PoisonSpell( m_Mobile, null ); else if ( IsNecromancer ) spell = new StrangleSpell( m_Mobile, null ); @@ -505,13 +505,13 @@ namespace Server.Mobiles ++m_Combo; // Move to next spell } - if( m_Combo == 3 && spell == null ) + if ( m_Combo == 3 && spell == null ) { switch( Utility.Random( IsNecromancer ? 4 : 3 ) ) { case 0: { - if( c.Int < c.Dex ) + if ( c.Int < c.Dex ) spell = new FeeblemindSpell( m_Mobile, null ); else spell = new ClumsySpell( m_Mobile, null ); @@ -540,7 +540,7 @@ namespace Server.Mobiles } } } - else if( m_Combo == 4 && spell == null ) + else if ( m_Combo == 4 && spell == null ) { spell = new MindBlastSpell( m_Mobile, null ); m_Combo = -1; @@ -551,7 +551,7 @@ namespace Server.Mobiles private TimeSpan GetDelay( Spell spell ) { - if( SmartAI || ( spell is DispelSpell ) ) + if ( SmartAI || ( spell is DispelSpell ) ) { return TimeSpan.FromSeconds( m_Mobile.ActiveSpeed ); } @@ -573,12 +573,12 @@ namespace Server.Mobiles Mobile c = m_Mobile.Combatant; m_Mobile.Warmode = true; - if( c == null || c.Deleted || !c.Alive || c.IsDeadBondedPet || !m_Mobile.CanSee( c ) || !m_Mobile.CanBeHarmful( c, false ) || c.Map != m_Mobile.Map ) + if ( c == null || c.Deleted || !c.Alive || c.IsDeadBondedPet || !m_Mobile.CanSee( c ) || !m_Mobile.CanBeHarmful( c, false ) || c.Map != m_Mobile.Map ) { // Our combatant is deleted, dead, hidden, or we cannot hurt them // Try to find another combatant - if( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) ) + if ( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) ) { m_Mobile.DebugSay( "Something happened to my combatant, so I am going to fight {0}", m_Mobile.FocusMob.Name ); @@ -593,11 +593,11 @@ namespace Server.Mobiles } } - if( !m_Mobile.InLOS( c ) ) + if ( !m_Mobile.InLOS( c ) ) { m_Mobile.DebugSay( "I can't see my target" ); - if( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) ) + if ( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) ) { m_Mobile.DebugSay( "I will switch to {0}", m_Mobile.FocusMob.Name ); m_Mobile.Combatant = c = m_Mobile.FocusMob; @@ -605,26 +605,26 @@ namespace Server.Mobiles } } - if( !Core.AOS && SmartAI && !m_Mobile.StunReady && m_Mobile.Skills[ SkillName.Wrestling ].Value >= 80.0 && m_Mobile.Skills[ SkillName.Anatomy ].Value >= 80.0 ) + if ( !Core.AOS && SmartAI && !m_Mobile.StunReady && m_Mobile.Skills[ SkillName.Wrestling ].Value >= 80.0 && m_Mobile.Skills[ SkillName.Anatomy ].Value >= 80.0 ) EventSink.InvokeStunRequest( new StunRequestEventArgs( m_Mobile ) ); - if( !m_Mobile.InRange( c, m_Mobile.RangePerception ) ) + if ( !m_Mobile.InRange( c, m_Mobile.RangePerception ) ) { // They are somewhat far away, can we find something else? - if( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) ) + if ( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) ) { m_Mobile.Combatant = m_Mobile.FocusMob; m_Mobile.FocusMob = null; } - else if( !m_Mobile.InRange( c, m_Mobile.RangePerception * 3 ) ) + else if ( !m_Mobile.InRange( c, m_Mobile.RangePerception * 3 ) ) { m_Mobile.Combatant = null; } c = m_Mobile.Combatant; - if( c == null ) + if ( c == null ) { m_Mobile.DebugSay( "My combatant has fled, so I am on guard" ); Action = ActionType.Guard; @@ -633,15 +633,15 @@ namespace Server.Mobiles } } - if( !m_Mobile.Controlled && !m_Mobile.Summoned && m_Mobile.CanFlee ) + if ( !m_Mobile.Controlled && !m_Mobile.Summoned && m_Mobile.CanFlee ) { - if( m_Mobile.Hits < m_Mobile.HitsMax * 20 / 100 ) + if ( m_Mobile.Hits < m_Mobile.HitsMax * 20 / 100 ) { // We are low on health, should we flee? bool flee = false; - if( m_Mobile.Hits < c.Hits ) + if ( m_Mobile.Hits < c.Hits ) { // We are more hurt than them @@ -654,7 +654,7 @@ namespace Server.Mobiles flee = Utility.Random( 0, 100 ) > 10; // 10% chance to flee } - if( flee ) + if ( flee ) { m_Mobile.DebugSay( "I am going to flee from {0}", c.Name ); @@ -671,23 +671,23 @@ namespace Server.Mobiles Spell spell = null; Mobile toDispel = FindDispelTarget( true ); - if( m_Mobile.Poisoned ) // Top cast priority is cure + if ( m_Mobile.Poisoned ) // Top cast priority is cure { m_Mobile.DebugSay( "I am going to cure myself" ); spell = new CureSpell( m_Mobile, null ); } - else if( toDispel != null ) // Something dispellable is attacking us + else if ( toDispel != null ) // Something dispellable is attacking us { m_Mobile.DebugSay( "I am going to dispel {0}", toDispel ); spell = DoDispel( toDispel ); } - else if( SmartAI && m_Combo != -1 ) // We are doing a spell combo + else if ( SmartAI && m_Combo != -1 ) // We are doing a spell combo { spell = DoCombo( c ); } - else if( SmartAI && ( c.Spell is HealSpell || c.Spell is GreaterHealSpell ) && !c.Poisoned ) // They have a heal spell out + else if ( SmartAI && ( c.Spell is HealSpell || c.Spell is GreaterHealSpell ) && !c.Poisoned ) // They have a heal spell out { spell = new PoisonSpell( m_Mobile, null ); } @@ -699,11 +699,11 @@ namespace Server.Mobiles // Now we have a spell picked // Move first before casting - if( SmartAI && toDispel != null ) + if ( SmartAI && toDispel != null ) { - if( m_Mobile.InRange( toDispel, 10 ) ) + if ( m_Mobile.InRange( toDispel, 10 ) ) RunFrom( toDispel ); - else if( !m_Mobile.InRange( toDispel, Core.ML ? 10 : 12 ) ) + else if ( !m_Mobile.InRange( toDispel, Core.ML ? 10 : 12 ) ) RunTo( toDispel ); } else @@ -711,12 +711,12 @@ namespace Server.Mobiles RunTo( c ); } - if( spell != null ) + if ( spell != null ) spell.Cast(); m_NextCastTime = Core.TickCount + (int)GetDelay(spell).TotalMilliseconds; } - else if( m_Mobile.Spell == null || !m_Mobile.Spell.IsCasting ) + else if ( m_Mobile.Spell == null || !m_Mobile.Spell.IsCasting ) { RunTo( c ); } @@ -731,29 +731,29 @@ namespace Server.Mobiles public override bool DoActionGuard() { - if( m_LastTarget != null && m_LastTarget.Hidden ) + if ( m_LastTarget != null && m_LastTarget.Hidden ) { Map map = m_Mobile.Map; - if( map == null || !m_Mobile.InRange( m_LastTargetLoc, Core.ML ? 10 : 12 ) ) + if ( map == null || !m_Mobile.InRange( m_LastTargetLoc, Core.ML ? 10 : 12 ) ) { m_LastTarget = null; } - else if( m_Mobile.Spell == null && Core.TickCount - m_NextCastTime >= 0 ) + else if ( m_Mobile.Spell == null && Core.TickCount - m_NextCastTime >= 0 ) { m_Mobile.DebugSay( "I am going to reveal my last target" ); m_RevealTarget = new LandTarget( m_LastTargetLoc, map ); Spell spell = new RevealSpell( m_Mobile, null ); - if( spell.Cast() ) + if ( spell.Cast() ) m_LastTarget = null; // only do it once m_NextCastTime = Core.TickCount + (int)GetDelay(spell).TotalMilliseconds; } } - if( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) ) + if ( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) ) { m_Mobile.DebugSay( "I am going to attack {0}", m_Mobile.FocusMob.Name ); @@ -762,13 +762,13 @@ namespace Server.Mobiles } else { - if( !m_Mobile.Controlled ) + if ( !m_Mobile.Controlled ) { ProcessTarget(); Spell spell = CheckCastHealingSpell(); - if( spell != null ) + if ( spell != null ) spell.Cast(); } @@ -782,19 +782,19 @@ namespace Server.Mobiles { Mobile c = m_Mobile.Combatant; - if( ( m_Mobile.Mana > 20 || m_Mobile.Mana == m_Mobile.ManaMax ) && m_Mobile.Hits > ( m_Mobile.HitsMax / 2 ) ) + if ( ( m_Mobile.Mana > 20 || m_Mobile.Mana == m_Mobile.ManaMax ) && m_Mobile.Hits > ( m_Mobile.HitsMax / 2 ) ) { m_Mobile.DebugSay( "I am stronger now, my guard is up" ); Action = ActionType.Guard; } - else if( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) ) + else if ( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) ) { m_Mobile.DebugSay( "I am scared of {0}", m_Mobile.FocusMob.Name ); RunFrom( m_Mobile.FocusMob ); m_Mobile.FocusMob = null; - if( m_Mobile.Poisoned && Utility.Random( 0, 5 ) == 0 ) + if ( m_Mobile.Poisoned && Utility.Random( 0, 5 ) == 0 ) new CureSpell( m_Mobile, null ).Cast(); } else @@ -810,10 +810,10 @@ namespace Server.Mobiles public Mobile FindDispelTarget( bool activeOnly ) { - if( m_Mobile.Deleted || m_Mobile.Int < 95 || CanDispel( m_Mobile ) || m_Mobile.AutoDispel ) + if ( m_Mobile.Deleted || m_Mobile.Int < 95 || CanDispel( m_Mobile ) || m_Mobile.AutoDispel ) return null; - if( activeOnly ) + if ( activeOnly ) { List aggressed = m_Mobile.Aggressed; List aggressors = m_Mobile.Aggressors; @@ -823,12 +823,12 @@ namespace Server.Mobiles Mobile comb = m_Mobile.Combatant; - if( comb != null && !comb.Deleted && comb.Alive && !comb.IsDeadBondedPet && m_Mobile.InRange( comb, Core.ML ? 10 : 12 ) && CanDispel( comb ) ) + if ( comb != null && !comb.Deleted && comb.Alive && !comb.IsDeadBondedPet && m_Mobile.InRange( comb, Core.ML ? 10 : 12 ) && CanDispel( comb ) ) { active = comb; activePrio = m_Mobile.GetDistanceToSqrt( comb ); - if( activePrio <= 2 ) + if ( activePrio <= 2 ) return active; } @@ -837,16 +837,16 @@ namespace Server.Mobiles AggressorInfo info = aggressed[ i ]; Mobile m = info.Defender; - if( m != comb && m.Combatant == m_Mobile && m_Mobile.InRange( m, Core.ML ? 10 : 12 ) && CanDispel( m ) ) + if ( m != comb && m.Combatant == m_Mobile && m_Mobile.InRange( m, Core.ML ? 10 : 12 ) && CanDispel( m ) ) { double prio = m_Mobile.GetDistanceToSqrt( m ); - if( active == null || prio < activePrio ) + if ( active == null || prio < activePrio ) { active = m; activePrio = prio; - if( activePrio <= 2 ) + if ( activePrio <= 2 ) return active; } } @@ -857,16 +857,16 @@ namespace Server.Mobiles AggressorInfo info = aggressors[ i ]; Mobile m = info.Attacker; - if( m != comb && m.Combatant == m_Mobile && m_Mobile.InRange( m, Core.ML ? 10 : 12 ) && CanDispel( m ) ) + if ( m != comb && m.Combatant == m_Mobile && m_Mobile.InRange( m, Core.ML ? 10 : 12 ) && CanDispel( m ) ) { double prio = m_Mobile.GetDistanceToSqrt( m ); - if( active == null || prio < activePrio ) + if ( active == null || prio < activePrio ) { active = m; activePrio = prio; - if( activePrio <= 2 ) + if ( activePrio <= 2 ) return active; } } @@ -878,14 +878,14 @@ namespace Server.Mobiles { Map map = m_Mobile.Map; - if( map != null ) + if ( map != null ) { Mobile active = null, inactive = null; double actPrio = 0.0, inactPrio = 0.0; Mobile comb = m_Mobile.Combatant; - if( comb != null && !comb.Deleted && comb.Alive && !comb.IsDeadBondedPet && CanDispel( comb ) ) + if ( comb != null && !comb.Deleted && comb.Alive && !comb.IsDeadBondedPet && CanDispel( comb ) ) { active = inactive = comb; actPrio = inactPrio = m_Mobile.GetDistanceToSqrt( comb ); @@ -893,17 +893,17 @@ namespace Server.Mobiles foreach( Mobile m in m_Mobile.GetMobilesInRange( Core.ML ? 10 : 12 ) ) { - if( m != m_Mobile && CanDispel( m ) ) + if ( m != m_Mobile && CanDispel( m ) ) { double prio = m_Mobile.GetDistanceToSqrt( m ); - if( !activeOnly && ( inactive == null || prio < inactPrio ) ) + if ( !activeOnly && ( inactive == null || prio < inactPrio ) ) { inactive = m; inactPrio = prio; } - if( ( m_Mobile.Combatant == m || m.Combatant == m_Mobile ) && ( active == null || prio < actPrio ) ) + if ( ( m_Mobile.Combatant == m || m.Combatant == m_Mobile ) && ( active == null || prio < actPrio ) ) { active = m; actPrio = prio; @@ -956,7 +956,7 @@ namespace Server.Mobiles { Target targ = m_Mobile.Target; - if( targ == null ) + if ( targ == null ) return false; bool isReveal = ( targ is RevealSpell.InternalTarget ); @@ -968,31 +968,31 @@ namespace Server.Mobiles Mobile toTarget; - if( isInvisible ) + if ( isInvisible ) { toTarget = m_Mobile; } - else if( isDispel ) + else if ( isDispel ) { toTarget = FindDispelTarget( false ); - if( !SmartAI && toTarget != null ) + if ( !SmartAI && toTarget != null ) RunTo( toTarget ); - else if( toTarget != null && m_Mobile.InRange( toTarget, 10 ) ) + else if ( toTarget != null && m_Mobile.InRange( toTarget, 10 ) ) RunFrom( toTarget ); } - else if( SmartAI && ( isParalyze || isTeleport ) ) + else if ( SmartAI && ( isParalyze || isTeleport ) ) { toTarget = FindDispelTarget( true ); - if( toTarget == null ) + if ( toTarget == null ) { toTarget = m_Mobile.Combatant; - if( toTarget != null ) + if ( toTarget != null ) RunTo( toTarget ); } - else if( m_Mobile.InRange( toTarget, 10 ) ) + else if ( m_Mobile.InRange( toTarget, 10 ) ) { RunFrom( toTarget ); teleportAway = true; @@ -1006,34 +1006,34 @@ namespace Server.Mobiles { toTarget = m_Mobile.Combatant; - if( toTarget != null ) + if ( toTarget != null ) RunTo( toTarget ); } - if( ( targ.Flags & TargetFlags.Harmful ) != 0 && toTarget != null ) + if ( ( targ.Flags & TargetFlags.Harmful ) != 0 && toTarget != null ) { - if( ( targ.Range == -1 || m_Mobile.InRange( toTarget, targ.Range ) ) && m_Mobile.CanSee( toTarget ) && m_Mobile.InLOS( toTarget ) ) + if ( ( targ.Range == -1 || m_Mobile.InRange( toTarget, targ.Range ) ) && m_Mobile.CanSee( toTarget ) && m_Mobile.InLOS( toTarget ) ) { targ.Invoke( m_Mobile, toTarget ); } - else if( isDispel ) + else if ( isDispel ) { targ.Cancel( m_Mobile, TargetCancelType.Canceled ); } } - else if( ( targ.Flags & TargetFlags.Beneficial ) != 0 ) + else if ( ( targ.Flags & TargetFlags.Beneficial ) != 0 ) { targ.Invoke( m_Mobile, m_Mobile ); } - else if( isReveal && m_RevealTarget != null ) + else if ( isReveal && m_RevealTarget != null ) { targ.Invoke( m_Mobile, m_RevealTarget ); } - else if( isTeleport && toTarget != null ) + else if ( isTeleport && toTarget != null ) { Map map = m_Mobile.Map; - if( map == null ) + if ( map == null ) { targ.Cancel( m_Mobile, TargetCancelType.Canceled ); return true; @@ -1041,7 +1041,7 @@ namespace Server.Mobiles int px, py; - if( teleportAway ) + if ( teleportAway ) { int rx = m_Mobile.X - toTarget.X; int ry = m_Mobile.Y - toTarget.Y; @@ -1065,7 +1065,7 @@ namespace Server.Mobiles LandTarget lt = new LandTarget( p, map ); - if( ( targ.Range == -1 || m_Mobile.InRange( p, targ.Range ) ) && m_Mobile.InLOS( lt ) && map.CanSpawnMobile( px + x, py + y, lt.Z ) && !SpellHelper.CheckMulti( p, map ) ) + if ( ( targ.Range == -1 || m_Mobile.InRange( p, targ.Range ) ) && m_Mobile.InLOS( lt ) && map.CanSpawnMobile( px + x, py + y, lt.Z ) && !SpellHelper.CheckMulti( p, map ) ) { targ.Invoke( m_Mobile, lt ); return true; @@ -1074,7 +1074,7 @@ namespace Server.Mobiles int teleRange = targ.Range; - if( teleRange < 0 ) + if ( teleRange < 0 ) teleRange = Core.ML ? 11 : 12; for( int i = 0; i < 10; ++i ) @@ -1083,7 +1083,7 @@ namespace Server.Mobiles LandTarget lt = new LandTarget( randomPoint, map ); - if( m_Mobile.InLOS( lt ) && map.CanSpawnMobile( lt.X, lt.Y, lt.Z ) && !SpellHelper.CheckMulti( randomPoint, map ) ) + if ( m_Mobile.InLOS( lt ) && map.CanSpawnMobile( lt.X, lt.Y, lt.Z ) && !SpellHelper.CheckMulti( randomPoint, map ) ) { targ.Invoke( m_Mobile, new LandTarget( randomPoint, map ) ); return true; @@ -1100,4 +1100,4 @@ namespace Server.Mobiles return true; } } -} \ No newline at end of file +} diff --git a/Scripts/Mobiles/Animals/Misc/Dolphin.cs b/Scripts/Mobiles/Animals/Misc/Dolphin.cs index 899674228..7ebb02f7f 100644 --- a/Scripts/Mobiles/Animals/Misc/Dolphin.cs +++ b/Scripts/Mobiles/Animals/Misc/Dolphin.cs @@ -52,13 +52,13 @@ namespace Server.Mobiles public override void OnDoubleClick( Mobile from ) { - if( from.AccessLevel >= AccessLevel.GameMaster ) + if ( from.AccessLevel >= AccessLevel.GameMaster ) Jump(); } public virtual void Jump() { - if( Utility.RandomBool() ) + if ( Utility.RandomBool() ) Animate( 3, 16, 1, true, false, 0 ); else Animate( 4, 20, 1, true, false, 0 ); @@ -66,7 +66,7 @@ namespace Server.Mobiles public override void OnThink() { - if( Utility.RandomDouble() < .005 ) // slim chance to jump + if ( Utility.RandomDouble() < .005 ) // slim chance to jump Jump(); base.OnThink(); diff --git a/Scripts/Mobiles/Animals/Mounts/BaseMount.cs b/Scripts/Mobiles/Animals/Mounts/BaseMount.cs index 258441c8d..e563e0c71 100644 --- a/Scripts/Mobiles/Animals/Mounts/BaseMount.cs +++ b/Scripts/Mobiles/Animals/Mounts/BaseMount.cs @@ -247,7 +247,7 @@ namespace Server.Mobiles } else { - if( m_Rider != null ) + if ( m_Rider != null ) { Dismount( m_Rider ); } @@ -261,7 +261,7 @@ namespace Server.Mobiles Internalize(); - if( value.Target is Bola.BolaTarget ) + if ( value.Target is Bola.BolaTarget ) { Target.Cancel( value ); } @@ -292,16 +292,16 @@ namespace Server.Mobiles public virtual void OnRiderDamaged( int amount, Mobile from, bool willKill ) { - if( m_Rider == null ) + if ( m_Rider == null ) return; Mobile attacker = from; - if( attacker == null ) + if ( attacker == null ) attacker = m_Rider.FindMostRecentDamager( true ); - if( !(attacker == this || attacker == m_Rider || willKill || DateTime.UtcNow < m_NextMountAbility) ) + if ( !(attacker == this || attacker == m_Rider || willKill || DateTime.UtcNow < m_NextMountAbility) ) { - if( DoMountAbility( amount, from ) ) + if ( DoMountAbility( amount, from ) ) m_NextMountAbility = DateTime.UtcNow + MountAbilityDelay; } diff --git a/Scripts/Mobiles/Animals/Mounts/Ethereals.cs b/Scripts/Mobiles/Animals/Mounts/Ethereals.cs index 7a541116e..9c7dd0742 100644 --- a/Scripts/Mobiles/Animals/Mounts/Ethereals.cs +++ b/Scripts/Mobiles/Animals/Mounts/Ethereals.cs @@ -50,12 +50,12 @@ namespace Server.Mobiles { base.GetProperties( list ); - if( m_IsDonationItem ) + if ( m_IsDonationItem ) { list.Add( "Donation Ethereal" ); list.Add( "7.5 sec slower cast time if not a 9mo. Veteran" ); } - if( Core.ML && m_IsRewardItem ) + if ( Core.ML && m_IsRewardItem ) list.Add( RewardSystem.GetRewardYearLabel( this, new object[] { } ) ); // X Year Veteran Reward } @@ -68,11 +68,11 @@ namespace Server.Mobiles } set { - if( m_MountedID != value ) + if ( m_MountedID != value ) { m_MountedID = value; - if( m_Rider != null ) + if ( m_Rider != null ) ItemID = value; } } @@ -87,11 +87,11 @@ namespace Server.Mobiles } set { - if( m_RegularID != value ) + if ( m_RegularID != value ) { m_RegularID = value; - if( m_Rider == null ) + if ( m_Rider == null ) ItemID = value; } } @@ -108,57 +108,57 @@ namespace Server.Mobiles public void RemoveFollowers() { - if( m_Rider != null ) + if ( m_Rider != null ) m_Rider.Followers -= FollowerSlots; - if( m_Rider != null && m_Rider.Followers < 0 ) + if ( m_Rider != null && m_Rider.Followers < 0 ) m_Rider.Followers = 0; } public void AddFollowers() { - if( m_Rider != null ) + if ( m_Rider != null ) m_Rider.Followers += FollowerSlots; } public virtual bool Validate( Mobile from ) { - if( Parent == null ) + if ( Parent == null ) { from.SayTo( from, 1010095 ); // This must be on your person to use. return false; } - else if( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) ) + else if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) ) { // CheckIsUsableBy sends the message return false; } - else if( !BaseMount.CheckMountAllowed( from ) ) + else if ( !BaseMount.CheckMountAllowed( from ) ) { // CheckMountAllowed sends the message return false; } - else if( from.Mounted ) + else if ( from.Mounted ) { from.SendLocalizedMessage( 1005583 ); // Please dismount first. return false; } - else if( from.IsBodyMod && !from.Body.IsHuman ) + else if ( from.IsBodyMod && !from.Body.IsHuman ) { from.SendLocalizedMessage( 1061628 ); // You can't do that while polymorphed. return false; } - else if( from.HasTrade ) + else if ( from.HasTrade ) { from.SendLocalizedMessage( 1042317, "", 0x41 ); // You may not ride at this time return false; } - else if( ( from.Followers + FollowerSlots ) > from.FollowersMax ) + else if ( ( from.Followers + FollowerSlots ) > from.FollowersMax ) { from.SendLocalizedMessage( 1049679 ); // You have too many followers to summon your mount. return false; } - else if( !Multis.DesignContext.Check( from ) ) + else if ( !Multis.DesignContext.Check( from ) ) { // Check sends the message return false; @@ -169,7 +169,7 @@ namespace Server.Mobiles public override void OnDoubleClick( Mobile from ) { - if( Validate( from ) ) + if ( Validate( from ) ) new EtherealSpell( this, from ).Cast(); } @@ -223,7 +223,7 @@ namespace Server.Mobiles m_RegularID = reader.ReadInt(); m_Rider = reader.ReadMobile(); - if( m_MountedID == 0x3EA2 ) + if ( m_MountedID == 0x3EA2 ) m_MountedID = 0x3EAA; break; @@ -232,7 +232,7 @@ namespace Server.Mobiles AddFollowers(); - if( version < 3 && Weight == 0 ) + if ( version < 3 && Weight == 0 ) Weight = -1; } @@ -247,7 +247,7 @@ namespace Server.Mobiles { IMount mount = m.Mount; - if( mount != null ) + if ( mount != null ) mount.Rider = null; } @@ -260,9 +260,9 @@ namespace Server.Mobiles } set { - if( value != m_Rider ) + if ( value != m_Rider ) { - if( value == null ) + if ( value == null ) { Internalize(); UnmountMe(); @@ -272,7 +272,7 @@ namespace Server.Mobiles } else { - if( m_Rider != null ) + if ( m_Rider != null ) Dismount( m_Rider ); Dismount( value ); @@ -297,10 +297,10 @@ namespace Server.Mobiles Layer = Layer.Invalid; Movable = true; - if( Hue == EtherealHue ) + if ( Hue == EtherealHue ) Hue = 0; - if( bp != null ) + if ( bp != null ) { bp.DropItem( this ); } @@ -309,7 +309,7 @@ namespace Server.Mobiles Point3D loc = m_Rider.Location; Map map = m_Rider.Map; - if( map == null || map == Map.Internal ) + if ( map == null || map == Map.Internal ) { loc = m_Rider.LogoutLocation; map = m_Rider.LogoutMap; @@ -325,7 +325,7 @@ namespace Server.Mobiles Layer = Layer.Mount; Movable = false; - if( Hue == 0 ) + if ( Hue == 0 ) Hue = EtherealHue; ProcessDelta(); @@ -345,7 +345,7 @@ namespace Server.Mobiles public static void StopMounting( Mobile mob ) { - if( mob.Spell is EtherealSpell ) + if ( mob.Spell is EtherealSpell ) ( (EtherealSpell)mob.Spell ).Stop(); } @@ -410,7 +410,7 @@ namespace Server.Mobiles public override bool CheckDisturb( DisturbType type, bool checkFirst, bool resistable ) { - if( type == DisturbType.EquipRequest || type == DisturbType.UseRequest/* || type == DisturbType.Hurt*/ ) + if ( type == DisturbType.EquipRequest || type == DisturbType.UseRequest/* || type == DisturbType.Hurt*/ ) return false; return true; @@ -418,19 +418,19 @@ namespace Server.Mobiles public override void DoHurtFizzle() { - if( !m_Stop ) + if ( !m_Stop ) base.DoHurtFizzle(); } public override void DoFizzle() { - if( !m_Stop ) + if ( !m_Stop ) base.DoFizzle(); } public override void OnDisturb( DisturbType type, bool message ) { - if( message && !m_Stop ) + if ( message && !m_Stop ) Caster.SendLocalizedMessage( 1049455 ); // You have been disrupted while attempting to summon your ethereal mount! //m_Mount.UnmountMe(); @@ -438,7 +438,7 @@ namespace Server.Mobiles public override void OnCast() { - if( !m_Mount.Deleted && m_Mount.Rider == null && m_Mount.Validate( m_Rider ) ) + if ( !m_Mount.Deleted && m_Mount.Rider == null && m_Mount.Validate( m_Rider ) ) m_Mount.Rider = m_Rider; FinishSequence(); @@ -474,10 +474,10 @@ namespace Server.Mobiles int version = reader.ReadInt(); - if( Name == "an ethereal horse" ) + if ( Name == "an ethereal horse" ) Name = null; - if( ItemID == 0x2124 ) + if ( ItemID == 0x2124 ) ItemID = 0x20DD; } } @@ -510,7 +510,7 @@ namespace Server.Mobiles int version = reader.ReadInt(); - if( Name == "an ethereal llama" ) + if ( Name == "an ethereal llama" ) Name = null; } } @@ -543,7 +543,7 @@ namespace Server.Mobiles int version = reader.ReadInt(); - if( Name == "an ethereal ostard" ) + if ( Name == "an ethereal ostard" ) Name = null; } } @@ -576,7 +576,7 @@ namespace Server.Mobiles int version = reader.ReadInt(); - if( Name == "an ethereal ridgeback" ) + if ( Name == "an ethereal ridgeback" ) Name = null; } } @@ -609,7 +609,7 @@ namespace Server.Mobiles int version = reader.ReadInt(); - if( Name == "an ethereal unicorn" ) + if ( Name == "an ethereal unicorn" ) Name = null; } } @@ -642,7 +642,7 @@ namespace Server.Mobiles int version = reader.ReadInt(); - if( Name == "an ethereal beetle" ) + if ( Name == "an ethereal beetle" ) Name = null; } } @@ -675,7 +675,7 @@ namespace Server.Mobiles int version = reader.ReadInt(); - if( Name == "an ethereal kirin" ) + if ( Name == "an ethereal kirin" ) Name = null; } } @@ -708,7 +708,7 @@ namespace Server.Mobiles int version = reader.ReadInt(); - if( Name == "an ethereal swamp dragon" ) + if ( Name == "an ethereal swamp dragon" ) Name = null; } } @@ -864,7 +864,7 @@ namespace Server.Mobiles int version = reader.ReadInt(); - if( version <= 1 && Hue != 0 ) + if ( version <= 1 && Hue != 0 ) { Hue = 0; } diff --git a/Scripts/Mobiles/Animals/Mounts/FireSteed.cs b/Scripts/Mobiles/Animals/Mounts/FireSteed.cs index cc9be807b..f7e87691b 100644 --- a/Scripts/Mobiles/Animals/Mounts/FireSteed.cs +++ b/Scripts/Mobiles/Animals/Mounts/FireSteed.cs @@ -76,7 +76,7 @@ namespace Server.Mobiles if ( BaseSoundID <= 0 ) BaseSoundID = 0xA8; - if( version < 1 ) + if ( version < 1 ) { for ( int i = 0; i < Skills.Length; ++i ) { diff --git a/Scripts/Mobiles/Animals/Mounts/Hiryu.cs b/Scripts/Mobiles/Animals/Mounts/Hiryu.cs index 77f73de7a..e18bfefd4 100644 --- a/Scripts/Mobiles/Animals/Mounts/Hiryu.cs +++ b/Scripts/Mobiles/Animals/Mounts/Hiryu.cs @@ -41,31 +41,31 @@ namespace Server.Mobiles 1 1075 Strong Green 0.09% 0x855C * */ - if( rand <= 0 ) + if ( rand <= 0 ) return 0x855C; - else if( rand <= 1 ) + else if ( rand <= 1 ) return 0x8490; - else if( rand <= 3 ) + else if ( rand <= 3 ) return 0x8030; - else if( rand <= 5 ) + else if ( rand <= 5 ) return 0x8037; - else if( rand <= 8 ) + else if ( rand <= 8 ) return 0x8295; - else if( rand <= 11 ) + else if ( rand <= 11 ) return 0x8123; - else if( rand <= 16 ) + else if ( rand <= 16 ) return 0x8482; - else if( rand <= 24 ) + else if ( rand <= 24 ) return 0x8487; - else if( rand <= 34 ) + else if ( rand <= 34 ) return 0x8032; - else if( rand <= 44 ) + else if ( rand <= 44 ) return 0x8899; - else if( rand <= 54 ) + else if ( rand <= 54 ) return 0x8495; - else if( rand <= 64 ) + else if ( rand <= 64 ) return 0x848D; - else if( rand <= 74 ) + else if ( rand <= 74 ) return 0x847F; @@ -107,7 +107,7 @@ namespace Server.Mobiles ControlSlots = 4; MinTameSkill = 98.7; - if( Utility.RandomDouble() < .33 ) + if ( Utility.RandomDouble() < .33 ) PackItem( Engines.Plants.Seed.RandomBonsaiSeed() ); if ( Core.ML && Utility.RandomDouble() < .33 ) @@ -156,7 +156,7 @@ namespace Server.Mobiles { base.OnGaveMeleeAttack( defender ); - if( 0.1 > Utility.RandomDouble() ) + if ( 0.1 > Utility.RandomDouble() ) { /* Grasping Claw * Start cliloc: 1070836 @@ -167,7 +167,7 @@ namespace Server.Mobiles ExpireTimer timer = (ExpireTimer)m_Table[defender]; - if( timer != null ) + if ( timer != null ) { timer.DoExpire(); defender.SendLocalizedMessage( 1070837 ); // The creature lands another blow in your weakened state. @@ -233,13 +233,13 @@ namespace Server.Mobiles base.Deserialize( reader ); int version = reader.ReadInt(); - if( version == 0 ) + if ( version == 0 ) Timer.DelayCall( TimeSpan.Zero, delegate { Hue = GetHue(); } ); - if( version <= 1 ) - Timer.DelayCall( TimeSpan.Zero, delegate { if( InternalItem != null ) { InternalItem.Hue = this.Hue; } } ); + if ( version <= 1 ) + Timer.DelayCall( TimeSpan.Zero, delegate { if ( InternalItem != null ) { InternalItem.Hue = this.Hue; } } ); - if( version < 2 ) + if ( version < 2 ) { for ( int i = 0; i < Skills.Length; ++i ) { diff --git a/Scripts/Mobiles/Animals/Mounts/Kirin.cs b/Scripts/Mobiles/Animals/Mounts/Kirin.cs index 826508fcd..d9637a46a 100644 --- a/Scripts/Mobiles/Animals/Mounts/Kirin.cs +++ b/Scripts/Mobiles/Animals/Mounts/Kirin.cs @@ -22,10 +22,10 @@ namespace Server.Mobiles public override bool DoMountAbility( int damage, Mobile attacker ) { - if( Rider == null || attacker == null ) //sanity + if ( Rider == null || attacker == null ) //sanity return false; - if( (Rider.Hits - damage) < 30 && Rider.Map == attacker.Map && Rider.InRange( attacker, 18 ) ) //Range and map checked here instead of other base fuction because of abiliites that don't need to check this + if ( (Rider.Hits - damage) < 30 && Rider.Map == attacker.Map && Rider.InRange( attacker, 18 ) ) //Range and map checked here instead of other base fuction because of abiliites that don't need to check this { attacker.BoltEffect( 0 ); // 35~100 damage, unresistable, by the Ki-rin. diff --git a/Scripts/Mobiles/Animals/Mounts/LesserHiryu.cs b/Scripts/Mobiles/Animals/Mounts/LesserHiryu.cs index 00da0757d..8463e1a08 100644 --- a/Scripts/Mobiles/Animals/Mounts/LesserHiryu.cs +++ b/Scripts/Mobiles/Animals/Mounts/LesserHiryu.cs @@ -29,15 +29,15 @@ namespace Server.Mobiles * */ - if( rand <= 0 ) + if ( rand <= 0 ) return 0x8258; - else if( rand <= 1 ) + else if ( rand <= 1 ) return 0x88AB; - else if( rand <= 6 ) + else if ( rand <= 6 ) return 0x87D4; - else if( rand <= 16 ) + else if ( rand <= 16 ) return 0x8163; - else if( rand <= 26 ) + else if ( rand <= 26 ) return 0x8295; @@ -79,7 +79,7 @@ namespace Server.Mobiles ControlSlots = 3; MinTameSkill = 98.7; - if( Utility.RandomDouble() < .33 ) + if ( Utility.RandomDouble() < .33 ) PackItem( Engines.Plants.Seed.RandomBonsaiSeed() ); } @@ -126,21 +126,21 @@ namespace Server.Mobiles { double tamingChance = base.GetControlChance( m, useBaseSkill ); - if( tamingChance >= 0.95 ) + if ( tamingChance >= 0.95 ) { return tamingChance; } double skill = (useBaseSkill? m.Skills.Bushido.Base : m.Skills.Bushido.Value); - if( skill < 90.0 ) + if ( skill < 90.0 ) { return tamingChance; } double bushidoChance = ( skill - 30.0 ) / 100; - if( m.Skills.Bushido.Base >= 120 ) + if ( m.Skills.Bushido.Base >= 120 ) bushidoChance += 0.05; return bushidoChance > tamingChance ? bushidoChance : tamingChance; @@ -156,7 +156,7 @@ namespace Server.Mobiles { base.OnGaveMeleeAttack( defender ); - if( 0.1 > Utility.RandomDouble() ) + if ( 0.1 > Utility.RandomDouble() ) { /* Grasping Claw * Start cliloc: 1070836 @@ -167,7 +167,7 @@ namespace Server.Mobiles ExpireTimer timer = (ExpireTimer)m_Table[defender]; - if( timer != null ) + if ( timer != null ) { timer.DoExpire(); defender.SendLocalizedMessage( 1070837 ); // The creature lands another blow in your weakened state. @@ -233,13 +233,13 @@ namespace Server.Mobiles base.Deserialize( reader ); int version = reader.ReadInt(); - if( version == 0 ) + if ( version == 0 ) Timer.DelayCall( TimeSpan.Zero, delegate { Hue = GetHue(); } ); - if( version <= 1 ) - Timer.DelayCall( TimeSpan.Zero, delegate { if( InternalItem != null ) { InternalItem.Hue = this.Hue; } } ); + if ( version <= 1 ) + Timer.DelayCall( TimeSpan.Zero, delegate { if ( InternalItem != null ) { InternalItem.Hue = this.Hue; } } ); - if( version < 2 ) + if ( version < 2 ) { for ( int i = 0; i < Skills.Length; ++i ) { diff --git a/Scripts/Mobiles/Animals/Mounts/Unicorn.cs b/Scripts/Mobiles/Animals/Mounts/Unicorn.cs index fec5de5e3..d6e055059 100644 --- a/Scripts/Mobiles/Animals/Mounts/Unicorn.cs +++ b/Scripts/Mobiles/Animals/Mounts/Unicorn.cs @@ -22,21 +22,21 @@ namespace Server.Mobiles public override bool DoMountAbility( int damage, Mobile attacker ) { - if( Rider == null || attacker == null ) //sanity + if ( Rider == null || attacker == null ) //sanity return false; - if( Rider.Poisoned && ((Rider.Hits - damage) < 40) ) + if ( Rider.Poisoned && ((Rider.Hits - damage) < 40) ) { Poison p = Rider.Poison; - if( p != null ) + if ( p != null ) { int chanceToCure = 10000 + (int)(this.Skills[SkillName.Magery].Value * 75) - ((p.Level + 1) * (Core.AOS ? (p.Level < 4 ? 3300 : 3100) : 1750)); chanceToCure /= 100; - if( chanceToCure > Utility.Random( 100 ) ) + if ( chanceToCure > Utility.Random( 100 ) ) { - if( Rider.CurePoison( this ) ) //TODO: Confirm if mount is the one flagged for curing it or the rider is + if ( Rider.CurePoison( this ) ) //TODO: Confirm if mount is the one flagged for curing it or the rider is { Rider.LocalOverheadMessage( Server.Network.MessageType.Regular, 0x3B2, true, "Your mount senses you are in danger and aids you with magic." ); Rider.FixedParticles( 0x373A, 10, 15, 5012, EffectLayer.Waist ); diff --git a/Scripts/Mobiles/BaseCreature.cs b/Scripts/Mobiles/BaseCreature.cs index e3e98aee0..fa2214a9f 100644 --- a/Scripts/Mobiles/BaseCreature.cs +++ b/Scripts/Mobiles/BaseCreature.cs @@ -144,11 +144,11 @@ namespace Server.Mobiles public static TextDefinition GetFriendlyNameFor( Type t ) { - if( t.IsDefined( typeof( FriendlyNameAttribute ), false ) ) + if ( t.IsDefined( typeof( FriendlyNameAttribute ), false ) ) { object[] objs = t.GetCustomAttributes( typeof( FriendlyNameAttribute ), false ); - if( objs != null && objs.Length > 0 ) + if ( objs != null && objs.Length > 0 ) { FriendlyNameAttribute friendly = objs[0] as FriendlyNameAttribute; @@ -422,7 +422,7 @@ namespace Server.Mobiles { get { - if( Spawner is Spawner ) + if ( Spawner is Spawner ) { return ( Spawner as Spawner ); } @@ -751,7 +751,7 @@ namespace Server.Mobiles public virtual void BreathDealDamage( Mobile target ) { - if( !Evasion.CheckSpellEvasion( target ) ) + if ( !Evasion.CheckSpellEvasion( target ) ) { int physDamage = BreathPhysicalDamage; int fireDamage = BreathFireDamage; @@ -759,7 +759,7 @@ namespace Server.Mobiles int poisDamage = BreathPoisonDamage; int nrgyDamage = BreathEnergyDamage; - if( BreathChaosDamage > 0 ) + if ( BreathChaosDamage > 0 ) { switch( Utility.Random( 5 )) { @@ -771,7 +771,7 @@ namespace Server.Mobiles } } - if( physDamage == 0 && fireDamage == 0 && coldDamage == 0 && poisDamage == 0 && nrgyDamage == 0 ) + if ( physDamage == 0 && fireDamage == 0 && coldDamage == 0 && poisDamage == 0 && nrgyDamage == 0 ) { target.Damage( BreathComputeDamage(), this );// Unresistable damage even in AOS } @@ -1003,7 +1003,7 @@ namespace Server.Mobiles if ( !(m is BaseCreature) || m is Server.Engines.Quests.Haven.MilitiaFighter ) return true; - if( TransformationSpellHelper.UnderTransformation( m, typeof( EtherealVoyageSpell ) ) ) + if ( TransformationSpellHelper.UnderTransformation( m, typeof( EtherealVoyageSpell ) ) ) return false; if ( m is PlayerMobile && ( (PlayerMobile)m ).HonorActive ) @@ -1073,16 +1073,16 @@ namespace Server.Mobiles int lore = (int)((useBaseSkill ? m.Skills[SkillName.AnimalLore].Base : m.Skills[SkillName.AnimalLore].Value )* 10); int bonus = 0, chance = 700; - if( Core.ML ) + if ( Core.ML ) { int SkillBonus = taming - (int)(dMinTameSkill * 10); int LoreBonus = lore - (int)(dMinTameSkill * 10); int SkillMod = 6, LoreMod = 6; - if( SkillBonus < 0 ) + if ( SkillBonus < 0 ) SkillMod = 28; - if( LoreBonus < 0 ) + if ( LoreBonus < 0 ) LoreMod = 14; SkillBonus *= SkillMod; @@ -1322,9 +1322,9 @@ namespace Server.Mobiles if ( m_HitsMax > 0 ) { int value = m_HitsMax + GetStatOffset( StatType.Str ); - if( value < 1 ) + if ( value < 1 ) value = 1; - else if( value > 65000 ) + else if ( value > 65000 ) value = 65000; return value; @@ -1349,9 +1349,9 @@ namespace Server.Mobiles if ( m_StamMax > 0 ) { int value = m_StamMax + GetStatOffset( StatType.Dex ); - if( value < 1 ) + if ( value < 1 ) value = 1; - else if( value > 65000 ) + else if ( value > 65000 ) value = 65000; return value; @@ -1376,9 +1376,9 @@ namespace Server.Mobiles if ( m_ManaMax > 0 ) { int value = m_ManaMax + GetStatOffset( StatType.Int ); - if( value < 1 ) + if ( value < 1 ) value = 1; - else if( value > 65000 ) + else if ( value > 65000 ) value = 65000; return value; @@ -1445,7 +1445,7 @@ namespace Server.Mobiles public virtual void CheckDistracted( Mobile from ) { - if( Utility.RandomDouble() < .10 ) + if ( Utility.RandomDouble() < .10 ) { ControlTarget = from; ControlOrder = OrderType.Attack; @@ -1461,22 +1461,22 @@ namespace Server.Mobiles int disruptThreshold; //NPCs can use bandages too! - if( !Core.AOS ) + if ( !Core.AOS ) disruptThreshold = 0; - else if( from != null && from.Player ) + else if ( from != null && from.Player ) disruptThreshold = 18; else disruptThreshold = 25; - if( amount > disruptThreshold ) + if ( amount > disruptThreshold ) { BandageContext c = BandageContext.GetContext( this ); - if( c != null ) + if ( c != null ) c.Slip(); } - if( Confidence.IsRegenerating( this ) ) + if ( Confidence.IsRegenerating( this ) ) Confidence.StopRegenerating( this ); WeightOverloading.FatigueOnDamage( this, amount ); @@ -1489,14 +1489,14 @@ namespace Server.Mobiles if ( m_ReceivedHonorContext != null ) m_ReceivedHonorContext.OnTargetDamaged( from, amount ); - if( !willKill ) + if ( !willKill ) { - if( CanBeDistracted && ControlOrder == OrderType.Follow ) + if ( CanBeDistracted && ControlOrder == OrderType.Follow ) { CheckDistracted( from ); } } - else if( from is PlayerMobile ) + else if ( from is PlayerMobile ) { Timer.DelayCall( TimeSpan.FromSeconds( 10 ), new TimerCallback( ( ( PlayerMobile )from ).RecoverAmmo ) ); } @@ -1506,7 +1506,7 @@ namespace Server.Mobiles public virtual void OnDamagedBySpell( Mobile from ) { - if( CanBeDistracted && ControlOrder == OrderType.Follow ) + if ( CanBeDistracted && ControlOrder == OrderType.Follow ) { CheckDistracted( from ); } @@ -2106,7 +2106,7 @@ namespace Server.Mobiles if ( version >= 19 ) m_HomeMap = reader.ReadMap(); - if( version <= 14 && m_Paragon && Hue == 0x31 ) + if ( version <= 14 && m_Paragon && Hue == 0x31 ) { Hue = Paragon.Hue; //Paragon hue fixed, should now be 0x501. } @@ -2327,7 +2327,7 @@ namespace Server.Mobiles from.SendLocalizedMessage( 1049666 ); // Your pet has bonded with you! } } - else if( Core.ML ) + else if ( Core.ML ) { from.SendLocalizedMessage( 1075268 ); // Your pet cannot form a bond with you until your animal taming ability has risen. } @@ -2405,7 +2405,7 @@ namespace Server.Mobiles if ( m_AI != null ) m_AI.m_Timer.Stop(); - if( ForcedAI != null ) + if ( ForcedAI != null ) { m_AI = ForcedAI; return; @@ -2673,17 +2673,17 @@ namespace Server.Mobiles if ( m_ControlMaster != null ) { m_ControlMaster.Followers -= ControlSlots; - if( m_ControlMaster is PlayerMobile ) + if ( m_ControlMaster is PlayerMobile ) { ((PlayerMobile)m_ControlMaster).AllFollowers.Remove( this ); - if( ((PlayerMobile)m_ControlMaster).AutoStabled.Contains( this ) ) + if ( ((PlayerMobile)m_ControlMaster).AutoStabled.Contains( this ) ) ((PlayerMobile)m_ControlMaster).AutoStabled.Remove( this ); } } else if ( m_SummonMaster != null ) { m_SummonMaster.Followers -= ControlSlots; - if( m_SummonMaster is PlayerMobile ) + if ( m_SummonMaster is PlayerMobile ) { ((PlayerMobile)m_SummonMaster).AllFollowers.Remove( this ); } @@ -2701,7 +2701,7 @@ namespace Server.Mobiles if ( m_ControlMaster != null ) { m_ControlMaster.Followers += ControlSlots; - if( m_ControlMaster is PlayerMobile ) + if ( m_ControlMaster is PlayerMobile ) { ((PlayerMobile)m_ControlMaster).AllFollowers.Add( this ); } @@ -2709,7 +2709,7 @@ namespace Server.Mobiles else if ( m_SummonMaster != null ) { m_SummonMaster.Followers += ControlSlots; - if( m_SummonMaster is PlayerMobile ) + if ( m_SummonMaster is PlayerMobile ) { ((PlayerMobile)m_SummonMaster).AllFollowers.Add( this ); } @@ -3146,7 +3146,7 @@ namespace Server.Mobiles if ( !CanTeach ) return false; - if( skill == SkillName.Stealth && from.Skills[SkillName.Hiding].Base < Stealth.HidingRequirement ) + if ( skill == SkillName.Stealth && from.Skills[SkillName.Hiding].Base < Stealth.HidingRequirement ) return false; if ( skill == SkillName.RemoveTrap && (from.Skills[SkillName.Lockpicking].Base < 50.0 || from.Skills[SkillName.DetectHidden].Base < 50.0) ) @@ -3346,7 +3346,7 @@ namespace Server.Mobiles if ( m_AI != null ) { - if( !Core.ML || ( ct != OrderType.Follow && ct != OrderType.Stop && ct != OrderType.Stay ) ) + if ( !Core.ML || ( ct != OrderType.Follow && ct != OrderType.Stop && ct != OrderType.Stay ) ) { m_AI.OnAggressiveAction( aggressor ); } @@ -3597,7 +3597,7 @@ namespace Server.Mobiles public virtual void CheckedAnimate( int action, int frameCount, int repeatCount, bool forward, bool repeat, int delay ) { - if( !Mounted ) + if ( !Mounted ) { base.Animate( action, frameCount, repeatCount, forward, repeat, delay ); } @@ -3622,7 +3622,7 @@ namespace Server.Mobiles Warmode = ( Combatant != null && !Combatant.Deleted && Combatant.Alive ); - if( CanFly && Warmode ) + if ( CanFly && Warmode ) { Flying = false; } @@ -3649,15 +3649,15 @@ namespace Server.Mobiles public override void OnMovement( Mobile m, Point3D oldLocation ) { - if( AcquireOnApproach && ( !Controlled && !Summoned ) && FightMode != FightMode.Aggressor ) + if ( AcquireOnApproach && ( !Controlled && !Summoned ) && FightMode != FightMode.Aggressor ) { - if( InRange( m.Location, AcquireOnApproachRange ) && !InRange( oldLocation, AcquireOnApproachRange ) ) + if ( InRange( m.Location, AcquireOnApproachRange ) && !InRange( oldLocation, AcquireOnApproachRange ) ) { - if( CanBeHarmful( m ) && IsEnemy( m )) + if ( CanBeHarmful( m ) && IsEnemy( m )) { Combatant = FocusMob = m; - if( AIObject != null ) + if ( AIObject != null ) { AIObject.MoveTo( m, true, 1 ); } @@ -3666,7 +3666,7 @@ namespace Server.Mobiles } } } - else if( ReacquireOnMovement ) + else if ( ReacquireOnMovement ) { ForceReacquire(); } @@ -3769,7 +3769,7 @@ namespace Server.Mobiles for( i=0; i< m_SpellAttack.Count; i++ ) { - if( m_SpellAttack[i] == type ) + if ( m_SpellAttack[i] == type ) { object[] args = { this, null }; return Activator.CreateInstance( type, args ) as Spell; @@ -4054,7 +4054,7 @@ namespace Server.Mobiles { if ( Backpack != null ) { - if( Backpack.Items.Count > 0 ) + if ( Backpack.Items.Count > 0 ) { Backpack b = new CreatureBackpack( Name ); @@ -4946,7 +4946,7 @@ namespace Server.Mobiles Region region = ds.m_Mobile.Region; - if( !givenToTKill && ( Map == Map.Tokuno || region.IsPartOf( "Yomotsu Mines" ) || region.IsPartOf( "Fan Dancer's Dojo" ) )) + if ( !givenToTKill && ( Map == Map.Tokuno || region.IsPartOf( "Yomotsu Mines" ) || region.IsPartOf( "Fan Dancer's Dojo" ) )) { givenToTKill = true; TreasuresOfTokuno.HandleKill( this, ds.m_Mobile ); @@ -5407,9 +5407,9 @@ namespace Server.Mobiles { Mobile target = this.Combatant; - if( target != null && target.Alive && !target.IsDeadBondedPet && CanBeHarmful( target ) && target.Map == this.Map && !IsDeadBondedPet && target.InRange( this, BreathRange ) && InLOS( target ) && !BardPacified ) + if ( target != null && target.Alive && !target.IsDeadBondedPet && CanBeHarmful( target ) && target.Map == this.Map && !IsDeadBondedPet && target.InRange( this, BreathRange ) && InLOS( target ) && !BardPacified ) { - if( ( Core.TickCount - m_NextBreathTime ) < 30000 && Utility.RandomBool() ) + if ( ( Core.TickCount - m_NextBreathTime ) < 30000 && Utility.RandomBool() ) { BreathStart( target ); } @@ -5574,7 +5574,7 @@ namespace Server.Mobiles string name = this.Name; - if( name == null || str.Length < name.Length ) + if ( name == null || str.Length < name.Length ) return false; string[] wordsString = str.Split(' '); @@ -5691,13 +5691,13 @@ namespace Server.Mobiles private bool IsSpawnerBound() { - if( ( Map != null ) && ( Map != Map.Internal ) ) + if ( ( Map != null ) && ( Map != Map.Internal ) ) { - if( FightMode != FightMode.None && ( RangeHome >= 0 ) ) + if ( FightMode != FightMode.None && ( RangeHome >= 0 ) ) { - if( !Controlled && !Summoned ) + if ( !Controlled && !Summoned ) { - if( Spawner != null && Spawner is Spawner && ( ( Spawner as Spawner ).Map ) == Map ) + if ( Spawner != null && Spawner is Spawner && ( ( Spawner as Spawner ).Map ) == Map ) { return true; } @@ -5718,13 +5718,13 @@ namespace Server.Mobiles public override void OnSectorDeactivate() { - if( !Deleted && ReturnsToHome && IsSpawnerBound() && !this.InRange( Home, ( RangeHome + 5 ) ) ) + if ( !Deleted && ReturnsToHome && IsSpawnerBound() && !this.InRange( Home, ( RangeHome + 5 ) ) ) { Timer.DelayCall( TimeSpan.FromSeconds( ( Utility.Random( 45 ) + 15 ) ), new TimerCallback( GoHome_Callback ) ); m_ReturnQueued = true; } - else if( PlayerRangeSensitive && m_AI != null ) + else if ( PlayerRangeSensitive && m_AI != null ) { m_AI.Deactivate(); } @@ -5734,13 +5734,13 @@ namespace Server.Mobiles public void GoHome_Callback() { - if( m_ReturnQueued && IsSpawnerBound() ) + if ( m_ReturnQueued && IsSpawnerBound() ) { - if( !( ( Map.GetSector( X, Y ) ).Active ) ) + if ( !( ( Map.GetSector( X, Y ) ).Active ) ) { this.SetLocation( Home, true ); - if( !( ( Map.GetSector( X, Y ) ).Active ) && m_AI != null ) + if ( !( ( Map.GetSector( X, Y ) ).Active ) && m_AI != null ) { m_AI.Deactivate(); } @@ -5752,7 +5752,7 @@ namespace Server.Mobiles public override void OnSectorActivate() { - if( PlayerRangeSensitive && m_AI != null ) + if ( PlayerRangeSensitive && m_AI != null ) { m_AI.Activate(); } @@ -5838,7 +5838,7 @@ namespace Server.Mobiles { c.Loyalty -= (BaseCreature.MaxLoyalty / 10); - if( c.Loyalty < (BaseCreature.MaxLoyalty / 10) ) + if ( c.Loyalty < (BaseCreature.MaxLoyalty / 10) ) { c.Say( 1043270, c.Name ); // * ~1_NAME~ looks around desperately * c.PlaySound( c.GetIdleSound() ); diff --git a/Scripts/Mobiles/Familiars/BaseFamiliar.cs b/Scripts/Mobiles/Familiars/BaseFamiliar.cs index c8fc852d5..8467e65f7 100644 --- a/Scripts/Mobiles/Familiars/BaseFamiliar.cs +++ b/Scripts/Mobiles/Familiars/BaseFamiliar.cs @@ -24,17 +24,17 @@ namespace Server.Mobiles public virtual void RangeCheck() { - if( !Deleted && ControlMaster != null && !ControlMaster.Deleted ) + if ( !Deleted && ControlMaster != null && !ControlMaster.Deleted ) { int range = ( RangeHome - 2 ); - if( !InRange( ControlMaster.Location, RangeHome ) ) + if ( !InRange( ControlMaster.Location, RangeHome ) ) { Mobile master = ControlMaster; Point3D m_Loc = Point3D.Zero; - if( Map == master.Map ) + if ( Map == master.Map ) { int x = ( X > master.X ) ? ( master.X + range ) : ( master.X - range ); int y = ( Y > master.Y ) ? ( master.Y + range ) : ( master.Y - range ); @@ -46,7 +46,7 @@ namespace Server.Mobiles m_Loc.Z = Map.GetAverageZ( m_Loc.X, m_Loc.Y ); - if( Map.CanSpawnMobile( m_Loc ) ) + if ( Map.CanSpawnMobile( m_Loc ) ) { break; } @@ -54,7 +54,7 @@ namespace Server.Mobiles m_Loc = master.Location; } - if( !Deleted ) + if ( !Deleted ) { SetLocation( m_Loc, true ); } @@ -67,11 +67,11 @@ namespace Server.Mobiles { Mobile master = ControlMaster; - if( Deleted ) + if ( Deleted ) { return; } - if( master == null || master.Deleted ) + if ( master == null || master.Deleted ) { DropPackContents(); EndRelease( null ); @@ -80,10 +80,10 @@ namespace Server.Mobiles RangeCheck(); - if( m_LastHidden != master.Hidden ) + if ( m_LastHidden != master.Hidden ) Hidden = m_LastHidden = master.Hidden; - if( AIObject != null && AIObject.WalkMobileRange( master, 5, true, 1, 1 )) + if ( AIObject != null && AIObject.WalkMobileRange( master, 5, true, 1, 1 )) { Warmode = master.Warmode; Combatant = master.Combatant; diff --git a/Scripts/Mobiles/Guards/WarriorGuard.cs b/Scripts/Mobiles/Guards/WarriorGuard.cs index 314f434d0..5239965ba 100644 --- a/Scripts/Mobiles/Guards/WarriorGuard.cs +++ b/Scripts/Mobiles/Guards/WarriorGuard.cs @@ -65,7 +65,7 @@ namespace Server.Mobiles } Utility.AssignRandomHair( this ); - if( Utility.RandomBool() ) + if ( Utility.RandomBool() ) Utility.AssignRandomFacialHair( this, HairHue ); Halberd weapon = new Halberd(); @@ -264,7 +264,7 @@ namespace Server.Mobiles Mobile target = m_Owner.Focus; - if ( target != null && (target.Deleted || !target.Alive || !m_Owner.CanBeHarmful( target )) ) + if ( target != null && (target.Deleted || !target.Alive || !m_Owner.CanBeHarmful( target )) ) { m_Owner.Focus = null; Stop(); @@ -366,4 +366,4 @@ namespace Server.Mobiles } } } -} \ No newline at end of file +} diff --git a/Scripts/Mobiles/Monsters/Ants/RedSolenQueen.cs b/Scripts/Mobiles/Monsters/Ants/RedSolenQueen.cs index 5abcb6714..359577ccd 100644 --- a/Scripts/Mobiles/Monsters/Ants/RedSolenQueen.cs +++ b/Scripts/Mobiles/Monsters/Ants/RedSolenQueen.cs @@ -49,7 +49,7 @@ namespace Server.Mobiles PackItem( new ZoogiFungus( ( Utility.RandomDouble() > 0.05 )? 5 : 25 ) ); - if( Utility.RandomDouble() < 0.05 ) + if ( Utility.RandomDouble() < 0.05 ) PackItem( new BallOfSummoning() ); } diff --git a/Scripts/Mobiles/Monsters/Humanoid/Magic/GargoyleDestroyer.cs b/Scripts/Mobiles/Monsters/Humanoid/Magic/GargoyleDestroyer.cs index 1c2f5cb14..c3bd8224c 100644 --- a/Scripts/Mobiles/Monsters/Humanoid/Magic/GargoyleDestroyer.cs +++ b/Scripts/Mobiles/Monsters/Humanoid/Magic/GargoyleDestroyer.cs @@ -62,7 +62,7 @@ namespace Server.Mobiles public override void OnDamagedBySpell( Mobile from ) { - if( from != null && from.Alive && 0.4 > Utility.RandomDouble() ) + if ( from != null && from.Alive && 0.4 > Utility.RandomDouble() ) { ThrowHatchet( from ); } @@ -72,7 +72,7 @@ namespace Server.Mobiles { base.OnGotMeleeAttack( attacker ); - if( attacker != null && attacker.Alive && attacker.Weapon is BaseRanged && 0.4 > Utility.RandomDouble() ) + if ( attacker != null && attacker.Alive && attacker.Weapon is BaseRanged && 0.4 > Utility.RandomDouble() ) { ThrowHatchet( attacker ); } diff --git a/Scripts/Mobiles/Monsters/Humanoid/Magic/SavageShaman.cs b/Scripts/Mobiles/Monsters/Humanoid/Magic/SavageShaman.cs index 5382078f9..833259e0a 100644 --- a/Scripts/Mobiles/Monsters/Humanoid/Magic/SavageShaman.cs +++ b/Scripts/Mobiles/Monsters/Humanoid/Magic/SavageShaman.cs @@ -115,7 +115,7 @@ namespace Server.Mobiles public void BeginSavageDance() { - if( this.Map == null ) + if ( this.Map == null ) return; ArrayList list = new ArrayList(); diff --git a/Scripts/Mobiles/Monsters/Humanoid/Melee/SpectralArmour.cs b/Scripts/Mobiles/Monsters/Humanoid/Melee/SpectralArmour.cs index ba0967b95..fab3b22a0 100644 --- a/Scripts/Mobiles/Monsters/Humanoid/Melee/SpectralArmour.cs +++ b/Scripts/Mobiles/Monsters/Humanoid/Melee/SpectralArmour.cs @@ -17,7 +17,7 @@ namespace Server.Mobiles Hue = 0x8026; Buckler buckler = new Buckler(); - ChainCoif coif = new ChainCoif(); + ChainCoif coif = new ChainCoif (); PlateGloves gloves = new PlateGloves(); buckler.Hue = 0x835; buckler.Movable = false; diff --git a/Scripts/Mobiles/Monsters/LBR/Exodus/ExodusMinion.cs b/Scripts/Mobiles/Monsters/LBR/Exodus/ExodusMinion.cs index 1d0d3fa9c..ed5a19d88 100644 --- a/Scripts/Mobiles/Monsters/LBR/Exodus/ExodusMinion.cs +++ b/Scripts/Mobiles/Monsters/LBR/Exodus/ExodusMinion.cs @@ -107,7 +107,7 @@ namespace Server.Mobiles public override void OnDamagedBySpell( Mobile from ) { - if( from != null && from.Alive && 0.4 > Utility.RandomDouble() ) + if ( from != null && from.Alive && 0.4 > Utility.RandomDouble() ) { SendEBolt( from ); } @@ -139,7 +139,7 @@ namespace Server.Mobiles attacker.SendAsciiMessage( "Your weapon cannot penetrate the creature's magical barrier" ); } - if( attacker != null && attacker.Alive && attacker.Weapon is BaseRanged && 0.4 > Utility.RandomDouble() ) + if ( attacker != null && attacker.Alive && attacker.Weapon is BaseRanged && 0.4 > Utility.RandomDouble() ) { SendEBolt( attacker ); } diff --git a/Scripts/Mobiles/Monsters/LBR/Exodus/ExodusOverseer.cs b/Scripts/Mobiles/Monsters/LBR/Exodus/ExodusOverseer.cs index 7ad3a1f8a..abbcb5a4d 100644 --- a/Scripts/Mobiles/Monsters/LBR/Exodus/ExodusOverseer.cs +++ b/Scripts/Mobiles/Monsters/LBR/Exodus/ExodusOverseer.cs @@ -103,7 +103,7 @@ namespace Server.Mobiles public override void OnDamagedBySpell( Mobile from ) { - if( from != null && from.Alive && 0.4 > Utility.RandomDouble() ) + if ( from != null && from.Alive && 0.4 > Utility.RandomDouble() ) { SendEBolt( from ); } @@ -135,7 +135,7 @@ namespace Server.Mobiles attacker.SendAsciiMessage( "Your weapon cannot penetrate the creature's magical barrier" ); } - if( attacker != null && attacker.Alive && attacker.Weapon is BaseRanged && 0.4 > Utility.RandomDouble() ) + if ( attacker != null && attacker.Alive && attacker.Weapon is BaseRanged && 0.4 > Utility.RandomDouble() ) { SendEBolt( attacker ); } @@ -185,7 +185,7 @@ namespace Server.Mobiles m_FieldActive = CanUseField; - if( this.Name == "Exodus Overseer" ) + if ( this.Name == "Exodus Overseer" ) this.Name = null; } } diff --git a/Scripts/Mobiles/Monsters/LBR/Meers/EnragedCreatures.cs b/Scripts/Mobiles/Monsters/LBR/Meers/EnragedCreatures.cs index 9db2256a0..e26827986 100644 --- a/Scripts/Mobiles/Monsters/LBR/Meers/EnragedCreatures.cs +++ b/Scripts/Mobiles/Monsters/LBR/Meers/EnragedCreatures.cs @@ -197,9 +197,9 @@ namespace Server.Mobiles less than stam. */ - if( Str < Hits ) + if ( Str < Hits ) Str = Hits; - if( Dex < Stam ) + if ( Dex < Stam ) Dex = Stam; Karma = -1000; @@ -211,7 +211,7 @@ namespace Server.Mobiles public override void OnThink() { - if( SummonMaster == null || SummonMaster.Deleted ) + if ( SummonMaster == null || SummonMaster.Deleted ) { Delete(); } @@ -222,9 +222,9 @@ namespace Server.Mobiles but never actually "follow". */ - else if( !Combat( this )) + else if ( !Combat( this )) { - if( AIObject != null ) + if ( AIObject != null ) { AIObject.MoveTo( SummonMaster, false , 5 ); } @@ -237,14 +237,14 @@ namespace Server.Mobiles engaged in combat. */ - else if( !Combat( SummonMaster )) + else if ( !Combat( SummonMaster )) { BaseCreature bc = null; - if( Combatant is BaseCreature ) + if ( Combatant is BaseCreature ) { bc = (BaseCreature)Combatant; } - if( Combatant.Player || ( bc != null && ( bc.Controlled || bc.SummonMaster != null ))) + if ( Combatant.Player || ( bc != null && ( bc.Controlled || bc.SummonMaster != null ))) { SummonMaster.Combatant = Combatant; } @@ -258,7 +258,7 @@ namespace Server.Mobiles private bool Combat( Mobile mobile ) { Mobile combatant = mobile.Combatant; - if( combatant == null || combatant.Deleted ) + if ( combatant == null || combatant.Deleted ) { return false; } diff --git a/Scripts/Mobiles/Monsters/LBR/Meers/MeerMage.cs b/Scripts/Mobiles/Monsters/LBR/Meers/MeerMage.cs index 1fa9c67c6..97a160668 100644 --- a/Scripts/Mobiles/Monsters/LBR/Meers/MeerMage.cs +++ b/Scripts/Mobiles/Monsters/LBR/Meers/MeerMage.cs @@ -89,11 +89,11 @@ namespace Server.Mobiles { m_NextAbilityTime = DateTime.UtcNow + TimeSpan.FromSeconds( Utility.RandomMinMax( 20, 30 ) ); - if( combatant is BaseCreature ) + if ( combatant is BaseCreature ) { BaseCreature bc = (BaseCreature)combatant; - if( bc.Controlled && bc.ControlMaster != null && !bc.ControlMaster.Deleted && bc.ControlMaster.Alive ) + if ( bc.Controlled && bc.ControlMaster != null && !bc.ControlMaster.Deleted && bc.ControlMaster.Alive ) { if ( bc.ControlMaster.Map == this.Map && bc.ControlMaster.InRange( this, 12 ) && !UnderEffect( bc.ControlMaster ) ) { @@ -102,7 +102,7 @@ namespace Server.Mobiles } } - if( Utility.RandomDouble() < .1 ) + if ( Utility.RandomDouble() < .1 ) { int[][] coord = { diff --git a/Scripts/Mobiles/Monsters/ML/Animal/Ferret.cs b/Scripts/Mobiles/Monsters/ML/Animal/Ferret.cs index c0f74ec54..b60b72227 100644 --- a/Scripts/Mobiles/Monsters/ML/Animal/Ferret.cs +++ b/Scripts/Mobiles/Monsters/ML/Animal/Ferret.cs @@ -78,11 +78,11 @@ namespace Server.Mobiles Say( m_Vocabulary[ Utility.Random( m_Vocabulary.Length ) ] ); if ( to != null && Utility.RandomBool() ) - Timer.DelayCall( TimeSpan.FromSeconds( Utility.RandomMinMax( 5, 8 ) ), new TimerCallback( delegate() { to.Talk(); } ) ); + Timer.DelayCall( TimeSpan.FromSeconds( Utility.RandomMinMax( 5, 8 ) ), new TimerCallback( delegate { to.Talk(); } ) ); m_CanTalk = false; - Timer.DelayCall( TimeSpan.FromSeconds( Utility.RandomMinMax( 20, 30 ) ), new TimerCallback( delegate() { m_CanTalk = true; } ) ); + Timer.DelayCall( TimeSpan.FromSeconds( Utility.RandomMinMax( 20, 30 ) ), new TimerCallback( delegate { m_CanTalk = true; } ) ); } } diff --git a/Scripts/Mobiles/Monsters/ML/Humanoid/Magic/InterredGrizzle .cs b/Scripts/Mobiles/Monsters/ML/Humanoid/Magic/InterredGrizzle .cs index 4176802c9..f9ad1accf 100644 --- a/Scripts/Mobiles/Monsters/ML/Humanoid/Magic/InterredGrizzle .cs +++ b/Scripts/Mobiles/Monsters/ML/Humanoid/Magic/InterredGrizzle .cs @@ -86,7 +86,7 @@ namespace Server.Mobiles public override void OnDamage( int amount, Mobile from, bool willKill ) { - if( Utility.RandomDouble() < 0.1 ) + if ( Utility.RandomDouble() < 0.1 ) DropOoze(); base.OnDamage( amount, from, willKill ); @@ -104,7 +104,7 @@ namespace Server.Mobiles public virtual Point3D GetSpawnPosition( Point3D from, Map map, int range ) { - if( map == null ) + if ( map == null ) return from; Point3D loc = new Point3D( ( RandomPoint( X ) ), ( RandomPoint( Y ) ), Z ); @@ -130,22 +130,22 @@ namespace Server.Mobiles bool found = false; foreach( Item item in Map.GetItemsInRange( p, 0 ) ) - if( item is StainedOoze ) + if ( item is StainedOoze ) { found = true; break; } - if( !found ) + if ( !found ) break; } ooze.MoveToWorld( p, Map ); } - if( Combatant != null ) + if ( Combatant != null ) { - if( corrosive ) + if ( corrosive ) Combatant.SendLocalizedMessage( 1072071 ); // A corrosive gas seeps out of your enemy's skin! else Combatant.SendLocalizedMessage( 1072072 ); // A poisonous gas seeps out of your enemy's skin! diff --git a/Scripts/Mobiles/Monsters/ML/Misc/Magic/GreaterDragon.cs b/Scripts/Mobiles/Monsters/ML/Misc/Magic/GreaterDragon.cs index a6e71454d..fa7afeaa2 100644 --- a/Scripts/Mobiles/Monsters/ML/Misc/Magic/GreaterDragon.cs +++ b/Scripts/Mobiles/Monsters/ML/Misc/Magic/GreaterDragon.cs @@ -90,7 +90,7 @@ namespace Server.Mobiles SetDamage( 24, 33 ); - if( version == 0 ) + if ( version == 0 ) { Server.SkillHandlers.AnimalTaming.ScaleStats( this, 0.50 ); Server.SkillHandlers.AnimalTaming.ScaleSkills( this, 0.80, 0.90 ); // 90% * 80% = 72% of original skills trainable to 90% diff --git a/Scripts/Mobiles/Monsters/ML/Special/Ilhenir.cs b/Scripts/Mobiles/Monsters/ML/Special/Ilhenir.cs index cfd5a4700..5af8d5a0f 100644 --- a/Scripts/Mobiles/Monsters/ML/Special/Ilhenir.cs +++ b/Scripts/Mobiles/Monsters/ML/Special/Ilhenir.cs @@ -125,10 +125,10 @@ namespace Server.Mobiles /*if ( Utility.RandomDouble() < 0.6 ) c.DropItem( new ParrotItem() ); */ - if( Utility.RandomDouble() < 0.05 ) + if ( Utility.RandomDouble() < 0.05 ) c.DropItem( new GrizzledMareStatuette() ); - if( Utility.RandomDouble() < 0.025 ) + if ( Utility.RandomDouble() < 0.025 ) c.DropItem( new CrimsonCincture() ); // TODO: Armor sets @@ -156,13 +156,13 @@ namespace Server.Mobiles { base.OnGaveMeleeAttack( defender ); - if( Utility.RandomDouble() < 0.25 ) + if ( Utility.RandomDouble() < 0.25 ) CacophonicAttack( defender ); } public override void OnDamage( int amount, Mobile from, bool willKill ) { - if( Utility.RandomDouble() < 0.1 ) + if ( Utility.RandomDouble() < 0.1 ) DropOoze(); base.OnDamage( amount, from, willKill ); @@ -216,10 +216,10 @@ namespace Server.Mobiles public virtual void CacophonicAttack( Mobile to ) { - if( m_Table == null ) + if ( m_Table == null ) m_Table = new Hashtable(); - if( to.Alive && to.Player && m_Table[ to ] == null ) + if ( to.Alive && to.Player && m_Table[ to ] == null ) { to.Send( SpeedControl.WalkSpeed ); to.SendLocalizedMessage( 1072069 ); // A cacophonic sound lambastes you, suppressing your ability to move. @@ -231,13 +231,13 @@ namespace Server.Mobiles private void EndCacophonic_Callback( object state ) { - if( state is Mobile ) + if ( state is Mobile ) CacophonicEnd( (Mobile)state ); } public virtual void CacophonicEnd( Mobile from ) { - if( m_Table == null ) + if ( m_Table == null ) m_Table = new Hashtable(); m_Table[ from ] = null; @@ -247,7 +247,7 @@ namespace Server.Mobiles public static bool UnderCacophonicAttack( Mobile from ) { - if( m_Table == null ) + if ( m_Table == null ) m_Table = new Hashtable(); return m_Table[ from ] != null; @@ -271,22 +271,22 @@ namespace Server.Mobiles bool found = false; foreach( Item item in Map.GetItemsInRange( p, 0 ) ) - if( item is StainedOoze ) + if ( item is StainedOoze ) { found = true; break; } - if( !found ) + if ( !found ) break; } ooze.MoveToWorld( p, Map ); } - if( Combatant != null ) + if ( Combatant != null ) { - if( corrosive ) + if ( corrosive ) Combatant.SendLocalizedMessage( 1072071 ); // A corrosive gas seeps out of your enemy's skin! else Combatant.SendLocalizedMessage( 1072072 ); // A poisonous gas seeps out of your enemy's skin! @@ -305,7 +305,7 @@ namespace Server.Mobiles public virtual Point3D GetSpawnPosition( Point3D from, Map map, int range ) { - if( map == null ) + if ( map == null ) return from; Point3D loc = new Point3D( ( RandomPoint( X ) ), ( RandomPoint( Y ) ), Z ); diff --git a/Scripts/Mobiles/Monsters/ML/Special/Meraktus.cs b/Scripts/Mobiles/Monsters/ML/Special/Meraktus.cs index 0f2d9b901..932b7b6a3 100644 --- a/Scripts/Mobiles/Monsters/ML/Special/Meraktus.cs +++ b/Scripts/Mobiles/Monsters/ML/Special/Meraktus.cs @@ -187,10 +187,10 @@ namespace Server.Mobiles for (int i = 0; i < targets.Count; ++i) { Mobile m = (Mobile)targets[i]; - if( m != null && !m.Deleted && m is PlayerMobile ) + if ( m != null && !m.Deleted && m is PlayerMobile ) { PlayerMobile pm = m as PlayerMobile; - if(pm != null && pm.Mounted) + if (pm != null && pm.Mounted) { pm.Mount.Rider=null; } diff --git a/Scripts/Mobiles/Monsters/ML/Twisted Weald/Swoop.cs b/Scripts/Mobiles/Monsters/ML/Twisted Weald/Swoop.cs index 3c1456955..f9ff7a5c8 100644 --- a/Scripts/Mobiles/Monsters/ML/Twisted Weald/Swoop.cs +++ b/Scripts/Mobiles/Monsters/ML/Twisted Weald/Swoop.cs @@ -55,11 +55,11 @@ namespace Server.Mobiles { base.OnGaveMeleeAttack( defender ); - if( 0.1 > Utility.RandomDouble() ) + if ( 0.1 > Utility.RandomDouble() ) { ExpireTimer timer = (ExpireTimer)m_Table[defender]; - if( timer != null ) + if ( timer != null ) { timer.DoExpire(); defender.SendLocalizedMessage( 1070837 ); // The creature lands another blow in your weakened state. diff --git a/Scripts/Mobiles/Monsters/Misc/Melee/PlagueBeast.cs b/Scripts/Mobiles/Monsters/Misc/Melee/PlagueBeast.cs index ea471ba46..1f153de91 100644 --- a/Scripts/Mobiles/Monsters/Misc/Melee/PlagueBeast.cs +++ b/Scripts/Mobiles/Monsters/Misc/Melee/PlagueBeast.cs @@ -190,7 +190,7 @@ namespace Server.Mobiles // Ensure that the corpse was killed by us if ( item.Killer == this && item.Owner != null ) { - if( !item.DevourCorpse() && !item.Devoured ) + if ( !item.DevourCorpse() && !item.Devoured ) PublicOverheadMessage( MessageType.Emote, 0x3B2, 1053032 ); // * The plague beast attempts to absorb the remains, but cannot! * } } @@ -201,10 +201,10 @@ namespace Server.Mobiles public bool Devour( Corpse corpse ) { - if( corpse == null || corpse.Owner == null ) // sorry we can't devour because the corpse's owner is null + if ( corpse == null || corpse.Owner == null ) // sorry we can't devour because the corpse's owner is null return false; - if( corpse.Owner.Body.IsHuman ) + if ( corpse.Owner.Body.IsHuman ) corpse.TurnToBones(); // Not bones yet, and we are a human body therefore we turn to bones. IncreaseHits( (int)Math.Ceiling( (double)corpse.Owner.HitsMax * 0.75 ) ); @@ -212,7 +212,7 @@ namespace Server.Mobiles PublicOverheadMessage( MessageType.Emote, 0x3B2, 1053033 ); // * The plague beast absorbs the fleshy remains of the corpse * - if( !m_HasMetalChest && m_DevourTotal >= DevourGoal ) + if ( !m_HasMetalChest && m_DevourTotal >= DevourGoal ) { PackItem( new MetalChest() ); m_HasMetalChest = true; @@ -230,10 +230,10 @@ namespace Server.Mobiles if ( this.IsParagon ) maxhits = (int)(maxhits * Paragon.HitsBuff); - if( hp < 1000 && !Core.AOS ) + if ( hp < 1000 && !Core.AOS ) hp = (hp * 100) / 60; - if( HitsMaxSeed >= maxhits ) + if ( HitsMaxSeed >= maxhits ) { HitsMaxSeed = maxhits; diff --git a/Scripts/Mobiles/Monsters/Reptile/Melee/Kraken.cs b/Scripts/Mobiles/Monsters/Reptile/Melee/Kraken.cs index e74075894..3bd815e28 100644 --- a/Scripts/Mobiles/Monsters/Reptile/Melee/Kraken.cs +++ b/Scripts/Mobiles/Monsters/Reptile/Melee/Kraken.cs @@ -50,7 +50,7 @@ namespace Server.Mobiles rope.ItemID = 0x14F8; PackItem( rope ); - if( Utility.RandomDouble() < .05 ) + if ( Utility.RandomDouble() < .05 ) PackItem( new MessageInABottle() ); PackItem( new SpecialFishingNet() ); //Confirm? diff --git a/Scripts/Mobiles/Monsters/SE/DeathWatchBeetle.cs b/Scripts/Mobiles/Monsters/SE/DeathWatchBeetle.cs index d70fe55b9..915934976 100644 --- a/Scripts/Mobiles/Monsters/SE/DeathWatchBeetle.cs +++ b/Scripts/Mobiles/Monsters/SE/DeathWatchBeetle.cs @@ -111,7 +111,7 @@ namespace Server.Mobiles if ( combatant == null || combatant.Deleted || combatant.Map != Map || !InRange( combatant, 12 ) || !CanBeHarmful( combatant ) || !InLOS( combatant ) ) return; - if( Utility.Random( 10 ) == 0 ) + if ( Utility.Random( 10 ) == 0 ) PoisonAttack( combatant ); base.OnDamage( amount, from, willKill ); diff --git a/Scripts/Mobiles/Monsters/SE/DeathWatchBeetleHatchling.cs b/Scripts/Mobiles/Monsters/SE/DeathWatchBeetleHatchling.cs index c25f51355..96a7ef229 100644 --- a/Scripts/Mobiles/Monsters/SE/DeathWatchBeetleHatchling.cs +++ b/Scripts/Mobiles/Monsters/SE/DeathWatchBeetleHatchling.cs @@ -41,7 +41,7 @@ namespace Server.Mobiles Karma = -700; - if( Utility.RandomBool() ) + if ( Utility.RandomBool() ) { Item i = Loot.RandomReagent(); i.Amount = 3; diff --git a/Scripts/Mobiles/Monsters/SE/EliteNinja.cs b/Scripts/Mobiles/Monsters/SE/EliteNinja.cs index 3d2aea00f..59a97fd01 100644 --- a/Scripts/Mobiles/Monsters/SE/EliteNinja.cs +++ b/Scripts/Mobiles/Monsters/SE/EliteNinja.cs @@ -68,7 +68,7 @@ namespace Server.Mobiles AddItem( new LeatherNinjaPants()); AddItem( new LeatherNinjaMitts()); - if( Utility.RandomDouble() < 0.33 ) + if ( Utility.RandomDouble() < 0.33 ) AddItem( new SmokeBomb() ); switch ( Utility.Random( 8 )) diff --git a/Scripts/Mobiles/Monsters/SE/FireBeetle.cs b/Scripts/Mobiles/Monsters/SE/FireBeetle.cs index e121c0ca7..27f336bb2 100644 --- a/Scripts/Mobiles/Monsters/SE/FireBeetle.cs +++ b/Scripts/Mobiles/Monsters/SE/FireBeetle.cs @@ -118,7 +118,7 @@ namespace Server.Mobiles int version = reader.ReadInt(); - if( version == 0 ) + if ( version == 0 ) Hue = 0x489; } } diff --git a/Scripts/Mobiles/Monsters/SE/KazeKemono.cs b/Scripts/Mobiles/Monsters/SE/KazeKemono.cs index e7c59090b..2f1ca6cf4 100644 --- a/Scripts/Mobiles/Monsters/SE/KazeKemono.cs +++ b/Scripts/Mobiles/Monsters/SE/KazeKemono.cs @@ -58,7 +58,7 @@ namespace Server.Mobiles { base.OnGaveMeleeAttack( defender ); - if( 0.1 > Utility.RandomDouble() ) + if ( 0.1 > Utility.RandomDouble() ) { /* Flurry of Twigs * Start cliloc: 1070850 @@ -69,7 +69,7 @@ namespace Server.Mobiles ExpireTimer timer = (ExpireTimer)m_FlurryOfTwigsTable[defender]; - if( timer != null ) + if ( timer != null ) { timer.DoExpire(); defender.SendLocalizedMessage( 1070851 ); // The creature lands another blow in your weakened state. @@ -88,7 +88,7 @@ namespace Server.Mobiles timer.Start(); m_FlurryOfTwigsTable[defender] = timer; } - else if( 0.05 > Utility.RandomDouble() ) + else if ( 0.05 > Utility.RandomDouble() ) { /* Chlorophyl Blast * Start cliloc: 1070827 @@ -99,7 +99,7 @@ namespace Server.Mobiles ExpireTimer timer = (ExpireTimer)m_ChlorophylBlastTable[defender]; - if( timer != null ) + if ( timer != null ) { timer.DoExpire(); defender.SendLocalizedMessage( 1070828 ); // The creature continues to hinder your energy resistance! @@ -147,7 +147,7 @@ namespace Server.Mobiles protected override void OnTick() { - if( m_Mod.Type == ResistanceType.Physical ) + if ( m_Mod.Type == ResistanceType.Physical ) m_Mobile.SendLocalizedMessage( 1070852 ); // Your resistance to physical attacks has returned. else m_Mobile.SendLocalizedMessage( 1070829 ); // Your resistance to energy attacks has returned. diff --git a/Scripts/Mobiles/Monsters/SE/LadyOfTheSnow.cs b/Scripts/Mobiles/Monsters/SE/LadyOfTheSnow.cs index b49098226..51d8089db 100644 --- a/Scripts/Mobiles/Monsters/SE/LadyOfTheSnow.cs +++ b/Scripts/Mobiles/Monsters/SE/LadyOfTheSnow.cs @@ -73,7 +73,7 @@ namespace Server.Mobiles { base.OnGaveMeleeAttack( defender ); - if( 0.1 > Utility.RandomDouble() ) + if ( 0.1 > Utility.RandomDouble() ) { /* Cold Wind * Graphics: Message - Type: "3" From: "0x57D4F5B" To: "0x0" ItemId: "0x37B9" ItemIdName: "glow" FromLocation: "(928 164, 34)" ToLocation: "(928 164, 34)" Speed: "10" Duration: "5" FixedDirection: "True" Explode: "False" @@ -85,7 +85,7 @@ namespace Server.Mobiles ExpireTimer timer = (ExpireTimer)m_Table[defender]; - if( timer != null ) + if ( timer != null ) { timer.DoExpire(); defender.SendLocalizedMessage( 1070831 ); // The freezing wind continues to blow! @@ -123,7 +123,7 @@ namespace Server.Mobiles public void DrainLife() { - if( m_Mobile.Alive ) + if ( m_Mobile.Alive ) m_Mobile.Damage( 2, m_From ); else DoExpire(); @@ -133,7 +133,7 @@ namespace Server.Mobiles { DrainLife(); - if( ++m_Count >= 5 ) + if ( ++m_Count >= 5 ) { DoExpire(); m_Mobile.SendLocalizedMessage( 1070830 ); // The icy wind dissipates. diff --git a/Scripts/Mobiles/Monsters/SE/Ronin.cs b/Scripts/Mobiles/Monsters/SE/Ronin.cs index 8e75d0157..72a3db959 100644 --- a/Scripts/Mobiles/Monsters/SE/Ronin.cs +++ b/Scripts/Mobiles/Monsters/SE/Ronin.cs @@ -69,7 +69,7 @@ namespace Server.Mobiles - if( Utility.RandomDouble() > .2 ) + if ( Utility.RandomDouble() > .2 ) AddItem( new NoDachi() ); else AddItem( new Halberd() ); diff --git a/Scripts/Mobiles/Monsters/SE/RuneBeetle.cs b/Scripts/Mobiles/Monsters/SE/RuneBeetle.cs index 85131c823..d7c0b2b4a 100644 --- a/Scripts/Mobiles/Monsters/SE/RuneBeetle.cs +++ b/Scripts/Mobiles/Monsters/SE/RuneBeetle.cs @@ -220,7 +220,7 @@ namespace Server.Mobiles base.Deserialize( reader ); int version = reader.ReadInt(); - if( version < 1 ) + if ( version < 1 ) { for ( int i = 0; i < Skills.Length; ++i ) { diff --git a/Scripts/Mobiles/Monsters/SE/TsukiWolf.cs b/Scripts/Mobiles/Monsters/SE/TsukiWolf.cs index 3d6bf0ead..b23bdfd87 100644 --- a/Scripts/Mobiles/Monsters/SE/TsukiWolf.cs +++ b/Scripts/Mobiles/Monsters/SE/TsukiWolf.cs @@ -75,7 +75,7 @@ namespace Server.Mobiles { base.OnGaveMeleeAttack( defender ); - if( 0.1 > Utility.RandomDouble() ) + if ( 0.1 > Utility.RandomDouble() ) { /* Blood Bath * Start cliloc 1070826 @@ -87,7 +87,7 @@ namespace Server.Mobiles ExpireTimer timer = (ExpireTimer)m_Table[defender]; - if( timer != null ) + if ( timer != null ) { timer.DoExpire(); defender.SendLocalizedMessage( 1070825 ); // The creature continues to rage! @@ -125,7 +125,7 @@ namespace Server.Mobiles public void DrainLife() { - if( m_Mobile.Alive ) + if ( m_Mobile.Alive ) m_Mobile.Damage( 2, m_From ); else DoExpire(); @@ -135,7 +135,7 @@ namespace Server.Mobiles { DrainLife(); - if( ++m_Count >= 5 ) + if ( ++m_Count >= 5 ) { DoExpire(); m_Mobile.SendLocalizedMessage( 1070824 ); // The creature's rage subsides. diff --git a/Scripts/Mobiles/Monsters/SE/Yamandon.cs b/Scripts/Mobiles/Monsters/SE/Yamandon.cs index 72843c49e..a6527522b 100644 --- a/Scripts/Mobiles/Monsters/SE/Yamandon.cs +++ b/Scripts/Mobiles/Monsters/SE/Yamandon.cs @@ -78,7 +78,7 @@ namespace Server.Mobiles private void DoCounter( Mobile attacker ) { - if( this.Map == null ) + if ( this.Map == null ) return; if ( attacker is BaseCreature && ((BaseCreature)attacker).BardProvoked ) @@ -99,7 +99,7 @@ namespace Server.Mobiles { Mobile m = ((BaseCreature)attacker).GetMaster(); - if( m != null ) + if ( m != null ) target = m; } diff --git a/Scripts/Mobiles/Monsters/SE/YomotsuWarrior.cs b/Scripts/Mobiles/Monsters/SE/YomotsuWarrior.cs index f3d42afcc..ab1cd14a8 100644 --- a/Scripts/Mobiles/Monsters/SE/YomotsuWarrior.cs +++ b/Scripts/Mobiles/Monsters/SE/YomotsuWarrior.cs @@ -45,7 +45,7 @@ namespace Server.Mobiles PackItem( new GreenGourd() ); PackItem( new ExecutionersAxe() ); - if( Utility.RandomBool() ) + if ( Utility.RandomBool() ) PackItem( new LongPants() ); else PackItem( new ShortPants() ); diff --git a/Scripts/Mobiles/PlayerMobile.cs b/Scripts/Mobiles/PlayerMobile.cs index b29163f3d..43ccd74c2 100644 --- a/Scripts/Mobiles/PlayerMobile.cs +++ b/Scripts/Mobiles/PlayerMobile.cs @@ -233,7 +233,7 @@ namespace Server.Mobiles { get { - if( m_AllFollowers == null ) + if ( m_AllFollowers == null ) m_AllFollowers = new List(); return m_AllFollowers; } @@ -243,7 +243,7 @@ namespace Server.Mobiles { get { - if( this.AccessLevel >= AccessLevel.GameMaster ) + if ( this.AccessLevel >= AccessLevel.GameMaster ) return Server.Guilds.RankDefinition.Leader; else return m_GuildRank; @@ -294,7 +294,7 @@ namespace Server.Mobiles } set { - if( m_IgnoreMobiles != value ) + if ( m_IgnoreMobiles != value ) { m_IgnoreMobiles = value; Delta( MobileDelta.Flags ); @@ -722,7 +722,7 @@ namespace Server.Mobiles EventSink.Connected += new ConnectedEventHandler( EventSink_Connected ); EventSink.Disconnected += new DisconnectedEventHandler( EventSink_Disconnected ); - if( Core.SE ) + if ( Core.SE ) { Timer.DelayCall( TimeSpan.Zero, new TimerCallback( CheckPets ) ); } @@ -732,11 +732,11 @@ namespace Server.Mobiles { foreach( Mobile m in World.Mobiles.Values ) { - if( m is PlayerMobile ) + if ( m is PlayerMobile ) { PlayerMobile pm = (PlayerMobile)m; - if((( !pm.Mounted || ( pm.Mount != null && pm.Mount is EtherealMount )) && ( pm.AllFollowers.Count > pm.AutoStabled.Count )) || + if ((( !pm.Mounted || ( pm.Mount != null && pm.Mount is EtherealMount )) && ( pm.AllFollowers.Count > pm.AutoStabled.Count )) || ( pm.Mounted && ( pm.AllFollowers.Count > ( pm.AutoStabled.Count +1 )))) { pm.AutoStablePets(); /* autostable checks summons, et al: no need here */ @@ -780,19 +780,19 @@ namespace Server.Mobiles public void SetMountBlock( BlockMountType type, TimeSpan duration, bool dismount ) { - if( dismount ) + if ( dismount ) { if ( this.Mount != null ) { this.Mount.Rider = null; } - else if( AnimalForm.UnderTransformation( this ) ) + else if ( AnimalForm.UnderTransformation( this ) ) { AnimalForm.RemoveContext(this, true); } } - if( ( m_MountBlock == null ) || !m_MountBlock.m_Timer.Running || ( m_MountBlock.m_Timer.Next < ( DateTime.UtcNow + duration ) ) ) + if ( ( m_MountBlock == null ) || !m_MountBlock.m_Timer.Running || ( m_MountBlock.m_Timer.Next < ( DateTime.UtcNow + duration ) ) ) { m_MountBlock = new MountBlock( duration, type, this ); } @@ -814,7 +814,7 @@ namespace Server.Mobiles if ( type != ResistanceType.Physical && 60 < max && Spells.Fourth.CurseSpell.UnderEffect( this ) ) max = 60; - if( Core.ML && this.Race == Race.Elf && type == ResistanceType.Energy ) + if ( Core.ML && this.Race == Race.Elf && type == ResistanceType.Energy ) max += 5; //Intended to go after the 60 max from curse return max; @@ -939,7 +939,7 @@ namespace Server.Mobiles return; } - if( from is PlayerMobile ) + if ( from is PlayerMobile ) ((PlayerMobile)from).ClaimAutoStabledPets(); } @@ -1027,13 +1027,13 @@ namespace Server.Mobiles bool drop = false; - if( dex < weapon.DexRequirement ) + if ( dex < weapon.DexRequirement ) drop = true; - else if( str < AOS.Scale( weapon.StrRequirement, 100 - weapon.GetLowerStatReq() ) ) + else if ( str < AOS.Scale( weapon.StrRequirement, 100 - weapon.GetLowerStatReq() ) ) drop = true; - else if( intel < weapon.IntRequirement ) + else if ( intel < weapon.IntRequirement ) drop = true; - else if( weapon.RequiredRace != null && weapon.RequiredRace != this.Race ) + else if ( weapon.RequiredRace != null && weapon.RequiredRace != this.Race ) drop = true; if ( drop ) @@ -1062,7 +1062,7 @@ namespace Server.Mobiles { drop = true; } - else if( armor.RequiredRace != null && armor.RequiredRace != this.Race ) + else if ( armor.RequiredRace != null && armor.RequiredRace != this.Race ) { drop = true; } @@ -1072,11 +1072,11 @@ namespace Server.Mobiles int dexBonus = armor.ComputeStatBonus( StatType.Dex ), dexReq = armor.ComputeStatReq( StatType.Dex ); int intBonus = armor.ComputeStatBonus( StatType.Int ), intReq = armor.ComputeStatReq( StatType.Int ); - if( dex < dexReq || (dex + dexBonus) < 1 ) + if ( dex < dexReq || (dex + dexBonus) < 1 ) drop = true; - else if( str < strReq || (str + strBonus) < 1 ) + else if ( str < strReq || (str + strBonus) < 1 ) drop = true; - else if( intel < intReq || (intel + intBonus) < 1 ) + else if ( intel < intReq || (intel + intBonus) < 1 ) drop = true; } @@ -1110,7 +1110,7 @@ namespace Server.Mobiles { drop = true; } - else if( clothing.RequiredRace != null && clothing.RequiredRace != this.Race ) + else if ( clothing.RequiredRace != null && clothing.RequiredRace != this.Race ) { drop = true; } @@ -1119,7 +1119,7 @@ namespace Server.Mobiles int strBonus = clothing.ComputeStatBonus( StatType.Str ); int strReq = clothing.ComputeStatReq( StatType.Str ); - if( str < strReq || (str + strBonus) < 1 ) + if ( str < strReq || (str + strBonus) < 1 ) drop = true; } @@ -1192,7 +1192,7 @@ namespace Server.Mobiles private static void OnLogout( LogoutEventArgs e ) { - if( e.Mobile is PlayerMobile ) + if ( e.Mobile is PlayerMobile ) ((PlayerMobile)e.Mobile).AutoStablePets(); } @@ -1290,7 +1290,7 @@ namespace Server.Mobiles { RemoveBuff(BuffIcon.HidingAndOrStealth); } - else// if( !InvisibilitySpell.HasTimer( this ) ) + else// if ( !InvisibilitySpell.HasTimer( this ) ) { BuffInfo.AddBuff(this, new BuffInfo(BuffIcon.HidingAndOrStealth, 1075655)); //Hidden/Stealthing & You Are Hidden } @@ -1397,7 +1397,7 @@ namespace Server.Mobiles { BaseArmor ar = armor as BaseArmor; - if( ar != null && ( !Core.AOS || ar.ArmorAttributes.MageArmor == 0 )) + if ( ar != null && ( !Core.AOS || ar.ArmorAttributes.MageArmor == 0 )) rating += ar.ArmorRatingScaled; } @@ -1450,7 +1450,7 @@ namespace Server.Mobiles { get { - if( Core.ML && this.AccessLevel == AccessLevel.Player ) + if ( Core.ML && this.AccessLevel == AccessLevel.Player ) return Math.Min( base.Str, 150 ); return base.Str; @@ -1466,7 +1466,7 @@ namespace Server.Mobiles { get { - if( Core.ML && this.AccessLevel == AccessLevel.Player ) + if ( Core.ML && this.AccessLevel == AccessLevel.Player ) return Math.Min( base.Int, 150 ); return base.Int; @@ -1482,7 +1482,7 @@ namespace Server.Mobiles { get { - if( Core.ML && this.AccessLevel == AccessLevel.Player ) + if ( Core.ML && this.AccessLevel == AccessLevel.Player ) return Math.Min( base.Dex, 150 ); return base.Dex; @@ -1578,7 +1578,7 @@ namespace Server.Mobiles { for( int i = 0; i < m_AnimalFormRestrictedSkills.Length; i++ ) { - if( m_AnimalFormRestrictedSkills[i] == skill ) + if ( m_AnimalFormRestrictedSkills[i] == skill ) { SendLocalizedMessage( 1070771 ); // You cannot use that skill in this form. return false; @@ -1684,7 +1684,7 @@ namespace Server.Mobiles if ( m_JusticeProtectors.Count > 0 ) list.Add( new CallbackEntry( 6157, new ContextCallback( CancelProtection ) ) ); - if( Alive ) + if ( Alive ) list.Add( new CallbackEntry( 6210, new ContextCallback( ToggleChampionTitleDisplay ) ) ); if ( Core.HS ) @@ -1720,7 +1720,7 @@ namespace Server.Mobiles BaseHouse curhouse = BaseHouse.FindHouseAt( this ); - if( curhouse != null ) + if ( curhouse != null ) { if ( Alive && Core.Expansion >= Expansion.AOS && curhouse.IsAosRules && curhouse.IsFriend( from ) ) list.Add( new EjectPlayerEntry( from, this ) ); @@ -1865,9 +1865,9 @@ namespace Server.Mobiles if ( !CheckAlive() ) return; - if( Core.SE ) + if ( Core.SE ) { - if( !HasGump( typeof( CancelRenewInventoryInsuranceGump ) ) ) + if ( !HasGump( typeof( CancelRenewInventoryInsuranceGump ) ) ) SendGump( new CancelRenewInventoryInsuranceGump( this, null ) ); } else @@ -2283,7 +2283,7 @@ namespace Server.Mobiles public override void DisruptiveAction() { - if( Meditating ) + if ( Meditating ) { RemoveBuff( BuffIcon.ActiveMeditation ); } @@ -2545,7 +2545,7 @@ namespace Server.Mobiles public override bool CheckShove( Mobile shoved ) { - if( m_IgnoreMobiles || TransformationSpellHelper.UnderTransformation( shoved, typeof( WraithFormSpell ) ) ) + if ( m_IgnoreMobiles || TransformationSpellHelper.UnderTransformation( shoved, typeof( WraithFormSpell ) ) ) return true; else return base.CheckShove( shoved ); @@ -2603,7 +2603,7 @@ namespace Server.Mobiles c.Slip(); } - if( Confidence.IsRegenerating( this ) ) + if ( Confidence.IsRegenerating( this ) ) Confidence.StopRegenerating( this ); WeightOverloading.FatigueOnDamage( this, amount ); @@ -2638,7 +2638,7 @@ namespace Server.Mobiles { get { - if( Core.ML && this.Race == Race.Human ) + if ( Core.ML && this.Race == Race.Human ) return 20.0; return 0; @@ -2859,7 +2859,7 @@ namespace Server.Mobiles { Mobile m = FindMostRecentDamager( false ); - if( m is BaseCreature ) + if ( m is BaseCreature ) m = ((BaseCreature)m).GetMaster(); if ( m != null && m is PlayerMobile && m != this ) @@ -2902,7 +2902,7 @@ namespace Server.Mobiles BaseCreature bc = (BaseCreature)killer; Mobile master = bc.GetMaster(); - if( master != null ) + if ( master != null ) killer = master; } @@ -2924,13 +2924,13 @@ namespace Server.Mobiles m_DuelContext.OnDeath( this, c ); #endregion - if( m_BuffTable != null ) + if ( m_BuffTable != null ) { List list = new List(); foreach( BuffInfo buff in m_BuffTable.Values ) { - if( !buff.RetainThroughDeath ) + if ( !buff.RetainThroughDeath ) { list.Add( buff ); } @@ -3121,16 +3121,16 @@ namespace Server.Mobiles public override void DoSpeech( string text, int[] keywords, MessageType type, int hue ) { - if( Guilds.Guild.NewGuildSystem && (type == MessageType.Guild || type == MessageType.Alliance) ) + if ( Guilds.Guild.NewGuildSystem && (type == MessageType.Guild || type == MessageType.Alliance) ) { Guilds.Guild g = this.Guild as Guilds.Guild; - if( g == null ) + if ( g == null ) { SendLocalizedMessage( 1063142 ); // You are not in a guild! } - else if( type == MessageType.Alliance ) + else if ( type == MessageType.Alliance ) { - if( g.Alliance != null && g.Alliance.IsMember( g ) ) + if ( g.Alliance != null && g.Alliance.IsMember( g ) ) { //g.Alliance.AllianceTextMessage( hue, "[Alliance][{0}]: {1}", this.Name, text ); g.Alliance.AllianceChat( this, text ); @@ -3165,9 +3165,9 @@ namespace Server.Mobiles { Mobile mob = ns.Mobile; - if( mob != null && mob.AccessLevel >= AccessLevel.GameMaster && mob.AccessLevel > from.AccessLevel ) + if ( mob != null && mob.AccessLevel >= AccessLevel.GameMaster && mob.AccessLevel > from.AccessLevel ) { - if( p == null ) + if ( p == null ) p = Packet.Acquire( new UnicodeMessage( from.Serial, from.Body, MessageType.Regular, from.SpeechHue, 3, from.Language, from.Name, text ) ); ns.Send( p ); @@ -3197,12 +3197,12 @@ namespace Server.Mobiles { amount = (int)(amount * 1.1); - if( amount > 35 && from is PlayerMobile ) /* capped @ 35, seems no expansion */ + if ( amount > 35 && from is PlayerMobile ) /* capped @ 35, seems no expansion */ { amount = 35; } - if( Core.ML ) + if ( Core.ML ) { from.Damage( (int)(amount * ( 1 - ((( from.Skills.MagicResist.Value * .5 ) + 10) / 100 ))), this ); } @@ -3398,14 +3398,14 @@ namespace Server.Mobiles { int recipeCount = reader.ReadInt(); - if( recipeCount > 0 ) + if ( recipeCount > 0 ) { m_AcquiredRecipes = new Dictionary(); for( int i = 0; i < recipeCount; i++ ) { int r = reader.ReadInt(); - if( reader.ReadBool() ) //Don't add in recipies which we haven't gotten or have been removed + if ( reader.ReadBool() ) //Don't add in recipies which we haven't gotten or have been removed m_AcquiredRecipes.Add( r, true ); } } @@ -3443,7 +3443,7 @@ namespace Server.Mobiles { int rank = reader.ReadEncodedInt(); int maxRank = Guilds.RankDefinition.Ranks.Length -1; - if( rank > maxRank ) + if ( rank > maxRank ) rank = maxRank; m_GuildRank = Guilds.RankDefinition.Ranks[rank]; @@ -3592,7 +3592,7 @@ namespace Server.Mobiles } case 0: { - if( version < 26 ) + if ( version < 26 ) m_AutoStabled = new List(); break; } @@ -3614,13 +3614,13 @@ namespace Server.Mobiles if ( m_BOBFilter == null ) m_BOBFilter = new Engines.BulkOrders.BOBFilter(); - if( m_GuildRank == null ) + if ( m_GuildRank == null ) m_GuildRank = Guilds.RankDefinition.Member; //Default to member if going from older version to new version (only time it should be null) - if( m_LastOnline == DateTime.MinValue && Account != null ) + if ( m_LastOnline == DateTime.MinValue && Account != null ) m_LastOnline = ((Account)Account).LastLogin; - if( m_ChampionTitles == null ) + if ( m_ChampionTitles == null ) m_ChampionTitles = new ChampionTitleInfo(); if ( AccessLevel > AccessLevel.Player ) @@ -3641,7 +3641,7 @@ namespace Server.Mobiles CheckAtrophies( this ); - if( Hidden ) //Hiding is the only buff where it has an effect that's serialized. + if ( Hidden ) //Hiding is the only buff where it has an effect that's serialized. AddBuff( new BuffInfo( BuffIcon.HidingAndOrStealth, 1075655 ) ); } @@ -3689,7 +3689,7 @@ namespace Server.Mobiles writer.Write( (DateTime) m_AnkhNextUse ); writer.Write( m_AutoStabled, true ); - if( m_AcquiredRecipes == null ) + if ( m_AcquiredRecipes == null ) { writer.Write( (int)0 ); } @@ -3795,7 +3795,7 @@ namespace Server.Mobiles CompassionVirtue.CheckAtrophy( m ); ValorVirtue.CheckAtrophy( m ); - if( m is PlayerMobile ) + if ( m is PlayerMobile ) ChampionTitleInfo.CheckAtrophy( (PlayerMobile)m ); } @@ -3858,7 +3858,7 @@ namespace Server.Mobiles Mobile master = bc.GetMaster(); - if( master != null ) + if ( master != null ) owner = master; } @@ -3871,7 +3871,7 @@ namespace Server.Mobiles public virtual void CheckedAnimate( int action, int frameCount, int repeatCount, bool forward, bool repeat, int delay ) { - if( !Mounted ) + if ( !Mounted ) { base.Animate( action, frameCount, repeatCount, forward, repeat, delay ); } @@ -3988,24 +3988,24 @@ namespace Server.Mobiles protected override bool OnMove( Direction d ) { - if( !Core.SE ) + if ( !Core.SE ) return base.OnMove( d ); - if( AccessLevel != AccessLevel.Player ) + if ( AccessLevel != AccessLevel.Player ) return true; - if( Hidden && DesignContext.Find( this ) == null ) //Hidden & NOT customizing a house + if ( Hidden && DesignContext.Find( this ) == null ) //Hidden & NOT customizing a house { - if( !Mounted && Skills.Stealth.Value >= 25.0 ) + if ( !Mounted && Skills.Stealth.Value >= 25.0 ) { bool running = (d & Direction.Running) != 0; - if( running ) + if ( running ) { - if( (AllowedStealthSteps -= 2) <= 0 ) + if ( (AllowedStealthSteps -= 2) <= 0 ) RevealingAction(); } - else if( AllowedStealthSteps-- <= 0 ) + else if ( AllowedStealthSteps-- <= 0 ) { Server.SkillHandlers.Stealth.OnUse( this ); } @@ -4038,7 +4038,7 @@ namespace Server.Mobiles { base.Paralyzed = value; - if( value ) + if ( value ) AddBuff( new BuffInfo( BuffIcon.Paralyze, 1075827 ) ); //Paralyze/You are frozen and can not move else RemoveBuff( BuffIcon.Paralyze ); @@ -4246,7 +4246,7 @@ namespace Server.Mobiles AnimalFormContext animalContext = AnimalForm.GetContext( this ); - if( onHorse || (animalContext != null && animalContext.SpeedBoost) ) + if ( onHorse || (animalContext != null && animalContext.SpeedBoost) ) return ( running ? Mobile.RunMount : Mobile.WalkMount ); return ( running ? Mobile.RunFoot : Mobile.WalkFoot ); @@ -4349,7 +4349,7 @@ namespace Server.Mobiles private void CreateHair( bool hair, int id, int hue ) { - if( hair ) + if ( hair ) { //TODO Verification? HairItemID = id; @@ -4372,7 +4372,7 @@ namespace Server.Mobiles else FacialHairItemID = 0; - //if( id != 0 ) + //if ( id != 0 ) CreateHair( hair, id, hue ); id = -1; @@ -4500,7 +4500,7 @@ namespace Server.Mobiles if ( Region is BaseRegion && !((BaseRegion)Region).YoungProtected ) return false; - if( from is BaseCreature && ((BaseCreature)from).IgnoreYoungProtection ) + if ( from is BaseCreature && ((BaseCreature)from).IgnoreYoungProtection ) return false; if ( this.Quest != null && this.Quest.IgnoreYoungProtection( from ) ) @@ -4671,10 +4671,10 @@ namespace Server.Mobiles private void ToggleChampionTitleDisplay() { - if( !CheckAlive() ) + if ( !CheckAlive() ) return; - if( DisplayChampionTitle ) + if ( DisplayChampionTitle ) SendLocalizedMessage( 1062419, "", 0x23 ); // You have chosen to hide your monster kill title. else SendLocalizedMessage( 1062418, "", 0x23 ); // You have chosen to display your monster kill title. @@ -4745,10 +4745,10 @@ namespace Server.Mobiles public int GetValue( int index ) { - if( m_Values == null || index < 0 || index >= m_Values.Length ) + if ( m_Values == null || index < 0 || index >= m_Values.Length ) return 0; - if( m_Values[index] == null ) + if ( m_Values[index] == null ) m_Values[index] = new TitleInfo(); return m_Values[index].Value; @@ -4756,10 +4756,10 @@ namespace Server.Mobiles public DateTime GetLastDecay( int index ) { - if( m_Values == null || index < 0 || index >= m_Values.Length ) + if ( m_Values == null || index < 0 || index >= m_Values.Length ) return DateTime.MinValue; - if( m_Values[index] == null ) + if ( m_Values[index] == null ) m_Values[index] = new TitleInfo(); return m_Values[index].LastDecay; @@ -4767,16 +4767,16 @@ namespace Server.Mobiles public void SetValue( int index, int value ) { - if( m_Values == null ) + if ( m_Values == null ) m_Values = new TitleInfo[ChampionSpawnInfo.Table.Length]; - if( value < 0 ) + if ( value < 0 ) value = 0; - if( index < 0 || index >= m_Values.Length ) + if ( index < 0 || index >= m_Values.Length ) return; - if( m_Values[index] == null ) + if ( m_Values[index] == null ) m_Values[index] = new TitleInfo(); m_Values[index].Value = value; @@ -4784,13 +4784,13 @@ namespace Server.Mobiles public void Award( int index, int value ) { - if( m_Values == null ) + if ( m_Values == null ) m_Values = new TitleInfo[ChampionSpawnInfo.Table.Length]; - if( index < 0 || index >= m_Values.Length || value <= 0 ) + if ( index < 0 || index >= m_Values.Length || value <= 0 ) return; - if( m_Values[index] == null ) + if ( m_Values[index] == null ) m_Values[index] = new TitleInfo(); m_Values[index].Value += value; @@ -4798,23 +4798,23 @@ namespace Server.Mobiles public void Atrophy( int index, int value ) { - if( m_Values == null ) + if ( m_Values == null ) m_Values = new TitleInfo[ChampionSpawnInfo.Table.Length]; - if( index < 0 || index >= m_Values.Length || value <= 0 ) + if ( index < 0 || index >= m_Values.Length || value <= 0 ) return; - if( m_Values[index] == null ) + if ( m_Values[index] == null ) m_Values[index] = new TitleInfo(); int before = m_Values[index].Value; - if( (m_Values[index].Value - value) < 0 ) + if ( (m_Values[index].Value - value) < 0 ) m_Values[index].Value = 0; else m_Values[index].Value -= value; - if( before != m_Values[index].Value ) + if ( before != m_Values[index].Value ) m_Values[index].LastDecay = DateTime.UtcNow; } @@ -4872,7 +4872,7 @@ namespace Server.Mobiles m_Values[i] = new TitleInfo( reader ); } - if( m_Values.Length != ChampionSpawnInfo.Table.Length ) + if ( m_Values.Length != ChampionSpawnInfo.Table.Length ) { TitleInfo[] oldValues = m_Values; m_Values = new TitleInfo[ChampionSpawnInfo.Table.Length]; @@ -4898,7 +4898,7 @@ namespace Server.Mobiles for( int i = 0; i < length; i++ ) { - if( titles.m_Values[i] == null ) + if ( titles.m_Values[i] == null ) titles.m_Values[i] = new TitleInfo(); TitleInfo.Serialize( writer, titles.m_Values[i] ); @@ -4908,15 +4908,15 @@ namespace Server.Mobiles public static void CheckAtrophy( PlayerMobile pm ) { ChampionTitleInfo t = pm.m_ChampionTitles; - if( t == null ) + if ( t == null ) return; - if( t.m_Values == null ) + if ( t.m_Values == null ) t.m_Values = new TitleInfo[ChampionSpawnInfo.Table.Length]; for( int i = 0; i < t.m_Values.Length; i++ ) { - if( (t.GetLastDecay( i ) + LossDelay) < DateTime.UtcNow ) + if ( (t.GetLastDecay( i ) + LossDelay) < DateTime.UtcNow ) { t.Atrophy( i, LossAmount ); } @@ -4926,17 +4926,17 @@ namespace Server.Mobiles public static void AwardHarrowerTitle( PlayerMobile pm ) //Called when killing a harrower. Will give a minimum of 1 point. { ChampionTitleInfo t = pm.m_ChampionTitles; - if( t == null ) + if ( t == null ) return; - if( t.m_Values == null ) + if ( t.m_Values == null ) t.m_Values = new TitleInfo[ChampionSpawnInfo.Table.Length]; int count = 1; for( int i = 0; i < t.m_Values.Length; i++ ) { - if( t.m_Values[i].Value > 900 ) + if ( t.m_Values[i].Value > 900 ) count++; } @@ -4952,7 +4952,7 @@ namespace Server.Mobiles public virtual bool HasRecipe( Recipe r ) { - if( r == null ) + if ( r == null ) return false; return HasRecipe( r.ID ); @@ -4960,7 +4960,7 @@ namespace Server.Mobiles public virtual bool HasRecipe( int recipeID ) { - if( m_AcquiredRecipes != null && m_AcquiredRecipes.ContainsKey( recipeID ) ) + if ( m_AcquiredRecipes != null && m_AcquiredRecipes.ContainsKey( recipeID ) ) return m_AcquiredRecipes[recipeID]; return false; @@ -4968,13 +4968,13 @@ namespace Server.Mobiles public virtual void AcquireRecipe( Recipe r ) { - if( r != null ) + if ( r != null ) AcquireRecipe( r.ID ); } public virtual void AcquireRecipe( int recipeID ) { - if( m_AcquiredRecipes == null ) + if ( m_AcquiredRecipes == null ) m_AcquiredRecipes = new Dictionary(); m_AcquiredRecipes[recipeID] = true; @@ -4990,7 +4990,7 @@ namespace Server.Mobiles { get { - if( m_AcquiredRecipes == null ) + if ( m_AcquiredRecipes == null ) return 0; return m_AcquiredRecipes.Count; @@ -5003,12 +5003,12 @@ namespace Server.Mobiles public void ResendBuffs() { - if( !BuffInfo.Enabled || m_BuffTable == null ) + if ( !BuffInfo.Enabled || m_BuffTable == null ) return; NetState state = this.NetState; - if( state != null && state.BuffIcon ) + if ( state != null && state.BuffIcon ) { foreach( BuffInfo info in m_BuffTable.Values ) { @@ -5021,19 +5021,19 @@ namespace Server.Mobiles public void AddBuff( BuffInfo b ) { - if( !BuffInfo.Enabled || b == null ) + if ( !BuffInfo.Enabled || b == null ) return; RemoveBuff( b ); //Check & subsequently remove the old one. - if( m_BuffTable == null ) + if ( m_BuffTable == null ) m_BuffTable = new Dictionary(); m_BuffTable.Add( b.ID, b ); NetState state = this.NetState; - if( state != null && state.BuffIcon ) + if ( state != null && state.BuffIcon ) { state.Send( new AddBuffPacket( this, b ) ); } @@ -5041,7 +5041,7 @@ namespace Server.Mobiles public void RemoveBuff( BuffInfo b ) { - if( b == null ) + if ( b == null ) return; RemoveBuff( b.ID ); @@ -5049,24 +5049,24 @@ namespace Server.Mobiles public void RemoveBuff( BuffIcon b ) { - if( m_BuffTable == null || !m_BuffTable.ContainsKey( b ) ) + if ( m_BuffTable == null || !m_BuffTable.ContainsKey( b ) ) return; BuffInfo info = m_BuffTable[b]; - if( info.Timer != null && info.Timer.Running ) + if ( info.Timer != null && info.Timer.Running ) info.Timer.Stop(); m_BuffTable.Remove( b ); NetState state = this.NetState; - if( state != null && state.BuffIcon ) + if ( state != null && state.BuffIcon ) { state.Send( new RemoveBuffPacket( this, b ) ); } - if( m_BuffTable.Count <= 0 ) + if ( m_BuffTable.Count <= 0 ) m_BuffTable = null; } diff --git a/Scripts/Mobiles/Special/BaseChampion.cs b/Scripts/Mobiles/Special/BaseChampion.cs index 6646e8c1c..b1162f6b6 100644 --- a/Scripts/Mobiles/Special/BaseChampion.cs +++ b/Scripts/Mobiles/Special/BaseChampion.cs @@ -61,7 +61,7 @@ namespace Server.Mobiles public Item CreateArtifact( Type[] list ) { - if( list.Length == 0 ) + if ( list.Length == 0 ) return null; int random = Utility.Random( list.Length ); @@ -70,7 +70,7 @@ namespace Server.Mobiles Item artifact = Loot.Construct( type ); - if( artifact is MonsterStatuette && StatueTypes.Length > 0 ) + if ( artifact is MonsterStatuette && StatueTypes.Length > 0 ) { ((MonsterStatuette)artifact).Type = StatueTypes[Utility.Random( StatueTypes.Length )]; ((MonsterStatuette)artifact).LootType = LootType.Regular; @@ -117,16 +117,16 @@ namespace Server.Mobiles { Mobile m = toGive[i]; - if( !(m is PlayerMobile) ) + if ( !(m is PlayerMobile) ) continue; bool gainedPath = false; int pointsToGain = 800; - if( VirtueHelper.Award( m, VirtueName.Valor, pointsToGain, ref gainedPath ) ) + if ( VirtueHelper.Award( m, VirtueName.Valor, pointsToGain, ref gainedPath ) ) { - if( gainedPath ) + if ( gainedPath ) m.SendLocalizedMessage( 1054032 ); // You have gained a path in Valor! else m.SendLocalizedMessage( 1054030 ); // You have gained in Valor! @@ -156,22 +156,22 @@ namespace Server.Mobiles public static void GivePowerScrollTo( Mobile m, PowerScroll ps ) { - if( ps == null || m == null ) //sanity + if ( ps == null || m == null ) //sanity return; m.SendLocalizedMessage( 1049524 ); // You have received a scroll of power! - if( !Core.SE || m.Alive ) + if ( !Core.SE || m.Alive ) m.AddToBackpack( ps ); else { - if( m.Corpse != null && !m.Corpse.Deleted ) + if ( m.Corpse != null && !m.Corpse.Deleted ) m.Corpse.DropItem( ps ); else m.AddToBackpack( ps ); } - if( m is PlayerMobile ) + if ( m is PlayerMobile ) { PlayerMobile pm = (PlayerMobile)m; @@ -179,7 +179,7 @@ namespace Server.Mobiles { Mobile prot = pm.JusticeProtectors[j]; - if( prot.Map != m.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion( m, prot ) ) + if ( prot.Map != m.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion( m, prot ) ) continue; int chance = 0; @@ -191,17 +191,17 @@ namespace Server.Mobiles case VirtueLevel.Knight: chance = 100; break; } - if( chance > Utility.Random( 100 ) ) + if ( chance > Utility.Random( 100 ) ) { PowerScroll powerScroll = new PowerScroll( ps.Skill, ps.Value ); prot.SendLocalizedMessage( 1049368 ); // You have been rewarded for your dedication to Justice! - if( !Core.SE || prot.Alive ) + if ( !Core.SE || prot.Alive ) prot.AddToBackpack( powerScroll ); else { - if( prot.Corpse != null && !prot.Corpse.Deleted ) + if ( prot.Corpse != null && !prot.Corpse.Deleted ) prot.Corpse.DropItem( powerScroll ); else prot.AddToBackpack( powerScroll ); @@ -217,7 +217,7 @@ namespace Server.Mobiles { GivePowerScrolls(); - if( NoGoodies ) + if ( NoGoodies ) return base.OnBeforeDeath(); Map map = this.Map; diff --git a/Scripts/Mobiles/Special/BaseShieldGuard.cs b/Scripts/Mobiles/Special/BaseShieldGuard.cs index 1280fe65b..cdfe8b743 100644 --- a/Scripts/Mobiles/Special/BaseShieldGuard.cs +++ b/Scripts/Mobiles/Special/BaseShieldGuard.cs @@ -56,7 +56,7 @@ namespace Server.Mobiles } Utility.AssignRandomHair( this ); - if( Utility.RandomBool() ) + if ( Utility.RandomBool() ) Utility.AssignRandomFacialHair( this, HairHue ); VikingSword weapon = new VikingSword(); @@ -148,4 +148,4 @@ namespace Server.Mobiles int version = reader.ReadInt(); } } -} \ No newline at end of file +} diff --git a/Scripts/Mobiles/Special/Harrower.cs b/Scripts/Mobiles/Special/Harrower.cs index 51e69d8a7..621b819e3 100644 --- a/Scripts/Mobiles/Special/Harrower.cs +++ b/Scripts/Mobiles/Special/Harrower.cs @@ -399,7 +399,7 @@ namespace Server.Mobiles public virtual void RegisterDamageTo( Mobile m ) { - if( m == null ) + if ( m == null ) return; foreach( DamageEntry de in m.DamageEntries ) @@ -408,7 +408,7 @@ namespace Server.Mobiles Mobile master = damager.GetDamageMaster( m ); - if( master != null ) + if ( master != null ) damager = master; RegisterDamage( damager, de.DamageGiven ); @@ -417,10 +417,10 @@ namespace Server.Mobiles public void RegisterDamage( Mobile from, int amount ) { - if( from == null || !from.Player ) + if ( from == null || !from.Player ) return; - if( m_DamageEntries.ContainsKey( from ) ) + if ( m_DamageEntries.ContainsKey( from ) ) m_DamageEntries[from] += amount; else m_DamageEntries.Add( from, amount ); @@ -439,7 +439,7 @@ namespace Server.Mobiles foreach (KeyValuePair kvp in m_DamageEntries) { - if( IsEligible( kvp.Key, artifact ) ) + if ( IsEligible( kvp.Key, artifact ) ) { validEntries.Add( kvp.Key, kvp.Value ); totalDamage += kvp.Value; @@ -454,7 +454,7 @@ namespace Server.Mobiles { totalDamage += kvp.Value; - if( totalDamage >= randomDamage ) + if ( totalDamage >= randomDamage ) { GiveArtifact( kvp.Key, artifact ); return; @@ -496,7 +496,7 @@ namespace Server.Mobiles public Item CreateArtifact( Type[] list ) { - if( list.Length == 0 ) + if ( list.Length == 0 ) return null; int random = Utility.Random( list.Length ); diff --git a/Scripts/Mobiles/Special/LordOaks.cs b/Scripts/Mobiles/Special/LordOaks.cs index 3c9cc94bd..642b9a6f4 100644 --- a/Scripts/Mobiles/Special/LordOaks.cs +++ b/Scripts/Mobiles/Special/LordOaks.cs @@ -146,7 +146,7 @@ namespace Server.Mobiles public void CheckQueen() { - if( this.Map == null ) + if ( this.Map == null ) return; if ( !m_SpawnedQueen ) diff --git a/Scripts/Mobiles/Special/Neira.cs b/Scripts/Mobiles/Special/Neira.cs index 065e529d6..40e572502 100644 --- a/Scripts/Mobiles/Special/Neira.cs +++ b/Scripts/Mobiles/Special/Neira.cs @@ -106,16 +106,16 @@ namespace Server.Mobiles private void CheckSpeedBoost() { - if( Hits < (HitsMax / 4 ) ) + if ( Hits < (HitsMax / 4 ) ) { - if( !m_SpeedBoost ) + if ( !m_SpeedBoost ) { ActiveSpeed /= SpeedBoostScalar; PassiveSpeed /= SpeedBoostScalar; m_SpeedBoost = true; } } - else if( m_SpeedBoost ) + else if ( m_SpeedBoost ) { ActiveSpeed *= SpeedBoostScalar; PassiveSpeed *= SpeedBoostScalar; @@ -189,7 +189,7 @@ namespace Server.Mobiles m_Rider = reader.ReadMobile(); - if( m_Rider == null ) + if ( m_Rider == null ) Delete(); } } @@ -231,7 +231,7 @@ namespace Server.Mobiles public void AddUnholyBone( Mobile target, double chanceToThrow ) { - if( this.Map == null ) + if ( this.Map == null ) return; if ( chanceToThrow >= Utility.RandomDouble() ) diff --git a/Scripts/Mobiles/Special/Paragon.cs b/Scripts/Mobiles/Special/Paragon.cs index 4f790e77f..0b83f543f 100644 --- a/Scripts/Mobiles/Special/Paragon.cs +++ b/Scripts/Mobiles/Special/Paragon.cs @@ -30,7 +30,7 @@ namespace Server.Mobiles protected override void OnTick() { - if( !m_Owner.Deleted && m_Owner.IsParagon && m_Owner .Map != Map.Internal ) + if ( !m_Owner.Deleted && m_Owner.IsParagon && m_Owner .Map != Map.Internal ) { m_Owner.Stam++; @@ -117,7 +117,7 @@ namespace Server.Mobiles { bc.Karma = (int)( bc.Karma * KarmaBuff ); - if( Math.Abs( bc.Karma ) > 32000 ) + if ( Math.Abs( bc.Karma ) > 32000 ) bc.Karma = 32000 * Math.Sign( bc.Karma ); } @@ -126,12 +126,12 @@ namespace Server.Mobiles public static void UnConvert( BaseCreature bc ) { - if( !bc.IsParagon ) + if ( !bc.IsParagon ) return; bc.Hue = 0; - if( bc.HitsMaxSeed >= 0 ) + if ( bc.HitsMaxSeed >= 0 ) bc.HitsMaxSeed = (int)( bc.HitsMaxSeed / HitsBuff ); bc.RawStr = (int)( bc.RawStr / StrBuff ); @@ -214,4 +214,4 @@ namespace Server.Mobiles m.SendMessage( "As your backpack is full, your reward for destroying the legendary paragon has been placed at your feet." ); } } -} \ No newline at end of file +} diff --git a/Scripts/Mobiles/Special/Semidar.cs b/Scripts/Mobiles/Special/Semidar.cs index 4f0458bd3..490cbd644 100644 --- a/Scripts/Mobiles/Special/Semidar.cs +++ b/Scripts/Mobiles/Special/Semidar.cs @@ -77,7 +77,7 @@ namespace Server.Mobiles public void DrainLife() { - if( this.Map == null ) + if ( this.Map == null ) return; ArrayList list = new ArrayList(); diff --git a/Scripts/Mobiles/Townfolk/Artist.cs b/Scripts/Mobiles/Townfolk/Artist.cs index 92df367ae..e44f43828 100644 --- a/Scripts/Mobiles/Townfolk/Artist.cs +++ b/Scripts/Mobiles/Townfolk/Artist.cs @@ -23,7 +23,7 @@ namespace Server.Mobiles Hue = Utility.RandomSkinHue(); - if( this.Female = Utility.RandomBool() ) + if ( this.Female = Utility.RandomBool() ) { this.Body = 0x191; this.Name = NameList.RandomName( "female" ); diff --git a/Scripts/Mobiles/Townfolk/BrideGroom.cs b/Scripts/Mobiles/Townfolk/BrideGroom.cs index d3686eb28..356bb5473 100644 --- a/Scripts/Mobiles/Townfolk/BrideGroom.cs +++ b/Scripts/Mobiles/Townfolk/BrideGroom.cs @@ -49,7 +49,7 @@ namespace Server.Mobiles else AddItem( new Boots( lowHue ) ); - if( Utility.RandomBool() ) + if ( Utility.RandomBool() ) HairItemID = 0x203B; else HairItemID = 0x203C; diff --git a/Scripts/Mobiles/Townfolk/Gypsy.cs b/Scripts/Mobiles/Townfolk/Gypsy.cs index cc84ec2cd..deeb7beb1 100644 --- a/Scripts/Mobiles/Townfolk/Gypsy.cs +++ b/Scripts/Mobiles/Townfolk/Gypsy.cs @@ -23,7 +23,7 @@ namespace Server.Mobiles Hue = Utility.RandomSkinHue(); - if( this.Female = Utility.RandomBool() ) + if ( this.Female = Utility.RandomBool() ) { this.Body = 0x191; this.Name = NameList.RandomName( "female" ); diff --git a/Scripts/Mobiles/Townfolk/HarborMaster.cs b/Scripts/Mobiles/Townfolk/HarborMaster.cs index 811785f3a..b596d2298 100644 --- a/Scripts/Mobiles/Townfolk/HarborMaster.cs +++ b/Scripts/Mobiles/Townfolk/HarborMaster.cs @@ -23,7 +23,7 @@ namespace Server.Mobiles Blessed = true; - if( this.Female = Utility.RandomBool() ) + if ( this.Female = Utility.RandomBool() ) { this.Body = 0x191; this.Name = NameList.RandomName( "female" ); diff --git a/Scripts/Mobiles/Townfolk/Merchant.cs b/Scripts/Mobiles/Townfolk/Merchant.cs index 7583575e8..109d94a95 100644 --- a/Scripts/Mobiles/Townfolk/Merchant.cs +++ b/Scripts/Mobiles/Townfolk/Merchant.cs @@ -35,7 +35,7 @@ namespace Server.Mobiles public override void InitOutfit() { - if( Female ) + if ( Female ) AddItem( new PlainDress() ); else AddItem( new Shirt( GetRandomHue() ) ); @@ -44,13 +44,13 @@ namespace Server.Mobiles AddItem( new ThighBoots() ); - if( Female ) + if ( Female ) AddItem( new FancyDress( lowHue ) ); else AddItem( new FancyShirt( lowHue ) ); AddItem( new LongPants( lowHue ) ); - if( !Female ) + if ( !Female ) AddItem( new BodySash( lowHue ) ); diff --git a/Scripts/Mobiles/Townfolk/Ninja.cs b/Scripts/Mobiles/Townfolk/Ninja.cs index a3d464d60..ff19149f5 100644 --- a/Scripts/Mobiles/Townfolk/Ninja.cs +++ b/Scripts/Mobiles/Townfolk/Ninja.cs @@ -51,7 +51,7 @@ namespace Server.Mobiles Utility.AssignRandomHair( this, hairHue ); - if( Utility.Random( 7 ) != 0 ) + if ( Utility.Random( 7 ) != 0 ) Utility.AssignRandomFacialHair( this, hairHue ); PackGold( 250, 300 ); diff --git a/Scripts/Mobiles/Townfolk/Samurai.cs b/Scripts/Mobiles/Townfolk/Samurai.cs index 5a1283201..a21476854 100644 --- a/Scripts/Mobiles/Townfolk/Samurai.cs +++ b/Scripts/Mobiles/Townfolk/Samurai.cs @@ -67,7 +67,7 @@ namespace Server.Mobiles Utility.AssignRandomHair( this, hairHue ); - if( Utility.Random( 7 ) != 0 ) + if ( Utility.Random( 7 ) != 0 ) Utility.AssignRandomFacialHair( this, hairHue ); PackGold( 250, 300 ); diff --git a/Scripts/Mobiles/Townfolk/Sculptor.cs b/Scripts/Mobiles/Townfolk/Sculptor.cs index 32d209abe..fcbf1bff8 100644 --- a/Scripts/Mobiles/Townfolk/Sculptor.cs +++ b/Scripts/Mobiles/Townfolk/Sculptor.cs @@ -17,7 +17,7 @@ namespace Server.Mobiles Title = "the sculptor"; Hue = Utility.RandomSkinHue(); - if( this.Female = Utility.RandomBool() ) + if ( this.Female = Utility.RandomBool() ) { this.Body = 0x191; this.Name = NameList.RandomName( "female" ); diff --git a/Scripts/Mobiles/Townfolk/TownCrier.cs b/Scripts/Mobiles/Townfolk/TownCrier.cs index 1ad6eeb9c..01e7b4884 100644 --- a/Scripts/Mobiles/Townfolk/TownCrier.cs +++ b/Scripts/Mobiles/Townfolk/TownCrier.cs @@ -145,7 +145,7 @@ namespace Server.Mobiles { TimeSpan ts; - if( !TimeSpan.TryParse( text, out ts ) ) + if ( !TimeSpan.TryParse( text, out ts ) ) { from.SendMessage( "Value was not properly formatted. Use: " ); from.SendGump( new TownCrierGump( from, m_Owner ) ); @@ -565,4 +565,4 @@ namespace Server.Mobiles NameHue = -1; } } -} \ No newline at end of file +} diff --git a/Scripts/Mobiles/Vendors/GenericBuy.cs b/Scripts/Mobiles/Vendors/GenericBuy.cs index 239bd55f1..c22d14e41 100644 --- a/Scripts/Mobiles/Vendors/GenericBuy.cs +++ b/Scripts/Mobiles/Vendors/GenericBuy.cs @@ -310,7 +310,7 @@ namespace Server.Mobiles object Obj_Disp = GetDisplayEntity(); - if( Core.ML && Obj_Disp is Item && !( Obj_Disp as Item ).Stackable ) + if ( Core.ML && Obj_Disp is Item && !( Obj_Disp as Item ).Stackable ) { m_MaxAmount = Math.Min( 20, m_MaxAmount ); } diff --git a/Scripts/Mobiles/Vendors/NPC/Blacksmith.cs b/Scripts/Mobiles/Vendors/NPC/Blacksmith.cs index e4d38ac80..f388210c3 100644 --- a/Scripts/Mobiles/Vendors/NPC/Blacksmith.cs +++ b/Scripts/Mobiles/Vendors/NPC/Blacksmith.cs @@ -122,7 +122,7 @@ namespace Server.Mobiles public override void OnSuccessfulBulkOrderReceive( Mobile from ) { - if( Core.SE && from is PlayerMobile ) + if ( Core.SE && from is PlayerMobile ) ((PlayerMobile)from).NextSmithBulkOrder = TimeSpan.Zero; } #endregion diff --git a/Scripts/Mobiles/Vendors/NPC/Tailor.cs b/Scripts/Mobiles/Vendors/NPC/Tailor.cs index 19a910948..13d4a10a8 100644 --- a/Scripts/Mobiles/Vendors/NPC/Tailor.cs +++ b/Scripts/Mobiles/Vendors/NPC/Tailor.cs @@ -73,7 +73,7 @@ namespace Server.Mobiles public override void OnSuccessfulBulkOrderReceive( Mobile from ) { - if( Core.SE && from is PlayerMobile ) + if ( Core.SE && from is PlayerMobile ) ((PlayerMobile)from).NextTailorBulkOrder = TimeSpan.Zero; } #endregion diff --git a/Scripts/Mobiles/Vendors/NPC/Weaponsmith.cs b/Scripts/Mobiles/Vendors/NPC/Weaponsmith.cs index 396b29293..79b8c5a4d 100644 --- a/Scripts/Mobiles/Vendors/NPC/Weaponsmith.cs +++ b/Scripts/Mobiles/Vendors/NPC/Weaponsmith.cs @@ -24,7 +24,7 @@ namespace Server.Mobiles public override void InitSBInfo() { m_SBInfos.Add( new SBWeaponSmith() ); - + if ( IsTokunoVendor ) m_SBInfos.Add( new SBSEWeapons() ); } @@ -91,7 +91,7 @@ namespace Server.Mobiles public override void OnSuccessfulBulkOrderReceive( Mobile from ) { - if( Core.SE && from is PlayerMobile ) + if ( Core.SE && from is PlayerMobile ) ((PlayerMobile)from).NextSmithBulkOrder = TimeSpan.Zero; } #endregion @@ -114,4 +114,4 @@ namespace Server.Mobiles int version = reader.ReadInt(); } } -} \ No newline at end of file +} diff --git a/Scripts/Mobiles/Vendors/NPC/Weaver.cs b/Scripts/Mobiles/Vendors/NPC/Weaver.cs index fb3905e07..3f0a781d8 100644 --- a/Scripts/Mobiles/Vendors/NPC/Weaver.cs +++ b/Scripts/Mobiles/Vendors/NPC/Weaver.cs @@ -73,7 +73,7 @@ namespace Server.Mobiles public override void OnSuccessfulBulkOrderReceive( Mobile from ) { - if( Core.SE && from is PlayerMobile ) + if ( Core.SE && from is PlayerMobile ) ((PlayerMobile)from).NextTailorBulkOrder = TimeSpan.Zero; } #endregion diff --git a/Scripts/Mobiles/Vendors/PlayerBarkeeper.cs b/Scripts/Mobiles/Vendors/PlayerBarkeeper.cs index bccbb0458..5aaf27373 100644 --- a/Scripts/Mobiles/Vendors/PlayerBarkeeper.cs +++ b/Scripts/Mobiles/Vendors/PlayerBarkeeper.cs @@ -28,7 +28,7 @@ namespace Server.Mobiles public override void OnResponse( Mobile from, string text ) { - if( text.Length > 130 ) + if ( text.Length > 130 ) text = text.Substring( 0, 130 ); m_Barkeeper.EndChangeRumor( from, m_RumorIndex, text ); @@ -53,7 +53,7 @@ namespace Server.Mobiles public override void OnResponse( Mobile from, string text ) { - if( text.Length > 130 ) + if ( text.Length > 130 ) text = text.Substring( 0, 130 ); m_Barkeeper.EndChangeKeyword( from, m_RumorIndex, text ); diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBAnimalTrainer.cs b/Scripts/Mobiles/Vendors/SBInfo/SBAnimalTrainer.cs index c74895e95..91a32656f 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBAnimalTrainer.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBAnimalTrainer.cs @@ -27,7 +27,7 @@ namespace Server.Mobiles Add( new AnimalBuyInfo( 1, typeof( PackLlama ), 565, 10, 292, 0 ) ); Add( new AnimalBuyInfo( 1, typeof( Rabbit ), 106, 10, 205, 0 ) ); - if( !Core.AOS ) + if ( !Core.AOS ) { Add( new AnimalBuyInfo( 1, typeof( Eagle ), 402, 10, 5, 0 ) ); Add( new AnimalBuyInfo( 1, typeof( BrownBear ), 855, 10, 167, 0 ) ); diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBBlacksmith.cs b/Scripts/Mobiles/Vendors/SBInfo/SBBlacksmith.cs index 768ed12b3..c994154bf 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBBlacksmith.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBBlacksmith.cs @@ -110,7 +110,7 @@ namespace Server.Mobiles Add( new GenericBuyInfo( typeof( WarHammer ), 25, 20, 0x1439, 0 ) ); Add( new GenericBuyInfo( typeof( WarMace ), 31, 20, 0x1407, 0 ) ); - if( Core.AOS ) + if ( Core.AOS ) { Add( new GenericBuyInfo( typeof( Scepter ), 39, 20, 0x26BC, 0 ) ); Add( new GenericBuyInfo( typeof( BladedStaff ), 40, 20, 0x26BD, 0 ) ); @@ -191,7 +191,7 @@ namespace Server.Mobiles Add( typeof( Bow ), 17 ); Add( typeof( Crossbow ), 23 ); - if( Core.AOS ) + if ( Core.AOS ) { Add( typeof( CompositeBow ), 25 ); Add( typeof( RepeatingCrossbow ), 28 ); diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBProvisioner.cs b/Scripts/Mobiles/Vendors/SBInfo/SBProvisioner.cs index 1bf36d40f..db629e7cc 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBProvisioner.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBProvisioner.cs @@ -22,7 +22,7 @@ namespace Server.Mobiles public InternalBuyInfo() { #region Salvage Bag - if( Core.ML ) + if ( Core.ML ) Add( new GenericBuyInfo( "1079931", typeof( SalvageBag ), 1255, 20, 0xE76, Utility.RandomBlueHue() ) ); #endregion Add( new GenericBuyInfo( "1060834", typeof( Engines.Plants.PlantBowl ), 2, 20, 0x15FD, 0 ) ); @@ -101,7 +101,7 @@ namespace Server.Mobiles Add( new GenericBuyInfo( typeof( LargeBagBall ), 3, 20, 0x2257, 0 ) ); } - if( !Guild.NewGuildSystem ) + if ( !Guild.NewGuildSystem ) Add( new GenericBuyInfo( "1041055", typeof( GuildDeed ), 12450, 20, 0x14F0, 0 ) ); } } @@ -166,7 +166,7 @@ namespace Server.Mobiles Add( typeof( GoldEarrings ), 13 ); Add( typeof( SilverEarrings ), 10 ); - if( !Guild.NewGuildSystem ) + if ( !Guild.NewGuildSystem ) Add( typeof( GuildDeed ), 6225 ); } } diff --git a/Scripts/Mobiles/Vendors/SBInfo/SBWeaponSmith.cs b/Scripts/Mobiles/Vendors/SBInfo/SBWeaponSmith.cs index 3e6af4529..53094ea6b 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/SBWeaponSmith.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/SBWeaponSmith.cs @@ -33,7 +33,7 @@ namespace Server.Mobiles Add( new GenericBuyInfo( typeof( WarHammer ), 25, 20, 0x1439, 0 ) ); Add( new GenericBuyInfo( typeof( WarMace ), 31, 20, 0x1407, 0 ) ); - if( Core.AOS ) + if ( Core.AOS ) { Add( new GenericBuyInfo( typeof( Scepter ), 39, 20, 0x26BC, 0 ) ); Add( new GenericBuyInfo( typeof( BladedStaff ), 40, 20, 0x26BD, 0 ) ); @@ -138,7 +138,7 @@ namespace Server.Mobiles Add( typeof( Bow ), 17 ); Add( typeof( Crossbow ), 23 ); - if( Core.AOS ) + if ( Core.AOS ) { Add( typeof( CompositeBow ), 25 ); Add( typeof( RepeatingCrossbow ), 28 ); diff --git a/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBRangedWeapon.cs b/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBRangedWeapon.cs index 14c31aca7..eadbaba28 100644 --- a/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBRangedWeapon.cs +++ b/Scripts/Mobiles/Vendors/SBInfo/Weapons/SBRangedWeapon.cs @@ -22,7 +22,7 @@ namespace Server.Mobiles { Add( new GenericBuyInfo( typeof( Crossbow ), 55, 20, 0xF50, 0 ) ); Add( new GenericBuyInfo( typeof( HeavyCrossbow ), 55, 20, 0x13FD, 0 ) ); - if( Core.AOS ) + if ( Core.AOS ) { Add( new GenericBuyInfo( typeof( RepeatingCrossbow ), 46, 20, 0x26C3, 0 ) ); Add( new GenericBuyInfo( typeof( CompositeBow ), 45, 20, 0x26C2, 0 ) ); @@ -48,7 +48,7 @@ namespace Server.Mobiles Add( typeof( Bow ), 17 ); Add( typeof( Crossbow ), 25 ); - if( Core.AOS ) + if ( Core.AOS ) { Add( typeof( CompositeBow ), 23 ); Add( typeof( RepeatingCrossbow ), 22 ); diff --git a/Scripts/Multis/BaseHouse.cs b/Scripts/Multis/BaseHouse.cs index 6d1ca8c6e..cfe1b818a 100644 --- a/Scripts/Multis/BaseHouse.cs +++ b/Scripts/Multis/BaseHouse.cs @@ -610,11 +610,11 @@ namespace Server.Multis bool retainDeedHue = false; //if the items aren't hued but the deed itself is int hue = 0; - if( addon is IAddon ) + if ( addon is IAddon ) { deed = ((IAddon)addon).Deed; - if( addon is BaseAddon && ((BaseAddon)addon).RetainDeedHue) //There are things that are IAddon which aren't BaseAddon + if ( addon is BaseAddon && ((BaseAddon)addon).RetainDeedHue) //There are things that are IAddon which aren't BaseAddon { BaseAddon ba = (BaseAddon)addon; retainDeedHue = true; @@ -623,7 +623,7 @@ namespace Server.Multis { AddonComponent c = ba.Components[i]; - if( c.Hue != 0 ) + if ( c.Hue != 0 ) hue = c.Hue; } } @@ -645,7 +645,7 @@ namespace Server.Multis addon.Delete(); - if( retainDeedHue ) + if ( retainDeedHue ) deed.Hue = hue; DropToMovingCrate( deed ); @@ -803,13 +803,13 @@ namespace Server.Multis if ( item is StrongBox ) relocateItem = ((StrongBox)item).ConvertToStandardContainer(); - if( item is IAddon ) + if ( item is IAddon ) { Item deed = ((IAddon)item).Deed; bool retainDeedHue = false; //if the items aren't hued but the deed itself is int hue = 0; - if( item is BaseAddon && ((BaseAddon)item).RetainDeedHue ) //There are things that are IAddon which aren't BaseAddon + if ( item is BaseAddon && ((BaseAddon)item).RetainDeedHue ) //There are things that are IAddon which aren't BaseAddon { BaseAddon ba = (BaseAddon)item; retainDeedHue = true; @@ -818,7 +818,7 @@ namespace Server.Multis { AddonComponent c = ba.Components[i]; - if( c.Hue != 0 ) + if ( c.Hue != 0 ) hue = c.Hue; } } @@ -893,7 +893,7 @@ namespace Server.Multis public List GetItems() { - if( this.Map == null || this.Map == Map.Internal ) + if ( this.Map == null || this.Map == Map.Internal ) return new List(); Point2D start = new Point2D( this.X + Components.Min.X, this.Y + Components.Min.Y ); @@ -915,7 +915,7 @@ namespace Server.Multis public List GetMobiles() { - if( this.Map == null || this.Map == Map.Internal ) + if ( this.Map == null || this.Map == Map.Internal ) return new List(); List list = new List(); @@ -1893,7 +1893,7 @@ namespace Server.Multis { to.SendLocalizedMessage( 1062071 ); // You cannot trade a house while you have other trades pending. } - else if( !to.Alive ) + else if ( !to.Alive ) { // TODO: Check if the message is correct. from.SendLocalizedMessage( 1062069 ); // You cannot transfer this house to that person. @@ -3179,14 +3179,14 @@ namespace Server.Multis if ( item != null ) { - if( !item.Deleted && item is IAddon ) + if ( !item.Deleted && item is IAddon ) { Item deed = ((IAddon)item).Deed; bool retainDeedHue = false; //if the items aren't hued but the deed itself is int hue = 0; - if( item is BaseAddon && ((BaseAddon)item).RetainDeedHue ) //There are things that are IAddon which aren't BaseAddon + if ( item is BaseAddon && ((BaseAddon)item).RetainDeedHue ) //There are things that are IAddon which aren't BaseAddon { BaseAddon ba = (BaseAddon)item; retainDeedHue = true; @@ -3195,14 +3195,14 @@ namespace Server.Multis { AddonComponent c = ba.Components[j]; - if( c.Hue != 0 ) + if ( c.Hue != 0 ) hue = c.Hue; } } - if( deed != null ) + if ( deed != null ) { - if( retainDeedHue ) + if ( retainDeedHue ) deed.Hue = hue; deed.MoveToWorld( item.Location, item.Map ); } @@ -3287,7 +3287,7 @@ namespace Server.Multis public bool IsGuildMember( Mobile m ) { - if( m == null || Owner == null || Owner.Guild == null ) + if ( m == null || Owner == null || Owner.Guild == null ) return false; return ( m.Guild == Owner.Guild ); diff --git a/Scripts/Multis/Boats/BaseBoat.cs b/Scripts/Multis/Boats/BaseBoat.cs index fa1c90df9..f21277c6c 100644 --- a/Scripts/Multis/Boats/BaseBoat.cs +++ b/Scripts/Multis/Boats/BaseBoat.cs @@ -467,7 +467,7 @@ namespace Server.Multis { m_DecayTime = DateTime.UtcNow + BoatDecayDelay; - if( m_TillerMan != null ) + if ( m_TillerMan != null ) m_TillerMan.InvalidateProperties(); } @@ -1299,9 +1299,9 @@ namespace Server.Multis public static Rectangle2D[] GetWrapFor( Map m ) { - if( m == Map.Ilshenar ) + if ( m == Map.Ilshenar ) return m_IlshWrap; - else if( m == Map.Tokuno ) + else if ( m == Map.Tokuno ) return m_TokunoWrap; else return m_BritWrap; diff --git a/Scripts/Multis/Boats/Strandedness.cs b/Scripts/Multis/Boats/Strandedness.cs index dc160cb2b..653a544ee 100644 --- a/Scripts/Multis/Boats/Strandedness.cs +++ b/Scripts/Multis/Boats/Strandedness.cs @@ -128,13 +128,13 @@ namespace Server.Misc Point2D[] list; - if( map == Map.Felucca ) + if ( map == Map.Felucca ) list = m_Felucca; - else if( map == Map.Trammel ) + else if ( map == Map.Trammel ) list = m_Trammel; - else if( map == Map.Ilshenar ) + else if ( map == Map.Ilshenar ) list = m_Ilshenar; - else if( map == Map.Tokuno ) + else if ( map == Map.Tokuno ) list = m_Tokuno; else return; @@ -181,4 +181,4 @@ namespace Server.Misc from.Location = new Point3D( x, y, z ); } } -} \ No newline at end of file +} diff --git a/Scripts/Multis/HouseFoundation.cs b/Scripts/Multis/HouseFoundation.cs index 5c39748a3..cdcd3cd77 100644 --- a/Scripts/Multis/HouseFoundation.cs +++ b/Scripts/Multis/HouseFoundation.cs @@ -63,7 +63,7 @@ namespace Server.Multis { get { - if( m_Current == null ) + if ( m_Current == null ) SetInitialState(); return m_Current.Components; @@ -81,9 +81,9 @@ namespace Server.Multis int h = CurrentState.Components.Height-1; int v = 18 + ((w > h ? w : h) / 2); - if( v > 24 ) + if ( v > 24 ) v = 24; - else if( v < 18 ) + else if ( v < 18 ) v = 18; return v; @@ -91,19 +91,19 @@ namespace Server.Multis public DesignState CurrentState { - get { if( m_Current == null ) SetInitialState(); return m_Current; } + get { if ( m_Current == null ) SetInitialState(); return m_Current; } set { m_Current = value; } } public DesignState DesignState { - get { if( m_Design == null ) SetInitialState(); return m_Design; } + get { if ( m_Design == null ) SetInitialState(); return m_Design; } set { m_Design = value; } } public DesignState BackupState { - get { if( m_Backup == null ) SetInitialState(); return m_Backup; } + get { if ( m_Backup == null ) SetInitialState(); return m_Backup; } set { m_Backup = value; } } @@ -119,20 +119,20 @@ namespace Server.Multis { base.OnAfterDelete(); - if( m_SignHanger != null ) + if ( m_SignHanger != null ) m_SignHanger.Delete(); - if( m_Signpost != null ) + if ( m_Signpost != null ) m_Signpost.Delete(); - if( m_Fixtures == null ) + if ( m_Fixtures == null ) return; for( int i = 0; i < m_Fixtures.Count; ++i ) { Item item = m_Fixtures[i]; - if( item != null ) + if ( item != null ) item.Delete(); } @@ -147,20 +147,20 @@ namespace Server.Multis int y = Location.Y - oldLocation.Y; int z = Location.Z - oldLocation.Z; - if( m_SignHanger != null ) + if ( m_SignHanger != null ) m_SignHanger.MoveToWorld( new Point3D( m_SignHanger.X + x, m_SignHanger.Y + y, m_SignHanger.Z + z ), Map ); - if( m_Signpost != null ) + if ( m_Signpost != null ) m_Signpost.MoveToWorld( new Point3D( m_Signpost.X + x, m_Signpost.Y + y, m_Signpost.Z + z ), Map ); - if( m_Fixtures == null ) + if ( m_Fixtures == null ) return; for( int i = 0; i < m_Fixtures.Count; ++i ) { Item item = m_Fixtures[i]; - if( Doors.Contains( item ) ) + if ( Doors.Contains( item ) ) continue; item.MoveToWorld( new Point3D( item.X + x, item.Y + y, item.Z + z ), Map ); @@ -171,13 +171,13 @@ namespace Server.Multis { base.OnMapChange(); - if( m_SignHanger != null ) + if ( m_SignHanger != null ) m_SignHanger.Map = this.Map; - if( m_Signpost != null ) + if ( m_Signpost != null ) m_Signpost.Map = this.Map; - if( m_Fixtures == null ) + if ( m_Fixtures == null ) return; for( int i = 0; i < m_Fixtures.Count; ++i ) @@ -186,7 +186,7 @@ namespace Server.Multis public void ClearFixtures( Mobile from ) { - if( m_Fixtures == null ) + if ( m_Fixtures == null ) return; RemoveKeys( from ); @@ -202,7 +202,7 @@ namespace Server.Multis public void AddFixtures( Mobile from, MultiTileEntry[] list ) { - if( m_Fixtures == null ) + if ( m_Fixtures == null ) m_Fixtures = new List(); uint keyValue = 0; @@ -212,7 +212,7 @@ namespace Server.Multis MultiTileEntry mte = list[i]; int itemID = mte.m_ItemID; - if( itemID >= 0x181D && itemID < 0x1829 ) + if ( itemID >= 0x181D && itemID < 0x1829 ) { HouseTeleporter tp = new HouseTeleporter( itemID ); @@ -222,7 +222,7 @@ namespace Server.Multis { BaseDoor door = null; - if( itemID >= 0x675 && itemID < 0x6F5 ) + if ( itemID >= 0x675 && itemID < 0x6F5 ) { int type = (itemID - 0x675) / 16; DoorFacing facing = (DoorFacing)(((itemID - 0x675) / 2) % 8); @@ -239,54 +239,54 @@ namespace Server.Multis case 7: door = new GenericHouseDoor( facing, 0x6E5, 0xEA, 0xF1 ); break; } } - else if( itemID >= 0x314 && itemID < 0x364 ) + else if ( itemID >= 0x314 && itemID < 0x364 ) { int type = (itemID - 0x314) / 16; DoorFacing facing = (DoorFacing)(((itemID - 0x314) / 2) % 8); door = new GenericHouseDoor( facing, 0x314 + ( type * 16 ), 0xED, 0xF4 ); } - else if( itemID >= 0x824 && itemID < 0x834 ) + else if ( itemID >= 0x824 && itemID < 0x834 ) { DoorFacing facing = (DoorFacing)(((itemID - 0x824) / 2) % 8); door = new GenericHouseDoor( facing, 0x824, 0xEC, 0xF3 ); } - else if( itemID >= 0x839 && itemID < 0x849 ) + else if ( itemID >= 0x839 && itemID < 0x849 ) { DoorFacing facing = (DoorFacing)(((itemID - 0x839) / 2) % 8); door = new GenericHouseDoor( facing, 0x839, 0xEB, 0xF2 ); } - else if( itemID >= 0x84C && itemID < 0x85C ) + else if ( itemID >= 0x84C && itemID < 0x85C ) { DoorFacing facing = (DoorFacing)(((itemID - 0x84C) / 2) % 8); door = new GenericHouseDoor( facing, 0x84C, 0xEC, 0xF3 ); } - else if( itemID >= 0x866 && itemID < 0x876 ) + else if ( itemID >= 0x866 && itemID < 0x876 ) { DoorFacing facing = (DoorFacing)(((itemID - 0x866) / 2) % 8); door = new GenericHouseDoor( facing, 0x866, 0xEB, 0xF2 ); } - else if( itemID >= 0xE8 && itemID < 0xF8 ) + else if ( itemID >= 0xE8 && itemID < 0xF8 ) { DoorFacing facing = (DoorFacing)(((itemID - 0xE8) / 2) % 8); door = new GenericHouseDoor( facing, 0xE8, 0xED, 0xF4 ); } - else if( itemID >= 0x1FED && itemID < 0x1FFD ) + else if ( itemID >= 0x1FED && itemID < 0x1FFD ) { DoorFacing facing = (DoorFacing)(((itemID - 0x1FED) / 2) % 8); door = new GenericHouseDoor( facing, 0x1FED, 0xEC, 0xF3 ); } - else if( itemID >= 0x241F && itemID < 0x2421 ) + else if ( itemID >= 0x241F && itemID < 0x2421 ) { //DoorFacing facing = (DoorFacing)(((itemID - 0x241F) / 2) % 8); door = new GenericHouseDoor( DoorFacing.NorthCCW, 0x2415, -1, -1 ); } - else if( itemID >= 0x2423 && itemID < 0x2425 ) + else if ( itemID >= 0x2423 && itemID < 0x2425 ) { //DoorFacing facing = (DoorFacing)(((itemID - 0x241F) / 2) % 8); //This one and the above one are 'special' cases, ie: OSI had the ItemID pattern discombobulated for these door = new GenericHouseDoor( DoorFacing.WestCW, 0x2423, -1, -1 ); } - else if( itemID >= 0x2A05 && itemID < 0x2A1D ) + else if ( itemID >= 0x2A05 && itemID < 0x2A1D ) { DoorFacing facing = (DoorFacing)((((itemID - 0x2A05) / 2) % 4) + 8); @@ -294,15 +294,15 @@ namespace Server.Multis door = new GenericHouseDoor( facing, 0x29F5 + (8 * ((itemID - 0x2A05) / 8)), sound, sound ); } - else if( itemID == 0x2D46 ) + else if ( itemID == 0x2D46 ) { door = new GenericHouseDoor( DoorFacing.NorthCW, 0x2D46, 0xEA, 0xF1, false ); } - else if( itemID == 0x2D48 || itemID == 0x2FE2 ) + else if ( itemID == 0x2D48 || itemID == 0x2FE2 ) { door = new GenericHouseDoor( DoorFacing.SouthCCW, itemID, 0xEA, 0xF1, false ); } - else if( itemID >= 0x2D63 && itemID < 0x2D70 ) + else if ( itemID >= 0x2D63 && itemID < 0x2D70 ) { int mod = (itemID - 0x2D63)/2%2; DoorFacing facing = ( ( mod == 0 ) ? DoorFacing.SouthCCW : DoorFacing.WestCCW ); @@ -311,11 +311,11 @@ namespace Server.Multis door = new GenericHouseDoor( facing, 0x2D63 + 4*type + mod*2, 0xEA, 0xF1, false ); } - else if( itemID == 0x2FE4 || itemID == 0x31AE ) + else if ( itemID == 0x2FE4 || itemID == 0x31AE ) { door = new GenericHouseDoor( DoorFacing.WestCCW, itemID, 0xEA, 0xF1, false ); } - else if( itemID >= 0x319C && itemID < 0x31AE ) + else if ( itemID >= 0x319C && itemID < 0x31AE ) { //special case for 0x31aa <-> 0x31a8 (a9) @@ -334,7 +334,7 @@ namespace Server.Multis door = new GenericHouseDoor( facing, 0x319C + 4 * type + mod * 2, 0xEA, 0xF1, false ); } - else if( itemID >= 0x367B && itemID < 0x369B ) + else if ( itemID >= 0x367B && itemID < 0x369B ) { int type = (itemID - 0x367B) / 16; DoorFacing facing = (DoorFacing)(((itemID - 0x367B) / 2) % 8); @@ -345,23 +345,23 @@ namespace Server.Multis case 1: door = new GenericHouseDoor( facing, 0x368B, 0xEC, 0x3E7 ); break; //shadow } } - else if( itemID >= 0x409B && itemID < 0x40A3 ) + else if ( itemID >= 0x409B && itemID < 0x40A3 ) { door = new GenericHouseDoor( GetSADoorFacing( itemID - 0x409B ), itemID, 0xEA, 0xF1, false ); } - else if( itemID >= 0x410C && itemID < 0x4114 ) + else if ( itemID >= 0x410C && itemID < 0x4114 ) { door = new GenericHouseDoor( GetSADoorFacing( itemID - 0x410C ), itemID, 0xEA, 0xF1, false ); } - else if( itemID >= 0x41C2 && itemID < 0x41CA ) + else if ( itemID >= 0x41C2 && itemID < 0x41CA ) { door = new GenericHouseDoor( GetSADoorFacing( itemID - 0x41C2 ), itemID, 0xEA, 0xF1, false ); } - else if( itemID >= 0x41CF && itemID < 0x41D7 ) + else if ( itemID >= 0x41CF && itemID < 0x41D7 ) { door = new GenericHouseDoor( GetSADoorFacing( itemID - 0x41CF ), itemID, 0xEA, 0xF1, false ); } - else if( itemID >= 0x436E && itemID < 0x437E ) + else if ( itemID >= 0x436E && itemID < 0x437E ) { /* These ones had to be different... * Offset 0 2 4 6 8 10 12 14 @@ -371,30 +371,30 @@ namespace Server.Multis DoorFacing facing = (DoorFacing)( ( offset / 2 + 2 * ( ( 1 + offset / 4 ) % 2 ) ) % 8 ); door = new GenericHouseDoor( facing, itemID, 0xEA, 0xF1, false ); } - else if( itemID >= 0x46DD && itemID < 0x46E5 ) + else if ( itemID >= 0x46DD && itemID < 0x46E5 ) { door = new GenericHouseDoor( GetSADoorFacing( itemID - 0x46DD ), itemID, 0xEB, 0xF2, false ); } - else if( itemID >= 0x4D22 && itemID < 0x4D2A ) + else if ( itemID >= 0x4D22 && itemID < 0x4D2A ) { door = new GenericHouseDoor( GetSADoorFacing( itemID - 0x4D22 ), itemID, 0xEA, 0xF1, false ); } - else if( itemID >= 0x50C8 && itemID < 0x50D0 ) + else if ( itemID >= 0x50C8 && itemID < 0x50D0 ) { door = new GenericHouseDoor( GetSADoorFacing( itemID - 0x50C8 ), itemID, 0xEA, 0xF1, false ); } - else if( itemID >= 0x50D0 && itemID < 0x50D8 ) + else if ( itemID >= 0x50D0 && itemID < 0x50D8 ) { door = new GenericHouseDoor( GetSADoorFacing( itemID - 0x50D0 ), itemID, 0xEA, 0xF1, false ); } - else if( itemID >= 0x5142 && itemID < 0x514A ) + else if ( itemID >= 0x5142 && itemID < 0x514A ) { door = new GenericHouseDoor( GetSADoorFacing( itemID - 0x5142 ), itemID, 0xF0, 0xEF, false ); } - if( door != null ) + if ( door != null ) { - if( keyValue == 0 ) + if ( keyValue == 0 ) keyValue = CreateKeys( from ); door.Locked = true; @@ -410,7 +410,7 @@ namespace Server.Multis { Item fixture = m_Fixtures[i]; - if( fixture is HouseTeleporter ) + if ( fixture is HouseTeleporter ) { HouseTeleporter tp = (HouseTeleporter)fixture; @@ -418,18 +418,18 @@ namespace Server.Multis { HouseTeleporter check = m_Fixtures[(i + j) % m_Fixtures.Count] as HouseTeleporter; - if( check != null && check.ItemID == tp.ItemID ) + if ( check != null && check.ItemID == tp.ItemID ) { tp.Target = check; break; } } } - else if( fixture is BaseHouseDoor ) + else if ( fixture is BaseHouseDoor ) { BaseHouseDoor door = (BaseHouseDoor)fixture; - if( door.Link != null ) + if ( door.Link != null ) continue; DoorFacing linkFacing; @@ -456,7 +456,7 @@ namespace Server.Multis { BaseHouseDoor check = m_Fixtures[j] as BaseHouseDoor; - if( check != null && check.Link == null && check.Facing == linkFacing && (check.X - door.X) == xOffset && (check.Y - door.Y) == yOffset && (check.Z == door.Z) ) + if ( check != null && check.Link == null && check.Facing == linkFacing && (check.X - door.X) == xOffset && (check.Y - door.Y) == yOffset && (check.Z == door.Z) ) { check.Link = door; door.Link = check; @@ -516,7 +516,7 @@ namespace Server.Multis { mcl.Add( south, x - xCenter, 0 - yCenter, 0 ); - if( x < mcl.Width-1 ) + if ( x < mcl.Width-1 ) mcl.Add( south, x - xCenter, mcl.Height - 2 - yCenter, 0 ); } @@ -524,7 +524,7 @@ namespace Server.Multis { mcl.Add( east, 0 - xCenter, y - yCenter, 0 ); - if( y < mcl.Height - 2 ) + if ( y < mcl.Height - 2 ) mcl.Add( east, mcl.Width - 1 - xCenter, y - yCenter, 0 ); } } @@ -582,14 +582,14 @@ namespace Server.Multis int x = mcl.Min.X; int y = mcl.Height - 2 - mcl.Center.Y; - if( CheckWall( mcl, x, y ) ) + if ( CheckWall( mcl, x, y ) ) { - if( m_Signpost != null ) + if ( m_Signpost != null ) m_Signpost.Delete(); m_Signpost = null; } - else if( m_Signpost == null ) + else if ( m_Signpost == null ) { m_Signpost = new Static( m_SignpostGraphic ); m_Signpost.MoveToWorld( new Point3D( X + x, Y + y, Z + 7 ), Map ); @@ -606,7 +606,7 @@ namespace Server.Multis x += mcl.Center.X; y += mcl.Center.Y; - if( x >= 0 && x < mcl.Width && y >= 0 && y < mcl.Height ) + if ( x >= 0 && x < mcl.Width && y >= 0 && y < mcl.Height ) { StaticTile[] tiles = mcl.Tiles[x][y]; @@ -614,7 +614,7 @@ namespace Server.Multis { StaticTile tile = tiles[i]; - if( tile.Z == 7 && tile.Height == 20 ) + if ( tile.Z == 7 && tile.Height == 20 ) return true; } } @@ -647,7 +647,7 @@ namespace Server.Multis public void BeginCustomize( Mobile m ) { - if( !m.CheckAlive() ) { + if ( !m.CheckAlive() ) { return; } else if ( SpellHelper.CheckCombat( m ) ) { m.SendLocalizedMessage( 1005564, "", 0x22 ); // Wouldst thou flee during the heat of battle?? @@ -663,7 +663,7 @@ namespace Server.Multis foreach( Mobile mobile in GetMobiles() ) { - if( mobile != m ) + if ( mobile != m ) mobile.Location = BanLocation; } @@ -671,7 +671,7 @@ namespace Server.Multis m.Send( new BeginHouseCustomization( this ) ); NetState ns = m.NetState; - if( ns != null ) + if ( ns != null ) SendInfoTo( ns ); DesignState.SendDetailedInfoTo( ns ); @@ -684,7 +684,7 @@ namespace Server.Multis DesignContext context = DesignContext.Find( state.Mobile ); DesignState stateToSend; - if( context != null && context.Foundation == this ) + if ( context != null && context.Foundation == this ) stateToSend = DesignState; else stateToSend = CurrentState; @@ -745,17 +745,17 @@ namespace Server.Multis } case 1: { - if( version < 5 ) + if ( version < 5 ) m_DefaultPrice = reader.ReadInt(); goto case 0; } case 0: { - if( version < 3 ) + if ( version < 3 ) m_Type = FoundationType.Stone; - if( version < 4 ) + if ( version < 4 ) m_SignpostGraphic = 9; m_LastRevision = reader.ReadInt(); @@ -802,7 +802,7 @@ namespace Server.Multis private static void EventSink_Speech( SpeechEventArgs e ) { - if( DesignContext.Find( e.Mobile ) != null ) + if ( DesignContext.Find( e.Mobile ) != null ) { e.Mobile.SendLocalizedMessage( 1061925 ); // You cannot speak while customizing your house. e.Blocked = true; @@ -814,7 +814,7 @@ namespace Server.Multis Mobile from = state.Mobile; DesignContext context = DesignContext.Find( from ); - if( context != null ) + if ( context != null ) { /* Client requested state synchronization * - Resend full house state @@ -832,7 +832,7 @@ namespace Server.Multis Mobile from = state.Mobile; DesignContext context = DesignContext.Find( from ); - if( context != null ) + if ( context != null ) { /* Client chose to clear the design * - Restore empty foundation @@ -862,7 +862,7 @@ namespace Server.Multis Mobile from = state.Mobile; DesignContext context = DesignContext.Find( from ); - if( context != null ) + if ( context != null ) { /* Client chose to restore design to the last backup state * - Restore backup @@ -892,7 +892,7 @@ namespace Server.Multis Mobile from = state.Mobile; DesignContext context = DesignContext.Find( from ); - if( context != null ) + if ( context != null ) { /* Client chose to backup design state * - Construct a copy of the current design state @@ -912,7 +912,7 @@ namespace Server.Multis Mobile from = state.Mobile; DesignContext context = DesignContext.Find( from ); - if( context != null ) + if ( context != null ) { /* Client chose to revert design state to currently visible state * - Revert design state @@ -1046,7 +1046,7 @@ namespace Server.Multis Mobile from = state.Mobile; DesignContext context = DesignContext.Find( from ); - if( context != null ) + if ( context != null ) { int oldPrice = context.Foundation.Price; int newPrice = oldPrice + context.Foundation.CustomizationCost + ((context.Foundation.DesignState.Components.List.Length - ( context.Foundation.CurrentState.Components.List.Length + context.Foundation.Fixtures.Count) ) * 500); @@ -1062,7 +1062,7 @@ namespace Server.Multis { MultiComponentList mcl = this.Components; - if( mcl.Width >= 14 || mcl.Height >= 14 ) + if ( mcl.Width >= 14 || mcl.Height >= 14 ) return 4; else return 3; @@ -1071,7 +1071,7 @@ namespace Server.Multis public static int GetLevelZ( int level, HouseFoundation house ) { - if( level < 1 || level > house.MaxLevels ) + if ( level < 1 || level > house.MaxLevels ) level = 1; return (level-1)*20 + 7; @@ -1092,7 +1092,7 @@ namespace Server.Multis { int level = (z - 7)/20 +1; - if( level < 1 || level > house.MaxLevels ) + if ( level < 1 || level > house.MaxLevels ) level = 1; return level; @@ -1186,7 +1186,7 @@ namespace Server.Multis for( int i = 0; delta < -3 && i < m_StairSeqs.Length; ++i ) delta = (m_StairSeqs[i] - id); - if( delta >= -3 && delta <= 0 ) + if ( delta >= -3 && delta <= 0 ) { dir = -delta; return true; @@ -1194,7 +1194,7 @@ namespace Server.Multis for( int i = 0; i < m_StairIDs.Length; ++i ) { - if( m_StairIDs[i] == id ) + if ( m_StairIDs[i] == id ) { dir = i % 4; return true; @@ -1209,10 +1209,10 @@ namespace Server.Multis int ax = x + mcl.Center.X; int ay = y + mcl.Center.Y; - if( ax < 0 || ay < 0 || ax >= mcl.Width || ay >= (mcl.Height - 1) || z < 7 || ((z - 7) % 5) != 0 ) + if ( ax < 0 || ay < 0 || ax >= mcl.Width || ay >= (mcl.Height - 1) || z < 7 || ((z - 7) % 5) != 0 ) return false; - if( IsStairBlock( id ) ) + if ( IsStairBlock( id ) ) { StaticTile[] tiles = mcl.Tiles[ax][ay]; @@ -1220,12 +1220,12 @@ namespace Server.Multis { StaticTile tile = tiles[i]; - if( tile.Z == (z + 5) ) + if ( tile.Z == (z + 5) ) { id = tile.ID; z = tile.Z; - if( !IsStairBlock( id ) ) + if ( !IsStairBlock( id ) ) break; } } @@ -1233,7 +1233,7 @@ namespace Server.Multis int dir = 0; - if( !IsStair( id, ref dir ) ) + if ( !IsStair( id, ref dir ) ) return false; if ( AllowStairSectioning ) @@ -1294,7 +1294,7 @@ namespace Server.Multis ax = x + mcl.Center.X; ay = y + mcl.Center.Y; - if( ax >= 1 && ax < mcl.Width && ay >= 1 && ay < mcl.Height - 1 ) + if ( ax >= 1 && ax < mcl.Width && ay >= 1 && ay < mcl.Height - 1 ) { StaticTile[] tiles = mcl.Tiles[ax][ay]; @@ -1303,7 +1303,7 @@ namespace Server.Multis for( int j = 0; !hasBaseFloor && j < tiles.Length; ++j ) hasBaseFloor = (tiles[j].Z == 7 && tiles[j].ID != 1); - if( !hasBaseFloor ) + if ( !hasBaseFloor ) mcl.Add( 0x31F4, x, y, 7 ); } } @@ -1316,7 +1316,7 @@ namespace Server.Multis Mobile from = state.Mobile; DesignContext context = DesignContext.Find( from ); - if( context != null ) + if ( context != null ) { /* Client chose to delete a component * - Read data detailing which component to delete @@ -1339,7 +1339,7 @@ namespace Server.Multis int ax = x + mcl.Center.X; int ay = y + mcl.Center.Y; - if( z == 0 && ax >= 0 && ax < mcl.Width && ay >= 0 && ay < (mcl.Height - 1) ) + if ( z == 0 && ax >= 0 && ax < mcl.Width && ay >= 0 && ay < (mcl.Height - 1) ) { /* Component is not deletable * - Resend design state @@ -1353,21 +1353,21 @@ namespace Server.Multis bool fixState = false; // Remove the component - if( AllowStairSectioning ) + if ( AllowStairSectioning ) { - if( DeleteStairs( mcl, itemID, x, y, z ) ) + if ( DeleteStairs( mcl, itemID, x, y, z ) ) fixState = true; // The client removes the entire set of stairs locally, resend state mcl.Remove( itemID, x, y, z ); } else { - if( !DeleteStairs( mcl, itemID, x, y, z ) ) + if ( !DeleteStairs( mcl, itemID, x, y, z ) ) mcl.Remove( itemID, x, y, z ); } // If needed, replace removed component with a dirt tile - if( ax >= 1 && ax < mcl.Width && ay >= 1 && ay < mcl.Height - 1 ) + if ( ax >= 1 && ax < mcl.Width && ay >= 1 && ay < mcl.Height - 1 ) { StaticTile[] tiles = mcl.Tiles[ax][ay]; @@ -1376,7 +1376,7 @@ namespace Server.Multis for( int i = 0; !hasBaseFloor && i < tiles.Length; ++i ) hasBaseFloor = (tiles[i].Z == 7 && tiles[i].ID != 1); - if( !hasBaseFloor ) + if ( !hasBaseFloor ) { // Replace with a dirt tile mcl.Add( 0x31F4, x, y, 7 ); @@ -1387,7 +1387,7 @@ namespace Server.Multis design.OnRevised(); // Resend design state - if( fixState ) + if ( fixState ) design.SendDetailedInfoTo( state ); } } @@ -1397,7 +1397,7 @@ namespace Server.Multis Mobile from = state.Mobile; DesignContext context = DesignContext.Find( from ); - if( context != null ) + if ( context != null ) { /* Client chose to add stairs * - Read data detailing stair type and location @@ -1441,7 +1441,7 @@ namespace Server.Multis { MultiTileEntry entry = stairs.List[i]; - if( entry.m_ItemID != 1 ) + if ( entry.m_ItemID != 1 ) mcl.Add( entry.m_ItemID, x + entry.m_OffsetX, y + entry.m_OffsetY, z + entry.m_OffsetZ ); } @@ -1467,7 +1467,7 @@ namespace Server.Multis Mobile from = state.Mobile; DesignContext context = DesignContext.Find( from ); - if( context != null ) + if ( context != null ) { /* Client chose to add a component * - Read data detailing component graphic and location @@ -1483,7 +1483,7 @@ namespace Server.Multis // Add component DesignState design = context.Foundation.DesignState; - if( from.AccessLevel < AccessLevel.GameMaster && !ValidPiece( itemID ) ) + if ( from.AccessLevel < AccessLevel.GameMaster && !ValidPiece( itemID ) ) { TraceValidity( state, itemID ); design.SendDetailedInfoTo( state ); @@ -1494,7 +1494,7 @@ namespace Server.Multis int z = GetLevelZ( context.Level, context.Foundation ); - if( (y + mcl.Center.Y) == (mcl.Height - 1) ) + if ( (y + mcl.Center.Y) == (mcl.Height - 1) ) z = 0; // Tiles placed on the far-south of the house are at 0 Z mcl.Add( itemID, x, y, z ); @@ -1509,7 +1509,7 @@ namespace Server.Multis Mobile from = state.Mobile; DesignContext context = DesignContext.Find( from ); - if( context != null ) + if ( context != null ) { /* Client closed his house design window * - Remove design context @@ -1552,7 +1552,7 @@ namespace Server.Multis Mobile from = state.Mobile; DesignContext context = DesignContext.Find( from ); - if( context != null ) + if ( context != null ) { /* Client is moving to a new floor level * - Read data detailing the target level @@ -1567,7 +1567,7 @@ namespace Server.Multis int newLevel = pvSrc.ReadInt32(); // Validate target level - if( newLevel < 1 || newLevel > context.MaxLevels ) + if ( newLevel < 1 || newLevel > context.MaxLevels ) newLevel = 1; // Update design context with new level @@ -1588,11 +1588,11 @@ namespace Server.Multis HouseFoundation foundation = World.FindItem( pvSrc.ReadInt32() ) as HouseFoundation; - if( foundation != null && from.Map == foundation.Map && from.InRange( foundation.GetWorldLocation(), 24 ) && from.CanSee( foundation ) ) + if ( foundation != null && from.Map == foundation.Map && from.InRange( foundation.GetWorldLocation(), 24 ) && from.CanSee( foundation ) ) { DesignState stateToSend; - if( context != null && context.Foundation == foundation ) + if ( context != null && context.Foundation == foundation ) stateToSend = foundation.DesignState; else stateToSend = foundation.CurrentState; @@ -1606,7 +1606,7 @@ namespace Server.Multis Mobile from = state.Mobile; DesignContext context = DesignContext.Find( from ); - if( context != null && (Core.SE || from.AccessLevel >= AccessLevel.GameMaster) ) + if ( context != null && (Core.SE || from.AccessLevel >= AccessLevel.GameMaster) ) { // Read data detailing component graphic and location int itemID = pvSrc.ReadInt32(); @@ -1617,7 +1617,7 @@ namespace Server.Multis // Add component DesignState design = context.Foundation.DesignState; - if( from.AccessLevel < AccessLevel.GameMaster && !ValidPiece( itemID, true ) ) + if ( from.AccessLevel < AccessLevel.GameMaster && !ValidPiece( itemID, true ) ) { TraceValidity( state, itemID ); design.SendDetailedInfoTo( state ); @@ -1626,7 +1626,7 @@ namespace Server.Multis MultiComponentList mcl = design.Components; - if( z < -3 || z > 12 || z % 3 != 0 ) + if ( z < -3 || z > 12 || z % 3 != 0 ) z = -3; z += GetLevelZ( context.Level, context.Foundation ); @@ -1635,7 +1635,7 @@ namespace Server.Multis { MultiTileEntry mte = list[i]; - if( mte.m_OffsetX == x && mte.m_OffsetY == y && GetZLevel( mte.m_OffsetZ, context.Foundation ) == context.Level && (TileData.ItemTable[mte.m_ItemID & TileData.MaxItemValue].Flags & TileFlag.Roof) != 0 ) + if ( mte.m_OffsetX == x && mte.m_OffsetY == y && GetZLevel( mte.m_OffsetZ, context.Foundation ) == context.Level && (TileData.ItemTable[mte.m_ItemID & TileData.MaxItemValue].Flags & TileFlag.Roof) != 0 ) mcl.Remove( mte.m_ItemID, x, y, mte.m_OffsetZ ); } @@ -1651,7 +1651,7 @@ namespace Server.Multis Mobile from = state.Mobile; DesignContext context = DesignContext.Find( from ); - if( context != null ) // No need to check for Core.SE if trying to remove something that shouldn't be able to be placed anyways + if ( context != null ) // No need to check for Core.SE if trying to remove something that shouldn't be able to be placed anyways { // Read data detailing which component to delete int itemID = pvSrc.ReadInt32(); @@ -1663,7 +1663,7 @@ namespace Server.Multis DesignState design = context.Foundation.DesignState; MultiComponentList mcl = design.Components; - if( (TileData.ItemTable[itemID & TileData.MaxItemValue].Flags & TileFlag.Roof) == 0 ) + if ( (TileData.ItemTable[itemID & TileData.MaxItemValue].Flags & TileFlag.Roof) == 0 ) { design.SendDetailedInfoTo( state ); return; @@ -1691,10 +1691,10 @@ namespace Server.Multis get { return m_PacketCache; } set { - if( m_PacketCache == value ) + if ( m_PacketCache == value ) return; - if( m_PacketCache != null ) + if ( m_PacketCache != null ) m_PacketCache.Release(); m_PacketCache = value; @@ -1784,7 +1784,7 @@ namespace Server.Multis { m_Revision = ++m_Foundation.LastRevision; - if( m_PacketCache != null ) + if ( m_PacketCache != null ) m_PacketCache.Release(); m_PacketCache = null; @@ -1793,17 +1793,17 @@ namespace Server.Multis public void SendGeneralInfoTo( NetState state ) { - if( state != null ) + if ( state != null ) state.Send( new DesignStateGeneral( m_Foundation, this ) ); } public void SendDetailedInfoTo( NetState state ) { - if( state != null ) + if ( state != null ) { lock( this ) { - if( m_PacketCache == null ) + if ( m_PacketCache == null ) DesignStateDetailed.SendDetails( state, m_Foundation, this ); else state.Send( m_PacketCache ); @@ -1836,7 +1836,7 @@ namespace Server.Multis { MultiTileEntry mte = list[i]; - if( IsFixture( mte.m_ItemID ) ) + if ( IsFixture( mte.m_ItemID ) ) ++length; } @@ -1846,7 +1846,7 @@ namespace Server.Multis { MultiTileEntry mte = list[i]; - if( IsFixture( mte.m_ItemID ) ) + if ( IsFixture( mte.m_ItemID ) ) { m_Fixtures[--length] = mte; m_Components.Remove( mte.m_ItemID, mte.m_OffsetX, mte.m_OffsetY, mte.m_OffsetZ ); @@ -1856,59 +1856,59 @@ namespace Server.Multis public static bool IsFixture( int itemID ) { - if( itemID >= 0x675 && itemID < 0x6F5 ) + if ( itemID >= 0x675 && itemID < 0x6F5 ) return true; - else if( itemID >= 0x314 && itemID < 0x364 ) + else if ( itemID >= 0x314 && itemID < 0x364 ) return true; - else if( itemID >= 0x824 && itemID < 0x834 ) + else if ( itemID >= 0x824 && itemID < 0x834 ) return true; - else if( itemID >= 0x839 && itemID < 0x849 ) + else if ( itemID >= 0x839 && itemID < 0x849 ) return true; - else if( itemID >= 0x84C && itemID < 0x85C ) + else if ( itemID >= 0x84C && itemID < 0x85C ) return true; - else if( itemID >= 0x866 && itemID < 0x876 ) + else if ( itemID >= 0x866 && itemID < 0x876 ) return true; - else if( itemID >= 0x0E8 && itemID < 0x0F8 ) + else if ( itemID >= 0x0E8 && itemID < 0x0F8 ) return true; - else if( itemID >= 0x1FED && itemID < 0x1FFD ) + else if ( itemID >= 0x1FED && itemID < 0x1FFD ) return true; - else if( itemID >= 0x181D && itemID < 0x1829 ) + else if ( itemID >= 0x181D && itemID < 0x1829 ) return true; - else if( itemID >= 0x241F && itemID < 0x2421 ) + else if ( itemID >= 0x241F && itemID < 0x2421 ) return true; - else if( itemID >= 0x2423 && itemID < 0x2425 ) + else if ( itemID >= 0x2423 && itemID < 0x2425 ) return true; - else if( itemID >= 0x2A05 && itemID < 0x2A1D ) + else if ( itemID >= 0x2A05 && itemID < 0x2A1D ) return true; - else if( itemID >= 0x319C && itemID < 0x31B0 ) + else if ( itemID >= 0x319C && itemID < 0x31B0 ) return true; // ML doors - else if( itemID == 0x2D46 ||itemID == 0x2D48 || itemID == 0x2FE2 || itemID == 0x2FE4 ) + else if ( itemID == 0x2D46 ||itemID == 0x2D48 || itemID == 0x2FE2 || itemID == 0x2FE4 ) return true; - else if( itemID >= 0x2D63 && itemID < 0x2D70 ) + else if ( itemID >= 0x2D63 && itemID < 0x2D70 ) return true; - else if( itemID >= 0x319C && itemID < 0x31AF ) + else if ( itemID >= 0x319C && itemID < 0x31AF ) return true; - else if( itemID >= 0x367B && itemID < 0x369B ) + else if ( itemID >= 0x367B && itemID < 0x369B ) return true; // SA doors - else if( itemID >= 0x409B && itemID < 0x40A3 ) + else if ( itemID >= 0x409B && itemID < 0x40A3 ) return true; - else if( itemID >= 0x410C && itemID < 0x4114 ) + else if ( itemID >= 0x410C && itemID < 0x4114 ) return true; - else if( itemID >= 0x41C2 && itemID < 0x41CA ) + else if ( itemID >= 0x41C2 && itemID < 0x41CA ) return true; - else if( itemID >= 0x41CF && itemID < 0x41D7 ) + else if ( itemID >= 0x41CF && itemID < 0x41D7 ) return true; - else if( itemID >= 0x436E && itemID < 0x437E ) + else if ( itemID >= 0x436E && itemID < 0x437E ) return true; - else if( itemID >= 0x46DD && itemID < 0x46E5 ) + else if ( itemID >= 0x46DD && itemID < 0x46E5 ) return true; - else if( itemID >= 0x4D22 && itemID < 0x4D2A ) + else if ( itemID >= 0x4D22 && itemID < 0x4D2A ) return true; - else if( itemID >= 0x50C8 && itemID < 0x50D8 ) + else if ( itemID >= 0x50C8 && itemID < 0x50D8 ) return true; - else if( itemID >= 0x5142 && itemID < 0x514A ) + else if ( itemID >= 0x5142 && itemID < 0x514A ) return true; // TOL doors else if ( itemID >= 0x9AD7 && itemID < 0x9AE7 ) @@ -1972,7 +1972,7 @@ namespace Server.Multis public override void OnResponse( NetState sender, RelayInfo info ) { - if( info.ButtonID == 1 ) + if ( info.ButtonID == 1 ) m_Foundation.EndConfirmCommit( sender.Mobile ); } } @@ -1998,7 +1998,7 @@ namespace Server.Multis public static DesignContext Find( Mobile from ) { - if( from == null ) + if ( from == null ) return null; m_Table.TryGetValue( from, out DesignContext d ); @@ -2008,7 +2008,7 @@ namespace Server.Multis public static bool Check( Mobile m ) { - if( Find( m ) != null ) + if ( Find( m ) != null ) { m.SendLocalizedMessage( 1062206 ); // You cannot do that while customizing a house. return false; @@ -2019,7 +2019,7 @@ namespace Server.Multis public static void Add( Mobile from, HouseFoundation foundation ) { - if( from == null ) + if ( from == null ) return; DesignContext c = new DesignContext( foundation ); @@ -2036,7 +2036,7 @@ namespace Server.Multis NetState state = from.NetState; - if( state == null ) + if ( state == null ) return; List fixtures = foundation.Fixtures; @@ -2048,13 +2048,13 @@ namespace Server.Multis state.Send( item.RemovePacket ); } - if( foundation.Signpost != null ) + if ( foundation.Signpost != null ) state.Send( foundation.Signpost.RemovePacket ); - if( foundation.SignHanger != null ) + if ( foundation.SignHanger != null ) state.Send( foundation.SignHanger.RemovePacket ); - if( foundation.Sign != null ) + if ( foundation.Sign != null ) state.Send( foundation.Sign.RemovePacket ); } @@ -2067,17 +2067,17 @@ namespace Server.Multis m_Table.Remove( from ); - if( from is PlayerMobile ) + if ( from is PlayerMobile ) ((PlayerMobile)from).DesignContext = null; - if( context == null ) + if ( context == null ) return; context.Foundation.Customizer = null; NetState state = from.NetState; - if( state == null ) + if ( state == null ) return; List fixtures = context.Foundation.Fixtures; @@ -2089,13 +2089,13 @@ namespace Server.Multis item.SendInfoTo( state ); } - if( context.Foundation.Signpost != null ) + if ( context.Foundation.Signpost != null ) context.Foundation.Signpost.SendInfoTo( state ); - if( context.Foundation.SignHanger != null ) + if ( context.Foundation.SignHanger != null ) context.Foundation.SignHanger.SendInfoTo( state ); - if( context.Foundation.Sign != null ) + if ( context.Foundation.Sign != null ) context.Foundation.Sign.SendInfoTo( state ); } } @@ -2271,11 +2271,11 @@ namespace Server.Multis } } - if( plane == 0 ) + if ( plane == 0 ) { size = height; } - else if( floor ) + else if ( floor ) { size = height - 2; x -= 1; @@ -2289,7 +2289,7 @@ namespace Server.Multis int index = ((x * size) + y) * 2; - if( x < 0 || y < 0 || y >= size || (index + 1) >= 0x400 ) + if ( x < 0 || y < 0 || y >= size || (index + 1) >= 0x400 ) { int stairBufferIndex = (totalStairsUsed / MaxItemsPerStairBuffer); byte[] stairBuffer = m_StairBuffers[stairBufferIndex]; @@ -2331,9 +2331,9 @@ namespace Server.Multis int size = 0; - if( i == 0 ) + if ( i == 0 ) size = width * height * 2; - else if( i < 5 ) + else if ( i < 5 ) size = (width - 1) * (height - 2) * 2; else size = width * (height - 1) * 2; @@ -2343,7 +2343,7 @@ namespace Server.Multis int deflatedLength = m_DeflatedBuffer.Length; ZLibError ce = Compression.Pack( m_DeflatedBuffer, ref deflatedLength, inflatedBuffer, size, ZLibQuality.Default ); - if( ce != ZLibError.Okay ) + if ( ce != ZLibError.Okay ) { Console.WriteLine( "ZLib error: {0} (#{1})", ce, (int)ce ); deflatedLength = 0; @@ -2369,7 +2369,7 @@ namespace Server.Multis int count = (totalStairsUsed - (i * MaxItemsPerStairBuffer)); - if( count > MaxItemsPerStairBuffer ) + if ( count > MaxItemsPerStairBuffer ) count = MaxItemsPerStairBuffer; int size = count * 5; @@ -2379,7 +2379,7 @@ namespace Server.Multis int deflatedLength = m_DeflatedBuffer.Length; ZLibError ce = Compression.Pack( m_DeflatedBuffer, ref deflatedLength, inflatedBuffer, size, ZLibQuality.Default ); - if( ce != ZLibError.Okay ) + if ( ce != ZLibError.Okay ) { Console.WriteLine( "ZLib error: {0} (#{1})", ce, (int)ce ); deflatedLength = 0; @@ -2475,14 +2475,14 @@ namespace Server.Multis lock( sqe.m_Root ) p = sqe.m_Root.PacketCache; - if( p == null ) + if ( p == null ) { p = new DesignStateDetailed( sqe.m_Serial, sqe.m_Revision, sqe.m_xMin, sqe.m_yMin, sqe.m_xMax, sqe.m_yMax, sqe.m_Tiles ); p.SetStatic(); lock( sqe.m_Root ) { - if( sqe.m_Revision == sqe.m_Root.Revision ) + if ( sqe.m_Revision == sqe.m_Root.Revision ) sqe.m_Root.PacketCache = p; } } diff --git a/Scripts/Multis/MovingCrate.cs b/Scripts/Multis/MovingCrate.cs index 100f7660d..114ec48ad 100644 --- a/Scripts/Multis/MovingCrate.cs +++ b/Scripts/Multis/MovingCrate.cs @@ -242,7 +242,7 @@ namespace Server.Multis m_House = reader.ReadItem() as BaseHouse; - if( m_House != null ) + if ( m_House != null ) { m_House.MovingCrate = this; Timer.DelayCall( TimeSpan.Zero, new TimerCallback( Hide ) ); diff --git a/Scripts/Regions/BaseRegion.cs b/Scripts/Regions/BaseRegion.cs index 3c15962bc..37670d60e 100644 --- a/Scripts/Regions/BaseRegion.cs +++ b/Scripts/Regions/BaseRegion.cs @@ -129,7 +129,7 @@ namespace Server.Regions { if (m is PlayerMobile && ((PlayerMobile)m).Young) { - if(!this.YoungProtected) + if (!this.YoungProtected) { m.SendGump(new YoungDungeonWarning()); } diff --git a/Scripts/Regions/GuardedRegion.cs b/Scripts/Regions/GuardedRegion.cs index 28a8f00a8..3fa64e698 100644 --- a/Scripts/Regions/GuardedRegion.cs +++ b/Scripts/Regions/GuardedRegion.cs @@ -281,7 +281,7 @@ namespace Server.Regions foreach ( Mobile v in m.GetMobilesInRange( 8 ) ) { - if( !v.Player && v != m && !IsGuardCandidate( v ) && ((v is BaseCreature)? ((BaseCreature)v).IsHumanInTown() : (v.Body.IsHuman && v.Region.IsPartOf( this ))) ) + if ( !v.Player && v != m && !IsGuardCandidate( v ) && ((v is BaseCreature)? ((BaseCreature)v).IsHumanInTown() : (v.Body.IsHuman && v.Region.IsPartOf( this ))) ) { double dist = m.GetDistanceToSqrt( v ); diff --git a/Scripts/Regions/HouseRegion.cs b/Scripts/Regions/HouseRegion.cs index c1db4cb7f..804aca11c 100644 --- a/Scripts/Regions/HouseRegion.cs +++ b/Scripts/Regions/HouseRegion.cs @@ -98,14 +98,14 @@ namespace Server.Regions { m.Location = m_House.BanLocation; - if( !Core.SE ) + if ( !Core.SE ) m.SendLocalizedMessage( 501284 ); // You may not enter. } else if ( m_House.IsAosRules && !m_House.Public && !m_House.HasAccess( m ) && m_House.IsInside( m ) ) { m.Location = m_House.BanLocation; - if( !Core.SE ) + if ( !Core.SE ) m.SendLocalizedMessage( 501284 ); // You may not enter. } else if ( m_House.IsCombatRestricted( m ) && m_House.IsInside( m ) && !m_House.IsInside( oldLocation, 16 ) ) @@ -159,14 +159,14 @@ namespace Server.Regions { from.Location = m_House.BanLocation; - if( !Core.SE ) + if ( !Core.SE ) from.SendLocalizedMessage( 501284 ); // You may not enter. return false; } else if ( m_House.IsAosRules && !m_House.Public && !m_House.HasAccess( from ) && m_House.IsInside( newLocation, 16 ) ) { - if( !Core.SE ) + if ( !Core.SE ) from.SendLocalizedMessage( 501284 ); // You may not enter. return false; @@ -257,7 +257,7 @@ namespace Server.Regions { from.CloseGump( typeof( ConfirmHouseResize ) ); from.CloseGump( typeof( HouseGumpAOS ) ); - from.SendGump( new ConfirmHouseResize( from, m_House ) ); + from.SendGump( new ConfirmHouseResize( from, m_House ) ); } else { @@ -429,4 +429,4 @@ namespace Server.Regions } } } -} \ No newline at end of file +} diff --git a/Scripts/Regions/Spawning/SpawnEntry.cs b/Scripts/Regions/Spawning/SpawnEntry.cs index 99e79e4a2..0ef7d593f 100644 --- a/Scripts/Regions/Spawning/SpawnEntry.cs +++ b/Scripts/Regions/Spawning/SpawnEntry.cs @@ -182,7 +182,7 @@ namespace Server.Regions bool uncontrolled = !(spawnable is BaseCreature) || !((BaseCreature)spawnable).Controlled; - if( uncontrolled ) + if ( uncontrolled ) spawnable.Delete(); } diff --git a/Scripts/Skills/AnimalTaming.cs b/Scripts/Skills/AnimalTaming.cs index bf759d8ce..39988a2c7 100644 --- a/Scripts/Skills/AnimalTaming.cs +++ b/Scripts/Skills/AnimalTaming.cs @@ -119,7 +119,7 @@ namespace Server.SkillHandlers public virtual void ResetPacify( object obj ) { - if( obj is BaseCreature ) + if ( obj is BaseCreature ) { ((BaseCreature)obj).BardPacified = true; } @@ -192,7 +192,7 @@ namespace Server.SkillHandlers creature.PlaySound( creature.GetAngerSound() ); creature.Direction = creature.GetDirectionTo( from ); - if( creature.BardPacified && Utility.RandomDouble() > .24) + if ( creature.BardPacified && Utility.RandomDouble() > .24) { Timer.DelayCall( TimeSpan.FromSeconds( 2.0 ), new TimerStateCallback( ResetPacify ), creature ); } @@ -400,7 +400,7 @@ namespace Server.SkillHandlers if ( p == null ) return false; - if( m_Creature.InRange( new Point3D( p ), 1 ) ) + if ( m_Creature.InRange( new Point3D( p ), 1 ) ) return true; MovementPath path = new MovementPath( m_Creature, new Point3D( p ) ); @@ -409,4 +409,4 @@ namespace Server.SkillHandlers } } } -} \ No newline at end of file +} diff --git a/Scripts/Skills/ArmsLore.cs b/Scripts/Skills/ArmsLore.cs index 820781f64..709cd6712 100644 --- a/Scripts/Skills/ArmsLore.cs +++ b/Scripts/Skills/ArmsLore.cs @@ -93,9 +93,9 @@ namespace Server.SkillHandlers from.SendLocalizedMessage( 500353 ); // You are not certain... } } - else if(targeted is BaseArmor) + else if (targeted is BaseArmor) { - if( from.CheckTargetSkill(SkillName.ArmsLore, targeted, 0, 100) ) + if ( from.CheckTargetSkill(SkillName.ArmsLore, targeted, 0, 100) ) { BaseArmor arm = (BaseArmor)targeted; @@ -164,4 +164,4 @@ namespace Server.SkillHandlers } } } -} \ No newline at end of file +} diff --git a/Scripts/Skills/SpiritSpeak.cs b/Scripts/Skills/SpiritSpeak.cs index 7c0ce29e0..e2072bee8 100644 --- a/Scripts/Skills/SpiritSpeak.cs +++ b/Scripts/Skills/SpiritSpeak.cs @@ -138,7 +138,7 @@ namespace Server.SkillHandlers foreach ( Item item in Caster.GetItemsInRange( 3 ) ) { - if( item is Corpse && !( (Corpse)item ).Channeled ) + if ( item is Corpse && !( (Corpse)item ).Channeled ) { toChannel = (Corpse)item; break; diff --git a/Scripts/Skills/Stealing.cs b/Scripts/Skills/Stealing.cs index 5fe07d7d5..0022cb95b 100644 --- a/Scripts/Skills/Stealing.cs +++ b/Scripts/Skills/Stealing.cs @@ -90,7 +90,7 @@ namespace Server.SkillHandlers } #region Sigils else if ( toSteal is Sigil ) - { + { PlayerState pl = PlayerState.Find( m_Thief ); Faction faction = ( pl == null ? null : pl.Faction ); @@ -116,9 +116,9 @@ namespace Server.SkillHandlers } else if ( !m_Thief.CanBeginAction( typeof( PolymorphSpell ) ) ) { - m_Thief.SendLocalizedMessage( 1010582 ); // You cannot steal the sigil while polymorphed + m_Thief.SendLocalizedMessage( 1010582 ); // You cannot steal the sigil while polymorphed } - else if( TransformationSpellHelper.UnderTransformation( m_Thief ) ) + else if ( TransformationSpellHelper.UnderTransformation( m_Thief ) ) { m_Thief.SendLocalizedMessage( 1061622 ); // You cannot steal the sigil while in that form. } @@ -299,7 +299,7 @@ namespace Server.SkillHandlers { root = ((Item)target).RootParent; stolen = TryStealItem( (Item)target, ref caught ); - } + } else if ( target is Mobile ) { Container pack = ((Mobile)target).Backpack; @@ -311,8 +311,8 @@ namespace Server.SkillHandlers root = target; stolen = TryStealItem( pack.Items[randomIndex], ref caught ); } - } - else + } + else { m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that! } @@ -488,4 +488,4 @@ namespace Server.SkillHandlers } } } -} \ No newline at end of file +} diff --git a/Scripts/Skills/Stealth.cs b/Scripts/Skills/Stealth.cs index 939c0beef..5a3d7d743 100644 --- a/Scripts/Skills/Stealth.cs +++ b/Scripts/Skills/Stealth.cs @@ -32,7 +32,7 @@ namespace Server.SkillHandlers public static int GetArmorRating( Mobile m ) { - if( !Core.AOS ) + if ( !Core.AOS ) return (int)m.ArmorRating; int ar = 0; @@ -41,16 +41,16 @@ namespace Server.SkillHandlers { BaseArmor armor = m.Items[i] as BaseArmor; - if( armor == null ) + if ( armor == null ) continue; int materialType = (int)armor.MaterialType; int bodyPosition = (int)armor.BodyPosition; - if( materialType >= m_ArmorTable.GetLength( 0 ) || bodyPosition >= m_ArmorTable.GetLength( 1 ) ) + if ( materialType >= m_ArmorTable.GetLength( 0 ) || bodyPosition >= m_ArmorTable.GetLength( 1 ) ) continue; - if( armor.ArmorAttributes.MageArmor == 0 ) + if ( armor.ArmorAttributes.MageArmor == 0 ) ar += m_ArmorTable[materialType, bodyPosition]; } @@ -68,7 +68,7 @@ namespace Server.SkillHandlers m.SendLocalizedMessage( 502726 ); // You are not hidden well enough. Become better at hiding. m.RevealingAction(); } - else if( !m.CanBeginAction( typeof( Stealth ) ) ) + else if ( !m.CanBeginAction( typeof( Stealth ) ) ) { m.SendLocalizedMessage( 1063086 ); // You cannot use this skill right now. m.RevealingAction(); @@ -77,23 +77,23 @@ namespace Server.SkillHandlers { int armorRating = GetArmorRating( m ); - if( armorRating >= (Core.AOS ? 42 : 26) ) //I have a hunch '42' was chosen cause someone's a fan of DNA + if ( armorRating >= (Core.AOS ? 42 : 26) ) //I have a hunch '42' was chosen cause someone's a fan of DNA { m.SendLocalizedMessage( 502727 ); // You could not hope to move quietly wearing this much armor. m.RevealingAction(); } - else if( m.CheckSkill( SkillName.Stealth, -20.0 + (armorRating * 2), (Core.AOS ? 60.0 : 80.0) + (armorRating * 2) ) ) + else if ( m.CheckSkill( SkillName.Stealth, -20.0 + (armorRating * 2), (Core.AOS ? 60.0 : 80.0) + (armorRating * 2) ) ) { int steps = (int)(m.Skills[SkillName.Stealth].Value / (Core.AOS ? 5.0 : 10.0)); - if( steps < 1 ) + if ( steps < 1 ) steps = 1; m.AllowedStealthSteps = steps; PlayerMobile pm = m as PlayerMobile; // IsStealthing should be moved to Server.Mobiles - if( pm != null ) + if ( pm != null ) pm.IsStealthing = true; m.SendLocalizedMessage( 502730 ); // You begin to move quietly. diff --git a/Scripts/Skills/Tracking.cs b/Scripts/Skills/Tracking.cs index 075618c34..08d7d1014 100644 --- a/Scripts/Skills/Tracking.cs +++ b/Scripts/Skills/Tracking.cs @@ -64,7 +64,7 @@ namespace Server.SkillHandlers m_Table.Remove( tracker ); //Reset as of Pub 40, counting it as bug for Core.SE. - if( Core.ML ) + if ( Core.ML ) return Math.Min( bonus, 10 + tracker.Skills.Tracking.Value/10 ); return bonus; @@ -212,7 +212,7 @@ namespace Server.SkillHandlers int tracking = from.Skills[SkillName.Tracking].Fixed; int detectHidden = from.Skills[SkillName.DetectHidden].Fixed; - if( Core.ML && m.Race == Race.Elf ) + if ( Core.ML && m.Race == Race.Elf ) tracking /= 2; //The 'Guide' says that it requires twice as Much tracking SKILL to track an elf. Not the total difficulty to track. int hiding = m.Skills[SkillName.Hiding].Fixed; diff --git a/Scripts/SpecialSystems/Engines/TestCenter.cs b/Scripts/SpecialSystems/Engines/TestCenter.cs index 3ade2d029..72c3a7c68 100644 --- a/Scripts/SpecialSystems/Engines/TestCenter.cs +++ b/Scripts/SpecialSystems/Engines/TestCenter.cs @@ -14,7 +14,7 @@ namespace Server.Misc public static void Initialize() { // Register our speech handler - if( Enabled ) + if ( Enabled ) EventSink.Speech += new SpeechEventHandler( EventSink_Speech ); } @@ -22,7 +22,7 @@ namespace Server.Misc { if ( !args.Handled ) { - if( Insensitive.StartsWith( args.Speech, "set" ) ) + if ( Insensitive.StartsWith( args.Speech, "set" ) ) { Mobile from = args.Mobile; @@ -49,7 +49,7 @@ namespace Server.Misc } } } - else if( Insensitive.Equals( args.Speech, "help" ) ) + else if ( Insensitive.Equals( args.Speech, "help" ) ) { args.Mobile.SendGump( new TCHelpGump() ); @@ -122,7 +122,7 @@ namespace Server.Misc { SkillName index; - if( !Enum.TryParse( name, true, out index ) || (!Core.SE && (int)index > 51) || (!Core.AOS && (int)index > 48) ) + if ( !Enum.TryParse( name, true, out index ) || (!Core.SE && (int)index > 51) || (!Core.AOS && (int)index > 48) ) { from.SendLocalizedMessage( 1005631 ); // You have specified an invalid skill to set. return; @@ -157,7 +157,7 @@ namespace Server.Misc } } - + public class TCHelpGump : Gump { public TCHelpGump() : base( 40, 40 ) @@ -233,4 +233,4 @@ namespace Server.Misc } } } -} \ No newline at end of file +} diff --git a/Scripts/SpecialSystems/Items/Stones/GamblingStone.cs b/Scripts/SpecialSystems/Items/Stones/GamblingStone.cs index 06e2b6693..ab7a597fa 100644 --- a/Scripts/SpecialSystems/Items/Stones/GamblingStone.cs +++ b/Scripts/SpecialSystems/Items/Stones/GamblingStone.cs @@ -48,14 +48,14 @@ namespace Server.Items { Container pack = from.Backpack; - if( pack != null && pack.ConsumeTotal( typeof( Gold ), 250 ) ) + if ( pack != null && pack.ConsumeTotal( typeof( Gold ), 250 ) ) { m_GamblePot += 150; InvalidateProperties(); int roll = Utility.Random( 1200 ); - if( roll == 0 ) // Jackpot + if ( roll == 0 ) // Jackpot { int maxCheck = 1000000; @@ -72,17 +72,17 @@ namespace Server.Items m_GamblePot = 2500; } - else if( roll <= 20 ) // Chance for a regbag + else if ( roll <= 20 ) // Chance for a regbag { from.SendMessage( 0x35, "You win a bag of reagents!" ); from.AddToBackpack( new BagOfReagents( 50 ) ); } - else if( roll <= 40 ) // Chance for gold + else if ( roll <= 40 ) // Chance for gold { from.SendMessage( 0x35, "You win 1500gp!" ); from.AddToBackpack( new BankCheck( 1500 ) ); } - else if( roll <= 100 ) // Another chance for gold + else if ( roll <= 100 ) // Another chance for gold { from.SendMessage( 0x35, "You win 1000gp!" ); from.AddToBackpack( new BankCheck( 1000 ) ); @@ -129,4 +129,4 @@ namespace Server.Items } } } -} \ No newline at end of file +} diff --git a/Scripts/Spells/Base/MagerySpell.cs b/Scripts/Spells/Base/MagerySpell.cs index 3c8bab783..5cfd63152 100644 --- a/Scripts/Spells/Base/MagerySpell.cs +++ b/Scripts/Spells/Base/MagerySpell.cs @@ -15,10 +15,10 @@ namespace Server.Spells public override bool ConsumeReagents() { - if( base.ConsumeReagents() ) + if ( base.ConsumeReagents() ) return true; - if( ArcaneGem.ConsumeCharges( Caster, (Core.SE ? 1 : 1 + (int)Circle) ) ) + if ( ArcaneGem.ConsumeCharges( Caster, (Core.SE ? 1 : 1 + (int)Circle) ) ) return true; return false; @@ -30,7 +30,7 @@ namespace Server.Spells { int circle = (int)Circle; - if( Scroll != null ) + if ( Scroll != null ) circle -= 2; double avg = ChanceLength * circle; @@ -43,7 +43,7 @@ namespace Server.Spells public override int GetMana() { - if( Scroll is BaseWand ) + if ( Scroll is BaseWand ) return 0; return m_ManaTable[(int)Circle]; @@ -54,7 +54,7 @@ namespace Server.Spells int maxSkill = (1 + (int)Circle) * 10; maxSkill += (1 + ((int)Circle / 6)) * 25; - if( m.Skills[SkillName.MagicResist].Value < maxSkill ) + if ( m.Skills[SkillName.MagicResist].Value < maxSkill ) m.CheckSkill( SkillName.MagicResist, 0.0, m.Skills[SkillName.MagicResist].Cap ); return m.Skills[SkillName.MagicResist].Value; @@ -66,16 +66,16 @@ namespace Server.Spells n /= 100.0; - if( n <= 0.0 ) + if ( n <= 0.0 ) return false; - if( n >= 1.0 ) + if ( n >= 1.0 ) return true; int maxSkill = (1 + (int)Circle) * 10; maxSkill += (1 + ((int)Circle / 6)) * 25; - if( target.Skills[SkillName.MagicResist].Value < maxSkill ) + if ( target.Skills[SkillName.MagicResist].Value < maxSkill ) target.CheckSkill( SkillName.MagicResist, 0.0, target.Skills[SkillName.MagicResist].Cap ); return (n >= Utility.RandomDouble()); @@ -96,10 +96,10 @@ namespace Server.Spells public override TimeSpan GetCastDelay() { - if( !Core.ML && Scroll is BaseWand ) + if ( !Core.ML && Scroll is BaseWand ) return TimeSpan.Zero; - if( !Core.AOS ) + if ( !Core.AOS ) return TimeSpan.FromSeconds( 0.5 + (0.25 * (int)Circle) ); return base.GetCastDelay(); diff --git a/Scripts/Spells/Base/Spell.cs b/Scripts/Spells/Base/Spell.cs index 0de32a1bd..c35ca7a6b 100644 --- a/Scripts/Spells/Base/Spell.cs +++ b/Scripts/Spells/Base/Spell.cs @@ -72,7 +72,7 @@ namespace Server.Spells public void StartDelayedDamageContext( Mobile m, Timer t ) { - if( DelayedDamageStacking ) + if ( DelayedDamageStacking ) return; //Sanity if (!m_ContextTable.TryGetValue( GetType(), out DelayedDamageContextWrapper contexts )) @@ -107,7 +107,7 @@ namespace Server.Spells public virtual int GetNewAosDamage( int bonus, int dice, int sides, Mobile singleTarget ) { - if( singleTarget != null ) + if ( singleTarget != null ) { return GetNewAosDamage( bonus, dice, sides, (Caster.Player && singleTarget.Player), GetDamageScalar( singleTarget ) ); } @@ -143,7 +143,7 @@ namespace Server.Spells TransformContext context = TransformationSpellHelper.GetContext( Caster ); - if( context != null && context.Spell is ReaperFormSpell ) + if ( context != null && context.Spell is ReaperFormSpell ) damageBonus += ((ReaperFormSpell)context.Spell).SpellDamageBonus; damage = AOS.Scale( damage, 100 + damageBonus ); @@ -285,19 +285,19 @@ namespace Server.Spells { double scalar = 1.0; - if( !Core.AOS ) //EvalInt stuff for AoS is handled elsewhere + if ( !Core.AOS ) //EvalInt stuff for AoS is handled elsewhere { double casterEI = m_Caster.Skills[DamageSkill].Value; double targetRS = target.Skills[SkillName.MagicResist].Value; /* - if( Core.AOS ) + if ( Core.AOS ) targetRS = 0; */ //m_Caster.CheckSkill( DamageSkill, 0.0, 120.0 ); - if( casterEI > targetRS ) + if ( casterEI > targetRS ) scalar = (1.0 + ((casterEI - targetRS) / 500.0)); else scalar = (1.0 + ((casterEI - targetRS) / 200.0)); @@ -305,7 +305,7 @@ namespace Server.Spells // magery damage bonus, -25% at 0 skill, +0% at 100 skill, +5% at 120 skill scalar += (m_Caster.Skills[CastSkill].Value - 100.0) / 400.0; - if( !target.Player && !target.Body.IsHuman /*&& !Core.AOS*/ ) + if ( !target.Player && !target.Body.IsHuman /*&& !Core.AOS*/ ) scalar *= 2.0; // Double magery damage to monsters/animals if not AOS } @@ -315,12 +315,12 @@ namespace Server.Spells if ( m_Caster is BaseCreature ) ((BaseCreature)m_Caster).AlterDamageScalarTo( target, ref scalar ); - if( Core.SE ) + if ( Core.SE ) scalar *= GetSlayerDamageScalar( target ); target.Region.SpellDamageScalar( m_Caster, target, ref scalar ); - if( Evasion.CheckSpellEvasion( target ) ) //Only single target spells an be evaded + if ( Evasion.CheckSpellEvasion( target ) ) //Only single target spells an be evaded scalar = 0; return scalar; @@ -331,12 +331,12 @@ namespace Server.Spells Spellbook atkBook = Spellbook.FindEquippedSpellbook( m_Caster ); double scalar = 1.0; - if( atkBook != null ) + if ( atkBook != null ) { SlayerEntry atkSlayer = SlayerGroup.GetEntryByName( atkBook.Slayer ); SlayerEntry atkSlayer2 = SlayerGroup.GetEntryByName( atkBook.Slayer2 ); - if( atkSlayer != null && atkSlayer.Slays( defender ) || atkSlayer2 != null && atkSlayer2.Slays( defender ) ) + if ( atkSlayer != null && atkSlayer.Slays( defender ) || atkSlayer2 != null && atkSlayer2.Slays( defender ) ) { defender.FixedEffect( 0x37B9, 10, 5 ); //TODO: Confirm this displays on OSIs scalar = 2.0; @@ -345,24 +345,24 @@ namespace Server.Spells TransformContext context = TransformationSpellHelper.GetContext( defender ); - if( (atkBook.Slayer == SlayerName.Silver || atkBook.Slayer2 == SlayerName.Silver) && context != null && context.Type != typeof( HorrificBeastSpell ) ) + if ( (atkBook.Slayer == SlayerName.Silver || atkBook.Slayer2 == SlayerName.Silver) && context != null && context.Type != typeof( HorrificBeastSpell ) ) scalar +=.25; // Every necromancer transformation other than horrific beast take an additional 25% damage - if( scalar != 1.0 ) + if ( scalar != 1.0 ) return scalar; } ISlayer defISlayer = Spellbook.FindEquippedSpellbook( defender ); - if( defISlayer == null ) + if ( defISlayer == null ) defISlayer = defender.Weapon as ISlayer; - if( defISlayer != null ) + if ( defISlayer != null ) { SlayerEntry defSlayer = SlayerGroup.GetEntryByName( defISlayer.Slayer ); SlayerEntry defSlayer2 = SlayerGroup.GetEntryByName( defISlayer.Slayer2 ); - if( defSlayer != null && defSlayer.Group.OppositionSuperSlays( m_Caster ) || defSlayer2 != null && defSlayer2.Group.OppositionSuperSlays( m_Caster ) ) + if ( defSlayer != null && defSlayer.Group.OppositionSuperSlays( m_Caster ) || defSlayer2 != null && defSlayer2.Group.OppositionSuperSlays( m_Caster ) ) scalar = 2.0; } @@ -407,7 +407,7 @@ namespace Server.Spells if ( m_State == SpellState.Casting ) { - if( !firstCircle && !Core.AOS && this is MagerySpell && ((MagerySpell)this).Circle == SpellCircle.First ) + if ( !firstCircle && !Core.AOS && this is MagerySpell && ((MagerySpell)this).Circle == SpellCircle.First ) return; m_State = SpellState.None; @@ -428,7 +428,7 @@ namespace Server.Spells } else if ( m_State == SpellState.Sequencing ) { - if( !firstCircle && !Core.AOS && this is MagerySpell && ((MagerySpell)this).Circle == SpellCircle.First ) + if ( !firstCircle && !Core.AOS && this is MagerySpell && ((MagerySpell)this).Circle == SpellCircle.First ) return; m_State = SpellState.None; @@ -693,7 +693,7 @@ namespace Server.Spells if ( ProtectionSpell.Registry.Contains( m_Caster ) ) fc -= 2; - if( EssenceOfWindSpell.IsDebuffed( m_Caster ) ) + if ( EssenceOfWindSpell.IsDebuffed( m_Caster ) ) fc -= EssenceOfWindSpell.GetFCMalus( m_Caster ); TimeSpan baseDelay = CastDelayBase; @@ -787,7 +787,7 @@ namespace Server.Spells if ( karma != 0 ) Misc.Titles.AwardKarma( Caster, karma, true ); - if( TransformationSpellHelper.UnderTransformation( m_Caster, typeof( VampiricEmbraceSpell ) ) ) + if ( TransformationSpellHelper.UnderTransformation( m_Caster, typeof( VampiricEmbraceSpell ) ) ) { bool garlic = false; diff --git a/Scripts/Spells/Base/SpellHelper.cs b/Scripts/Spells/Base/SpellHelper.cs index 4c206f165..cce8de41b 100644 --- a/Scripts/Spells/Base/SpellHelper.cs +++ b/Scripts/Spells/Base/SpellHelper.cs @@ -21,7 +21,7 @@ namespace Server { public static void Nullify( Mobile from ) { - if( !from.CanBeginAction( typeof( DefensiveSpell ) ) ) + if ( !from.CanBeginAction( typeof( DefensiveSpell ) ) ) new InternalTimer( from ).Start(); } @@ -65,7 +65,7 @@ namespace Server.Spells public static TimeSpan GetDamageDelayForSpell( Spell sp ) { - if( !sp.DelayedDamage ) + if ( !sp.DelayedDamage ) return TimeSpan.Zero; return (Core.AOS ? AosDamageDelay : OldDamageDelay); @@ -83,7 +83,7 @@ namespace Server.Spells public static bool CheckMulti( Point3D p, Map map, bool houses, int housingrange ) { - if( map == null || map == Map.Internal ) + if ( map == null || map == Map.Internal ) return false; Sector sector = map.GetSector( p.X, p.Y ); @@ -92,14 +92,14 @@ namespace Server.Spells { BaseMulti multi = sector.Multis[i]; - if( multi is BaseHouse ) + if ( multi is BaseHouse ) { BaseHouse bh = (BaseHouse)multi; - if( ( houses && bh.IsInside( p, 16 ) ) || ( housingrange > 0 && bh.InRange( p, housingrange ) ) ) + if ( ( houses && bh.IsInside( p, 16 ) ) || ( housingrange > 0 && bh.InRange( p, housingrange ) ) ) return true; } - else if( multi.Contains( p )) + else if ( multi.Contains( p )) { return true; } @@ -112,17 +112,17 @@ namespace Server.Spells { IPoint3D target = to as IPoint3D; - if( target == null ) + if ( target == null ) return; - if( target is Item ) + if ( target is Item ) { Item item = (Item)target; - if( item.RootParent != from ) + if ( item.RootParent != from ) from.Direction = from.GetDirectionTo( item.GetWorldLocation() ); } - else if( from != target ) + else if ( from != target ) { from.Direction = from.GetDirectionTo( target ); } @@ -133,24 +133,24 @@ namespace Server.Spells public static bool CheckCombat( Mobile m ) { - if( !RestrictTravelCombat ) + if ( !RestrictTravelCombat ) return false; for( int i = 0; i < m.Aggressed.Count; ++i ) { AggressorInfo info = m.Aggressed[i]; - if( info.Defender.Player && (DateTime.UtcNow - info.LastCombatTime) < CombatHeatDelay ) + if ( info.Defender.Player && (DateTime.UtcNow - info.LastCombatTime) < CombatHeatDelay ) return true; } - if( Core.Expansion == Expansion.AOS ) + if ( Core.Expansion == Expansion.AOS ) { for( int i = 0; i < m.Aggressors.Count; ++i ) { AggressorInfo info = m.Aggressors[i]; - if( info.Attacker.Player && (DateTime.UtcNow - info.LastCombatTime) < CombatHeatDelay ) + if ( info.Attacker.Player && (DateTime.UtcNow - info.LastCombatTime) < CombatHeatDelay ) return true; } } @@ -160,14 +160,14 @@ namespace Server.Spells public static bool AdjustField( ref Point3D p, Map map, int height, bool mobsBlock ) { - if( map == null ) + if ( map == null ) return false; for( int offset = 0; offset < 10; ++offset ) { Point3D loc = new Point3D( p.X, p.Y, p.Z - offset ); - if( map.CanFit( loc, height, true, mobsBlock ) ) + if ( map.CanFit( loc, height, true, mobsBlock ) ) { p = loc; return true; @@ -192,16 +192,16 @@ namespace Server.Spells public static void GetSurfaceTop( ref IPoint3D p ) { - if( p is Item ) + if ( p is Item ) { p = ((Item)p).GetSurfaceTop(); } - else if( p is StaticTarget ) + else if ( p is StaticTarget ) { StaticTarget t = (StaticTarget)p; int z = t.Z; - if( (t.Flags & TileFlag.Surface) == 0 ) + if ( (t.Flags & TileFlag.Surface) == 0 ) z -= TileData.ItemTable[t.ItemID & TileData.MaxItemValue].CalcHeight; p = new Point3D( t.X, t.Y, z ); @@ -210,9 +210,9 @@ namespace Server.Spells public static bool AddStatOffset( Mobile m, StatType type, int offset, TimeSpan duration ) { - if( offset > 0 ) + if ( offset > 0 ) return AddStatBonus( m, m, type, offset, duration ); - else if( offset < 0 ) + else if ( offset < 0 ) return AddStatCurse( m, m, type, -offset, duration ); return true; @@ -230,12 +230,12 @@ namespace Server.Spells StatMod mod = target.GetStatMod( name ); - if( mod != null && mod.Offset < 0 ) + if ( mod != null && mod.Offset < 0 ) { target.AddStatMod( new StatMod( type, name, mod.Offset + offset, duration ) ); return true; } - else if( mod == null || mod.Offset < offset ) + else if ( mod == null || mod.Offset < offset ) { target.AddStatMod( new StatMod( type, name, offset, duration ) ); return true; @@ -256,12 +256,12 @@ namespace Server.Spells StatMod mod = target.GetStatMod( name ); - if( mod != null && mod.Offset > 0 ) + if ( mod != null && mod.Offset > 0 ) { target.AddStatMod( new StatMod( type, name, mod.Offset + offset, duration ) ); return true; } - else if( mod == null || mod.Offset > offset ) + else if ( mod == null || mod.Offset > offset ) { target.AddStatMod( new StatMod( type, name, offset, duration ) ); return true; @@ -272,7 +272,7 @@ namespace Server.Spells public static TimeSpan GetDuration( Mobile caster, Mobile target ) { - if( Core.AOS ) + if ( Core.AOS ) return TimeSpan.FromSeconds( ((6 * caster.Skills.EvalInt.Fixed) / 50) + 1 ); return TimeSpan.FromSeconds( caster.Skills[SkillName.Magery].Value * 1.2 ); @@ -290,14 +290,14 @@ namespace Server.Spells { double percent; - if( curse ) + if ( curse ) percent = 8 + (caster.Skills.EvalInt.Fixed / 100) - (target.Skills.MagicResist.Fixed / 100); else percent = 1 + (caster.Skills.EvalInt.Fixed / 100); percent *= 0.01; - if( percent < 0 ) + if ( percent < 0 ) percent = 0; return percent; @@ -305,13 +305,13 @@ namespace Server.Spells public static int GetOffset( Mobile caster, Mobile target, StatType type, bool curse ) { - if( Core.AOS ) + if ( Core.AOS ) { - if( !m_DisableSkillCheck ) + if ( !m_DisableSkillCheck ) { caster.CheckSkill( SkillName.EvalInt, 0.0, 120.0 ); - if( curse ) + if ( curse ) target.CheckSkill( SkillName.MagicResist, 0.0, 120.0 ); } @@ -335,19 +335,19 @@ namespace Server.Spells { Guild g = m.Guild as Guild; - if( g == null && m is BaseCreature ) + if ( g == null && m is BaseCreature ) { BaseCreature c = (BaseCreature)m; m = c.ControlMaster; - if( m != null ) + if ( m != null ) g = m.Guild as Guild; - if( g == null ) + if ( g == null ) { m = c.SummonMaster; - if( m != null ) + if ( m != null ) g = m.Guild as Guild; } } @@ -357,10 +357,10 @@ namespace Server.Spells public static bool ValidIndirectTarget( Mobile from, Mobile to ) { - if( from == to ) + if ( from == to ) return true; - if( to.Hidden && to.AccessLevel > from.AccessLevel ) + if ( to.Hidden && to.AccessLevel > from.AccessLevel ) return false; #region Dueling @@ -393,45 +393,45 @@ namespace Server.Spells Guild fromGuild = GetGuildFor( from ); Guild toGuild = GetGuildFor( to ); - if( fromGuild != null && toGuild != null && (fromGuild == toGuild || fromGuild.IsAlly( toGuild )) ) + if ( fromGuild != null && toGuild != null && (fromGuild == toGuild || fromGuild.IsAlly( toGuild )) ) return false; Party p = Party.Get( from ); - if( p != null && p.Contains( to ) ) + if ( p != null && p.Contains( to ) ) return false; - if( to is BaseCreature ) + if ( to is BaseCreature ) { BaseCreature c = (BaseCreature)to; - if( c.Controlled || c.Summoned ) + if ( c.Controlled || c.Summoned ) { - if( c.ControlMaster == from || c.SummonMaster == from ) + if ( c.ControlMaster == from || c.SummonMaster == from ) return false; - if( p != null && (p.Contains( c.ControlMaster ) || p.Contains( c.SummonMaster )) ) + if ( p != null && (p.Contains( c.ControlMaster ) || p.Contains( c.SummonMaster )) ) return false; } } - if( from is BaseCreature ) + if ( from is BaseCreature ) { BaseCreature c = (BaseCreature)from; - if( c.Controlled || c.Summoned ) + if ( c.Controlled || c.Summoned ) { - if( c.ControlMaster == to || c.SummonMaster == to ) + if ( c.ControlMaster == to || c.SummonMaster == to ) return false; p = Party.Get( to ); - if( p != null && (p.Contains( c.ControlMaster ) || p.Contains( c.SummonMaster )) ) + if ( p != null && (p.Contains( c.ControlMaster ) || p.Contains( c.SummonMaster )) ) return false; } } - if( to is BaseCreature && !((BaseCreature)to).Controlled && ((BaseCreature)to).InitialInnocent ) + if ( to is BaseCreature && !((BaseCreature)to).Controlled && ((BaseCreature)to).InitialInnocent ) return true; int noto = Notoriety.Compute( from, to ); @@ -455,15 +455,15 @@ namespace Server.Spells { Map map = caster.Map; - if( map == null ) + if ( map == null ) return; double scale = 1.0 + ((caster.Skills[SkillName.Magery].Value - 100.0) / 200.0); - if( scaleDuration ) + if ( scaleDuration ) duration = TimeSpan.FromSeconds( duration.TotalSeconds * scale ); - if( scaleStats ) + if ( scaleStats ) { creature.RawStr = (int)(creature.RawStr * scale); creature.Hits = creature.HitsMax; @@ -477,7 +477,7 @@ namespace Server.Spells Point3D p = new Point3D( caster ); - if( SpellHelper.FindValidSpawnLocation( map, ref p, true ) ) + if ( SpellHelper.FindValidSpawnLocation( map, ref p, true ) ) { BaseCreature.Summon( creature, caster, p, sound, duration ); return; @@ -492,7 +492,7 @@ namespace Server.Spells int x = caster.X + m_Offsets[(offset + i) % m_Offsets.Length]; int y = caster.Y + m_Offsets[(offset + i + 1) % m_Offsets.Length]; - if( map.CanSpawnMobile( x, y, caster.Z ) ) + if ( map.CanSpawnMobile( x, y, caster.Z ) ) { BaseCreature.Summon( creature, caster, new Point3D( x, y, caster.Z ), sound, duration ); return; @@ -501,7 +501,7 @@ namespace Server.Spells { int z = map.GetAverageZ( x, y ); - if( map.CanSpawnMobile( x, y, z ) ) + if ( map.CanSpawnMobile( x, y, z ) ) { BaseCreature.Summon( creature, caster, new Point3D( x, y, z ), sound, duration ); return; @@ -516,12 +516,12 @@ namespace Server.Spells public static bool FindValidSpawnLocation( Map map, ref Point3D p, bool surroundingsOnly ) { - if( map == null ) //sanity + if ( map == null ) //sanity return false; - if( !surroundingsOnly ) + if ( !surroundingsOnly ) { - if( map.CanSpawnMobile( p ) ) //p's fine. + if ( map.CanSpawnMobile( p ) ) //p's fine. { p = new Point3D( p ); return true; @@ -529,7 +529,7 @@ namespace Server.Spells int z = map.GetAverageZ( p.X, p.Y ); - if( map.CanSpawnMobile( p.X, p.Y, z ) ) + if ( map.CanSpawnMobile( p.X, p.Y, z ) ) { p = new Point3D( p.X, p.Y, z ); return true; @@ -543,7 +543,7 @@ namespace Server.Spells int x = p.X + m_Offsets[(offset + i) % m_Offsets.Length]; int y = p.Y + m_Offsets[(offset + i + 1) % m_Offsets.Length]; - if( map.CanSpawnMobile( x, y, p.Z ) ) + if ( map.CanSpawnMobile( x, y, p.Z ) ) { p = new Point3D( x, y, p.Z ); return true; @@ -552,7 +552,7 @@ namespace Server.Spells { int z = map.GetAverageZ( x, y ); - if( map.CanSpawnMobile( x, y, z ) ) + if ( map.CanSpawnMobile( x, y, z ) ) { p = new Point3D( x, y, z ); return true; @@ -602,9 +602,9 @@ namespace Server.Spells public static void SendInvalidMessage( Mobile caster, TravelCheckType type ) { - if( type == TravelCheckType.RecallTo || type == TravelCheckType.GateTo ) + if ( type == TravelCheckType.RecallTo || type == TravelCheckType.GateTo ) caster.SendLocalizedMessage( 1019004 ); // You are not allowed to travel there. - else if( type == TravelCheckType.TeleportTo ) + else if ( type == TravelCheckType.TeleportTo ) caster.SendLocalizedMessage( 501035 ); // You cannot teleport from here to the destination. else caster.SendLocalizedMessage( 501802 ); // Thy spell doth not appear to work... @@ -625,15 +625,15 @@ namespace Server.Spells public static bool CheckTravel( Mobile caster, Map map, Point3D loc, TravelCheckType type ) { - if( IsInvalid( map, loc ) ) // null, internal, out of bounds + if ( IsInvalid( map, loc ) ) // null, internal, out of bounds { - if( caster != null ) + if ( caster != null ) SendInvalidMessage( caster, type ); return false; } - if( caster != null && caster.AccessLevel == AccessLevel.Player && caster.Region.IsPartOf( typeof( Regions.Jail ) ) ) + if ( caster != null && caster.AccessLevel == AccessLevel.Player && caster.Region.IsPartOf( typeof( Regions.Jail ) ) ) { caster.SendLocalizedMessage( 1114345 ); // You'll need a better jailbreak plan than that! return false; @@ -657,7 +657,7 @@ namespace Server.Spells for( int i = 0; isValid && i < m_Validators.Length; ++i ) isValid = (m_Rules[v, i] || !m_Validators[i]( map, loc )); - if( !isValid && caster != null ) + if ( !isValid && caster != null ) SendInvalidMessage( caster, type ); return isValid; @@ -729,7 +729,7 @@ namespace Server.Spells public static bool IsCrystalCave( Map map, Point3D loc ) { - if( map != Map.Malas || loc.Z >= -80 ) + if ( map != Map.Malas || loc.Z >= -80 ) return false; int x = loc.X, y = loc.Y; @@ -779,15 +779,15 @@ namespace Server.Spells public static bool IsDoomFerry( Map map, Point3D loc ) { - if( map != Map.Malas ) + if ( map != Map.Malas ) return false; int x = loc.X, y = loc.Y; - if( x >= 426 && y >= 314 && x <= 430 && y <= 331 ) + if ( x >= 426 && y >= 314 && x <= 430 && y <= 331 ) return true; - if( x >= 406 && y >= 247 && x <= 410 && y <= 264 ) + if ( x >= 406 && y >= 247 && x <= 410 && y <= 264 ) return true; return false; @@ -796,7 +796,7 @@ namespace Server.Spells public static bool IsTokunoDungeon( Map map, Point3D loc ) { //The tokuno dungeons are really inside malas - if( map != Map.Malas ) + if ( map != Map.Malas ) return false; int x = loc.X, y = loc.Y, z = loc.Z; @@ -809,7 +809,7 @@ namespace Server.Spells public static bool IsDoomGauntlet( Map map, Point3D loc ) { - if( map != Map.Malas ) + if ( map != Map.Malas ) return false; int x = loc.X - 256, y = loc.Y - 304; @@ -851,7 +851,7 @@ namespace Server.Spells public static bool IsInvalid( Map map, Point3D loc ) { - if( map == null || map == Map.Internal ) + if ( map == null || map == Map.Internal ) return true; int x = loc.X, y = loc.Y; @@ -862,7 +862,7 @@ namespace Server.Spells //towns public static bool IsTown( IPoint3D loc, Mobile caster ) { - if( loc is Item ) + if ( loc is Item ) loc = ((Item)loc).GetWorldLocation(); return IsTown( new Point3D( loc ), caster ); @@ -872,7 +872,7 @@ namespace Server.Spells { Map map = caster.Map; - if( map == null ) + if ( map == null ) return false; #region Dueling @@ -894,7 +894,7 @@ namespace Server.Spells public static bool CheckTown( IPoint3D loc, Mobile caster ) { - if( loc is Item ) + if ( loc is Item ) loc = ((Item)loc).GetWorldLocation(); return CheckTown( new Point3D( loc ), caster ); @@ -902,7 +902,7 @@ namespace Server.Spells public static bool CheckTown( Point3D loc, Mobile caster ) { - if( IsTown( loc, caster ) ) + if ( IsTown( loc, caster ) ) { caster.SendLocalizedMessage( 500946 ); // You cannot cast this in town! return false; @@ -919,7 +919,7 @@ namespace Server.Spells public static void CheckReflect( int circle, ref Mobile caster, ref Mobile target ) { - if( target.MagicDamageAbsorb > 0 ) + if ( target.MagicDamageAbsorb > 0 ) { ++circle; @@ -929,16 +929,16 @@ namespace Server.Spells bool reflect = (target.MagicDamageAbsorb >= 0); - if( target is BaseCreature ) + if ( target is BaseCreature ) ((BaseCreature)target).CheckReflect( caster, ref reflect ); - if( target.MagicDamageAbsorb <= 0 ) + if ( target.MagicDamageAbsorb <= 0 ) { target.MagicDamageAbsorb = 0; DefensiveSpell.Nullify( target ); } - if( reflect ) + if ( reflect ) { target.FixedEffect( 0x37B9, 10, 5 ); @@ -947,13 +947,13 @@ namespace Server.Spells target = temp; } } - else if( target is BaseCreature ) + else if ( target is BaseCreature ) { bool reflect = false; ((BaseCreature)target).CheckReflect( caster, ref reflect ); - if( reflect ) + if ( reflect ) { target.FixedEffect( 0x37B9, 10, 5 ); @@ -985,12 +985,12 @@ namespace Server.Spells { int iDamage = (int)damage; - if( delay == TimeSpan.Zero ) + if ( delay == TimeSpan.Zero ) { - if( from is BaseCreature ) + if ( from is BaseCreature ) ((BaseCreature)from).AlterSpellDamageTo( target, ref iDamage ); - if( target is BaseCreature ) + if ( target is BaseCreature ) ((BaseCreature)target).AlterSpellDamageFrom( from, ref iDamage ); target.Damage( iDamage, from ); @@ -1000,7 +1000,7 @@ namespace Server.Spells new SpellDamageTimer( spell, target, from, iDamage, delay ).Start(); } - if( target is BaseCreature && from != null && delay == TimeSpan.Zero ) + if ( target is BaseCreature && from != null && delay == TimeSpan.Zero ) { BaseCreature c = (BaseCreature) target; @@ -1042,12 +1042,12 @@ namespace Server.Spells { int iDamage = (int)damage; - if( delay == TimeSpan.Zero ) + if ( delay == TimeSpan.Zero ) { - if( from is BaseCreature ) + if ( from is BaseCreature ) ((BaseCreature)from).AlterSpellDamageTo( target, ref iDamage ); - if( target is BaseCreature ) + if ( target is BaseCreature ) ((BaseCreature)target).AlterSpellDamageFrom( from, ref iDamage ); WeightOverloading.DFA = dfa; @@ -1066,7 +1066,7 @@ namespace Server.Spells new SpellDamageTimerAOS( spell, target, from, iDamage, phys, fire, cold, pois, nrgy, delay, dfa ).Start(); } - if( target is BaseCreature && from != null && delay == TimeSpan.Zero ) + if ( target is BaseCreature && from != null && delay == TimeSpan.Zero ) { BaseCreature c = (BaseCreature) target; @@ -1123,7 +1123,7 @@ namespace Server.Spells m_Damage = damage; m_Spell = s; - if( m_Spell != null && m_Spell.DelayedDamage && !m_Spell.DelayedDamageStacking ) + if ( m_Spell != null && m_Spell.DelayedDamage && !m_Spell.DelayedDamageStacking ) m_Spell.StartDelayedDamageContext( target, this ); Priority = TimerPriority.TwentyFiveMS; @@ -1131,14 +1131,14 @@ namespace Server.Spells protected override void OnTick() { - if( m_From is BaseCreature ) + if ( m_From is BaseCreature ) ((BaseCreature)m_From).AlterSpellDamageTo( m_Target, ref m_Damage ); - if( m_Target is BaseCreature ) + if ( m_Target is BaseCreature ) ((BaseCreature)m_Target).AlterSpellDamageFrom( m_From, ref m_Damage ); m_Target.Damage( m_Damage ); - if( m_Spell != null ) + if ( m_Spell != null ) m_Spell.RemoveDelayedDamageContext( m_Target ); } } @@ -1164,7 +1164,7 @@ namespace Server.Spells m_Nrgy = nrgy; m_DFA = dfa; m_Spell = s; - if( m_Spell != null && m_Spell.DelayedDamage && !m_Spell.DelayedDamageStacking ) + if ( m_Spell != null && m_Spell.DelayedDamage && !m_Spell.DelayedDamageStacking ) m_Spell.StartDelayedDamageContext( target, this ); Priority = TimerPriority.TwentyFiveMS; @@ -1172,10 +1172,10 @@ namespace Server.Spells protected override void OnTick() { - if( m_From is BaseCreature && m_Target != null ) + if ( m_From is BaseCreature && m_Target != null ) ((BaseCreature)m_From).AlterSpellDamageTo( m_Target, ref m_Damage ); - if( m_Target is BaseCreature && m_From != null ) + if ( m_Target is BaseCreature && m_From != null ) ((BaseCreature)m_Target).AlterSpellDamageFrom( m_From, ref m_Damage ); WeightOverloading.DFA = m_DFA; @@ -1189,7 +1189,7 @@ namespace Server.Spells WeightOverloading.DFA = DFAlgorithm.Standard; - if( m_Target is BaseCreature && m_From != null ) + if ( m_Target is BaseCreature && m_From != null ) { BaseCreature c = (BaseCreature) m_Target; @@ -1197,7 +1197,7 @@ namespace Server.Spells c.OnDamagedBySpell( m_From ); } - if( m_Spell != null ) + if ( m_Spell != null ) m_Spell.RemoveDelayedDamageContext( m_Target ); } @@ -1218,13 +1218,13 @@ namespace Server.Spells { TransformContext context = GetContext( m ); - if( context != null ) + if ( context != null ) RemoveContext( m, context, resetGraphics ); } public static void RemoveContext( Mobile m, TransformContext context, bool resetGraphics ) { - if( m_Table.ContainsKey( m ) ) + if ( m_Table.ContainsKey( m ) ) { m_Table.Remove( m ); @@ -1233,7 +1233,7 @@ namespace Server.Spells for( int i = 0; i < mods.Count; ++i ) m.RemoveResistanceMod( mods[i] ); - if( resetGraphics ) + if ( resetGraphics ) { m.HueMod = -1; m.BodyMod = 0; @@ -1266,17 +1266,17 @@ namespace Server.Spells public static bool CheckCast( Mobile caster, Spell spell ) { - if( Factions.Sigil.ExistsOn( caster ) ) + if ( Factions.Sigil.ExistsOn( caster ) ) { caster.SendLocalizedMessage( 1061632 ); // You can't do that while carrying the sigil. return false; } - else if( !caster.CanBeginAction( typeof( PolymorphSpell ) ) ) + else if ( !caster.CanBeginAction( typeof( PolymorphSpell ) ) ) { caster.SendLocalizedMessage( 1061628 ); // You can't do that while polymorphed. return false; } - else if( AnimalForm.UnderTransformation( caster ) ) + else if ( AnimalForm.UnderTransformation( caster ) ) { caster.SendLocalizedMessage( 1061091 ); // You cannot cast that spell in this form. return false; @@ -1289,14 +1289,14 @@ namespace Server.Spells { ITransformationSpell transformSpell = spell as ITransformationSpell; - if( transformSpell == null ) + if ( transformSpell == null ) return false; - if( Factions.Sigil.ExistsOn( caster ) ) + if ( Factions.Sigil.ExistsOn( caster ) ) { caster.SendLocalizedMessage( 1061632 ); // You can't do that while carrying the sigil. } - else if( !caster.CanBeginAction( typeof( PolymorphSpell ) ) ) + else if ( !caster.CanBeginAction( typeof( PolymorphSpell ) ) ) { caster.SendLocalizedMessage( 1061628 ); // You can't do that while polymorphed. } @@ -1305,15 +1305,15 @@ namespace Server.Spells caster.SendLocalizedMessage( 1061631 ); // You can't do that while disguised. return false; } - else if( AnimalForm.UnderTransformation( caster ) ) + else if ( AnimalForm.UnderTransformation( caster ) ) { caster.SendLocalizedMessage( 1061091 ); // You cannot cast that spell in this form. } - else if( !caster.CanBeginAction( typeof( IncognitoSpell ) ) || (caster.IsBodyMod && GetContext( caster ) == null) ) + else if ( !caster.CanBeginAction( typeof( IncognitoSpell ) ) || (caster.IsBodyMod && GetContext( caster ) == null) ) { spell.DoFizzle(); } - else if( spell.CheckSequence() ) + else if ( spell.CheckSequence() ) { TransformContext context = GetContext( caster ); Type ourType = spell.GetType(); @@ -1321,41 +1321,41 @@ namespace Server.Spells bool wasTransformed = (context != null); bool ourTransform = (wasTransformed && context.Type == ourType); - if( wasTransformed ) + if ( wasTransformed ) { RemoveContext( caster, context, ourTransform ); - if( ourTransform ) + if ( ourTransform ) { caster.PlaySound( 0xFA ); caster.FixedParticles( 0x3728, 1, 13, 5042, EffectLayer.Waist ); } } - if( !ourTransform ) + if ( !ourTransform ) { List mods = new List(); - if( transformSpell.PhysResistOffset != 0 ) + if ( transformSpell.PhysResistOffset != 0 ) mods.Add( new ResistanceMod( ResistanceType.Physical, transformSpell.PhysResistOffset ) ); - if( transformSpell.FireResistOffset != 0 ) + if ( transformSpell.FireResistOffset != 0 ) mods.Add( new ResistanceMod( ResistanceType.Fire, transformSpell.FireResistOffset ) ); - if( transformSpell.ColdResistOffset != 0 ) + if ( transformSpell.ColdResistOffset != 0 ) mods.Add( new ResistanceMod( ResistanceType.Cold, transformSpell.ColdResistOffset ) ); - if( transformSpell.PoisResistOffset != 0 ) + if ( transformSpell.PoisResistOffset != 0 ) mods.Add( new ResistanceMod( ResistanceType.Poison, transformSpell.PoisResistOffset ) ); - if( transformSpell.NrgyResistOffset != 0 ) + if ( transformSpell.NrgyResistOffset != 0 ) mods.Add( new ResistanceMod( ResistanceType.Energy, transformSpell.NrgyResistOffset ) ); - if( !((Body)transformSpell.Body).IsHuman ) + if ( !((Body)transformSpell.Body).IsHuman ) { Mobiles.IMount mt = caster.Mount; - if( mt != null ) + if ( mt != null ) mt.Rider = null; } @@ -1435,7 +1435,7 @@ namespace Server.Spells protected override void OnTick() { - if( m_Mobile.Deleted || !m_Mobile.Alive || m_Mobile.Body != m_Spell.Body || m_Mobile.Hue != m_Spell.Hue ) + if ( m_Mobile.Deleted || !m_Mobile.Alive || m_Mobile.Body != m_Spell.Body || m_Mobile.Hue != m_Spell.Hue ) { TransformationSpellHelper.RemoveContext( m_Mobile, true ); Stop(); diff --git a/Scripts/Spells/Base/SpellRegistry.cs b/Scripts/Spells/Base/SpellRegistry.cs index 6e1520283..0c36e820b 100644 --- a/Scripts/Spells/Base/SpellRegistry.cs +++ b/Scripts/Spells/Base/SpellRegistry.cs @@ -58,7 +58,7 @@ namespace Server.Spells public static int GetRegistryNumber( Type type ) { - if( m_IDsFromTypes.ContainsKey( type ) ) + if ( m_IDsFromTypes.ContainsKey( type ) ) return m_IDsFromTypes[type]; return -1; @@ -74,10 +74,10 @@ namespace Server.Spells m_Types[spellID] = type; - if( !m_IDsFromTypes.ContainsKey( type ) ) + if ( !m_IDsFromTypes.ContainsKey( type ) ) m_IDsFromTypes.Add( type, spellID ); - if( type.IsSubclassOf( typeof( SpecialMove ) ) ) + if ( type.IsSubclassOf( typeof( SpecialMove ) ) ) { SpecialMove spm = null; @@ -89,7 +89,7 @@ namespace Server.Spells { } - if( spm != null ) + if ( spm != null ) m_SpecialMoves.Add( spellID, spm ); } } @@ -116,7 +116,7 @@ namespace Server.Spells Type t = m_Types[spellID]; - if( t != null && !t.IsSubclassOf( typeof( SpecialMove ) ) ) + if ( t != null && !t.IsSubclassOf( typeof( SpecialMove ) ) ) { m_Params[0] = caster; m_Params[1] = scroll; diff --git a/Scripts/Spells/Bushido/Evasion.cs b/Scripts/Spells/Bushido/Evasion.cs index 2c4490256..b59e2ec3d 100644 --- a/Scripts/Spells/Bushido/Evasion.cs +++ b/Scripts/Spells/Bushido/Evasion.cs @@ -23,7 +23,7 @@ namespace Server.Spells.Bushido public override bool CheckCast() { - if( VerifyCast( Caster, true ) ) + if ( VerifyCast( Caster, true ) ) return base.CheckCast(); return false; @@ -31,12 +31,12 @@ namespace Server.Spells.Bushido public static bool VerifyCast( Mobile Caster, bool messages ) { - if( Caster == null ) // Sanity + if ( Caster == null ) // Sanity return false; BaseWeapon weap = Caster.FindItemOnLayer( Layer.OneHanded ) as BaseWeapon; - if( weap == null ) + if ( weap == null ) weap = Caster.FindItemOnLayer( Layer.TwoHanded ) as BaseWeapon; if ( weap != null ) { @@ -107,7 +107,7 @@ namespace Server.Spells.Bushido public override void OnCast() { - if( CheckSequence() ) + if ( CheckSequence() ) { Caster.SendLocalizedMessage( 1063120 ); // You feel that you might be able to deflect any attack! Caster.FixedParticles( 0x376A, 1, 20, 0x7F5, 0x960, 3, EffectLayer.Waist ); @@ -142,15 +142,15 @@ namespace Server.Spells.Bushido * o 6-7 seconds w/ GM+ Bushido and GM tactics/anatomy */ - if( !Core.ML ) + if ( !Core.ML ) return TimeSpan.FromSeconds( 8.0 ); double seconds = 3; - if( m.Skills.Bushido.Value > 60 ) + if ( m.Skills.Bushido.Value > 60 ) seconds += (m.Skills.Bushido.Value - 60) / 20; - if( m.Skills.Anatomy.Value >= 100.0 && m.Skills.Tactics.Value >= 100.0 && m.Skills.Bushido.Value > 100.0 ) //Bushido being HIGHER than 100 for bonus is intended + if ( m.Skills.Anatomy.Value >= 100.0 && m.Skills.Tactics.Value >= 100.0 && m.Skills.Bushido.Value > 100.0 ) //Bushido being HIGHER than 100 for bonus is intended seconds++; return TimeSpan.FromSeconds( (int)seconds ); @@ -167,15 +167,15 @@ namespace Server.Spells.Bushido * o 42-50% bonus w/ GM+ bushido and GM tactics/anatomy */ - if( !Core.ML ) + if ( !Core.ML ) return 1.5; double bonus = 0; - if( m.Skills.Bushido.Value >= 60 ) + if ( m.Skills.Bushido.Value >= 60 ) bonus += ( ( ( m.Skills.Bushido.Value - 60 ) * .004 ) + 0.16 ); - if( m.Skills.Anatomy.Value >= 100 && m.Skills.Tactics.Value >= 100 && m.Skills.Bushido.Value > 100 ) //Bushido being HIGHER than 100 for bonus is intended + if ( m.Skills.Anatomy.Value >= 100 && m.Skills.Tactics.Value >= 100 && m.Skills.Bushido.Value > 100 ) //Bushido being HIGHER than 100 for bonus is intended bonus += 0.10; return 1.0 + bonus; @@ -185,7 +185,7 @@ namespace Server.Spells.Bushido { Timer t = (Timer)m_Table[m]; - if( t != null ) + if ( t != null ) t.Stop(); t = new InternalTimer( m, GetEvadeDuration( m ) ); @@ -199,7 +199,7 @@ namespace Server.Spells.Bushido { Timer t = (Timer)m_Table[m]; - if( t != null ) + if ( t != null ) t.Stop(); m_Table.Remove( m ); diff --git a/Scripts/Spells/Chivalry/DispelEvil.cs b/Scripts/Spells/Chivalry/DispelEvil.cs index 2e6bc1b4b..7839b0305 100644 --- a/Scripts/Spells/Chivalry/DispelEvil.cs +++ b/Scripts/Spells/Chivalry/DispelEvil.cs @@ -96,7 +96,7 @@ namespace Server.Spells.Chivalry } TransformContext context = TransformationSpellHelper.GetContext( m ); - if( context != null && context.Spell is NecromancerSpell ) //Trees are not evil! TODO: OSI confirm? + if ( context != null && context.Spell is NecromancerSpell ) //Trees are not evil! TODO: OSI confirm? { // transformed .. diff --git a/Scripts/Spells/Chivalry/NobleSacrifice.cs b/Scripts/Spells/Chivalry/NobleSacrifice.cs index d1c46e601..b03df02e7 100644 --- a/Scripts/Spells/Chivalry/NobleSacrifice.cs +++ b/Scripts/Spells/Chivalry/NobleSacrifice.cs @@ -72,7 +72,7 @@ namespace Server.Spells.Chivalry { Caster.SendLocalizedMessage( 1010395 ); // The veil of death in this area is too strong and resists thy efforts to restore life. } - else if( resChance > Utility.RandomDouble() ) + else if ( resChance > Utility.RandomDouble() ) { m.FixedParticles( 0x375A, 1, 15, 5005, 5, 3, EffectLayer.Head ); m.CloseGump( typeof( ResurrectGump ) ); diff --git a/Scripts/Spells/Fifth/BladeSpirits.cs b/Scripts/Spells/Fifth/BladeSpirits.cs index 9565189d4..e19070c3a 100644 --- a/Scripts/Spells/Fifth/BladeSpirits.cs +++ b/Scripts/Spells/Fifth/BladeSpirits.cs @@ -36,7 +36,7 @@ namespace Server.Spells.Fifth if ( !base.CheckCast() ) return false; - if( (Caster.Followers + (Core.SE ? 2 : 1)) > Caster.FollowersMax ) + if ( (Caster.Followers + (Core.SE ? 2 : 1)) > Caster.FollowersMax ) { Caster.SendLocalizedMessage( 1049645 ); // You have too many followers to summon that creature. return false; diff --git a/Scripts/Spells/Fifth/Incognito.cs b/Scripts/Spells/Fifth/Incognito.cs index 91768970a..404f3b2d5 100644 --- a/Scripts/Spells/Fifth/Incognito.cs +++ b/Scripts/Spells/Fifth/Incognito.cs @@ -99,7 +99,7 @@ namespace Server.Spells.Fifth int timeVal = ((6 * Caster.Skills.Magery.Fixed) / 50) + 1; - if( timeVal > 144 ) + if ( timeVal > 144 ) timeVal = 144; TimeSpan length = TimeSpan.FromSeconds( timeVal ); diff --git a/Scripts/Spells/Fifth/Paralyze.cs b/Scripts/Spells/Fifth/Paralyze.cs index d16d80a4f..219b6667f 100644 --- a/Scripts/Spells/Fifth/Paralyze.cs +++ b/Scripts/Spells/Fifth/Paralyze.cs @@ -50,7 +50,7 @@ namespace Server.Spells.Fifth { int secs = (int)((GetDamageSkill( Caster ) / 10) - (GetResistSkill( m ) / 10)); - if( !Core.SE ) + if ( !Core.SE ) secs += 2; if ( !m.Player ) diff --git a/Scripts/Spells/First/Heal.cs b/Scripts/Spells/First/Heal.cs index 38a20c650..80a456bcd 100644 --- a/Scripts/Spells/First/Heal.cs +++ b/Scripts/Spells/First/Heal.cs @@ -72,7 +72,7 @@ namespace Server.Spells.First toHeal = Caster.Skills.Magery.Fixed / 120; toHeal += Utility.RandomMinMax( 1, 4 ); - if( Core.SE && Caster != m ) + if ( Core.SE && Caster != m ) toHeal = (int)(toHeal * 1.5); } else diff --git a/Scripts/Spells/Fourth/FireField.cs b/Scripts/Spells/Fourth/FireField.cs index de07048b7..1f6d5cda2 100644 --- a/Scripts/Spells/Fourth/FireField.cs +++ b/Scripts/Spells/Fourth/FireField.cs @@ -177,7 +177,7 @@ namespace Server.Spells.Fourth } } - if( version < 2 ) + if ( version < 2 ) m_Damage = 2; } diff --git a/Scripts/Spells/Fourth/Recall.cs b/Scripts/Spells/Fourth/Recall.cs index 7a955cf9c..1b6cf6e75 100644 --- a/Scripts/Spells/Fourth/Recall.cs +++ b/Scripts/Spells/Fourth/Recall.cs @@ -39,7 +39,7 @@ namespace Server.Spells.Fourth { if ( TransformationSpellHelper.UnderTransformation( Caster, typeof( WraithFormSpell ) ) ) min = max = 0; - else if( Core.SE && m_Book != null ) //recall using Runebook charge + else if ( Core.SE && m_Book != null ) //recall using Runebook charge min = max = 0; else base.GetCastSkills( out min, out max ); diff --git a/Scripts/Spells/Initializer.cs b/Scripts/Spells/Initializer.cs index e6ceda004..12f72d2da 100644 --- a/Scripts/Spells/Initializer.cs +++ b/Scripts/Spells/Initializer.cs @@ -107,7 +107,7 @@ namespace Server.Spells Register( 114, typeof( Necromancy.WitherSpell ) ); Register( 115, typeof( Necromancy.WraithFormSpell ) ); - if( Core.SE ) + if ( Core.SE ) Register( 116, typeof( Necromancy.ExorcismSpell ) ); // Paladin abilities diff --git a/Scripts/Spells/Necromancy/AnimateDeadSpell.cs b/Scripts/Spells/Necromancy/AnimateDeadSpell.cs index aa4f41dd5..4729df1c8 100644 --- a/Scripts/Spells/Necromancy/AnimateDeadSpell.cs +++ b/Scripts/Spells/Necromancy/AnimateDeadSpell.cs @@ -185,7 +185,7 @@ namespace Server.Spells.Necromancy Corpse c = obj as Corpse; - if( c == null ) + if ( c == null ) { Caster.SendLocalizedMessage( 1061084 ); // You cannot animate that. } @@ -193,12 +193,12 @@ namespace Server.Spells.Necromancy { Type type = null; - if( c.Owner != null ) + if ( c.Owner != null ) { type = c.Owner.GetType(); } - if( c.ItemID != 0x2006 || c.Animated || type == typeof( PlayerMobile ) || type == null || ( c.Owner != null && c.Owner.Fame < 100 ) || ( ( c.Owner != null ) && ( c.Owner is BaseCreature ) && ( ( ( BaseCreature )c.Owner ).Summoned || ( ( BaseCreature )c.Owner ).IsBonded ) ) ) + if ( c.ItemID != 0x2006 || c.Animated || type == typeof( PlayerMobile ) || type == null || ( c.Owner != null && c.Owner.Fame < 100 ) || ( ( c.Owner != null ) && ( c.Owner is BaseCreature ) && ( ( ( BaseCreature )c.Owner ).Summoned || ( ( BaseCreature )c.Owner ).IsBonded ) ) ) { Caster.SendLocalizedMessage( 1061085 ); // There's not enough life force there to animate. } @@ -206,18 +206,18 @@ namespace Server.Spells.Necromancy { CreatureGroup group = FindGroup( type ); - if( group != null ) + if ( group != null ) { - if( group.m_Entries.Length == 0 || type == typeof( DemonKnight ) ) + if ( group.m_Entries.Length == 0 || type == typeof( DemonKnight ) ) { Caster.SendLocalizedMessage( 1061086 ); // You cannot animate undead remains. } - else if( CheckSequence() ) + else if ( CheckSequence() ) { Point3D p = c.GetWorldLocation(); Map map = c.Map; - if( map != null ) + if ( map != null ) { Effects.PlaySound( p, map, 0x1FB ); Effects.SendLocationParticles( EffectItem.Create( p, map, EffectItem.DefaultDuration ), 0x3789, 1, 40, 0x3F, 3, 9907, 0 ); diff --git a/Scripts/Spells/Necromancy/BloodOathSpell.cs b/Scripts/Spells/Necromancy/BloodOathSpell.cs index 76da6dfbd..03db64204 100644 --- a/Scripts/Spells/Necromancy/BloodOathSpell.cs +++ b/Scripts/Spells/Necromancy/BloodOathSpell.cs @@ -143,13 +143,13 @@ namespace Server.Spells.Necromancy } public void DoExpire() { - if( m_OathTable.Contains( m_Caster ) ) + if ( m_OathTable.Contains( m_Caster ) ) { m_Caster.SendLocalizedMessage( 1061620 ); // Your Blood Oath has been broken. m_OathTable.Remove ( m_Caster ); } - if( m_OathTable.Contains( m_Target ) ) + if ( m_OathTable.Contains( m_Target ) ) { m_Target.SendLocalizedMessage( 1061620 ); // Your Blood Oath has been broken. m_OathTable.Remove ( m_Target ); diff --git a/Scripts/Spells/Necromancy/Exorcism.cs b/Scripts/Spells/Necromancy/Exorcism.cs index 224552d7f..e96c03df4 100644 --- a/Scripts/Spells/Necromancy/Exorcism.cs +++ b/Scripts/Spells/Necromancy/Exorcism.cs @@ -31,7 +31,7 @@ namespace Server.Spells.Necromancy public override bool CheckCast() { - if( Caster.Skills.SpiritSpeak.Value < 100.0 ) + if ( Caster.Skills.SpiritSpeak.Value < 100.0 ) { Caster.SendLocalizedMessage( 1072112 ); // You must have GM Spirit Speak to use this spell return false; @@ -54,20 +54,20 @@ namespace Server.Spells.Necromancy { ChampionSpawnRegion r = Caster.Region.GetRegion( typeof( ChampionSpawnRegion ) ) as ChampionSpawnRegion; - if( r == null || !Caster.InRange( r.ChampionSpawn, Range ) ) + if ( r == null || !Caster.InRange( r.ChampionSpawn, Range ) ) { Caster.SendLocalizedMessage( 1072111 ); // You are not in a valid exorcism region. } - else if( CheckSequence() ) + else if ( CheckSequence() ) { Map map = Caster.Map; - if( map != null ) + if ( map != null ) { List targets = new List(); foreach( Mobile m in r.ChampionSpawn.GetMobilesInRange( Range ) ) - if( IsValidTarget( m ) ) + if ( IsValidTarget( m ) ) targets.Add( m ); for( int i = 0; i < targets.Count; ++i ) @@ -86,18 +86,18 @@ namespace Server.Spells.Necromancy private bool IsValidTarget( Mobile m ) { - if( !m.Player || m.Alive ) + if ( !m.Player || m.Alive ) return false; Corpse c = m.Corpse as Corpse; Map map = m.Map; - if( c != null && !c.Deleted && map != null && c.Map == map ) + if ( c != null && !c.Deleted && map != null && c.Map == map ) { - if( SpellHelper.IsAnyT2A( map, c.Location ) && SpellHelper.IsAnyT2A( map, m.Location ) ) + if ( SpellHelper.IsAnyT2A( map, c.Location ) && SpellHelper.IsAnyT2A( map, m.Location ) ) return false; //Same Map, both in T2A, ie, same 'sub server'. - if( m.Region.IsPartOf( typeof( DungeonRegion ) ) == Region.Find( c.Location, map ).IsPartOf( typeof( DungeonRegion ) ) ) + if ( m.Region.IsPartOf( typeof( DungeonRegion ) ) == Region.Find( c.Location, map ).IsPartOf( typeof( DungeonRegion ) ) ) return false; //Same Map, both in Dungeon region OR They're both NOT in a dungeon region. //Just an approximation cause RunUO doens't divide up the world the same way OSI does ;p @@ -106,24 +106,24 @@ namespace Server.Spells.Necromancy Party p = Party.Get( m ); - if( p != null && p.Contains( Caster ) ) + if ( p != null && p.Contains( Caster ) ) return false; - if( m.Guild != null && Caster.Guild != null ) + if ( m.Guild != null && Caster.Guild != null ) { Guild mGuild = m.Guild as Guild; Guild cGuild = Caster.Guild as Guild; - if( mGuild.IsAlly( cGuild ) ) + if ( mGuild.IsAlly( cGuild ) ) return false; - if( mGuild == cGuild ) + if ( mGuild == cGuild ) return false; } Faction f = Faction.Find( m ); - if( Faction.Facet == m.Map && f != null && f == Faction.Find( Caster ) ) + if ( Faction.Facet == m.Map && f != null && f == Faction.Find( Caster ) ) return false; return true; @@ -136,13 +136,13 @@ namespace Server.Spells.Necromancy Point3D[] locList; - if( map == Map.Felucca || map == Map.Trammel ) + if ( map == Map.Felucca || map == Map.Trammel ) locList = m_BritanniaLocs; - else if( map == Map.Ilshenar ) + else if ( map == Map.Ilshenar ) locList = m_IllshLocs; - else if( map == Map.Tokuno ) + else if ( map == Map.Tokuno ) locList = m_TokunoLocs; - else if( map == Map.Malas ) + else if ( map == Map.Malas ) locList = m_MalasLocs; else locList = new Point3D[0]; @@ -155,7 +155,7 @@ namespace Server.Spells.Necromancy Point3D p = locList[i]; double dist = m.GetDistanceToSqrt( p ); - if( minDist > dist ) + if ( minDist > dist ) { closest = p; minDist = dist; diff --git a/Scripts/Spells/Necromancy/NecromancerSpell.cs b/Scripts/Spells/Necromancy/NecromancerSpell.cs index 91a5e15a6..92ff5bf6d 100644 --- a/Scripts/Spells/Necromancy/NecromancerSpell.cs +++ b/Scripts/Spells/Necromancy/NecromancerSpell.cs @@ -42,10 +42,10 @@ namespace Server.Spells.Necromancy public override bool ConsumeReagents() { - if( base.ConsumeReagents() ) + if ( base.ConsumeReagents() ) return true; - if( ArcaneGem.ConsumeCharges( Caster, 1 ) ) + if ( ArcaneGem.ConsumeCharges( Caster, 1 ) ) return true; return false; diff --git a/Scripts/Spells/Necromancy/PainSpike.cs b/Scripts/Spells/Necromancy/PainSpike.cs index 35bdf1f2e..cb95f6da3 100644 --- a/Scripts/Spells/Necromancy/PainSpike.cs +++ b/Scripts/Spells/Necromancy/PainSpike.cs @@ -57,12 +57,12 @@ namespace Server.Spells.Necromancy TimeSpan buffTime = TimeSpan.FromSeconds( 10.0 ); - if( m_Table.Contains( m ) ) + if ( m_Table.Contains( m ) ) { damage = Utility.RandomMinMax( 3, 7 ); Timer t = m_Table[m] as Timer; - if( t != null ) + if ( t != null ) { t.Delay += TimeSpan.FromSeconds( 2.0 ); diff --git a/Scripts/Spells/Necromancy/PoisonStrike.cs b/Scripts/Spells/Necromancy/PoisonStrike.cs index 30d6de652..99eeef414 100644 --- a/Scripts/Spells/Necromancy/PoisonStrike.cs +++ b/Scripts/Spells/Necromancy/PoisonStrike.cs @@ -35,7 +35,7 @@ namespace Server.Spells.Necromancy public void Target( Mobile m ) { - if( CheckHSequence( m ) ) + if ( CheckHSequence( m ) ) { SpellHelper.Turn( Caster, m ); @@ -60,7 +60,7 @@ namespace Server.Spells.Necromancy Map map = m.Map; - if( map != null ) + if ( map != null ) { List targets = new List(); @@ -68,8 +68,8 @@ namespace Server.Spells.Necromancy targets.Add( m ); foreach( Mobile targ in m.GetMobilesInRange( 2 ) ) - if(!(Caster is BaseCreature && targ is BaseCreature )) - if( ( targ != Caster && m != targ ) && ( SpellHelper.ValidIndirectTarget( Caster, targ ) && Caster.CanBeHarmful( targ, false) ) ) + if (!(Caster is BaseCreature && targ is BaseCreature )) + if ( ( targ != Caster && m != targ ) && ( SpellHelper.ValidIndirectTarget( Caster, targ ) && Caster.CanBeHarmful( targ, false) ) ) targets.Add( targ ); for( int i = 0; i < targets.Count; ++i ) @@ -77,9 +77,9 @@ namespace Server.Spells.Necromancy Mobile targ = targets[i]; int num; - if( targ.InRange( m.Location, 0 ) ) + if ( targ.InRange( m.Location, 0 ) ) num = 1; - else if( targ.InRange( m.Location, 1 ) ) + else if ( targ.InRange( m.Location, 1 ) ) num = 2; else num = 3; @@ -105,7 +105,7 @@ namespace Server.Spells.Necromancy protected override void OnTarget( Mobile from, object o ) { - if( o is Mobile ) + if ( o is Mobile ) m_Owner.Target( (Mobile)o ); } diff --git a/Scripts/Spells/Necromancy/TransformationSpell.cs b/Scripts/Spells/Necromancy/TransformationSpell.cs index e3072284e..ad54ff6b2 100644 --- a/Scripts/Spells/Necromancy/TransformationSpell.cs +++ b/Scripts/Spells/Necromancy/TransformationSpell.cs @@ -26,7 +26,7 @@ namespace Server.Spells.Necromancy public override bool CheckCast() { - if( !TransformationSpellHelper.CheckCast( Caster, this ) ) + if ( !TransformationSpellHelper.CheckCast( Caster, this ) ) return false; return base.CheckCast(); diff --git a/Scripts/Spells/Necromancy/Wither.cs b/Scripts/Spells/Necromancy/Wither.cs index 667f07ca1..2e1853bf6 100644 --- a/Scripts/Spells/Necromancy/Wither.cs +++ b/Scripts/Spells/Necromancy/Wither.cs @@ -31,7 +31,7 @@ namespace Server.Spells.Necromancy public override void OnCast() { - if( CheckSequence() ) + if ( CheckSequence() ) { /* Creates a withering frost around the Caster, * which deals Cold Damage to all valid targets in a radius of 5 tiles. @@ -39,7 +39,7 @@ namespace Server.Spells.Necromancy Map map = Caster.Map; - if( map != null ) + if ( map != null ) { List targets = new List(); @@ -48,7 +48,7 @@ namespace Server.Spells.Necromancy foreach( Mobile m in Caster.GetMobilesInRange( Core.ML ? 4 : 5 ) ) { - if( Caster != m && Caster.InLOS( m ) && ( isMonster || SpellHelper.ValidIndirectTarget( Caster, m ) ) && Caster.CanBeHarmful( m, false ) ) + if ( Caster != m && Caster.InLOS( m ) && ( isMonster || SpellHelper.ValidIndirectTarget( Caster, m ) ) && Caster.CanBeHarmful( m, false ) ) { if ( isMonster ) { @@ -88,7 +88,7 @@ namespace Server.Spells.Necromancy int sdiBonus = AosAttributes.GetValue( Caster, AosAttribute.SpellDamage ); // PvP spell damage increase cap of 15% from an item�s magic property in Publish 33(SE) - if( Core.SE && m.Player && Caster.Player && sdiBonus > 15 ) + if ( Core.SE && m.Player && Caster.Player && sdiBonus > 15 ) sdiBonus = 15; damage *= ( 100 + sdiBonus ); diff --git a/Scripts/Spells/Ninjitsu/AnimalForm.cs b/Scripts/Spells/Ninjitsu/AnimalForm.cs index 098e73816..56dc5f785 100644 --- a/Scripts/Spells/Ninjitsu/AnimalForm.cs +++ b/Scripts/Spells/Ninjitsu/AnimalForm.cs @@ -191,7 +191,7 @@ namespace Server.Spells.Ninjitsu } /* - if( !m.CheckSkill( SkillName.Ninjitsu, entry.ReqSkill, entry.ReqSkill + 37.5 ) ) + if ( !m.CheckSkill( SkillName.Ninjitsu, entry.ReqSkill, entry.ReqSkill + 37.5 ) ) return MorphResult.Fail; * * On OSI,it seems you can only gain starting at '0' using Animal form. @@ -472,7 +472,7 @@ namespace Server.Spells.Ninjitsu { m_Caster.SendLocalizedMessage(1060174, mana.ToString()); // You must have at least ~1_MANA_REQUIREMENT~ Mana to use this ability. } - else if( ( m_Caster is PlayerMobile ) && ( m_Caster as PlayerMobile ).MountBlockReason != BlockMountType.None ) + else if ( ( m_Caster is PlayerMobile ) && ( m_Caster as PlayerMobile ).MountBlockReason != BlockMountType.None ) { m_Caster.SendLocalizedMessage( 1063108 ); // You cannot use this ability right now. } diff --git a/Scripts/Spells/Ninjitsu/Backstab.cs b/Scripts/Spells/Ninjitsu/Backstab.cs index 0b30b8cbc..cafcb2daa 100644 --- a/Scripts/Spells/Ninjitsu/Backstab.cs +++ b/Scripts/Spells/Ninjitsu/Backstab.cs @@ -28,7 +28,7 @@ namespace Server.Spells.Ninjitsu public override bool Validate( Mobile from ) { - if( !from.Hidden || from.AllowedStealthSteps <= 0 ) + if ( !from.Hidden || from.AllowedStealthSteps <= 0 ) { from.SendLocalizedMessage( 1063087 ); // You must be in stealth mode to use this ability. return false; @@ -41,7 +41,7 @@ namespace Server.Spells.Ninjitsu { bool valid = Validate( attacker ) && CheckMana( attacker, true ); - if( valid ) + if ( valid ) { attacker.BeginAction( typeof( Stealth ) ); Timer.DelayCall( TimeSpan.FromSeconds( 5.0 ), delegate { attacker.EndAction( typeof( Stealth ) ); } ); diff --git a/Scripts/Spells/Ninjitsu/DeathStrike.cs b/Scripts/Spells/Ninjitsu/DeathStrike.cs index 67c12f0b4..f3454a21c 100644 --- a/Scripts/Spells/Ninjitsu/DeathStrike.cs +++ b/Scripts/Spells/Ninjitsu/DeathStrike.cs @@ -26,7 +26,7 @@ namespace Server.Spells.Ninjitsu public override void OnHit( Mobile attacker, Mobile defender, int damage ) { - if( !Validate( attacker ) || !CheckMana( attacker, true ) ) + if ( !Validate( attacker ) || !CheckMana( attacker, true ) ) return; ClearCurrentMove( attacker ); @@ -39,12 +39,12 @@ namespace Server.Spells.Ninjitsu if ( attacker.Weapon is BaseRanged ) isRanged = true; - if( ninjitsu < 100 ) //This formula is an approximation from OSI data. TODO: find correct formula + if ( ninjitsu < 100 ) //This formula is an approximation from OSI data. TODO: find correct formula chance = 30 + (ninjitsu - 85) * 2.2; else chance = 63 + (ninjitsu - 100) * 1.1; - if( (chance / 100) < Utility.RandomDouble() ) + if ( (chance / 100) < Utility.RandomDouble() ) { attacker.SendLocalizedMessage( 1070779 ); // You missed your opponent with a Death Strike. return; @@ -55,16 +55,16 @@ namespace Server.Spells.Ninjitsu int damageBonus = 0; - if( m_Table.Contains( defender ) ) + if ( m_Table.Contains( defender ) ) { defender.SendLocalizedMessage( 1063092 ); // Your opponent lands another Death Strike! info = (DeathStrikeInfo)m_Table[defender]; - if( info.m_Steps > 0 ) + if ( info.m_Steps > 0 ) damageBonus = attacker.Skills[SkillName.Ninjitsu].Fixed / 150; - if( info.m_Timer != null ) + if ( info.m_Timer != null ) info.m_Timer.Stop(); m_Table.Remove( defender ); @@ -112,10 +112,10 @@ namespace Server.Spells.Ninjitsu { DeathStrikeInfo info = m_Table[m] as DeathStrikeInfo; - if( info == null ) + if ( info == null ) return; - if( ++info.m_Steps >= 5 ) + if ( ++info.m_Steps >= 5 ) ProcessDeathStrike( m ); } @@ -125,7 +125,7 @@ namespace Server.Spells.Ninjitsu DeathStrikeInfo info = m_Table[defender] as DeathStrikeInfo; - if( info == null ) //sanity + if ( info == null ) //sanity return; int maxDamage, damage = 0; @@ -163,7 +163,7 @@ namespace Server.Spells.Ninjitsu else AOS.Damage( info.m_Target, info.m_Attacker, damage, true, 100, 0, 0, 0, 0, 0, 0, false, false, true ); // Damage is physical. - if( info.m_Timer != null ) + if ( info.m_Timer != null ) info.m_Timer.Stop(); m_Table.Remove( info.m_Target ); diff --git a/Scripts/Spells/Ninjitsu/KiAttack.cs b/Scripts/Spells/Ninjitsu/KiAttack.cs index 343cea606..bb76a8aab 100644 --- a/Scripts/Spells/Ninjitsu/KiAttack.cs +++ b/Scripts/Spells/Ninjitsu/KiAttack.cs @@ -37,11 +37,11 @@ namespace Server.Spells.Ninjitsu return false; } - if( Core.ML ) + if ( Core.ML ) { BaseRanged ranged = from.Weapon as BaseRanged; - if( ranged != null ) + if ( ranged != null ) { from.SendLocalizedMessage( 1075858 ); // You can only use this with melee attacks. return false; diff --git a/Scripts/Spells/Ninjitsu/MirrorImage.cs b/Scripts/Spells/Ninjitsu/MirrorImage.cs index 9d774c0bc..3874c1904 100644 --- a/Scripts/Spells/Ninjitsu/MirrorImage.cs +++ b/Scripts/Spells/Ninjitsu/MirrorImage.cs @@ -72,7 +72,7 @@ namespace Server.Spells.Ninjitsu Caster.SendLocalizedMessage( 1063133 ); // You cannot summon a mirror image because you have too many followers. return false; } - else if( TransformationSpellHelper.UnderTransformation( Caster, typeof( HorrificBeastSpell ) ) ) + else if ( TransformationSpellHelper.UnderTransformation( Caster, typeof( HorrificBeastSpell ) ) ) { Caster.SendLocalizedMessage( 1061091 ); // You cannot cast that spell in this form. return false; @@ -103,7 +103,7 @@ namespace Server.Spells.Ninjitsu { Caster.SendLocalizedMessage( 1063133 ); // You cannot summon a mirror image because you have too many followers. } - else if( TransformationSpellHelper.UnderTransformation( Caster, typeof( HorrificBeastSpell ) ) ) + else if ( TransformationSpellHelper.UnderTransformation( Caster, typeof( HorrificBeastSpell ) ) ) { Caster.SendLocalizedMessage( 1061091 ); // You cannot cast that spell in this form. } diff --git a/Scripts/Spells/Ninjitsu/SurpriseAttack.cs b/Scripts/Spells/Ninjitsu/SurpriseAttack.cs index 9ab3f11c5..908410ba5 100644 --- a/Scripts/Spells/Ninjitsu/SurpriseAttack.cs +++ b/Scripts/Spells/Ninjitsu/SurpriseAttack.cs @@ -21,7 +21,7 @@ namespace Server.Spells.Ninjitsu public override bool Validate( Mobile from ) { - if( !from.Hidden || from.AllowedStealthSteps <= 0 ) + if ( !from.Hidden || from.AllowedStealthSteps <= 0 ) { from.SendLocalizedMessage( 1063087 ); // You must be in stealth mode to use this ability. return false; @@ -34,7 +34,7 @@ namespace Server.Spells.Ninjitsu { bool valid = Validate( attacker ) && CheckMana( attacker, true ); - if( valid ) + if ( valid ) { attacker.BeginAction( typeof( Stealth ) ); Timer.DelayCall( TimeSpan.FromSeconds( 5.0 ), delegate { attacker.EndAction( typeof( Stealth ) ); } ); diff --git a/Scripts/Spells/Seventh/Polymorph.cs b/Scripts/Spells/Seventh/Polymorph.cs index 66260bca7..98b776129 100644 --- a/Scripts/Spells/Seventh/Polymorph.cs +++ b/Scripts/Spells/Seventh/Polymorph.cs @@ -45,7 +45,7 @@ namespace Server.Spells.Seventh Caster.SendLocalizedMessage( 1010521 ); // You cannot polymorph while you have a Town Sigil return false; } - else if( TransformationSpellHelper.UnderTransformation( Caster ) ) + else if ( TransformationSpellHelper.UnderTransformation( Caster ) ) { Caster.SendLocalizedMessage( 1061633 ); // You cannot polymorph while in that form. return false; @@ -62,7 +62,7 @@ namespace Server.Spells.Seventh } else if ( !Caster.CanBeginAction( typeof( PolymorphSpell ) ) ) { - if( Core.ML ) + if ( Core.ML ) EndPolymorph( Caster ); else Caster.SendLocalizedMessage( 1005559 ); // This spell is already in effect. @@ -96,12 +96,12 @@ namespace Server.Spells.Seventh } else if ( !Caster.CanBeginAction( typeof( PolymorphSpell ) ) ) { - if( Core.ML ) + if ( Core.ML ) EndPolymorph( Caster ); else Caster.SendLocalizedMessage( 1005559 ); // This spell is already in effect. } - else if( TransformationSpellHelper.UnderTransformation( Caster ) ) + else if ( TransformationSpellHelper.UnderTransformation( Caster ) ) { Caster.SendLocalizedMessage( 1061633 ); // You cannot polymorph while in that form. } @@ -141,7 +141,7 @@ namespace Server.Spells.Seventh BaseArmor.ValidateMobile( Caster ); BaseClothing.ValidateMobile( Caster ); - if( !Core.ML ) + if ( !Core.ML ) { StopTimer( Caster ); @@ -179,7 +179,7 @@ namespace Server.Spells.Seventh private static void EndPolymorph( Mobile m ) { - if( !m.CanBeginAction( typeof( PolymorphSpell ) ) ) + if ( !m.CanBeginAction( typeof( PolymorphSpell ) ) ) { m.BodyMod = 0; m.HueMod = -1; diff --git a/Scripts/Spells/Spellweaving/ArcaneCircle.cs b/Scripts/Spells/Spellweaving/ArcaneCircle.cs index 38fbb516a..a06ea53fc 100644 --- a/Scripts/Spells/Spellweaving/ArcaneCircle.cs +++ b/Scripts/Spells/Spellweaving/ArcaneCircle.cs @@ -24,7 +24,7 @@ namespace Server.Spells.Spellweaving public override bool CheckCast() { - if( !IsValidLocation( Caster.Location, Caster.Map ) ) + if ( !IsValidLocation( Caster.Location, Caster.Map ) ) { Caster.SendLocalizedMessage( 1072705 ); // You must be standing on an arcane circle, pentagram or abbatoir to use this spell. return false; @@ -41,7 +41,7 @@ namespace Server.Spells.Spellweaving public override void OnCast() { - if( CheckSequence() ) + if ( CheckSequence() ) { Caster.FixedParticles( 0x3779, 10, 20, 0x0, EffectLayer.Waist ); Caster.PlaySound( 0x5C0 ); @@ -68,7 +68,7 @@ namespace Server.Spells.Spellweaving { LandTile lt = map.Tiles.GetLandTile( location.X, location.Y ); // Land Tiles - if( IsValidTile( lt.ID ) && lt.Z == location.Z ) + if ( IsValidTile( lt.ID ) && lt.Z == location.Z ) return true; StaticTile[] tiles = map.Tiles.GetStaticTiles( location.X, location.Y ); // Static Tiles @@ -80,9 +80,9 @@ namespace Server.Spells.Spellweaving int tand = t.ID; - if( t.Z + id.CalcHeight != location.Z ) + if ( t.Z + id.CalcHeight != location.Z ) continue; - else if( IsValidTile( tand ) ) + else if ( IsValidTile( tand ) ) return true; } @@ -92,9 +92,9 @@ namespace Server.Spells.Spellweaving { ItemData id = item.ItemData; - if( item == null || item.Z + id.CalcHeight != location.Z ) + if ( item == null || item.Z + id.CalcHeight != location.Z ) continue; - else if( IsValidTile( item.ItemID ) ) + else if ( IsValidTile( item.ItemID ) ) { eable.Free(); return true; @@ -132,15 +132,15 @@ namespace Server.Spells.Spellweaving private void GiveArcaneFocus( Mobile to, TimeSpan duration, int strengthBonus ) { - if( to == null ) //Sanity + if ( to == null ) //Sanity return; ArcaneFocus focus = FindArcaneFocus( to ); - if( focus == null ) + if ( focus == null ) { ArcaneFocus f = new ArcaneFocus( duration, strengthBonus ); - if( to.PlaceInBackpack( f ) ) + if ( to.PlaceInBackpack( f ) ) { f.SendTimeRemainingMessage( to ); to.SendLocalizedMessage( 1072740 ); // An arcane focus appears in your backpack. diff --git a/Scripts/Spells/Spellweaving/ArcaneForm.cs b/Scripts/Spells/Spellweaving/ArcaneForm.cs index b3ba5c3a2..fc869c8e1 100644 --- a/Scripts/Spells/Spellweaving/ArcaneForm.cs +++ b/Scripts/Spells/Spellweaving/ArcaneForm.cs @@ -27,7 +27,7 @@ namespace Server.Spells.Spellweaving public override bool CheckCast() { - if( !TransformationSpellHelper.CheckCast( Caster, this ) ) + if ( !TransformationSpellHelper.CheckCast( Caster, this ) ) return false; return base.CheckCast(); diff --git a/Scripts/Spells/Spellweaving/ArcaneSummon.cs b/Scripts/Spells/Spellweaving/ArcaneSummon.cs index 9228c925e..378b513c2 100644 --- a/Scripts/Spells/Spellweaving/ArcaneSummon.cs +++ b/Scripts/Spells/Spellweaving/ArcaneSummon.cs @@ -15,10 +15,10 @@ namespace Server.Spells.Spellweaving public override bool CheckCast() { - if( !base.CheckCast() ) + if ( !base.CheckCast() ) return false; - if( (Caster.Followers + 1) > Caster.FollowersMax ) + if ( (Caster.Followers + 1) > Caster.FollowersMax ) { Caster.SendLocalizedMessage( 1074270 ); // You have too many followers to summon another one. return false; @@ -29,7 +29,7 @@ namespace Server.Spells.Spellweaving public override void OnCast() { - if( CheckSequence() ) + if ( CheckSequence() ) { TimeSpan duration = TimeSpan.FromMinutes( Caster.Skills.Spellweaving.Value /24 + FocusLevel*2 ); int summons = Math.Min( 1+FocusLevel, Caster.FollowersMax - Caster.Followers ); @@ -48,4 +48,4 @@ namespace Server.Spells.Spellweaving } } } -} \ No newline at end of file +} diff --git a/Scripts/Spells/Spellweaving/ArcanistSpell.cs b/Scripts/Spells/Spellweaving/ArcanistSpell.cs index 89bf203bf..fc4b910ee 100644 --- a/Scripts/Spells/Spellweaving/ArcanistSpell.cs +++ b/Scripts/Spells/Spellweaving/ArcanistSpell.cs @@ -32,7 +32,7 @@ namespace Server.Spells.Spellweaving { ArcaneFocus focus = FindArcaneFocus( from ); - if( focus == null || focus.Deleted ) + if ( focus == null || focus.Deleted ) return 0; return focus.StrengthBonus; @@ -40,7 +40,7 @@ namespace Server.Spells.Spellweaving public static ArcaneFocus FindArcaneFocus( Mobile from ) { - if( from == null || from.Backpack == null ) + if ( from == null || from.Backpack == null ) return null; if ( from.Holding is ArcaneFocus ) @@ -51,10 +51,10 @@ namespace Server.Spells.Spellweaving public static bool CheckExpansion( Mobile from ) { - if( !(from is PlayerMobile) ) + if ( !(from is PlayerMobile) ) return true; - if( from.NetState == null ) + if ( from.NetState == null ) return false; return from.NetState.SupportsExpansion( Expansion.ML ); @@ -62,7 +62,7 @@ namespace Server.Spells.Spellweaving public override bool CheckCast() { - if( !base.CheckCast() ) + if ( !base.CheckCast() ) return false; Mobile caster = Caster; @@ -126,7 +126,7 @@ namespace Server.Spells.Spellweaving { base.OnDisturb( type, message ); - if( message ) + if ( message ) Caster.PlaySound( 0x1D6 ); } @@ -147,10 +147,10 @@ namespace Server.Spells.Spellweaving { double percent = (50 + 2*(GetResistSkill( m ) - GetDamageSkill( Caster )))/100; //TODO: According to the guide this is it.. but.. is it correct per OSI? - if( percent <= 0 ) + if ( percent <= 0 ) return false; - if( percent >= 1.0 ) + if ( percent >= 1.0 ) return true; return (percent >= Utility.RandomDouble()); diff --git a/Scripts/Spells/Spellweaving/AttuneWeapon.cs b/Scripts/Spells/Spellweaving/AttuneWeapon.cs index 16acb1f58..95d8dcaa3 100644 --- a/Scripts/Spells/Spellweaving/AttuneWeapon.cs +++ b/Scripts/Spells/Spellweaving/AttuneWeapon.cs @@ -23,12 +23,12 @@ namespace Server.Spells.Spellweaving public override bool CheckCast() { - if( m_Table.ContainsKey( Caster ) ) + if ( m_Table.ContainsKey( Caster ) ) { Caster.SendLocalizedMessage( 501775 ); // This spell is already in effect. return false; } - else if( !Caster.CanBeginAction( typeof( AttuneWeaponSpell ) ) ) + else if ( !Caster.CanBeginAction( typeof( AttuneWeaponSpell ) ) ) { Caster.SendLocalizedMessage( 1075124 ); // You must wait before casting that spell again. return false; @@ -39,7 +39,7 @@ namespace Server.Spells.Spellweaving public override void OnCast() { - if( CheckSequence() ) + if ( CheckSequence() ) { Caster.PlaySound( 0x5C3 ); Caster.FixedParticles( 0x3728, 1, 13, 0x26B8, 0x455, 7, EffectLayer.Waist ); @@ -69,7 +69,7 @@ namespace Server.Spells.Spellweaving public static void TryAbsorb( Mobile defender, ref int damage ) { - if( damage == 0 || !IsAbsorbing( defender ) || defender.MeleeDamageAbsorb <= 0 ) + if ( damage == 0 || !IsAbsorbing( defender ) || defender.MeleeDamageAbsorb <= 0 ) return; int absorbed = Math.Min( damage, defender.MeleeDamageAbsorb ); @@ -79,7 +79,7 @@ namespace Server.Spells.Spellweaving defender.SendLocalizedMessage( 1075127, String.Format( "{0}\t{1}", absorbed, defender.MeleeDamageAbsorb ) ); // ~1_damage~ point(s) of damage have been absorbed. A total of ~2_remaining~ point(s) of shielding remain. - if( defender.MeleeDamageAbsorb <= 0 ) + if ( defender.MeleeDamageAbsorb <= 0 ) StopAbsorbing( defender, true ); } @@ -117,7 +117,7 @@ namespace Server.Spells.Spellweaving m_Mobile.MeleeDamageAbsorb = 0; - if( message ) + if ( message ) { m_Mobile.SendLocalizedMessage( 1075126 ); // Your attunement fades. m_Mobile.PlaySound( 0x1F8 ); diff --git a/Scripts/Spells/Spellweaving/EssenceOfWind.cs b/Scripts/Spells/Spellweaving/EssenceOfWind.cs index 304a60393..616c126d7 100644 --- a/Scripts/Spells/Spellweaving/EssenceOfWind.cs +++ b/Scripts/Spells/Spellweaving/EssenceOfWind.cs @@ -19,7 +19,7 @@ namespace Server.Spells.Spellweaving public override void OnCast() { - if( CheckSequence() ) + if ( CheckSequence() ) { Caster.PlaySound( 0x5C6 ); @@ -37,7 +37,7 @@ namespace Server.Spells.Spellweaving foreach( Mobile m in Caster.GetMobilesInRange( range ) ) { - if( Caster != m && Caster.InLOS( m ) && SpellHelper.ValidIndirectTarget( Caster, m ) && Caster.CanBeHarmful( m, false ) ) + if ( Caster != m && Caster.InLOS( m ) && SpellHelper.ValidIndirectTarget( Caster, m ) && Caster.CanBeHarmful( m, false ) ) targets.Add( m ); } @@ -49,7 +49,7 @@ namespace Server.Spells.Spellweaving SpellHelper.Damage( this, m, damage, 0, 0, 100, 0, 0 ); - if( !CheckResisted( m ) ) //No message on resist + if ( !CheckResisted( m ) ) //No message on resist { m_Table[m] = new EssenceOfWindInfo( m, fcMalus, ssiMalus, duration ); @@ -131,7 +131,7 @@ namespace Server.Spells.Spellweaving { Stop(); /* - if( message ) + if ( message ) { } */ diff --git a/Scripts/Spells/Spellweaving/EtherealVoyage.cs b/Scripts/Spells/Spellweaving/EtherealVoyage.cs index 1ac0b18a1..d96594e01 100644 --- a/Scripts/Spells/Spellweaving/EtherealVoyage.cs +++ b/Scripts/Spells/Spellweaving/EtherealVoyage.cs @@ -26,7 +26,7 @@ namespace Server.Spells.Spellweaving { EventSink.AggressiveAction += new AggressiveActionEventHandler( delegate( AggressiveActionEventArgs e ) { - if( TransformationSpellHelper.UnderTransformation( e.Aggressor, typeof( EtherealVoyageSpell ) ) ) + if ( TransformationSpellHelper.UnderTransformation( e.Aggressor, typeof( EtherealVoyageSpell ) ) ) { TransformationSpellHelper.RemoveContext( e.Aggressor, true ); } @@ -35,15 +35,15 @@ namespace Server.Spells.Spellweaving public override bool CheckCast() { - if( TransformationSpellHelper.UnderTransformation( Caster, typeof( EtherealVoyageSpell ) ) ) + if ( TransformationSpellHelper.UnderTransformation( Caster, typeof( EtherealVoyageSpell ) ) ) { Caster.SendLocalizedMessage( 501775 ); // This spell is already in effect. } - else if( !Caster.CanBeginAction( typeof( EtherealVoyageSpell ) ) ) + else if ( !Caster.CanBeginAction( typeof( EtherealVoyageSpell ) ) ) { Caster.SendLocalizedMessage( 1075124 ); // You must wait before casting that spell again. } - else if( Caster.Combatant != null ) + else if ( Caster.Combatant != null ) { Caster.SendLocalizedMessage( 1072586 ); // You cannot cast Ethereal Voyage while you are in combat. } diff --git a/Scripts/Spells/Spellweaving/GiftOfLife.cs b/Scripts/Spells/Spellweaving/GiftOfLife.cs index 3302c3314..eeefa3597 100644 --- a/Scripts/Spells/Spellweaving/GiftOfLife.cs +++ b/Scripts/Spells/Spellweaving/GiftOfLife.cs @@ -41,25 +41,25 @@ namespace Server.Spells.Spellweaving { BaseCreature bc = m as BaseCreature; - if( !Caster.CanSee( m ) ) + if ( !Caster.CanSee( m ) ) { Caster.SendLocalizedMessage( 500237 ); // Target can not be seen. } - else if( m.IsDeadBondedPet || !m.Alive ) + else if ( m.IsDeadBondedPet || !m.Alive ) { // As per Osi: Nothing happens. } - else if( m != Caster && (bc == null || !bc.IsBonded || bc.ControlMaster != Caster) ) + else if ( m != Caster && (bc == null || !bc.IsBonded || bc.ControlMaster != Caster) ) { Caster.SendLocalizedMessage( 1072077 ); // You may only cast this spell on yourself or a bonded pet. } - else if( m_Table.ContainsKey( m ) ) + else if ( m_Table.ContainsKey( m ) ) { Caster.SendLocalizedMessage( 501775 ); // This spell is already in effect. } - else if( CheckBSequence( m ) ) + else if ( CheckBSequence( m ) ) { - if( Caster == m ) + if ( Caster == m ) { Caster.SendLocalizedMessage( 1074774 ); // You weave powerful magic, protecting yourself from death. } @@ -93,7 +93,7 @@ namespace Server.Spells.Spellweaving public static void HandleDeath( Mobile m ) { - if( m_Table.ContainsKey( m ) ) + if ( m_Table.ContainsKey( m ) ) Timer.DelayCall( TimeSpan.FromSeconds( Utility.RandomMinMax( 2, 4 ) ), new TimerStateCallback( HandleDeath_OnCallback ), m ); } @@ -103,12 +103,12 @@ namespace Server.Spells.Spellweaving { double hitsScalar = timer.Spell.HitsScalar; - if( m is BaseCreature && m.IsDeadBondedPet ) + if ( m is BaseCreature && m.IsDeadBondedPet ) { BaseCreature pet = (BaseCreature)m; Mobile master = pet.GetMaster(); - if( master != null && master.NetState != null && Utility.InUpdateRange( pet, master ) ) + if ( master != null && master.NetState != null && Utility.InUpdateRange( pet, master ) ) { master.CloseGump( typeof( PetResurrectGump ) ); master.SendGump( new PetResurrectGump( master, pet, hitsScalar ) ); @@ -121,7 +121,7 @@ namespace Server.Spells.Spellweaving { Mobile friend = friends[i]; - if( friend.NetState != null && Utility.InUpdateRange( pet, friend ) ) + if ( friend.NetState != null && Utility.InUpdateRange( pet, friend ) ) { friend.CloseGump( typeof( PetResurrectGump ) ); friend.SendGump( new PetResurrectGump( friend, pet ) ); @@ -148,7 +148,7 @@ namespace Server.Spells.Spellweaving { Mobile m = e.Mobile; - if( m == null || m.Alive || m_Table[m] == null ) + if ( m == null || m.Alive || m_Table[m] == null ) return; HandleDeath_OnCallback( m ); @@ -197,7 +197,7 @@ namespace Server.Spells.Spellweaving protected override void OnTarget( Mobile m, object o ) { - if( o is Mobile ) + if ( o is Mobile ) { m_Owner.Target( (Mobile)o ); } diff --git a/Scripts/Spells/Spellweaving/GiftOfRenewal.cs b/Scripts/Spells/Spellweaving/GiftOfRenewal.cs index d5cde8597..4297da51c 100644 --- a/Scripts/Spells/Spellweaving/GiftOfRenewal.cs +++ b/Scripts/Spells/Spellweaving/GiftOfRenewal.cs @@ -29,26 +29,26 @@ namespace Server.Spells.Spellweaving public void Target( Mobile m ) { - if( !Caster.CanSee( m ) ) + if ( !Caster.CanSee( m ) ) { Caster.SendLocalizedMessage( 500237 ); // Target can not be seen. } - if( m_Table.ContainsKey( m ) ) + if ( m_Table.ContainsKey( m ) ) { Caster.SendLocalizedMessage( 501775 ); // This spell is already in effect. } - else if( !Caster.CanBeginAction( typeof( GiftOfRenewalSpell ) ) ) + else if ( !Caster.CanBeginAction( typeof( GiftOfRenewalSpell ) ) ) { Caster.SendLocalizedMessage( 501789 ); // You must wait before trying again. } - else if( CheckBSequence( m ) ) + else if ( CheckBSequence( m ) ) { SpellHelper.Turn( Caster, m ); Caster.FixedEffect( 0x374A, 10, 20 ); Caster.PlaySound( 0x5C9 ); - if( m.Poisoned ) + if ( m.Poisoned ) { m.CurePoison( m ); } @@ -64,7 +64,7 @@ namespace Server.Spells.Spellweaving Timer.DelayCall( duration, delegate { - if( StopEffect( m ) ) + if ( StopEffect( m ) ) { m.PlaySound( 0x455 ); m.SendLocalizedMessage( 1075071 ); // The Gift of Renewal has faded. @@ -118,20 +118,20 @@ namespace Server.Spells.Spellweaving { Mobile m = m_Info.m_Mobile; - if( !m_Table.ContainsKey( m ) ) + if ( !m_Table.ContainsKey( m ) ) { Stop(); return; } - if( !m.Alive ) + if ( !m.Alive ) { Stop(); StopEffect( m ); return; } - if( m.Hits >= m.HitsMax ) + if ( m.Hits >= m.HitsMax ) return; int toHeal = m_Info.m_HitsPerRound; @@ -170,7 +170,7 @@ namespace Server.Spells.Spellweaving protected override void OnTarget( Mobile m, object o ) { - if( o is Mobile ) + if ( o is Mobile ) { m_Owner.Target( (Mobile)o ); } diff --git a/Scripts/Spells/Spellweaving/Items/TransientItem.cs b/Scripts/Spells/Spellweaving/Items/TransientItem.cs index 05f6ab17f..3413da9b0 100644 --- a/Scripts/Spells/Spellweaving/Items/TransientItem.cs +++ b/Scripts/Spells/Spellweaving/Items/TransientItem.cs @@ -30,7 +30,7 @@ namespace Server.Items public override bool Nontransferable => true; public override void HandleInvalidTransfer( Mobile from ) { - if( InvalidTransferMessage != null ) + if ( InvalidTransferMessage != null ) TextDefinition.SendMessageTo( from, InvalidTransferMessage ); this.Delete(); @@ -41,7 +41,7 @@ namespace Server.Items public virtual void Expire( Mobile parent ) { - if( parent != null ) + if ( parent != null ) parent.SendLocalizedMessage( 1072515, (this.Name == null ? String.Format( "#{0}", LabelNumber ): this.Name) ); // The ~1_name~ expired... Effects.PlaySound( GetWorldLocation(), Map, 0x201 ); @@ -56,7 +56,7 @@ namespace Server.Items public override void OnDelete() { - if( m_Timer != null ) + if ( m_Timer != null ) m_Timer.Stop(); base.OnDelete(); @@ -64,7 +64,7 @@ namespace Server.Items public virtual void CheckExpiry() { - if( (m_CreationTime + m_LifeSpan) < DateTime.UtcNow ) + if ( (m_CreationTime + m_LifeSpan) < DateTime.UtcNow ) Expire( RootParent as Mobile ); else InvalidateProperties(); diff --git a/Scripts/Spells/Spellweaving/Mobiles/NatureFury.cs b/Scripts/Spells/Spellweaving/Mobiles/NatureFury.cs index 07d4d75f2..281dd9acd 100644 --- a/Scripts/Spells/Spellweaving/Mobiles/NatureFury.cs +++ b/Scripts/Spells/Spellweaving/Mobiles/NatureFury.cs @@ -61,7 +61,7 @@ namespace Server.Mobiles PlaySound( 0xE ); PlaySound( 0x1BC ); - if( Alive && !Deleted ) + if ( Alive && !Deleted ) Timer.DelayCall( TimeSpan.FromSeconds( 7.0 ), DoEffects ); } diff --git a/Scripts/Spells/Spellweaving/ReaperForm.cs b/Scripts/Spells/Spellweaving/ReaperForm.cs index 7f3531f4e..dd94c8d8d 100644 --- a/Scripts/Spells/Spellweaving/ReaperForm.cs +++ b/Scripts/Spells/Spellweaving/ReaperForm.cs @@ -18,7 +18,7 @@ namespace Server.Spells.Spellweaving { TransformContext context = TransformationSpellHelper.GetContext( e.Mobile ); - if( context != null && context.Type == typeof( ReaperFormSpell ) ) + if ( context != null && context.Type == typeof( ReaperFormSpell ) ) e.Mobile.Send( SpeedControl.WalkSpeed ); } diff --git a/Scripts/Spells/Spellweaving/Thunderstorm.cs b/Scripts/Spells/Spellweaving/Thunderstorm.cs index 0fca64d93..654c22923 100644 --- a/Scripts/Spells/Spellweaving/Thunderstorm.cs +++ b/Scripts/Spells/Spellweaving/Thunderstorm.cs @@ -23,7 +23,7 @@ namespace Server.Spells.Spellweaving public override void OnCast() { - if( CheckSequence() ) + if ( CheckSequence() ) { Caster.PlaySound( 0x5CE ); @@ -49,7 +49,7 @@ namespace Server.Spells.Spellweaving foreach( Mobile m in Caster.GetMobilesInRange( range ) ) { - if( Caster != m && SpellHelper.ValidIndirectTarget( Caster, m ) && Caster.CanBeHarmful( m, false ) && Caster.InLOS( m ) ) + if ( Caster != m && SpellHelper.ValidIndirectTarget( Caster, m ) && Caster.CanBeHarmful( m, false ) && Caster.InLOS( m ) ) targets.Add( m ); } @@ -63,9 +63,9 @@ namespace Server.Spells.Spellweaving SpellHelper.Damage( this, m, ( m.Player && Caster.Player ) ? pvpDamage : pvmDamage, 0, 0, 0, 0, 100 ); - if( oldSpell != null && oldSpell != m.Spell ) + if ( oldSpell != null && oldSpell != m.Spell ) { - if( !CheckResisted( m ) ) + if ( !CheckResisted( m ) ) { m_Table[m] = Timer.DelayCall( duration, DoExpire, m ); diff --git a/Scripts/Spells/Spellweaving/WordOfDeath.cs b/Scripts/Spells/Spellweaving/WordOfDeath.cs index 06fbceff6..8a9cf1780 100644 --- a/Scripts/Spells/Spellweaving/WordOfDeath.cs +++ b/Scripts/Spells/Spellweaving/WordOfDeath.cs @@ -24,11 +24,11 @@ namespace Server.Spells.Spellweaving public void Target( Mobile m ) { - if( !Caster.CanSee( m ) ) + if ( !Caster.CanSee( m ) ) { Caster.SendLocalizedMessage( 500237 ); // Target can not be seen. } - else if( CheckHSequence( m ) ) + else if ( CheckHSequence( m ) ) { Point3D loc = m.Location; loc.Z += 50; @@ -42,7 +42,7 @@ namespace Server.Spells.Spellweaving int damage; - if( !m.Player && (((double)m.Hits / (double)m.HitsMax) < percentage )) + if ( !m.Player && (((double)m.Hits / (double)m.HitsMax) < percentage )) { damage = 300; } @@ -78,7 +78,7 @@ namespace Server.Spells.Spellweaving protected override void OnTarget( Mobile m, object o ) { - if( o is Mobile ) + if ( o is Mobile ) { m_Owner.Target( (Mobile)o ); } diff --git a/Server/Body.cs b/Server/Body.cs index cb0c2c7af..16615e251 100644 --- a/Server/Body.cs +++ b/Server/Body.cs @@ -59,7 +59,7 @@ namespace Server BodyType type; int bodyID; - if( int.TryParse( split[0], out bodyID ) && Enum.TryParse( split[1], true, out type ) && bodyID >= 0 && bodyID < m_Types.Length ) + if ( int.TryParse( split[0], out bodyID ) && Enum.TryParse( split[1], true, out type ) && bodyID >= 0 && bodyID < m_Types.Length ) { m_Types[bodyID] = type; } @@ -284,4 +284,4 @@ namespace Server return l.m_BodyID <= r.m_BodyID; } } -} \ No newline at end of file +} diff --git a/Server/ClientVersion.cs b/Server/ClientVersion.cs index c3f67dd94..72ae412f0 100644 --- a/Server/ClientVersion.cs +++ b/Server/ClientVersion.cs @@ -207,11 +207,11 @@ namespace Server m_Minor = Utility.ToInt32( fmt.Substring( br1 + 1, br2 - br1 - 1 ) ); m_Revision = Utility.ToInt32( fmt.Substring( br2 + 1, br3 - br2 - 1 ) ); - if( br3 < fmt.Length ) + if ( br3 < fmt.Length ) { - if( m_Major <= 5 && m_Minor <= 0 && m_Revision <= 6 ) //Anything before 5.0.7 + if ( m_Major <= 5 && m_Minor <= 0 && m_Revision <= 6 ) //Anything before 5.0.7 { - if( !Char.IsWhiteSpace( fmt, br3 ) ) + if ( !Char.IsWhiteSpace( fmt, br3 ) ) m_Patch = (fmt[br3] - 'a') + 1; } else @@ -302,4 +302,4 @@ namespace Server return a.CompareTo( b ); } } -} \ No newline at end of file +} diff --git a/Server/Commands.cs b/Server/Commands.cs index c1650981f..0565d5da5 100644 --- a/Server/Commands.cs +++ b/Server/Commands.cs @@ -285,7 +285,7 @@ namespace Server.Commands { if ( text.StartsWith( m_Prefix ) || type == MessageType.Command ) { - if( type != MessageType.Command ) + if ( type != MessageType.Command ) text = text.Substring( m_Prefix.Length ); int indexOf = text.IndexOf( ' ' ); @@ -344,4 +344,4 @@ namespace Server.Commands return false; } } -} \ No newline at end of file +} diff --git a/Server/EventSink.cs b/Server/EventSink.cs index 85de32d6c..65e4f65ff 100644 --- a/Server/EventSink.cs +++ b/Server/EventSink.cs @@ -856,7 +856,7 @@ namespace Server public static event GuildGumpRequestHandler GuildGumpRequest; public static event QuestGumpRequestHandler QuestGumpRequest; public static event ClientVersionReceivedHandler ClientVersionReceived; - + /* The following is a .NET 2.0 "Generic EventHandler" implementation. * It is a breaking change; we would have to refactor all event handlers. * This style does not appear to be in widespread use. @@ -911,7 +911,7 @@ namespace Server public static void InvokeClientVersionReceived( ClientVersionReceivedArgs e ) { - if( ClientVersionReceived != null ) + if ( ClientVersionReceived != null ) ClientVersionReceived( e ); } @@ -935,13 +935,13 @@ namespace Server public static void InvokeGuildGumpRequest( GuildGumpRequestArgs e ) { - if( GuildGumpRequest != null ) + if ( GuildGumpRequest != null ) GuildGumpRequest( e ); } public static void InvokeQuestGumpRequest( QuestGumpRequestArgs e ) { - if( QuestGumpRequest != null ) + if ( QuestGumpRequest != null ) QuestGumpRequest( e ); } @@ -1210,4 +1210,4 @@ namespace Server QuestGumpRequest = null; } } -} \ No newline at end of file +} diff --git a/Server/Gumps/GumpImageTileButton.cs b/Server/Gumps/GumpImageTileButton.cs index 6843cc1d1..4a83a4fd2 100644 --- a/Server/Gumps/GumpImageTileButton.cs +++ b/Server/Gumps/GumpImageTileButton.cs @@ -128,13 +128,13 @@ namespace Server.Gumps } set { - if( m_Type != value ) + if ( m_Type != value ) { m_Type = value; Gump parent = Parent; - if( parent != null ) + if ( parent != null ) { parent.Invalidate(); } @@ -216,7 +216,7 @@ namespace Server.Gumps public override string Compile( NetState ns ) { - if( m_LocalizedTooltip > 0 ) + if ( m_LocalizedTooltip > 0 ) return String.Format( "{{ buttontileart {0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10} }}{{ tooltip {11} }}", m_X, m_Y, m_ID1, m_ID2, (int)m_Type, m_Param, m_ButtonID, m_ItemID, m_Hue, m_Width, m_Height, m_LocalizedTooltip ); else return String.Format( "{{ buttontileart {0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10} }}", m_X, m_Y, m_ID1, m_ID2, (int)m_Type, m_Param, m_ButtonID, m_ItemID, m_Hue, m_Width, m_Height ); @@ -241,11 +241,11 @@ namespace Server.Gumps disp.AppendLayout( m_Width ); disp.AppendLayout( m_Height ); - if( m_LocalizedTooltip > 0 ) + if ( m_LocalizedTooltip > 0 ) { disp.AppendLayout( m_LayoutTooltip ); disp.AppendLayout( m_LocalizedTooltip ); } } } -} \ No newline at end of file +} diff --git a/Server/Item.cs b/Server/Item.cs index 9f6a5983d..d026fe873 100644 --- a/Server/Item.cs +++ b/Server/Item.cs @@ -1009,9 +1009,9 @@ namespace Server } /// - /// Overridable. Determines whether the item will show . + /// Overridable. Determines whether the item will show . /// - public virtual bool DisplayWeight + public virtual bool DisplayWeight { get { @@ -1022,11 +1022,11 @@ namespace Server return false; return true; - } + } } /// - /// Overridable. Displays cliloc 1072788-1072789. + /// Overridable. Displays cliloc 1072788-1072789. /// public virtual void AddWeightProperty( ObjectPropertyList list ) { @@ -1062,7 +1062,7 @@ namespace Server if ( DisplayWeight ) AddWeightProperty( list ); - if( QuestItem ) + if ( QuestItem ) AddQuestItemProperty( list ); @@ -1197,10 +1197,10 @@ namespace Server /// { /// if ( from.Int >= 100 ) /// return true; - /// + /// /// return base.AllowEquippedCast( from ); /// } - /// + /// /// When placed in an Item script, the item may be cast when equipped if the has 100 or more intelligence. Otherwise, it will drop to their backpack. /// public virtual bool AllowEquippedCast( Mobile from ) @@ -1249,7 +1249,7 @@ namespace Server return DeathMoveResult.MoveToBackpack; else if ( CheckNewbied() && parent.Kills < 5 ) return DeathMoveResult.MoveToBackpack; - else if( parent.Player && Nontransferable ) + else if ( parent.Player && Nontransferable ) return DeathMoveResult.MoveToBackpack; else return DeathMoveResult.MoveToCorpse; @@ -1265,7 +1265,7 @@ namespace Server return DeathMoveResult.MoveToBackpack; else if ( CheckNewbied() && parent.Kills < 5 ) return DeathMoveResult.MoveToBackpack; - else if( parent.Player && Nontransferable ) + else if ( parent.Player && Nontransferable ) return DeathMoveResult.MoveToBackpack; else return DeathMoveResult.MoveToCorpse; @@ -2766,7 +2766,7 @@ namespace Server else if ( m_Parent is Mobile ) ( m_Parent as Mobile ).UpdateTotal( sender, type, delta ); else if ( this.HeldBy != null ) - ( this.HeldBy as Mobile ).UpdateTotal( sender, type, delta ); + ( this.HeldBy as Mobile ).UpdateTotal( sender, type, delta ); } } @@ -2899,7 +2899,7 @@ namespace Server public virtual void HandleInvalidTransfer( Mobile from ) { // OSI sends 1074769, bug! - if( QuestItem ) + if ( QuestItem ) from.SendLocalizedMessage( 1049343 ); // You can only drop quest items into the top-most level of your backpack while you still need them for your quest. } @@ -2927,7 +2927,7 @@ namespace Server { List items = LookupItems(); - if( items == null ) + if ( items == null ) items = EmptyItems; return items; @@ -2965,12 +2965,12 @@ namespace Server while( p is Item ) { - if( p is T ) + if ( p is T ) return true; Item item = (Item)p; - if( item.m_Parent == null ) + if ( item.m_Parent == null ) { break; } @@ -3511,7 +3511,7 @@ namespace Server } public ISpawner Spawner - { + { get { CompactInfo info = LookupCompactInfo(); @@ -3521,7 +3521,7 @@ namespace Server return null; - } + } set { CompactInfo info = AcquireCompactInfo(); @@ -3530,7 +3530,7 @@ namespace Server if (info.m_Spawner == null) VerifyCompactInfo(); - } + } } public virtual void OnBeforeSpawn( Point3D location, Map m ) @@ -3834,7 +3834,7 @@ namespace Server public virtual bool OnDroppedToMobile( Mobile from, Mobile target ) { - if( Nontransferable && from.Player ) + if ( Nontransferable && from.Player ) { HandleInvalidTransfer( from ); return false; @@ -3863,11 +3863,11 @@ namespace Server public virtual bool OnDroppedInto( Mobile from, Container target, Point3D p ) { - if( !from.OnDroppedItemInto( this, target, p ) ) + if ( !from.OnDroppedItemInto( this, target, p ) ) { return false; } - else if( Nontransferable && from.Player && target != from.Backpack ) + else if ( Nontransferable && from.Player && target != from.Backpack ) { HandleInvalidTransfer( from ); return false; @@ -3888,7 +3888,7 @@ namespace Server return false; else if ( !from.OnDroppedItemOnto( this, target ) ) return false; - else if( Nontransferable && from.Player && target != from.Backpack ) + else if ( Nontransferable && from.Player && target != from.Backpack ) { HandleInvalidTransfer( from ); return false; @@ -3922,7 +3922,7 @@ namespace Server public virtual bool OnDroppedToWorld( Mobile from, Point3D p ) { - if( Nontransferable && from.Player ) + if ( Nontransferable && from.Player ) { HandleInvalidTransfer( from ); return false; @@ -4583,9 +4583,9 @@ namespace Server public bool QuestItem { get { return GetFlag( ImplFlag.QuestItem ); } - set - { - SetFlag( ImplFlag.QuestItem, value ); + set + { + SetFlag( ImplFlag.QuestItem, value ); InvalidateProperties(); @@ -4719,4 +4719,4 @@ namespace Server { } } -} \ No newline at end of file +} diff --git a/Server/Items/Container.cs b/Server/Items/Container.cs index aadece33e..08771ef8e 100644 --- a/Server/Items/Container.cs +++ b/Server/Items/Container.cs @@ -211,7 +211,7 @@ namespace Server.Items return false; } - + if ( MaxWeight != 0 && (this.TotalWeight + plusWeight + item.TotalWeight + item.PileWeight) > MaxWeight ) { if ( message ) @@ -717,7 +717,7 @@ namespace Server.Items for( int i = 0; i < items.Length; ++i ) total += items[i].Amount; - if( total >= amount ) + if ( total >= amount ) { // We've enough, so consume it @@ -729,9 +729,9 @@ namespace Server.Items int theirAmount = item.Amount; - if( theirAmount < need ) + if ( theirAmount < need ) { - if( callback != null ) + if ( callback != null ) callback( item, theirAmount ); item.Consume( theirAmount ); @@ -739,7 +739,7 @@ namespace Server.Items } else { - if( callback != null ) + if ( callback != null ) callback( item, need ); item.Consume( need ); @@ -773,7 +773,7 @@ namespace Server.Items private static void RecurseConsumeUpTo( Item current, Type type, int amount, bool recurse, ref int consumed, Queue toDelete ) { - if( current != null && current.Items.Count > 0 ) + if ( current != null && current.Items.Count > 0 ) { List list = current.Items; @@ -781,12 +781,12 @@ namespace Server.Items { Item item = list[i]; - if( type.IsAssignableFrom( item.GetType() ) ) + if ( type.IsAssignableFrom( item.GetType() ) ) { int need = amount - consumed; int theirAmount = item.Amount; - if( theirAmount <= need ) + if ( theirAmount <= need ) { toDelete.Enqueue( item ); consumed += theirAmount; @@ -799,7 +799,7 @@ namespace Server.Items return; } } - else if( recurse && item is Container ) + else if ( recurse && item is Container ) { RecurseConsumeUpTo( item, type, amount, recurse, ref consumed, toDelete ); } @@ -812,7 +812,7 @@ namespace Server.Items #region Get[BestGroup]Amount public int GetBestGroupAmount( Type type, bool recurse, CheckItemGroup grouper ) { - if( grouper == null ) + if ( grouper == null ) throw new ArgumentNullException(); int best = 0; @@ -834,7 +834,7 @@ namespace Server.Items Item b = typedItems[idx]; int v = grouper( a, b ); - if( v == 0 ) + if ( v == 0 ) group.Add( b ); else break; @@ -855,7 +855,7 @@ namespace Server.Items for( int j = 0; j < items.Length; ++j ) total += items[j].Amount; - if( total >= best ) + if ( total >= best ) best = total; } @@ -864,7 +864,7 @@ namespace Server.Items public int GetBestGroupAmount( Type[] types, bool recurse, CheckItemGroup grouper ) { - if( grouper == null ) + if ( grouper == null ) throw new ArgumentNullException(); int best = 0; @@ -886,7 +886,7 @@ namespace Server.Items Item b = typedItems[idx]; int v = grouper( a, b ); - if( v == 0 ) + if ( v == 0 ) group.Add( b ); else break; @@ -906,7 +906,7 @@ namespace Server.Items for( int k = 0; k < items.Length; ++k ) total += items[k].Amount; - if( total >= best ) + if ( total >= best ) best = total; } @@ -915,7 +915,7 @@ namespace Server.Items public int GetBestGroupAmount( Type[][] types, bool recurse, CheckItemGroup grouper ) { - if( grouper == null ) + if ( grouper == null ) throw new ArgumentNullException(); int best = 0; @@ -939,7 +939,7 @@ namespace Server.Items Item b = typedItems[idx]; int v = grouper( a, b ); - if( v == 0 ) + if ( v == 0 ) group.Add( b ); else break; @@ -959,7 +959,7 @@ namespace Server.Items for( int k = 0; k < items.Length; ++k ) total += items[k].Amount; - if( total >= best ) + if ( total >= best ) best = total; } } @@ -1046,7 +1046,7 @@ namespace Server.Items public Item[] FindItemsByType( Type[] types, bool recurse ) { - if( m_FindItemsList.Count > 0 ) + if ( m_FindItemsList.Count > 0 ) m_FindItemsList.Clear(); RecurseFindItemsByType( this, types, recurse, m_FindItemsList ); @@ -1056,7 +1056,7 @@ namespace Server.Items private static void RecurseFindItemsByType( Item current, Type[] types, bool recurse, List list ) { - if( current != null && current.Items.Count > 0 ) + if ( current != null && current.Items.Count > 0 ) { List items = current.Items; @@ -1064,10 +1064,10 @@ namespace Server.Items { Item item = items[i]; - if( InTypeList( item, types ) ) + if ( InTypeList( item, types ) ) list.Add( item ); - if( recurse && item is Container ) + if ( recurse && item is Container ) RecurseFindItemsByType( item, types, recurse, list ); } } @@ -1085,7 +1085,7 @@ namespace Server.Items private static Item RecurseFindItemByType( Item current, Type type, bool recurse ) { - if( current != null && current.Items.Count > 0 ) + if ( current != null && current.Items.Count > 0 ) { List list = current.Items; @@ -1093,15 +1093,15 @@ namespace Server.Items { Item item = list[i]; - if( type.IsAssignableFrom( item.GetType() ) ) + if ( type.IsAssignableFrom( item.GetType() ) ) { return item; } - else if( recurse && item is Container ) + else if ( recurse && item is Container ) { Item check = RecurseFindItemByType( item, type, recurse ); - if( check != null ) + if ( check != null ) return check; } } @@ -1122,7 +1122,7 @@ namespace Server.Items private static Item RecurseFindItemByType( Item current, Type[] types, bool recurse ) { - if( current != null && current.Items.Count > 0 ) + if ( current != null && current.Items.Count > 0 ) { List list = current.Items; @@ -1130,15 +1130,15 @@ namespace Server.Items { Item item = list[i]; - if( InTypeList( item, types ) ) + if ( InTypeList( item, types ) ) { return item; } - else if( recurse && item is Container ) + else if ( recurse && item is Container ) { Item check = RecurseFindItemByType( item, types, recurse ); - if( check != null ) + if ( check != null ) return check; } } @@ -1167,11 +1167,11 @@ namespace Server.Items public List FindItemsByType( bool recurse, Predicate predicate ) where T : Item { - if( m_FindItemsList.Count > 0 ) + if ( m_FindItemsList.Count > 0 ) m_FindItemsList.Clear(); List list = new List(); - + RecurseFindItemsByType( this, recurse, list, predicate ); return list; @@ -1179,7 +1179,7 @@ namespace Server.Items private static void RecurseFindItemsByType( Item current, bool recurse, List list, Predicate predicate ) where T : Item { - if( current != null && current.Items.Count > 0 ) + if ( current != null && current.Items.Count > 0 ) { List items = current.Items; @@ -1187,15 +1187,15 @@ namespace Server.Items { Item item = items[i]; - if( typeof( T ).IsAssignableFrom( item.GetType() ) ) + if ( typeof( T ).IsAssignableFrom( item.GetType() ) ) { T typedItem = (T)item; - if( predicate == null || predicate( typedItem ) ) + if ( predicate == null || predicate( typedItem ) ) list.Add( typedItem ); } - if( recurse && item is Container ) + if ( recurse && item is Container ) RecurseFindItemsByType( item, recurse, list, predicate ); } } @@ -1224,7 +1224,7 @@ namespace Server.Items private static T RecurseFindItemByType( Item current, bool recurse, Predicate predicate ) where T : Item { - if( current != null && current.Items.Count > 0 ) + if ( current != null && current.Items.Count > 0 ) { List list = current.Items; @@ -1232,18 +1232,18 @@ namespace Server.Items { Item item = list[i]; - if( typeof( T ).IsAssignableFrom( item.GetType() ) ) + if ( typeof( T ).IsAssignableFrom( item.GetType() ) ) { T typedItem = (T)item; - if( predicate == null || predicate( typedItem ) ) + if ( predicate == null || predicate( typedItem ) ) return typedItem; } - else if( recurse && item is Container ) + else if ( recurse && item is Container ) { T check = RecurseFindItemByType( item, recurse, predicate ); - if( check != null ) + if ( check != null ) return check; } } @@ -1766,7 +1766,7 @@ namespace Server.Items { if ( Core.ML ) { - if( ParentsContain() ) //Root Parent is the Mobile. Parent could be another containter. + if ( ParentsContain() ) //Root Parent is the Mobile. Parent could be another containter. list.Add( 1073841, "{0}\t{1}\t{2}", TotalItems, MaxItems, TotalWeight ); // Contents: ~1_COUNT~/~2_MAXCOUNT~ items, ~3_WEIGHT~ stones else list.Add( 1072241, "{0}\t{1}\t{2}\t{3}", TotalItems, MaxItems, TotalWeight, MaxWeight ); // Contents: ~1_COUNT~/~2_MAXCOUNT~ items, ~3_WEIGHT~/~4_MAXWEIGHT~ stones diff --git a/Server/Items/VirtualHair.cs b/Server/Items/VirtualHair.cs index 3b01507f4..762202bd0 100644 --- a/Server/Items/VirtualHair.cs +++ b/Server/Items/VirtualHair.cs @@ -122,7 +122,7 @@ namespace Server { int hue = parent.HairHue; - if( parent.SolidHueOverride >= 0 ) + if ( parent.SolidHueOverride >= 0 ) hue = parent.SolidHueOverride; int hairSerial = HairInfo.FakeSerial( parent ); @@ -143,7 +143,7 @@ namespace Server { int hue = parent.FacialHairHue; - if( parent.SolidHueOverride >= 0 ) + if ( parent.SolidHueOverride >= 0 ) hue = parent.SolidHueOverride; int hairSerial = FacialHairInfo.FakeSerial( parent ); @@ -174,4 +174,4 @@ namespace Server m_Stream.Write( (int)FacialHairInfo.FakeSerial( parent ) ); } } -} \ No newline at end of file +} diff --git a/Server/Main.cs b/Server/Main.cs index 072c6c392..87b5fe5b5 100644 --- a/Server/Main.cs +++ b/Server/Main.cs @@ -73,12 +73,12 @@ namespace Server get { return m_Profiling; } set { - if( m_Profiling == value ) + if ( m_Profiling == value ) return; m_Profiling = value; - if( m_ProfileStart > DateTime.MinValue ) + if ( m_ProfileStart > DateTime.MinValue ) m_ProfileTime += DateTime.UtcNow - m_ProfileStart; m_ProfileStart = (m_Profiling ? DateTime.UtcNow : DateTime.MinValue); @@ -89,7 +89,7 @@ namespace Server { get { - if( m_ProfileStart > DateTime.MinValue ) + if ( m_ProfileStart > DateTime.MinValue ) return m_ProfileTime + (DateTime.UtcNow - m_ProfileStart); return m_ProfileTime; @@ -156,7 +156,7 @@ namespace Server public static string FindDataFile( string path ) { - if( m_DataDirectories.Count == 0 ) + if ( m_DataDirectories.Count == 0 ) throw new InvalidOperationException( "Attempted to FindDataFile before DataDirectories list has been filled." ); string fullPath = null; @@ -165,7 +165,7 @@ namespace Server { fullPath = Path.Combine( p, path ); - if( File.Exists( fullPath ) ) + if ( File.Exists( fullPath ) ) break; fullPath = null; @@ -249,13 +249,13 @@ namespace Server { get { - if( m_BaseDirectory == null ) + if ( m_BaseDirectory == null ) { try { m_BaseDirectory = ExePath; - if( m_BaseDirectory.Length > 0 ) + if ( m_BaseDirectory.Length > 0 ) m_BaseDirectory = Path.GetDirectoryName( m_BaseDirectory ); } catch @@ -273,7 +273,7 @@ namespace Server Console.WriteLine( e.IsTerminating ? "Error:" : "Warning:" ); Console.WriteLine( e.ExceptionObject ); - if( e.IsTerminating ) + if ( e.IsTerminating ) { m_Crashed = true; @@ -291,7 +291,7 @@ namespace Server { } - if( !close && !m_Service ) + if ( !close && !m_Service ) { try { @@ -331,7 +331,7 @@ namespace Server private static bool OnConsoleEvent( ConsoleEventType type ) { - if( World.Saving || ( m_Service && type == ConsoleEventType.CTRL_LOGOFF_EVENT ) ) + if ( World.Saving || ( m_Service && type == ConsoleEventType.CTRL_LOGOFF_EVENT ) ) return true; Kill(); //Kill -> HandleClosed will handle waiting for the completion of flushing to disk @@ -371,7 +371,7 @@ namespace Server private static void HandleClosed() { - if( m_Closing ) + if ( m_Closing ) return; m_Closing = true; @@ -380,7 +380,7 @@ namespace Server World.WaitForWriteCompletion(); - if( !m_Crashed ) + if ( !m_Crashed ) EventSink.InvokeShutdown( new ShutdownEventArgs() ); Timer.TimerThread.Set(); @@ -417,9 +417,9 @@ namespace Server try { - if( m_Service ) + if ( m_Service ) { - if( !Directory.Exists( "Logs" ) ) + if ( !Directory.Exists( "Logs" ) ) Directory.CreateDirectory( "Logs" ); Console.SetOut( m_MultiConOut = new MultiTextWriter( new FileLogger( "Logs/Console.log" ) ) ); @@ -437,10 +437,10 @@ namespace Server m_Process = Process.GetCurrentProcess(); m_Assembly = Assembly.GetEntryAssembly(); - if( m_Thread != null ) + if ( m_Thread != null ) m_Thread.Name = "Core Thread"; - if( BaseDirectory.Length > 0 ) + if ( BaseDirectory.Length > 0 ) Directory.SetCurrentDirectory( BaseDirectory ); Timer.TimerThread ttObj = new Timer.TimerThread(); @@ -457,19 +457,19 @@ namespace Server string s = Arguments; - if( s.Length > 0 ) + if ( s.Length > 0 ) Console.WriteLine( "Core: Running with arguments: {0}", s ); m_ProcessorCount = Environment.ProcessorCount; - if( m_ProcessorCount > 1 ) + if ( m_ProcessorCount > 1 ) m_MultiProcessor = true; - if( m_MultiProcessor || Is64Bit ) + if ( m_MultiProcessor || Is64Bit ) Console.WriteLine( "Core: Optimizing for {0} {2}processor{1}", m_ProcessorCount, m_ProcessorCount == 1 ? "" : "s", Is64Bit ? "64-bit " : "" ); int platform = (int)Environment.OSVersion.Platform; - if( platform == 4 || platform == 128 ) { // MS 4, MONO 128 + if ( platform == 4 || platform == 128 ) { // MS 4, MONO 128 m_Unix = true; Console.WriteLine( "Core: Unix environment detected" ); } @@ -490,12 +490,12 @@ namespace Server { Console.WriteLine( "Scripts: One or more scripts failed to compile or no script files were found." ); - if( m_Service ) + if ( m_Service ) return; Console.WriteLine( " - Press return to exit, or R to try again." ); - if( Console.ReadKey( true ).Key != ConsoleKey.R ) + if ( Console.ReadKey( true ).Key != ConsoleKey.R ) return; } @@ -539,7 +539,7 @@ namespace Server NetState.FlushAll(); NetState.ProcessDisposedQueue(); - if( Slice != null ) + if ( Slice != null ) Slice(); if (sample++ % sampleInterval != 0) @@ -564,19 +564,19 @@ namespace Server { StringBuilder sb = new StringBuilder(); - if( m_Debug ) + if ( m_Debug ) Utility.Separate( sb, "-debug", " " ); - if( m_Service ) + if ( m_Service ) Utility.Separate( sb, "-service", " " ); - if( m_Profiling ) + if ( m_Profiling ) Utility.Separate( sb, "-profile", " " ); - if( !m_Cache ) + if ( !m_Cache ) Utility.Separate( sb, "-nocache", " " ); - if( m_HaltOnWarning ) + if ( m_HaltOnWarning ) Utility.Separate( sb, "-haltonwarning", " " ); if ( m_VBdotNET ) diff --git a/Server/Mobile.cs b/Server/Mobile.cs index b16399788..b3ae5a3d2 100644 --- a/Server/Mobile.cs +++ b/Server/Mobile.cs @@ -126,11 +126,11 @@ namespace Server { m_ObeyCap = value; - if( m_Owner != null ) + if ( m_Owner != null ) { Skill sk = m_Owner.Skills[m_Skill]; - if( sk != null ) + if ( sk != null ) sk.Update(); } } @@ -144,14 +144,14 @@ namespace Server } set { - if( m_Owner != value ) + if ( m_Owner != value ) { - if( m_Owner != null ) + if ( m_Owner != null ) m_Owner.RemoveSkillMod( this ); m_Owner = value; - if( m_Owner != value ) + if ( m_Owner != value ) m_Owner.AddSkillMod( this ); } } @@ -170,21 +170,21 @@ namespace Server } set { - if( m_Skill != value ) + if ( m_Skill != value ) { Skill oldUpdate = (m_Owner != null ? m_Owner.Skills[m_Skill] : null); m_Skill = value; - if( m_Owner != null ) + if ( m_Owner != null ) { Skill sk = m_Owner.Skills[m_Skill]; - if( sk != null ) + if ( sk != null ) sk.Update(); } - if( oldUpdate != null ) + if ( oldUpdate != null ) oldUpdate.Update(); } } @@ -198,15 +198,15 @@ namespace Server } set { - if( m_Relative != value ) + if ( m_Relative != value ) { m_Relative = value; - if( m_Owner != null ) + if ( m_Owner != null ) { Skill sk = m_Owner.Skills[m_Skill]; - if( sk != null ) + if ( sk != null ) sk.Update(); } } @@ -221,15 +221,15 @@ namespace Server } set { - if( m_Relative == value ) + if ( m_Relative == value ) { m_Relative = !value; - if( m_Owner != null ) + if ( m_Owner != null ) { Skill sk = m_Owner.Skills[m_Skill]; - if( sk != null ) + if ( sk != null ) sk.Update(); } } @@ -244,15 +244,15 @@ namespace Server } set { - if( m_Value != value ) + if ( m_Value != value ) { m_Value = value; - if( m_Owner != null ) + if ( m_Owner != null ) { Skill sk = m_Owner.Skills[m_Skill]; - if( sk != null ) + if ( sk != null ) sk.Update(); } } @@ -279,11 +279,11 @@ namespace Server get { return m_Type; } set { - if( m_Type != value ) + if ( m_Type != value ) { m_Type = value; - if( m_Owner != null ) + if ( m_Owner != null ) m_Owner.UpdateResistances(); } } @@ -294,11 +294,11 @@ namespace Server get { return m_Offset; } set { - if( m_Offset != value ) + if ( m_Offset != value ) { m_Offset = value; - if( m_Owner != null ) + if ( m_Owner != null ) m_Owner.UpdateResistances(); } } @@ -325,7 +325,7 @@ namespace Server public bool HasElapsed() { - if( m_Duration == TimeSpan.Zero ) + if ( m_Duration == TimeSpan.Zero ) return false; return (DateTime.UtcNow - m_Added) >= m_Duration; @@ -511,7 +511,7 @@ namespace Server #region CompareTo(...) public int CompareTo( IEntity other ) { - if( other == null ) + if ( other == null ) return -1; return m_Serial.CompareTo( other.Serial ); @@ -524,7 +524,7 @@ namespace Server public int CompareTo( object other ) { - if( other == null || other is IEntity ) + if ( other == null || other is IEntity ) return this.CompareTo( (IEntity)other ); throw new ArgumentException(); @@ -638,7 +638,7 @@ namespace Server public static TimeSpan GetHitsRegenRate( Mobile m ) { - if( m_HitsRegenRate == null ) + if ( m_HitsRegenRate == null ) return m_DefaultHitsRate; else return m_HitsRegenRate( m ); @@ -646,7 +646,7 @@ namespace Server public static TimeSpan GetStamRegenRate( Mobile m ) { - if( m_StamRegenRate == null ) + if ( m_StamRegenRate == null ) return m_DefaultStamRate; else return m_StamRegenRate( m ); @@ -654,7 +654,7 @@ namespace Server public static TimeSpan GetManaRegenRate( Mobile m ) { - if( m_ManaRegenRate == null ) + if ( m_ManaRegenRate == null ) return m_DefaultManaRate; else return m_ManaRegenRate( m ); @@ -672,7 +672,7 @@ namespace Server { MovementRecord r; - if( m_InstancePool.Count > 0 ) + if ( m_InstancePool.Count > 0 ) { r = m_InstancePool.Dequeue(); @@ -695,7 +695,7 @@ namespace Server { bool v = (Core.TickCount - m_End >= 0); - if( v ) + if ( v ) m_InstancePool.Enqueue( this ); return v; @@ -800,7 +800,7 @@ namespace Server { get { - if( m_Race == null ) + if ( m_Race == null ) m_Race = Race.DefaultRace; return m_Race; @@ -811,7 +811,7 @@ namespace Server m_Race = value; - if( m_Race == null ) + if ( m_Race == null ) m_Race = Race.DefaultRace; this.Body = m_Race.Body( this ); @@ -845,7 +845,7 @@ namespace Server { ComputeBaseLightLevels( out global, out personal ); - if( m_Region != null ) + if ( m_Region != null ) m_Region.AlterLightLevel( this, ref global, ref personal ); } @@ -891,37 +891,37 @@ namespace Server public virtual void UpdateResistances() { - if( m_Resistances == null ) + if ( m_Resistances == null ) m_Resistances = new int[5] { int.MinValue, int.MinValue, int.MinValue, int.MinValue, int.MinValue }; bool delta = false; for( int i = 0; i < m_Resistances.Length; ++i ) { - if( m_Resistances[i] != int.MinValue ) + if ( m_Resistances[i] != int.MinValue ) { m_Resistances[i] = int.MinValue; delta = true; } } - if( delta ) + if ( delta ) Delta( MobileDelta.Resistances ); } public virtual int GetResistance( ResistanceType type ) { - if( m_Resistances == null ) + if ( m_Resistances == null ) m_Resistances = new int[5] { int.MinValue, int.MinValue, int.MinValue, int.MinValue, int.MinValue }; int v = (int)type; - if( v < 0 || v >= m_Resistances.Length ) + if ( v < 0 || v >= m_Resistances.Length ) return 0; int res = m_Resistances[v]; - if( res == int.MinValue ) + if ( res == int.MinValue ) { ComputeResistances(); res = m_Resistances[v]; @@ -948,11 +948,11 @@ namespace Server public virtual void RemoveResistanceMod( ResistanceMod toRemove ) { - if( m_ResistMods != null ) + if ( m_ResistMods != null ) { m_ResistMods.Remove( toRemove ); - if( m_ResistMods.Count == 0 ) + if ( m_ResistMods.Count == 0 ) m_ResistMods = null; } @@ -965,7 +965,7 @@ namespace Server public virtual void ComputeResistances() { - if( m_Resistances == null ) + if ( m_Resistances == null ) m_Resistances = new int[5] { int.MinValue, int.MinValue, int.MinValue, int.MinValue, int.MinValue }; for( int i = 0; i < m_Resistances.Length; ++i ) @@ -982,7 +982,7 @@ namespace Server ResistanceMod mod = m_ResistMods[i]; int v = (int)mod.Type; - if( v >= 0 && v < m_Resistances.Length ) + if ( v >= 0 && v < m_Resistances.Length ) m_Resistances[v] += mod.Offset; } @@ -990,7 +990,7 @@ namespace Server { Item item = m_Items[i]; - if( item.CheckPropertyConfliction( this ) ) + if ( item.CheckPropertyConfliction( this ) ) continue; m_Resistances[0] += item.PhysicalResistance; @@ -1005,12 +1005,12 @@ namespace Server int min = GetMinResistance( (ResistanceType)i ); int max = GetMaxResistance( (ResistanceType)i ); - if( max < min ) + if ( max < min ) max = min; - if( m_Resistances[i] > max ) + if ( m_Resistances[i] > max ) m_Resistances[i] = max; - else if( m_Resistances[i] < min ) + else if ( m_Resistances[i] < min ) m_Resistances[i] = min; } } @@ -1022,7 +1022,7 @@ namespace Server public virtual int GetMaxResistance( ResistanceType type ) { - if( m_Player ) + if ( m_Player ) return m_MaxPlayerResistance; return int.MaxValue; @@ -1042,13 +1042,13 @@ namespace Server { ObjectPropertyList opl = this.PropertyList; - if( opl.Header > 0 ) + if ( opl.Header > 0 ) { int hue; - if( m_NameHue != -1 ) + if ( m_NameHue != -1 ) hue = m_NameHue; - else if( m_AccessLevel > AccessLevel.Player ) + else if ( m_AccessLevel > AccessLevel.Player ) hue = 11; else hue = Notoriety.GetHue( Notoriety.Compute( from, this ) ); @@ -1066,24 +1066,24 @@ namespace Server { string name = Name; - if( name == null ) + if ( name == null ) name = String.Empty; string prefix = ""; - if( ShowFameTitle && (m_Player || m_Body.IsHuman) && m_Fame >= 10000 ) + if ( ShowFameTitle && (m_Player || m_Body.IsHuman) && m_Fame >= 10000 ) prefix = m_Female ? "Lady" : "Lord"; string suffix = ""; - if( PropertyTitle && Title != null && Title.Length > 0 ) + if ( PropertyTitle && Title != null && Title.Length > 0 ) suffix = Title; BaseGuild guild = m_Guild; - if( guild != null && (m_Player || m_DisplayGuildTitle) ) + if ( guild != null && (m_Player || m_DisplayGuildTitle) ) { - if( suffix.Length > 0 ) + if ( suffix.Length > 0 ) suffix = String.Format( "{0} [{1}]", suffix, Utility.FixHtml( guild.Abbreviation ) ); else suffix = String.Format( "[{0}]", Utility.FixHtml( guild.Abbreviation ) ); @@ -1093,29 +1093,29 @@ namespace Server list.Add( 1050045, "{0} \t{1}\t {2}", prefix, name, suffix ); // ~1_PREFIX~~2_NAME~~3_SUFFIX~ - if( guild != null && (m_DisplayGuildTitle || (m_Player && guild.Type != GuildType.Regular)) ) + if ( guild != null && (m_DisplayGuildTitle || (m_Player && guild.Type != GuildType.Regular)) ) { string type; - if( guild.Type >= 0 && (int)guild.Type < m_GuildTypes.Length ) + if ( guild.Type >= 0 && (int)guild.Type < m_GuildTypes.Length ) type = m_GuildTypes[(int)guild.Type]; else type = ""; string title = GuildTitle; - if( title == null ) + if ( title == null ) title = ""; else title = title.Trim(); - if( NewGuildDisplay && title.Length > 0 ) + if ( NewGuildDisplay && title.Length > 0 ) { list.Add( "{0}, {1}", Utility.FixHtml( title ), Utility.FixHtml( guild.Name ) ); } else { - if( title.Length > 0 ) + if ( title.Length > 0 ) list.Add( "{0}, {1} Guild{2}", Utility.FixHtml( title ), Utility.FixHtml( guild.Name ), type ); else list.Add( Utility.FixHtml( guild.Name ) ); @@ -1140,11 +1140,11 @@ namespace Server private void UpdateAggrExpire() { - if( m_Deleted || (m_Aggressors.Count == 0 && m_Aggressed.Count == 0) ) + if ( m_Deleted || (m_Aggressors.Count == 0 && m_Aggressed.Count == 0) ) { StopAggrExpire(); } - else if( m_ExpireAggrTimer == null ) + else if ( m_ExpireAggrTimer == null ) { m_ExpireAggrTimer = new ExpireAggressorsTimer( this ); m_ExpireAggrTimer.Start(); @@ -1153,7 +1153,7 @@ namespace Server private void StopAggrExpire() { - if( m_ExpireAggrTimer != null ) + if ( m_ExpireAggrTimer != null ) m_ExpireAggrTimer.Stop(); m_ExpireAggrTimer = null; @@ -1163,12 +1163,12 @@ namespace Server { for( int i = m_Aggressors.Count - 1; i >= 0; --i ) { - if( i >= m_Aggressors.Count ) + if ( i >= m_Aggressors.Count ) continue; AggressorInfo info = m_Aggressors[i]; - if( info.Expired ) + if ( info.Expired ) { Mobile attacker = info.Attacker; attacker.RemoveAggressed( this ); @@ -1176,7 +1176,7 @@ namespace Server m_Aggressors.RemoveAt( i ); info.Free(); - if( m_NetState != null && this.CanSee( attacker ) && Utility.InUpdateRange( m_Location, attacker.m_Location ) ) { + if ( m_NetState != null && this.CanSee( attacker ) && Utility.InUpdateRange( m_Location, attacker.m_Location ) ) { m_NetState.Send(MobileIncoming.Create(m_NetState, this, attacker)); } } @@ -1184,12 +1184,12 @@ namespace Server for( int i = m_Aggressed.Count - 1; i >= 0; --i ) { - if( i >= m_Aggressed.Count ) + if ( i >= m_Aggressed.Count ) continue; AggressorInfo info = m_Aggressed[i]; - if( info.Expired ) + if ( info.Expired ) { Mobile defender = info.Defender; defender.RemoveAggressor( this ); @@ -1197,7 +1197,7 @@ namespace Server m_Aggressed.RemoveAt( i ); info.Free(); - if( m_NetState != null && this.CanSee( defender ) && Utility.InUpdateRange( m_Location, defender.m_Location ) ) { + if ( m_NetState != null && this.CanSee( defender ) && Utility.InUpdateRange( m_Location, defender.m_Location ) ) { m_NetState.Send(MobileIncoming.Create(m_NetState, this, defender)); } } @@ -1223,7 +1223,7 @@ namespace Server } set { - if( m_VirtualArmorMod != value ) + if ( m_VirtualArmorMod != value ) { m_VirtualArmorMod = value; @@ -1249,7 +1249,7 @@ namespace Server Skill sk = m_Skills[mod.Skill]; - if( sk != null ) + if ( sk != null ) sk.Update(); } } @@ -1260,7 +1260,7 @@ namespace Server { SkillMod mod = m_SkillMods[i]; - if( mod.CheckCondition() ) + if ( mod.CheckCondition() ) ++i; else InternalRemoveSkillMod( mod ); @@ -1269,26 +1269,26 @@ namespace Server public virtual void AddSkillMod( SkillMod mod ) { - if( mod == null ) + if ( mod == null ) return; ValidateSkillMods(); - if( !m_SkillMods.Contains( mod ) ) + if ( !m_SkillMods.Contains( mod ) ) { m_SkillMods.Add( mod ); mod.Owner = this; Skill sk = m_Skills[mod.Skill]; - if( sk != null ) + if ( sk != null ) sk.Update(); } } public virtual void RemoveSkillMod( SkillMod mod ) { - if( mod == null ) + if ( mod == null ) return; ValidateSkillMods(); @@ -1298,14 +1298,14 @@ namespace Server private void InternalRemoveSkillMod( SkillMod mod ) { - if( m_SkillMods.Contains( mod ) ) + if ( m_SkillMods.Contains( mod ) ) { m_SkillMods.Remove( mod ); mod.Owner = null; Skill sk = m_Skills[mod.Skill]; - if( sk != null ) + if ( sk != null ) sk.Update(); } } @@ -1352,23 +1352,23 @@ namespace Server public void DelayChangeWarmode( bool value ) { - if( m_WarmodeTimer != null ) + if ( m_WarmodeTimer != null ) { m_WarmodeTimer.Value = value; return; } - if( m_Warmode == value ) + if ( m_Warmode == value ) return; DateTime now = DateTime.UtcNow, next = m_NextWarmodeChange; - if( now > next || m_WarmodeChanges == 0 ) + if ( now > next || m_WarmodeChanges == 0 ) { m_WarmodeChanges = 1; m_NextWarmodeChange = now + WarmodeSpamCatch; } - else if( m_WarmodeChanges == WarmodeCatchCount ) + else if ( m_WarmodeChanges == WarmodeCatchCount ) { m_WarmodeTimer = new WarmodeTimer( this, value ); m_WarmodeTimer.Start(); @@ -1427,16 +1427,16 @@ namespace Server } set { - if( m_Skills != null ) + if ( m_Skills != null ) m_Skills.Cap = value; } } public bool InLOS( Mobile target ) { - if( m_Deleted || m_Map == null ) + if ( m_Deleted || m_Map == null ) return false; - else if( target == this || m_AccessLevel > AccessLevel.Player ) + else if ( target == this || m_AccessLevel > AccessLevel.Player ) return true; return m_Map.LineOfSight( this, target ); @@ -1444,11 +1444,11 @@ namespace Server public bool InLOS( object target ) { - if( m_Deleted || m_Map == null ) + if ( m_Deleted || m_Map == null ) return false; - else if( target == this || m_AccessLevel > AccessLevel.Player ) + else if ( target == this || m_AccessLevel > AccessLevel.Player ) return true; - else if( target is Item && ((Item)target).RootParent == this ) + else if ( target is Item && ((Item)target).RootParent == this ) return true; return m_Map.LineOfSight( this, target ); @@ -1456,9 +1456,9 @@ namespace Server public bool InLOS( Point3D target ) { - if( m_Deleted || m_Map == null ) + if ( m_Deleted || m_Map == null ) return false; - else if( m_AccessLevel > AccessLevel.Player ) + else if ( m_AccessLevel > AccessLevel.Player ) return true; return m_Map.LineOfSight( this, target ); @@ -1546,7 +1546,7 @@ namespace Server { int oldValue = m_Hunger; - if( oldValue != value ) + if ( oldValue != value ) { m_Hunger = value; @@ -1600,15 +1600,15 @@ namespace Server } /* Logout: - * + * * When a client logs into mobile x * - if ( x is Internalized ) move x to logout location and map - * + * * When a client attached to a mobile disconnects * - LogoutTimer is started * - Delay is taken from Region.GetLogoutDelay to allow insta-logout regions. * - OnTick : Location and map are stored, and mobile is internalized - * + * * Some things to consider: * - An internalized person getting killed (say, by poison). Where does the body go? * - Regions now have a GetLogoutDelay( Mobile m ); virtual function (see above) @@ -1633,26 +1633,26 @@ namespace Server } set { - if( m_Holding != value ) + if ( m_Holding != value ) { - if( m_Holding != null ) + if ( m_Holding != null ) { UpdateTotal( m_Holding, TotalType.Weight, -(m_Holding.TotalWeight + m_Holding.PileWeight) ); - if( m_Holding.HeldBy == this ) + if ( m_Holding.HeldBy == this ) m_Holding.HeldBy = null; } - if( value != null && m_Holding != null ) + if ( value != null && m_Holding != null ) DropHolding(); m_Holding = value; - if( m_Holding != null ) + if ( m_Holding != null ) { UpdateTotal( m_Holding, TotalType.Weight, m_Holding.TotalWeight + m_Holding.PileWeight ); - if( m_Holding.HeldBy == null ) + if ( m_Holding.HeldBy == null ) m_Holding.HeldBy = this; } } @@ -1680,14 +1680,14 @@ namespace Server } set { - if( m_Paralyzed != value ) + if ( m_Paralyzed != value ) { m_Paralyzed = value; Delta( MobileDelta.Flags ); this.SendLocalizedMessage( m_Paralyzed ? 502381 : 502382 ); - if( m_ParaTimer != null ) + if ( m_ParaTimer != null ) { m_ParaTimer.Stop(); m_ParaTimer = null; @@ -1733,12 +1733,12 @@ namespace Server } set { - if( m_Frozen != value ) + if ( m_Frozen != value ) { m_Frozen = value; Delta( MobileDelta.Flags ); - if( m_FrozenTimer != null ) + if ( m_FrozenTimer != null ) { m_FrozenTimer.Stop(); m_FrozenTimer = null; @@ -1749,7 +1749,7 @@ namespace Server public void Paralyze( TimeSpan duration ) { - if( !m_Paralyzed ) + if ( !m_Paralyzed ) { Paralyzed = true; @@ -1760,7 +1760,7 @@ namespace Server public void Freeze( TimeSpan duration ) { - if( !m_Frozen ) + if ( !m_Frozen ) { Frozen = true; @@ -1781,11 +1781,11 @@ namespace Server } set { - if( m_StrLock != value ) + if ( m_StrLock != value ) { m_StrLock = value; - if( m_NetState != null ) + if ( m_NetState != null ) m_NetState.Send( new StatLockInfo( this ) ); } } @@ -1803,11 +1803,11 @@ namespace Server } set { - if( m_DexLock != value ) + if ( m_DexLock != value ) { m_DexLock = value; - if( m_NetState != null ) + if ( m_NetState != null ) m_NetState.Send( new StatLockInfo( this ) ); } } @@ -1825,11 +1825,11 @@ namespace Server } set { - if( m_IntLock != value ) + if ( m_IntLock != value ) { m_IntLock = value; - if( m_NetState != null ) + if ( m_NetState != null ) m_NetState.Send( new StatLockInfo( this ) ); } } @@ -1900,11 +1900,11 @@ namespace Server public virtual void ClearHand( Item item ) { - if( item != null && item.Movable && !item.AllowEquippedCast( this ) ) + if ( item != null && item.Movable && !item.AllowEquippedCast( this ) ) { Container pack = this.Backpack; - if( pack == null ) + if ( pack == null ) AddToBackpack( item ); else pack.DropItem( item ); @@ -1941,7 +1941,7 @@ namespace Server protected override void OnTick() { - if( m_Owner.CanRegenMana )// m_Owner.Alive ) + if ( m_Owner.CanRegenMana )// m_Owner.Alive ) m_Owner.Mana++; Delay = Interval = Mobile.GetManaRegenRate( m_Owner ); @@ -1961,7 +1961,7 @@ namespace Server protected override void OnTick() { - if( m_Owner.CanRegenHits )// m_Owner.Alive && !m_Owner.Poisoned ) + if ( m_Owner.CanRegenHits )// m_Owner.Alive && !m_Owner.Poisoned ) m_Owner.Hits++; Delay = Interval = Mobile.GetHitsRegenRate( m_Owner ); @@ -1981,7 +1981,7 @@ namespace Server protected override void OnTick() { - if( m_Owner.CanRegenStam )// m_Owner.Alive ) + if ( m_Owner.CanRegenStam )// m_Owner.Alive ) m_Owner.Stam++; Delay = Interval = Mobile.GetStamRegenRate( m_Owner ); @@ -2001,7 +2001,7 @@ namespace Server protected override void OnTick() { - if( m_Mobile.m_Map != Map.Internal ) + if ( m_Mobile.m_Map != Map.Internal ) { EventSink.InvokeLogout( new LogoutEventArgs( m_Mobile ) ); @@ -2056,7 +2056,7 @@ namespace Server { m_Mobile = m; - if( !m_Mobile.m_Player && m_Mobile.m_Dex <= 100 ) + if ( !m_Mobile.m_Player && m_Mobile.m_Dex <= 100 ) Priority = TimerPriority.FiftyMS; } @@ -2067,7 +2067,7 @@ namespace Server Mobile combatant = m_Mobile.Combatant; // If no combatant, wrong map, one of us is a ghost, or cannot see, or deleted, then stop combat - if( combatant == null || combatant.m_Deleted || m_Mobile.m_Deleted || combatant.m_Map != m_Mobile.m_Map || !combatant.Alive || !m_Mobile.Alive || !m_Mobile.CanSee( combatant ) || combatant.IsDeadBondedPet || m_Mobile.IsDeadBondedPet ) + if ( combatant == null || combatant.m_Deleted || m_Mobile.m_Deleted || combatant.m_Map != m_Mobile.m_Map || !combatant.Alive || !m_Mobile.Alive || !m_Mobile.CanSee( combatant ) || combatant.IsDeadBondedPet || m_Mobile.IsDeadBondedPet ) { m_Mobile.Combatant = null; return; @@ -2075,10 +2075,10 @@ namespace Server IWeapon weapon = m_Mobile.Weapon; - if( !m_Mobile.InRange( combatant, weapon.MaxRange ) ) + if ( !m_Mobile.InRange( combatant, weapon.MaxRange ) ) return; - if( m_Mobile.InLOS( combatant ) ) + if ( m_Mobile.InLOS( combatant ) ) { weapon.OnBeforeSwing( m_Mobile, combatant ); //OnBeforeSwing for checking in regards to being hidden and whatnot m_Mobile.RevealingAction(); @@ -2143,7 +2143,7 @@ namespace Server protected override void OnTick() { - if( m_Mobile.Deleted || (m_Mobile.Aggressors.Count == 0 && m_Mobile.Aggressed.Count == 0) ) + if ( m_Mobile.Deleted || (m_Mobile.Aggressors.Count == 0 && m_Mobile.Aggressed.Count == 0) ) m_Mobile.StopAggrExpire(); else m_Mobile.CheckAggrExpire(); @@ -2191,7 +2191,7 @@ namespace Server public virtual void Attack( Mobile m ) { - if( CheckAttack( m ) ) + if ( CheckAttack( m ) ) Combatant = m; } @@ -2213,32 +2213,32 @@ namespace Server } set { - if( m_Deleted ) + if ( m_Deleted ) return; - if( m_Combatant != value && value != this ) + if ( m_Combatant != value && value != this ) { Mobile old = m_Combatant; ++m_ChangingCombatant; m_Combatant = value; - if( (m_Combatant != null && !CanBeHarmful( m_Combatant, false )) || !Region.OnCombatantChange( this, old, m_Combatant ) ) + if ( (m_Combatant != null && !CanBeHarmful( m_Combatant, false )) || !Region.OnCombatantChange( this, old, m_Combatant ) ) { m_Combatant = old; --m_ChangingCombatant; return; } - if( m_NetState != null ) + if ( m_NetState != null ) m_NetState.Send( new ChangeCombatant( m_Combatant ) ); - if( m_Combatant == null ) + if ( m_Combatant == null ) { - if( m_ExpireCombatant != null ) + if ( m_ExpireCombatant != null ) m_ExpireCombatant.Stop(); - if( m_CombatTimer != null ) + if ( m_CombatTimer != null ) m_CombatTimer.Stop(); m_ExpireCombatant = null; @@ -2246,22 +2246,22 @@ namespace Server } else { - if( m_ExpireCombatant == null ) + if ( m_ExpireCombatant == null ) m_ExpireCombatant = new ExpireCombatantTimer( this ); m_ExpireCombatant.Start(); - if( m_CombatTimer == null ) + if ( m_CombatTimer == null ) m_CombatTimer = new CombatTimer( this ); m_CombatTimer.Start(); } - if( m_Combatant != null && CanBeHarmful( m_Combatant, false ) ) + if ( m_Combatant != null && CanBeHarmful( m_Combatant, false ) ) { DoHarmful( m_Combatant ); - if( m_Combatant != null ) + if ( m_Combatant != null ) m_Combatant.PlaySound( m_Combatant.GetAngerSound() ); } @@ -2310,7 +2310,7 @@ namespace Server public virtual void AggressiveAction( Mobile aggressor, bool criminal ) { - if( aggressor == this ) + if ( aggressor == this ) return; AggressiveActionEventArgs args = AggressiveActionEventArgs.Create( this, aggressor, criminal ); @@ -2319,9 +2319,9 @@ namespace Server args.Free(); - if( Combatant == aggressor ) + if ( Combatant == aggressor ) { - if( m_ExpireCombatant == null ) + if ( m_ExpireCombatant == null ) m_ExpireCombatant = new ExpireCombatantTimer( this ); else m_ExpireCombatant.Stop(); @@ -2337,7 +2337,7 @@ namespace Server { AggressorInfo info = list[i]; - if( info.Attacker == aggressor ) + if ( info.Attacker == aggressor ) { info.Refresh(); info.CriminalAggression = criminal; @@ -2353,7 +2353,7 @@ namespace Server { AggressorInfo info = list[i]; - if( info.Attacker == this ) + if ( info.Attacker == this ) { info.Refresh(); @@ -2369,7 +2369,7 @@ namespace Server { AggressorInfo info = list[i]; - if( info.Defender == aggressor ) + if ( info.Defender == aggressor ) { info.Refresh(); @@ -2383,7 +2383,7 @@ namespace Server { AggressorInfo info = list[i]; - if( info.Defender == this ) + if ( info.Defender == this ) { info.Refresh(); info.CriminalAggression = criminal; @@ -2395,35 +2395,35 @@ namespace Server bool setCombatant = false; - if( addAggressor ) + if ( addAggressor ) { m_Aggressors.Add( AggressorInfo.Create( aggressor, this, criminal ) ); // new AggressorInfo( aggressor, this, criminal, true ) ); - if( this.CanSee( aggressor ) && m_NetState != null ) { + if ( this.CanSee( aggressor ) && m_NetState != null ) { m_NetState.Send(MobileIncoming.Create(m_NetState, this, aggressor)); } - if( Combatant == null ) + if ( Combatant == null ) setCombatant = true; UpdateAggrExpire(); } - if( addAggressed ) + if ( addAggressed ) { aggressor.m_Aggressed.Add( AggressorInfo.Create( aggressor, this, criminal ) ); // new AggressorInfo( aggressor, this, criminal, false ) ); - if( this.CanSee( aggressor ) && m_NetState != null ) { + if ( this.CanSee( aggressor ) && m_NetState != null ) { m_NetState.Send(MobileIncoming.Create(m_NetState, this, aggressor)); } - if( Combatant == null ) + if ( Combatant == null ) setCombatant = true; UpdateAggrExpire(); } - if( setCombatant ) + if ( setCombatant ) Combatant = aggressor; Region.OnAggressed( aggressor, this, criminal ); @@ -2431,7 +2431,7 @@ namespace Server public void RemoveAggressed( Mobile aggressed ) { - if( m_Deleted ) + if ( m_Deleted ) return; List list = m_Aggressed; @@ -2440,12 +2440,12 @@ namespace Server { AggressorInfo info = list[i]; - if( info.Defender == aggressed ) + if ( info.Defender == aggressed ) { m_Aggressed.RemoveAt( i ); info.Free(); - if( m_NetState != null && this.CanSee( aggressed ) ) { + if ( m_NetState != null && this.CanSee( aggressed ) ) { m_NetState.Send(MobileIncoming.Create(m_NetState, this, aggressed)); } @@ -2458,7 +2458,7 @@ namespace Server public void RemoveAggressor( Mobile aggressor ) { - if( m_Deleted ) + if ( m_Deleted ) return; List list = m_Aggressors; @@ -2467,12 +2467,12 @@ namespace Server { AggressorInfo info = list[i]; - if( info.Attacker == aggressor ) + if ( info.Attacker == aggressor ) { m_Aggressors.RemoveAt( i ); info.Free(); - if( m_NetState != null && this.CanSee( aggressor ) ) { + if ( m_NetState != null && this.CanSee( aggressor ) ) { m_NetState.Send(MobileIncoming.Create(m_NetState, this, aggressor)); } @@ -2510,7 +2510,7 @@ namespace Server } set { - if( m_TithingPoints != value ) + if ( m_TithingPoints != value ) { m_TithingPoints = value; @@ -2528,7 +2528,7 @@ namespace Server } set { - if( m_Followers != value ) + if ( m_Followers != value ) { m_Followers = value; @@ -2546,7 +2546,7 @@ namespace Server } set { - if( m_FollowersMax != value ) + if ( m_FollowersMax != value ) { m_FollowersMax = value; @@ -2574,7 +2574,7 @@ namespace Server public virtual void UpdateTotal( Item sender, TotalType type, int delta ) { - if( delta == 0 || sender.IsVirtualItem ) + if ( delta == 0 || sender.IsVirtualItem ) return; switch( type ) @@ -2598,7 +2598,7 @@ namespace Server public virtual void UpdateTotals() { - if( m_Items == null ) + if ( m_Items == null ) return; int oldWeight = m_TotalWeight; @@ -2613,7 +2613,7 @@ namespace Server item.UpdateTotals(); - if( item.IsVirtualItem ) + if ( item.IsVirtualItem ) continue; m_TotalGold += item.TotalGold; @@ -2621,10 +2621,10 @@ namespace Server m_TotalWeight += item.TotalWeight + item.PileWeight; } - if( m_Holding != null ) + if ( m_Holding != null ) m_TotalWeight += m_Holding.TotalWeight + m_Holding.PileWeight; - if( m_TotalWeight != oldWeight ) + if ( m_TotalWeight != oldWeight ) OnWeightChange( oldWeight ); } @@ -2664,7 +2664,7 @@ namespace Server protected override void OnTarget( Mobile from, object targeted ) { - if( m_Callback != null ) + if ( m_Callback != null ) m_Callback( from, targeted ); } } @@ -2692,7 +2692,7 @@ namespace Server protected override void OnTarget( Mobile from, object targeted ) { - if( m_Callback != null ) + if ( m_Callback != null ) m_Callback( from, targeted, m_State ); } } @@ -2744,17 +2744,17 @@ namespace Server Target oldTarget = m_Target; Target newTarget = value; - if( oldTarget == newTarget ) + if ( oldTarget == newTarget ) return; m_Target = null; - if( oldTarget != null && newTarget != null ) + if ( oldTarget != null && newTarget != null ) oldTarget.Cancel( this, TargetCancelType.Overridden ); m_Target = newTarget; - if( newTarget != null && m_NetState != null && !m_TargetLocked ) + if ( newTarget != null && m_NetState != null && !m_TargetLocked ) m_NetState.Send( newTarget.GetPacketFor( m_NetState ) ); OnTargetChange(); @@ -2820,15 +2820,15 @@ namespace Server public override void OnResponse( Mobile from, string text ) { - if( m_Callback != null ) + if ( m_Callback != null ) m_Callback( from, text ); } public override void OnCancel( Mobile from ) { - if( m_CallbackHandlesCancel && m_Callback != null ) + if ( m_CallbackHandlesCancel && m_Callback != null ) m_Callback( from, "" ); - else if( m_CancelCallback != null ) + else if ( m_CancelCallback != null ) m_CancelCallback( from, "" ); } } @@ -2879,15 +2879,15 @@ namespace Server public override void OnResponse( Mobile from, string text ) { - if( m_Callback != null ) + if ( m_Callback != null ) m_Callback( from, text, m_State ); } public override void OnCancel( Mobile from ) { - if( m_CallbackHandlesCancel && m_Callback != null ) + if ( m_CallbackHandlesCancel && m_Callback != null ) m_Callback( from, "", m_State ); - else if( m_CancelCallback != null ) + else if ( m_CancelCallback != null ) m_CancelCallback( from, "", m_State ); } } @@ -2980,17 +2980,17 @@ namespace Server Prompt oldPrompt = m_Prompt; Prompt newPrompt = value; - if( oldPrompt == newPrompt ) + if ( oldPrompt == newPrompt ) return; m_Prompt = null; - if( oldPrompt != null && newPrompt != null ) + if ( oldPrompt != null && newPrompt != null ) oldPrompt.OnCancel( this ); m_Prompt = newPrompt; - if( newPrompt != null ) + if ( newPrompt != null ) Send( new UnicodePrompt( newPrompt ) ); } } @@ -2998,7 +2998,7 @@ namespace Server private bool InternalOnMove( Direction d ) { - if( !OnMove( d ) ) + if ( !OnMove( d ) ) return false; MovementEventArgs e = MovementEventArgs.Create( this, d ); @@ -3018,9 +3018,9 @@ namespace Server /// True if the move is allowed, false if not. protected virtual bool OnMove( Direction d ) { - if( m_Hidden && m_AccessLevel == AccessLevel.Player ) + if ( m_Hidden && m_AccessLevel == AccessLevel.Player ) { - if( m_AllowedStealthSteps-- <= 0 || (d & Direction.Running) != 0 || this.Mounted ) + if ( m_AllowedStealthSteps-- <= 0 || (d & Direction.Running) != 0 || this.Mounted ) RevealingAction(); } @@ -3074,7 +3074,7 @@ namespace Server public virtual void ClearFastwalkStack() { - if( m_MoveRecords != null && m_MoveRecords.Count > 0 ) + if ( m_MoveRecords != null && m_MoveRecords.Count > 0 ) m_MoveRecords.Clear(); m_EndQueue = Core.TickCount; @@ -3087,25 +3087,25 @@ namespace Server public virtual bool Move( Direction d ) { - if( m_Deleted ) + if ( m_Deleted ) return false; BankBox box = FindBankNoCreate(); - if( box != null && box.Opened ) + if ( box != null && box.Opened ) box.Close(); Point3D newLocation = m_Location; Point3D oldLocation = newLocation; - if( (m_Direction & Direction.Mask) == (d & Direction.Mask) ) + if ( (m_Direction & Direction.Mask) == (d & Direction.Mask) ) { // We are actually moving (not just a direction change) - if( m_Spell != null && !m_Spell.OnCasterMoving( d ) ) + if ( m_Spell != null && !m_Spell.OnCasterMoving( d ) ) return false; - if( m_Paralyzed || m_Frozen ) + if ( m_Paralyzed || m_Frozen ) { SendLocalizedMessage( 500111 ); // You are frozen and can not move. @@ -3114,7 +3114,7 @@ namespace Server int newZ; - if( CheckMovement( d, out newZ ) ) + if ( CheckMovement( d, out newZ ) ) { int x = oldLocation.m_X, y = oldLocation.m_Y; int oldX = x, oldY = y; @@ -3160,18 +3160,18 @@ namespace Server Map map = m_Map; - if( map != null ) + if ( map != null ) { Sector oldSector = map.GetSector( oldX, oldY ); Sector newSector = map.GetSector( x, y ); - if( oldSector != newSector ) + if ( oldSector != newSector ) { for( int i = 0; i < oldSector.Mobiles.Count; ++i ) { Mobile m = oldSector.Mobiles[i]; - if( m != this && m.X == oldX && m.Y == oldY && (m.Z + 15) > oldZ && (oldZ + 15) > m.Z && !m.OnMoveOff( this ) ) + if ( m != this && m.X == oldX && m.Y == oldY && (m.Z + 15) > oldZ && (oldZ + 15) > m.Z && !m.OnMoveOff( this ) ) return false; } @@ -3179,7 +3179,7 @@ namespace Server { Item item = oldSector.Items[i]; - if( item.AtWorldPoint( oldX, oldY ) && (item.Z == oldZ || ((item.Z + item.ItemData.Height) > oldZ && (oldZ + 15) > item.Z)) && !item.OnMoveOff( this ) ) + if ( item.AtWorldPoint( oldX, oldY ) && (item.Z == oldZ || ((item.Z + item.ItemData.Height) > oldZ && (oldZ + 15) > item.Z)) && !item.OnMoveOff( this ) ) return false; } @@ -3187,7 +3187,7 @@ namespace Server { Mobile m = newSector.Mobiles[i]; - if( m.X == x && m.Y == y && (m.Z + 15) > newZ && (newZ + 15) > m.Z && !m.OnMoveOver( this ) ) + if ( m.X == x && m.Y == y && (m.Z + 15) > newZ && (newZ + 15) > m.Z && !m.OnMoveOver( this ) ) return false; } @@ -3195,7 +3195,7 @@ namespace Server { Item item = newSector.Items[i]; - if( item.AtWorldPoint( x, y ) && (item.Z == newZ || ((item.Z + item.ItemData.Height) > newZ && (newZ + 15) > item.Z)) && !item.OnMoveOver( this ) ) + if ( item.AtWorldPoint( x, y ) && (item.Z == newZ || ((item.Z + item.ItemData.Height) > newZ && (newZ + 15) > item.Z)) && !item.OnMoveOver( this ) ) return false; } } @@ -3205,9 +3205,9 @@ namespace Server { Mobile m = oldSector.Mobiles[i]; - if( m != this && m.X == oldX && m.Y == oldY && (m.Z + 15) > oldZ && (oldZ + 15) > m.Z && !m.OnMoveOff( this ) ) + if ( m != this && m.X == oldX && m.Y == oldY && (m.Z + 15) > oldZ && (oldZ + 15) > m.Z && !m.OnMoveOff( this ) ) return false; - else if( m.X == x && m.Y == y && (m.Z + 15) > newZ && (newZ + 15) > m.Z && !m.OnMoveOver( this ) ) + else if ( m.X == x && m.Y == y && (m.Z + 15) > newZ && (newZ + 15) > m.Z && !m.OnMoveOver( this ) ) return false; } @@ -3215,14 +3215,14 @@ namespace Server { Item item = oldSector.Items[i]; - if( item.AtWorldPoint( oldX, oldY ) && (item.Z == oldZ || ((item.Z + item.ItemData.Height) > oldZ && (oldZ + 15) > item.Z)) && !item.OnMoveOff( this ) ) + if ( item.AtWorldPoint( oldX, oldY ) && (item.Z == oldZ || ((item.Z + item.ItemData.Height) > oldZ && (oldZ + 15) > item.Z)) && !item.OnMoveOff( this ) ) return false; - else if( item.AtWorldPoint( x, y ) && (item.Z == newZ || ((item.Z + item.ItemData.Height) > newZ && (newZ + 15) > item.Z)) && !item.OnMoveOver( this ) ) + else if ( item.AtWorldPoint( x, y ) && (item.Z == newZ || ((item.Z + item.ItemData.Height) > newZ && (newZ + 15) > item.Z)) && !item.OnMoveOver( this ) ) return false; } } - if( !Region.CanMove( this, d, newLocation, oldLocation, m_Map ) ) + if ( !Region.CanMove( this, d, newLocation, oldLocation, m_Map ) ) return false; } else @@ -3230,30 +3230,30 @@ namespace Server return false; } - if( !InternalOnMove( d ) ) + if ( !InternalOnMove( d ) ) return false; - if( m_FwdEnabled && m_NetState != null && m_AccessLevel < m_FwdAccessOverride && (!m_FwdUOTDOverride || !m_NetState.IsUOTDClient) ) + if ( m_FwdEnabled && m_NetState != null && m_AccessLevel < m_FwdAccessOverride && (!m_FwdUOTDOverride || !m_NetState.IsUOTDClient) ) { - if( m_MoveRecords == null ) + if ( m_MoveRecords == null ) m_MoveRecords = new Queue( 6 ); while( m_MoveRecords.Count > 0 ) { MovementRecord r = m_MoveRecords.Peek(); - if( r.Expired() ) + if ( r.Expired() ) m_MoveRecords.Dequeue(); else break; } - if( m_MoveRecords.Count >= m_FwdMaxSteps ) + if ( m_MoveRecords.Count >= m_FwdMaxSteps ) { FastWalkEventArgs fw = new FastWalkEventArgs( m_NetState ); EventSink.InvokeFastWalk( fw ); - if( fw.Blocked ) + if ( fw.Blocked ) return false; } @@ -3261,7 +3261,7 @@ namespace Server long end; - if( m_MoveRecords.Count > 0 ) + if ( m_MoveRecords.Count > 0 ) end = m_EndQueue + delay; else end = Core.TickCount + delay; @@ -3281,29 +3281,29 @@ namespace Server DisruptiveAction(); } - if( m_NetState != null ) + if ( m_NetState != null ) m_NetState.Send( MovementAck.Instantiate( m_NetState.Sequence, this ) );//new MovementAck( m_NetState.Sequence, this ) ); SetLocation( newLocation, false ); SetDirection( d ); - if( m_Map != null ) + if ( m_Map != null ) { IPooledEnumerable eable = m_Map.GetObjectsInRange( m_Location, Core.GlobalMaxUpdateRange ); foreach(IEntity o in eable) { - if(o == this) + if (o == this) continue; - if(o is Mobile) { + if (o is Mobile) { Mobile mob = o as Mobile; if (mob.NetState != null) m_MoveClientList.Add(mob); m_MoveList.Add(o); - } else if(o is Item) { + } else if (o is Item) { Item item = (Item)o; - if(item.HandlesOnMovement) + if (item.HandlesOnMovement) m_MoveList.Add(item); } } @@ -3349,9 +3349,9 @@ namespace Server for( int i = 0; i < m_MoveList.Count; ++i ) { IEntity o = m_MoveList[i]; - if(o is Mobile) { + if (o is Mobile) { ((Mobile)o).OnMovement( this, oldLocation ); - } else if( o is Item ) { + } else if ( o is Item ) { ((Item)o).OnMovement( this, oldLocation ); } } @@ -3385,7 +3385,7 @@ namespace Server { int delay; - if( Mounted ) + if ( Mounted ) delay = (dir & Direction.Running) != 0 ? m_RunMount : m_WalkMount; else delay = (dir & Direction.Running) != 0 ? m_RunFoot : m_WalkFoot; @@ -3410,7 +3410,7 @@ namespace Server /// True if the move is allowed, false if not. public virtual bool OnMoveOver( Mobile m ) { - if( m_Map == null || m_Deleted ) + if ( m_Map == null || m_Deleted ) return true; return m.CheckShove( this ); @@ -3418,26 +3418,26 @@ namespace Server public virtual bool CheckShove( Mobile shoved ) { - if( (m_Map.Rules & MapRules.FreeMovement) == 0 ) + if ( (m_Map.Rules & MapRules.FreeMovement) == 0 ) { - if( !shoved.Alive || !Alive || shoved.IsDeadBondedPet || IsDeadBondedPet ) + if ( !shoved.Alive || !Alive || shoved.IsDeadBondedPet || IsDeadBondedPet ) return true; - else if( shoved.m_Hidden && shoved.m_AccessLevel > AccessLevel.Player ) + else if ( shoved.m_Hidden && shoved.m_AccessLevel > AccessLevel.Player ) return true; - if( !m_Pushing ) + if ( !m_Pushing ) { m_Pushing = true; int number; - if( this.AccessLevel > AccessLevel.Player ) + if ( this.AccessLevel > AccessLevel.Player ) { number = shoved.m_Hidden ? 1019041 : 1019040; } else { - if( Stam == StamMax ) + if ( Stam == StamMax ) { number = shoved.m_Hidden ? 1019043 : 1019042; Stam -= 10; @@ -3471,7 +3471,7 @@ namespace Server } set { - if( m_Spell != null && value != null ) + if ( m_Spell != null && value != null ) Console.WriteLine( "Warning: Spell has been overwritten" ); m_Spell = value; @@ -3493,7 +3493,7 @@ namespace Server public virtual void CriminalAction( bool message ) { - if( m_Deleted ) + if ( m_Deleted ) return; Criminal = true; @@ -3533,19 +3533,19 @@ namespace Server public virtual void Resurrect() { - if( !Alive ) + if ( !Alive ) { - if( !Region.OnResurrect( this ) ) + if ( !Region.OnResurrect( this ) ) return; - if( !CheckResurrect() ) + if ( !CheckResurrect() ) return; OnBeforeResurrect(); BankBox box = FindBankNoCreate(); - if( box != null && box.Opened ) + if ( box != null && box.Opened ) box.Close(); Poison = null; @@ -3563,12 +3563,12 @@ namespace Server for( int i = m_Items.Count - 1; i >= 0; --i ) { - if( i >= m_Items.Count ) + if ( i >= m_Items.Count ) continue; Item item = m_Items[i]; - if( item.ItemID == 0x204E ) + if ( item.ItemID == 0x204E ) item.Delete(); } @@ -3615,7 +3615,7 @@ namespace Server } set { - if( m_VirtualArmor != value ) + if ( m_VirtualArmor != value ) { m_VirtualArmor = value; @@ -3637,7 +3637,7 @@ namespace Server { Item holding = m_Holding; - if( holding != null ) + if ( holding != null ) { if ( !holding.Deleted && holding.HeldBy == this && holding.Map == Map.Internal ) AddToBackpack( holding ); @@ -3649,15 +3649,15 @@ namespace Server public virtual void Delete() { - if( m_Deleted ) + if ( m_Deleted ) return; - else if( !World.OnDelete( this ) ) + else if ( !World.OnDelete( this ) ) return; - if( m_NetState != null ) + if ( m_NetState != null ) m_NetState.CancelAllTrades(); - if( m_NetState != null ) + if ( m_NetState != null ) m_NetState.Dispose(); DropHolding(); @@ -3672,7 +3672,7 @@ namespace Server OnDelete(); for( int i = m_Items.Count - 1; i >= 0; --i ) - if( i < m_Items.Count ) + if ( i < m_Items.Count ) m_Items[i].OnParentDeleted( this ); for( int i = 0; i < m_Stabled.Count; i++ ) @@ -3680,12 +3680,12 @@ namespace Server SendRemovePacket(); - if( m_Guild != null ) + if ( m_Guild != null ) m_Guild.OnDelete( this ); m_Deleted = true; - if( m_Map != null ) + if ( m_Map != null ) { m_Map.OnLeave( this ); m_Map = null; @@ -3707,7 +3707,7 @@ namespace Server /// public virtual void OnDelete() { - if( m_Spawner != null ) + if ( m_Spawner != null ) { m_Spawner.Remove( this ); m_Spawner = null; @@ -3762,40 +3762,40 @@ namespace Server CheckAggrExpire(); - if( m_PoisonTimer != null ) + if ( m_PoisonTimer != null ) m_PoisonTimer.Stop(); - if( m_HitsTimer != null ) + if ( m_HitsTimer != null ) m_HitsTimer.Stop(); - if( m_StamTimer != null ) + if ( m_StamTimer != null ) m_StamTimer.Stop(); - if( m_ManaTimer != null ) + if ( m_ManaTimer != null ) m_ManaTimer.Stop(); - if( m_CombatTimer != null ) + if ( m_CombatTimer != null ) m_CombatTimer.Stop(); - if( m_ExpireCombatant != null ) + if ( m_ExpireCombatant != null ) m_ExpireCombatant.Stop(); - if( m_LogoutTimer != null ) + if ( m_LogoutTimer != null ) m_LogoutTimer.Stop(); - if( m_ExpireCriminal != null ) + if ( m_ExpireCriminal != null ) m_ExpireCriminal.Stop(); - if( m_WarmodeTimer != null ) + if ( m_WarmodeTimer != null ) m_WarmodeTimer.Stop(); - if( m_ParaTimer != null ) + if ( m_ParaTimer != null ) m_ParaTimer.Stop(); - if( m_FrozenTimer != null ) + if ( m_FrozenTimer != null ) m_FrozenTimer.Stop(); - if( m_AutoManifestTimer != null ) + if ( m_AutoManifestTimer != null ) m_AutoManifestTimer.Stop(); } @@ -3836,30 +3836,30 @@ namespace Server public virtual void Kill() { - if( !CanBeDamaged() ) + if ( !CanBeDamaged() ) return; - else if( !Alive || IsDeadBondedPet ) + else if ( !Alive || IsDeadBondedPet ) return; - else if( m_Deleted ) + else if ( m_Deleted ) return; - else if( !Region.OnBeforeDeath( this ) ) + else if ( !Region.OnBeforeDeath( this ) ) return; - else if( !OnBeforeDeath() ) + else if ( !OnBeforeDeath() ) return; BankBox box = FindBankNoCreate(); - if( box != null && box.Opened ) + if ( box != null && box.Opened ) box.Close(); - if( m_NetState != null ) + if ( m_NetState != null ) m_NetState.CancelAllTrades(); - if( m_Spell != null ) + if ( m_Spell != null ) m_Spell.OnCasterKilled(); //m_Spell.Disturb( DisturbType.Kill ); - if( m_Target != null ) + if ( m_Target != null ) m_Target.Cancel( this, TargetCancelType.Canceled ); DisruptiveAction(); @@ -3875,19 +3875,19 @@ namespace Server Poison = null; Combatant = null; - if( Paralyzed ) + if ( Paralyzed ) { Paralyzed = false; - if( m_ParaTimer != null ) + if ( m_ParaTimer != null ) m_ParaTimer.Stop(); } - if( Frozen ) + if ( Frozen ) { Frozen = false; - if( m_FrozenTimer != null ) + if ( m_FrozenTimer != null ) m_FrozenTimer.Stop(); } @@ -3903,7 +3903,7 @@ namespace Server { Item item = itemsCopy[i]; - if( item == pack ) + if ( item == pack ) continue; DeathMoveResult res = GetParentMoveResultFor( item ); @@ -3924,7 +3924,7 @@ namespace Server } } - if( pack != null ) + if ( pack != null ) { List packCopy = new List( pack.Items ); @@ -3934,7 +3934,7 @@ namespace Server DeathMoveResult res = GetInventoryMoveResultFor( item ); - if( res == DeathMoveResult.MoveToCorpse ) + if ( res == DeathMoveResult.MoveToCorpse ) content.Add( item ); else moveToPack.Add( item ); @@ -3944,7 +3944,7 @@ namespace Server { Item item = moveToPack[i]; - if( RetainPackLocsOnDeath && item.Parent == pack ) + if ( RetainPackLocsOnDeath && item.Parent == pack ) continue; pack.DropItem( item ); @@ -3952,11 +3952,11 @@ namespace Server } HairInfo hair = null; - if( m_Hair != null ) + if ( m_Hair != null ) hair = new HairInfo( m_Hair.ItemID, m_Hair.Hue ); FacialHairInfo facialhair = null; - if( m_FacialHair != null ) + if ( m_FacialHair != null ) facialhair = new FacialHairInfo( m_FacialHair.ItemID, m_FacialHair.Hue ); Container c = (m_CreateCorpse == null ? null : m_CreateCorpse( this, hair, facialhair, content, equip )); @@ -3970,20 +3970,20 @@ namespace Server if ( c != null ) c.MoveToWorld( this.Location, this.Map );*/ - if( m_Map != null ) + if ( m_Map != null ) { Packet animPacket = null; IPooledEnumerable eable = m_Map.GetClientsInRange(m_Location); foreach( NetState state in eable ) { - if( state != m_NetState ) { + if ( state != m_NetState ) { if (animPacket == null) animPacket = Packet.Acquire( new DeathAnimation( this, c ) );; state.Send( animPacket ); - if( !state.Mobile.CanSee( this ) ) { + if ( !state.Mobile.CanSee( this ) ) { state.Send( this.RemovePacket ); } } @@ -4033,10 +4033,10 @@ namespace Server { int sound = this.GetDeathSound(); - if( sound >= 0 ) + if ( sound >= 0 ) Effects.PlaySound( this, this.Map, sound ); - if( !m_Player ) + if ( !m_Player ) { Delete(); } @@ -4081,7 +4081,7 @@ namespace Server public virtual int GetAngerSound() { - if( m_BaseSoundID != 0 ) + if ( m_BaseSoundID != 0 ) return m_BaseSoundID; return -1; @@ -4089,7 +4089,7 @@ namespace Server public virtual int GetIdleSound() { - if( m_BaseSoundID != 0 ) + if ( m_BaseSoundID != 0 ) return m_BaseSoundID + 1; return -1; @@ -4097,7 +4097,7 @@ namespace Server public virtual int GetAttackSound() { - if( m_BaseSoundID != 0 ) + if ( m_BaseSoundID != 0 ) return m_BaseSoundID + 2; return -1; @@ -4105,7 +4105,7 @@ namespace Server public virtual int GetHurtSound() { - if( m_BaseSoundID != 0 ) + if ( m_BaseSoundID != 0 ) return m_BaseSoundID + 3; return -1; @@ -4113,11 +4113,11 @@ namespace Server public virtual int GetDeathSound() { - if( m_BaseSoundID != 0 ) + if ( m_BaseSoundID != 0 ) { return m_BaseSoundID + 4; } - else if( m_Body.IsHuman ) + else if ( m_Body.IsHuman ) { return Utility.Random( m_Female ? 0x314 : 0x423, m_Female ? 4 : 5 ); } @@ -4155,7 +4155,7 @@ namespace Server protected override void OnTick() { - if( !m_Mobile.Alive ) + if ( !m_Mobile.Alive ) m_Mobile.Warmode = false; } } @@ -4175,68 +4175,68 @@ namespace Server public virtual void Use( Item item ) { - if( item == null || item.Deleted || item.QuestItem || this.Deleted ) + if ( item == null || item.Deleted || item.QuestItem || this.Deleted ) return; DisruptiveAction(); - if( m_Spell != null && !m_Spell.OnCasterUsingObject( item ) ) + if ( m_Spell != null && !m_Spell.OnCasterUsingObject( item ) ) return; object root = item.RootParent; bool okay = false; - if( !Utility.InUpdateRange( this, item.GetWorldLocation() ) ) + if ( !Utility.InUpdateRange( this, item.GetWorldLocation() ) ) item.OnDoubleClickOutOfRange( this ); - else if( !CanSee( item ) ) + else if ( !CanSee( item ) ) item.OnDoubleClickCantSee( this ); - else if( !item.IsAccessibleTo( this ) ) + else if ( !item.IsAccessibleTo( this ) ) { Region reg = Region.Find( item.GetWorldLocation(), item.Map ); - if( reg == null || !reg.SendInaccessibleMessage( item, this ) ) + if ( reg == null || !reg.SendInaccessibleMessage( item, this ) ) item.OnDoubleClickNotAccessible( this ); } - else if( !CheckAlive( false ) ) + else if ( !CheckAlive( false ) ) item.OnDoubleClickDead( this ); - else if( item.InSecureTrade ) + else if ( item.InSecureTrade ) item.OnDoubleClickSecureTrade( this ); - else if( !AllowItemUse( item ) ) + else if ( !AllowItemUse( item ) ) okay = false; - else if( !item.CheckItemUse( this, item ) ) + else if ( !item.CheckItemUse( this, item ) ) okay = false; - else if( root != null && root is Mobile && ((Mobile)root).IsSnoop( this ) ) + else if ( root != null && root is Mobile && ((Mobile)root).IsSnoop( this ) ) item.OnSnoop( this ); - else if( this.Region.OnDoubleClick( this, item ) ) + else if ( this.Region.OnDoubleClick( this, item ) ) okay = true; - if( okay ) + if ( okay ) { - if( !item.Deleted ) + if ( !item.Deleted ) item.OnItemUsed( this, item ); - if( !item.Deleted ) + if ( !item.Deleted ) item.OnDoubleClick( this ); } } public virtual void Use( Mobile m ) { - if( m == null || m.Deleted || this.Deleted ) + if ( m == null || m.Deleted || this.Deleted ) return; DisruptiveAction(); - if( m_Spell != null && !m_Spell.OnCasterUsingObject( m ) ) + if ( m_Spell != null && !m_Spell.OnCasterUsingObject( m ) ) return; - if( !Utility.InUpdateRange( this, m ) ) + if ( !Utility.InUpdateRange( this, m ) ) m.OnDoubleClickOutOfRange( this ); - else if( !CanSee( m ) ) + else if ( !CanSee( m ) ) m.OnDoubleClickCantSee( this ); - else if( !CheckAlive( false ) ) + else if ( !CheckAlive( false ) ) m.OnDoubleClickDead( this ); - else if( this.Region.OnDoubleClick( this, m ) && !m.Deleted ) + else if ( this.Region.OnDoubleClick( this, m ) && !m.Deleted ) m.OnDoubleClick( this ); } @@ -4253,7 +4253,7 @@ namespace Server rejected = true; reject = LRReason.Inspecific; - if( item == null ) + if ( item == null ) return; Mobile from = this; @@ -4261,53 +4261,53 @@ namespace Server if (from.AccessLevel >= AccessLevel.GameMaster || Core.TickCount - from.NextActionTime >= 0) { - if( from.CheckAlive() ) + if ( from.CheckAlive() ) { from.DisruptiveAction(); - if( from.Holding != null ) + if ( from.Holding != null ) { reject = LRReason.AreHolding; } - else if( from.AccessLevel < AccessLevel.GameMaster && !from.InRange( item.GetWorldLocation(), 2 ) ) + else if ( from.AccessLevel < AccessLevel.GameMaster && !from.InRange( item.GetWorldLocation(), 2 ) ) { reject = LRReason.OutOfRange; } - else if( !from.CanSee( item ) || !from.InLOS( item ) ) + else if ( !from.CanSee( item ) || !from.InLOS( item ) ) { reject = LRReason.OutOfSight; } - else if( !item.VerifyMove( from ) ) + else if ( !item.VerifyMove( from ) ) { reject = LRReason.CannotLift; } - else if( !item.IsAccessibleTo( from ) ) + else if ( !item.IsAccessibleTo( from ) ) { reject = LRReason.CannotLift; } - else if( item.Nontransferable && amount != item.Amount ) + else if ( item.Nontransferable && amount != item.Amount ) { if ( item.QuestItem ) from.SendLocalizedMessage( 1074868 ); // Stacks of quest items cannot be unstacked. reject = LRReason.CannotLift; } - else if( !item.CheckLift( from, item, ref reject ) ) + else if ( !item.CheckLift( from, item, ref reject ) ) { } else { object root = item.RootParent; - if( root != null && root is Mobile && !((Mobile)root).CheckNonlocalLift( from, item ) ) + if ( root != null && root is Mobile && !((Mobile)root).CheckNonlocalLift( from, item ) ) { reject = LRReason.TryToSteal; } - else if( !from.OnDragLift( item ) || !item.OnDragLift( from ) ) + else if ( !from.OnDragLift( item ) || !item.OnDragLift( from ) ) { reject = LRReason.Inspecific; } - else if( !from.CheckAlive() ) + else if ( !from.CheckAlive() ) { reject = LRReason.Inspecific; } @@ -4315,34 +4315,34 @@ namespace Server { item.SetLastMoved(); - if( item.Spawner != null ) + if ( item.Spawner != null ) { item.Spawner.Remove( item ); item.Spawner = null; } - if( amount == 0 ) + if ( amount == 0 ) amount = 1; - if( amount > item.Amount ) + if ( amount > item.Amount ) amount = item.Amount; int oldAmount = item.Amount; //item.Amount = amount; //Set in LiftItemDupe - if( amount < oldAmount ) + if ( amount < oldAmount ) LiftItemDupe( item, amount ); //item.Dupe( oldAmount - amount ); Map map = from.Map; - if( m_DragEffects && map != null && (root == null || root is Item) ) + if ( m_DragEffects && map != null && (root == null || root is Item) ) { IPooledEnumerable eable = map.GetClientsInRange(from.Location); Packet p = null; foreach( NetState ns in eable ) { - if( ns.Mobile != from && ns.Mobile.CanSee( from ) && ns.Mobile.InLOS( from ) && ns.Mobile.CanSee( root ) ) { + if ( ns.Mobile != from && ns.Mobile.CanSee( from ) && ns.Mobile.InLOS( from ) && ns.Mobile.CanSee( root ) ) { if (p == null) { IEntity src; @@ -4375,12 +4375,12 @@ namespace Server int liftSound = item.GetLiftSound( from ); - if( liftSound != -1 ) + if ( liftSound != -1 ) from.Send( new PlaySound( liftSound, from ) ); from.NextActionTime = Core.TickCount + m_ActionDelay; - if( fixMap != null && shouldFix ) + if ( fixMap != null && shouldFix ) fixMap.FixColumn( fixLoc.m_X, fixLoc.m_Y ); reject = LRReason.Inspecific; @@ -4399,24 +4399,24 @@ namespace Server reject = LRReason.Inspecific; } - if( rejected && state != null ) + if ( rejected && state != null ) { state.Send( new LiftRej( reject ) ); - if( item.Deleted ) + if ( item.Deleted ) return; - if( item.Parent is Item ) { + if ( item.Parent is Item ) { if ( state.ContainerGridLines ) state.Send( new ContainerContentUpdate6017( item ) ); else state.Send( new ContainerContentUpdate( item ) ); - } else if( item.Parent is Mobile ) + } else if ( item.Parent is Mobile ) state.Send( new EquipUpdate( item ) ); else item.SendInfoTo( state ); - if( ObjectPropertyList.Enabled && item.Parent != null ) + if ( ObjectPropertyList.Enabled && item.Parent != null ) state.Send( item.OPLPacket ); } } @@ -4450,11 +4450,11 @@ namespace Server oldItem.Amount = amount; oldItem.OnAfterDuped( item ); - if( oldItem.Parent is Mobile ) + if ( oldItem.Parent is Mobile ) { ((Mobile)oldItem.Parent).AddItem( item ); } - else if( oldItem.Parent is Item ) + else if ( oldItem.Parent is Item ) { ((Item)oldItem.Parent).AddItem( item ); } @@ -4466,12 +4466,12 @@ namespace Server public virtual void SendDropEffect( Item item ) { - if( m_DragEffects && !item.Deleted ) + if ( m_DragEffects && !item.Deleted ) { Map map = m_Map; object root = item.RootParent; - if( map != null && (root == null || root is Item) ) + if ( map != null && (root == null || root is Item) ) { IPooledEnumerable eable = map.GetClientsInRange(m_Location); Packet p = null; @@ -4480,7 +4480,7 @@ namespace Server if (ns.StygianAbyss) continue; - if( ns.Mobile != this && ns.Mobile.CanSee( this ) && ns.Mobile.InLOS( this ) && ns.Mobile.CanSee( root ) ) { + if ( ns.Mobile != this && ns.Mobile.CanSee( this ) && ns.Mobile.InLOS( this ) && ns.Mobile.CanSee( root ) ) { if (p == null) { IEntity trg; @@ -4520,14 +4520,14 @@ namespace Server item.SetLastMoved(); - if( to == null || !item.DropToItem( from, to, loc ) ) + if ( to == null || !item.DropToItem( from, to, loc ) ) item.Bounce( from ); else bounced = false; item.ClearBounce(); - if( !bounced ) + if ( !bounced ) SendDropEffect( item ); return !bounced; @@ -4550,14 +4550,14 @@ namespace Server item.SetLastMoved(); - if( !item.DropToWorld( from, loc ) ) + if ( !item.DropToWorld( from, loc ) ) item.Bounce( from ); else bounced = false; item.ClearBounce(); - if( !bounced ) + if ( !bounced ) SendDropEffect( item ); return !bounced; @@ -4580,14 +4580,14 @@ namespace Server item.SetLastMoved(); - if( to == null || !item.DropToMobile( from, to, loc ) ) + if ( to == null || !item.DropToMobile( from, to, loc ) ) item.Bounce( from ); else bounced = false; item.ClearBounce(); - if( !bounced ) + if ( !bounced ) SendDropEffect( item ); return !bounced; @@ -4597,14 +4597,14 @@ namespace Server public virtual bool MutateSpeech( List hears, ref string text, ref object context ) { - if( Alive ) + if ( Alive ) return false; StringBuilder sb = new StringBuilder( text.Length, text.Length ); for( int i = 0; i < text.Length; ++i ) { - if( text[i] != ' ' ) + if ( text[i] != ' ' ) sb.Append( m_GhostChars[Utility.Random( m_GhostChars.Length )] ); else sb.Append( ' ' ); @@ -4619,7 +4619,7 @@ namespace Server { Warmode = true; - if( m_AutoManifestTimer == null ) + if ( m_AutoManifestTimer == null ) m_AutoManifestTimer = new AutoManifestTimer( this, delay ); else m_AutoManifestTimer.Stop(); @@ -4629,12 +4629,12 @@ namespace Server public virtual bool CheckSpeechManifest() { - if( Alive ) + if ( Alive ) return false; TimeSpan delay = m_AutoManifestTimeout; - if( delay > TimeSpan.Zero && (!Warmode || m_AutoManifestTimer != null) ) + if ( delay > TimeSpan.Zero && (!Warmode || m_AutoManifestTimer != null) ) { Manifest( delay ); return true; @@ -4645,7 +4645,7 @@ namespace Server public virtual bool CheckHearsMutatedSpeech( Mobile m, object context ) { - if( context == m_GhostMutateContext ) + if ( context == m_GhostMutateContext ) return (m.Alive && !m.CanHearGhosts); return true; @@ -4656,10 +4656,10 @@ namespace Server for(int i = 0; i < cont.Items.Count; ++i) { Item item = cont.Items[i]; - if(item.HandlesOnSpeech) + if (item.HandlesOnSpeech) list.Add( item ); - if(item is Container) + if (item is Container) AddSpeechItemsFrom(list, (Container)item); } } @@ -4670,7 +4670,7 @@ namespace Server public static LocationComparer GetInstance(IEntity relativeTo) { - if( m_Instance == null ) + if ( m_Instance == null ) m_Instance = new LocationComparer(relativeTo); else m_Instance.m_RelativeTo = relativeTo; @@ -4718,7 +4718,7 @@ namespace Server { Map map = m_Map; - if( map == null ) + if ( map == null ) return Server.Map.NullEnumerable.Instance; return map.GetItemsInRange( m_Location, range ); @@ -4728,7 +4728,7 @@ namespace Server { Map map = m_Map; - if( map == null ) + if ( map == null ) return Server.Map.NullEnumerable.Instance; return map.GetObjectsInRange( m_Location, range ); @@ -4752,7 +4752,7 @@ namespace Server { Map map = m_Map; - if( map == null ) + if ( map == null ) return Server.Map.NullEnumerable.Instance; return map.GetClientsInRange( m_Location, range ); @@ -4765,7 +4765,7 @@ namespace Server public virtual void DoSpeech( string text, int[] keywords, MessageType type, int hue ) { - if( m_Deleted || CommandSystem.Handle( this, text, type ) ) + if ( m_Deleted || CommandSystem.Handle( this, text, type ) ) return; int range = 15; @@ -4797,51 +4797,51 @@ namespace Server this.Region.OnSpeech( regArgs ); OnSaid( regArgs ); - if( regArgs.Blocked ) + if ( regArgs.Blocked ) return; text = regArgs.Speech; - if( string.IsNullOrEmpty( text ) ) + if ( string.IsNullOrEmpty( text ) ) return; List hears = m_Hears; List onSpeech = m_OnSpeech; - if( m_Map != null ) + if ( m_Map != null ) { IPooledEnumerable eable = m_Map.GetObjectsInRange( m_Location, range ); foreach(IEntity o in eable) { - if( o is Mobile ) { + if ( o is Mobile ) { Mobile heard = (Mobile)o; - if( heard.CanSee( this ) && (m_NoSpeechLOS || !heard.Player || heard.InLOS( this )) ) + if ( heard.CanSee( this ) && (m_NoSpeechLOS || !heard.Player || heard.InLOS( this )) ) { - if( heard.m_NetState != null ) + if ( heard.m_NetState != null ) hears.Add( heard ); - if( heard.HandlesOnSpeech( this ) ) + if ( heard.HandlesOnSpeech( this ) ) onSpeech.Add( heard ); for( int i = 0; i < heard.Items.Count; ++i ) { Item item = heard.Items[i]; - if( item.HandlesOnSpeech ) + if ( item.HandlesOnSpeech ) onSpeech.Add( item ); - if( item is Container ) + if ( item is Container ) AddSpeechItemsFrom( onSpeech, (Container)item ); } } } - else if( o is Item ) + else if ( o is Item ) { - if( ((Item)o).HandlesOnSpeech ) + if ( ((Item)o).HandlesOnSpeech ) onSpeech.Add(o); - if( o is Container ) + if ( o is Container ) AddSpeechItemsFrom( onSpeech, (Container)o ); } } @@ -4852,7 +4852,7 @@ namespace Server string mutatedText = text; SpeechEventArgs mutatedArgs = null; - if( MutateSpeech( hears, ref mutatedText, ref mutateContext ) ) + if ( MutateSpeech( hears, ref mutatedText, ref mutateContext ) ) mutatedArgs = new SpeechEventArgs( this, mutatedText, type, hue, new int[0] ); CheckSpeechManifest(); @@ -4867,13 +4867,13 @@ namespace Server for( int i = 0; i < hears.Count; ++i ) { Mobile heard = hears[i]; - if( mutatedArgs == null || !CheckHearsMutatedSpeech( heard, mutateContext ) ) { + if ( mutatedArgs == null || !CheckHearsMutatedSpeech( heard, mutateContext ) ) { heard.OnSpeech( regArgs ); NetState ns = heard.NetState; - if( ns != null ) { - if( regp == null ) + if ( ns != null ) { + if ( regp == null ) regp = Packet.Acquire( new UnicodeMessage( m_Serial, Body, type, hue, 3, m_Language, Name, text ) ); ns.Send( regp ); @@ -4883,8 +4883,8 @@ namespace Server NetState ns = heard.NetState; - if( ns != null ) { - if( mutp == null ) + if ( ns != null ) { + if ( mutp == null ) mutp = Packet.Acquire( new UnicodeMessage( m_Serial, Body, type, hue, 3, m_Language, Name, mutatedText ) ); ns.Send( mutp ); @@ -4895,16 +4895,16 @@ namespace Server Packet.Release( regp ); Packet.Release( mutp ); - if( onSpeech.Count > 1 ) + if ( onSpeech.Count > 1 ) onSpeech.Sort( LocationComparer.GetInstance( this ) ); for( int i = 0; i < onSpeech.Count; ++i ) { IEntity obj = onSpeech[i]; - if( obj is Mobile ) { + if ( obj is Mobile ) { Mobile heard = (Mobile)obj; - if( mutatedArgs == null || !CheckHearsMutatedSpeech( heard, mutateContext ) ) + if ( mutatedArgs == null || !CheckHearsMutatedSpeech( heard, mutateContext ) ) heard.OnSpeech( regArgs ); else heard.OnSpeech( mutatedArgs ); @@ -4915,10 +4915,10 @@ namespace Server } } - if(m_Hears.Count > 0) + if (m_Hears.Count > 0) m_Hears.Clear(); - if(m_OnSpeech.Count > 0) + if (m_OnSpeech.Count > 0) m_OnSpeech.Clear(); } } @@ -4952,14 +4952,14 @@ namespace Server { for( int i = m_DamageEntries.Count - 1; i >= 0; --i ) { - if( i >= m_DamageEntries.Count ) + if ( i >= m_DamageEntries.Count ) continue; DamageEntry de = m_DamageEntries[i]; - if( de.HasExpired ) + if ( de.HasExpired ) m_DamageEntries.RemoveAt( i ); - else if( allowSelf || de.Damager != this ) + else if ( allowSelf || de.Damager != this ) return de; } @@ -4975,17 +4975,17 @@ namespace Server { for( int i = 0; i < m_DamageEntries.Count; ++i ) { - if( i < 0 ) + if ( i < 0 ) continue; DamageEntry de = m_DamageEntries[i]; - if( de.HasExpired ) + if ( de.HasExpired ) { m_DamageEntries.RemoveAt( i ); --i; } - else if( allowSelf || de.Damager != this ) + else if ( allowSelf || de.Damager != this ) { return de; } @@ -5005,14 +5005,14 @@ namespace Server for( int i = m_DamageEntries.Count - 1; i >= 0; --i ) { - if( i >= m_DamageEntries.Count ) + if ( i >= m_DamageEntries.Count ) continue; DamageEntry de = m_DamageEntries[i]; - if( de.HasExpired ) + if ( de.HasExpired ) m_DamageEntries.RemoveAt( i ); - else if( (allowSelf || de.Damager != this) && (mostTotal == null || de.DamageGiven > mostTotal.DamageGiven) ) + else if ( (allowSelf || de.Damager != this) && (mostTotal == null || de.DamageGiven > mostTotal.DamageGiven) ) mostTotal = de; } @@ -5030,14 +5030,14 @@ namespace Server for( int i = m_DamageEntries.Count - 1; i >= 0; --i ) { - if( i >= m_DamageEntries.Count ) + if ( i >= m_DamageEntries.Count ) continue; DamageEntry de = m_DamageEntries[i]; - if( de.HasExpired ) + if ( de.HasExpired ) m_DamageEntries.RemoveAt( i ); - else if( (allowSelf || de.Damager != this) && (mostTotal == null || de.DamageGiven < mostTotal.DamageGiven) ) + else if ( (allowSelf || de.Damager != this) && (mostTotal == null || de.DamageGiven < mostTotal.DamageGiven) ) mostTotal = de; } @@ -5048,14 +5048,14 @@ namespace Server { for( int i = m_DamageEntries.Count - 1; i >= 0; --i ) { - if( i >= m_DamageEntries.Count ) + if ( i >= m_DamageEntries.Count ) continue; DamageEntry de = m_DamageEntries[i]; - if( de.HasExpired ) + if ( de.HasExpired ) m_DamageEntries.RemoveAt( i ); - else if( de.Damager == m ) + else if ( de.Damager == m ) return de; } @@ -5071,7 +5071,7 @@ namespace Server { DamageEntry de = FindDamageEntryFor( from ); - if( de == null ) + if ( de == null ) de = new DamageEntry( from ); de.DamageGiven += amount; @@ -5082,11 +5082,11 @@ namespace Server Mobile master = from.GetDamageMaster( this ); - if( master != null ) + if ( master != null ) { List list = de.Responsible; - if( list == null ) + if ( list == null ) de.Responsible = list = new List(); DamageEntry resp = null; @@ -5095,14 +5095,14 @@ namespace Server { DamageEntry check = list[i]; - if( check.Damager == master ) + if ( check.Damager == master ) { resp = check; break; } } - if( resp == null ) + if ( resp == null ) list.Add( resp = new DamageEntry( master ) ); resp.DamageGiven += amount; @@ -5148,24 +5148,24 @@ namespace Server public virtual void Damage( int amount, Mobile from, bool informMount ) { - if( !CanBeDamaged() || m_Deleted ) + if ( !CanBeDamaged() || m_Deleted ) return; - if( !this.Region.OnDamage( this, ref amount ) ) + if ( !this.Region.OnDamage( this, ref amount ) ) return; - if( amount > 0 ) + if ( amount > 0 ) { int oldHits = Hits; int newHits = oldHits - amount; - if( m_Spell != null ) + if ( m_Spell != null ) m_Spell.OnCasterHurt(); //if ( m_Spell != null && m_Spell.State == SpellState.Casting ) // m_Spell.Disturb( DisturbType.Hurt, false, true ); - if( from != null ) + if ( from != null ) RegisterDamage( amount, from ); DisruptiveAction(); @@ -5194,16 +5194,16 @@ namespace Server OnDamage( amount, from, newHits < 0 ); IMount m = this.Mount; - if( m != null && informMount ) + if ( m != null && informMount ) m.OnRiderDamaged( amount, from, newHits < 0 ); - if( newHits < 0 ) + if ( newHits < 0 ) { m_LastKiller = from; Hits = 0; - if( oldHits >= 0 ) + if ( oldHits >= 0 ) Kill(); } else @@ -5271,12 +5271,12 @@ namespace Server public void SendVisibleDamageEveryone(int amount) { - if( amount < 0 ) + if ( amount < 0 ) return; Map map = m_Map; - if( map == null ) + if ( map == null ) return; IPooledEnumerable eable = map.GetClientsInRange(m_Location); @@ -5285,14 +5285,14 @@ namespace Server Packet pOld = null; foreach( NetState ns in eable ) { - if( ns.Mobile.CanSee( this ) ) { - if( ns.DamagePacket ) { - if( pNew == null ) + if ( ns.Mobile.CanSee( this ) ) { + if ( ns.DamagePacket ) { + if ( pNew == null ) pNew = Packet.Acquire( new DamagePacket( this, amount ) ); ns.Send( pNew ); } else { - if( pOld == null ) + if ( pOld == null ) pOld = Packet.Acquire( new DamagePacketOld( this, amount ) ); ns.Send( pOld ); @@ -5378,22 +5378,22 @@ namespace Server public void Heal( int amount, Mobile from, bool message ) { - if( !Alive || IsDeadBondedPet ) + if ( !Alive || IsDeadBondedPet ) return; - if( !Region.OnHeal( this, ref amount ) ) + if ( !Region.OnHeal( this, ref amount ) ) return; OnHeal( ref amount, from ); - if( (Hits + amount) > HitsMax ) + if ( (Hits + amount) > HitsMax ) { amount = HitsMax - Hits; } Hits += amount; - if( message && amount > 0 && m_NetState != null ) + if ( message && amount > 0 && m_NetState != null ) m_NetState.Send( new MessageLocalizedAffix( Serial.MinusOne, -1, MessageType.Label, 0x3B2, 3, 1008158, "", AffixType.Append | AffixType.System, amount.ToString(), "" ) ); } @@ -5437,9 +5437,9 @@ namespace Server { byte hairflag = reader.ReadByte(); - if( (hairflag & 0x01) != 0 ) + if ( (hairflag & 0x01) != 0 ) m_Hair = new HairInfo( reader ); - if( (hairflag & 0x02) != 0 ) + if ( (hairflag & 0x02) != 0 ) m_FacialHair = new FacialHairInfo( reader ); goto case 29; @@ -5451,7 +5451,7 @@ namespace Server } case 28: { - if( version <= 30 ) + if ( version <= 30 ) LastStatGain = reader.ReadDeltaTime(); goto case 27; @@ -5507,7 +5507,7 @@ namespace Server { m_ShortTermMurders = reader.ReadInt(); - if( version <= 24 ) + if ( version <= 24 ) { reader.ReadDateTime(); reader.ReadDateTime(); @@ -5517,7 +5517,7 @@ namespace Server } case 15: { - if( version < 22 ) + if ( version < 22 ) reader.ReadInt(); // followers m_FollowersMax = reader.ReadInt(); @@ -5587,7 +5587,7 @@ namespace Server } case 4: { - if( version <= 25 ) + if ( version <= 25 ) { Poison.Deserialize( reader ); } @@ -5614,19 +5614,19 @@ namespace Server } case 0: { - if( version < 21 ) + if ( version < 21 ) m_Stabled = new List(); - if( version < 18 ) + if ( version < 18 ) m_Virtues = new VirtueInfo(); - if( version < 11 ) + if ( version < 11 ) m_DisplayGuildTitle = true; - if( version < 3 ) + if ( version < 3 ) m_StatCap = 225; - if( version < 15 ) + if ( version < 15 ) { m_Followers = 0; m_FollowersMax = 5; @@ -5669,7 +5669,7 @@ namespace Server m_Profile = reader.ReadString(); m_ProfileLocked = reader.ReadBool(); - if( version <= 18 ) + if ( version <= 18 ) { reader.ReadInt(); reader.ReadInt(); @@ -5700,7 +5700,7 @@ namespace Server } } - if( m_Player && m_Map != Map.Internal ) + if ( m_Player && m_Map != Map.Internal ) { m_LogoutLocation = m_Location; m_LogoutMap = m_Map; @@ -5708,23 +5708,23 @@ namespace Server m_Map = Map.Internal; } - if( m_Map != null ) + if ( m_Map != null ) m_Map.OnEnter( this ); - if( m_Criminal ) + if ( m_Criminal ) { - if( m_ExpireCriminal == null ) + if ( m_ExpireCriminal == null ) m_ExpireCriminal = new ExpireCriminalTimer( this ); m_ExpireCriminal.Start(); } - if( ShouldCheckStatTimers ) + if ( ShouldCheckStatTimers ) CheckStatTimers(); - if( !m_Player && m_Dex <= 100 && m_CombatTimer != null ) + if ( !m_Player && m_Dex <= 100 && m_CombatTimer != null ) m_CombatTimer.Priority = TimerPriority.FiftyMS; - else if( m_CombatTimer != null ) + else if ( m_CombatTimer != null ) m_CombatTimer.Priority = TimerPriority.EveryTick; UpdateRegion(); @@ -5735,14 +5735,14 @@ namespace Server } } - if( !m_Player ) + if ( !m_Player ) Utility.Intern( ref m_Name ); Utility.Intern( ref m_Title ); Utility.Intern( ref m_Language ); /* //Moved into cleanup in scripts. - if( version < 30 ) + if ( version < 30 ) Timer.DelayCall( TimeSpan.Zero, new TimerCallback( ConvertHair ) ); * */ @@ -5752,14 +5752,14 @@ namespace Server { Item hair; - if( (hair = FindItemOnLayer( Layer.Hair )) != null ) + if ( (hair = FindItemOnLayer( Layer.Hair )) != null ) { HairItemID = hair.ItemID; HairHue = hair.Hue; hair.Delete(); } - if( (hair = FindItemOnLayer( Layer.FacialHair )) != null ) + if ( (hair = FindItemOnLayer( Layer.FacialHair )) != null ) { FacialHairItemID = hair.ItemID; FacialHairHue = hair.Hue; @@ -5771,19 +5771,19 @@ namespace Server public virtual void CheckStatTimers() { - if( m_Deleted ) + if ( m_Deleted ) return; - if( Hits < HitsMax ) + if ( Hits < HitsMax ) { - if( CanRegenHits ) + if ( CanRegenHits ) { - if( m_HitsTimer == null ) + if ( m_HitsTimer == null ) m_HitsTimer = new HitsTimer( this ); m_HitsTimer.Start(); } - else if( m_HitsTimer != null ) + else if ( m_HitsTimer != null ) { m_HitsTimer.Stop(); } @@ -5793,16 +5793,16 @@ namespace Server Hits = HitsMax; } - if( Stam < StamMax ) + if ( Stam < StamMax ) { - if( CanRegenStam ) + if ( CanRegenStam ) { - if( m_StamTimer == null ) + if ( m_StamTimer == null ) m_StamTimer = new StamTimer( this ); m_StamTimer.Start(); } - else if( m_StamTimer != null ) + else if ( m_StamTimer != null ) { m_StamTimer.Stop(); } @@ -5812,16 +5812,16 @@ namespace Server Stam = StamMax; } - if( Mana < ManaMax ) + if ( Mana < ManaMax ) { - if( CanRegenMana ) + if ( CanRegenMana ) { - if( m_ManaTimer == null ) + if ( m_ManaTimer == null ) m_ManaTimer = new ManaTimer( this ); m_ManaTimer.Start(); } - else if( m_ManaTimer != null ) + else if ( m_ManaTimer != null ) { m_ManaTimer.Stop(); } @@ -5863,16 +5863,16 @@ namespace Server byte hairflag = 0x00; - if( m_Hair != null ) + if ( m_Hair != null ) hairflag |= 0x01; - if( m_FacialHair != null ) + if ( m_FacialHair != null ) hairflag |= 0x02; writer.Write( (byte)hairflag ); - if( (hairflag & 0x01) != 0 ) + if ( (hairflag & 0x01) != 0 ) m_Hair.Serialize( writer ); - if( (hairflag & 0x02) != 0 ) + if ( (hairflag & 0x02) != 0 ) m_FacialHair.Serialize( writer ); writer.Write( this.Race ); @@ -5984,7 +5984,7 @@ namespace Server } set { - if( m_LightLevel != value ) + if ( m_LightLevel != value ) { m_LightLevel = value; @@ -6034,9 +6034,9 @@ namespace Server m_Player = value; InvalidateProperties(); - if( !m_Player && m_Dex <= 100 && m_CombatTimer != null ) + if ( !m_Player && m_Dex <= 100 && m_CombatTimer != null ) m_CombatTimer.Priority = TimerPriority.FiftyMS; - else if( m_CombatTimer != null ) + else if ( m_CombatTimer != null ) m_CombatTimer.Priority = TimerPriority.EveryTick; CheckStatTimers(); @@ -6084,13 +6084,13 @@ namespace Server public virtual void GetContextMenuEntries( Mobile from, List list ) { - if( m_Deleted ) + if ( m_Deleted ) return; - if( CanPaperdollBeOpenedBy( from ) ) + if ( CanPaperdollBeOpenedBy( from ) ) list.Add( new PaperdollEntry( this ) ); - if( from == this && Backpack != null && CanSee( Backpack ) && CheckAlive( false ) ) + if ( from == this && Backpack != null && CanSee( Backpack ) && CheckAlive( false ) ) list.Add( new OpenBackpackEntry( this ) ); } @@ -6155,14 +6155,14 @@ namespace Server public void AddItem( Item item ) { - if( item == null || item.Deleted ) + if ( item == null || item.Deleted ) return; - if( item.Parent == this ) + if ( item.Parent == this ) return; - else if( item.Parent is Mobile ) + else if ( item.Parent is Mobile ) ((Mobile)item.Parent).RemoveItem( item ); - else if( item.Parent is Item ) + else if ( item.Parent is Item ) ((Item)item.Parent).RemoveItem( item ); else item.SendRemovePacket(); @@ -6172,7 +6172,7 @@ namespace Server m_Items.Add( item ); - if( !item.IsVirtualItem ) + if ( !item.IsVirtualItem ) { UpdateTotal( item, TotalType.Gold, item.TotalGold ); UpdateTotal( item, TotalType.Items, item.TotalItems + 1 ); @@ -6184,7 +6184,7 @@ namespace Server item.OnAdded( this ); OnItemAdded( item ); - if( item.PhysicalResistance != 0 || item.FireResistance != 0 || item.ColdResistance != 0 || + if ( item.PhysicalResistance != 0 || item.FireResistance != 0 || item.ColdResistance != 0 || item.PoisonResistance != 0 || item.EnergyResistance != 0 ) UpdateResistances(); } @@ -6205,10 +6205,10 @@ namespace Server public void RemoveItem( Item item ) { - if( item == null || m_Items == null ) + if ( item == null || m_Items == null ) return; - if( m_Items.Contains( item ) ) + if ( m_Items.Contains( item ) ) { item.SendRemovePacket(); @@ -6216,7 +6216,7 @@ namespace Server m_Items.Remove( item ); - if( !item.IsVirtualItem ) + if ( !item.IsVirtualItem ) { UpdateTotal( item, TotalType.Gold, -item.TotalGold ); UpdateTotal( item, TotalType.Items, -(item.TotalItems + 1) ); @@ -6228,7 +6228,7 @@ namespace Server item.OnRemoved( this ); OnItemRemoved( item ); - if( item.PhysicalResistance != 0 || item.FireResistance != 0 || item.ColdResistance != 0 || + if ( item.PhysicalResistance != 0 || item.FireResistance != 0 || item.ColdResistance != 0 || item.PoisonResistance != 0 || item.EnergyResistance != 0 ) UpdateResistances(); } @@ -6238,7 +6238,7 @@ namespace Server { Map map = m_Map; - if( map != null ) + if ( map != null ) { ProcessDelta(); @@ -6248,11 +6248,11 @@ namespace Server IPooledEnumerable eable = map.GetClientsInRange(m_Location); foreach( NetState state in eable ) { - if( state.Mobile.CanSee( this ) ) { + if ( state.Mobile.CanSee( this ) ) { state.Mobile.ProcessDelta(); //if ( state.StygianAbyss ) { - //if( pNew == null ) + //if ( pNew == null ) //pNew = Packet.Acquire( new NewMobileAnimation( this, action, frameCount, delay ) ); //state.Send( pNew ); @@ -6326,29 +6326,29 @@ namespace Server public void SendSound( int soundID ) { - if( soundID != -1 && m_NetState != null ) + if ( soundID != -1 && m_NetState != null ) Send( new PlaySound( soundID, this ) ); } public void SendSound( int soundID, IPoint3D p ) { - if( soundID != -1 && m_NetState != null ) + if ( soundID != -1 && m_NetState != null ) Send( new PlaySound( soundID, p ) ); } public void PlaySound( int soundID ) { - if( soundID == -1 ) + if ( soundID == -1 ) return; - if( m_Map != null ) + if ( m_Map != null ) { Packet p = Packet.Acquire(new PlaySound(soundID, this)); IPooledEnumerable eable = m_Map.GetClientsInRange(m_Location); foreach( NetState state in eable ) { - if( state.Mobile.CanSee( this ) ) { + if ( state.Mobile.CanSee( this ) ) { state.Send( p ); } } @@ -6382,7 +6382,7 @@ namespace Server { AccessLevel oldValue = m_AccessLevel; - if( oldValue != value ) + if ( oldValue != value ) { m_AccessLevel = value; Delta( MobileDelta.Noto ); @@ -6413,11 +6413,11 @@ namespace Server { int oldValue = m_Fame; - if( oldValue != value ) + if ( oldValue != value ) { m_Fame = value; - if( ShowFameTitle && (m_Player || m_Body.IsHuman) && (oldValue >= 10000) != (value >= 10000) ) + if ( ShowFameTitle && (m_Player || m_Body.IsHuman) && (oldValue >= 10000) != (value >= 10000) ) InvalidateProperties(); OnFameChange( oldValue ); @@ -6440,7 +6440,7 @@ namespace Server { int old = m_Karma; - if( old != value ) + if ( old != value ) { m_Karma = value; OnKarmaChange( old ); @@ -6455,7 +6455,7 @@ namespace Server // Mobile did something which should unhide him public virtual void RevealingAction() { - if( m_Hidden && m_AccessLevel == AccessLevel.Player ) + if ( m_Hidden && m_AccessLevel == AccessLevel.Player ) Hidden = false; DisruptiveAction(); // Anything that unhides you will also distrupt meditation @@ -6592,7 +6592,7 @@ namespace Server } set { - if( m_Blessed != value ) + if ( m_Blessed != value ) { m_Blessed = value; Delta( MobileDelta.HealthbarYellow ); @@ -6607,12 +6607,12 @@ namespace Server public void SendRemovePacket( bool everyone ) { - if( m_Map != null ) + if ( m_Map != null ) { IPooledEnumerable eable = m_Map.GetClientsInRange(m_Location); foreach( NetState state in eable ) { - if( state != m_NetState && (everyone || !state.Mobile.CanSee( this )) ) + if ( state != m_NetState && (everyone || !state.Mobile.CanSee( this )) ) state.Send( this.RemovePacket ); } @@ -6624,20 +6624,20 @@ namespace Server { NetState ns = m_NetState; - if( m_Map != null && ns != null ) + if ( m_Map != null && ns != null ) { IPooledEnumerable eable = m_Map.GetObjectsInRange( m_Location, Core.GlobalMaxUpdateRange ); foreach ( IEntity o in eable ) { - if( o is Mobile ) { + if ( o is Mobile ) { Mobile m = (Mobile)o; - if( m != this && Utility.InUpdateRange( m_Location, m.m_Location ) ) + if ( m != this && Utility.InUpdateRange( m_Location, m.m_Location ) ) ns.Send( m.RemovePacket ); - } else if( o is Item ) { + } else if ( o is Item ) { Item item = (Item)o; - if( InRange( item.Location, item.GetUpdateRange( this ) ) ) + if ( InRange( item.Location, item.GetUpdateRange( this ) ) ) ns.Send( item.RemovePacket ); } } @@ -6792,9 +6792,9 @@ namespace Server /// public virtual void OnSaid( SpeechEventArgs e ) { - if( m_Squelched ) + if ( m_Squelched ) { - if( Core.ML ) + if ( Core.ML ) this.SendLocalizedMessage( 500168 ); // You can not say anything, you have been muted. else this.SendMessage( "You can not say anything, you have been squelched." ); //Cliloc ITSELF changed during ML. @@ -6802,7 +6802,7 @@ namespace Server e.Blocked = true; } - if( !e.Blocked ) + if ( !e.Blocked ) RevealingAction(); } @@ -6823,20 +6823,20 @@ namespace Server { NetState ns = m_NetState; - if( m_Map != null && ns != null ) + if ( m_Map != null && ns != null ) { IPooledEnumerable eable = m_Map.GetObjectsInRange( m_Location, Core.GlobalMaxUpdateRange ); foreach ( IEntity o in eable ) { - if( o is Item ) { + if ( o is Item ) { Item item = (Item)o; - if( CanSee( item ) && InRange( item.Location, item.GetUpdateRange( this ) ) ) + if ( CanSee( item ) && InRange( item.Location, item.GetUpdateRange( this ) ) ) item.SendInfoTo( ns ); - } else if( o is Mobile ) { + } else if ( o is Mobile ) { Mobile m = (Mobile)o; - if( CanSee( m ) && Utility.InUpdateRange( m_Location, m.m_Location ) ) + if ( CanSee( m ) && Utility.InUpdateRange( m_Location, m.m_Location ) ) { ns.Send(MobileIncoming.Create(ns, this, m)); @@ -6848,10 +6848,10 @@ namespace Server ns.Send( new HealthbarYellow( m ) ); } - if( m.IsDeadBondedPet ) + if ( m.IsDeadBondedPet ) ns.Send( new BondedStatus( 0, m.m_Serial, 1 ) ); - if( ObjectPropertyList.Enabled ) + if ( ObjectPropertyList.Enabled ) { ns.Send( m.OPLPacket ); @@ -6875,17 +6875,17 @@ namespace Server } set { - if( m_Deleted ) + if ( m_Deleted ) return; - if( m_Map != value ) + if ( m_Map != value ) { - if( m_NetState != null ) + if ( m_NetState != null ) m_NetState.ValidateAllTrades(); Map oldMap = m_Map; - if( m_Map != null ) + if ( m_Map != null ) { m_Map.OnLeave( this ); @@ -6900,12 +6900,12 @@ namespace Server UpdateRegion(); - if( m_Map != null ) + if ( m_Map != null ) m_Map.OnEnter( this ); NetState ns = m_NetState; - if( ns != null && m_Map != null ) + if ( ns != null && m_Map != null ) { ns.Sequence = 0; ns.Send( new MapChange( this ) ); @@ -6920,9 +6920,9 @@ namespace Server ClearFastwalkStack(); } - if( ns != null ) + if ( ns != null ) { - if( m_Map != null ) + if ( m_Map != null ) ns.Send( new ServerChange( this, m_Map ) ); ns.Sequence = 0; @@ -6944,7 +6944,7 @@ namespace Server SendEverything(); SendIncomingPacket(); - if( ns != null ) + if ( ns != null ) { ns.Sequence = 0; ClearFastwalkStack(); @@ -6969,12 +6969,12 @@ namespace Server public void UpdateRegion() { - if( m_Deleted ) + if ( m_Deleted ) return; Region newRegion = Region.Find( m_Location, m_Map ); - if( newRegion != m_Region ) + if ( newRegion != m_Region ) { Region.OnRegionChange( this, m_Region, newRegion ); @@ -7004,26 +7004,26 @@ namespace Server public virtual bool CanBeBeneficial( Mobile target, bool message, bool allowDead ) { - if( target == null ) + if ( target == null ) return false; - if( m_Deleted || target.m_Deleted || !Alive || IsDeadBondedPet || (!allowDead && (!target.Alive || target.IsDeadBondedPet)) ) + if ( m_Deleted || target.m_Deleted || !Alive || IsDeadBondedPet || (!allowDead && (!target.Alive || target.IsDeadBondedPet)) ) { - if( message ) + if ( message ) SendLocalizedMessage( 1001017 ); // You can not perform beneficial acts on your target. return false; } - if( target == this ) + if ( target == this ) return true; - if( /*m_Player &&*/ !Region.AllowBeneficial( this, target ) ) + if ( /*m_Player &&*/ !Region.AllowBeneficial( this, target ) ) { // TODO: Pets //if ( !(target.m_Player || target.Body.IsHuman || target.Body.IsAnimal) ) //{ - if( message ) + if ( message ) SendLocalizedMessage( 1001017 ); // You can not perform beneficial acts on your target. return false; @@ -7035,7 +7035,7 @@ namespace Server public virtual bool IsBeneficialCriminal( Mobile target ) { - if( this == target ) + if ( this == target ) return false; int n = Notoriety.Compute( this, target ); @@ -7048,13 +7048,13 @@ namespace Server /// public virtual void OnBeneficialAction( Mobile target, bool isCriminal ) { - if( isCriminal ) + if ( isCriminal ) CriminalAction( false ); } public virtual void DoBeneficial( Mobile target ) { - if( target == null ) + if ( target == null ) return; OnBeneficialAction( target, IsBeneficialCriminal( target ) ); @@ -7065,7 +7065,7 @@ namespace Server public virtual bool BeneficialCheck( Mobile target ) { - if( CanBeBeneficial( target, true ) ) + if ( CanBeBeneficial( target, true ) ) { DoBeneficial( target ); return true; @@ -7073,7 +7073,7 @@ namespace Server return false; } - + #endregion #region Harmful Checks/Actions @@ -7090,24 +7090,24 @@ namespace Server public virtual bool CanBeHarmful( Mobile target, bool message, bool ignoreOurBlessedness ) { - if( target == null ) + if ( target == null ) return false; - if( m_Deleted || (!ignoreOurBlessedness && m_Blessed) || target.m_Deleted || target.m_Blessed || !Alive || IsDeadBondedPet || !target.Alive || target.IsDeadBondedPet ) + if ( m_Deleted || (!ignoreOurBlessedness && m_Blessed) || target.m_Deleted || target.m_Blessed || !Alive || IsDeadBondedPet || !target.Alive || target.IsDeadBondedPet ) { - if( message ) + if ( message ) SendLocalizedMessage( 1001018 ); // You can not perform negative acts on your target. return false; } - if( target == this ) + if ( target == this ) return true; // TODO: Pets - if( /*m_Player &&*/ !Region.AllowHarmful( this, target ) )//(target.m_Player || target.Body.IsHuman) && !Region.AllowHarmful( this, target ) ) + if ( /*m_Player &&*/ !Region.AllowHarmful( this, target ) )//(target.m_Player || target.Body.IsHuman) && !Region.AllowHarmful( this, target ) ) { - if( message ) + if ( message ) SendLocalizedMessage( 1001018 ); // You can not perform negative acts on your target. return false; @@ -7118,7 +7118,7 @@ namespace Server public virtual bool IsHarmfulCriminal( Mobile target ) { - if( this == target ) + if ( this == target ) return false; return (Notoriety.Compute( this, target ) == Notoriety.Innocent); @@ -7129,7 +7129,7 @@ namespace Server /// public virtual void OnHarmfulAction( Mobile target, bool isCriminal ) { - if( isCriminal ) + if ( isCriminal ) CriminalAction( false ); } @@ -7140,7 +7140,7 @@ namespace Server public virtual void DoHarmful( Mobile target, bool indirect ) { - if( target == null || m_Deleted ) + if ( target == null || m_Deleted ) return; bool isCriminal = IsHarmfulCriminal( target ); @@ -7151,10 +7151,10 @@ namespace Server this.Region.OnDidHarmful( this, target ); target.Region.OnGotHarmful( this, target ); - if( !indirect ) + if ( !indirect ) Combatant = target; - if( m_ExpireCombatant == null ) + if ( m_ExpireCombatant == null ) m_ExpireCombatant = new ExpireCombatantTimer( this ); else m_ExpireCombatant.Stop(); @@ -7164,7 +7164,7 @@ namespace Server public virtual bool HarmfulCheck( Mobile target ) { - if( CanBeHarmful( target ) ) + if ( CanBeHarmful( target ) ) { DoHarmful( target ); return true; @@ -7188,7 +7188,7 @@ namespace Server { StatMod check = m_StatMods[i]; - if( check.Name == name ) + if ( check.Name == name ) { m_StatMods.RemoveAt( i ); CheckStatTimers(); @@ -7206,7 +7206,7 @@ namespace Server { StatMod check = m_StatMods[i]; - if( check.Name == name ) + if ( check.Name == name ) return check; } @@ -7219,7 +7219,7 @@ namespace Server { StatMod check = m_StatMods[i]; - if( check.Name == mod.Name ) + if ( check.Name == mod.Name ) { Delta( MobileDelta.Stat | GetStatDelta( check.Type ) ); m_StatMods.RemoveAt( i ); @@ -7236,13 +7236,13 @@ namespace Server { MobileDelta delta = 0; - if( (type & StatType.Str) != 0 ) + if ( (type & StatType.Str) != 0 ) delta |= MobileDelta.Hits; - if( (type & StatType.Dex) != 0 ) + if ( (type & StatType.Dex) != 0 ) delta |= MobileDelta.Stam; - if( (type & StatType.Int) != 0 ) + if ( (type & StatType.Int) != 0 ) delta |= MobileDelta.Mana; return delta; @@ -7259,7 +7259,7 @@ namespace Server { StatMod mod = m_StatMods[i]; - if( mod.HasElapsed() ) + if ( mod.HasElapsed() ) { m_StatMods.RemoveAt( i ); Delta( MobileDelta.Stat | GetStatDelta( mod.Type ) ); @@ -7267,7 +7267,7 @@ namespace Server --i; } - else if( (mod.Type & type) != 0 ) + else if ( (mod.Type & type) != 0 ) { offset += mod.Offset; } @@ -7329,26 +7329,26 @@ namespace Server } set { - if( value < 1 ) + if ( value < 1 ) value = 1; - else if( value > 65000 ) + else if ( value > 65000 ) value = 65000; - if( m_Str != value ) + if ( m_Str != value ) { int oldValue = m_Str; m_Str = value; Delta( MobileDelta.Stat | MobileDelta.Hits ); - if( Hits < HitsMax ) + if ( Hits < HitsMax ) { - if( m_HitsTimer == null ) + if ( m_HitsTimer == null ) m_HitsTimer = new HitsTimer( this ); m_HitsTimer.Start(); } - else if( Hits > HitsMax ) + else if ( Hits > HitsMax ) { Hits = HitsMax; } @@ -7371,16 +7371,16 @@ namespace Server { int value = m_Str + GetStatOffset( StatType.Str ); - if( value < 1 ) + if ( value < 1 ) value = 1; - else if( value > 65000 ) + else if ( value > 65000 ) value = 65000; return value; } set { - if( m_StatMods.Count == 0 ) + if ( m_StatMods.Count == 0 ) RawStr = value; } } @@ -7401,26 +7401,26 @@ namespace Server } set { - if( value < 1 ) + if ( value < 1 ) value = 1; - else if( value > 65000 ) + else if ( value > 65000 ) value = 65000; - if( m_Dex != value ) + if ( m_Dex != value ) { int oldValue = m_Dex; m_Dex = value; Delta( MobileDelta.Stat | MobileDelta.Stam ); - if( Stam < StamMax ) + if ( Stam < StamMax ) { - if( m_StamTimer == null ) + if ( m_StamTimer == null ) m_StamTimer = new StamTimer( this ); m_StamTimer.Start(); } - else if( Stam > StamMax ) + else if ( Stam > StamMax ) { Stam = StamMax; } @@ -7443,16 +7443,16 @@ namespace Server { int value = m_Dex + GetStatOffset( StatType.Dex ); - if( value < 1 ) + if ( value < 1 ) value = 1; - else if( value > 65000 ) + else if ( value > 65000 ) value = 65000; return value; } set { - if( m_StatMods.Count == 0 ) + if ( m_StatMods.Count == 0 ) RawDex = value; } } @@ -7473,26 +7473,26 @@ namespace Server } set { - if( value < 1 ) + if ( value < 1 ) value = 1; - else if( value > 65000 ) + else if ( value > 65000 ) value = 65000; - if( m_Int != value ) + if ( m_Int != value ) { int oldValue = m_Int; m_Int = value; Delta( MobileDelta.Stat | MobileDelta.Mana ); - if( Mana < ManaMax ) + if ( Mana < ManaMax ) { - if( m_ManaTimer == null ) + if ( m_ManaTimer == null ) m_ManaTimer = new ManaTimer( this ); m_ManaTimer.Start(); } - else if( Mana > ManaMax ) + else if ( Mana > ManaMax ) { Mana = ManaMax; } @@ -7515,16 +7515,16 @@ namespace Server { int value = m_Int + GetStatOffset( StatType.Int ); - if( value < 1 ) + if ( value < 1 ) value = 1; - else if( value > 65000 ) + else if ( value > 65000 ) value = 65000; return value; } set { - if( m_StatMods.Count == 0 ) + if ( m_StatMods.Count == 0 ) RawInt = value; } } @@ -7553,43 +7553,43 @@ namespace Server } set { - if( m_Deleted ) + if ( m_Deleted ) return; - if( value < 0 ) + if ( value < 0 ) { value = 0; } - else if( value >= HitsMax ) + else if ( value >= HitsMax ) { value = HitsMax; - if( m_HitsTimer != null ) + if ( m_HitsTimer != null ) m_HitsTimer.Stop(); for( int i = 0; i < m_Aggressors.Count; i++ ) //reset reports on full HP m_Aggressors[i].CanReportMurder = false; - if( m_DamageEntries.Count > 0 ) + if ( m_DamageEntries.Count > 0 ) m_DamageEntries.Clear(); // reset damage entries on full HP } - if( value < HitsMax ) + if ( value < HitsMax ) { - if( CanRegenHits ) + if ( CanRegenHits ) { - if( m_HitsTimer == null ) + if ( m_HitsTimer == null ) m_HitsTimer = new HitsTimer( this ); m_HitsTimer.Start(); } - else if( m_HitsTimer != null ) + else if ( m_HitsTimer != null ) { m_HitsTimer.Stop(); } } - if( m_Hits != value ) + if ( m_Hits != value ) { int oldValue = m_Hits; m_Hits = value; @@ -7623,37 +7623,37 @@ namespace Server } set { - if( m_Deleted ) + if ( m_Deleted ) return; - if( value < 0 ) + if ( value < 0 ) { value = 0; } - else if( value >= StamMax ) + else if ( value >= StamMax ) { value = StamMax; - if( m_StamTimer != null ) + if ( m_StamTimer != null ) m_StamTimer.Stop(); } - if( value < StamMax ) + if ( value < StamMax ) { - if( CanRegenStam ) + if ( CanRegenStam ) { - if( m_StamTimer == null ) + if ( m_StamTimer == null ) m_StamTimer = new StamTimer( this ); m_StamTimer.Start(); } - else if( m_StamTimer != null ) + else if ( m_StamTimer != null ) { m_StamTimer.Stop(); } } - if( m_Stam != value ) + if ( m_Stam != value ) { int oldValue = m_Stam; m_Stam = value; @@ -7687,43 +7687,43 @@ namespace Server } set { - if( m_Deleted ) + if ( m_Deleted ) return; - if( value < 0 ) + if ( value < 0 ) { value = 0; } - else if( value >= ManaMax ) + else if ( value >= ManaMax ) { value = ManaMax; - if( m_ManaTimer != null ) + if ( m_ManaTimer != null ) m_ManaTimer.Stop(); - if( Meditating ) + if ( Meditating ) { Meditating = false; SendLocalizedMessage( 501846 ); // You are at peace. } } - if( value < ManaMax ) + if ( value < ManaMax ) { - if( CanRegenMana ) + if ( CanRegenMana ) { - if( m_ManaTimer == null ) + if ( m_ManaTimer == null ) m_ManaTimer = new ManaTimer( this ); m_ManaTimer.Start(); } - else if( m_ManaTimer != null ) + else if ( m_ManaTimer != null ) { m_ManaTimer.Stop(); } } - if( m_Mana != value ) + if ( m_Mana != value ) { int oldValue = m_Mana; m_Mana = value; @@ -7746,12 +7746,12 @@ namespace Server } #endregion - + public virtual int Luck { get { return 0; } } - + public virtual int HuedItemID { get @@ -7771,7 +7771,7 @@ namespace Server } set { - if( m_HueMod != value ) + if ( m_HueMod != value ) { m_HueMod = value; @@ -7785,7 +7785,7 @@ namespace Server { get { - if( m_HueMod != -1 ) + if ( m_HueMod != -1 ) return m_HueMod; return m_Hue; @@ -7794,7 +7794,7 @@ namespace Server { int oldHue = m_Hue; - if( oldHue != value ) + if ( oldHue != value ) { m_Hue = value; @@ -7818,7 +7818,7 @@ namespace Server } set { - if( m_Direction != value ) + if ( m_Direction != value ) { m_Direction = value; @@ -7830,7 +7830,7 @@ namespace Server public virtual int GetSeason() { - if( m_Map != null ) + if ( m_Map != null ) return m_Map.Season; return 1; @@ -7840,22 +7840,22 @@ namespace Server { int flags = 0x0; - if( m_Paralyzed || m_Frozen ) + if ( m_Paralyzed || m_Frozen ) flags |= 0x01; - if( m_Female ) + if ( m_Female ) flags |= 0x02; - if( m_Flying ) + if ( m_Flying ) flags |= 0x04; - if( m_Blessed || m_YellowHealthbar ) + if ( m_Blessed || m_YellowHealthbar ) flags |= 0x08; - if( m_Warmode ) + if ( m_Warmode ) flags |= 0x40; - if( m_Hidden ) + if ( m_Hidden ) flags |= 0x80; return flags; @@ -7866,22 +7866,22 @@ namespace Server { int flags = 0x0; - if( m_Paralyzed || m_Frozen ) + if ( m_Paralyzed || m_Frozen ) flags |= 0x01; - if( m_Female ) + if ( m_Female ) flags |= 0x02; - if( m_Poison != null ) + if ( m_Poison != null ) flags |= 0x04; - if( m_Blessed || m_YellowHealthbar ) + if ( m_Blessed || m_YellowHealthbar ) flags |= 0x08; - if( m_Warmode ) + if ( m_Warmode ) flags |= 0x40; - if( m_Hidden ) + if ( m_Hidden ) flags |= 0x80; return flags; @@ -7896,7 +7896,7 @@ namespace Server } set { - if( m_Female != value ) + if ( m_Female != value ) { m_Female = value; Delta( MobileDelta.Flags ); @@ -7918,7 +7918,7 @@ namespace Server } set { - if( m_Flying != value ) + if ( m_Flying != value ) { m_Flying = value; Delta( MobileDelta.Flags ); @@ -7939,12 +7939,12 @@ namespace Server } set { - if( m_Deleted ) + if ( m_Deleted ) return; - if( m_Warmode != value ) + if ( m_Warmode != value ) { - if( m_AutoManifestTimer != null ) + if ( m_AutoManifestTimer != null ) { m_AutoManifestTimer.Stop(); m_AutoManifestTimer = null; @@ -7953,15 +7953,15 @@ namespace Server m_Warmode = value; Delta( MobileDelta.Flags ); - if( m_NetState != null ) + if ( m_NetState != null ) Send( SetWarMode.Instantiate( value ) ); - if( !m_Warmode ) + if ( !m_Warmode ) Combatant = null; - if( !Alive ) + if ( !Alive ) { - if( value ) + if ( value ) Delta( MobileDelta.GhostUpdate ); else SendRemovePacket( false ); @@ -7988,12 +7988,12 @@ namespace Server } set { - if( m_Hidden != value ) + if ( m_Hidden != value ) { m_Hidden = value; //Delta( MobileDelta.Flags ); - OnHiddenChanged(); + OnHiddenChanged(); } } } @@ -8054,29 +8054,29 @@ namespace Server } set { - if( m_NetState != value ) + if ( m_NetState != value ) { - if( m_Map != null ) + if ( m_Map != null ) m_Map.OnClientChange( m_NetState, value, this ); - if( m_Target != null ) + if ( m_Target != null ) m_Target.Cancel( this, TargetCancelType.Disconnected ); - if( m_QuestArrow != null ) + if ( m_QuestArrow != null ) QuestArrow = null; - if( m_Spell != null ) + if ( m_Spell != null ) m_Spell.OnConnectionChanged(); //if ( m_Spell != null ) // m_Spell.FinishSequence(); - if( m_NetState != null ) + if ( m_NetState != null ) m_NetState.CancelAllTrades(); BankBox box = FindBankNoCreate(); - if( box != null && box.Opened ) + if ( box != null && box.Opened ) box.Close(); // REMOVED: @@ -8084,14 +8084,14 @@ namespace Server m_NetState = value; - if( m_NetState == null ) + if ( m_NetState == null ) { OnDisconnected(); EventSink.InvokeDisconnected( new DisconnectedEventArgs( this ) ); // Disconnected, start the logout timer - if( m_LogoutTimer == null ) + if ( m_LogoutTimer == null ) m_LogoutTimer = new LogoutTimer( this ); else m_LogoutTimer.Stop(); @@ -8106,12 +8106,12 @@ namespace Server // Connected, stop the logout timer and if needed, move to the world - if( m_LogoutTimer != null ) + if ( m_LogoutTimer != null ) m_LogoutTimer.Stop(); m_LogoutTimer = null; - if( m_Map == Map.Internal && m_LogoutMap != null ) + if ( m_Map == Map.Internal && m_LogoutMap != null ) { Map = m_LogoutMap; Location = m_LogoutLocation; @@ -8120,16 +8120,16 @@ namespace Server for( int i = m_Items.Count - 1; i >= 0; --i ) { - if( i >= m_Items.Count ) + if ( i >= m_Items.Count ) continue; Item item = m_Items[i]; - if( item is SecureTradeContainer ) + if ( item is SecureTradeContainer ) { for( int j = item.Items.Count - 1; j >= 0; --j ) { - if( j < item.Items.Count ) + if ( j < item.Items.Count ) { item.Items[j].OnSecureTrade( this, this, this, false ); AddToBackpack( item.Items[j] ); @@ -8148,11 +8148,11 @@ namespace Server public virtual bool CanSee( object o ) { - if( o is Item ) + if ( o is Item ) { return CanSee( (Item)o ); } - else if( o is Mobile ) + else if ( o is Mobile ) { return CanSee( (Mobile)o ); } @@ -8164,39 +8164,39 @@ namespace Server public virtual bool CanSee( Item item ) { - if( m_Map == Map.Internal ) + if ( m_Map == Map.Internal ) return false; - else if( item.Map == Map.Internal ) + else if ( item.Map == Map.Internal ) return false; - if( item.Parent != null ) + if ( item.Parent != null ) { - if( item.Parent is Item ) + if ( item.Parent is Item ) { Item parent = item.Parent as Item; if ( !(CanSee( parent ) && parent.IsChildVisibleTo( this, item )) ) return false; } - else if( item.Parent is Mobile ) + else if ( item.Parent is Mobile ) { - if( !CanSee( (Mobile)item.Parent ) ) + if ( !CanSee( (Mobile)item.Parent ) ) return false; } } - if( item is BankBox ) + if ( item is BankBox ) { BankBox box = item as BankBox; - if( box != null && m_AccessLevel <= AccessLevel.Counselor && (box.Owner != this || !box.Opened) ) + if ( box != null && m_AccessLevel <= AccessLevel.Counselor && (box.Owner != this || !box.Opened) ) return false; } - else if( item is SecureTradeContainer ) + else if ( item is SecureTradeContainer ) { SecureTrade trade = ((SecureTradeContainer)item).Trade; - if( trade != null && trade.From.Mobile != this && trade.To.Mobile != this ) + if ( trade != null && trade.From.Mobile != this && trade.To.Mobile != this ) return false; } @@ -8205,7 +8205,7 @@ namespace Server public virtual bool CanSee( Mobile m ) { - if( m_Deleted || m.m_Deleted || m_Map == Map.Internal || m.m_Map == Map.Internal ) + if ( m_Deleted || m.m_Deleted || m_Map == Map.Internal || m.m_Map == Map.Internal ) return false; return this == m || ( @@ -8229,7 +8229,7 @@ namespace Server } set { - if( m_Language != value ) + if ( m_Language != value ) m_Language = value; } } @@ -8297,11 +8297,11 @@ namespace Server { string old = m_GuildTitle; - if( old != value ) + if ( old != value ) { m_GuildTitle = value; - if( m_Guild != null && !m_Guild.Disbanded && m_GuildTitle != null ) + if ( m_Guild != null && !m_Guild.Disbanded && m_GuildTitle != null ) this.SendLocalizedMessage( 1018026, true, m_GuildTitle ); // Your guild title has changed : InvalidateProperties(); @@ -8353,7 +8353,7 @@ namespace Server } set { - if( m_NameMod != value ) + if ( m_NameMod != value ) { m_NameMod = value; Delta( MobileDelta.Name ); @@ -8457,10 +8457,10 @@ namespace Server { DateTime d = m_LastStrGain; - if( m_LastIntGain > d ) + if ( m_LastIntGain > d ) d = m_LastIntGain; - if( m_LastDexGain > d ) + if ( m_LastDexGain > d ) d = m_LastDexGain; return d; @@ -8483,9 +8483,9 @@ namespace Server { BaseGuild old = m_Guild; - if( old != value ) + if ( old != value ) { - if( value == null ) + if ( value == null ) GuildTitle = null; m_Guild = value; @@ -8523,17 +8523,17 @@ namespace Server m_Poison = value; Delta( MobileDelta.HealthbarPoison ); - if( m_PoisonTimer != null ) + if ( m_PoisonTimer != null ) { m_PoisonTimer.Stop(); m_PoisonTimer = null; } - if( m_Poison != null ) + if ( m_Poison != null ) { m_PoisonTimer = m_Poison.ConstructTimer( this ); - if( m_PoisonTimer != null ) + if ( m_PoisonTimer != null ) m_PoisonTimer.Start(); } @@ -8570,7 +8570,7 @@ namespace Server /// public virtual void OnPoisoned( Mobile from, Poison poison, Poison oldPoison ) { - if( poison != null ) + if ( poison != null ) { this.LocalOverheadMessage( MessageType.Regular, 0x21, 1042857 + (poison.Level * 2) ); this.NonlocalOverheadMessage( MessageType.Regular, 0x21, 1042858 + (poison.Level * 2), Name ); @@ -8626,19 +8626,19 @@ namespace Server /// public virtual ApplyPoisonResult ApplyPoison( Mobile from, Poison poison ) { - if( poison == null ) + if ( poison == null ) { CurePoison( from ); return ApplyPoisonResult.Cured; } - if( CheckHigherPoison( from, poison ) ) + if ( CheckHigherPoison( from, poison ) ) { OnHigherPoison( from, poison ); return ApplyPoisonResult.HigherPoisonActive; } - if( CheckPoisonImmunity( from, poison ) ) + if ( CheckPoisonImmunity( from, poison ) ) { OnPoisonImmunity( from, poison ); return ApplyPoisonResult.Immune; @@ -8688,7 +8688,7 @@ namespace Server /// True if poison was cured, false if otherwise. public virtual bool CurePoison( Mobile from ) { - if( CheckCure( from ) ) + if ( CheckCure( from ) ) { Poison oldPoison = m_Poison; this.Poison = null; @@ -8748,7 +8748,7 @@ namespace Server } set { - if( m_BodyMod != value ) + if ( m_BodyMod != value ) { m_BodyMod = value; @@ -8774,14 +8774,14 @@ namespace Server { get { - if( IsBodyMod ) + if ( IsBodyMod ) return m_BodyMod; return m_Body; } set { - if( m_Body != value && !IsBodyMod ) + if ( m_Body != value && !IsBodyMod ) { m_Body = SafeBody( value ); @@ -8800,7 +8800,7 @@ namespace Server for( int i = 0; delta < 0 && i < m_InvalidBodies.Length; ++i ) delta = (m_InvalidBodies[i] - body); - if( delta != 0 ) + if ( delta != 0 ) return body; return 0; @@ -8871,8 +8871,8 @@ namespace Server { get { - if( m_Region == null ) - if( this.Map == null ) + if ( m_Region == null ) + if ( this.Map == null ) return Map.Internal.DefaultRegion; else return this.Map.DefaultRegion; @@ -8940,7 +8940,7 @@ namespace Server { get { - if( m_PropertyList == null ) + if ( m_PropertyList == null ) { m_PropertyList = new ObjectPropertyList( this ); @@ -8962,16 +8962,16 @@ namespace Server public void InvalidateProperties() { - if( !ObjectPropertyList.Enabled ) + if ( !ObjectPropertyList.Enabled ) return; - if( m_Map != null && m_Map != Map.Internal && !World.Loading ) + if ( m_Map != null && m_Map != Map.Internal && !World.Loading ) { ObjectPropertyList oldList = m_PropertyList; Packet.Release( ref m_PropertyList ); ObjectPropertyList newList = PropertyList; - if( oldList == null || oldList.Hash != newList.Hash ) + if ( oldList == null || oldList.Hash != newList.Hash ) { Packet.Release( ref m_OPLPacket ); Delta( MobileDelta.Properties ); @@ -8989,15 +8989,15 @@ namespace Server public int SolidHueOverride { get { return m_SolidHueOverride; } - set { if( m_SolidHueOverride == value ) return; m_SolidHueOverride = value; Delta( MobileDelta.Hue | MobileDelta.Body ); } + set { if ( m_SolidHueOverride == value ) return; m_SolidHueOverride = value; Delta( MobileDelta.Hue | MobileDelta.Body ); } } public virtual void MoveToWorld( Point3D newLocation, Map map ) { - if( m_Deleted ) + if ( m_Deleted ) return; - if( m_Map == map ) + if ( m_Map == map ) { SetLocation( newLocation, true ); return; @@ -9005,7 +9005,7 @@ namespace Server BankBox box = FindBankNoCreate(); - if( box != null && box.Opened ) + if ( box != null && box.Opened ) box.Close(); Point3D oldLocation = m_Location; @@ -9013,7 +9013,7 @@ namespace Server Region oldRegion = m_Region; - if( oldMap != null ) + if ( oldMap != null ) { oldMap.OnLeave( this ); @@ -9030,13 +9030,13 @@ namespace Server NetState ns = m_NetState; - if( m_Map != null ) + if ( m_Map != null ) { m_Map.OnEnter( this ); UpdateRegion(); - if( ns != null && m_Map != null ) + if ( ns != null && m_Map != null ) { ns.Sequence = 0; ns.Send( new MapChange( this ) ); @@ -9056,9 +9056,9 @@ namespace Server UpdateRegion(); } - if( ns != null ) + if ( ns != null ) { - if( m_Map != null ) + if ( m_Map != null ) Send( new ServerChange( this, m_Map ) ); ns.Sequence = 0; @@ -9080,7 +9080,7 @@ namespace Server SendEverything(); SendIncomingPacket(); - if( ns != null ) + if ( ns != null ) { ns.Sequence = 0; ClearFastwalkStack(); @@ -9101,34 +9101,34 @@ namespace Server OnMapChange( oldMap ); OnLocationChange( oldLocation ); - if( m_Region != null ) + if ( m_Region != null ) m_Region.OnLocationChanged( this, oldLocation ); } public virtual void SetLocation( Point3D newLocation, bool isTeleport ) { - if( m_Deleted ) + if ( m_Deleted ) return; Point3D oldLocation = m_Location; - if( oldLocation != newLocation ) + if ( oldLocation != newLocation ) { m_Location = newLocation; UpdateRegion(); BankBox box = FindBankNoCreate(); - if( box != null && box.Opened ) + if ( box != null && box.Opened ) box.Close(); - if( m_NetState != null ) + if ( m_NetState != null ) m_NetState.ValidateAllTrades(); - if( m_Map != null ) + if ( m_Map != null ) m_Map.OnMove( oldLocation, this ); - if( isTeleport && m_NetState != null && ( !m_NetState.HighSeas || !m_NoMoveHS ) ) + if ( isTeleport && m_NetState != null && ( !m_NetState.HighSeas || !m_NoMoveHS ) ) { m_NetState.Sequence = 0; @@ -9142,14 +9142,14 @@ namespace Server Map map = m_Map; - if( map != null ) + if ( map != null ) { // First, send a remove message to everyone who can no longer see us. (inOldRange && !inNewRange) IPooledEnumerable eable = map.GetClientsInRange(oldLocation); foreach( NetState ns in eable ) { - if( ns != m_NetState && !Utility.InUpdateRange( newLocation, ns.Mobile.Location ) ) { + if ( ns != m_NetState && !Utility.InUpdateRange( newLocation, ns.Mobile.Location ) ) { ns.Send( this.RemovePacket ); } } @@ -9159,33 +9159,33 @@ namespace Server NetState ourState = m_NetState; // Check to see if we are attached to a client - if( ourState != null ) + if ( ourState != null ) { IPooledEnumerable eeable = map.GetObjectsInRange( newLocation, Core.GlobalMaxUpdateRange ); // We are attached to a client, so it's a bit more complex. We need to send new items and people to ourself, and ourself to other clients foreach ( IEntity o in eeable ) { - if( o is Item ) + if ( o is Item ) { Item item = (Item)o; int range = item.GetUpdateRange( this ); Point3D loc = item.Location; - if( !Utility.InRange( oldLocation, loc, range ) && Utility.InRange( newLocation, loc, range ) && CanSee( item ) ) + if ( !Utility.InRange( oldLocation, loc, range ) && Utility.InRange( newLocation, loc, range ) && CanSee( item ) ) item.SendInfoTo( ourState ); } - else if( o != this && o is Mobile ) + else if ( o != this && o is Mobile ) { Mobile m = (Mobile)o; - if( !Utility.InUpdateRange( newLocation, m.m_Location ) ) + if ( !Utility.InUpdateRange( newLocation, m.m_Location ) ) continue; bool inOldRange = Utility.InUpdateRange( oldLocation, m.m_Location ); - if( m.m_NetState != null && ( ( isTeleport && ( !m.m_NetState.HighSeas || !m_NoMoveHS ) ) || !inOldRange ) && m.CanSee( this ) ) + if ( m.m_NetState != null && ( ( isTeleport && ( !m.m_NetState.HighSeas || !m_NoMoveHS ) ) || !inOldRange ) && m.CanSee( this ) ) { m.m_NetState.Send(MobileIncoming.Create(m.m_NetState, m, this)); @@ -9197,10 +9197,10 @@ namespace Server m.m_NetState.Send( new HealthbarYellow( this ) ); } - if( IsDeadBondedPet ) + if ( IsDeadBondedPet ) m.m_NetState.Send( new BondedStatus( 0, m_Serial, 1 ) ); - if( ObjectPropertyList.Enabled ) + if ( ObjectPropertyList.Enabled ) { m.m_NetState.Send( OPLPacket ); @@ -9209,7 +9209,7 @@ namespace Server } } - if( !inOldRange && CanSee( m ) ) + if ( !inOldRange && CanSee( m ) ) { ourState.Send(MobileIncoming.Create(ourState, this, m)); @@ -9221,10 +9221,10 @@ namespace Server ourState.Send( new HealthbarYellow( m ) ); } - if( m.IsDeadBondedPet ) + if ( m.IsDeadBondedPet ) ourState.Send( new BondedStatus( 0, m.m_Serial, 1 ) ); - if( ObjectPropertyList.Enabled ) + if ( ObjectPropertyList.Enabled ) { ourState.Send( m.OPLPacket ); @@ -9243,7 +9243,7 @@ namespace Server // We're not attached to a client, so simply send an Incoming foreach( NetState ns in eable ) { - if( ( ( isTeleport && ( !ns.HighSeas || !m_NoMoveHS ) ) || !Utility.InUpdateRange( oldLocation, ns.Mobile.Location )) && ns.Mobile.CanSee( this ) ) + if ( ( ( isTeleport && ( !ns.HighSeas || !m_NoMoveHS ) ) || !Utility.InUpdateRange( oldLocation, ns.Mobile.Location )) && ns.Mobile.CanSee( this ) ) { ns.Send(MobileIncoming.Create(ns, ns.Mobile, this)); @@ -9255,10 +9255,10 @@ namespace Server ns.Send( new HealthbarYellow( this ) ); } - if( IsDeadBondedPet ) + if ( IsDeadBondedPet ) ns.Send( new BondedStatus( 0, m_Serial, 1 ) ); - if( ObjectPropertyList.Enabled ) + if ( ObjectPropertyList.Enabled ) { ns.Send( OPLPacket ); @@ -9295,16 +9295,16 @@ namespace Server { get { - if( m_Hair == null ) + if ( m_Hair == null ) return 0; return m_Hair.ItemID; } set { - if( m_Hair == null && value > 0 ) + if ( m_Hair == null && value > 0 ) m_Hair = new HairInfo( value ); - else if( value <= 0 ) + else if ( value <= 0 ) m_Hair = null; else m_Hair.ItemID = value; @@ -9321,16 +9321,16 @@ namespace Server { get { - if( m_FacialHair == null ) + if ( m_FacialHair == null ) return 0; return m_FacialHair.ItemID; } set { - if( m_FacialHair == null && value > 0 ) + if ( m_FacialHair == null && value > 0 ) m_FacialHair = new FacialHairInfo( value ); - else if( value <= 0 ) + else if ( value <= 0 ) m_FacialHair = null; else m_FacialHair.ItemID = value; @@ -9347,13 +9347,13 @@ namespace Server { get { - if( m_Hair == null ) + if ( m_Hair == null ) return 0; return m_Hair.Hue; } set { - if( m_Hair != null ) + if ( m_Hair != null ) { m_Hair.Hue = value; Delta( MobileDelta.Hair ); @@ -9366,14 +9366,14 @@ namespace Server { get { - if( m_FacialHair == null ) + if ( m_FacialHair == null ) return 0; return m_FacialHair.Hue; } set { - if( m_FacialHair != null ) + if ( m_FacialHair != null ) { m_FacialHair.Hue = value; Delta( MobileDelta.FacialHair ); @@ -9397,17 +9397,17 @@ namespace Server { Item item = m_Weapon as Item; - if( item != null && !item.Deleted && item.Parent == this && CanSee( item ) ) + if ( item != null && !item.Deleted && item.Parent == this && CanSee( item ) ) return m_Weapon; m_Weapon = null; item = FindItemOnLayer( Layer.OneHanded ); - if( item == null ) + if ( item == null ) item = FindItemOnLayer( Layer.TwoHanded ); - if( item is IWeapon ) + if ( item is IWeapon ) return (m_Weapon = (IWeapon)item); else return GetDefaultWeapon(); @@ -9426,12 +9426,12 @@ namespace Server { get { - if( m_BankBox != null && !m_BankBox.Deleted && m_BankBox.Parent == this ) + if ( m_BankBox != null && !m_BankBox.Deleted && m_BankBox.Parent == this ) return m_BankBox; m_BankBox = FindItemOnLayer( Layer.Bank ) as BankBox; - if( m_BankBox == null ) + if ( m_BankBox == null ) AddItem( m_BankBox = new BankBox( this ) ); return m_BankBox; @@ -9440,7 +9440,7 @@ namespace Server public BankBox FindBankNoCreate() { - if( m_BankBox != null && !m_BankBox.Deleted && m_BankBox.Parent == this ) + if ( m_BankBox != null && !m_BankBox.Deleted && m_BankBox.Parent == this ) return m_BankBox; m_BankBox = FindItemOnLayer( Layer.Bank ) as BankBox; @@ -9455,7 +9455,7 @@ namespace Server { get { - if( m_Backpack != null && !m_Backpack.Deleted && m_Backpack.Parent == this ) + if ( m_Backpack != null && !m_Backpack.Deleted && m_Backpack.Parent == this ) return m_Backpack; return (m_Backpack = (FindItemOnLayer( Layer.Backpack ) as Container)); @@ -9473,7 +9473,7 @@ namespace Server { Item item = eq[i]; - if( !item.Deleted && item.Layer == layer ) + if ( !item.Deleted && item.Layer == layer ) { return item; } @@ -9574,12 +9574,12 @@ namespace Server public void SendIncomingPacket() { - if( m_Map != null ) + if ( m_Map != null ) { IPooledEnumerable eable = m_Map.GetClientsInRange(m_Location); foreach( NetState state in eable ) { - if( state.Mobile.CanSee( this ) ) + if ( state.Mobile.CanSee( this ) ) { state.Send(MobileIncoming.Create(state, state.Mobile, this)); @@ -9591,10 +9591,10 @@ namespace Server state.Send( new HealthbarYellow( this ) ); } - if( IsDeadBondedPet ) + if ( IsDeadBondedPet ) state.Send( new BondedStatus( 0, m_Serial, 1 ) ); - if( ObjectPropertyList.Enabled ) + if ( ObjectPropertyList.Enabled ) { state.Send( OPLPacket ); @@ -9610,7 +9610,7 @@ namespace Server public bool PlaceInBackpack( Item item ) { - if( item.Deleted ) + if ( item.Deleted ) return false; Container pack = this.Backpack; @@ -9620,15 +9620,15 @@ namespace Server public bool AddToBackpack( Item item ) { - if( item.Deleted ) + if ( item.Deleted ) return false; - if( !PlaceInBackpack( item ) ) + if ( !PlaceInBackpack( item ) ) { Point3D loc = m_Location; Map map = m_Map; - if( (map == null || map == Map.Internal) && m_LogoutMap != null ) + if ( (map == null || map == Map.Internal) && m_LogoutMap != null ) { loc = m_LogoutLocation; map = m_LogoutMap; @@ -9648,7 +9648,7 @@ namespace Server public virtual bool CheckNonlocalLift( Mobile from, Item item ) { - if( from == this || (from.AccessLevel > this.AccessLevel && from.AccessLevel >= AccessLevel.GameMaster) ) + if ( from == this || (from.AccessLevel > this.AccessLevel && from.AccessLevel >= AccessLevel.GameMaster) ) return true; return false; @@ -9658,7 +9658,7 @@ namespace Server { get { - if( m_NetState != null ) + if ( m_NetState != null ) return m_NetState.Trades.Count > 0; return false; @@ -9714,16 +9714,16 @@ namespace Server /// public virtual bool OnDragDrop( Mobile from, Item dropped ) { - if( from == this ) + if ( from == this ) { Container pack = this.Backpack; - if( pack != null ) + if ( pack != null ) return dropped.DropToItem( from, pack, new Point3D( -1, -1, 0 ) ); return false; } - else if( from.InRange( Location, 2 ) ) + else if ( from.InRange( Location, 2 ) ) { return OpenTrade( from, dropped ); } @@ -9736,7 +9736,7 @@ namespace Server public virtual bool CheckEquip( Item item ) { for( int i = 0; i < m_Items.Count; ++i ) - if( m_Items[i].CheckConflictingLayer( this, item, item.Layer ) || item.CheckConflictingLayer( this, m_Items[i], m_Items[i].Layer ) ) + if ( m_Items[i].CheckConflictingLayer( this, item, item.Layer ) || item.CheckConflictingLayer( this, m_Items[i], m_Items[i].Layer ) ) return false; return true; @@ -9772,7 +9772,7 @@ namespace Server /// SendMessage( "That is too heavy for you to lift." ); /// return false; /// } - /// + /// /// return base.OnDragLift( item ); /// } /// @@ -9836,7 +9836,7 @@ namespace Server public virtual bool CheckNonlocalDrop( Mobile from, Item item, Item target ) { - if( from == this || (from.AccessLevel > this.AccessLevel && from.AccessLevel >= AccessLevel.GameMaster) ) + if ( from == this || (from.AccessLevel > this.AccessLevel && from.AccessLevel >= AccessLevel.GameMaster) ) return true; return false; @@ -9867,12 +9867,12 @@ namespace Server public virtual bool EquipItem( Item item ) { - if( item == null || item.Deleted || !item.CanEquip( this ) ) + if ( item == null || item.Deleted || !item.CanEquip( this ) ) return false; - if( CheckEquip( item ) && OnEquip( item ) && item.OnEquip( this ) ) + if ( CheckEquip( item ) && OnEquip( item ) && item.OnEquip( this ) ) { - if( m_Spell != null && !m_Spell.OnCasterEquiping( item ) ) + if ( m_Spell != null && !m_Spell.OnCasterEquiping( item ) ) return false; //if ( m_Spell != null && m_Spell.State == SpellState.Casting ) @@ -9899,7 +9899,7 @@ namespace Server Type ourType = this.GetType(); m_TypeRef = World.m_MobileTypes.IndexOf( ourType ); - if( m_TypeRef == -1 ) + if ( m_TypeRef == -1 ) { World.m_MobileTypes.Add( ourType ); m_TypeRef = World.m_MobileTypes.Count - 1; @@ -9918,7 +9918,7 @@ namespace Server Type ourType = this.GetType(); m_TypeRef = World.m_MobileTypes.IndexOf( ourType ); - if( m_TypeRef == -1 ) + if ( m_TypeRef == -1 ) { World.m_MobileTypes.Add( ourType ); m_TypeRef = World.m_MobileTypes.Count - 1; @@ -9953,12 +9953,12 @@ namespace Server public virtual void Delta( MobileDelta flag ) { - if( m_Map == null || m_Map == Map.Internal || m_Deleted ) + if ( m_Map == null || m_Map == Map.Internal || m_Deleted ) return; m_DeltaFlags |= flag; - if( !m_InDeltaQueue ) + if ( !m_InDeltaQueue ) { m_InDeltaQueue = true; @@ -10005,15 +10005,15 @@ namespace Server Direction ret; - if( ((ay >> 1) - ax) >= 0 ) + if ( ((ay >> 1) - ax) >= 0 ) ret = (ry > 0) ? Direction.Up : Direction.Down; - else if( ((ax >> 1) - ay) >= 0 ) + else if ( ((ax >> 1) - ay) >= 0 ) ret = (rx > 0) ? Direction.Left : Direction.Right; - else if( rx >= 0 && ry >= 0 ) + else if ( rx >= 0 && ry >= 0 ) ret = Direction.West; - else if( rx >= 0 && ry < 0 ) + else if ( rx >= 0 && ry < 0 ) ret = Direction.South; - else if( rx < 0 && ry < 0 ) + else if ( rx < 0 && ry < 0 ) ret = Direction.East; else ret = Direction.North; @@ -10033,7 +10033,7 @@ namespace Server public Direction GetDirectionTo( IPoint2D p ) { - if( p == null ) + if ( p == null ) return Direction.North; return GetDirectionTo( p.X, p.Y ); @@ -10048,7 +10048,7 @@ namespace Server delta = m.m_DeltaFlags; - if( delta == MobileDelta.None ) + if ( delta == MobileDelta.None ) return; MobileDelta attrs = delta & MobileDelta.Attributes; @@ -10067,11 +10067,11 @@ namespace Server bool sendHealthbarPoison = false, sendHealthbarYellow = false; - if( attrs != MobileDelta.None ) + if ( attrs != MobileDelta.None ) { sendAny = true; - if( attrs == MobileDelta.Attributes ) + if ( attrs == MobileDelta.Attributes ) { sendAll = true; } @@ -10083,25 +10083,25 @@ namespace Server } } - if( (delta & MobileDelta.GhostUpdate) != 0 ) + if ( (delta & MobileDelta.GhostUpdate) != 0 ) { sendNonlocalIncoming = true; } - if( (delta & MobileDelta.Hue) != 0 ) + if ( (delta & MobileDelta.Hue) != 0 ) { sendNonlocalIncoming = true; sendUpdate = true; sendRemove = true; } - if( (delta & MobileDelta.Direction) != 0 ) + if ( (delta & MobileDelta.Direction) != 0 ) { sendNonlocalMoving = true; sendUpdate = true; } - if( (delta & MobileDelta.Body) != 0 ) + if ( (delta & MobileDelta.Body) != 0 ) { sendUpdate = true; sendIncoming = true; @@ -10118,22 +10118,22 @@ namespace Server sendUpdate = true; } else*/ - if( (delta & (MobileDelta.Flags | MobileDelta.Noto)) != 0 ) + if ( (delta & (MobileDelta.Flags | MobileDelta.Noto)) != 0 ) { sendMoving = true; } - if( (delta & MobileDelta.HealthbarPoison) != 0 ) + if ( (delta & MobileDelta.HealthbarPoison) != 0 ) { sendHealthbarPoison = true; } - if( (delta & MobileDelta.HealthbarYellow) != 0 ) + if ( (delta & MobileDelta.HealthbarYellow) != 0 ) { sendHealthbarYellow = true; } - if( (delta & MobileDelta.Name) != 0 ) + if ( (delta & MobileDelta.Name) != 0 ) { sendAll = false; sendHits = false; @@ -10141,24 +10141,24 @@ namespace Server sendPublicStats = true; } - if( (delta & (MobileDelta.WeaponDamage | MobileDelta.Resistances | MobileDelta.Stat | + if ( (delta & (MobileDelta.WeaponDamage | MobileDelta.Resistances | MobileDelta.Stat | MobileDelta.Weight | MobileDelta.Gold | MobileDelta.Armor | MobileDelta.StatCap | MobileDelta.Followers | MobileDelta.TithingPoints | MobileDelta.Race)) != 0 ) { sendPrivateStats = true; } - if( (delta & MobileDelta.Hair) != 0 ) + if ( (delta & MobileDelta.Hair) != 0 ) { - if( m.HairItemID <= 0 ) + if ( m.HairItemID <= 0 ) removeHair = true; sendHair = true; } - if( (delta & MobileDelta.FacialHair) != 0 ) + if ( (delta & MobileDelta.FacialHair) != 0 ) { - if( m.FacialHairItemID <= 0 ) + if ( m.FacialHairItemID <= 0 ) removeFacialHair = true; sendFacialHair = true; @@ -10168,9 +10168,9 @@ namespace Server NetState ourState = m.m_NetState; - if( ourState != null ) + if ( ourState != null ) { - if( sendUpdate ) + if ( sendUpdate ) { ourState.Sequence = 0; @@ -10186,7 +10186,7 @@ namespace Server ourState.Send(MobileIncoming.Create(ourState, m, m)); if ( ourState.StygianAbyss ) { - if( sendMoving ) + if ( sendMoving ) { int noto = Notoriety.Compute( m, m ); ourState.Send( cache[0][noto] = Packet.Acquire( new MobileMoving( m, noto ) ) ); @@ -10198,61 +10198,61 @@ namespace Server if ( sendHealthbarYellow ) ourState.Send( new HealthbarYellow( m ) ); } else { - if( sendMoving || sendHealthbarPoison || sendHealthbarYellow ) + if ( sendMoving || sendHealthbarPoison || sendHealthbarYellow ) { int noto = Notoriety.Compute( m, m ); ourState.Send( cache[1][noto] = Packet.Acquire( new MobileMovingOld( m, noto ) ) ); } } - if( sendPublicStats || sendPrivateStats ) + if ( sendPublicStats || sendPrivateStats ) { ourState.Send( new MobileStatusExtended( m, m_NetState ) ); } - else if( sendAll ) + else if ( sendAll ) { ourState.Send( new MobileAttributes( m ) ); } - else if( sendAny ) + else if ( sendAny ) { - if( sendHits ) + if ( sendHits ) ourState.Send( new MobileHits( m ) ); - if( sendStam ) + if ( sendStam ) ourState.Send( new MobileStam( m ) ); - if( sendMana ) + if ( sendMana ) ourState.Send( new MobileMana( m ) ); } - if( sendStam || sendMana ) + if ( sendStam || sendMana ) { IParty ip = m_Party as IParty; - if( ip != null && sendStam ) + if ( ip != null && sendStam ) ip.OnStamChanged( this ); - if( ip != null && sendMana ) + if ( ip != null && sendMana ) ip.OnManaChanged( this ); } - if( sendHair ) + if ( sendHair ) { - if( removeHair ) + if ( removeHair ) ourState.Send( new RemoveHair( m ) ); else ourState.Send( new HairEquipUpdate( m ) ); } - if( sendFacialHair ) + if ( sendFacialHair ) { - if( removeFacialHair ) + if ( removeFacialHair ) ourState.Send( new RemoveFacialHair( m ) ); else ourState.Send( new FacialHairEquipUpdate( m ) ); } - if( sendOPLUpdate ) + if ( sendOPLUpdate ) ourState.Send( OPLPacket ); } @@ -10260,7 +10260,7 @@ namespace Server sendIncoming = sendIncoming || sendNonlocalIncoming; sendHits = sendHits || sendAll; - if( m.m_Map != null && (sendRemove || sendIncoming || sendPublicStats || sendHits || sendMoving || sendOPLUpdate || sendHair || sendFacialHair || sendHealthbarPoison || sendHealthbarYellow) ) + if ( m.m_Map != null && (sendRemove || sendIncoming || sendPublicStats || sendHits || sendMoving || sendOPLUpdate || sendHair || sendFacialHair || sendHealthbarPoison || sendHealthbarYellow) ) { Mobile beholder; @@ -10278,16 +10278,16 @@ namespace Server foreach ( NetState state in eable ) { beholder = state.Mobile; - if( beholder != m && beholder.CanSee( m ) ) + if ( beholder != m && beholder.CanSee( m ) ) { - if( sendRemove ) + if ( sendRemove ) state.Send(this.RemovePacket); - if( sendIncoming ) + if ( sendIncoming ) { state.Send(MobileIncoming.Create(state, beholder, m)); - if( m.IsDeadBondedPet ) + if ( m.IsDeadBondedPet ) { if (deadPacket == null) deadPacket = Packet.Acquire(new BondedStatus(0, m.m_Serial, 1)); @@ -10297,7 +10297,7 @@ namespace Server } if ( state.StygianAbyss ) { - if( sendMoving ) + if ( sendMoving ) { int noto = Notoriety.Compute( beholder, m ); @@ -10323,7 +10323,7 @@ namespace Server state.Send( hbyPacket ); } } else { - if( sendMoving || sendHealthbarPoison || sendHealthbarYellow ) + if ( sendMoving || sendHealthbarPoison || sendHealthbarYellow ) { int noto = Notoriety.Compute( beholder, m ); @@ -10336,9 +10336,9 @@ namespace Server } } - if( sendPublicStats ) + if ( sendPublicStats ) { - if( m.CanBeRenamedBy( beholder ) ) + if ( m.CanBeRenamedBy( beholder ) ) { if (statPacketTrue == null) statPacketTrue = Packet.Acquire(new MobileStatusCompact(true, m)); @@ -10353,7 +10353,7 @@ namespace Server state.Send( statPacketFalse ); } } - else if( sendHits ) + else if ( sendHits ) { if (hitsPacket == null) hitsPacket = Packet.Acquire(new MobileHitsN(m)); @@ -10361,7 +10361,7 @@ namespace Server state.Send( hitsPacket ); } - if( sendHair ) + if ( sendHair ) { if (hairPacket == null) { if (removeHair) @@ -10373,7 +10373,7 @@ namespace Server state.Send( hairPacket ); } - if( sendFacialHair ) + if ( sendFacialHair ) { if (facialhairPacket == null) { if (removeFacialHair) @@ -10385,7 +10385,7 @@ namespace Server state.Send( facialhairPacket ); } - if( sendOPLUpdate ) + if ( sendOPLUpdate ) state.Send(this.OPLPacket); } } @@ -10402,7 +10402,7 @@ namespace Server eable.Free(); } - if( sendMoving || sendNonlocalMoving || sendHealthbarPoison || sendHealthbarYellow ) + if ( sendMoving || sendNonlocalMoving || sendHealthbarPoison || sendHealthbarYellow ) { for( int i = 0; i < cache.Length; ++i ) for( int j = 0; j < cache[i].Length; ++j ) @@ -10439,14 +10439,14 @@ namespace Server { int oldValue = m_Kills; - if( m_Kills != value ) + if ( m_Kills != value ) { m_Kills = value; - if( m_Kills < 0 ) + if ( m_Kills < 0 ) m_Kills = 0; - if( (oldValue >= 5) != (m_Kills >= 5) ) + if ( (oldValue >= 5) != (m_Kills >= 5) ) { Delta( MobileDelta.Noto ); InvalidateProperties(); @@ -10470,11 +10470,11 @@ namespace Server } set { - if( m_ShortTermMurders != value ) + if ( m_ShortTermMurders != value ) { m_ShortTermMurders = value; - if( m_ShortTermMurders < 0 ) + if ( m_ShortTermMurders < 0 ) m_ShortTermMurders = 0; } } @@ -10489,23 +10489,23 @@ namespace Server } set { - if( m_Criminal != value ) + if ( m_Criminal != value ) { m_Criminal = value; Delta( MobileDelta.Noto ); InvalidateProperties(); } - if( m_Criminal ) + if ( m_Criminal ) { - if( m_ExpireCriminal == null ) + if ( m_ExpireCriminal == null ) m_ExpireCriminal = new ExpireCriminalTimer( this ); else m_ExpireCriminal.Stop(); m_ExpireCriminal.Start(); } - else if( m_ExpireCriminal != null ) + else if ( m_ExpireCriminal != null ) { m_ExpireCriminal.Stop(); m_ExpireCriminal = null; @@ -10520,9 +10520,9 @@ namespace Server public bool CheckAlive( bool message ) { - if( !Alive ) + if ( !Alive ) { - if( message ) + if ( message ) this.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019048 ); // I am dead and cannot do that. return false; @@ -10542,11 +10542,11 @@ namespace Server public void PublicOverheadMessage( MessageType type, int hue, bool ascii, string text, bool noLineOfSight ) { - if( m_Map != null ) + if ( m_Map != null ) { Packet p = null; - if( ascii ) + if ( ascii ) p = new AsciiMessage( m_Serial, Body, type, hue, 3, Name, text ); else p = new UnicodeMessage( m_Serial, Body, type, hue, 3, m_Language, Name, text ); @@ -10556,7 +10556,7 @@ namespace Server IPooledEnumerable eable = m_Map.GetClientsInRange(m_Location); foreach( NetState state in eable ) { - if( state.Mobile.CanSee( this ) && (noLineOfSight || state.Mobile.InLOS( this )) ) { + if ( state.Mobile.CanSee( this ) && (noLineOfSight || state.Mobile.InLOS( this )) ) { state.Send( p ); } } @@ -10579,14 +10579,14 @@ namespace Server public void PublicOverheadMessage( MessageType type, int hue, int number, string args, bool noLineOfSight ) { - if( m_Map != null ) + if ( m_Map != null ) { Packet p = Packet.Acquire( new MessageLocalized( m_Serial, Body, type, hue, 3, number, Name, args ) ); IPooledEnumerable eable = m_Map.GetClientsInRange(m_Location); foreach( NetState state in eable ) { - if( state.Mobile.CanSee( this ) && (noLineOfSight || state.Mobile.InLOS( this )) ) { + if ( state.Mobile.CanSee( this ) && (noLineOfSight || state.Mobile.InLOS( this )) ) { state.Send( p ); } } @@ -10604,14 +10604,14 @@ namespace Server public void PublicOverheadMessage( MessageType type, int hue, int number, AffixType affixType, string affix, string args, bool noLineOfSight ) { - if( m_Map != null ) + if ( m_Map != null ) { Packet p = Packet.Acquire( new MessageLocalizedAffix( m_Serial, Body, type, hue, 3, number, Name, affixType, affix, args ) ); IPooledEnumerable eable = m_Map.GetClientsInRange(m_Location); foreach( NetState state in eable ) { - if( state.Mobile.CanSee( this ) && (noLineOfSight || state.Mobile.InLOS( this )) ) { + if ( state.Mobile.CanSee( this ) && (noLineOfSight || state.Mobile.InLOS( this )) ) { state.Send( p ); } } @@ -10624,10 +10624,10 @@ namespace Server public void PrivateOverheadMessage( MessageType type, int hue, bool ascii, string text, NetState state ) { - if( state == null ) + if ( state == null ) return; - if( ascii ) + if ( ascii ) state.Send( new AsciiMessage( m_Serial, Body, type, hue, 3, Name, text ) ); else state.Send( new UnicodeMessage( m_Serial, Body, type, hue, 3, m_Language, Name, text ) ); @@ -10640,7 +10640,7 @@ namespace Server public void PrivateOverheadMessage( MessageType type, int hue, int number, string args, NetState state ) { - if( state == null ) + if ( state == null ) return; state.Send( new MessageLocalized( m_Serial, Body, type, hue, 3, number, Name, args ) ); @@ -10650,9 +10650,9 @@ namespace Server { NetState ns = m_NetState; - if( ns != null ) + if ( ns != null ) { - if( ascii ) + if ( ascii ) ns.Send( new AsciiMessage( m_Serial, Body, type, hue, 3, Name, text ) ); else ns.Send( new UnicodeMessage( m_Serial, Body, type, hue, 3, m_Language, Name, text ) ); @@ -10668,7 +10668,7 @@ namespace Server { NetState ns = m_NetState; - if( ns != null ) + if ( ns != null ) ns.Send( new MessageLocalized( m_Serial, Body, type, hue, 3, number, Name, args ) ); } @@ -10679,14 +10679,14 @@ namespace Server public void NonlocalOverheadMessage( MessageType type, int hue, int number, string args ) { - if( m_Map != null ) + if ( m_Map != null ) { Packet p = Packet.Acquire( new MessageLocalized( m_Serial, Body, type, hue, 3, number, Name, args ) ); IPooledEnumerable eable = m_Map.GetClientsInRange(m_Location); foreach( NetState state in eable ) { - if( state != m_NetState && state.Mobile.CanSee( this ) ) { + if ( state != m_NetState && state.Mobile.CanSee( this ) ) { state.Send( p ); } } @@ -10699,11 +10699,11 @@ namespace Server public void NonlocalOverheadMessage( MessageType type, int hue, bool ascii, string text ) { - if( m_Map != null ) + if ( m_Map != null ) { Packet p = null; - if( ascii ) + if ( ascii ) p = new AsciiMessage( m_Serial, Body, type, hue, 3, Name, text ); else p = new UnicodeMessage( m_Serial, Body, type, hue, 3, Language, Name, text ); @@ -10713,7 +10713,7 @@ namespace Server IPooledEnumerable eable = m_Map.GetClientsInRange(m_Location); foreach( NetState state in eable ) { - if( state != m_NetState && state.Mobile.CanSee( this ) ) { + if ( state != m_NetState && state.Mobile.CanSee( this ) ) { state.Send( p ); } } @@ -10732,7 +10732,7 @@ namespace Server { NetState ns = m_NetState; - if( ns != null ) + if ( ns != null ) ns.Send( MessageLocalized.InstantiateGeneric( number ) ); } @@ -10743,18 +10743,18 @@ namespace Server public void SendLocalizedMessage( int number, string args, int hue ) { - if( hue == 0x3B2 && (args == null || args.Length == 0) ) + if ( hue == 0x3B2 && (args == null || args.Length == 0) ) { NetState ns = m_NetState; - if( ns != null ) + if ( ns != null ) ns.Send( MessageLocalized.InstantiateGeneric( number ) ); } else { NetState ns = m_NetState; - if( ns != null ) + if ( ns != null ) ns.Send( new MessageLocalized( Serial.MinusOne, -1, MessageType.Regular, hue, 3, number, "System", args ) ); } } @@ -10773,7 +10773,7 @@ namespace Server { NetState ns = m_NetState; - if( ns != null ) + if ( ns != null ) ns.Send( new MessageLocalizedAffix( Serial.MinusOne, -1, MessageType.Regular, hue, 3, number, "System", (append ? AffixType.Append : AffixType.Prepend) | AffixType.System, affix, args ) ); } @@ -10781,7 +10781,7 @@ namespace Server public void LaunchBrowser( string url ) { - if( m_NetState != null ) + if ( m_NetState != null ) m_NetState.LaunchBrowser( url ); } @@ -10801,7 +10801,7 @@ namespace Server { NetState ns = m_NetState; - if( ns != null ) + if ( ns != null ) ns.Send( new UnicodeMessage( Serial.MinusOne, -1, MessageType.Regular, hue, 3, "ENU", "System", text ) ); } @@ -10824,7 +10824,7 @@ namespace Server { NetState ns = m_NetState; - if( ns != null ) + if ( ns != null ) ns.Send( new AsciiMessage( Serial.MinusOne, -1, MessageType.Regular, hue, 3, "System", text ) ); } @@ -10882,7 +10882,7 @@ namespace Server private static bool m_DisableDismountInWarmode; public static bool DisableDismountInWarmode { get { return m_DisableDismountInWarmode; } set { m_DisableDismountInWarmode = value; } } - + #region OnDoubleClick[..] /// @@ -10892,18 +10892,18 @@ namespace Server /// public virtual void OnDoubleClick( Mobile from ) { - if( this == from && (!m_DisableDismountInWarmode || !m_Warmode) ) + if ( this == from && (!m_DisableDismountInWarmode || !m_Warmode) ) { IMount mount = Mount; - if( mount != null ) + if ( mount != null ) { mount.Rider = null; return; } } - if( CanPaperdollBeOpenedBy( from ) ) + if ( CanPaperdollBeOpenedBy( from ) ) DisplayPaperdollTo( from ); } @@ -10929,7 +10929,7 @@ namespace Server /// public virtual void OnDoubleClickDead( Mobile from ) { - if( CanPaperdollBeOpenedBy( from ) ) + if ( CanPaperdollBeOpenedBy( from ) ) DisplayPaperdollTo( from ); } @@ -10940,7 +10940,7 @@ namespace Server /// public virtual void OnPaperdollRequest() { - if( CanPaperdollBeOpenedBy( this ) ) + if ( CanPaperdollBeOpenedBy( this ) ) DisplayPaperdollTo( this ); } @@ -10954,15 +10954,15 @@ namespace Server /// public virtual void OnStatsQuery( Mobile from ) { - if( from.Map == this.Map && Utility.InUpdateRange( this, from ) && from.CanSee( this ) ) + if ( from.Map == this.Map && Utility.InUpdateRange( this, from ) && from.CanSee( this ) ) from.Send( new MobileStatus( from, this, m_NetState ) ); - if( from == this ) + if ( from == this ) Send( new StatLockInfo( this ) ); IParty ip = m_Party as IParty; - if( ip != null ) + if ( ip != null ) ip.OnStatsQuery( from, this ); } @@ -10971,7 +10971,7 @@ namespace Server /// public virtual void OnSkillsQuery( Mobile from ) { - if( from == this ) + if ( from == this ) Send( new SkillUpdate( m_Skills ) ); } @@ -10991,10 +10991,10 @@ namespace Server { IMountItem mountItem = null; - if( m_MountItem != null && !m_MountItem.Deleted && m_MountItem.Parent == this ) + if ( m_MountItem != null && !m_MountItem.Deleted && m_MountItem.Parent == this ) mountItem = (IMountItem)m_MountItem; - if( mountItem == null ) + if ( mountItem == null ) m_MountItem = (mountItem = (FindItemOnLayer( Layer.Mount ) as IMountItem)) as Item; return mountItem == null ? null : mountItem.Mount; @@ -11020,9 +11020,9 @@ namespace Server } set { - if( m_QuestArrow != value ) + if ( m_QuestArrow != value ) { - if( m_QuestArrow != null ) + if ( m_QuestArrow != null ) m_QuestArrow.Stop(); m_QuestArrow = value; @@ -11052,33 +11052,33 @@ namespace Server public static bool GuildClickMessage { get { return m_GuildClickMessage; } set { m_GuildClickMessage = value; } } public static bool OldPropertyTitles { get { return m_OldPropertyTitles; } set { m_OldPropertyTitles = value; } } - public virtual bool ShowFameTitle { get { return true; } }//(m_Player || m_Body.IsHuman) && m_Fame >= 10000; } + public virtual bool ShowFameTitle { get { return true; } }//(m_Player || m_Body.IsHuman) && m_Fame >= 10000; } /// /// Overridable. Event invoked when the Mobile is single clicked. /// public virtual void OnSingleClick( Mobile from ) { - if( m_Deleted ) + if ( m_Deleted ) return; - else if( AccessLevel == AccessLevel.Player && DisableHiddenSelfClick && Hidden && from == this ) + else if ( AccessLevel == AccessLevel.Player && DisableHiddenSelfClick && Hidden && from == this ) return; - if( m_GuildClickMessage ) + if ( m_GuildClickMessage ) { BaseGuild guild = m_Guild; - if( guild != null && (m_DisplayGuildTitle || (m_Player && guild.Type != GuildType.Regular)) ) + if ( guild != null && (m_DisplayGuildTitle || (m_Player && guild.Type != GuildType.Regular)) ) { string title = GuildTitle; string type; - if( title == null ) + if ( title == null ) title = ""; else title = title.Trim(); - if( guild.Type >= 0 && (int)guild.Type < m_GuildTypes.Length ) + if ( guild.Type >= 0 && (int)guild.Type < m_GuildTypes.Length ) type = m_GuildTypes[(int)guild.Type]; else type = ""; @@ -11091,37 +11091,37 @@ namespace Server int hue; - if( m_NameHue != -1 ) + if ( m_NameHue != -1 ) hue = m_NameHue; - else if( AccessLevel > AccessLevel.Player ) + else if ( AccessLevel > AccessLevel.Player ) hue = 11; else hue = Notoriety.GetHue( Notoriety.Compute( from, this ) ); string name = Name; - if( name == null ) + if ( name == null ) name = String.Empty; string prefix = ""; - if( ShowFameTitle && (m_Player || m_Body.IsHuman) && m_Fame >= 10000 ) + if ( ShowFameTitle && (m_Player || m_Body.IsHuman) && m_Fame >= 10000 ) prefix = (m_Female ? "Lady" : "Lord"); string suffix = ""; - if( ClickTitle && Title != null && Title.Length > 0 ) + if ( ClickTitle && Title != null && Title.Length > 0 ) suffix = Title; suffix = ApplyNameSuffix( suffix ); string val; - if( prefix.Length > 0 && suffix.Length > 0 ) + if ( prefix.Length > 0 && suffix.Length > 0 ) val = String.Concat( prefix, " ", name, " ", suffix ); - else if( prefix.Length > 0 ) + else if ( prefix.Length > 0 ) val = String.Concat( prefix, " ", name ); - else if( suffix.Length > 0 ) + else if ( suffix.Length > 0 ) val = String.Concat( name, " ", suffix ); else val = name; @@ -11131,7 +11131,7 @@ namespace Server public bool CheckSkill( SkillName skill, double minSkill, double maxSkill ) { - if( m_SkillCheckLocationHandler == null ) + if ( m_SkillCheckLocationHandler == null ) return false; else return m_SkillCheckLocationHandler( this, skill, minSkill, maxSkill ); @@ -11139,7 +11139,7 @@ namespace Server public bool CheckSkill( SkillName skill, double chance ) { - if( m_SkillCheckDirectLocationHandler == null ) + if ( m_SkillCheckDirectLocationHandler == null ) return false; else return m_SkillCheckDirectLocationHandler( this, skill, chance ); @@ -11147,7 +11147,7 @@ namespace Server public bool CheckTargetSkill( SkillName skill, object target, double minSkill, double maxSkill ) { - if( m_SkillCheckTargetHandler == null ) + if ( m_SkillCheckTargetHandler == null ) return false; else return m_SkillCheckTargetHandler( this, skill, target, minSkill, maxSkill ); @@ -11155,7 +11155,7 @@ namespace Server public bool CheckTargetSkill( SkillName skill, object target, double chance ) { - if( m_SkillCheckDirectTargetHandler == null ) + if ( m_SkillCheckDirectTargetHandler == null ) return false; else return m_SkillCheckDirectTargetHandler( this, skill, target, chance ); @@ -11163,7 +11163,7 @@ namespace Server public virtual void DisruptiveAction() { - if( Meditating ) + if ( Meditating ) { Meditating = false; SendLocalizedMessage( 500134 ); // You stop meditating. @@ -11217,7 +11217,7 @@ namespace Server { Item ar = FindItemOnLayer( Layer.InnerLegs ) as Item; - if( ar == null ) + if ( ar == null ) ar = FindItemOnLayer( Layer.Pants ) as Item; return ar; @@ -11230,7 +11230,7 @@ namespace Server { Item ar = FindItemOnLayer( Layer.InnerTorso ) as Item; - if( ar == null ) + if ( ar == null ) ar = FindItemOnLayer( Layer.Shirt ) as Item; return ar; @@ -11258,7 +11258,7 @@ namespace Server } set { - if( m_StatCap != value ) + if ( m_StatCap != value ) { m_StatCap = value; diff --git a/Server/Network/PacketHandlers.cs b/Server/Network/PacketHandlers.cs index e4a1aa7b6..90c0c971e 100644 --- a/Server/Network/PacketHandlers.cs +++ b/Server/Network/PacketHandlers.cs @@ -441,7 +441,7 @@ namespace Server.Network byte layer = pvSrc.ReadByte(); Serial serial = pvSrc.ReadInt32(); int amount = pvSrc.ReadInt16(); - + buyList.Add( new BuyItemResponse( serial, amount ) ); } @@ -2028,11 +2028,11 @@ namespace Server.Network public static PlayCharCallback ThirdPartyAuthCallback = null, ThirdPartyHackedCallback = null; - private static byte[] m_ThirdPartyAuthKey = new byte[] - { - 0x9, 0x11, 0x83, (byte)'+', 0x4, 0x17, 0x83, - 0x5, 0x24, 0x85, - 0x7, 0x17, 0x87, + private static byte[] m_ThirdPartyAuthKey = new byte[] + { + 0x9, 0x11, 0x83, (byte)'+', 0x4, 0x17, 0x83, + 0x5, 0x24, 0x85, + 0x7, 0x17, 0x87, 0x6, 0x19, 0x88, }; @@ -2080,7 +2080,7 @@ namespace Server.Network bool match = true; for ( int i=0; match && i < m_ThirdPartyAuthKey.Length; i++ ) match = match && pvSrc.ReadByte() == m_ThirdPartyAuthKey[i]; - + if ( match ) authOK = true; } @@ -2308,7 +2308,7 @@ namespace Server.Network race = Race.Races[(byte)(genderRace / 2)]; } - if( race == null ) + if ( race == null ) race = Race.DefaultRace; CityInfo[] info = state.CityInfo; @@ -2427,8 +2427,8 @@ namespace Server.Network byte raceID = (byte)(genderRace < 4 ? 0 : ((genderRace / 2) - 1)); race = Race.Races[raceID]; - - if( race == null ) + + if ( race == null ) race = Race.DefaultRace; CityInfo[] info = state.CityInfo; @@ -2518,7 +2518,7 @@ namespace Server.Network private static Dictionary m_AuthIDWindow = new Dictionary( m_AuthIDWindowSize ); private static int GenerateAuthID( NetState state ) - { + { if ( m_AuthIDWindow.Count == m_AuthIDWindowSize ) { int oldestID = 0; DateTime oldest = DateTime.MaxValue; @@ -2532,7 +2532,7 @@ namespace Server.Network m_AuthIDWindow.Remove( oldestID ); } - + int authID; do { @@ -2543,7 +2543,7 @@ namespace Server.Network } while ( m_AuthIDWindow.ContainsKey( authID ) ); m_AuthIDWindow[authID] = new AuthIDPersistence( state.Version ); - + return authID; } @@ -2569,7 +2569,7 @@ namespace Server.Network state.Dispose(); return; } - + if ( state.m_AuthID != 0 && authID != state.m_AuthID ) { Console.WriteLine( "Login: {0}: Invalid client detected, disconnecting", state ); diff --git a/Server/Network/Packets.cs b/Server/Network/Packets.cs index 5444a9afd..267be55ba 100644 --- a/Server/Network/Packets.cs +++ b/Server/Network/Packets.cs @@ -303,7 +303,7 @@ namespace Server.Network for ( int i = list.Count - 1; i >= 0; --i ) { BuyItemState bis = (BuyItemState)list[i]; - + m_Stream.Write( (int)bis.MySerial ); m_Stream.Write( (ushort)bis.ItemID ); m_Stream.Write( (byte)0 );//itemid offset @@ -331,7 +331,7 @@ namespace Server.Network for ( int i = list.Count - 1; i >= 0; --i ) { BuyItemState bis = (BuyItemState)list[i]; - + m_Stream.Write( (int)bis.MySerial ); m_Stream.Write( (ushort)bis.ItemID ); m_Stream.Write( (byte)0 );//itemid offset @@ -575,7 +575,7 @@ namespace Server.Network m_Stream.Write( (int) -3 ); - if ( name == null ) + if ( name == null ) m_Stream.Write( (ushort) 0 ); else { @@ -837,7 +837,7 @@ namespace Server.Network string question = menu.Question; - if ( question == null ) + if ( question == null ) m_Stream.Write( (byte) 0 ); else { @@ -858,7 +858,7 @@ namespace Server.Network string answer = answers[i]; - if ( answer == null ) + if ( answer == null ) m_Stream.Write( (byte) 0 ); else { @@ -1193,7 +1193,7 @@ namespace Server.Network itemID &= 0x3FFF; - m_Stream.Write( (short) itemID ); + m_Stream.Write( (short) itemID ); m_Stream.Write( (byte) 0 ); /*} else if ( ) { @@ -1201,7 +1201,7 @@ namespace Server.Network m_Stream.Write( (int) item.Serial ); - m_Stream.Write( (short) itemID ); + m_Stream.Write( (short) itemID ); m_Stream.Write( (byte) item.Direction );*/ } else { @@ -1211,7 +1211,7 @@ namespace Server.Network itemID &= 0x7FFF; - m_Stream.Write( (short) itemID ); + m_Stream.Write( (short) itemID ); m_Stream.Write( (byte) 0 ); } @@ -1248,7 +1248,7 @@ namespace Server.Network itemID &= 0x3FFF; - m_Stream.Write( (ushort) itemID ); + m_Stream.Write( (ushort) itemID ); m_Stream.Write( (byte) 0 ); /*} else if ( ) { @@ -1256,7 +1256,7 @@ namespace Server.Network m_Stream.Write( (int) item.Serial ); - m_Stream.Write( (ushort) itemID ); + m_Stream.Write( (ushort) itemID ); m_Stream.Write( (byte) item.Direction );*/ } else { @@ -1266,7 +1266,7 @@ namespace Server.Network itemID &= 0xFFFF; - m_Stream.Write( (ushort) itemID ); + m_Stream.Write( (ushort) itemID ); m_Stream.Write( (byte) 0 ); } @@ -1622,7 +1622,7 @@ namespace Server.Network public ScreenFadeOut() : base( ScreenEffectType.FadeOut ) - { + { } } @@ -1642,7 +1642,7 @@ namespace Server.Network public ScreenFadeInOut() : base( ScreenEffectType.FadeInOut ) - { + { } } @@ -1662,7 +1662,7 @@ namespace Server.Network public ScreenDarkFlash() : base( ScreenEffectType.DarkFlash ) - { + { } } @@ -3285,7 +3285,7 @@ namespace Server.Network m_Stream.Write( (int) m.Serial ); m_Stream.Write( (short) 1 ); - + m_Stream.Write( (short) 1 ); Poison p = m.Poison; @@ -3497,9 +3497,9 @@ namespace Server.Network List eq = beheld.Items; int count = eq.Count; - if( beheld.HairItemID > 0 ) + if ( beheld.HairItemID > 0 ) count++; - if( beheld.FacialHairItemID > 0 ) + if ( beheld.FacialHairItemID > 0 ) count++; this.EnsureCapacity( 23 + (count * 9) ); @@ -3549,54 +3549,54 @@ namespace Server.Network } } - if( beheld.HairItemID > 0 ) + if ( beheld.HairItemID > 0 ) { - if( m_DupedLayers[(int)Layer.Hair] != m_Version ) + if ( m_DupedLayers[(int)Layer.Hair] != m_Version ) { m_DupedLayers[(int)Layer.Hair] = m_Version; hue = beheld.HairHue; - if( beheld.SolidHueOverride >= 0 ) + if ( beheld.SolidHueOverride >= 0 ) hue = beheld.SolidHueOverride; int itemID = beheld.HairItemID & 0x7FFF; bool writeHue = (hue != 0); - if( writeHue ) + if ( writeHue ) itemID |= 0x8000; m_Stream.Write( (int)HairInfo.FakeSerial( beheld ) ); m_Stream.Write( (ushort)itemID ); m_Stream.Write( (byte)Layer.Hair ); - if( writeHue ) + if ( writeHue ) m_Stream.Write( (short)hue ); } } - if( beheld.FacialHairItemID > 0 ) + if ( beheld.FacialHairItemID > 0 ) { - if( m_DupedLayers[(int)Layer.FacialHair] != m_Version ) + if ( m_DupedLayers[(int)Layer.FacialHair] != m_Version ) { m_DupedLayers[(int)Layer.FacialHair] = m_Version; hue = beheld.FacialHairHue; - if( beheld.SolidHueOverride >= 0 ) + if ( beheld.SolidHueOverride >= 0 ) hue = beheld.SolidHueOverride; int itemID = beheld.FacialHairItemID & 0x7FFF; bool writeHue = (hue != 0); - if( writeHue ) + if ( writeHue ) itemID |= 0x8000; m_Stream.Write( (int)FacialHairInfo.FakeSerial( beheld ) ); m_Stream.Write( (ushort)itemID ); m_Stream.Write( (byte)Layer.FacialHair ); - if( writeHue ) + if ( writeHue ) m_Stream.Write( (short)hue ); } } @@ -3623,9 +3623,9 @@ namespace Server.Network List eq = beheld.Items; int count = eq.Count; - if( beheld.HairItemID > 0 ) + if ( beheld.HairItemID > 0 ) count++; - if( beheld.FacialHairItemID > 0 ) + if ( beheld.FacialHairItemID > 0 ) count++; this.EnsureCapacity( 23 + (count * 9) ); @@ -3675,54 +3675,54 @@ namespace Server.Network } } - if( beheld.HairItemID > 0 ) + if ( beheld.HairItemID > 0 ) { - if( m_DupedLayers[(int)Layer.Hair] != m_Version ) + if ( m_DupedLayers[(int)Layer.Hair] != m_Version ) { m_DupedLayers[(int)Layer.Hair] = m_Version; hue = beheld.HairHue; - if( beheld.SolidHueOverride >= 0 ) + if ( beheld.SolidHueOverride >= 0 ) hue = beheld.SolidHueOverride; int itemID = beheld.HairItemID & 0x7FFF; bool writeHue = (hue != 0); - if( writeHue ) + if ( writeHue ) itemID |= 0x8000; m_Stream.Write( (int)HairInfo.FakeSerial( beheld ) ); m_Stream.Write( (ushort)itemID ); m_Stream.Write( (byte)Layer.Hair ); - if( writeHue ) + if ( writeHue ) m_Stream.Write( (short)hue ); } } - if( beheld.FacialHairItemID > 0 ) + if ( beheld.FacialHairItemID > 0 ) { - if( m_DupedLayers[(int)Layer.FacialHair] != m_Version ) + if ( m_DupedLayers[(int)Layer.FacialHair] != m_Version ) { m_DupedLayers[(int)Layer.FacialHair] = m_Version; hue = beheld.FacialHairHue; - if( beheld.SolidHueOverride >= 0 ) + if ( beheld.SolidHueOverride >= 0 ) hue = beheld.SolidHueOverride; int itemID = beheld.FacialHairItemID & 0x7FFF; bool writeHue = (hue != 0); - if( writeHue ) + if ( writeHue ) itemID |= 0x8000; m_Stream.Write( (int)FacialHairInfo.FakeSerial( beheld ) ); m_Stream.Write( (ushort)itemID ); m_Stream.Write( (byte)Layer.FacialHair ); - if( writeHue ) + if ( writeHue ) m_Stream.Write( (short)hue ); } } diff --git a/Server/Persistence/DualSaveStrategy.cs b/Server/Persistence/DualSaveStrategy.cs index eebc299f3..b9a933095 100644 --- a/Server/Persistence/DualSaveStrategy.cs +++ b/Server/Persistence/DualSaveStrategy.cs @@ -39,7 +39,7 @@ namespace Server { { this.PermitBackgroundWrite = permitBackgroundWrite; - Thread saveThread = new Thread( delegate() { + Thread saveThread = new Thread( delegate { SaveItems(metrics); } ); diff --git a/Server/Persistence/DynamicSaveStrategy.cs b/Server/Persistence/DynamicSaveStrategy.cs index 3e58c9bda..7f05e9397 100644 --- a/Server/Persistence/DynamicSaveStrategy.cs +++ b/Server/Persistence/DynamicSaveStrategy.cs @@ -239,7 +239,7 @@ namespace Server while( _decayBag.TryTake( out item ) ) { - if( item.OnDecay() ) + if ( item.OnDecay() ) { item.Delete(); } diff --git a/Server/Race.cs b/Server/Race.cs index bd32326d4..2099cbe01 100644 --- a/Server/Race.cs +++ b/Server/Race.cs @@ -67,14 +67,14 @@ namespace Server for( int i = 0; i < m_RaceNames.Length; ++i ) { - if( Insensitive.Equals( m_RaceNames[i], value ) ) + if ( Insensitive.Equals( m_RaceNames[i], value ) ) return m_RaceValues[i]; } int index; - if( int.TryParse( value, out index ) ) + if ( int.TryParse( value, out index ) ) { - if( index >= 0 && index < m_Races.Length && m_Races[index] != null ) + if ( index >= 0 && index < m_Races.Length && m_Races[index] != null ) return m_Races[index]; } @@ -83,7 +83,7 @@ namespace Server private static void CheckNamesAndValues() { - if( m_RaceNames != null && m_RaceNames.Length == m_AllRaces.Count ) + if ( m_RaceNames != null && m_RaceNames.Length == m_AllRaces.Count ) return; m_RaceNames = new string[m_AllRaces.Count]; @@ -151,7 +151,7 @@ namespace Server public virtual int Body( Mobile m ) { - if( m.Alive ) + if ( m.Alive ) return AliveBody( m.Female ); return GhostBody( m.Female ); @@ -209,4 +209,4 @@ namespace Server } } } -} \ No newline at end of file +} diff --git a/Server/Region.cs b/Server/Region.cs index 54a792e77..c501ce388 100644 --- a/Server/Region.cs +++ b/Server/Region.cs @@ -1142,7 +1142,7 @@ namespace Server T tempVal; - if( type.IsEnum && Enum.TryParse( s, true, out tempVal ) ) + if ( type.IsEnum && Enum.TryParse( s, true, out tempVal ) ) { value = tempVal; return true; @@ -1282,4 +1282,4 @@ namespace Server return true; } } -} \ No newline at end of file +} diff --git a/Server/ScriptCompiler.cs b/Server/ScriptCompiler.cs index d9545832c..e3935392d 100644 --- a/Server/ScriptCompiler.cs +++ b/Server/ScriptCompiler.cs @@ -57,7 +57,7 @@ namespace Server string path = Path.Combine( Core.BaseDirectory, "Data/Assemblies.cfg" ); - if( File.Exists( path ) ) + if ( File.Exists( path ) ) { using( StreamReader ip = new StreamReader( path ) ) { @@ -65,7 +65,7 @@ namespace Server while( (line = ip.ReadLine()) != null ) { - if( line.Length > 0 && !line.StartsWith( "#" ) ) + if ( line.Length > 0 && !line.StartsWith( "#" ) ) list.Add( line ); } } @@ -80,20 +80,20 @@ namespace Server public static string GetCompilerOptions( bool debug ) { - StringBuilder sb = null; + StringBuilder sb = null; AppendCompilerOption( ref sb, "/unsafe" ); - if( !debug ) + if ( !debug ) AppendCompilerOption( ref sb, "/optimize" ); #if MONO AppendCompilerOption( ref sb, "/d:MONO" ); #endif - if( Core.Is64Bit ) + if ( Core.Is64Bit ) AppendCompilerOption( ref sb, "/d:x64" ); - + #if NEWTIMERS AppendCompilerOption(ref sb, "/d:NEWTIMERS"); #endif @@ -107,7 +107,7 @@ namespace Server private static void AppendCompilerOption( ref StringBuilder sb, string define ) { - if( sb == null ) + if ( sb == null ) sb = new StringBuilder(); else sb.Append( ' ' ); @@ -160,16 +160,16 @@ namespace Server Console.Write( "Scripts: Compiling C# scripts..." ); string[] files = GetScripts( "*.cs" ); - if( files.Length == 0 ) + if ( files.Length == 0 ) { Console.WriteLine( "no files found." ); assembly = null; return true; } - if( File.Exists( "Scripts/Output/Scripts.CS.dll" ) ) + if ( File.Exists( "Scripts/Output/Scripts.CS.dll" ) ) { - if( cache && File.Exists( "Scripts/Output/Scripts.CS.hash" ) ) + if ( cache && File.Exists( "Scripts/Output/Scripts.CS.hash" ) ) { try { @@ -181,24 +181,24 @@ namespace Server { byte[] bytes = bin.ReadBytes( hashCode.Length ); - if( bytes.Length == hashCode.Length ) + if ( bytes.Length == hashCode.Length ) { bool valid = true; for( int i = 0; i < bytes.Length; ++i ) { - if( bytes[i] != hashCode[i] ) + if ( bytes[i] != hashCode[i] ) { valid = false; break; } } - if( valid ) + if ( valid ) { assembly = Assembly.LoadFrom( "Scripts/Output/Scripts.CS.dll" ); - if( !m_AdditionalReferences.Contains( assembly.Location ) ) + if ( !m_AdditionalReferences.Contains( assembly.Location ) ) { m_AdditionalReferences.Add( assembly.Location ); } @@ -227,10 +227,10 @@ namespace Server string options = GetCompilerOptions( debug ); - if( options != null ) + if ( options != null ) parms.CompilerOptions = options; - if( Core.HaltOnWarning ) + if ( Core.HaltOnWarning ) parms.WarningLevel = 4; if (Core.Unix) @@ -262,7 +262,7 @@ namespace Server } - if( cache && Path.GetFileName( path ) == "Scripts.CS.dll" ) + if ( cache && Path.GetFileName( path ) == "Scripts.CS.dll" ) { try { @@ -301,16 +301,16 @@ namespace Server Console.Write( "Scripts: Compiling VB.NET scripts..." ); string[] files = GetScripts( "*.vb" ); - if( files.Length == 0 ) + if ( files.Length == 0 ) { Console.WriteLine( "no files found." ); assembly = null; return true; } - if( File.Exists( "Scripts/Output/Scripts.VB.dll" ) ) + if ( File.Exists( "Scripts/Output/Scripts.VB.dll" ) ) { - if( cache && File.Exists( "Scripts/Output/Scripts.VB.hash" ) ) + if ( cache && File.Exists( "Scripts/Output/Scripts.VB.hash" ) ) { byte[] hashCode = GetHashCode( "Scripts/Output/Scripts.VB.dll", files, debug ); @@ -322,24 +322,24 @@ namespace Server { byte[] bytes = bin.ReadBytes( hashCode.Length ); - if( bytes.Length == hashCode.Length ) + if ( bytes.Length == hashCode.Length ) { bool valid = true; for( int i = 0; i < bytes.Length; ++i ) { - if( bytes[i] != hashCode[i] ) + if ( bytes[i] != hashCode[i] ) { valid = false; break; } } - if( valid ) + if ( valid ) { assembly = Assembly.LoadFrom( "Scripts/Output/Scripts.VB.dll" ); - if( !m_AdditionalReferences.Contains( assembly.Location ) ) + if ( !m_AdditionalReferences.Contains( assembly.Location ) ) { m_AdditionalReferences.Add( assembly.Location ); } @@ -368,10 +368,10 @@ namespace Server string options = GetCompilerOptions( debug ); - if( options != null ) + if ( options != null ) parms.CompilerOptions = options; - if( Core.HaltOnWarning ) + if ( Core.HaltOnWarning ) parms.WarningLevel = 4; if (Core.Unix) @@ -402,7 +402,7 @@ namespace Server } } - if( cache && Path.GetFileName( path ) == "Scripts.VB.dll" ) + if ( cache && Path.GetFileName( path ) == "Scripts.VB.dll" ) { try { @@ -428,7 +428,7 @@ namespace Server public static void Display( CompilerResults results ) { - if( results.Errors.Count > 0 ) + if ( results.Errors.Count > 0 ) { Dictionary> errors = new Dictionary>( results.Errors.Count, StringComparer.OrdinalIgnoreCase ); Dictionary> warnings = new Dictionary>( results.Errors.Count, StringComparer.OrdinalIgnoreCase ); @@ -448,13 +448,13 @@ namespace Server List list = null; table.TryGetValue( file, out list ); - if( list == null ) + if ( list == null ) table[file] = list = new List(); list.Add( e ); } - if( errors.Count > 0 ) + if ( errors.Count > 0 ) Console.WriteLine( "failed ({0} errors, {1} warnings)", errors.Count, warnings.Count ); else Console.WriteLine( "done ({0} errors, {1} warnings)", errors.Count, warnings.Count ); @@ -464,7 +464,7 @@ namespace Server Utility.PushColor( ConsoleColor.Yellow ); - if( warnings.Count > 0 ) + if ( warnings.Count > 0 ) Console.WriteLine( "Warnings:" ); foreach( KeyValuePair> kvp in warnings ) @@ -489,7 +489,7 @@ namespace Server Utility.PushColor( ConsoleColor.Red ); - if( errors.Count > 0 ) + if ( errors.Count > 0 ) Console.WriteLine( "Errors:" ); foreach( KeyValuePair> kvp in errors ) @@ -562,16 +562,16 @@ namespace Server EnsureDirectory( "Scripts/" ); EnsureDirectory( "Scripts/Output/" ); - if( m_AdditionalReferences.Count > 0 ) + if ( m_AdditionalReferences.Count > 0 ) m_AdditionalReferences.Clear(); List assemblies = new List(); Assembly assembly; - if( CompileCSScripts( debug, cache, out assembly ) ) + if ( CompileCSScripts( debug, cache, out assembly ) ) { - if( assembly != null ) + if ( assembly != null ) { assemblies.Add( assembly ); } @@ -600,7 +600,7 @@ namespace Server Console.WriteLine( "Scripts: Skipping VB.NET Scripts...done (use -vb to enable)"); } - if( assemblies.Count == 0 ) + if ( assemblies.Count == 0 ) { return false; } @@ -610,9 +610,9 @@ namespace Server Console.Write( "Scripts: Verifying..." ); Stopwatch watch = Stopwatch.StartNew(); - + Core.VerifySerialization(); - + watch.Stop(); Console.WriteLine("done ({0} items, {1} mobiles) ({2:F2} seconds)", Core.ScriptItems, Core.ScriptMobiles, watch.Elapsed.TotalSeconds); @@ -632,7 +632,7 @@ namespace Server { MethodInfo m = types[i].GetMethod( method, BindingFlags.Static | BindingFlags.Public ); - if( m != null ) + if ( m != null ) invoke.Add( m ); } } @@ -648,9 +648,9 @@ namespace Server public static TypeCache GetTypeCache( Assembly asm ) { - if( asm == null ) + if ( asm == null ) { - if( m_NullCache == null ) + if ( m_NullCache == null ) m_NullCache = new TypeCache( null ); return m_NullCache; @@ -659,7 +659,7 @@ namespace Server TypeCache c = null; m_TypeCaches.TryGetValue( asm, out c ); - if( c == null ) + if ( c == null ) m_TypeCaches[asm] = c = new TypeCache( asm ); return c; @@ -677,7 +677,7 @@ namespace Server for( int i = 0; type == null && i < m_Assemblies.Length; ++i ) type = GetTypeCache( m_Assemblies[i] ).GetTypeByFullName( fullName, ignoreCase ); - if( type == null ) + if ( type == null ) type = GetTypeCache( Core.Assembly ).GetTypeByFullName( fullName, ignoreCase ); return type; @@ -695,7 +695,7 @@ namespace Server for( int i = 0; type == null && i < m_Assemblies.Length; ++i ) type = GetTypeCache( m_Assemblies[i] ).GetTypeByName( name, ignoreCase ); - if( type == null ) + if ( type == null ) type = GetTypeCache( Core.Assembly ).GetTypeByName( name, ignoreCase ); return type; @@ -705,7 +705,7 @@ namespace Server { string path = Path.Combine( Core.BaseDirectory, dir ); - if( !Directory.Exists( path ) ) + if ( !Directory.Exists( path ) ) Directory.CreateDirectory( path ); } @@ -748,7 +748,7 @@ namespace Server public TypeCache( Assembly asm ) { - if( asm == null ) + if ( asm == null ) m_Types = Type.EmptyTypes; else m_Types = asm.GetTypes(); @@ -765,15 +765,15 @@ namespace Server m_Names.Add( type.Name, type ); m_FullNames.Add( type.FullName, type ); - if( type.IsDefined( typeofTypeAliasAttribute, false ) ) + if ( type.IsDefined( typeofTypeAliasAttribute, false ) ) { object[] attrs = type.GetCustomAttributes( typeofTypeAliasAttribute, false ); - if( attrs != null && attrs.Length > 0 ) + if ( attrs != null && attrs.Length > 0 ) { TypeAliasAttribute attr = attrs[0] as TypeAliasAttribute; - if( attr != null ) + if ( attr != null ) { for( int j = 0; j < attr.Aliases.Length; ++j ) m_FullNames.Add( attr.Aliases[j], type ); @@ -798,7 +798,7 @@ namespace Server { Type t = null; - if( ignoreCase ) + if ( ignoreCase ) m_Insensitive.TryGetValue( key, out t ); else m_Sensitive.TryGetValue( key, out t ); diff --git a/Server/Serialization.cs b/Server/Serialization.cs index f290dfea5..48d14f4d2 100644 --- a/Server/Serialization.cs +++ b/Server/Serialization.cs @@ -231,7 +231,7 @@ namespace Server public void Flush() { - if( m_Index > 0 ) + if ( m_Index > 0 ) { m_Position += m_Index; @@ -254,7 +254,7 @@ namespace Server { get { - if( m_Index > 0 ) + if ( m_Index > 0 ) Flush(); return m_File; @@ -263,7 +263,7 @@ namespace Server public override void Close() { - if( m_Index > 0 ) + if ( m_Index > 0 ) Flush(); m_File.Close(); @@ -275,14 +275,14 @@ namespace Server while( v >= 0x80 ) { - if( (m_Index + 1) > m_Buffer.Length ) + if ( (m_Index + 1) > m_Buffer.Length ) Flush(); m_Buffer[m_Index++] = (byte)(v | 0x80); v >>= 7; } - if( (m_Index + 1) > m_Buffer.Length ) + if ( (m_Index + 1) > m_Buffer.Length ) Flush(); m_Buffer[m_Index++] = (byte)v; @@ -298,13 +298,13 @@ namespace Server WriteEncodedInt( length ); - if( m_CharacterBuffer == null ) + if ( m_CharacterBuffer == null ) { m_CharacterBuffer = new byte[LargeByteBufferSize]; m_MaxBufferChars = LargeByteBufferSize / m_Encoding.GetMaxByteCount( 1 ); } - if( length > LargeByteBufferSize ) + if ( length > LargeByteBufferSize ) { int current = 0; int charsLeft = value.Length; @@ -314,7 +314,7 @@ namespace Server int charCount = (charsLeft > m_MaxBufferChars) ? m_MaxBufferChars : charsLeft; int byteLength = m_Encoding.GetBytes( value, current, charCount, m_CharacterBuffer, 0 ); - if( (m_Index + byteLength) > m_Buffer.Length ) + if ( (m_Index + byteLength) > m_Buffer.Length ) Flush(); Buffer.BlockCopy( m_CharacterBuffer, 0, m_Buffer, m_Index, byteLength ); @@ -328,7 +328,7 @@ namespace Server { int byteLength = m_Encoding.GetBytes( value, 0, value.Length, m_CharacterBuffer, 0 ); - if( (m_Index + byteLength) > m_Buffer.Length ) + if ( (m_Index + byteLength) > m_Buffer.Length ) Flush(); Buffer.BlockCopy( m_CharacterBuffer, 0, m_Buffer, m_Index, byteLength ); @@ -338,18 +338,18 @@ namespace Server public override void Write( string value ) { - if( PrefixStrings ) + if ( PrefixStrings ) { - if( value == null ) + if ( value == null ) { - if( (m_Index + 1) > m_Buffer.Length ) + if ( (m_Index + 1) > m_Buffer.Length ) Flush(); m_Buffer[m_Index++] = 0; } else { - if( (m_Index + 1) > m_Buffer.Length ) + if ( (m_Index + 1) > m_Buffer.Length ) Flush(); m_Buffer[m_Index++] = 1; @@ -382,7 +382,7 @@ namespace Server TimeSpan d; try { d = new TimeSpan( ticks-now ); } - catch { if( ticks < now ) d = TimeSpan.MaxValue; else d = TimeSpan.MaxValue; } + catch { if ( ticks < now ) d = TimeSpan.MaxValue; else d = TimeSpan.MaxValue; } Write( d ); } @@ -407,7 +407,7 @@ namespace Server public override void Write( long value ) { - if( (m_Index + 8) > m_Buffer.Length ) + if ( (m_Index + 8) > m_Buffer.Length ) Flush(); m_Buffer[m_Index] = (byte)value; @@ -423,7 +423,7 @@ namespace Server public override void Write( ulong value ) { - if( (m_Index + 8) > m_Buffer.Length ) + if ( (m_Index + 8) > m_Buffer.Length ) Flush(); m_Buffer[m_Index] = (byte)value; @@ -439,7 +439,7 @@ namespace Server public override void Write( int value ) { - if( (m_Index + 4) > m_Buffer.Length ) + if ( (m_Index + 4) > m_Buffer.Length ) Flush(); m_Buffer[m_Index] = (byte)value; @@ -451,7 +451,7 @@ namespace Server public override void Write( uint value ) { - if( (m_Index + 4) > m_Buffer.Length ) + if ( (m_Index + 4) > m_Buffer.Length ) Flush(); m_Buffer[m_Index] = (byte)value; @@ -463,7 +463,7 @@ namespace Server public override void Write( short value ) { - if( (m_Index + 2) > m_Buffer.Length ) + if ( (m_Index + 2) > m_Buffer.Length ) Flush(); m_Buffer[m_Index] = (byte)value; @@ -473,7 +473,7 @@ namespace Server public override void Write( ushort value ) { - if( (m_Index + 2) > m_Buffer.Length ) + if ( (m_Index + 2) > m_Buffer.Length ) Flush(); m_Buffer[m_Index] = (byte)value; @@ -483,7 +483,7 @@ namespace Server public unsafe override void Write( double value ) { - if( (m_Index + 8) > m_Buffer.Length ) + if ( (m_Index + 8) > m_Buffer.Length ) Flush(); #if MONO @@ -500,7 +500,7 @@ namespace Server public unsafe override void Write( float value ) { - if( (m_Index + 4) > m_Buffer.Length ) + if ( (m_Index + 4) > m_Buffer.Length ) Flush(); #if MONO @@ -519,7 +519,7 @@ namespace Server public override void Write( char value ) { - if( (m_Index + 8) > m_Buffer.Length ) + if ( (m_Index + 8) > m_Buffer.Length ) Flush(); m_SingleCharBuffer[0] = value; @@ -530,7 +530,7 @@ namespace Server public override void Write( byte value ) { - if( (m_Index + 1) > m_Buffer.Length ) + if ( (m_Index + 1) > m_Buffer.Length ) Flush(); m_Buffer[m_Index++] = value; @@ -538,7 +538,7 @@ namespace Server public override void Write( sbyte value ) { - if( (m_Index + 1) > m_Buffer.Length ) + if ( (m_Index + 1) > m_Buffer.Length ) Flush(); m_Buffer[m_Index++] = (byte)value; @@ -546,7 +546,7 @@ namespace Server public override void Write( bool value ) { - if( (m_Index + 1) > m_Buffer.Length ) + if ( (m_Index + 1) > m_Buffer.Length ) Flush(); m_Buffer[m_Index++] = (byte)(value ? 1 : 0); @@ -579,7 +579,7 @@ namespace Server public override void Write( Map value ) { - if( value != null ) + if ( value != null ) Write( (byte)value.MapIndex ); else Write( (byte)0xFF ); @@ -587,7 +587,7 @@ namespace Server public override void Write( Race value ) { - if( value != null ) + if ( value != null ) Write( (byte)value.RaceIndex ); else Write( (byte)0xFF ); @@ -603,7 +603,7 @@ namespace Server public override void Write( Item value ) { - if( value == null || value.Deleted ) + if ( value == null || value.Deleted ) Write( Serial.MinusOne ); else Write( value.Serial ); @@ -611,7 +611,7 @@ namespace Server public override void Write( Mobile value ) { - if( value == null || value.Deleted ) + if ( value == null || value.Deleted ) Write( Serial.MinusOne ); else Write( value.Serial ); @@ -619,7 +619,7 @@ namespace Server public override void Write( BaseGuild value ) { - if( value == null ) + if ( value == null ) Write( 0 ); else Write( value.Id ); @@ -646,11 +646,11 @@ namespace Server } public override void WriteMobileList( ArrayList list, bool tidy ) { - if( tidy ) + if ( tidy ) { for( int i = 0; i < list.Count; ) { - if( ((Mobile)list[i]).Deleted ) + if ( ((Mobile)list[i]).Deleted ) list.RemoveAt( i ); else ++i; @@ -669,11 +669,11 @@ namespace Server } public override void WriteItemList( ArrayList list, bool tidy ) { - if( tidy ) + if ( tidy ) { for( int i = 0; i < list.Count; ) { - if( ((Item)list[i]).Deleted ) + if ( ((Item)list[i]).Deleted ) list.RemoveAt( i ); else ++i; @@ -692,11 +692,11 @@ namespace Server } public override void WriteGuildList( ArrayList list, bool tidy ) { - if( tidy ) + if ( tidy ) { for( int i = 0; i < list.Count; ) { - if( ((BaseGuild)list[i]).Disbanded ) + if ( ((BaseGuild)list[i]).Disbanded ) list.RemoveAt( i ); else ++i; @@ -715,11 +715,11 @@ namespace Server } public override void Write( List list, bool tidy ) { - if( tidy ) + if ( tidy ) { for( int i = 0; i < list.Count; ) { - if( list[i].Deleted ) + if ( list[i].Deleted ) list.RemoveAt( i ); else ++i; @@ -738,11 +738,11 @@ namespace Server } public override void WriteItemList( List list, bool tidy ) { - if( tidy ) + if ( tidy ) { for( int i = 0; i < list.Count; ) { - if( list[i].Deleted ) + if ( list[i].Deleted ) list.RemoveAt( i ); else ++i; @@ -761,7 +761,7 @@ namespace Server } public override void Write( HashSet set, bool tidy ) { - if( tidy ) + if ( tidy ) { set.RemoveWhere( item => item.Deleted ); } @@ -778,9 +778,9 @@ namespace Server { WriteItemSet( set, false ); } - public override void WriteItemSet( HashSet set, bool tidy ) + public override void WriteItemSet( HashSet set, bool tidy ) { - if( tidy ) + if ( tidy ) { set.RemoveWhere( item => item.Deleted ); } @@ -799,11 +799,11 @@ namespace Server } public override void Write( List list, bool tidy ) { - if( tidy ) + if ( tidy ) { for( int i = 0; i < list.Count; ) { - if( list[i].Deleted ) + if ( list[i].Deleted ) list.RemoveAt( i ); else ++i; @@ -822,11 +822,11 @@ namespace Server } public override void WriteMobileList( List list, bool tidy ) { - if( tidy ) + if ( tidy ) { for( int i = 0; i < list.Count; ) { - if( list[i].Deleted ) + if ( list[i].Deleted ) list.RemoveAt( i ); else ++i; @@ -845,7 +845,7 @@ namespace Server } public override void Write( HashSet set, bool tidy ) { - if( tidy ) + if ( tidy ) { set.RemoveWhere( mobile => mobile.Deleted ); } @@ -864,7 +864,7 @@ namespace Server } public override void WriteMobileSet( HashSet set, bool tidy ) { - if( tidy ) + if ( tidy ) { set.RemoveWhere( mob => mob.Deleted ); } @@ -883,11 +883,11 @@ namespace Server } public override void Write( List list, bool tidy ) { - if( tidy ) + if ( tidy ) { for( int i = 0; i < list.Count; ) { - if( list[i].Disbanded ) + if ( list[i].Disbanded ) list.RemoveAt( i ); else ++i; @@ -906,11 +906,11 @@ namespace Server } public override void WriteGuildList( List list, bool tidy ) { - if( tidy ) + if ( tidy ) { for( int i = 0; i < list.Count; ) { - if( list[i].Disbanded ) + if ( list[i].Disbanded ) list.RemoveAt( i ); else ++i; @@ -929,7 +929,7 @@ namespace Server } public override void Write( HashSet set, bool tidy ) { - if( tidy ) + if ( tidy ) { set.RemoveWhere( guild => guild.Disbanded ); } @@ -948,7 +948,7 @@ namespace Server } public override void WriteGuildSet( HashSet set, bool tidy ) { - if( tidy ) + if ( tidy ) { set.RemoveWhere( guild => guild.Disbanded ); } @@ -988,7 +988,7 @@ namespace Server public override string ReadString() { - if( ReadByte() != 0 ) + if ( ReadByte() != 0 ) return m_File.ReadString(); else return null; @@ -999,13 +999,13 @@ namespace Server long ticks = m_File.ReadInt64(); long now = DateTime.UtcNow.Ticks; - if( ticks > 0 && (ticks+now) < 0 ) + if ( ticks > 0 && (ticks+now) < 0 ) return DateTime.MaxValue; - else if( ticks < 0 && (ticks+now) < 0 ) + else if ( ticks < 0 && (ticks+now) < 0 ) return DateTime.MinValue; try { return new DateTime( now+ticks ); } - catch { if( ticks > 0 ) return DateTime.MaxValue; else return DateTime.MinValue; } + catch { if ( ticks > 0 ) return DateTime.MaxValue; else return DateTime.MinValue; } } public override IPAddress ReadIPAddress() @@ -1274,7 +1274,7 @@ namespace Server { int count = ReadInt(); - if( count > 0 ) + if ( count > 0 ) { HashSet set = new HashSet(); @@ -1282,7 +1282,7 @@ namespace Server { T item = ReadItem() as T; - if( item != null ) + if ( item != null ) { set.Add( item ); } @@ -1331,7 +1331,7 @@ namespace Server { int count = ReadInt(); - if( count > 0 ) + if ( count > 0 ) { HashSet set = new HashSet(); @@ -1339,7 +1339,7 @@ namespace Server { T item = ReadMobile() as T; - if( item != null ) + if ( item != null ) { set.Add( item ); } @@ -1388,7 +1388,7 @@ namespace Server { int count = ReadInt(); - if( count > 0 ) + if ( count > 0 ) { HashSet set = new HashSet(); @@ -1396,7 +1396,7 @@ namespace Server { T item = ReadGuild() as T; - if( item != null ) + if ( item != null ) { set.Add( item ); } @@ -1461,7 +1461,7 @@ namespace Server lock (m_WriteQueue) m_WriteQueue.Enqueue( mem ); - if( m_WorkerThread == null || !m_WorkerThread.IsAlive ) + if ( m_WorkerThread == null || !m_WorkerThread.IsAlive ) { m_WorkerThread = new Thread( new ThreadStart( new WorkerThread( this ).Worker ) ); m_WorkerThread.Priority = ThreadPriority.BelowNormal; @@ -1496,7 +1496,7 @@ namespace Server mem.WriteTo(m_Owner.m_File); } while (lastCount > 1); - if( m_Owner.m_Closed ) + if ( m_Owner.m_Closed ) m_Owner.m_File.Close(); AsyncWriter.m_ThreadCount--; @@ -1511,7 +1511,7 @@ namespace Server long curlen = m_Mem.Length; m_CurPos += curlen - m_LastPos; m_LastPos = curlen; - if( curlen >= BufferSize ) + if ( curlen >= BufferSize ) { Enqueue( m_Mem ); m_Mem = new MemoryStream( BufferSize + 1024 ); @@ -1528,7 +1528,7 @@ namespace Server } set { - if( m_Mem.Length > 0 ) + if ( m_Mem.Length > 0 ) Enqueue( m_Mem ); m_Mem = value; @@ -1561,9 +1561,9 @@ namespace Server public override void Write( string value ) { - if( PrefixStrings ) + if ( PrefixStrings ) { - if( value == null ) + if ( value == null ) { m_Bin.Write( (byte)0 ); } @@ -1588,7 +1588,7 @@ namespace Server TimeSpan d; try { d = new TimeSpan( ticks-now ); } - catch { if( ticks < now ) d = TimeSpan.MaxValue; else d = TimeSpan.MaxValue; } + catch { if ( ticks < now ) d = TimeSpan.MaxValue; else d = TimeSpan.MaxValue; } Write( d ); } @@ -1731,7 +1731,7 @@ namespace Server public override void Write( Map value ) { - if( value != null ) + if ( value != null ) Write( (byte)value.MapIndex ); else Write( (byte)0xFF ); @@ -1739,7 +1739,7 @@ namespace Server public override void Write( Race value ) { - if( value != null ) + if ( value != null ) Write( (byte)value.RaceIndex ); else Write( (byte)0xFF ); @@ -1755,7 +1755,7 @@ namespace Server public override void Write( Item value ) { - if( value == null || value.Deleted ) + if ( value == null || value.Deleted ) Write( Serial.MinusOne ); else Write( value.Serial ); @@ -1763,7 +1763,7 @@ namespace Server public override void Write( Mobile value ) { - if( value == null || value.Deleted ) + if ( value == null || value.Deleted ) Write( Serial.MinusOne ); else Write( value.Serial ); @@ -1771,7 +1771,7 @@ namespace Server public override void Write( BaseGuild value ) { - if( value == null ) + if ( value == null ) Write( 0 ); else Write( value.Id ); @@ -1798,11 +1798,11 @@ namespace Server } public override void WriteMobileList( ArrayList list, bool tidy ) { - if( tidy ) + if ( tidy ) { for( int i = 0; i < list.Count; ) { - if( ((Mobile)list[i]).Deleted ) + if ( ((Mobile)list[i]).Deleted ) list.RemoveAt( i ); else ++i; @@ -1821,11 +1821,11 @@ namespace Server } public override void WriteItemList( ArrayList list, bool tidy ) { - if( tidy ) + if ( tidy ) { for( int i = 0; i < list.Count; ) { - if( ((Item)list[i]).Deleted ) + if ( ((Item)list[i]).Deleted ) list.RemoveAt( i ); else ++i; @@ -1844,11 +1844,11 @@ namespace Server } public override void WriteGuildList( ArrayList list, bool tidy ) { - if( tidy ) + if ( tidy ) { for( int i = 0; i < list.Count; ) { - if( ((BaseGuild)list[i]).Disbanded ) + if ( ((BaseGuild)list[i]).Disbanded ) list.RemoveAt( i ); else ++i; @@ -1867,11 +1867,11 @@ namespace Server } public override void Write( List list, bool tidy ) { - if( tidy ) + if ( tidy ) { for( int i = 0; i < list.Count; ) { - if( list[i].Deleted ) + if ( list[i].Deleted ) list.RemoveAt( i ); else ++i; @@ -1890,11 +1890,11 @@ namespace Server } public override void WriteItemList( List list, bool tidy ) { - if( tidy ) + if ( tidy ) { for( int i = 0; i < list.Count; ) { - if( list[i].Deleted ) + if ( list[i].Deleted ) list.RemoveAt( i ); else ++i; @@ -1913,7 +1913,7 @@ namespace Server } public override void Write( HashSet set, bool tidy ) { - if( tidy ) + if ( tidy ) { set.RemoveWhere( item => item.Deleted ); } @@ -1932,7 +1932,7 @@ namespace Server } public override void WriteItemSet( HashSet set, bool tidy ) { - if( tidy ) + if ( tidy ) { set.RemoveWhere( item => item.Deleted ); } @@ -1951,11 +1951,11 @@ namespace Server } public override void Write( List list, bool tidy ) { - if( tidy ) + if ( tidy ) { for( int i = 0; i < list.Count; ) { - if( list[i].Deleted ) + if ( list[i].Deleted ) list.RemoveAt( i ); else ++i; @@ -1974,11 +1974,11 @@ namespace Server } public override void WriteMobileList( List list, bool tidy ) { - if( tidy ) + if ( tidy ) { for( int i = 0; i < list.Count; ) { - if( list[i].Deleted ) + if ( list[i].Deleted ) list.RemoveAt( i ); else ++i; @@ -1997,7 +1997,7 @@ namespace Server } public override void Write( HashSet set, bool tidy ) { - if( tidy ) + if ( tidy ) { set.RemoveWhere( mobile => mobile.Deleted ); } @@ -2016,7 +2016,7 @@ namespace Server } public override void WriteMobileSet( HashSet set, bool tidy ) { - if( tidy ) + if ( tidy ) { set.RemoveWhere( mob => mob.Deleted ); } @@ -2035,11 +2035,11 @@ namespace Server } public override void Write( List list, bool tidy ) { - if( tidy ) + if ( tidy ) { for( int i = 0; i < list.Count; ) { - if( list[i].Disbanded ) + if ( list[i].Disbanded ) list.RemoveAt( i ); else ++i; @@ -2058,11 +2058,11 @@ namespace Server } public override void WriteGuildList( List list, bool tidy ) { - if( tidy ) + if ( tidy ) { for( int i = 0; i < list.Count; ) { - if( list[i].Disbanded ) + if ( list[i].Disbanded ) list.RemoveAt( i ); else ++i; @@ -2081,7 +2081,7 @@ namespace Server } public override void Write( HashSet set, bool tidy ) { - if( tidy ) + if ( tidy ) { set.RemoveWhere( guild => guild.Disbanded ); } @@ -2100,7 +2100,7 @@ namespace Server } public override void WriteGuildSet( HashSet set, bool tidy ) { - if( tidy ) + if ( tidy ) { set.RemoveWhere( guild => guild.Disbanded ); } @@ -2120,4 +2120,4 @@ namespace Server int SerialIdentity { get; } void Serialize( GenericWriter writer ); } -} \ No newline at end of file +} diff --git a/Server/Skills.cs b/Server/Skills.cs index e31b40212..3c3cf10a4 100644 --- a/Server/Skills.cs +++ b/Server/Skills.cs @@ -366,7 +366,7 @@ namespace Server double raceBonus = m_Owner.Owner.RacialSkillBonus; - if( raceBonus > value ) + if ( raceBonus > value ) value = raceBonus; return value; @@ -381,7 +381,7 @@ namespace Server double baseValue = Base; double inv = 100.0 - baseValue; - if( inv < 0.0 ) inv = 0.0; + if ( inv < 0.0 ) inv = 0.0; inv /= 100.0; @@ -390,7 +390,7 @@ namespace Server statsOffset *= inv; - if( statsOffset > statTotal ) + if ( statsOffset > statTotal ) statsOffset = statTotal; double value = baseValue + statsOffset; @@ -405,11 +405,11 @@ namespace Server { SkillMod mod = mods[i]; - if( mod.Skill == (SkillName)m_Info.SkillID ) + if ( mod.Skill == (SkillName)m_Info.SkillID ) { - if( mod.Relative ) + if ( mod.Relative ) { - if( mod.ObeyCap ) + if ( mod.ObeyCap ) bonusObey += mod.Value; else bonusNotObey += mod.Value; @@ -425,11 +425,11 @@ namespace Server value += bonusNotObey; - if( value < Cap ) + if ( value < Cap ) { value += bonusObey; - if( value > Cap ) + if ( value > Cap ) value = Cap; } @@ -878,7 +878,7 @@ namespace Server [CommandProperty( AccessLevel.Counselor, AccessLevel.GameMaster )] public int Cap { - get{ return m_Cap; } + get{ return m_Cap; } set{ m_Cap = value; } } @@ -1120,4 +1120,4 @@ namespace Server return m_Skills.Where(s => s != null).GetEnumerator(); } } -} \ No newline at end of file +} diff --git a/Server/Timer.cs b/Server/Timer.cs index 37ab72080..ef159c5ca 100644 --- a/Server/Timer.cs +++ b/Server/Timer.cs @@ -551,7 +551,7 @@ namespace Server { Timer t = new DelayStateCallTimer( delay, interval, count, callback, state ); - if( count == 1 ) + if ( count == 1 ) t.Priority = ComputePriority( delay ); else t.Priority = ComputePriority( interval ); @@ -638,7 +638,7 @@ namespace Server protected override void OnTick() { - if( m_Callback != null ) + if ( m_Callback != null ) m_Callback( m_State ); } diff --git a/Server/Utility.cs b/Server/Utility.cs index aafd854a8..4bc456841 100644 --- a/Server/Utility.cs +++ b/Server/Utility.cs @@ -121,7 +121,7 @@ namespace Server public static string FixHtml( string str ) { - if( str == null ) + if ( str == null ) return ""; bool hasOpen = ( str.IndexOf( '<' ) >= 0 ); @@ -320,7 +320,7 @@ namespace Server | ( ( source & 0x0000FF00 ) << 8 ) | ( ( source & 0x00FF0000 ) >> 8 ) | ( ( source & 0xFF000000 ) >> 0x18 ) ) ); - } + } public static bool TryConvertIPv6toIPv4( ref IPAddress address ) { @@ -511,7 +511,7 @@ namespace Server { int i; - if( value.StartsWith( "0x" ) ) + if ( value.StartsWith( "0x" ) ) int.TryParse( value.Substring( 2 ), NumberStyles.HexNumber, null, out i ); else int.TryParse( value, out i ); @@ -563,7 +563,7 @@ namespace Server { DateTime d; - if( DateTime.TryParse( dateTimeString, out d ) ) + if ( DateTime.TryParse( dateTimeString, out d ) ) return d; return defaultValue; @@ -580,7 +580,7 @@ namespace Server { DateTimeOffset d; - if( DateTimeOffset.TryParse( dateTimeOffsetString, out d ) ) + if ( DateTimeOffset.TryParse( dateTimeOffsetString, out d ) ) return d; return defaultValue; @@ -1318,7 +1318,7 @@ namespace Server { m.HairItemID = m.Race.RandomHair( m ); - if( randomHue ) + if ( randomHue ) m.HairHue = m.Race.RandomHairHue(); } @@ -1337,7 +1337,7 @@ namespace Server { m.FacialHairItemID = m.Race.RandomFacialHair( m ); - if( randomHue ) + if ( randomHue ) m.FacialHairHue = m.Race.RandomHairHue(); } @@ -1354,11 +1354,11 @@ namespace Server { TOutput t = list[i] as TOutput; - if( t != null ) + if ( t != null ) output.Add( t ); } return output; } } -} \ No newline at end of file +} diff --git a/Server/VirtueInfo.cs b/Server/VirtueInfo.cs index 104063e61..385275c7e 100644 --- a/Server/VirtueInfo.cs +++ b/Server/VirtueInfo.cs @@ -108,7 +108,7 @@ namespace Server } } - if( version == 0 ) + if ( version == 0 ) { Compassion *= 200; Sacrifice *= 250; //Even though 40 (the max) only gives 10k, It's because it was formerly too easy @@ -144,4 +144,4 @@ namespace Server } } } -} \ No newline at end of file +} diff --git a/Server/World.cs b/Server/World.cs index 7894c4a0d..2157f02af 100644 --- a/Server/World.cs +++ b/Server/World.cs @@ -62,7 +62,7 @@ namespace Server { public static void NotifyDiskWriteComplete() { - if( m_DiskWriteHandle.Set()) + if ( m_DiskWriteHandle.Set()) { Console.WriteLine("Closing Save Files. "); }