Beispiel #1
0
        /// <summary>
        /// Called when this client has been disconnected
        /// </summary>
        public override void OnDisconnect()
        {
            try
            {
                if (PacketProcessor != null)
                {
                    PacketProcessor.OnDisconnect();
                }

                // If we went linkdead and we were inside the game
                // we don't let the player disappear!
                if (ClientState == eClientState.Playing)
                {
                    OnLinkdeath();
                    return;
                }

                if (ClientState == eClientState.WorldEnter && Player != null)
                {
                    Player.SaveIntoDatabase();
                }
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("OnDisconnect", e);
                }
            }
            finally
            {
                // Make sure the client is diconnected even on errors
                Quit();
            }
        }