| @@ -224,60 +224,42 @@ window.onload = function() | |||||
| return true; | return true; | ||||
| } | } | ||||
| }); | }); | ||||
| //处理返回的数据 | |||||
| function dealIdata(responseText) | |||||
| { | |||||
| var idata; | |||||
| try | |||||
| { | |||||
| ms = JSON.parse(responseText); | |||||
| initialize();//初始化 | |||||
| var idataQer = getQueryString("d") || getQueryString("data"); | |||||
| if (idataQer) | |||||
| { | |||||
| idata = JSON.parse(idataQer); | |||||
| } | |||||
| }catch(e) | |||||
| { | |||||
| console.log("初始数据JSON解码出错",e); | |||||
| return; | |||||
| } | |||||
| if (idata) | |||||
| { | |||||
| formation.loadObj(idata); | |||||
| refreshAll(formation); | |||||
| } | |||||
| } | |||||
| GM_xmlhttpRequest({ | GM_xmlhttpRequest({ | ||||
| method: "GET", | method: "GET", | ||||
| url:"monsters-info/mon_"+dataSource.code+".json", | url:"monsters-info/mon_"+dataSource.code+".json", | ||||
| onload: function(response) { | onload: function(response) { | ||||
| ms = JSON.parse(response.response); | |||||
| initialize();//初始化 | |||||
| var idata; | |||||
| try | |||||
| { | |||||
| var idataQer = getQueryString("d") || getQueryString("data"); | |||||
| if (idataQer) | |||||
| { | |||||
| idata = JSON.parse(idataQer); | |||||
| } | |||||
| }catch(e) | |||||
| { | |||||
| console.log("初始数据JSON解码出错",e); | |||||
| return; | |||||
| } | |||||
| if (idata) | |||||
| { | |||||
| //formation = idata; | |||||
| formation.loadObj(idata); | |||||
| refreshAll(formation); | |||||
| } | |||||
| dealIdata(response.response); | |||||
| }, | }, | ||||
| onerror: function(response) { | onerror: function(response) { | ||||
| var isChrome = navigator.userAgent.indexOf("Chrome") >=0; | var isChrome = navigator.userAgent.indexOf("Chrome") >=0; | ||||
| if (isChrome && location.host.length==0) | if (isChrome && location.host.length==0) | ||||
| { | { | ||||
| console.info("因为是Chrome本地打开,正在尝试读取XML"); | |||||
| var idata; | |||||
| try | |||||
| { | |||||
| ms = JSON.parse(response.response); | |||||
| initialize();//初始化 | |||||
| var idataQer = getQueryString("d") || getQueryString("data"); | |||||
| if (idataQer) | |||||
| { | |||||
| idata = JSON.parse(idataQer); | |||||
| } | |||||
| }catch(e) | |||||
| { | |||||
| console.error("网络请求返回错误,尝试解码仍错误。",e); | |||||
| return; | |||||
| } | |||||
| if (idata) | |||||
| { | |||||
| //formation = idata; | |||||
| formation.loadObj(idata); | |||||
| refreshAll(formation); | |||||
| } | |||||
| console.info("因为是Chrome本地打开,正在尝试读取JSON"); | |||||
| dealIdata(response.response); | |||||
| }else | }else | ||||
| { | { | ||||
| console.error("怪物数据获取错误",response); | console.error("怪物数据获取错误",response); | ||||
| @@ -150,8 +150,8 @@ function calculateAbility(monid,level,plus,awoken,latent,weaponId,weaponAwoken) | |||||
| if (awoken == undefined) awoken = 0; | if (awoken == undefined) awoken = 0; | ||||
| if (latent == undefined) latent = []; | if (latent == undefined) latent = []; | ||||
| if (monid<=0) return null; | |||||
| var m = ms[monid]; //怪物数据 | var m = ms[monid]; //怪物数据 | ||||
| if (monid ==0 || m==undefined) return null; | |||||
| var plusAdd = [10,5,3]; //加值的增加值 | var plusAdd = [10,5,3]; //加值的增加值 | ||||
| var awokenAdd = [ //对应加三维觉醒的序号与增加值 | var awokenAdd = [ //对应加三维觉醒的序号与增加值 | ||||
| [{index:1,value:500},{index:65,value:-5000}], | [{index:1,value:500},{index:65,value:-5000}], | ||||
| @@ -162,7 +162,7 @@ function calculateAbility(monid,level,plus,awoken,latent,weaponId,weaponAwoken) | |||||
| [{index:1,scale:0.015},{index:12,scale:0.03},{index:25,scale:0.045}], | [{index:1,scale:0.015},{index:12,scale:0.03},{index:25,scale:0.045}], | ||||
| [{index:2,scale:0.01},{index:12,scale:0.02},{index:26,scale:0.03}], | [{index:2,scale:0.01},{index:12,scale:0.02},{index:26,scale:0.03}], | ||||
| [{index:3,scale:0.1},{index:12,scale:0.2},{index:27,scale:0.3}] | [{index:3,scale:0.1},{index:12,scale:0.2},{index:27,scale:0.3}] | ||||
| ]; | |||||
| ]; | |||||
| var abilitys = m.ability.map(function(ab,idx){ | var abilitys = m.ability.map(function(ab,idx){ | ||||
| var n_base = Math.round(valueAt(level,m.maxLv,ab)); | var n_base = Math.round(valueAt(level,m.maxLv,ab)); | ||||
| //var n_base = Math.round((ab[1]-ab[0])*(level-1)/98+ab[0]); //99级以内的增加 | //var n_base = Math.round((ab[1]-ab[0])*(level-1)/98+ab[0]); //99级以内的增加 | ||||