This commit is contained in:
Alexander Drozdov
2021-04-23 15:20:05 +03:00
parent a47fffa098
commit 2ab28a416d
3 changed files with 20 additions and 8 deletions
+1
View File
@@ -46,6 +46,7 @@ export interface ParsedItem {
category?: ItemCategory
icon?: string
rawText: string
isAdvancedDesc: boolean
}
export type HeistJob =
+9 -3
View File
@@ -75,7 +75,10 @@ export function parseClipboard (clipboard: string) {
if (!parsed) {
return null
}
sections.shift()
parsed.rawText = clipboard
parsed.isAdvancedDesc = isAdvancedDescription(lines)
// each section can be parsed at most by one parser
for (const parser of parsers) {
@@ -90,8 +93,6 @@ export function parseClipboard (clipboard: string) {
}
}
parsed.rawText = clipboard
return Object.freeze(parsed)
}
@@ -200,7 +201,8 @@ function parseNamePlate (section: string[]) {
influences: [],
sockets: {},
extra: {},
rawText: undefined!
rawText: undefined!,
isAdvancedDesc: false
}
return item
}
@@ -683,3 +685,7 @@ function markupConditionParser (text: string) {
return text
}
function isAdvancedDescription (lines: string[]): boolean {
return lines.some(line => line.startsWith('{') && line.endsWith('}'))
}
+10 -5
View File
@@ -6,12 +6,12 @@ import { nameToDetailsId } from '../price-check/trends/getDetailsId'
interface NinjaCurrencyInfo { /* eslint-disable camelcase */
currencyTypeName: string
receive?: {
league_id: number
pay_currency_id: number
get_currency_id: number
count: number
value: number
includes_secondary: boolean
}
pay?: {
get_currency_id: number
value: number
}
receiveSparkLine: {
data: Array<number | null>
@@ -142,7 +142,12 @@ async function load (force: boolean = false) {
if (currency.receive.value >= 15) {
chaosExaRate.value = currency.receive.value
} else {
chaosExaRate.value = undefined
// fallback to sell price
if (currency.pay?.value && (1 / currency.pay.value) >= 15) {
chaosExaRate.value = (1 / currency.pay.value)
} else {
chaosExaRate.value = undefined
}
}
}
}