fix: parse any rarity Blighted map

This commit is contained in:
Alexander Drozdov
2020-07-11 20:43:21 +03:00
parent f0ec089513
commit 8528623bcc
4 changed files with 26 additions and 12 deletions
+2 -1
View File
@@ -52,7 +52,8 @@ const dict = {
'You will find Einhar and complete his mission.': 'You will find Einhar and complete his mission.',
'You will find Niko and complete his mission.': 'You will find Niko and complete his mission.',
'You will find Jun and complete her mission.': 'You will find Jun and complete her mission.',
'You will find Zana and complete her mission.': 'You will find Zana and complete her mission.'
'You will find Zana and complete her mission.': 'You will find Zana and complete her mission.',
'Blighted {0}': 'Blighted {0}'
}
export default dict
+2 -1
View File
@@ -54,7 +54,8 @@ const dict: TranslationDict = {
'You will find Einhar and complete his mission.': 'Ты встретишь Эйнара и выполнишь его задание.',
'You will find Niko and complete his mission.': 'Ты встретишь Нико и выполнишь его задание.',
'You will find Jun and complete her mission.': 'Ты встретишь Джун и выполнишь её задание.',
'You will find Zana and complete her mission.': 'Ты встретишь Зану и выполнишь её задание.'
'You will find Zana and complete her mission.': 'Ты встретишь Зану и выполнишь её задание.',
'Blighted {0}': 'Заражённая {0}'
}
export default dict
+10 -6
View File
@@ -139,13 +139,17 @@ function parseMap (section: string[], item: ParsedItem) {
if (section[0].startsWith(_$[C.TAG_MAP_TIER])) {
item.props.mapTier = Number(section[0].substr(_$[C.TAG_MAP_TIER].length))
if (item.rarity === ItemRarity.Normal) {
if (_$[C.MAP_BLIGHTED].test(item.name)) {
const name = _$[C.MAP_BLIGHTED].exec(item.name)![1]
item.name = ITEM_NAME_REF_BY_TRANSLATED.get(name) || name
item.category = ItemCategory.Map
item.props.mapBlighted = true
let name = item.baseType || item.name
if (_$[C.MAP_BLIGHTED].test(name)) {
name = _$[C.MAP_BLIGHTED].exec(name)![1]
name = ITEM_NAME_REF_BY_TRANSLATED.get(name) || name
if (item.baseType) {
item.baseType = name
} else {
item.name = name
}
item.category = ItemCategory.Map
item.props.mapBlighted = true
}
return SECTION_PARSED
+12 -4
View File
@@ -1,12 +1,20 @@
import { BASE_TYPES, TRANSLATED_ITEM_NAME_BY_REF } from '@/assets/data'
import { BASE_TYPES, TRANSLATED_ITEM_NAME_BY_REF, CLIENT_STRINGS } from '@/assets/data'
import { ItemCategory } from './meta'
let baseTypes: Set<string>
export function magicBasetype (name: string) {
if (!baseTypes) {
baseTypes = new Set(
Array.from(BASE_TYPES.keys()).map(b => TRANSLATED_ITEM_NAME_BY_REF.get(b)!)
)
baseTypes = new Set<string>()
for (let [name, info] of BASE_TYPES.entries()) {
name = TRANSLATED_ITEM_NAME_BY_REF.get(name)!
baseTypes.add(name)
if (info.category === ItemCategory.Map) {
baseTypes.add(
CLIENT_STRINGS['Blighted {0}'].replace('{0}', name)
)
}
}
}
const words = name.split(' ')