|
@ -10,6 +10,7 @@ |
|
|
|
|
|
|
|
|
export let logs: LogResult[] = []; |
|
|
export let logs: LogResult[] = []; |
|
|
export let mode: GoalCompositionMode = "item"; |
|
|
export let mode: GoalCompositionMode = "item"; |
|
|
|
|
|
export let ignoreZeroWeight: boolean = false; |
|
|
|
|
|
|
|
|
let list: CompositionItem[] = []; |
|
|
let list: CompositionItem[] = []; |
|
|
|
|
|
|
|
@ -20,19 +21,23 @@ |
|
|
for (const log of logs) { |
|
|
for (const log of logs) { |
|
|
if (log.itemCounted !== false) { |
|
|
if (log.itemCounted !== false) { |
|
|
const item = log.item; |
|
|
const item = log.item; |
|
|
if (!map[item.id]) { |
|
|
|
|
|
map[item.id] = {name: item.name, amount: log.itemAmount, link: `/items#${item.id}`}; |
|
|
|
|
|
} else { |
|
|
|
|
|
map[item.id].amount += log.itemAmount; |
|
|
|
|
|
|
|
|
if (!ignoreZeroWeight || item.groupWeight > 0) { |
|
|
|
|
|
if (!map[item.id]) { |
|
|
|
|
|
map[item.id] = {name: item.name, amount: log.itemAmount, link: `/items#${item.id}`}; |
|
|
|
|
|
} else { |
|
|
|
|
|
map[item.id].amount += log.itemAmount; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (log.secondaryItem && log.secondaryItemCounted !== false) { |
|
|
if (log.secondaryItem && log.secondaryItemCounted !== false) { |
|
|
const item = log.secondaryItem; |
|
|
const item = log.secondaryItem; |
|
|
if (!map[item.id]) { |
|
|
|
|
|
map[item.id] = {name: item.name, amount: log.secondaryItemAmount, link: `/items#${item.id}`}; |
|
|
|
|
|
} else { |
|
|
|
|
|
map[item.id].amount += log.secondaryItemAmount; |
|
|
|
|
|
|
|
|
if (!ignoreZeroWeight || item.groupWeight > 0) { |
|
|
|
|
|
if (!map[item.id]) { |
|
|
|
|
|
map[item.id] = {name: item.name, amount: log.secondaryItemAmount, link: `/items#${item.id}`}; |
|
|
|
|
|
} else { |
|
|
|
|
|
map[item.id].amount += log.secondaryItemAmount; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|