mirror of
https://github.com/earthjasonlin/zzz-signal-search-export.git
synced 2024-11-22 21:30:22 +08:00
feat: Support export as Star Rail Gacha Log Format file (#39)
This commit is contained in:
parent
f2592040cb
commit
4ab2f60b53
@ -3,6 +3,7 @@
|
||||
"ui.button.load": "Lade Daten",
|
||||
"ui.button.update": "Aktualisieren",
|
||||
"ui.button.excel": "In Excel exportieren",
|
||||
"ui.button.srgf": "In SRGF exportieren",
|
||||
"ui.button.url": "Eingabe URL",
|
||||
"ui.button.setting": "Einstellungen",
|
||||
"ui.button.option": "Optionen",
|
||||
@ -75,5 +76,6 @@
|
||||
"excel.wish2": "Wunsch 2",
|
||||
"excel.customFont": "Arial",
|
||||
"excel.filePrefix": "",
|
||||
"excel.fileType": "Excel Datei"
|
||||
"excel.fileType": "Excel Datei",
|
||||
"srgf.fileType": "Star Rail Gacha Log Format Datei"
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
"ui.button.update": "Update",
|
||||
"ui.button.directUpdate": "Direct update",
|
||||
"ui.button.excel": "Export Excel",
|
||||
"ui.button.srgf": "Export SRGF",
|
||||
"ui.button.url": "Input URL",
|
||||
"ui.button.setting": "Settings",
|
||||
"ui.button.option": "Option",
|
||||
@ -94,6 +95,7 @@
|
||||
"excel.customFont": "Arial",
|
||||
"excel.filePrefix": "Star Rail Warp logger",
|
||||
"excel.fileType": "Excel file",
|
||||
"srgf.fileType": "Star Rail Gacha Log Format file",
|
||||
"ui.extra.cacheClean": "1. Confirm whether the warp history in the game has been opened, and if the error \"User authentication expired\" still appears, try the following steps \n2. Close the game window of Star Rail \n3. Click the \"Open Web Cache Folder\" button above to open the \"Cache\" folder \n4. Delete the \"Cache_ Data\" folder \n5. Start the Star Rail game and open the warp history page in the game \n6. Close this dialog and click the \"Update Data\" button",
|
||||
"ui.extra.findCacheFolder": "If the \"Open cache folder\" button does not respond, you can manually find the game's web cache folder. The directory is \"Your game installation path/Star Rail/Games/StarRail_Data/webCaches/Cache/\"",
|
||||
"ui.extra.urlCopied": "URL Copied"
|
||||
|
@ -4,6 +4,7 @@
|
||||
"ui.button.update": "Mettre à jour",
|
||||
"ui.button.directUpdate": "Mise à jour directe",
|
||||
"ui.button.excel": "Exporter vers Excel",
|
||||
"ui.button.srgf": "Exporter vers SRGF",
|
||||
"ui.button.url": "URL d'import",
|
||||
"ui.button.setting": "Paramètres",
|
||||
"ui.button.option": "Options",
|
||||
|
@ -3,6 +3,7 @@
|
||||
"ui.button.load": "データの読み込み",
|
||||
"ui.button.update": "更新データ",
|
||||
"ui.button.excel": "Excelにエクスポート",
|
||||
"ui.button.srgf": "SRGFにエクスポート",
|
||||
"ui.button.url": "URL入力",
|
||||
"ui.button.setting": "設定",
|
||||
"ui.button.option": "オプション",
|
||||
|
@ -4,6 +4,7 @@
|
||||
"ui.button.update": "更新数据",
|
||||
"ui.button.directUpdate": "直接更新",
|
||||
"ui.button.excel": "导出Excel",
|
||||
"ui.button.srgf":"导出SRGF",
|
||||
"ui.button.url": "输入URL",
|
||||
"ui.button.setting": "设置",
|
||||
"ui.button.option": "选项",
|
||||
@ -94,6 +95,7 @@
|
||||
"excel.customFont": "微软雅黑",
|
||||
"excel.filePrefix": "星穹铁道跃迁记录",
|
||||
"excel.fileType": "Excel文件",
|
||||
"srgf.fileType":"星穹铁道跃迁记录格式文件",
|
||||
"ui.extra.cacheClean": "1. 确认是否已经打开游戏内的抽卡历史记录,如果仍然出现“身份认证已过期”的错误,再尝试下面的步骤\n2. 关闭星穹铁道的游戏窗口\n3. 点击上方的“打开缓存文件夹”按钮,打开Cache文件夹\n4. 删除Cache_Data文件夹\n5. 启动星穹铁道游戏,打开游戏内抽卡历史记录页面\n6. 关闭这个对话框,再点击“更新数据”按钮",
|
||||
"ui.extra.findCacheFolder": "如果点“打开缓存文件夹”按钮没有反应,可以手动找到游戏的网页缓存文件夹,目录为“你的游戏安装路径/Star Rail/Game/StarRail_Data/webCaches/Cache/”",
|
||||
"ui.extra.urlCopied": "URL已复制"
|
||||
|
@ -4,6 +4,7 @@
|
||||
"ui.button.update": "更新資料",
|
||||
"ui.button.directUpdate": "直接更新",
|
||||
"ui.button.excel": "匯出 Excel",
|
||||
"ui.button.srgf": "匯出 SRGF",
|
||||
"ui.button.url": "輸入 URL",
|
||||
"ui.button.setting": "設定",
|
||||
"ui.button.option": "選項",
|
||||
@ -83,6 +84,7 @@
|
||||
"excel.customFont": "微軟正黑體",
|
||||
"excel.filePrefix": "星穹鐵道躍遷紀錄",
|
||||
"excel.fileType": "Excel 檔案",
|
||||
"srgf.fileType":"星穹鐵道躍遷紀錄格式檔案",
|
||||
"ui.extra.cacheClean": "1. 確認是否已經開啟遊戲內的躍遷歷史紀錄,如果仍然出現「身分驗證已過期」的錯誤,再嘗試下面的步驟\n2. 關閉「崩壞:星穹鐵道」的遊戲視窗\n3. 按一下上方的「開啟快取資料夾」按鈕,開啟「Cache」資料夾\n4. 刪除「Cache_Data」資料夾\n5. 啟動「崩壞:星穹鐵道」遊戲,開啟遊戲內躍遷歷史紀錄頁面\n6. 關閉這個對話方塊,再按下「更新資料」按鈕",
|
||||
"ui.extra.findCacheFolder": "如果按下「開啟快取資料夾」按鈕沒有回應,可以手動找到遊戲的網頁快取資料夾,目錄為「您的遊戲安裝路徑/Star Rail/Games/StarRail_Data/webCaches/Cache/」"
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ const fs = require('fs-extra')
|
||||
const path = require('path')
|
||||
const getData = require('./getData').getData
|
||||
const { version } = require('../../package.json')
|
||||
const i18n = require('./i18n')
|
||||
|
||||
const getTimeString = () => {
|
||||
return new Date().toLocaleString('sv').replace(/[- :]/g, '').slice(0, -2)
|
||||
@ -15,67 +16,51 @@ const formatDate = (date) => {
|
||||
return `${y}-${m}-${d} ${date.toLocaleString('zh-cn', { hour12: false }).slice(-8)}`
|
||||
}
|
||||
|
||||
const fakeIdFn = () => {
|
||||
let id = 1000000000000000000n
|
||||
return () => {
|
||||
id = id + 1n
|
||||
return id.toString()
|
||||
}
|
||||
}
|
||||
|
||||
const shouldBeString = (value) => {
|
||||
if (typeof value !== 'string') {
|
||||
return ''
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
const start = async () => {
|
||||
const { dataMap, current } = await getData()
|
||||
const data = dataMap.get(current)
|
||||
if (!data.result.size) {
|
||||
throw new Error('数据为空')
|
||||
}
|
||||
const fakeId = fakeIdFn()
|
||||
const result = {
|
||||
info: {
|
||||
uid: data.uid,
|
||||
lang: data.lang,
|
||||
export_time: formatDate(new Date()),
|
||||
export_timestamp: Date.now(),
|
||||
export_app: 'genshin-wish-export',
|
||||
export_timestamp: Math.ceil(Date.now()/1000),
|
||||
export_app: 'star-rail-warp-export',
|
||||
export_app_version: `v${version}`,
|
||||
uigf_version: 'v2.2'
|
||||
region_time_zone: data.region_time_zone,
|
||||
srgf_version: 'v1.0'
|
||||
},
|
||||
list: []
|
||||
}
|
||||
const listTemp = []
|
||||
for (let [type, arr] of data.result) {
|
||||
arr.forEach(item => {
|
||||
arr.forEach(log => {
|
||||
listTemp.push({
|
||||
gacha_type: shouldBeString(item[4]) || type,
|
||||
time: item[0],
|
||||
timestamp: new Date(item[0]).getTime(),
|
||||
name: item[1],
|
||||
item_type: item[2],
|
||||
rank_type: `${item[3]}`,
|
||||
id: shouldBeString(item[5]) || '',
|
||||
uigf_gacha_type: type
|
||||
gacha_id:log.gacha_id,
|
||||
gacha_type: log.gacha_type,
|
||||
item_id:log.item_id,
|
||||
count:"1",
|
||||
time:log.time,
|
||||
name:log.name,
|
||||
item_type:log.item_type,
|
||||
rank_type:log.rank_type,
|
||||
id:log.id
|
||||
})
|
||||
})
|
||||
}
|
||||
listTemp.sort((a, b) => a.timestamp - b.timestamp)
|
||||
listTemp.sort((a, b) => BigInt(a.id) - BigInt(b.id))
|
||||
listTemp.forEach(item => {
|
||||
delete item.timestamp
|
||||
result.list.push({
|
||||
...item,
|
||||
id: item.id || fakeId()
|
||||
...item
|
||||
})
|
||||
})
|
||||
const filePath = dialog.showSaveDialogSync({
|
||||
defaultPath: path.join(app.getPath('downloads'), `UIGF_${data.uid}_${getTimeString()}`),
|
||||
defaultPath: path.join(app.getPath('downloads'), `SRGF_${data.uid}_${getTimeString()}`),
|
||||
filters: [
|
||||
{ name: 'JSON文件', extensions: ['json'] }
|
||||
{ name: i18n.srgf.fileType, extensions: ['json'] }
|
||||
]
|
||||
})
|
||||
if (filePath) {
|
||||
@ -84,6 +69,6 @@ const start = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
ipcMain.handle('EXPORT_UIGF_JSON', async () => {
|
||||
ipcMain.handle('EXPORT_SRGF_JSON', async () => {
|
||||
await start()
|
||||
})
|
@ -76,7 +76,7 @@ const parseText = (text, data) => {
|
||||
}
|
||||
|
||||
const mainProps = [
|
||||
'symbol', 'ui', 'log', 'excel'
|
||||
'symbol', 'ui', 'log', 'excel',"srgf"
|
||||
]
|
||||
|
||||
const i18n = new Proxy(raw, {
|
||||
|
@ -4,7 +4,7 @@ const { disableProxy, proxyStatus } = require('./module/system-proxy')
|
||||
require('./getData')
|
||||
require('./bridge')
|
||||
require('./excel')
|
||||
require('./UIGFJson')
|
||||
require('./SRGFJson')
|
||||
const { getUpdateInfo } = require('./update/index')
|
||||
|
||||
const isDev = !app.isPackaged
|
||||
|
@ -4,6 +4,7 @@
|
||||
<div>
|
||||
<el-button type="primary" :icon="state.status === 'init' ? 'milk-tea': 'refresh-right'" class="focus:outline-none" :disabled="!allowClick()" plain @click="fetchData()" :loading="state.status === 'loading'">{{state.status === 'init' ? ui.button.load: ui.button.update}}</el-button>
|
||||
<el-button icon="folder-opened" @click="saveExcel" class="focus:outline-none" :disabled="!gachaData" type="success" plain>{{ui.button.excel}}</el-button>
|
||||
<el-button icon="folder-opened" @click="exportSRGFJSON" class="focus:outline-none" :disabled="!gachaData" type="success" plain>{{ui.button.srgf}}</el-button>
|
||||
<el-tooltip v-if="detail && state.status !== 'loading'" :content="ui.hint.newAccount" placement="bottom">
|
||||
<el-button @click="newUser()" plain icon="plus" class="focus:outline-none"></el-button>
|
||||
</el-tooltip>
|
||||
@ -227,6 +228,10 @@ const saveExcel = async () => {
|
||||
await ipcRenderer.invoke('SAVE_EXCEL')
|
||||
}
|
||||
|
||||
const exportSRGFJSON = () => {
|
||||
ipcRenderer.invoke('EXPORT_SRGF_JSON')
|
||||
}
|
||||
|
||||
const openCacheFolder = async () => {
|
||||
await ipcRenderer.invoke('OPEN_CACHE_FOLDER')
|
||||
}
|
||||
|
@ -139,10 +139,6 @@ const disableProxy = async () => {
|
||||
const openGithub = () => shell.openExternal('https://github.com/biuuu/star-rail-warp-export')
|
||||
const openLink = (link) => shell.openExternal(link)
|
||||
|
||||
const exportUIGFJSON = () => {
|
||||
ipcRenderer.invoke('EXPORT_UIGF_JSON')
|
||||
}
|
||||
|
||||
const deleteData = async (uid, action) => {
|
||||
state.dataActionLoading = true
|
||||
await ipcRenderer.invoke('DELETE_DATA', uid, action)
|
||||
|
Loading…
x
Reference in New Issue
Block a user