| @@ -2,6 +2,9 @@ | |||
| .status.loading-mon-info .text::before{ | |||
| content: "Please wait while the monster data is being loaded."; | |||
| } | |||
| .status.loading-skill-info .text::before{ | |||
| content: "Please wait while the skills data is being loaded."; | |||
| } | |||
| .delay .monster::before{ | |||
| content: "Prevent\A Delay"; | |||
| font-size: 22px; | |||
| @@ -2,6 +2,9 @@ | |||
| .status.loading-mon-info .text::before{ | |||
| content: "モンスターデータを読み込んでいます。"; | |||
| } | |||
| .status.loading-skill-info .text::before{ | |||
| content: "スキル データを読み込んでいます。"; | |||
| } | |||
| .delay .monster::before{ | |||
| content: "遅 延\A対 策"; | |||
| } | |||
| @@ -2,6 +2,9 @@ | |||
| .status.loading-mon-info .text::before{ | |||
| content: "몬스터 데이터를 로드 하 고 있습니다."; | |||
| } | |||
| .status.loading-skill-info .text::before{ | |||
| content: "기술 데이터를 로드 하 고 있습니다."; | |||
| } | |||
| .delay .monster::before{ | |||
| content: "지 연\A방 지"; | |||
| } | |||
| @@ -2,6 +2,9 @@ | |||
| .status.loading-mon-info .text::before{ | |||
| content: "正在載入怪物數據,請稍候。"; | |||
| } | |||
| .status.loading-skill-info .text::before{ | |||
| content: "正在載入技能数据,请稍候。"; | |||
| } | |||
| .delay .monster::before{ | |||
| content: "應 對\A威 嚇"; | |||
| } | |||
| @@ -2,6 +2,9 @@ | |||
| .status.loading-mon-info .text::before{ | |||
| content: "正在加载怪物数据,请稍候。"; | |||
| } | |||
| .status.loading-skill-info .text::before{ | |||
| content: "正在加载技能数据,请稍候。"; | |||
| } | |||
| .delay .monster::before{ | |||
| content: "应 对\A威 吓"; | |||
| } | |||
| @@ -1,5 +1,6 @@ | |||
| const fs = require('fs'); | |||
| const Card = require('./official-API/parseCard'); | |||
| const Skill = require('./official-API/parseSkill'); | |||
| var officialAPI = [ //来源于官方API | |||
| { | |||
| code:"ja", | |||
| @@ -34,24 +35,23 @@ function sameCard(m1,m2) | |||
| */ | |||
| officialAPI.forEach(function(lang){ | |||
| console.log("正在读取官方 " + lang.code + " 信息"); | |||
| let json = fs.readFileSync("official-API/" + lang.code +".json", 'utf-8'); //使用同步读取 | |||
| let oCards = lang.cardOriginal = JSON.parse(json).card;//将字符串转换为json对象 | |||
| const cardJson = fs.readFileSync("official-API/" + lang.code +".json", 'utf-8'); //使用同步读取怪物 | |||
| const oCards = lang.cardOriginal = JSON.parse(cardJson).card;//将字符串转换为json对象 | |||
| let maxCardIndex = 0; | |||
| while (oCards[maxCardIndex][0] == maxCardIndex) | |||
| { | |||
| maxCardIndex++; | |||
| } | |||
| let monCards = lang.cards = oCards | |||
| const monCards = lang.cards = oCards | |||
| .slice(0,maxCardIndex) //切出前面id相等部分(id不等于索引时,都是敌人) | |||
| .map((oc)=>{return new Card(oc);}); //每一项生成分析对象 | |||
| //加入自定义的语言 | |||
| lang.customName.forEach(function(lcode){ | |||
| console.log("正在读取自定义 " + lcode + " 信息"); | |||
| let json = fs.readFileSync("custom/" + lcode +".json", 'utf-8'); //使用同步读取 | |||
| let ccard = JSON.parse(json);//将字符串转换为json对象 | |||
| const ljson = fs.readFileSync("custom/" + lcode +".json", 'utf-8'); //使用同步读取 | |||
| const ccard = JSON.parse(ljson);//将字符串转换为json对象 | |||
| ccard.forEach(function(cm,idx){ //每个文件内的名字循环 | |||
| let m = monCards[cm.id]; | |||
| if (m) | |||
| @@ -62,6 +62,10 @@ officialAPI.forEach(function(lang){ | |||
| } | |||
| }); | |||
| }); | |||
| const skillJson = fs.readFileSync("official-API/" + lang.code +"-skill.json", 'utf-8'); //使用同步读取技能 | |||
| const oSkills = lang.skillOriginal = JSON.parse(skillJson).skill;//将字符串转换为json对象 | |||
| lang.skills = oSkills.map((oc,idx)=>{return new Skill(idx,oc);}); //每一项生成分析对象 | |||
| }); | |||
| //加入其他服务器相同角色的名字 | |||
| @@ -150,11 +154,18 @@ officialAPI.forEach(function(lang){ | |||
| delete card.enemy; | |||
| }); | |||
| */ | |||
| let str = JSON.stringify(lang.cards); | |||
| fs.writeFile('./mon_'+lcode+'.json',str,function(err){ | |||
| const cardStr = JSON.stringify(lang.cards); | |||
| fs.writeFile('./mon_'+lcode+'.json',cardStr,function(err){ | |||
| if(err){ | |||
| console.error(err); | |||
| } | |||
| console.log('mon_'+lcode+'.json 导出成功'); | |||
| }); | |||
| const skillStr = JSON.stringify(lang.skills); | |||
| fs.writeFile('./skill_'+lcode+'.json',skillStr,function(err){ | |||
| if(err){ | |||
| console.error(err); | |||
| } | |||
| console.log('skill_'+lcode+'.json 导出成功'); | |||
| }); | |||
| }); | |||
| @@ -1,4 +1,5 @@ | |||
| var Cards = null; //怪物数据 | |||
| var Skills = null; //技能数据 | |||
| var currentLanguage = null; //当前语言 | |||
| var currentDataSource = null; //当前数据 | |||
| const dataSourceList = [ //几个不同的游戏服务区 | |||
| @@ -276,41 +277,72 @@ window.onload = function() | |||
| return true; | |||
| } | |||
| }); | |||
| //处理返回的数据 | |||
| function dealIdata(responseText) | |||
| { | |||
| try | |||
| { | |||
| Cards = JSON.parse(responseText); | |||
| }catch(e) | |||
| { | |||
| console.log("Cards数据JSON解码出错",e); | |||
| return; | |||
| } | |||
| initialize();//初始化 | |||
| statusLine.classList.remove("loading-mon-info"); | |||
| //如果通过的话就载入URL中的怪物数据 | |||
| reloadFormationData(); | |||
| } | |||
| statusLine.classList.add("loading-mon-info"); | |||
| GM_xmlhttpRequest({ | |||
| method: "GET", | |||
| url:`monsters-info/mon_${currentDataSource.code}.json`, //Cards数据文件 | |||
| onload: function(response) { | |||
| dealIdata(response.response); | |||
| dealCardsData(response.response); | |||
| }, | |||
| onerror: function(response) { | |||
| let isChrome = navigator.userAgent.indexOf("Chrome") >=0; | |||
| if (isChrome && location.host.length==0 && response.response.length>0) | |||
| { | |||
| console.info("因为是Chrome本地打开,正在尝试读取JSON"); | |||
| dealIdata(response.response); | |||
| dealCardsData(response.response); | |||
| }else | |||
| { | |||
| console.error("Cars JSON数据获取失败",response); | |||
| console.error("Cards JSON数据获取失败",response); | |||
| } | |||
| } | |||
| }); | |||
| //处理返回的数据 | |||
| function dealCardsData(responseText) | |||
| { | |||
| try | |||
| { | |||
| Cards = JSON.parse(responseText); | |||
| }catch(e) | |||
| { | |||
| console.log("Cards数据JSON解码出错",e); | |||
| return; | |||
| } | |||
| statusLine.classList.remove("loading-mon-info"); | |||
| statusLine.classList.add("loading-skill-info"); | |||
| GM_xmlhttpRequest({ | |||
| method: "GET", | |||
| url:`monsters-info/skill_${currentDataSource.code}.json`, //Skills数据文件 | |||
| onload: function(response) { | |||
| dealSkillData(response.response); | |||
| }, | |||
| onerror: function(response) { | |||
| let isChrome = navigator.userAgent.indexOf("Chrome") >=0; | |||
| if (isChrome && location.host.length==0 && response.response.length>0) | |||
| { | |||
| console.info("因为是Chrome本地打开,正在尝试读取JSON"); | |||
| dealSkillData(response.response); | |||
| }else | |||
| { | |||
| console.error("Skills JSON数据获取失败",response); | |||
| } | |||
| } | |||
| }); | |||
| } | |||
| function dealSkillData(responseText) | |||
| { | |||
| try | |||
| { | |||
| Skills = JSON.parse(responseText); | |||
| }catch(e) | |||
| { | |||
| console.log("Skills数据JSON解码出错",e); | |||
| return; | |||
| } | |||
| initialize();//初始化 | |||
| statusLine.classList.remove("loading-skill-info"); | |||
| //如果通过的话就载入URL中的怪物数据 | |||
| reloadFormationData(); | |||
| } | |||
| }; | |||
| //重新读取URL中的Data数据并刷新页面 | |||
| function reloadFormationData() | |||
| @@ -50,16 +50,21 @@ body{ | |||
| background-color: #eee; | |||
| padding: 0; | |||
| } | |||
| .status{ | |||
| line-height: 16px; | |||
| } | |||
| /*.status.loading-mon-info .text::before{ | |||
| content: "正在加载怪物数据"; | |||
| }*/ | |||
| .status.loading-mon-info .icon{ | |||
| .status.loading-mon-info .icon, | |||
| .status.loading-skill-info .icon{ | |||
| display: inline-block; | |||
| width: 16px; | |||
| height: 16px; | |||
| background-image: url(images/loading.png); | |||
| background-size: cover; | |||
| animation: loading-animate 10s infinite linear; | |||
| border: 4px SteelBlue dotted; | |||
| border-radius: 50%; | |||
| animation: loading-animate 50s infinite linear; | |||
| vertical-align: middle; | |||
| } | |||
| ul{ | |||
| margin: 0; | |||