From df1d12d88ccf65b9e2f1cb8aa9f2d0ac29682c4c Mon Sep 17 00:00:00 2001 From: vhaudiquet Date: Sat, 30 Nov 2024 15:26:57 +0100 Subject: [PATCH] Supp items: fix #1 --- match_collector/champion_stat.ts | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/match_collector/champion_stat.ts b/match_collector/champion_stat.ts index abf37d1..7ef7822 100644 --- a/match_collector/champion_stat.ts +++ b/match_collector/champion_stat.ts @@ -78,7 +78,7 @@ function handleParticipantRunes(participant, runes: Array) { if(addRunes) runes.push(gameRunes) } -function handleMatchItems(timeline, participantIndex : number, builds: Builds) { +function handleMatchItems(timeline, participant: any, participantIndex : number, builds: Builds) { const items : Array = [] for(let frame of timeline.info.frames) { for(let event of frame.events) { @@ -89,9 +89,26 @@ function handleMatchItems(timeline, participantIndex : number, builds: Builds) { } continue; } - if(event.type != "ITEM_PURCHASED") continue; let itemInfo = itemDict.get(event.itemId) + // Handle bounty of worlds destroy as upgrade + if(event.type == "ITEM_DESTROYED") { + if(event.itemId == 3867) { + let suppItem : number = itemInfo.to.find((x:number) => + x == participant.item0 + || x == participant.item1 + || x == participant.item2 + || x == participant.item3 + || x == participant.item4 + || x == participant.item5 + || x == participant.item6 ) + if(suppItem != undefined) + items.push(suppItem) + } + } + if(event.type != "ITEM_PURCHASED") continue; + + // Handle boots differently if(itemInfo.categories.includes("Boots")){ @@ -183,7 +200,7 @@ async function championInfos(client, patch: number, champion: Champion) { handleParticipantRunes(participant, lane.runes) // Items - handleMatchItems(match.timeline, participantIndex, lane.builds) + handleMatchItems(match.timeline, participant, participantIndex, lane.builds) break; }