diff --git a/locales/ja.json5 b/locales/ja.json5
index ebb1a33..a990f49 100644
--- a/locales/ja.json5
+++ b/locales/ja.json5
@@ -529,7 +529,7 @@
"You will keep your achievements, building levels and sugar lumps.": "実績と施設レベル、角砂糖は引き継がれます。",
"Ascending": "昇天中",
"So long, cookies.": "クッキーたち、またね。",
- "You forfeit your %1.": "貯蓄していた %1クッキー を失いました。",
+ "You forfeit your %1.": "貯蓄していた %1 を失いました。",
"Prestige level:": "名声レベル :",
"Heavenly chips:": "ヘブンリーチップス :",
"%1 prestige level": [
@@ -3558,7 +3558,7 @@
"Cryogenically preserve your garden.
Plants no longer grow, spread or die; they provide no benefits.
Soil cannot be changed.
') + if (qpos >= 0) { + obj.baseDesc = obj.baseDesc.substring(0, qpos) + } + obj.ddesc = BeautifyInText(obj.baseDesc) let quote = loc(FindLocStringByPart('Upgrade quote ' + obj.id)) - if (typeof (quote) !== 'undefined') { - let qpos = obj.baseDesc.indexOf('') - if (qpos >= 0) { - obj.baseDesc = obj.baseDesc.substring(0, qpos) - } + if (quote) { obj.baseDesc += `${quote}` + obj.ddesc += `${quote}` } - obj.ddesc = obj.baseDesc } // ティアあり実績概要 - for (let result of funcInitString.matchAll(/Game.TieredAchievement\('(.+?)(?%1.', loc('%1 ' + obj.buildingTie.bsingle, LBeautify(Game.Tiers[obj.tier].achievUnlock))) } // 施設別生産量実績概要 - for (let result of funcInitString.matchAll(/Game.ProductionAchievement\('(.+?)(?%1 in one ascension.', loc('%1 cookie', { n: obj.threshold, b: toFixed(obj.threshold) })) } // CpS実績概要 - for (let result of funcInitString.matchAll(/Game.CpsAchievement\(('.+?(?%1 per second.', loc('%1 cookie', { n: obj.threshold, b: toFixed(obj.threshold) })) } // その他実績概要 - for (let result of funcInitString.matchAll(/new Game.Achievement\('(.+?)(?') + if (qpos >= 0) { + obj.baseDesc = obj.baseDesc.substring(0, qpos) + } obj.ddesc = BeautifyInText(obj.baseDesc) let quote = loc(FindLocStringByPart('Achievement quote ' + obj.id)) if (typeof (quote) !== 'undefined') { - let qpos = obj.ddesc.indexOf('') - if (qpos >= 0) { - obj.ddesc = obj.ddesc.substring(0, qpos) - } + obj.baseDesc += `${quote}` obj.ddesc += `${quote}` } } - + + // ミニゲーム菜園関連の再翻訳 + let Mg = Game.Objects['Farm'].minigame + funcInitString = Mg.init.toString().replace(/[\r\n\t]/g, '') + // 作物の再翻訳 + let plantsString = funcInitString.match(/M\.plants=\{(.+?)\};/)[1] + for (let res of plantsString.matchAll(/'([^']+?)':\{name:'(.+?)(?${loc('Each time you slot a spirit, you use up one worship swap.If you have 2 swaps left, the next one will refill after %1.
If you have 1 swap left, the next one will refill after %2.
If you have 0 swaps left, you will get one after %3.Unslotting a spirit costs no swaps.', [Game.sayTime(60 * 60 * 1 * Game.fps), Game.sayTime(60 * 60 * 4 * Game.fps), Game.sayTime(60 * 60 * 16 * Game.fps)])}`) + + // ミニゲーム在庫市場関連の再翻訳 + Mg = Game.Objects['Bank'].minigame + funcInitString = Mg.init.toString().replaceAll(/[\r\n\t]/g, '') + // オフィスの再翻訳 + let counter = 0 + for (let res of funcInitString.match(/M\.offices=\[(.+?)\];/)[1].matchAll(/{name:loc\("(.+?)"\),.+?,desc:(.+?)},/g)) { + Mg.offices[counter].name = loc(res[1]) + Mg.offices[counter].desc = Function('return ' + res[2])() + counter++ + } + // ローンの再翻訳 + counter = 0 + for (let res of funcInitString.match(/M\.loanTypes=\[(.+?)\];/)[1].matchAll(/\[loc\("(.+?)"\),.+?,loc\("(.+?)"\)\]/g)) { + Mg.loanTypes[counter][0] = loc(res[1]) + Mg.loanTypes[counter][6] = loc(res[2]) + counter++ + } + // メイン画面を再翻訳 + l('bankHeader').children[0].children[0].innerHTML = loc('Profits: %1. All prices are in $econds of your highest raw cookies per second.', '$0') + ' ' + l('bankBrokersBuy').innerHTML = loc('Hire') + for (let i = 1; i <= 3; i++) { + l('bankLoan' + i).innerHTML = loc('Loan #%1', i) + } + let buyStr = loc('Buy') + let sellStr = loc('Sell') + for (let i = 0; i < Mg.goodsById.length; i++) { + let good = Mg.goodsById[i] + good.name = loc(FindLocStringByPart(`STOCK ${i + 1} TYPE`)) + good.symbol = loc(FindLocStringByPart(`STOCK ${i + 1} LOGO`)) + good.company = loc(FindLocStringByPart(`STOCK ${i + 1} NAME`)) + let goodDiv = l('bankGood-' + i) + let bankSymbols = goodDiv.children[0].querySelectorAll('.bankSymbol') + let str = bankSymbols[0].innerHTML + bankSymbols[0].innerHTML = `${good.symbol} ${str.substring(str.indexOf('<'))}` + str = bankSymbols[1].innerHTML + bankSymbols[1].innerHTML = `${loc('value:')} ${str.substring(str.indexOf('<'))}` + str = bankSymbols[2].innerHTML + bankSymbols[2].innerHTML = `${loc('stock:')} ${str.substring(str.indexOf('<'))}` + bankSymbols = goodDiv.children[1].querySelectorAll('.bankSymbol') + for (let j = 0; j <= 1; j++) { + bankSymbols[j].style['display'] = (buyStr.length > 4 || sellStr.length > 4) ? 'block' : '' + bankSymbols[j].style['padding'] = (buyStr.length > 4 || sellStr.length > 4) ? '0px' : '' + bankSymbols[j].style['width'] = (buyStr.length > 4 || sellStr.length > 4) ? '100%' : '' + } + bankSymbols[0].innerHTML = buyStr + bankSymbols[1].innerHTML = sellStr + l(`bankGood-${i}_Max`).innerHTML = cap(loc('max')) + l(`bankGood-${i}_-All`).innerHTML = cap(loc('all')) + } + l('bankGraphLines').innerHTML = loc('Line style') + l('bankGraphCols').innerHTML = loc('Color mode') + if (l('bankCheatSpeeda') != null) { + l('bankCheatSpeeda').innerHTML = loc('Toggle speed') + } + l('bankGraphBox').children[1].innerHTML = loc('DOUGH JONES INDEX') + + // ミニゲーム魔導書関連の再翻訳 + Mg = Game.Objects['Wizard tower'].minigame + // 魔法を再翻訳 + for (let res of Mg.init.toString().replace(/[\r\n\t]/g, '').matchAll(/'((?:[^']|\\')+?)(?${loc('This is your magic meter. Each spell costs magic to use.Your maximum amount of magic varies depending on your amount of Wizard towers, and their level.Magic refills over time. The lower your magic meter, the slower it refills.')}`) + Game.RebuildUpgrades() Game.BuildStore() @@ -380,6 +511,50 @@ function rebuildLocalization() { l('smallSupport').children[4].innerHTML = '^ スポンサードリンク ^' l('support').children[0].innerHTML = 'v スポンサードリンク v' 'Cookie Clickerは主に広告によって支えられています。
このサイトをブロックしないよう考えていただくかPatreonを確認してください!' + + // 通知欄の再翻訳 + for (let note of Game.Notes) { + let icon = JSON.stringify(note.pic) + if (icon === JSON.stringify([25, 7])) { + // バックアップ催促の通知 + note.title = loc('Back up your save!') + note.desc = `${loc('Hello again! Just a reminder that you may want to back up your Cookie Clicker save every once in a while, just in case.
To do so, go to Options and hit "Export save" or "Save to file"!')}${loc('Don\'t show this again')}`.replaceAll('==CLOSETHIS()==', 'Game.CloseNote(' + note.id + ');') + } else if (note.pic[1] === 11 && note.pic[0] >= 0 && note.pic[0] < 16) { + // オフライン中の収入の通知 + let res = note.desc.match(/(\d+)(?:,(\d+)|\.(\d+)( \w+))?/) + let newval + if (res[2]) { + newval = Number(res[1] + res[2]) + } else if(res[3] && res[4]) { + newval = Number(`${res[1]}.${res[3]}`) * 1000 ** (formatLong.indexOf(res[4]) + 1) + } else { + newval = Number(res[1]) + } + note.title = loc('Welcome back!') + note.desc = loc('You earned %1 while you were away.', loc('%1 cookie', LBeautify(newval))) + } else if (icon === JSON.stringify([20, 3])) { + // バレンタインシーズン開始の通知 + note.title = loc('Valentine\'s Day!') + note.desc = loc('It\'s Valentine\'s season!
Love\'s in the air and cookies are just that much sweeter!') + } else if (icon === JSON.stringify([17, 6])) { + // ビジネスシーズン開始の通知 + note.title = loc('Business Day!') + note.desc = loc('It\'s Business season!
Don\'t panic! Things are gonna be looking a little more corporate for a few days.') + } else if (icon === JSON.stringify([13, 8])) { + // ハロウィンシーズン開始の通知 + note.title = loc('Halloween!') + note.desc = loc('It\'s Halloween season!
Everything is just a little bit spookier!') + } else if (icon === JSON.stringify([12, 10])) { + // クリスマスシーズン開始の通知 + note.title = loc('Christmas time!') + note.desc = loc('It\'s Christmas season!
Bring good cheer to all and you just may get cookies in your stockings!') + } else if (icon === JSON.stringify([0, 12])) { + // イースターシーズン開始の通知 + note.title = loc('Easter!') + note.desc = loc('It\'s Easter season!
Keep an eye out and you just might click a rabbit or two!') + } + } + Game.UpdateNotes() } if(typeof betterJapanese !== 'undefined') rebuildLocalization() \ No newline at end of file diff --git a/tools/build-steam.js b/tools/build-steam.js index c073b36..11b1755 100644 --- a/tools/build-steam.js +++ b/tools/build-steam.js @@ -5,7 +5,10 @@ const distDir = path.join(rootDir, './build/') const assetsDir = path.join(rootDir, './src/steam/') const srcDir = path.join(rootDir, './src/common/') +const version = require(path.join(rootDir, './package.json')).version + if (!fs.existsSync(distDir)) fs.mkdirSync(distDir) fs.copySync(srcDir, distDir) -fs.copySync(assetsDir, distDir) \ No newline at end of file +fs.copySync(assetsDir, distDir) +fs.writeJSONSync(path.join(distDir, './version.json'), { version }) \ No newline at end of file diff --git a/tools/build-web.js b/tools/build-web.js index 387de78..c27dd7e 100644 --- a/tools/build-web.js +++ b/tools/build-web.js @@ -6,8 +6,11 @@ const assetsDir = path.join(distDir, './assets/') const srcDir = path.join(rootDir, './src/common/') const webAssetsDir = path.join(rootDir, './src/web/') +const version = require(path.join(rootDir, './package.json')).version + if (!fs.existsSync(distDir)) fs.mkdirSync(distDir) if (!fs.existsSync(assetsDir)) fs.mkdirSync(assetsDir) fs.copySync(srcDir, assetsDir) -fs.copySync(webAssetsDir, distDir) \ No newline at end of file +fs.copySync(webAssetsDir, distDir) +fs.writeJSONSync(path.join(distDir, './version.json'), { version }) \ No newline at end of file diff --git a/tools/start.js b/tools/start.js index f10dc10..3aacef4 100644 --- a/tools/start.js +++ b/tools/start.js @@ -16,6 +16,8 @@ const eslint = new ESLINT() const color = require('chalk') log.enabled = true +const version = require(path.join(rootDir, './package.json')).version + async function initFormatter() { formatter = await eslint.loadFormatter('stylish') } @@ -88,6 +90,8 @@ async function copyFiles(file) { copyFiles() +fs.writeJSONSync(path.join(distDir, './version.json'), { version }) + const watcher = chokidar.watch([srcDir, assetsDir, localeFile]) watcher.on('ready', () => log('ready'))