mirror of
https://github.com/Kvan7/Exiled-Exchange-2.git
synced 2025-12-16 13:05:53 +00:00
make rarity optional (for Allflames)
This commit is contained in:
@@ -273,17 +273,33 @@ function pickCorrectVariant (item: ParserState) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function parseNamePlate (section: string[]) {
|
function parseNamePlate (section: string[]) {
|
||||||
if (section.length < 3 ||
|
let line = section.shift()
|
||||||
!section[0].startsWith(_$.ITEM_CLASS) ||
|
if (!line?.startsWith(_$.ITEM_CLASS)) {
|
||||||
!section[1].startsWith(_$.RARITY)) {
|
|
||||||
return err('item.parse_error')
|
return err('item.parse_error')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
line = section.shift()
|
||||||
|
let rarityText: string | undefined
|
||||||
|
if (line?.startsWith(_$.RARITY)) {
|
||||||
|
rarityText = line.slice(_$.RARITY.length)
|
||||||
|
line = section.shift()
|
||||||
|
}
|
||||||
|
|
||||||
|
let name: string
|
||||||
|
if (line != null) {
|
||||||
|
name = markupConditionParser(line)
|
||||||
|
} else {
|
||||||
|
return err('item.parse_error')
|
||||||
|
}
|
||||||
|
|
||||||
|
line = section.shift()
|
||||||
|
const baseType = line && markupConditionParser(line)
|
||||||
|
|
||||||
const item: ParserState = {
|
const item: ParserState = {
|
||||||
rarity: undefined,
|
rarity: undefined,
|
||||||
category: undefined,
|
category: undefined,
|
||||||
name: markupConditionParser(section[2]),
|
name: name,
|
||||||
baseType: (section.length >= 4) ? markupConditionParser(section[3]) : undefined,
|
baseType: baseType,
|
||||||
isUnidentified: false,
|
isUnidentified: false,
|
||||||
isCorrupted: false,
|
isCorrupted: false,
|
||||||
newMods: [],
|
newMods: [],
|
||||||
@@ -295,32 +311,22 @@ function parseNamePlate (section: string[]) {
|
|||||||
rawText: undefined!
|
rawText: undefined!
|
||||||
}
|
}
|
||||||
|
|
||||||
const rarityText = section[1].slice(_$.RARITY.length)
|
|
||||||
switch (rarityText) {
|
switch (rarityText) {
|
||||||
case _$.RARITY_CURRENCY:
|
case _$.RARITY_CURRENCY:
|
||||||
item.category = ItemCategory.Currency
|
item.category = ItemCategory.Currency; break
|
||||||
break
|
|
||||||
case _$.RARITY_DIVCARD:
|
case _$.RARITY_DIVCARD:
|
||||||
item.category = ItemCategory.DivinationCard
|
item.category = ItemCategory.DivinationCard; break
|
||||||
break
|
|
||||||
case _$.RARITY_GEM:
|
case _$.RARITY_GEM:
|
||||||
item.category = ItemCategory.Gem
|
item.category = ItemCategory.Gem; break
|
||||||
break
|
|
||||||
case _$.RARITY_NORMAL:
|
case _$.RARITY_NORMAL:
|
||||||
case _$.RARITY_QUEST:
|
case _$.RARITY_QUEST:
|
||||||
item.rarity = ItemRarity.Normal
|
item.rarity = ItemRarity.Normal; break
|
||||||
break
|
|
||||||
case _$.RARITY_MAGIC:
|
case _$.RARITY_MAGIC:
|
||||||
item.rarity = ItemRarity.Magic
|
item.rarity = ItemRarity.Magic; break
|
||||||
break
|
|
||||||
case _$.RARITY_RARE:
|
case _$.RARITY_RARE:
|
||||||
item.rarity = ItemRarity.Rare
|
item.rarity = ItemRarity.Rare; break
|
||||||
break
|
|
||||||
case _$.RARITY_UNIQUE:
|
case _$.RARITY_UNIQUE:
|
||||||
item.rarity = ItemRarity.Unique
|
item.rarity = ItemRarity.Unique; break
|
||||||
break
|
|
||||||
default:
|
|
||||||
return err('item.unknown')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ok(item)
|
return ok(item)
|
||||||
|
|||||||
Reference in New Issue
Block a user