public void Disconnect(DisconnectionType dcType) { try { Player.Group?.UpdateTarget(Player, new List <command_i3O> { new GroupPlayerDisconnectedModule(true) }); Player.UpdateCurrentCooldowns(); Player.SaveSettings(); QueryManager.SavePlayer.Information(Player); QueryManager.SavePlayer.Boosters(Player); Player.Storage.InRangeAssets.Clear(); Player.Storage.InRangeObjects.Clear(); Player.InRangeCharacters.Clear(); InProcessOfDisconnection = true; if (dcType == DisconnectionType.SOCKET_CLOSED) { EstDisconnectionTime = DateTime.Now.AddMinutes(2); return; } foreach (var session in GameManager.GameSessions.Values) { if (session != null) { var player = session.Player; if (player.Storage.GroupInvites.ContainsKey(Player.Id)) { player.Storage.GroupInvites.Remove(Player.Id); player.SendCommand(GroupRemoveInvitationCommand.write(Player.Id, player.Id, GroupRemoveInvitationCommand.REVOKE)); } } } PrepareForDisconnect(); Client.Close(); InProcessOfDisconnection = false; Program.TickManager.RemoveTick(this); GameManager.GameSessions.TryRemove(Player.Id, out var gameSession); Console.Title = $"DarkOrbit | {GameManager.GameSessions.Count} users online"; } catch (Exception e) { Out.WriteLine("Disconnect void exception: " + e, "GameSession.cs"); Logger.Log("error_log", $"- [GameSession.cs] Disconnect void exception: {e}"); } }
public void execute(GameSession gameSession, byte[] bytes) { var read = new GroupRejectInvitationRequest(); read.readCommand(bytes); var player = gameSession.Player; var inviterSession = GameManager.GetGameSession(read.userId); if (inviterSession == null) { return; } if (player.Storage.GroupInvites.ContainsKey(inviterSession.Player.Id)) { player.Storage.GroupInvites.Remove(inviterSession.Player.Id); inviterSession.Player.SendCommand(GroupRemoveInvitationCommand.write(inviterSession.Player.Id, player.Id, GroupRemoveInvitationCommand.REJECT)); } }
public void DeleteInvitation(Player inviter, Player player) { inviter.SendCommand(GroupRemoveInvitationCommand.write(inviter.Id, player.Id, GroupRemoveInvitationCommand.NONE)); player.SendCommand(GroupRemoveInvitationCommand.write(inviter.Id, player.Id, GroupRemoveInvitationCommand.NONE)); }