diff --git a/package.json b/package.json index bb1d26e..12f8e8a 100644 --- a/package.json +++ b/package.json @@ -2,16 +2,17 @@ "name": "mishiro", "productName": "mishiro", "companyName": "Toyo", - "version": "1.0.2", + "version": "1.1.0", "description": "A desktop application that can be used for getting the resource of CGSS (IDOL MASTER CINDERELLA GIRLS STARLIGHT STAGE).", "main": "main.min.js", "scripts": { "start": "electron . --enable-logging", + "webpack": "webpack", "dll": "webpack --config webpack.dll.config.js", - "dev": "webpack -w", - "pro": "set NODE_ENV=production&&webpack", - "proWin32": "set NODE_ENV=production&&webpack&&electron-packager . mishiro --platform=win32 --arch=ia32 --icon=./src/res/icon/mishiro.ico --out=./dist --overwrite --app-version=1.0.2 --win32metadata.FileDescription=\"CGSS Desktop Application\" --ignore=\"(node_modules|data|download|dist|src|docs|public/img/card|public/asset/sound/live|.gitignore|README.md|webpack|.eslintrc.json|config.json|manifest.json)\"", - "proWin64": "set NODE_ENV=production&&webpack&&electron-packager . mishiro --platform=win32 --arch=x64 --icon=./src/res/icon/mishiro.ico --out=./dist --overwrite --app-version=1.0.2 --win32metadata.FileDescription=\"CGSS Desktop Application\" --ignore=\"(node_modules|data|download|dist|src|docs|public/img/card|public/asset/sound/live|.gitignore|README.md|webpack|.eslintrc.json|config.json|manifest.json)\"" + "dev": "webpack --config webpack.dll.config.js&&webpack -w", + "prod": "set NODE_ENV=production&&webpack --config webpack.dll.config.js&&webpack", + "pkg32": "npm run prod&&electron-packager . mishiro --platform=win32 --arch=ia32 --icon=./src/res/icon/mishiro.ico --out=./dist --overwrite --app-version=1.1.0 --win32metadata.FileDescription=\"CGSS Desktop Application\" --ignore=\"(node_modules|data|download|dist|src|docs|public/img/card|public/asset/sound/live|.gitignore|README.md|webpack|.eslintrc.json|config.json|manifest.json)\"", + "pkg64": "npm run prod&&electron-packager . mishiro --platform=win32 --arch=x64 --icon=./src/res/icon/mishiro.ico --out=./dist --overwrite --app-version=1.1.0 --win32metadata.FileDescription=\"CGSS Desktop Application\" --ignore=\"(node_modules|data|download|dist|src|docs|public/img/card|public/asset/sound/live|.gitignore|README.md|webpack|.eslintrc.json|config.json|manifest.json)\"" }, "repository": { "type": "git", diff --git a/src/i18n/ja-JP.js b/src/i18n/ja-JP.js index b35965a..9fe2dd2 100644 --- a/src/i18n/ja-JP.js +++ b/src/i18n/ja-JP.js @@ -64,7 +64,10 @@ export default { skill_explain: "特技詳細", leader_skill_name: "センター効果", leader_skill_explain: "センター効果詳細", - nashi: "無し" + nashi: "無し", + limited: "限定", + event: "イベント", + gacha: "ガシャ" }, live: { decoding: " デコード中...", diff --git a/src/i18n/zh-CN.js b/src/i18n/zh-CN.js index 3694fc6..d371417 100644 --- a/src/i18n/zh-CN.js +++ b/src/i18n/zh-CN.js @@ -64,7 +64,10 @@ export default { skill_explain: "特技詳細", leader_skill_name: "領隊効果", leader_skill_explain: "領隊効果詳細", - nashi: "无" + nashi: "无", + limited: "限定", + event: "活動", + gacha: "転蛋" }, live: { decoding: " 解碼中...", diff --git a/src/js/check.js b/src/js/check.js index 55748d2..5849382 100644 --- a/src/js/check.js +++ b/src/js/check.js @@ -42,9 +42,9 @@ function check(progressing){ if(config.resVer){ return config.resVer; } - if(!config.latestResVer){ + /* if(!config.latestResVer){ configurer.configure("latestResVer", 10033600); - } + } */ let versionFrom = configurer.getConfig().latestResVer; diff --git a/src/js/gacha.js b/src/js/gacha.js index dc5ec80..9357ffa 100644 --- a/src/js/gacha.js +++ b/src/js/gacha.js @@ -163,6 +163,7 @@ export default { r: this.r, sr: this.sr, ssr: this.ssr, + total: this.r + this.sr + this.ssr, costStarJewel: this.costStarJewel }); }, diff --git a/src/js/home.js b/src/js/home.js index b7c64bc..9053c78 100644 --- a/src/js/home.js +++ b/src/js/home.js @@ -128,5 +128,14 @@ export default { this.event.$emit("alert", this.$t("home.errorTitle"), this.$t("home.noEmptyDownload")); } } + }, + mounted(){ + this.$nextTick(() => { + this.event.$on("enterKey", (block) => { + if(block === "home"){ + this.query(); + } + }); + }); } }; \ No newline at end of file diff --git a/src/js/icpMain.js b/src/js/icpMain.js index 2d5ddbe..223a0bd 100644 --- a/src/js/icpMain.js +++ b/src/js/icpMain.js @@ -1,13 +1,14 @@ import { ipcMain } from "electron"; -import SQL from "./sqlExec.js"; import { exec } from "child_process"; +import fs from "fs"; +import SQL from "./sqlExec.js"; import { getPath } from "./getPath.js"; import { configurer } from "./config.js"; let config = configurer.getConfig(); let fix = {}; -if(!config.latestVersion){ - fix.latestResVer = 10033600; +if(!config.latestResVer){ + fix.latestResVer = 10033710; } if(config.language !== "zh" && config.language !== "ja"){ fix.language = "zh"; @@ -34,6 +35,7 @@ ipcMain.on("readManifest", (event, manifestFile) => { ipcMain.on("readMaster", (event, masterFile) => { const master = new SQL.Database(masterFile); + const gachaAll = master._exec("SELECT * FROM gacha_data"); const eventAll = master._exec("SELECT * FROM event_data"); const eventNow = master._exec("SELECT * FROM event_data WHERE event_start = (SELECT MAX(event_start) FROM (SELECT * FROM event_data WHERE event_start < DATETIME(CURRENT_TIMESTAMP, 'localtime')))")[0]; const eventData = config.event ? master._exec(`SELECT * FROM event_data WHERE id="${config.event}"`)[0] : eventNow; @@ -52,9 +54,30 @@ ipcMain.on("readMaster", (event, masterFile) => { let liveManifest = manifest._exec("SELECT name, hash FROM manifests WHERE name LIKE \"l/%\""); let bgmManifest = manifest._exec("SELECT name, hash FROM manifests WHERE name LIKE \"b/%\""); + + let gachaLimited = master._exec("SELECT gacha_id, reward_id FROM gacha_available WHERE limited_flag = 1 ORDER BY reward_id"); + let eventLimited = master._exec("SELECT event_id, reward_id FROM event_available ORDER BY reward_id"); manifest.close(); master.close(); + let gachaLimitedCard = {}; + gachaLimited.forEach((card) => { + if(!gachaLimitedCard[card["reward_id"]]){ + gachaLimitedCard[card["reward_id"]] = []; + } + let gacha = gachaAll.filter(gacha => gacha.id == card["gacha_id"])[0]; + gachaLimitedCard[card["reward_id"]].push({ name: gacha.name, id: gacha.id, startDate: gacha.start_date.split(" ")[0], endDate: gacha.end_date.split(" ")[0] }); + }); + + let eventLimitedCard = {}; + eventLimited.forEach((card) => { + if(!eventLimitedCard[card["reward_id"]]){ + eventLimitedCard[card["reward_id"]] = []; + } + let event = eventAll.filter(event => event.id == card["event_id"])[0]; + eventLimitedCard[card["reward_id"]].push({ name: event.name, id: event.id, startDate: event.event_start.split(" ")[0], endDate: event.event_end.split(" ")[0] }); + }); + charaData.forEach((chara, i) => { let hometown = textData[0].filter(row => row.index == chara.home_town)[0], seiza = textData[1].filter(row => (1000 + Number(row.index)) == chara.constellation)[0]; @@ -65,10 +88,19 @@ ipcMain.on("readMaster", (event, masterFile) => { charaData[i].seiza = seiza.text; } }); + + let gachaLimitedCardId = Object.keys(gachaLimitedCard).map(id => Number(id)); + let eventLimitedCardId = Object.keys(eventLimitedCard).map(id => Number(id)); cardData.forEach((card, i) => { cardData[i].charaData = charaData.filter(row => row.chara_id == card.chara_id)[0]; cardData[i].skill = skillData.filter(row => row.id == card.skill_id)[0]; cardData[i].leaderSkill = leaderSkillData.filter(row => row.id == card.leader_skill_id)[0]; + if(eventLimitedCardId.indexOf(cardData[i].id) !== -1){ + cardData[i].limited = eventLimitedCard[cardData[i].id]; + } + if(gachaLimitedCardId.indexOf(cardData[i].id) !== -1){ + cardData[i].limited = gachaLimitedCard[cardData[i].id]; + } }); bgmManifest.forEach((bgm, i) => { let fileName = bgm.name.split("/")[1].split(".")[0] + ".mp3"; @@ -98,20 +130,23 @@ ipcMain.on("readMaster", (event, masterFile) => { }); let R = 0, SR = 0, SSR = 0, fes = false; - gachaAvailable.forEach(function (v, i){ + let SSR_UP = 0, SR_UP = 0; + gachaAvailable.forEach(function(v, i){ gachaAvailable[i].rarity = getRarity(v.reward_id, cardData); - switch(gachaAvailable[i].rarity){ - case 3: - R++; - break; - case 5: - SR++; - break; - case 7: - SSR++; - break; - default: - break; + if(gachaAvailable[i].rarity == 3){ + R++; + } + else if(gachaAvailable[i].rarity == 5){ + SR++; + if(gachaAvailable[i].up_value == 1){ + SR_UP++; + } + } + else if(gachaAvailable[i].rarity == 7){ + SSR++; + if(gachaAvailable[i].up_value == 1){ + SSR_UP++; + } } }); @@ -121,24 +156,67 @@ ipcMain.on("readMaster", (event, masterFile) => { if(gachaAvailable[0]["relative_odds"] === 0){ let R_ODDS = 850000, SR_ODDS = 120000, SSR_ODDS = 30000; let R_ODDS_SR = 0, SR_ODDS_SR = 970000, SSR_ODDS_SR = 30000; + let SR_UP_ODDS = 0, SSR_UP_ODDS = 0, SR_UP_ODDS_SR = 0; + + if(SSR_UP > 0 && SR_UP > 0){ + if(SSR_UP === 1){ + SSR_UP_ODDS = 7500; + } + else if(SSR_UP === 2){ + SSR_UP_ODDS = 8000; + } + SR_UP_ODDS = 24000; + SR_UP_ODDS_SR = 200000; + } if(fes){ - R_ODDS = 820000, SR_ODDS = 120000, SSR_ODDS = 60000; - R_ODDS_SR = 0, SR_ODDS_SR = 940000, SSR_ODDS_SR = 60000; + R_ODDS = 820000; SR_ODDS = 120000; SSR_ODDS = 60000; + R_ODDS_SR = 0; SR_ODDS_SR = 940000; SSR_ODDS_SR = 60000; + SSR_UP_ODDS = 15000; } - gachaAvailable.forEach(function (v, i){ + gachaAvailable.forEach(function(v, i){ if(v.rarity == 3){ gachaAvailable[i]["relative_odds"] = Math.round(R_ODDS / R); gachaAvailable[i]["relative_sr_odds"] = Math.round(R_ODDS_SR / R); } else if(v.rarity == 5){ - gachaAvailable[i]["relative_odds"] = Math.round(SR_ODDS / SR); - gachaAvailable[i]["relative_sr_odds"] = Math.round(SR_ODDS_SR / SR); + if(v.up_value == 1){ + gachaAvailable[i]["relative_odds"] = Math.round(SR_UP_ODDS / SR_UP); + gachaAvailable[i]["relative_sr_odds"] = Math.round(SR_UP_ODDS_SR / SR_UP); + } + else{ + gachaAvailable[i]["relative_odds"] = Math.round((SR_ODDS - SR_UP_ODDS) / (SR - SR_UP)); + gachaAvailable[i]["relative_sr_odds"] = Math.round((SR_ODDS_SR - SR_UP_ODDS_SR) / (SR - SR_UP)); + } } else if(v.rarity == 7){ - gachaAvailable[i]["relative_odds"] = Math.round(SSR_ODDS / SSR); - gachaAvailable[i]["relative_sr_odds"] = Math.round(SSR_ODDS_SR / SSR); + if(fes){ + if(v.up_value == 1){ + if(v.recommend_order == 1){ + gachaAvailable[i]["relative_odds"] = SSR_UP_ODDS / 2; + gachaAvailable[i]["relative_sr_odds"] = SSR_UP_ODDS / 2; + } + else{ + gachaAvailable[i]["relative_odds"] = Math.round((SSR_UP_ODDS / 2) / (SSR_UP - 1)); + gachaAvailable[i]["relative_sr_odds"] = Math.round((SSR_UP_ODDS / 2) / (SSR_UP - 1)); + } + } + else{ + gachaAvailable[i]["relative_odds"] = Math.round((SSR_ODDS - SSR_UP_ODDS) / (SSR - SSR_UP)); + gachaAvailable[i]["relative_sr_odds"] = Math.round((SSR_ODDS_SR - SSR_UP_ODDS) / (SSR - SSR_UP)); + } + } + else{ + if(v.up_value == 1){ + gachaAvailable[i]["relative_odds"] = Math.round(SSR_UP_ODDS / SSR_UP); + gachaAvailable[i]["relative_sr_odds"] = Math.round(SSR_UP_ODDS / SSR_UP); + } + else{ + gachaAvailable[i]["relative_odds"] = Math.round((SSR_ODDS - SSR_UP_ODDS) / (SSR - SSR_UP)); + gachaAvailable[i]["relative_sr_odds"] = Math.round((SSR_ODDS_SR - SSR_UP_ODDS) / (SSR - SSR_UP)); + } + } } }); } @@ -153,18 +231,15 @@ ipcMain.on("acb", (event, acbPath, url = "") => { if(!err){ if(url){ if(url.split("/")[url.split("/").length - 2] === "live"){ - exec(`ren "${getPath()}\\public\\asset\\sound\\live\\${name}.mp3" "${url.split("/")[url.split("/").length - 1]}"`, (err) => { - if(!err){ - event.sender.send("acb", acbPath, url); - } - }); + fs.renameSync(getPath(`./public/asset/sound/live/${name}.mp3`), getPath(`./public/asset/sound/live/${url.split("/")[url.split("/").length - 1]}`)); + event.sender.send("acb", acbPath, url); } else{ event.sender.send("acb", acbPath, url); } } else{ - exec(`del /q /f ${acbPath}`); + fs.unlinkSync(acbPath); } } }); diff --git a/src/js/idol.js b/src/js/idol.js index 6b58fa4..3971a82 100644 --- a/src/js/idol.js +++ b/src/js/idol.js @@ -269,6 +269,11 @@ export default { } } }); + this.event.$on("enterKey", (block) => { + if(block === "idol"){ + this.query(); + } + }); }); } }; \ No newline at end of file diff --git a/src/js/live.js b/src/js/live.js index 6dc78b2..b6d2f41 100644 --- a/src/js/live.js +++ b/src/js/live.js @@ -1,8 +1,7 @@ +import { ipcRenderer, shell } from "electron"; +import fs from "fs"; import task from "../template/task.vue"; import Downloader from "./downloader.js"; -import fs from "fs"; -import { exec } from "child_process"; -import { ipcRenderer, shell } from "electron"; import getPath from "./getPath.js"; const dler = new Downloader(); @@ -165,11 +164,16 @@ export default { this.activeAudio = this.liveManifest.filter(bgm => bgm.fileName === fileName)[0]; } }); + this.event.$on("enterKey", (block) => { + if(block === "live"){ + this.query(); + } + }); ipcRenderer.on("acb", (event, acbPath, url) => { this.total = 0; this.current = 0; this.text = ""; - exec(`del /q /f ${acbPath}`); + fs.unlinkSync(acbPath); this.event.$emit("liveSelect", { src: url }); }); }); diff --git a/src/js/menu.js b/src/js/menu.js index 607524a..99040b7 100644 --- a/src/js/menu.js +++ b/src/js/menu.js @@ -66,7 +66,7 @@ OTHER DEALINGS IN THE SOFTWARE.
`, 800); const exePath = $(".release.label-latest .release-body a[href$=\".exe\"]").attr("href"); const exeUrl = exePath ? gitRoot + exePath : null; - const description = $(".release.label-latest .release-body .markdown-body").html(); + const description = $(".release.label-latest .release-body .markdown-body").html().replace(/\n/g, "").trim(); const versionData = { version, commit, description, commitUrl, zipUrl, exeUrl }; console.log(versionData); if(remote.app.getVersion() < version){ diff --git a/src/template/about.vue b/src/template/about.vue index 5945a57..c5a222a 100644 --- a/src/template/about.vue +++ b/src/template/about.vue @@ -72,6 +72,9 @@ export default { this.show = true; this.visible = true; }); + this.event.$on("escKey", () => { + this.close(); + }); }); } }; diff --git a/src/template/alert.vue b/src/template/alert.vue index 9aee3e8..a3d0097 100644 --- a/src/template/alert.vue +++ b/src/template/alert.vue @@ -53,6 +53,9 @@ export default { this.show = true; this.visible = true; }); + this.event.$on("escKey", () => { + this.close(); + }); }); } }; diff --git a/src/template/app.vue b/src/template/app.vue index e80092b..b88c79c 100644 --- a/src/template/app.vue +++ b/src/template/app.vue @@ -116,6 +116,22 @@ export default { this.currentBlock = block; this.event.$emit("changeBgm", block); } + }, + mounted(){ + this.$nextTick(() => { + document.addEventListener("keyup", (e) => { + switch(e.keyCode){ + case 13: + this.event.$emit("enterKey", this.currentBlock); + break; + case 27: + this.event.$emit("escKey"); + break; + default: + break; + } + }, false); + }); } }; diff --git a/src/template/gachaCard.vue b/src/template/gachaCard.vue index 3d11339..67e79fe 100644 --- a/src/template/gachaCard.vue +++ b/src/template/gachaCard.vue @@ -94,6 +94,10 @@{{"(" + (limit.id > 9999 ? $t("idol.gacha") + limit.id : $t("idol.event") + limit.id) + ") " + limit.name + ": " + limit.startDate + " ~ " + limit.endDate}}