Fixes casting checks
This commit is contained in:
parent
7ea00fbf4f
commit
03dd5f1926
431 changed files with 5616 additions and 6250 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1009,9 +1009,9 @@ namespace Server
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overridable. Determines whether the item will show <see cref="AddWeightProperty" />.
|
||||
/// Overridable. Determines whether the item will show <see cref="AddWeightProperty" />.
|
||||
/// </summary>
|
||||
public virtual bool DisplayWeight
|
||||
public virtual bool DisplayWeight
|
||||
{
|
||||
get
|
||||
{
|
||||
|
|
@ -1022,11 +1022,11 @@ namespace Server
|
|||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overridable. Displays cliloc 1072788-1072789.
|
||||
/// Overridable. Displays cliloc 1072788-1072789.
|
||||
/// </summary>
|
||||
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 );
|
||||
/// }</code>
|
||||
///
|
||||
///
|
||||
/// When placed in an Item script, the item may be cast when equipped if the <paramref name="from" /> has 100 or more intelligence. Otherwise, it will drop to their backpack.
|
||||
/// </example>
|
||||
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<Item> 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
|
|||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<Item> toDelete )
|
||||
{
|
||||
if( current != null && current.Items.Count > 0 )
|
||||
if ( current != null && current.Items.Count > 0 )
|
||||
{
|
||||
List<Item> 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<Item> list )
|
||||
{
|
||||
if( current != null && current.Items.Count > 0 )
|
||||
if ( current != null && current.Items.Count > 0 )
|
||||
{
|
||||
List<Item> 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<Item> 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<Item> 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<T> FindItemsByType<T>( bool recurse, Predicate<T> predicate ) where T : Item
|
||||
{
|
||||
if( m_FindItemsList.Count > 0 )
|
||||
if ( m_FindItemsList.Count > 0 )
|
||||
m_FindItemsList.Clear();
|
||||
|
||||
List<T> list = new List<T>();
|
||||
|
||||
|
||||
RecurseFindItemsByType<T>( this, recurse, list, predicate );
|
||||
|
||||
return list;
|
||||
|
|
@ -1179,7 +1179,7 @@ namespace Server.Items
|
|||
|
||||
private static void RecurseFindItemsByType<T>( Item current, bool recurse, List<T> list, Predicate<T> predicate ) where T : Item
|
||||
{
|
||||
if( current != null && current.Items.Count > 0 )
|
||||
if ( current != null && current.Items.Count > 0 )
|
||||
{
|
||||
List<Item> 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<T>( item, recurse, list, predicate );
|
||||
}
|
||||
}
|
||||
|
|
@ -1224,7 +1224,7 @@ namespace Server.Items
|
|||
|
||||
private static T RecurseFindItemByType<T>( Item current, bool recurse, Predicate<T> predicate ) where T : Item
|
||||
{
|
||||
if( current != null && current.Items.Count > 0 )
|
||||
if ( current != null && current.Items.Count > 0 )
|
||||
{
|
||||
List<Item> 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<T>( item, recurse, predicate );
|
||||
|
||||
if( check != null )
|
||||
if ( check != null )
|
||||
return check;
|
||||
}
|
||||
}
|
||||
|
|
@ -1766,7 +1766,7 @@ namespace Server.Items
|
|||
{
|
||||
if ( Core.ML )
|
||||
{
|
||||
if( ParentsContain<BankBox>() ) //Root Parent is the Mobile. Parent could be another containter.
|
||||
if ( ParentsContain<BankBox>() ) //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
|
||||
|
|
|
|||
|
|
@ -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 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 )
|
||||
|
|
|
|||
1768
Server/Mobile.cs
1768
Server/Mobile.cs
File diff suppressed because it is too large
Load diff
|
|
@ -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<int, AuthIDPersistence> m_AuthIDWindow = new Dictionary<int, AuthIDPersistence>( 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 );
|
||||
|
|
|
|||
|
|
@ -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<Item> 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<Item> 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 );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ namespace Server {
|
|||
{
|
||||
this.PermitBackgroundWrite = permitBackgroundWrite;
|
||||
|
||||
Thread saveThread = new Thread( delegate() {
|
||||
Thread saveThread = new Thread( delegate {
|
||||
SaveItems(metrics);
|
||||
} );
|
||||
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ namespace Server
|
|||
|
||||
while( _decayBag.TryTake( out item ) )
|
||||
{
|
||||
if( item.OnDecay() )
|
||||
if ( item.OnDecay() )
|
||||
{
|
||||
item.Delete();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<string, List<CompilerError>> errors = new Dictionary<string, List<CompilerError>>( results.Errors.Count, StringComparer.OrdinalIgnoreCase );
|
||||
Dictionary<string, List<CompilerError>> warnings = new Dictionary<string, List<CompilerError>>( results.Errors.Count, StringComparer.OrdinalIgnoreCase );
|
||||
|
|
@ -448,13 +448,13 @@ namespace Server
|
|||
List<CompilerError> list = null;
|
||||
table.TryGetValue( file, out list );
|
||||
|
||||
if( list == null )
|
||||
if ( list == null )
|
||||
table[file] = list = new List<CompilerError>();
|
||||
|
||||
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<string, List<CompilerError>> 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<string, List<CompilerError>> 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<Assembly> assemblies = new List<Assembly>();
|
||||
|
||||
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 );
|
||||
|
|
|
|||
|
|
@ -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<Item> 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<T>( List<T> 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<Item> 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<T>( HashSet<T> set, bool tidy )
|
||||
public override void WriteItemSet<T>( HashSet<T> set, bool tidy )
|
||||
{
|
||||
if( tidy )
|
||||
if ( tidy )
|
||||
{
|
||||
set.RemoveWhere( item => item.Deleted );
|
||||
}
|
||||
|
|
@ -799,11 +799,11 @@ namespace Server
|
|||
}
|
||||
public override void Write( List<Mobile> 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<T>( List<T> 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<Mobile> set, bool tidy )
|
||||
{
|
||||
if( tidy )
|
||||
if ( tidy )
|
||||
{
|
||||
set.RemoveWhere( mobile => mobile.Deleted );
|
||||
}
|
||||
|
|
@ -864,7 +864,7 @@ namespace Server
|
|||
}
|
||||
public override void WriteMobileSet<T>( HashSet<T> set, bool tidy )
|
||||
{
|
||||
if( tidy )
|
||||
if ( tidy )
|
||||
{
|
||||
set.RemoveWhere( mob => mob.Deleted );
|
||||
}
|
||||
|
|
@ -883,11 +883,11 @@ namespace Server
|
|||
}
|
||||
public override void Write( List<BaseGuild> 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<T>( List<T> 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<BaseGuild> set, bool tidy )
|
||||
{
|
||||
if( tidy )
|
||||
if ( tidy )
|
||||
{
|
||||
set.RemoveWhere( guild => guild.Disbanded );
|
||||
}
|
||||
|
|
@ -948,7 +948,7 @@ namespace Server
|
|||
}
|
||||
public override void WriteGuildSet<T>( HashSet<T> 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<T> set = new HashSet<T>();
|
||||
|
||||
|
|
@ -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<T> set = new HashSet<T>();
|
||||
|
||||
|
|
@ -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<T> set = new HashSet<T>();
|
||||
|
||||
|
|
@ -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<Item> 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<T>( List<T> 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<Item> set, bool tidy )
|
||||
{
|
||||
if( tidy )
|
||||
if ( tidy )
|
||||
{
|
||||
set.RemoveWhere( item => item.Deleted );
|
||||
}
|
||||
|
|
@ -1932,7 +1932,7 @@ namespace Server
|
|||
}
|
||||
public override void WriteItemSet<T>( HashSet<T> set, bool tidy )
|
||||
{
|
||||
if( tidy )
|
||||
if ( tidy )
|
||||
{
|
||||
set.RemoveWhere( item => item.Deleted );
|
||||
}
|
||||
|
|
@ -1951,11 +1951,11 @@ namespace Server
|
|||
}
|
||||
public override void Write( List<Mobile> 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<T>( List<T> 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<Mobile> set, bool tidy )
|
||||
{
|
||||
if( tidy )
|
||||
if ( tidy )
|
||||
{
|
||||
set.RemoveWhere( mobile => mobile.Deleted );
|
||||
}
|
||||
|
|
@ -2016,7 +2016,7 @@ namespace Server
|
|||
}
|
||||
public override void WriteMobileSet<T>( HashSet<T> set, bool tidy )
|
||||
{
|
||||
if( tidy )
|
||||
if ( tidy )
|
||||
{
|
||||
set.RemoveWhere( mob => mob.Deleted );
|
||||
}
|
||||
|
|
@ -2035,11 +2035,11 @@ namespace Server
|
|||
}
|
||||
public override void Write( List<BaseGuild> 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<T>( List<T> 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<BaseGuild> set, bool tidy )
|
||||
{
|
||||
if( tidy )
|
||||
if ( tidy )
|
||||
{
|
||||
set.RemoveWhere( guild => guild.Disbanded );
|
||||
}
|
||||
|
|
@ -2100,7 +2100,7 @@ namespace Server
|
|||
}
|
||||
public override void WriteGuildSet<T>( HashSet<T> 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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -551,7 +551,7 @@ namespace Server
|
|||
{
|
||||
Timer t = new DelayStateCallTimer<T>( 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 );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ namespace Server {
|
|||
|
||||
public static void NotifyDiskWriteComplete()
|
||||
{
|
||||
if( m_DiskWriteHandle.Set())
|
||||
if ( m_DiskWriteHandle.Set())
|
||||
{
|
||||
Console.WriteLine("Closing Save Files. ");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue