Compare commits

...

6 Commits

4 changed files with 21 additions and 8 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "star-rail-warp-export", "name": "star-rail-warp-export",
"version": "0.0.4", "version": "0.0.7",
"main": "./dist/electron/main/main.js", "main": "./dist/electron/main/main.js",
"author": "biuuu <https://github.com/biuuu>", "author": "biuuu <https://github.com/biuuu>",
"license": "MIT", "license": "MIT",

View File

@ -115,9 +115,12 @@ const readLog = async () => {
} }
const promises = logPaths.map(async logpath => { const promises = logPaths.map(async logpath => {
const logText = await fs.readFile(logpath, 'utf8') const logText = await fs.readFile(logpath, 'utf8')
const gamePathMch = logText.match(/\w:\/.*?(Star\sRail\/Game\/StarRail_Data)/) const gamePathMch = logText.match(/\w:\/.*?\/StarRail_Data\//)
if (gamePathMch) { if (gamePathMch) {
const cacheText = await fs.readFile(path.join(gamePathMch[0], '/webCaches/Cache/Cache_Data/data_2'), 'utf8') let cacheText = ''
try {
cacheText = await fs.readFile(path.join(gamePathMch[0], '/webCaches/Cache/Cache_Data/data_2'), 'utf8')
} catch (e) {}
const urlMch = cacheText.match(/https.+?&auth_appid=webview_gacha&.+?authkey=.+?&game_biz=hkrpg_.+?&plat_type=pc/g) const urlMch = cacheText.match(/https.+?&auth_appid=webview_gacha&.+?authkey=.+?&game_biz=hkrpg_.+?&plat_type=pc/g)
if (urlMch) { if (urlMch) {
cacheFolder = path.join(gamePathMch[0], '/webCaches/Cache/') cacheFolder = path.join(gamePathMch[0], '/webCaches/Cache/')
@ -456,7 +459,7 @@ ipcMain.handle('READ_DATA', async () => {
}) })
ipcMain.handle('CHANGE_UID', (event, uid) => { ipcMain.handle('CHANGE_UID', (event, uid) => {
config.current = uid changeCurrent(uid)
}) })
ipcMain.handle('GET_CONFIG', () => { ipcMain.handle('GET_CONFIG', () => {

View File

@ -42,14 +42,24 @@ const parseData = (data) => {
return result return result
} }
const assignData = (objA, objB) => {
const temp = { ...objA }
for (let key in objB) {
if (objB[key]) {
temp[key] = objB[key]
}
}
return temp
}
const i18nMap = new Map() const i18nMap = new Map()
const prepareData = () => { const prepareData = () => {
for (let key in raw) { for (let key in raw) {
let temp = {} let temp = {}
if (key === 'zh-tw') { if (key === 'zh-tw') {
Object.assign(temp, raw['zh-cn'], raw[key]) temp = assignData(raw['zh-cn'], raw[key])
} else { } else {
Object.assign(temp, raw['zh-cn'], raw['en-us'], raw[key]) temp = assignData(raw['zh-cn'], assignData(raw['en-us'], raw[key]))
} }
i18nMap.set(key, parseData(temp)) i18nMap.set(key, parseData(temp))
} }

View File

@ -1,11 +1,11 @@
import * as IconComponents from '@element-plus/icons-vue' import * as IconComponents from '@element-plus/icons-vue'
const weaponTypeNames = new Set([ const weaponTypeNames = new Set([
'光锥', 'Light Cone', '光錐', 'Lichtkegel', 'Conos de luz', 'cônes de lumière', '光円錐', '광추', 'Cones de Luz', 'Световые конусы', 'Nón Ánh Sáng' '光锥', '光錐', 'Lichtkegel', 'Light Cone', 'Conos de luz', 'cônes de lumière', '光円錐', '광추', 'Cones de Luz', 'Световые конусы', 'Nón Ánh Sáng'
]) ])
const characterTypeNames = new Set([ const characterTypeNames = new Set([
'角色', 'Character', '캐릭터', 'キャラクター', 'Personaje', 'Personnage', 'Персонажи', 'ตัวละคร', 'Nhân Vật', 'Figur', 'Karakter', 'Personagem' '角色', 'Figur', 'Character', 'Personajes', 'Personnages', 'Karakter', 'キャラクター', '캐릭터', 'Personagens', 'Персонажи', 'ตัวละคร', 'Nhân Vật'
]) ])
const isCharacter = (name) => characterTypeNames.has(name) const isCharacter = (name) => characterTypeNames.has(name)