| @@ -67,20 +67,21 @@ officialAPI.forEach(function(lang){ | |||
| //加入其他服务器相同角色的名字 | |||
| for (let li = 0;li < officialAPI.length; li++) | |||
| { | |||
| let otherLangs = officialAPI.concat(); //复制一份原始数组,储存其他语言 | |||
| let lang = otherLangs.splice(li,1)[0]; //删掉并取得当前的语言 | |||
| const otherLangs = officialAPI.concat(); //复制一份原始数组,储存其他语言 | |||
| const lang = otherLangs.splice(li,1)[0]; //删掉并取得当前的语言 | |||
| let langCard = lang.cards,langCardCount = langCard.length; | |||
| const langCard = lang.cards; | |||
| const langCardCount = langCard.length; | |||
| for (let mi=0; mi<langCardCount; mi++) | |||
| { | |||
| let m = langCard[mi]; | |||
| let name = m.name; //当前语言的名字 | |||
| const m = langCard[mi]; | |||
| const name = m.name; //当前语言的名字 | |||
| //名字对象 | |||
| otherLangs.forEach((otLang)=>{ | |||
| let _m = otLang.cards[mi]; //获得这种其他语言的当前这个怪物数据 | |||
| let isSame = sameCard(m,_m); //与原语言怪物是否是同一只 | |||
| let l1 = lang.code, l2 = otLang.code; | |||
| const l1 = lang.code, l2 = otLang.code; | |||
| if (!isSame && | |||
| ( | |||
| l1 == 'ja' && (l2 == 'en' || l2 == 'ko') || | |||
| @@ -88,7 +89,7 @@ for (let li = 0;li < officialAPI.length; li++) | |||
| ) //当同id两者不同,日服和英韩服比较时的一些人工确认相同的特殊id差异卡片 | |||
| ) | |||
| { | |||
| let langIsJa = l1 == 'ja' ? true : false; //原始语言是否是日语 | |||
| const langIsJa = l1 == 'ja' ? true : false; //原始语言是否是日语 | |||
| let diff = 0; //日语和其它语言的id差异 | |||
| switch(true) | |||
| { | |||
| @@ -121,7 +122,7 @@ for (let li = 0;li < officialAPI.length; li++) | |||
| } | |||
| if (_m && isSame) //如果有这个怪物,且与原语言怪物是同一只 | |||
| { | |||
| let otName = _m.name; | |||
| const otName = _m.name; | |||
| if (!/^\*+/.test(name) && //名字不是星号开头 | |||
| !/^\*+/.test(otName) && //另一个语言名字不是星号开头 | |||
| !/^\?+/.test(name) && //名字不是问号开头 | |||
| @@ -1,16 +1,16 @@ | |||
| var fs = require('fs'); | |||
| var sourceFolder = "Download-pad.skyozora.com/pad.skyozora.com"; | |||
| var outJSON = "custom/cht.json"; | |||
| var path = require('path');//解析需要遍历的文件夹 | |||
| const fs = require('fs'); | |||
| const sourceFolder = "Download-pad.skyozora.com/pad.skyozora.com"; | |||
| const outJSON = "custom/cht.json"; | |||
| const path = require('path');//解析需要遍历的文件夹 | |||
| fs.access(outJSON,function(err){ | |||
| var monArr; | |||
| let monArr; | |||
| if (err) | |||
| { | |||
| monArr = []; | |||
| }else | |||
| { | |||
| var monArr = JSON.parse(fs.readFileSync(outJSON, 'utf-8'));//读取繁体中文数据避免重复工作 | |||
| monArr = JSON.parse(fs.readFileSync(outJSON, 'utf-8'));//读取繁体中文数据避免重复工作 | |||
| } | |||
| //根据文件路径读取文件,返回文件列表 | |||
| @@ -20,22 +20,22 @@ fs.access(outJSON,function(err){ | |||
| }else{ | |||
| //遍历读取到的文件列表 | |||
| files.forEach(function(filename){ | |||
| var searchID = /^(\d+)\.html$/i.exec(filename); | |||
| let searchID = /^(\d+)\.html$/i.exec(filename); | |||
| if (searchID && !monArr.some(function(cn){return cn.id == searchID[1];})) | |||
| { | |||
| var filepath = path.join(sourceFolder, filename);//合并当前文件的路径 | |||
| var htmlText = fs.readFileSync(filepath, 'utf-8'); //使用同步读取 | |||
| var searchName = /<h2 .+>\s*?([\s\S]*)\s*?<\/h2>/igm.exec(htmlText); | |||
| const filepath = path.join(sourceFolder, filename);//合并当前文件的路径 | |||
| const htmlText = fs.readFileSync(filepath, 'utf-8'); //使用同步读取 | |||
| let searchName = /<h2 .+>\s*?([\s\S]*)\s*?<\/h2>/igm.exec(htmlText); | |||
| try | |||
| { | |||
| var mname = searchName[1].trim(); | |||
| let mname = searchName[1].trim(); | |||
| mname = mname.replace("探偵","偵探"); //把日语的探侦都换成侦探 | |||
| if (mname.length>0) | |||
| { | |||
| var m = { | |||
| const m = { | |||
| id:searchID[1], | |||
| name:mname, | |||
| } | |||
| }; | |||
| monArr.push(m); | |||
| if (monArr.length % 100 == 0) | |||
| { | |||
| @@ -47,21 +47,21 @@ fs.access(outJSON,function(err){ | |||
| } | |||
| }catch(e) | |||
| { | |||
| console.log(filename,e) | |||
| console.log(filename,e); | |||
| } | |||
| } | |||
| }); | |||
| monArr.sort(function(a,b){ | |||
| return a.id - b.id; | |||
| }) | |||
| var str = JSON.stringify(monArr); | |||
| }); | |||
| const str = JSON.stringify(monArr); | |||
| fs.writeFile(outJSON,str,function(err){ | |||
| if(err){ | |||
| console.error(err); | |||
| } | |||
| console.log("---繁体中文导出成功,共 " + monArr.length + " 个名称---"); | |||
| }) | |||
| }); | |||
| } | |||
| }); | |||
| }) | |||
| }); | |||
| @@ -1065,6 +1065,7 @@ function touchendMonHead(e) | |||
| //移动端编辑界面每个怪物的头像的取消 | |||
| function touchcancelMonHead(e) | |||
| { | |||
| interchangeSVG.style.display = "none"; | |||
| console.log("移动取消",e,this); | |||
| } | |||
| function interchangeCard(formArr,toArr) | |||
| @@ -13,7 +13,7 @@ const type_allowable_latent = { | |||
| "6":[19,23],//6攻击 | |||
| "7":[17],//7恶魔 | |||
| "8":[17,20,21,24],//8机械 | |||
| } | |||
| }; | |||
| //仿GM_xmlhttpRequest函数v1.3 | |||
| if (typeof(GM_xmlhttpRequest) == "undefined") { | |||
| var GM_xmlhttpRequest = function(GM_param) { | |||
| @@ -33,14 +33,14 @@ if (typeof(GM_xmlhttpRequest) == "undefined") { | |||
| GM_param.onerror(xhr); | |||
| } | |||
| } | |||
| } | |||
| }; | |||
| //添加header | |||
| for (var header in GM_param.headers) { | |||
| xhr.setRequestHeader(header, GM_param.headers[header]); | |||
| } | |||
| //发送数据 | |||
| xhr.send(GM_param.data ? GM_param.data : null); | |||
| } | |||
| }; | |||
| } | |||
| //数字补前导0 | |||
| function PrefixInteger(num, length) | |||
| @@ -91,7 +91,7 @@ function awokenCountInFormation(formationTeam,ak,solo) | |||
| { | |||
| var allAwokenCount = formationTeam.reduce(function(fc,fm){ | |||
| return fc + awokenCountInTeam(fm,ak,solo); | |||
| },0) | |||
| },0); | |||
| return allAwokenCount; | |||
| } | |||
| //计算队伍中有多少个该觉醒 | |||
| @@ -122,7 +122,7 @@ function awokenCountInTeam(team,awokenIndex,solo) | |||
| return c + hasAwoken; | |||
| },0); | |||
| return tc + teamAwokenCount; | |||
| },0) | |||
| },0); | |||
| return formationAwokenCount; | |||
| } | |||
| //返回可用的怪物名称 | |||
| @@ -144,7 +144,7 @@ function returnMonsterNameArr(card, lsList, defaultCode) | |||
| return monNameArr; | |||
| } | |||
| //计算怪物的能力 | |||
| function calculateAbility(monid = 0,level = 1,plus = [0,0,0],awoken = 0,latent = [],weaponId,weaponAwoken) | |||
| function calculateAbility(monid = 0, level = 1, plus = [0,0,0], awoken = 0, latent = [], weaponId = null, weaponAwoken = null) | |||
| { | |||
| const card = Cards[monid]; //怪物数据 | |||
| if (monid == 0 || card == undefined) return null; | |||
| @@ -189,23 +189,23 @@ function calculateAbility(monid = 0,level = 1,plus = [0,0,0],awoken = 0,latent = | |||
| if (weaponAwokenList.indexOf(49)>=0) //49是武器觉醒,确认已经点亮了武器觉醒 | |||
| {awokenList = awokenList.concat(weaponAwokenList);} | |||
| } | |||
| const n_awoken = awoken //觉醒增加的数值 | |||
| ?Math.round(awokenAdd[idx].reduce(function(previous,aw){ | |||
| const n_awoken = awoken ? //觉醒增加的数值 | |||
| Math.round(awokenAdd[idx].reduce(function(previous,aw){ | |||
| const awokenCount = awokenList.filter(function(a){return a==aw.index;}).length; //每个潜觉的数量 | |||
| return previous + aw.value * awokenCount; //无加值与觉醒的基础值,乘以那么多个潜觉的增加倍数 | |||
| },0)) | |||
| :0; | |||
| const n_latent = (latent && latent.length) //潜觉增加的数值 | |||
| ?Math.round(latentAdd[idx].reduce(function(previous,la){ | |||
| },0)) : | |||
| 0; | |||
| const n_latent = (latent && latent.length) ? //潜觉增加的数值 | |||
| Math.round(latentAdd[idx].reduce(function(previous,la){ | |||
| const latentCount = latent.filter(function(l){return l==la.index;}).length; //每个潜觉的数量 | |||
| return previous + n_base * la.scale * latentCount; //无加值与觉醒的基础值,乘以那么多个潜觉的增加倍数 | |||
| },0)) | |||
| :0; | |||
| },0)) : | |||
| 0; | |||
| //console.log("基础值:%d,加蛋值:%d,觉醒x%d增加:%d,潜觉增加:%d",n_base,n_plus,awokenCount,n_awoken,n_latent); | |||
| let reValue = n_base + n_plus + n_awoken + n_latent; | |||
| if (idx<2 && reValue<1) reValue = 1; //HP和ATK最低为1 | |||
| return reValue; | |||
| }) | |||
| }); | |||
| return abilitys; | |||
| } | |||
| function searchCards(cards,attr1,attr2,fixMainColor,types,awokens,sawokens) | |||
| @@ -237,7 +237,7 @@ function searchCards(cards,attr1,attr2,fixMainColor,types,awokens,sawokens) | |||
| } | |||
| if (types.length>0) | |||
| { | |||
| res = res.filter(c=>{return types.some(t=>{return c.types.indexOf(t)>=0});}); | |||
| res = res.filter(c=>{return types.some(t=>{return c.types.indexOf(t)>=0;});}); | |||
| } | |||
| if (awokens.length>0) | |||
| { | |||