Supp items: fix #1
All checks were successful
pipeline / build-and-push-images (push) Successful in 10s
pipeline / deploy (push) Successful in 6s

This commit is contained in:
2024-11-30 15:26:57 +01:00
parent a56b81835f
commit df1d12d88c

View File

@@ -78,7 +78,7 @@ function handleParticipantRunes(participant, runes: Array<Rune>) {
if(addRunes) runes.push(gameRunes) if(addRunes) runes.push(gameRunes)
} }
function handleMatchItems(timeline, participantIndex : number, builds: Builds) { function handleMatchItems(timeline, participant: any, participantIndex : number, builds: Builds) {
const items : Array<number> = [] const items : Array<number> = []
for(let frame of timeline.info.frames) { for(let frame of timeline.info.frames) {
for(let event of frame.events) { for(let event of frame.events) {
@@ -89,9 +89,26 @@ function handleMatchItems(timeline, participantIndex : number, builds: Builds) {
} }
continue; continue;
} }
if(event.type != "ITEM_PURCHASED") continue;
let itemInfo = itemDict.get(event.itemId) 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 // Handle boots differently
if(itemInfo.categories.includes("Boots")){ if(itemInfo.categories.includes("Boots")){
@@ -183,7 +200,7 @@ async function championInfos(client, patch: number, champion: Champion) {
handleParticipantRunes(participant, lane.runes) handleParticipantRunes(participant, lane.runes)
// Items // Items
handleMatchItems(match.timeline, participantIndex, lane.builds) handleMatchItems(match.timeline, participant, participantIndex, lane.builds)
break; break;
} }