public async Task HandleAsync(IGameWebSocketConnection connection, GamePacket packet) { if (packet.Data is TimeSyncUpdate update) { this.sessionManager.RecordTimeMismatch(connection.SessionToken, update); } }
public async Task HandleAsync(IGameWebSocketConnection connection, GamePacket packet) { if (packet.Data is ClientSyncUpdate update) { this.sessionManager.UpdateSessionState(connection.SessionToken, update); } }
public Task HandleAsync( IGameWebSocketConnection connection, GamePacket packet) { logger.LogError($"Unsupported packet received with id: {packet.Id}. payload type: {packet.Type}"); return(Task.CompletedTask); }
public GameProcessor( IRavenBotApiClient ravenbotApi, IIntegrityChecker integrityChecker, IGameWebSocketConnection websocket, IExtensionWebSocketConnectionProvider extWsProvider, ISessionManager sessionManager, IPlayerInventoryProvider inventoryProvider, IGameData gameData, IGameManager gameManager, SessionToken sessionToken) { this.gameData = gameData; this.gameManager = gameManager; this.ravenbotApi = ravenbotApi; this.integrityChecker = integrityChecker; this.gameConnection = websocket; this.extensionConnectionProvider = extWsProvider; this.sessionManager = sessionManager; this.inventoryProvider = inventoryProvider; this.sessionToken = sessionToken; RegisterPlayerTask <ClanProcessor>(ClanProcessorName); RegisterPlayerTask <VillageProcessor>(VillageProcessorName); RegisterPlayerTask <LoyaltyProcessor>(LoyaltyProcessorName); RegisterPlayerTask <RestedProcessor>(RestedProcessorName); RegisterPlayerTask <FightingTaskProcessor>("Fighting"); RegisterPlayerTask <MiningTaskProcessor>("Mining"); RegisterPlayerTask <FishingTaskProcessor>("Fishing"); RegisterPlayerTask <FarmingTaskProcessor>("Farming"); RegisterPlayerTask <WoodcuttingTaskProcessor>("Woodcutting"); RegisterPlayerTask <CraftingTaskProcessor>("Crafting"); RegisterPlayerTask <CookingTaskProcessor>("Cooking"); SendSessionData(); }
public Task HandleAsync(IGameWebSocketConnection connection, GamePacket packet) { if (packet.Data is UserLoyaltyUpdate update) { this.playerManager.UpdateUserLoyalty(connection.SessionToken, update); } return(Task.CompletedTask); }
public async Task HandleAsync(IGameWebSocketConnection connection, GamePacket packet) { var result = false; if (packet.Data is PlayerSessionActivity update) { this.playerManager.UpdatePlayerActivity(connection.SessionToken, update); } //await connection.ReplyAsync(packet.CorrelationId, packet.Type, result, CancellationToken.None); }
public async Task HandleAsync(IGameWebSocketConnection connection, GamePacket packet) { var result = false; //if (packet.Data is CharacterSkillUpdate update) //{ // result = this.playerManager.UpdateExperience( // connection.SessionToken, update.UserId, update.Level, update.Experience, update.CharacterId); //} await connection.ReplyAsync(packet.CorrelationId, packet.Type, result, CancellationToken.None); }
public async Task HandleAsync(IGameWebSocketConnection connection, GamePacket packet) { var result = false; if (packet.Data is CharacterStateUpdate update) { result = this.playerManager.UpdatePlayerState(connection.SessionToken, update); } else { logger.LogError("CharacterStateUpdate package received but the packet data did not contain the proper structure."); } //await connection.ReplyAsync(packet, result); }
public async Task HandleAsync(IGameWebSocketConnection connection, GamePacket packet) { var result = false; if (packet.Data is CharacterSkillUpdate update) { result = this.playerManager.UpdateExperience( connection.SessionToken, update.UserId, update.Level, update.Experience, update.CharacterId); } else { logger.LogError("CharacterSkillUpdate package received but the packet data did not contain the proper structure."); } //await connection.ReplyAsync(packet.CorrelationId, packet.Type, result, CancellationToken.None); }
public async Task HandleAsync(IGameWebSocketConnection connection, GamePacket packet) { var result = false; if (connection == null) { logger.LogError("Connection dropped during saving."); return; } if (connection.SessionToken == null && packet != null) { logger.LogError("SessionToken is null. UpdateCharacterExperiencePacketHandler:" + packet.Data); return; } if (packet.TryGetValue <CharacterExpUpdate>(out var update)) { if (connection.SessionToken.Expired) { logger.LogError("Trying to saving character but session expired. " + connection.SessionToken.SessionId); return; } result = this.playerManager.UpdateExperience( connection.SessionToken, update.SkillIndex, update.Level, update.Experience, update.CharacterId); } else { logger.LogError("CharacterExpUpdate package received but the packet data did not contain the proper structure."); } //await connection.ReplyAsync(packet.CorrelationId, packet.Type, result, CancellationToken.None); }
public bool TryGet(SessionToken token, out IGameWebSocketConnection session) { return(socketSessions.TryGetValue(token.SessionId, out session)); }
public bool TryGet(Guid sessionId, out IGameWebSocketConnection session) { return(socketSessions.TryGetValue(sessionId, out session)); }
public async Task HandleAsync(IGameWebSocketConnection connection, GamePacket packet) { var result = false; await connection.ReplyAsync(packet.CorrelationId, packet.Type, result, CancellationToken.None); }