general cleanup, fixed a slightly improbably crash issue

This commit is contained in:
mark 2007-08-12 07:19:44 +00:00
parent 6780b3c2e7
commit b9e3476d8b
26 changed files with 62 additions and 67 deletions

View file

@ -127,7 +127,7 @@ namespace Server.Accounting
}
/// <summary>
/// Account username and password hashed with MD5. May be null.
/// Account username and password hashed with SHA1. May be null.
/// </summary>
public string NewCryptPassword
{

View file

@ -1,8 +1,8 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Collections.Generic;
namespace Server
{

View file

@ -48,7 +48,7 @@ namespace Server.Misc
{
++count;
if ( count >= MaxAddresses )
if ( count > MaxAddresses )
return false;
}
}

View file

@ -5,7 +5,6 @@ using System.Collections;
using System.Reflection;
using Server;
using Server.Items;
using Server.Commands;
namespace Server.Commands
{

View file

@ -1,9 +1,9 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Reflection;
using System.Reflection.Emit;
using System.Globalization;
using System.Text;
using Server;

View file

@ -98,7 +98,7 @@ namespace Server.Commands
PlayerMobile pm = (PlayerMobile)from;
Mobile targ = (Mobile)targeted;
if ( targ.AccessLevel < from.AccessLevel )
if ( targ.AccessLevel <= from.AccessLevel )
{
List<Mobile> list = pm.VisibilityList;

View file

@ -1,13 +1,13 @@
using System;
using System.Threading;
using System.Collections;
using System.Collections.Generic;
using Server;
using Server.Items;
using Server.Mobiles;
using Server.Network;
using Server.Factions;
using Server.Accounting;
using System.Collections.Generic;
namespace Server.Engines.Reports
{

View file

@ -515,7 +515,7 @@ namespace Server.Gumps
{
if ( m_List == null )
{
m_List = new ArrayList( (ICollection)NetState.Instances );
m_List = new ArrayList( NetState.Instances );
m_List.Sort( NetStateComparer.Instance );
}
@ -1119,7 +1119,7 @@ namespace Server.Gumps
AccountComment c = a.Comments[i];
sb.AppendFormat( "[{0} on {1}]<BR>{2}", c.AddedBy, c.LastModified,c.Content );
sb.AppendFormat( "[{0} on {1}]<BR>{2}", c.AddedBy, c.LastModified, c.Content );
}
AddHtml( 20, 180, 380, 190, sb.ToString(), true, true );

View file

@ -4,7 +4,6 @@ using Server;
using Server.Accounting;
using Server.Network;
using Server.Targets;
using Server.Gumps;
using Server.Commands;
using Server.Commands.Generic;

View file

@ -235,7 +235,7 @@ namespace Server.Gumps
{
Mobile from = state.Mobile;
if ( !Server.Commands.Generic.BaseCommand.IsAccessible( from, m_Object ) )
if ( !BaseCommand.IsAccessible( from, m_Object ) )
{
from.SendMessage( "You may no longer access their properties." );
return;
@ -315,10 +315,12 @@ namespace Server.Gumps
}
else if( HasAttribute( type, typeofPropertyObject, true ) )
{
object o = prop.GetValue( m_Object, null );
if( o != null )
from.SendGump( new PropertiesGump( from, o, m_Stack, new StackEntry( m_Object, prop ) ) );
object obj = prop.GetValue( m_Object, null );
if ( obj != null )
from.SendGump( new PropertiesGump( from, obj, m_Stack, new StackEntry( m_Object, prop ) ) );
else
from.SendGump( new PropertiesGump( from, m_Object, m_Stack, m_List, m_Page ) );
}
}
@ -489,7 +491,7 @@ namespace Server.Gumps
}
else if ( o is Item )
{
return String.Format( "(I) 0x{0:X}", ((Item)o).Serial.Value );
return String.Format( "(I) 0x{0:X}", ((Item)o).Serial );
}
else if ( o is Type )
{
@ -671,7 +673,7 @@ namespace Server.Gumps
}
else if ( o is Item )
{
return String.Format( "(I) 0x{0:X}", ((Item)o).Serial.Value );
return String.Format( "(I) 0x{0:X}", ((Item)o).Serial );
}
else if ( o is Type )
{

View file

@ -267,7 +267,7 @@ namespace Server.Gumps
if ( obj == null )
m_Mobile.SendMessage( "The property is null and so you cannot view its properties." );
else if ( !Server.Commands.Generic.BaseCommand.IsAccessible( m_Mobile, obj ) )
else if ( !BaseCommand.IsAccessible( m_Mobile, obj ) )
m_Mobile.SendMessage( "You may not view their properties." );
else
viewProps = obj;

View file

@ -134,7 +134,6 @@ namespace Server.Gumps
toSet = TimeSpan.Zero;
}
shouldSet = shouldSend = successfulParse;
break;

View file

@ -3,7 +3,6 @@ using System.Collections;
using System.Collections.Generic;
using Server;
using Server.Items;
using Server.Gumps;
using Server.Network;
using Server.Mobiles;
@ -186,7 +185,7 @@ namespace Server.Gumps
}
}
if( m_FromSacrifice && !from.Criminal && from is PlayerMobile )
if( m_FromSacrifice && from is PlayerMobile )
{
((PlayerMobile)from).AvailableResurrects -= 1;
@ -237,7 +236,6 @@ namespace Server.Gumps
}
}
if( from.Alive && m_HitsScalar > 0 )
from.Hits = (int)(from.HitsMax * m_HitsScalar);
}

View file

@ -625,7 +625,7 @@ namespace Server.Items
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
writer.Write( (int) 1 ); // version
}
public override void Deserialize( GenericReader reader )
@ -656,7 +656,7 @@ namespace Server.Items
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
writer.Write( (int) 1 ); // version
}
public override void Deserialize( GenericReader reader )
@ -687,7 +687,7 @@ namespace Server.Items
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
writer.Write( (int) 1 ); // version
}
public override void Deserialize( GenericReader reader )
@ -781,7 +781,7 @@ namespace Server.Items
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
writer.Write( (int) 1 ); // version
}
public override void Deserialize( GenericReader reader )
@ -812,7 +812,7 @@ namespace Server.Items
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
writer.Write( (int) 1 ); // version
}
public override void Deserialize( GenericReader reader )
@ -843,7 +843,7 @@ namespace Server.Items
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
writer.Write( (int) 1 ); // version
}
public override void Deserialize( GenericReader reader )
@ -874,7 +874,7 @@ namespace Server.Items
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
writer.Write( (int) 1 ); // version
}
public override void Deserialize( GenericReader reader )

View file

@ -483,6 +483,9 @@ namespace Server.Items
}
else if ( Parent is Item )
{
if ( to.NetState == null )
return;
// What will happen if the client doesn't know about our parent?
if ( to.NetState.IsPost6017 )
to.Send( new ContainerContentUpdate6017( this ) );

View file

@ -127,7 +127,7 @@ namespace Server.Misc
}
}
public static bool IsBuggable(Item item)
public static bool IsBuggable( Item item )
{
if ( item is Fists )
return false;

View file

@ -45,16 +45,6 @@ namespace Server.Misc
if ( pathTD != null )
Core.DataDirectories.Add( pathTD );
if ( CustomPath != null )
Core.DataDirectories.Add( CustomPath );
if ( pathReg != null )
Core.DataDirectories.Add( pathReg );
if ( pathTD != null )
Core.DataDirectories.Add( pathTD );
if ( Core.DataDirectories.Count == 0 )
{
Console.WriteLine( "Enter the Ultima Online directory:" );

View file

@ -179,7 +179,7 @@ namespace Server.Misc
private static bool AllowGain( Mobile from, Skill skill, object obj )
{
if ( from is PlayerMobile && AntiMacroCode && UseAntiMacro[skill.Info.SkillID] )
if ( AntiMacroCode && from is PlayerMobile && UseAntiMacro[skill.Info.SkillID] )
return ((PlayerMobile)from).AntiMacroCheck( skill, obj );
else
return true;

View file

@ -178,7 +178,7 @@ namespace Server.Mobiles
writer.Write( (int)3 ); // version
writer.Write( m_IsDonationItem );
writer.Write( (bool)m_IsRewardItem );
writer.Write( m_IsRewardItem );
writer.Write( (int)m_MountedID );
writer.Write( (int)m_RegularID );

View file

@ -632,6 +632,9 @@ namespace Server.Mobiles
list.Sort( new BuyItemStateComparer() );
SendPacksTo( from );
if ( from.NetState == null )
return;
if ( from.NetState.IsPost6017 )
from.Send( new VendorBuyContent6017( list ) );

View file

@ -133,6 +133,7 @@ namespace Server.Regions
{
m_GuardType = DefaultGuardType;
}
public GuardedRegion( XmlElement xml, Map map, Region parent ) : base( xml, map, parent )
{
XmlElement el = xml["guards"];

View file

@ -173,8 +173,8 @@ namespace Server.SkillHandlers
{
int y = 276;
if ( Core.SE )
{
if ( Core.SE )
{
double bd = Items.BaseInstrument.GetBaseDifficulty( c );
if ( c.Uncalmable )
bd = 0;
@ -183,7 +183,7 @@ namespace Server.SkillHandlers
AddHtml( 320, y, 35, 18, FormatDouble( bd ), false, false );
y += 18;
}
}
AddImage( 128, y + 2, 2086 );
AddHtmlLocalized( 147, y, 160, 18, 1049594, 200, false, false ); // Loyalty Rating

View file

@ -57,28 +57,28 @@ namespace Server.SkillHandlers
}
public static void ScaleStats( BaseCreature bc, double scalar )
{
if ( bc.RawStr > 0 )
bc.RawStr = (int)Math.Max( 1, bc.RawStr * scalar );
{
if ( bc.RawStr > 0 )
bc.RawStr = (int)Math.Max( 1, bc.RawStr * scalar );
if ( bc.RawDex > 0 )
bc.RawDex = (int)Math.Max( 1, bc.RawDex * scalar );
if ( bc.RawDex > 0 )
bc.RawDex = (int)Math.Max( 1, bc.RawDex * scalar );
if ( bc.RawInt > 0 )
bc.RawInt = (int)Math.Max( 1, bc.RawInt * scalar );
if ( bc.HitsMaxSeed > 0 )
{
bc.HitsMaxSeed = (int)Math.Max( 1, bc.HitsMaxSeed * scalar );
bc.Hits = bc.Hits;
if ( bc.HitsMaxSeed > 0 )
{
bc.HitsMaxSeed = (int)Math.Max( 1, bc.HitsMaxSeed * scalar );
bc.Hits = bc.Hits;
}
if ( bc.StamMaxSeed > 0 )
{
bc.StamMaxSeed = (int)Math.Max( 1, bc.StamMaxSeed * scalar );
bc.Stam = bc.Stam;
}
if ( bc.StamMaxSeed > 0 )
{
bc.StamMaxSeed = (int)Math.Max( 1, bc.StamMaxSeed * scalar );
bc.Stam = bc.Stam;
}
}
public static void ScaleSkills( BaseCreature bc, double scalar )
{