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> /// <summary>
/// Account username and password hashed with MD5. May be null. /// Account username and password hashed with SHA1. May be null.
/// </summary> /// </summary>
public string NewCryptPassword public string NewCryptPassword
{ {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -515,7 +515,7 @@ namespace Server.Gumps
{ {
if ( m_List == null ) if ( m_List == null )
{ {
m_List = new ArrayList( (ICollection)NetState.Instances ); m_List = new ArrayList( NetState.Instances );
m_List.Sort( NetStateComparer.Instance ); m_List.Sort( NetStateComparer.Instance );
} }
@ -1119,7 +1119,7 @@ namespace Server.Gumps
AccountComment c = a.Comments[i]; 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 ); AddHtml( 20, 180, 380, 190, sb.ToString(), true, true );

View file

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

View file

@ -235,7 +235,7 @@ namespace Server.Gumps
{ {
Mobile from = state.Mobile; 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." ); from.SendMessage( "You may no longer access their properties." );
return; return;
@ -315,10 +315,12 @@ namespace Server.Gumps
} }
else if( HasAttribute( type, typeofPropertyObject, true ) ) else if( HasAttribute( type, typeofPropertyObject, true ) )
{ {
object o = prop.GetValue( m_Object, null ); object obj = prop.GetValue( m_Object, null );
if( o != null ) if ( obj != null )
from.SendGump( new PropertiesGump( from, o, m_Stack, new StackEntry( m_Object, prop ) ) ); 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 ) 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 ) else if ( o is Type )
{ {
@ -671,7 +673,7 @@ namespace Server.Gumps
} }
else if ( o is Item ) 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 ) else if ( o is Type )
{ {

View file

@ -267,7 +267,7 @@ namespace Server.Gumps
if ( obj == null ) if ( obj == null )
m_Mobile.SendMessage( "The property is null and so you cannot view its properties." ); 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." ); m_Mobile.SendMessage( "You may not view their properties." );
else else
viewProps = obj; viewProps = obj;

View file

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

View file

@ -3,7 +3,6 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using Server; using Server;
using Server.Items; using Server.Items;
using Server.Gumps;
using Server.Network; using Server.Network;
using Server.Mobiles; 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; ((PlayerMobile)from).AvailableResurrects -= 1;
@ -237,7 +236,6 @@ namespace Server.Gumps
} }
} }
if( from.Alive && m_HitsScalar > 0 ) if( from.Alive && m_HitsScalar > 0 )
from.Hits = (int)(from.HitsMax * m_HitsScalar); from.Hits = (int)(from.HitsMax * m_HitsScalar);
} }

View file

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

View file

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

View file

@ -45,16 +45,6 @@ namespace Server.Misc
if ( pathTD != null ) if ( pathTD != null )
Core.DataDirectories.Add( pathTD ); 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 ) if ( Core.DataDirectories.Count == 0 )
{ {
Console.WriteLine( "Enter the Ultima Online directory:" ); 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 ) 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 ); return ((PlayerMobile)from).AntiMacroCheck( skill, obj );
else else
return true; return true;

View file

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

View file

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

View file

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

View file

@ -173,8 +173,8 @@ namespace Server.SkillHandlers
{ {
int y = 276; int y = 276;
if ( Core.SE ) if ( Core.SE )
{ {
double bd = Items.BaseInstrument.GetBaseDifficulty( c ); double bd = Items.BaseInstrument.GetBaseDifficulty( c );
if ( c.Uncalmable ) if ( c.Uncalmable )
bd = 0; bd = 0;
@ -183,7 +183,7 @@ namespace Server.SkillHandlers
AddHtml( 320, y, 35, 18, FormatDouble( bd ), false, false ); AddHtml( 320, y, 35, 18, FormatDouble( bd ), false, false );
y += 18; y += 18;
} }
AddImage( 128, y + 2, 2086 ); AddImage( 128, y + 2, 2086 );
AddHtmlLocalized( 147, y, 160, 18, 1049594, 200, false, false ); // Loyalty Rating 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 ) public static void ScaleStats( BaseCreature bc, double scalar )
{ {
if ( bc.RawStr > 0 ) if ( bc.RawStr > 0 )
bc.RawStr = (int)Math.Max( 1, bc.RawStr * scalar ); bc.RawStr = (int)Math.Max( 1, bc.RawStr * scalar );
if ( bc.RawDex > 0 ) if ( bc.RawDex > 0 )
bc.RawDex = (int)Math.Max( 1, bc.RawDex * scalar ); bc.RawDex = (int)Math.Max( 1, bc.RawDex * scalar );
if ( bc.RawInt > 0 ) if ( bc.RawInt > 0 )
bc.RawInt = (int)Math.Max( 1, bc.RawInt * scalar ); bc.RawInt = (int)Math.Max( 1, bc.RawInt * scalar );
if ( bc.HitsMaxSeed > 0 ) if ( bc.HitsMaxSeed > 0 )
{ {
bc.HitsMaxSeed = (int)Math.Max( 1, bc.HitsMaxSeed * scalar ); bc.HitsMaxSeed = (int)Math.Max( 1, bc.HitsMaxSeed * scalar );
bc.Hits = bc.Hits; bc.Hits = bc.Hits;
} }
if ( bc.StamMaxSeed > 0 ) if ( bc.StamMaxSeed > 0 )
{ {
bc.StamMaxSeed = (int)Math.Max( 1, bc.StamMaxSeed * scalar ); bc.StamMaxSeed = (int)Math.Max( 1, bc.StamMaxSeed * scalar );
bc.Stam = bc.Stam; bc.Stam = bc.Stam;
}
} }
}
public static void ScaleSkills( BaseCreature bc, double scalar ) public static void ScaleSkills( BaseCreature bc, double scalar )
{ {

View file

@ -1659,7 +1659,7 @@ namespace Server.Items
to.Send( new ContainerDisplay( this ) ); to.Send( new ContainerDisplay( this ) );
if ( to.NetState.IsPost6017 ) if ( to.NetState != null && to.NetState.IsPost6017 )
to.Send( new ContainerContent6017( to, this ) ); to.Send( new ContainerContent6017( to, this ) );
else else
to.Send( new ContainerContent( to, this ) ); to.Send( new ContainerContent( to, this ) );

View file

@ -461,10 +461,8 @@ namespace Server
int sample = 0; int sample = 0;
while( true ) while( m_Signal.WaitOne() )
{ {
m_Signal.WaitOne();
Mobile.ProcessDeltaQueue(); Mobile.ProcessDeltaQueue();
Item.ProcessDeltaQueue(); Item.ProcessDeltaQueue();

View file

@ -209,14 +209,17 @@ namespace Server
m_From = new SecureTradeInfo( this, from, new SecureTradeContainer( this ) ); m_From = new SecureTradeInfo( this, from, new SecureTradeContainer( this ) );
m_To = new SecureTradeInfo( this, to, new SecureTradeContainer( this ) ); m_To = new SecureTradeInfo( this, to, new SecureTradeContainer( this ) );
bool from6017 = ( from.NetState == null ? false : from.NetState.IsPost6017 );
bool to6017 = ( to.NetState == null ? false : to.NetState.IsPost6017 );
from.Send( new MobileStatus( from, to ) ); from.Send( new MobileStatus( from, to ) );
from.Send( new UpdateSecureTrade( m_From.Container, false, false ) ); from.Send( new UpdateSecureTrade( m_From.Container, false, false ) );
if ( from.NetState.IsPost6017 ) if ( from6017 )
from.Send( new SecureTradeEquip6017( m_To.Container, to ) ); from.Send( new SecureTradeEquip6017( m_To.Container, to ) );
else else
from.Send( new SecureTradeEquip( m_To.Container, to ) ); from.Send( new SecureTradeEquip( m_To.Container, to ) );
from.Send( new UpdateSecureTrade( m_From.Container, false, false ) ); from.Send( new UpdateSecureTrade( m_From.Container, false, false ) );
if ( from.NetState.IsPost6017 ) if ( from6017 )
from.Send( new SecureTradeEquip6017( m_From.Container, from ) ); from.Send( new SecureTradeEquip6017( m_From.Container, from ) );
else else
from.Send( new SecureTradeEquip( m_From.Container, from ) ); from.Send( new SecureTradeEquip( m_From.Container, from ) );
@ -225,12 +228,12 @@ namespace Server
to.Send( new MobileStatus( to, from ) ); to.Send( new MobileStatus( to, from ) );
to.Send( new UpdateSecureTrade( m_To.Container, false, false ) ); to.Send( new UpdateSecureTrade( m_To.Container, false, false ) );
if ( to.NetState.IsPost6017 ) if ( to6017 )
to.Send( new SecureTradeEquip6017( m_From.Container, from ) ); to.Send( new SecureTradeEquip6017( m_From.Container, from ) );
else else
to.Send( new SecureTradeEquip( m_From.Container, from ) ); to.Send( new SecureTradeEquip( m_From.Container, from ) );
to.Send( new UpdateSecureTrade( m_To.Container, false, false ) ); to.Send( new UpdateSecureTrade( m_To.Container, false, false ) );
if ( to.NetState.IsPost6017 ) if ( to6017 )
to.Send( new SecureTradeEquip6017( m_To.Container, to ) ); to.Send( new SecureTradeEquip6017( m_To.Container, to ) );
else else
to.Send( new SecureTradeEquip( m_To.Container, to ) ); to.Send( new SecureTradeEquip( m_To.Container, to ) );