mirror of
https://github.com/Kvan7/Exiled-Exchange-2.git
synced 2026-09-27 07:05:46 +00:00
item text format change (initial support)
This commit is contained in:
@@ -8,6 +8,7 @@ const dict = {
|
||||
'Divination Card': 'Divination Card',
|
||||
'Map Tier: ': 'Map Tier: ',
|
||||
'Rarity: ': 'Rarity: ',
|
||||
'Item Class: ': 'Item Class: ',
|
||||
'Item Level: ': 'Item Level: ',
|
||||
'Talisman Tier: ': 'Talisman Tier: ',
|
||||
'Level: ': 'Level: ',
|
||||
|
||||
@@ -10,6 +10,7 @@ const dict: TranslationDict = {
|
||||
'Divination Card': 'Гадальная карта',
|
||||
'Map Tier: ': 'Уровень карты: ',
|
||||
'Rarity: ': 'Редкость: ',
|
||||
'Item Class: ': 'Класс предмета: ',
|
||||
'Item Level: ': 'Уровень предмета: ',
|
||||
'Talisman Tier: ': 'Уровень талисмана: ',
|
||||
'Level: ': 'Уровень: ',
|
||||
|
||||
@@ -17,7 +17,7 @@ export async function pollClipboard (): Promise<string> {
|
||||
}
|
||||
|
||||
let textBefore = clipboard.readText()
|
||||
if (textBefore.startsWith(getTranslatedRarity())) {
|
||||
if (textBefore.startsWith(getTranslatedFirstLine())) {
|
||||
textBefore = ''
|
||||
clipboard.writeText('')
|
||||
}
|
||||
@@ -26,7 +26,7 @@ export async function pollClipboard (): Promise<string> {
|
||||
function poll () {
|
||||
const textAfter = clipboard.readText()
|
||||
|
||||
if (textAfter.startsWith(getTranslatedRarity())) {
|
||||
if (textAfter.startsWith(getTranslatedFirstLine())) {
|
||||
clipboard.writeText(textBefore)
|
||||
isPollingClipboard = false
|
||||
clipboardPromise = undefined
|
||||
@@ -50,11 +50,11 @@ export async function pollClipboard (): Promise<string> {
|
||||
return clipboardPromise
|
||||
}
|
||||
|
||||
function getTranslatedRarity () {
|
||||
return TAG_RARITY[config.get('language')]
|
||||
function getTranslatedFirstLine () {
|
||||
return TAG_ITEM_CLASS[config.get('language')]
|
||||
}
|
||||
|
||||
const TAG_RARITY = {
|
||||
en: 'Rarity: ',
|
||||
ru: 'Редкость: '
|
||||
const TAG_ITEM_CLASS = {
|
||||
en: 'Item Class: ',
|
||||
ru: 'Класс предмета: '
|
||||
}
|
||||
|
||||
+10
-7
@@ -66,9 +66,10 @@ export function parseClipboard (clipboard: string) {
|
||||
}, sections[0])
|
||||
sections = sections.filter(section => section.length)
|
||||
|
||||
if (sections[0][1] === _$[C.CANNOT_USE_ITEM]) {
|
||||
sections[1].unshift(sections[0][0]) // `Rarity: xxx`
|
||||
sections.shift()
|
||||
if (sections[0][2] === _$[C.CANNOT_USE_ITEM]) {
|
||||
sections[0].pop() // remove CANNOT_USE_ITEM line
|
||||
sections[1].unshift(...sections[0]) // prepend item class & rarity into second section
|
||||
sections.shift() // remove first section where CANNOT_USE_ITEM line was
|
||||
}
|
||||
const parsed = parseNamePlate(sections[0])
|
||||
if (!parsed) {
|
||||
@@ -153,11 +154,13 @@ function parseMap (section: string[], item: ParsedItem) {
|
||||
}
|
||||
|
||||
function parseNamePlate (section: string[]) {
|
||||
if (!section[0].startsWith(_$[C.TAG_RARITY])) {
|
||||
if (section.length < 3 ||
|
||||
!section[0].startsWith(_$[C.TAG_ITEM_CLASS]) ||
|
||||
!section[1].startsWith(_$[C.TAG_RARITY])) {
|
||||
return null
|
||||
}
|
||||
|
||||
const rarityText = section[0].substr(_$[C.TAG_RARITY].length)
|
||||
const rarityText = section[1].substr(_$[C.TAG_RARITY].length)
|
||||
let rarity: ItemRarity
|
||||
switch (rarityText) {
|
||||
case _$[ItemRarity.Currency]:
|
||||
@@ -187,8 +190,8 @@ function parseNamePlate (section: string[]) {
|
||||
|
||||
const item: ParsedItem = {
|
||||
rarity,
|
||||
name: markupConditionParser(section[1]),
|
||||
baseType: (section.length >= 3) ? markupConditionParser(section[2]) : undefined,
|
||||
name: markupConditionParser(section[2]),
|
||||
baseType: (section.length >= 4) ? markupConditionParser(section[3]) : undefined,
|
||||
props: {},
|
||||
isUnidentified: false,
|
||||
isCorrupted: false,
|
||||
|
||||
@@ -26,6 +26,7 @@ export const WARLORD_ITEM = 'Warlord Item'
|
||||
|
||||
export const TAG_MAP_TIER = 'Map Tier: '
|
||||
export const TAG_RARITY = 'Rarity: '
|
||||
export const TAG_ITEM_CLASS = 'Item Class: '
|
||||
export const TAG_ITEM_LEVEL = 'Item Level: '
|
||||
export const TAG_TALISMAN_TIER = 'Talisman Tier: '
|
||||
export const TAG_GEM_LEVEL = 'Level: '
|
||||
|
||||
Reference in New Issue
Block a user