Exemple #1
0
        /// <summary>
        /// Logs out the specified player.
        /// </summary>
        /// <param name="player">The player.</param>
        /// <param name="logoutType">Type of the logout.</param>
        public void Logout(Player player, LogoutType logoutType)
        {
            if (player.CurrentMap != null)
            {
                player.CurrentMap.Remove(player);
            }

            if (player.SelectedCharacter != null)
            {
                player.SelectedCharacter = null;
            }

            player.MagicEffectList.ClearAllEffects();
            player.PersistenceContext.SaveChanges();
            if (logoutType == LogoutType.CloseGame)
            {
                player.Disconnect();
            }
            else
            {
                if (logoutType == LogoutType.BackToCharacterSelection)
                {
                    player.PlayerState.TryAdvanceTo(PlayerState.Authenticated);
                }

                player.PlayerView.Logout(logoutType);
            }
        }
Exemple #2
0
 /// <remarks>
 /// This packet is sent to the Client after a Logout Request, or by disconnection by the server.
 /// It will send the Client to the the Server Select, Character Select or Disconnects the User.
 /// </remarks>
 /// <inheritdoc />
 public void Logout(LogoutType logoutType)
 {
     using (var writer = this.connection.StartSafeWrite(0xC3, 0x05))
     {
         var packet = writer.Span;
         packet[2] = 0xF1;
         packet[3] = 0x02;
         packet[4] = (byte)logoutType;
         writer.Commit();
     }
 }
Exemple #3
0
        /// <summary>
        /// Logs out the specified player.
        /// </summary>
        /// <param name="player">The player.</param>
        /// <param name="logoutType">Type of the logout.</param>
        public void Logout(Player player, LogoutType logoutType)
        {
            player.CurrentMap?.Remove(player);
            player.Party?.KickMySelf(player);
            player.SelectedCharacter = null;
            player.MagicEffectList.ClearAllEffects();
            player.PersistenceContext.SaveChanges();
            if (logoutType == LogoutType.CloseGame)
            {
                player.Disconnect();
            }
            else
            {
                if (logoutType == LogoutType.BackToCharacterSelection)
                {
                    player.PlayerState.TryAdvanceTo(PlayerState.Authenticated);
                }

                player.ViewPlugIns.GetPlugIn <ILogoutPlugIn>()?.Logout(logoutType);
            }
        }
Exemple #4
0
 /// <remarks>
 /// This packet is sent to the Client after a Logout Request, or by disconnection by the server.
 /// It will send the Client to the the Server Select, Character Select or Disconnects the User.
 /// </remarks>
 /// <inheritdoc />
 public void Logout(LogoutType logoutType)
 {
     this.connection.Send(new byte[] { 0xC3, 0x05, 0xF1, 0x02, (byte)logoutType });
 }