Better late game items (fix #6) :)
This commit is contained in:
@@ -11,12 +11,23 @@ for(let item of items.value) {
|
|||||||
|
|
||||||
watch(() => props.builds, () => trimBuilds(props.builds))
|
watch(() => props.builds, () => trimBuilds(props.builds))
|
||||||
trimBuilds(props.builds)
|
trimBuilds(props.builds)
|
||||||
|
trimLateGameItems(props.builds)
|
||||||
|
|
||||||
function trimBuilds(builds : Builds) {
|
function trimBuilds(builds : Builds) {
|
||||||
builds.tree.children.splice(1, builds.tree.children.length - 1)
|
builds.tree.children.splice(1, builds.tree.children.length - 1)
|
||||||
if(builds.tree.children[0] != null && builds.tree.children[0] != undefined)
|
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)
|
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>
|
</script>
|
||||||
|
|
||||||
@@ -90,7 +101,7 @@ function trimBuilds(builds : Builds) {
|
|||||||
</div>
|
</div>
|
||||||
</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)" >
|
<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"
|
<NuxtImg v-if="item.data != null && item.data != undefined"
|
||||||
class="item-img" width="64" height="64" :alt="item.data.toString()"
|
class="item-img" width="64" height="64" :alt="item.data.toString()"
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ function handleMatchItems(timeline, participant: any, participantIndex : number,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Late game items
|
// 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)
|
const already = builds.lateGame.find((x) => x.data == item)
|
||||||
if(already == undefined) builds.lateGame.push({count:1, data:item})
|
if(already == undefined) builds.lateGame.push({count:1, data:item})
|
||||||
else already.count += 1
|
else already.count += 1
|
||||||
|
|||||||
Reference in New Issue
Block a user