protected override void OnSocketKilled(string msg) { if (ServerUser.CurrentCharacter != null) { CharacterCache.UncacheCharacter(ServerUser.CurrentCharacter.CharacterInfo.ID); } CharacterUtil.Instance.CharacterDeleting -= new Func <System.Data.SqlClient.SqlConnection, System.Data.SqlClient.SqlTransaction, int, ServerUser, bool>(CharacterUtil_OnCharacterDeleting); CharacterUtil.Instance.CharacterPersisting -= new Func <SqlConnection, SqlTransaction, ServerCharacterInfo, bool>(CharacterUtil_CharacterPersisting); CharacterUtil.Instance.CharacterLoading -= new Func <SqlConnection, SqlTransaction, ServerCharacterInfo, bool>(CharacterUtil_CharacterLoading); CharacterUtil.Instance.CharacterSaving -= new Func <SqlConnection, SqlTransaction, ServerCharacterInfo, bool>(CharacterUtil_CharacterSaving); base.OnSocketKilled(msg); }
protected override void OnSocketKilled(string msg) { if (ServerUser != null && ServerUser.CurrentCharacter != null) { GameServerGame gsg = ServerUser.CurrentCharacter.GetCurrentGame(); if (gsg != null) { gsg.RemovePlayer(ServerUser.CurrentCharacter, "Disconnected.", true); gsg.RemoveObserver(ServerUser.CurrentCharacter); } CharacterCache.UncacheCharacter(ServerUser.CurrentCharacter.ID); } base.OnSocketKilled(msg); DB.Instance.Server_Register(MyServer.ServerUserID, MyServer.ServerAddress, MyServer.ListenOnPort, DateTime.UtcNow, "content", ConnectionManager.PaddedConnectionCount, MyServer.MaxConnections); }
protected override void OnRemoteCharacterDisconnected(INetworkConnection con, int characterId, string transferTarget) { // there is a remote possibility that the player can reconnect to THIS server (as part of a transfer) // BEFORE the content server's disconnection message arives (which calls this method). In such a case, // the character would become uncached (i.e. the player connecting causes the character to be re-cached // and then when this disconnection packet arrives, it would uncache the character. base.OnRemoteCharacterDisconnected(con, characterId, transferTarget); // uncache, if appropriate if (!CharacterCache.IsCharacterConnectionAlive(characterId)) { if (transferTarget != null && transferTarget.Length > 0) { // just transferring, so don't immediately expire the cache. let it expire if the player never makes it on again. // if the player logs back in on another server, we will have OnCharacterHandoffComplete fire, which will reset the // cache timer CharacterCache.UpdateCacheTime(characterId, TimeSpan.FromSeconds(60)); } else { CharacterCache.UncacheCharacter(characterId); } } }