Various fixes related to DefaultName. Makes the event loop more async.

This commit is contained in:
Kamron Batman 2018-09-03 14:44:48 -07:00
parent 6ef32ce910
commit 4d2965d2de
No known key found for this signature in database
GPG key ID: 9F6247D24FA2AAD4
5 changed files with 29 additions and 28 deletions

View file

@ -256,7 +256,7 @@ namespace Server.Mobiles
{
get
{
if (NameMod == null && Name == null)
if (NameMod == null && base.Name == null)
return DefaultName;
return base.Name;

View file

@ -195,7 +195,7 @@ namespace Server.Mobiles
Body = 264;
Hue = ( IsParagon && DefaultHue == 0 ) ? Paragon.Hue : DefaultHue;
Female = false;
Name = DefaultName;
Name = null;
NameHue = -1;
Title = null;
Kills = 0;

View file

@ -519,7 +519,7 @@ namespace Server
try
{
long now, last = TickCount;
long last = TickCount;
const int sampleInterval = 100;
const float ticksPerSecond = 1000.0f * sampleInterval;
@ -530,24 +530,25 @@ namespace Server
{
m_Signal.WaitOne();
Mobile.ProcessDeltaQueue();
Item.ProcessDeltaQueue();
Task.WaitAll(
Task.Run(() => Mobile.ProcessDeltaQueue()),
Task.Run(() => Item.ProcessDeltaQueue()),
Task.Run(() => Timer.Slice()),
Task.Run(() => messagePump.Slice())
);
Timer.Slice();
messagePump.Slice();
NetState.FlushAll();
NetState.ProcessDisposedQueue();
if ( Slice != null )
Slice();
Slice?.Invoke();
if (sample++ % sampleInterval != 0)
{
continue;
}
now = TickCount;
long now = TickCount;
m_CyclesPerSecond[m_CycleIndex++ % m_CyclesPerSecond.Length] = ticksPerSecond / (now - last);
last = now;
}

View file

@ -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 );

View file

@ -42,7 +42,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\</OutputPath>
<DefineConstants>TRACE;DEBUG;NEWTIMERS;NEWPARENT</DefineConstants>
<DefineConstants>TRACE;DEBUG;NEWTIMERS;NEWPARENT;NewAsyncSockets</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
@ -53,7 +53,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<OutputPath>..\</OutputPath>
<DefineConstants>TRACE;NEWTIMERS;NEWPARENT</DefineConstants>
<DefineConstants>TRACE;NEWTIMERS;NEWPARENT;NewAsyncSockets</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
@ -66,7 +66,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\</OutputPath>
<DefineConstants>TRACE;DEBUG;NEWTIMERS, NEWPARENT</DefineConstants>
<DefineConstants>TRACE;DEBUG;NEWTIMERS,NEWPARENT;NewAsyncSockets</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
@ -77,7 +77,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>..\</OutputPath>
<DefineConstants>TRACE;NEWTIMERS, NEWPARENT</DefineConstants>
<DefineConstants>TRACE;NEWTIMERS,NEWPARENT;NewAsyncSockets</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>