diff --git a/src/parser/Parser.ts b/src/parser/Parser.ts index 9d3fdf46..82b823c6 100644 --- a/src/parser/Parser.ts +++ b/src/parser/Parser.ts @@ -30,6 +30,7 @@ import { PREFIX_SYNTHESISED, PROPHECY_HELP, BEAST_HELP, + SEED_HELP, METAMORPH_HELP, METAMORPH_BRAIN, METAMORPH_EYE, @@ -37,7 +38,8 @@ import { METAMORPH_HEART, METAMORPH_LIVER, VEILED_PREFIX, - VEILED_SUFFIX + VEILED_SUFFIX, + SEED_MONSTER_LEVEL } from './constants' import { BaseTypes } from '@/assets/data' import { ModifierType, sectionToStatStrings, tryFindModifier } from './modifiers' @@ -297,11 +299,26 @@ function parseStackSize (section: string[], item: ParsedItem) { if (section[0].startsWith(TAG_STACK_SIZE)) { // "Stack Size: 2/9" item.stackSize = parseInt(section[0].substr(TAG_STACK_SIZE.length), 10) + + if (item.category === ItemCategory.Seed) { + parseSeedLevelNested(section, item) + } + return SECTION_PARSED } return SECTION_SKIPPED } +function parseSeedLevelNested (section: string[], item: ParsedItem) { + for (const line of section) { + const match = line.match(SEED_MONSTER_LEVEL) + if (match != null) { + item.itemLevel = Number(match[1]) + break + } + } +} + function parseSockets (section: string[], item: ParsedItem) { if (section[0].startsWith(TAG_SOCKETS)) { let sockets = section[0].substr(TAG_SOCKETS.length).trimEnd() @@ -503,17 +520,18 @@ function parseSynthesised (section: string[], item: ParsedItem) { } function parseCategoryByHelpText (section: string[], item: ParsedItem) { - if (section.length === 1) { - if (section[0] === PROPHECY_HELP) { - item.category = ItemCategory.Prophecy - return SECTION_PARSED - } else if (section[0] === BEAST_HELP) { - item.category = ItemCategory.CapturedBeast - return SECTION_PARSED - } else if (section[0] === METAMORPH_HELP) { - item.category = ItemCategory.MetamorphSample - return SECTION_PARSED - } + if (section[0] === PROPHECY_HELP) { + item.category = ItemCategory.Prophecy + return SECTION_PARSED + } else if (section[0] === BEAST_HELP) { + item.category = ItemCategory.CapturedBeast + return SECTION_PARSED + } else if (section[0] === METAMORPH_HELP) { + item.category = ItemCategory.MetamorphSample + return SECTION_PARSED + } else if (section[0].startsWith(SEED_HELP)) { + item.category = ItemCategory.Seed + return SECTION_PARSED } return SECTION_SKIPPED diff --git a/src/parser/constants.ts b/src/parser/constants.ts index 2c2b9dfd..599f4ddd 100644 --- a/src/parser/constants.ts +++ b/src/parser/constants.ts @@ -46,6 +46,7 @@ export const ENCHANT_SUFFIX = ' (enchant)' export const CORRUPTED = 'Corrupted' export const UNIDENTIFIED = 'Unidentified' export const FLASK_CHARGES = /^Currently has \d+ Charges$/ +export const SEED_MONSTER_LEVEL = /^Spawns a Level (\d+) Monster when Harvested$/ export const SECTION_SYNTHESISED = 'Synthesised Item' export const PREFIX_SYNTHESISED = 'Synthesised ' @@ -54,6 +55,7 @@ export const CLUSTER_JEWEL_GRANT = 'Added Small Passive Skills grant: ' export const PROPHECY_HELP = 'Right-click to add this prophecy to your character.' export const BEAST_HELP = 'Right-click to add this to your bestiary.' export const METAMORPH_HELP = "Combine this with four other different samples in Tane's Laboratory." +export const SEED_HELP = 'Right-click this item then left-click the ground to plant it in the Sacred Grove.' // Once planted and fully grown, can be Harvested by using a nearby (Wild|Vivid|Primal) Collector. export const METAMORPH_BRAIN = 'Brain' export const METAMORPH_EYE = 'Eye' diff --git a/src/parser/meta.ts b/src/parser/meta.ts index d9c1aacd..9f3a4550 100644 --- a/src/parser/meta.ts +++ b/src/parser/meta.ts @@ -3,6 +3,7 @@ export enum ItemCategory { Prophecy = 'Prophecy', CapturedBeast = 'Captured Beast', MetamorphSample = 'Metamorph Sample', + Seed = 'Seed', Helmet = 'Helmet', BodyArmour = 'Body Armour', Gloves = 'Gloves', diff --git a/src/web/price-check/CheckedItem.vue b/src/web/price-check/CheckedItem.vue index ae8c20cb..633dca41 100644 --- a/src/web/price-check/CheckedItem.vue +++ b/src/web/price-check/CheckedItem.vue @@ -9,7 +9,7 @@ - } @@ -398,7 +398,9 @@ export async function requestResults (queryId: string, resultIds: string[]): Pro return data.result.map(result => { return { id: result.id, - itemLevel: result.item.ilvl, + itemLevel: + result.item.ilvl || + result.item.properties?.find(prop => prop.name === 'Spawns a Level %0 Monster when Harvested')?.values[0][0], stackSize: result.item.stackSize, corrupted: result.item.corrupted, quality: result.item.properties?.find(prop => prop.name === 'Quality')?.values[0][0],