From 0b425824349bb191b6cfb16f764c9de28a69905d Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Sun, 2 Jul 2023 16:23:06 -0700 Subject: [PATCH] Normalize 1-index for over mastery --- components/party/Party/index.tsx | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/components/party/Party/index.tsx b/components/party/Party/index.tsx index 87079f42..d6837cd4 100644 --- a/components/party/Party/index.tsx +++ b/components/party/Party/index.tsx @@ -21,7 +21,7 @@ import { GridType } from '~utils/enums' import { retrieveCookies } from '~utils/retrieveCookies' import { setEditKey, storeEditKey, unsetEditKey } from '~utils/userToken' -import type { DetailsObject } from '~types' +import type { CharacterOverMastery, DetailsObject } from '~types' // Props interface Props { @@ -316,8 +316,22 @@ const Party = (props: Props) => { const storeCharacters = (list: Array) => { list.forEach((object: GridCharacter) => { - if (object.position != null) - appState.grid.characters[object.position] = object + let character = clonedeep(object) + + if (character.over_mastery) { + const overMastery: CharacterOverMastery = { + 1: object.over_mastery[0], + 2: object.over_mastery[1], + 3: object.over_mastery[2], + 4: object.over_mastery[3], + } + + character.over_mastery = overMastery + } + + if (character.position != null) { + appState.grid.characters[object.position] = character + } }) }