From 01f7546a958406e5d5a67c4d93641e86d3fbeb18 Mon Sep 17 00:00:00 2001 From: Vasile Date: Tue, 4 Apr 2023 14:52:11 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20Fix=20share=20battle=20by=20remo?= =?UTF-8?q?ving=20unimplemented=20creature=20fields?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/state/SyncManager.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/state/SyncManager.js b/src/state/SyncManager.js index 2c7fcd51..90cc41e2 100644 --- a/src/state/SyncManager.js +++ b/src/state/SyncManager.js @@ -5,6 +5,13 @@ export function share(state, createBattle, updateBattle, date) { if (!state.shareEnabled) { return state; } + // remove additional data from creatures to fix share battle + const newCreatures = state.creatures.map((creature) => { + const { + spellData, apiData, armorClass, ...rest + } = creature; + return rest; + }); const battleId = state.battleId || nanoid(11); @@ -13,7 +20,7 @@ export function share(state, createBattle, updateBattle, date) { battleinput: { battleId, round: state.round, - creatures: state.creatures, + creatures: newCreatures, activeCreature: state.activeCreature, expdate: Math.floor(date.getTime() / 1000.0) + 86400, },