feat: Harvest seed level

This commit is contained in:
Alexander Drozdov
2020-06-30 11:53:56 +03:00
parent 505e1f741f
commit da21111c7c
6 changed files with 42 additions and 16 deletions
+30 -12
View File
@@ -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
+2
View File
@@ -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'
+1
View File
@@ -3,6 +3,7 @@ export enum ItemCategory {
Prophecy = 'Prophecy',
CapturedBeast = 'Captured Beast',
MetamorphSample = 'Metamorph Sample',
Seed = 'Seed',
Helmet = 'Helmet',
BodyArmour = 'Body Armour',
Gloves = 'Gloves',
+1 -1
View File
@@ -9,7 +9,7 @@
<price-trend
:item="item"
@filter-item-base="applyItemBaseFilter" />
<filters-block v-if="!item.stackSize"
<filters-block
:filters="itemFilters"
:stats="itemStats"
:item="item"
@@ -23,7 +23,10 @@ export function createFilters (item: ParsedItem): ItemFilters {
}
return filters
}
if (item.category === ItemCategory.MetamorphSample) {
if (
item.category === ItemCategory.MetamorphSample ||
item.category === ItemCategory.Seed
) {
filters.baseType = {
value: item.name
}
@@ -137,7 +137,7 @@ interface FetchResult {
stackSize?: number
corrupted?: boolean
properties?: Array<{
name: 'Quality' | 'Level'
name: 'Quality' | 'Level' | 'Spawns a Level %0 Monster when Harvested'
values: [[string, number]]
}>
}
@@ -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],