mirror of
https://github.com/Kvan7/Exiled-Exchange-2.git
synced 2026-09-27 15:15:48 +00:00
fix: missing quality parser
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
TAG_RARITY,
|
||||
TAG_STACK_SIZE,
|
||||
TAG_SOCKETS,
|
||||
TAG_QUALITY,
|
||||
CORRUPTED,
|
||||
UNIDENTIFIED,
|
||||
SUFFIX_INFLUENCE
|
||||
@@ -74,7 +75,7 @@ export function parseClipboard (clipboard: string) {
|
||||
const parsers = new Set([
|
||||
parseUnidentified,
|
||||
parseItemLevel,
|
||||
parseGemLevel,
|
||||
parseGem,
|
||||
parseStackSize,
|
||||
parseCorrupted,
|
||||
parseInfluence,
|
||||
@@ -199,13 +200,16 @@ function parseItemLevel (section: string[], item: ParsedItem) {
|
||||
return SECTION_SKIPPED
|
||||
}
|
||||
|
||||
function parseGemLevel (section: string[], item: ParsedItem) {
|
||||
function parseGem (section: string[], item: ParsedItem) {
|
||||
if (item.rarity !== ItemRarity.Gem) {
|
||||
return PARSER_SKIPPED
|
||||
}
|
||||
if (section[1]?.startsWith(TAG_GEM_LEVEL)) {
|
||||
// "Level: 20 (Max)"
|
||||
item.gemLevel = parseInt(section[1].substr(TAG_GEM_LEVEL.length), 10)
|
||||
|
||||
parseQualityNested(section, item)
|
||||
|
||||
return SECTION_PARSED
|
||||
}
|
||||
return SECTION_SKIPPED
|
||||
@@ -240,6 +244,16 @@ function parseSockets (section: string[], item: ParsedItem) {
|
||||
return SECTION_SKIPPED
|
||||
}
|
||||
|
||||
function parseQualityNested (section: string[], item: ParsedItem) {
|
||||
for (const line of section) {
|
||||
if (line.startsWith(TAG_QUALITY)) {
|
||||
// "Quality: +20% (augmented)"
|
||||
item.quality = parseInt(line.substr(TAG_QUALITY.length), 10)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// detailsId
|
||||
|
||||
function getDetailsId (item: ParsedItem) {
|
||||
|
||||
@@ -24,6 +24,7 @@ export const TAG_ITEM_LEVEL = 'Item Level: '
|
||||
export const TAG_GEM_LEVEL = 'Level: '
|
||||
export const TAG_STACK_SIZE = 'Stack Size: '
|
||||
export const TAG_SOCKETS = 'Sockets: '
|
||||
export const TAG_QUALITY = 'Quality: '
|
||||
export const SUFFIX_INFLUENCE = ' Item'
|
||||
export const CORRUPTED = 'Corrupted'
|
||||
export const UNIDENTIFIED = 'Unidentified'
|
||||
|
||||
Reference in New Issue
Block a user