Skip to content

Commit

Permalink
update 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
toyobayashi committed Dec 28, 2017
1 parent 29188d0 commit 96624ff
Show file tree
Hide file tree
Showing 20 changed files with 205 additions and 50 deletions.
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 4 additions & 1 deletion src/i18n/ja-JP.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ export default {
skill_explain: "特技詳細",
leader_skill_name: "センター効果",
leader_skill_explain: "センター効果詳細",
nashi: "無し"
nashi: "無し",
limited: "限定",
event: "イベント",
gacha: "ガシャ"
},
live: {
decoding: " デコード中...",
Expand Down
5 changes: 4 additions & 1 deletion src/i18n/zh-CN.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ export default {
skill_explain: "特技詳細",
leader_skill_name: "領隊効果",
leader_skill_explain: "領隊効果詳細",
nashi: "无"
nashi: "无",
limited: "限定",
event: "活動",
gacha: "転蛋"
},
live: {
decoding: " 解碼中...",
Expand Down
4 changes: 2 additions & 2 deletions src/js/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions src/js/gacha.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
},
Expand Down
9 changes: 9 additions & 0 deletions src/js/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
});
});
}
};
133 changes: 104 additions & 29 deletions src/js/icpMain.js
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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;
Expand All @@ -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];
Expand All @@ -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";
Expand Down Expand Up @@ -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++;
}
}
});

Expand All @@ -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));
}
}
}
});
}
Expand All @@ -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);
}
}
});
Expand Down
5 changes: 5 additions & 0 deletions src/js/idol.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,11 @@ export default {
}
}
});
this.event.$on("enterKey", (block) => {
if(block === "idol"){
this.query();
}
});
});
}
};
12 changes: 8 additions & 4 deletions src/js/live.js
Original file line number Diff line number Diff line change
@@ -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();

Expand Down Expand Up @@ -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 });
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/js/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ OTHER DEALINGS IN THE SOFTWARE.</p>`, 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){
Expand Down
3 changes: 3 additions & 0 deletions src/template/about.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ export default {
this.show = true;
this.visible = true;
});
this.event.$on("escKey", () => {
this.close();
});
});
}
};
Expand Down
3 changes: 3 additions & 0 deletions src/template/alert.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ export default {
this.show = true;
this.visible = true;
});
this.event.$on("escKey", () => {
this.close();
});
});
}
};
Expand Down
16 changes: 16 additions & 0 deletions src/template/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
}
};
</script>
Expand Down
Loading

0 comments on commit 96624ff

Please sign in to comment.