From 5054f9d87faaca18113cc1257bb9f8b44c4a8766 Mon Sep 17 00:00:00 2001 From: Made Baruna Date: Tue, 8 Jun 2021 23:52:30 +0700 Subject: [PATCH] Fix todo bugs --- src/locales/en.json | 3 +- src/routes/calculator/_character.svelte | 41 +++++++------------------ src/routes/todo.svelte | 4 ++- 3 files changed, 16 insertions(+), 32 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index 42f1eb4b..6956306d 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -390,7 +390,8 @@ "mora": "Mora (approximate ±40)", "expWasted": "EXP Wasted", "addToTodo": "Add to Todo List", - "addedToTodo": "Added to Todo List" + "addedToTodo": "Added to Todo List", + "talent": ["Attack", "Skill", "Burst"] }, "expTable": { "level": "Level", diff --git a/src/routes/calculator/_character.svelte b/src/routes/calculator/_character.svelte index e6ee7f0e..f9b2560a 100644 --- a/src/routes/calculator/_character.svelte +++ b/src/routes/calculator/_character.svelte @@ -284,6 +284,8 @@ } } }); + + moraNeeded = moraNeeded + talentMaterial.mora; } function calculateTalent() { @@ -407,6 +409,14 @@ calculateTalent(); } } + + for (const [id, item] of Object.entries(talentMaterial.items)) { + if (ascensionResouce[id]) { + ascensionResouce[id].amount += item.amount; + } else { + ascensionResouce[id] = item; + } + } } changed = false; @@ -429,14 +439,6 @@ return prev; }, {}); - const talentRes = Object.keys(talentMaterial.items).reduce((prev, item) => { - if (talentMaterial.items[item].amount > 0) { - prev[item] = talentMaterial.items[item].amount; - } - - return prev; - }, {}); - addTodo({ type: 'character', character: withAscension ? selectedCharacter : null, @@ -445,13 +447,11 @@ mora: moraNeeded, ...levelRes, ...ascensionRes, - ...talentRes, }, original: { mora: moraNeeded, ...levelRes, ...ascensionRes, - ...talentRes, }, }); @@ -460,6 +460,7 @@ addedToTodo = false; }, 2000); } +
@@ -665,26 +666,6 @@ {/if} {/each} - {#each Object.entries(talentMaterial.items) as [id, item]} - {#if item.amount > 0} - - - {item.amount} - - - - - - {item.name} - - {item.name} - - - - {/if} - {/each} @@ -456,7 +457,7 @@
- {#each Object.entries(todo.resources) as [id, amount]} + {#each Object.entries(todo.resources).sort((a, b) => b[1] - a[1]) as [id, amount]}
@@ -496,4 +497,5 @@ @apply border-b-0; } } +