Better late game items (fix #6) :)
All checks were successful
pipeline / build-and-push-images (push) Successful in 33s
pipeline / deploy (push) Successful in 7s

This commit is contained in:
2024-12-07 16:09:49 +01:00
parent 42da27e544
commit b7f37898bd
2 changed files with 13 additions and 2 deletions

View File

@@ -11,12 +11,23 @@ for(let item of items.value) {
watch(() => props.builds, () => trimBuilds(props.builds))
trimBuilds(props.builds)
trimLateGameItems(props.builds)
function trimBuilds(builds : Builds) {
builds.tree.children.splice(1, builds.tree.children.length - 1)
if(builds.tree.children[0] != null && builds.tree.children[0] != undefined)
builds.tree.children[0].children.splice(1, builds.tree.children[0].children.length - 1)
}
function trimLateGameItems(builds: Builds) {
function trimLateGameItemsFromTree(tree: ItemTree) {
const foundIndex = builds.lateGame.findIndex((x) => x.data === tree.data)
if(foundIndex != -1) builds.lateGame.splice(foundIndex, 1)
for(let children of tree.children) {
trimLateGameItemsFromTree(children)
}
}
trimLateGameItemsFromTree(builds.tree)
}
</script>
@@ -90,7 +101,7 @@ function trimBuilds(builds : Builds) {
</div>
</div>
<div class="iv-items-container">
<div class="iv-items-container" v-if="builds.lateGame.length > 4">
<div style="margin-left: 5px; margin-right: 5px;" v-for="item in builds.lateGame.slice(4, 8)" >
<NuxtImg v-if="item.data != null && item.data != undefined"
class="item-img" width="64" height="64" :alt="item.data.toString()"

View File

@@ -161,7 +161,7 @@ function handleMatchItems(timeline, participant: any, participantIndex : number,
}
// Late game items
for(let item of items.slice(4)) {
for(let item of items.slice(3)) {
const already = builds.lateGame.find((x) => x.data == item)
if(already == undefined) builds.lateGame.push({count:1, data:item})
else already.count += 1