From 3f45bd57b9216ebed40f235d0b3d5bbc17a4c29c Mon Sep 17 00:00:00 2001 From: Kamron Batman Date: Tue, 4 Sep 2018 08:58:07 -0700 Subject: [PATCH] Small adjustments as I go through the code. --- Server/Item.cs | 2 +- Server/Network/PacketHandlers.cs | 48 ++++++++++++++++---------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Server/Item.cs b/Server/Item.cs index d026fe873..edde48ed2 100644 --- a/Server/Item.cs +++ b/Server/Item.cs @@ -3316,7 +3316,7 @@ namespace Server } } - private static bool _processing = false; + private static bool _processing; public static void ProcessDeltaQueue() { diff --git a/Server/Network/PacketHandlers.cs b/Server/Network/PacketHandlers.cs index e4a1aa7b6..9b3fd5c1d 100644 --- a/Server/Network/PacketHandlers.cs +++ b/Server/Network/PacketHandlers.cs @@ -441,7 +441,7 @@ namespace Server.Network byte layer = pvSrc.ReadByte(); Serial serial = pvSrc.ReadInt32(); int amount = pvSrc.ReadInt16(); - + buyList.Add( new BuyItemResponse( serial, amount ) ); } @@ -2028,11 +2028,11 @@ namespace Server.Network public static PlayCharCallback ThirdPartyAuthCallback = null, ThirdPartyHackedCallback = null; - private static byte[] m_ThirdPartyAuthKey = new byte[] - { - 0x9, 0x11, 0x83, (byte)'+', 0x4, 0x17, 0x83, - 0x5, 0x24, 0x85, - 0x7, 0x17, 0x87, + private static byte[] m_ThirdPartyAuthKey = new byte[] + { + 0x9, 0x11, 0x83, (byte)'+', 0x4, 0x17, 0x83, + 0x5, 0x24, 0x85, + 0x7, 0x17, 0x87, 0x6, 0x19, 0x88, }; @@ -2080,7 +2080,7 @@ namespace Server.Network bool match = true; for ( int i=0; match && i < m_ThirdPartyAuthKey.Length; i++ ) match = match && pvSrc.ReadByte() == m_ThirdPartyAuthKey[i]; - + if ( match ) authOK = true; } @@ -2135,25 +2135,25 @@ namespace Server.Network if ( m == null ) { state.Dispose(); + return; } - else - { - if ( m.NetState != null ) - m.NetState.Dispose(); - NetState.ProcessDisposedQueue(); - state.Send( new ClientVersionReq() ); + m.NetState?.Dispose(); - state.BlockAllPackets = true; + // TODO: Make this wait one tick so we don't have to call it unnecessarily + NetState.ProcessDisposedQueue(); - state.Flags = (ClientFlags)flags; + state.Send( new ClientVersionReq() ); - state.Mobile = m; - m.NetState = state; + state.BlockAllPackets = true; - new LoginTimer( state, m ).Start(); - } + state.Flags = (ClientFlags)flags; + + state.Mobile = m; + m.NetState = state; + + new LoginTimer( state, m ).Start(); } } @@ -2427,7 +2427,7 @@ namespace Server.Network byte raceID = (byte)(genderRace < 4 ? 0 : ((genderRace / 2) - 1)); race = Race.Races[raceID]; - + if( race == null ) race = Race.DefaultRace; @@ -2518,7 +2518,7 @@ namespace Server.Network private static Dictionary m_AuthIDWindow = new Dictionary( m_AuthIDWindowSize ); private static int GenerateAuthID( NetState state ) - { + { if ( m_AuthIDWindow.Count == m_AuthIDWindowSize ) { int oldestID = 0; DateTime oldest = DateTime.MaxValue; @@ -2532,7 +2532,7 @@ namespace Server.Network m_AuthIDWindow.Remove( oldestID ); } - + int authID; do { @@ -2543,7 +2543,7 @@ namespace Server.Network } while ( m_AuthIDWindow.ContainsKey( authID ) ); m_AuthIDWindow[authID] = new AuthIDPersistence( state.Version ); - + return authID; } @@ -2569,7 +2569,7 @@ namespace Server.Network state.Dispose(); return; } - + if ( state.m_AuthID != 0 && authID != state.m_AuthID ) { Console.WriteLine( "Login: {0}: Invalid client detected, disconnecting", state );