Fix todo bugs

This commit is contained in:
Made Baruna 2021-06-08 23:52:30 +07:00
parent e8581f8255
commit 5054f9d87f
No known key found for this signature in database
GPG key ID: 5AA5DA16AA5DCEAD
3 changed files with 16 additions and 32 deletions

View file

@ -390,7 +390,8 @@
"mora": "Mora (approximate ±40)", "mora": "Mora (approximate ±40)",
"expWasted": "EXP Wasted", "expWasted": "EXP Wasted",
"addToTodo": "Add to Todo List", "addToTodo": "Add to Todo List",
"addedToTodo": "Added to Todo List" "addedToTodo": "Added to Todo List",
"talent": ["Attack", "Skill", "Burst"]
}, },
"expTable": { "expTable": {
"level": "Level", "level": "Level",

View file

@ -284,6 +284,8 @@
} }
} }
}); });
moraNeeded = moraNeeded + talentMaterial.mora;
} }
function calculateTalent() { function calculateTalent() {
@ -407,6 +409,14 @@
calculateTalent(); calculateTalent();
} }
} }
for (const [id, item] of Object.entries(talentMaterial.items)) {
if (ascensionResouce[id]) {
ascensionResouce[id].amount += item.amount;
} else {
ascensionResouce[id] = item;
}
}
} }
changed = false; changed = false;
@ -429,14 +439,6 @@
return prev; 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({ addTodo({
type: 'character', type: 'character',
character: withAscension ? selectedCharacter : null, character: withAscension ? selectedCharacter : null,
@ -445,13 +447,11 @@
mora: moraNeeded, mora: moraNeeded,
...levelRes, ...levelRes,
...ascensionRes, ...ascensionRes,
...talentRes,
}, },
original: { original: {
mora: moraNeeded, mora: moraNeeded,
...levelRes, ...levelRes,
...ascensionRes, ...ascensionRes,
...talentRes,
}, },
}); });
@ -460,6 +460,7 @@
addedToTodo = false; addedToTodo = false;
}, 2000); }, 2000);
} }
</script> </script>
<div class="bg-item rounded-xl p-4"> <div class="bg-item rounded-xl p-4">
@ -665,26 +666,6 @@
</tr> </tr>
{/if} {/if}
{/each} {/each}
{#each Object.entries(talentMaterial.items) as [id, item]}
{#if item.amount > 0}
<tr>
<td class="text-right border-b border-gray-700 py-1">
<span class="text-white mr-2 whitespace-no-wrap"
>{item.amount}
<Icon size={0.5} path={mdiClose} /></span
>
</td>
<td class="border-b border-gray-700 py-1">
<span class="text-white">
<span class="w-6 inline-block">
<img class="h-6 inline-block mr-1" src={`/images/items/${id}.png`} alt={item.name} />
</span>
{item.name}
</span>
</td>
</tr>
{/if}
{/each}
<tr> <tr>
<td class="text-right border-b border-gray-700 py-1"> <td class="text-right border-b border-gray-700 py-1">
<span class="text-white mr-2 whitespace-no-wrap" <span class="text-white mr-2 whitespace-no-wrap"

View file

@ -270,6 +270,7 @@
$: $todos, updateSummary(); $: $todos, updateSummary();
$: columnCount, updateId(); $: columnCount, updateId();
</script> </script>
<svelte:head> <svelte:head>
@ -456,7 +457,7 @@
</Button> </Button>
</div> </div>
<table class="w-full"> <table class="w-full">
{#each Object.entries(todo.resources) as [id, amount]} {#each Object.entries(todo.resources).sort((a, b) => b[1] - a[1]) as [id, amount]}
<tr> <tr>
<td class="text-right border-b border-gray-700 py-1"> <td class="text-right border-b border-gray-700 py-1">
<span class={`${amount === 0 ? 'line-through text-gray-600' : 'text-white'} mr-2 whitespace-no-wrap`}> <span class={`${amount === 0 ? 'line-through text-gray-600' : 'text-white'} mr-2 whitespace-no-wrap`}>
@ -496,4 +497,5 @@
@apply border-b-0; @apply border-b-0;
} }
} }
</style> </style>