From ae0c67d237df3be5eb560862cdeb0ea3c881a10c Mon Sep 17 00:00:00 2001 From: Alexander Drozdov Date: Mon, 16 Mar 2020 18:35:05 +0200 Subject: [PATCH] fix multistat grant --- src/components/parser/constants.ts | 2 ++ src/components/parser/modifiers.ts | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/components/parser/constants.ts b/src/components/parser/constants.ts index 40a91cac..0d65ba18 100644 --- a/src/components/parser/constants.ts +++ b/src/components/parser/constants.ts @@ -48,3 +48,5 @@ export const UNIDENTIFIED = 'Unidentified' export const FLASK_CHARGES = /^Currently has \d+ Charges$/ export const SECTION_SYNTHESISED = 'Synthesised Item' export const PREFIX_SYNTHESISED = 'Synthesised ' + +export const CLUSTER_JEWEL_GRANT = 'Added Small Passive Skills grant: ' diff --git a/src/components/parser/modifiers.ts b/src/components/parser/modifiers.ts index e40d72dc..8507888b 100644 --- a/src/components/parser/modifiers.ts +++ b/src/components/parser/modifiers.ts @@ -1,4 +1,5 @@ import { Mods, Mod, StatMatcher } from '../../data' +import { CLUSTER_JEWEL_GRANT } from './constants' export enum ModifierType { Pseudo = 'pseudo', @@ -22,7 +23,19 @@ export function * sectionToStatStrings (section: string[]) { let multi = (idx + 1) < section.length while (idx < section.length) { - const str = multi ? `${section[idx]}\n${section[idx + 1]}` : section[idx] + let str: string + if (multi) { + const lines = [ + section[idx], + section[idx + 1] + ] + if (lines.every(l => l.startsWith(CLUSTER_JEWEL_GRANT))) { + lines[1] = lines[1].substr(CLUSTER_JEWEL_GRANT.length) + } + str = lines.join('\n') + } else { + str = section[idx] + } const isParsed: boolean = yield str