diff --git a/src/client/dev-dist/sw.js b/src/client/dev-dist/sw.js index 7276bc2..9686a5c 100644 --- a/src/client/dev-dist/sw.js +++ b/src/client/dev-dist/sw.js @@ -82,7 +82,7 @@ define(['./workbox-5a5d9309'], (function (workbox) { 'use strict'; "revision": "3ca0b8505b4bec776b69afdba2768812" }, { "url": "index.html", - "revision": "0.99c1h4jant" + "revision": "0.r2hp08ujhtk" }], {}); workbox.cleanupOutdatedCaches(); workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), { diff --git a/src/server/managers/GameManager.ts b/src/server/managers/GameManager.ts index b8b17ad..7bbd73d 100644 --- a/src/server/managers/GameManager.ts +++ b/src/server/managers/GameManager.ts @@ -366,25 +366,31 @@ export class GameManager extends EventEmitter { console.log(`[GameManager] Handling Action: ${action.type} for ${roomId} by ${actorId}`); - switch (action.type) { - case 'UPDATE_LIFE': - if (game.players[actorId]) { - game.players[actorId].life += (action.amount || 0); - } - break; - case 'MOVE_CARD': - this.moveCard(game, action, actorId); - break; - case 'TAP_CARD': - this.tapCard(game, action, actorId); - break; - case 'DRAW_CARD': - const engine = new RulesEngine(game); - engine.drawCard(actorId); - break; - case 'RESTART_GAME': - this.restartGame(roomId); - break; + try { + switch (action.type) { + case 'UPDATE_LIFE': + if (game.players[actorId]) { + game.players[actorId].life += (action.amount || 0); + } + break; + case 'MOVE_CARD': + this.moveCard(game, action, actorId); + break; + case 'TAP_CARD': + this.tapCard(game, action, actorId); + break; + case 'DRAW_CARD': + const engine = new RulesEngine(game); + engine.drawCard(actorId); + break; + case 'RESTART_GAME': + this.restartGame(roomId); + break; + } + } catch (e: any) { + console.error(`Legacy Action Error [${action?.type}]: ${e.message}`); + this.emit('game_error', roomId, { message: e.message, userId: actorId }); + return null; } return game;