You've already forked tf2wikipricing
feat: add support for festive weapon variants
on schema update, festive variants are linked. on content injection, if if finds a festive variant, it adds price rows for Festive and Strange Festive.
This commit is contained in:
@@ -237,6 +237,42 @@ async function inject() {
|
||||
}))
|
||||
}
|
||||
|
||||
// Check item schema for Festive variant of current defindex
|
||||
if(itemSchema[itemIndex].festiveVariant != null) {
|
||||
promises.push(new Promise(async (resolve) => {
|
||||
logDebug(`Fetching price for Festive ${itemName}`)
|
||||
var data: ItemPriceData | null
|
||||
try {
|
||||
data = await fetchPrice(token, `${itemSchema[itemIndex].festiveVariant};6`, currentTime);
|
||||
updateTime = new Date(data.update)
|
||||
} catch {
|
||||
log(`Festive ${itemName} is unpriced or unavailable, skipping...`)
|
||||
}
|
||||
|
||||
const priceRow = createPriceRow($T("Festive"), data, keyPrice, locale, "https://wiki.teamfortress.com/wiki/Festive_weapons")
|
||||
|
||||
priceRows.push({quality: 97, row: priceRow})
|
||||
resolve()
|
||||
return
|
||||
}))
|
||||
promises.push(new Promise(async (resolve) => {
|
||||
logDebug(`Fetching price for Strange Festive ${itemName}`)
|
||||
var data: ItemPriceData | null
|
||||
try {
|
||||
data = await fetchPrice(token, `${itemSchema[itemIndex].festiveVariant};11`, currentTime);
|
||||
updateTime = new Date(data.update)
|
||||
} catch {
|
||||
log(`Strange Festive ${itemName} is unpriced or unavailable, skipping...`)
|
||||
}
|
||||
|
||||
const priceRow = createPriceRow($T("Strange Festive"), data, keyPrice, locale, "https://wiki.teamfortress.com/wiki/Festive_weapons")
|
||||
|
||||
priceRows.push({quality: 98, row: priceRow})
|
||||
resolve()
|
||||
return
|
||||
}))
|
||||
}
|
||||
|
||||
Promise.all(promises).then(() => {
|
||||
priceRows.sort((a, b) => {
|
||||
// Sort 6 first always, then numerically
|
||||
|
||||
Reference in New Issue
Block a user