private void BattleAgentServer_OnClientDisconnected(ClientSession client) { BattleAgentSession session = client as BattleAgentSession; if (session.AgentID != -1) { BattleAgent agent = this.GetAgent(session.AgentID); if ((agent != null) && !agent.BattleEnd) { agent.PlayerExit(client.SessionID); } } }