You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

script.js 88 kB

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago
7 years ago
6 years ago
7 years ago
7 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512
  1. var Cards; //怪物数据
  2. var Skills; //技能数据
  3. var currentLanguage; //当前语言
  4. var currentDataSource; //当前数据
  5. var isGuideMod; //是否以图鉴模式启动
  6. const teamBigBoxs = []; //储存全部teamBigBox
  7. const allMembers = []; //储存所有成员,包含辅助
  8. var interchangeSvg; //储存划线的SVG
  9. var controlBox; //储存整个controlBox
  10. var statusLine; //储存状态栏
  11. var formationBox; //储存整个formationBox
  12. var editBox; //储存整个editBox
  13. var showSearch; //整个程序都可以用的显示搜索函数
  14. var zipURL; //储存是否压缩网址数据
  15. const dataStructure = 3; //阵型输出数据的结构版本
  16. const className_displayNone = "display-none";
  17. class Member2
  18. {
  19. constructor(oldMenber = null,isAssist = false)
  20. {
  21. if (oldMenber)
  22. { //Copy一个
  23. this.id = oldMenber.id;
  24. this.level = oldMenber.level;
  25. this.plus = [...oldMenber.plus];
  26. this.awoken = oldMenber.awoken;
  27. this.sAwoken = oldMenber.sAwoken;
  28. this.latent = [...oldMenber.latent];
  29. this.skilllevel = oldMenber.sAwoken;
  30. this.assist = oldMenber.assist;
  31. }else
  32. { //全新的
  33. this.id = 0;
  34. this.level = 1;
  35. this.plus = [0,0,0];
  36. this.awoken = 0;
  37. this.sAwoken = null;
  38. this.latent = [];
  39. this.skilllevel = null;
  40. this.assist = null;
  41. }
  42. this.isAssist = isAssist;
  43. }
  44. calculateAbility(solo,teamCount){
  45. const card = Cards[this.id];
  46. let bonus = null;
  47. if (!this.isAssist &&
  48. this.assist &&
  49. this.assist.id>0 &&
  50. Cards[this.assist.id].attrs[0] === card.attrs[0]
  51. ){
  52. bonus = this.assist.calculateAbility(solo,teamCount);
  53. }
  54. }
  55. toJSON(){
  56. }
  57. }
  58. //队员基本的留空
  59. var Member = function(){
  60. this.id=0;
  61. this.ability = [0,0,0];
  62. };
  63. Member.prototype.outObj = function(){
  64. const m = this;
  65. let obj = [m.id];
  66. if (m.level != undefined) obj[1] = m.level;
  67. if (m.awoken != undefined) obj[2] = m.awoken;
  68. if (m.plus != undefined && m.plus instanceof Array && m.plus.length>=3 && (m.plus[0]+m.plus[1]+m.plus[2])!=0)
  69. {
  70. if (m.plus[0] === m.plus[1] && m.plus[0] === m.plus[2])
  71. { //当3个加值一样时只生成第一个减少长度
  72. obj[3] = m.plus[0];
  73. }else
  74. {
  75. obj[3] = m.plus;
  76. }
  77. }
  78. if (m.latent != undefined && m.latent instanceof Array && m.latent.length>=1) obj[4] = m.latent;
  79. if (m.sawoken != undefined && m.sawoken>=0) obj[5] = m.sawoken;
  80. const card = Cards[m.id] || Cards[0]; //怪物固定数据
  81. const skill = Skills[card.activeSkillId];
  82. //有技能等级,并且技能等级低于最大等级时才记录技能
  83. if (m.skilllevel != undefined && m.skilllevel < skill.maxLevel) obj[6] = m.skilllevel;
  84. return obj;
  85. };
  86. Member.prototype.loadObj = function(m,dataVersion){
  87. if (m == undefined) //如果没有提供数据,直接返回默认
  88. {
  89. return;
  90. }
  91. if (dataVersion == undefined) dataVersion = 1;
  92. this.id = dataVersion>1 ? m[0] : m.id;
  93. this.level = dataVersion>1 ? m[1] : m.level;
  94. this.awoken = dataVersion>1 ? m[2] : m.awoken;
  95. if (dataVersion>1)
  96. {
  97. if (isNaN(m[3]) || m[3]==null)
  98. {
  99. this.plus = m[3];
  100. }else
  101. {
  102. const singlePlus = parseInt(m[3],10);//如果只有一个数字时,复制3份
  103. this.plus = [singlePlus,singlePlus,singlePlus];
  104. }
  105. }else
  106. {
  107. this.plus = m.plus;
  108. }
  109. if (!(this.plus instanceof Array)) this.plus = [0,0,0]; //如果加值不是数组,则改变
  110. this.latent = dataVersion>1 ? m[4] : m.latent;
  111. if (this.latent && dataVersion<=2) this.latent = this.latent.map(l=>l>=13?l+3:l); //修复以前自己编的潜觉编号为官方编号
  112. if (!(this.latent instanceof Array)) this.latent = []; //如果潜觉不是数组,则改变
  113. this.sawoken = dataVersion>1 ? m[5] : m.sawoken;
  114. this.skilllevel = m[6] || null;
  115. };
  116. Member.prototype.loadFromMember = function(m){
  117. if (m == undefined) //如果没有提供数据,直接返回默认
  118. {
  119. return;
  120. }
  121. this.id = m.id;
  122. };
  123. //只用来防坐的任何队员
  124. var MemberDelay = function(){
  125. this.id=-1;
  126. };
  127. MemberDelay.prototype = Object.create(Member.prototype);
  128. MemberDelay.prototype.constructor = MemberDelay;
  129. //辅助队员
  130. var MemberAssist = function(){
  131. this.level = 0;
  132. this.awoken = 0;
  133. this.plus = [0,0,0];
  134. Member.call(this);
  135. };
  136. MemberAssist.prototype = Object.create(Member.prototype);
  137. MemberAssist.prototype.constructor = MemberAssist;
  138. MemberAssist.prototype.loadFromMember = function(m){
  139. if (m == undefined) //如果没有提供数据,直接返回默认
  140. {
  141. return;
  142. }
  143. this.id = m.id;
  144. if (m.level != undefined) this.level = m.level;
  145. if (m.awoken != undefined) this.awoken = m.awoken;
  146. if (m.plus != undefined && m.plus instanceof Array && m.plus.length>=3 && (m.plus[0]+m.plus[1]+m.plus[2])>0) this.plus = JSON.parse(JSON.stringify(m.plus));
  147. if (m.skilllevel != undefined) this.skilllevel = m.skilllevel;
  148. };
  149. //正式队伍
  150. var MemberTeam = function(){
  151. this.latent = [];
  152. this.ability = [0,0,0];
  153. MemberAssist.call(this);
  154. //sawoken作为可选项目,默认不在内
  155. };
  156. MemberTeam.prototype = Object.create(MemberAssist.prototype);
  157. MemberTeam.prototype.constructor = MemberTeam;
  158. MemberTeam.prototype.loadFromMember = function(m){
  159. if (m == undefined) //如果没有提供数据,直接返回默认
  160. {
  161. return;
  162. }
  163. this.id = m.id;
  164. if (m.level != undefined) this.level = m.level;
  165. if (m.awoken != undefined) this.awoken = m.awoken;
  166. if (m.plus != undefined && m.plus instanceof Array && m.plus.length>=3 && (m.plus[0]+m.plus[1]+m.plus[2])>0) this.plus = JSON.parse(JSON.stringify(m.plus));
  167. if (m.latent != undefined && m.latent instanceof Array && m.latent.length>=1) this.latent = JSON.parse(JSON.stringify(m.latent));
  168. if (m.sawoken != undefined) this.sawoken = m.sawoken;
  169. if (m.ability != undefined && m.ability instanceof Array && m.plus.length>=3) this.ability = JSON.parse(JSON.stringify(m.ability));
  170. if (m.skilllevel != undefined) this.skilllevel = m.skilllevel;
  171. };
  172. var Formation = function(teamCount,memberCount){
  173. this.title = "";
  174. this.detail = "";
  175. this.teams = [];
  176. for (let ti=0;ti<teamCount;ti++)
  177. {
  178. const team = [[],[],0]; //第三个是徽章
  179. for (let mi=0;mi<memberCount;mi++)
  180. {
  181. team[0].push(new MemberTeam());
  182. team[1].push(new MemberAssist());
  183. }
  184. this.teams.push(team);
  185. }
  186. };
  187. Formation.prototype.outObj= function(){
  188. const obj = {};
  189. if (this.title != undefined && this.title.length>0) obj.t = this.title;
  190. if (this.detail != undefined && this.detail.length>0) obj.d = this.detail;
  191. obj.f = this.teams.map(t=>
  192. {
  193. const teamArr = [];
  194. teamArr[0] = t[0].map(m=>
  195. m.outObj()
  196. );
  197. teamArr[1] = t[1].map(m=>
  198. m.outObj()
  199. );
  200. if (t[2]) teamArr[2] = t[2];
  201. return teamArr;
  202. });
  203. obj.v = dataStructure;
  204. return obj;
  205. };
  206. Formation.prototype.loadObj= function(f){
  207. const dataVeision = f.v?f.v:(f.f?2:1); //是第几版格式
  208. this.title = dataVeision>1 ? f.t : f.title;
  209. this.detail = dataVeision>1 ? f.d : f.detail;
  210. const loadTeamArr = dataVeision>1 ? f.f : f.team;
  211. this.teams.forEach(function(t,ti){
  212. const tf = loadTeamArr[ti];
  213. if (tf)
  214. {
  215. t[0].forEach(function(m,mi){
  216. const fm = tf[0][mi];
  217. m.loadObj(fm,dataVeision);
  218. });
  219. t[1].forEach(function(m,mi){
  220. const fm = tf[1][mi];
  221. m.loadObj(fm,dataVeision);
  222. });
  223. if (tf[2] != undefined) t[2] = tf[2]; //徽章
  224. }
  225. });
  226. if (f.b)
  227. this.teams[0][2] = f.b; //原来模式的徽章
  228. };
  229. //切换通用的切换className显示的函数
  230. function toggleDomClassName(checkBox, className, checkedAdd = true, dom = document.body)
  231. {
  232. if (!checkBox) return;
  233. const checked = checkBox.checked;
  234. if (checked && checkedAdd || !checked && !checkedAdd)
  235. {
  236. dom.classList.add(className);
  237. }else
  238. {
  239. dom.classList.remove(className);
  240. }
  241. }
  242. //清除数据
  243. function clearData()
  244. {
  245. const locationURL = new URL(location);
  246. locationURL.searchParams.delete('d'); //删除数据
  247. locationURL.searchParams.delete('l'); //删除语言
  248. location = locationURL.toString();
  249. }
  250. //轮换ABC队伍
  251. function swapABCteam()
  252. {
  253. if (formation.teams.length>1)
  254. {
  255. formation.teams.push(formation.teams.splice(0,1)[0]); //将队伍1移动到最后
  256. creatNewUrl();
  257. refreshAll(formation);
  258. }
  259. }
  260. //在单人和多人之间转移数据
  261. function turnPage(toPage,e = null)
  262. {
  263. console.log(e)
  264. let pagename = null;
  265. switch(toPage)
  266. {
  267. case 1:
  268. if (formation.teams[0][0].length<6)
  269. {
  270. //把第二支队伍的队长添加到最后方
  271. formation.teams[0][0].push(formation.teams[1][0][0]);
  272. formation.teams[0][1].push(formation.teams[1][1][0]);
  273. }
  274. //删掉第2支开始的队伍
  275. formation.teams.splice(1);
  276. pagename = "solo.html";
  277. break;
  278. case 2:
  279. if (formation.teams.length<2)
  280. { //从1人到2人
  281. formation.teams[1] = [[],[]];
  282. //把右边的队长加到第二支队伍最后面
  283. formation.teams[1][0].splice(0,0,formation.teams[0][0].splice(5,1)[0]);
  284. formation.teams[1][1].splice(0,0,formation.teams[0][1].splice(5,1)[0]);
  285. }else
  286. { //从3人到2人,直接删除后面两个队伍
  287. //删掉第3支开始的队伍
  288. formation.teams.splice(2);
  289. //删掉前面两支队伍的战友
  290. formation.teams[0][0].splice(5);
  291. formation.teams[0][1].splice(5);
  292. formation.teams[1][0].splice(5);
  293. formation.teams[1][1].splice(5);
  294. }
  295. formation.badge = 0;
  296. pagename = "multi.html";
  297. break;
  298. case 3:
  299. if (formation.teams.length<2)
  300. { //从1人到3人
  301. }else
  302. { //从2人到3人
  303. formation.teams[0][0].push(formation.teams[1][0][0]);
  304. formation.teams[0][1].push(formation.teams[1][1][0]);
  305. formation.teams[1][0].push(formation.teams[0][0][0]);
  306. formation.teams[1][1].push(formation.teams[0][1][0]);
  307. }
  308. formation.badge = 0;
  309. pagename = "triple.html";
  310. break;
  311. }
  312. const newURL = creatNewUrl({url:pagename, notPushState:true});
  313. if (e && e.ctrlKey)
  314. {
  315. window.open(newURL);
  316. }else
  317. {
  318. location.href = newURL;
  319. }
  320. }
  321. window.onload = function()
  322. {
  323. controlBox = document.body.querySelector(".control-box");
  324. statusLine = controlBox.querySelector(".status"); //显示当前状态的
  325. const zipClassName = 'zip-data';
  326. const zipData = controlBox.querySelector(`#${zipClassName}`);
  327. zipData.onchange = function(){
  328. localStorage.setItem("PADDF-" + zipClassName, this.checked ? 1 : 0);
  329. zipURL = this.checked;
  330. }
  331. zipData.checked = Boolean(parseInt(localStorage.getItem("PADDF-" + zipClassName)));
  332. zipData.onchange();
  333. const helpLink = controlBox.querySelector(".help-link");
  334. interchangeSVG = document.body.querySelector("#interchange-line");
  335. interchangeSVG.line = interchangeSVG.querySelector("g line");
  336. interchangeSVG.changePoint = function(p1,p2){
  337. const line = this.line;
  338. if (p1 && p1.x != undefined)
  339. line.setAttribute("x1",p1.x);
  340. if (p1 && p1.y != undefined)
  341. line.setAttribute("y1",p1.y);
  342. if (p2 && p2.x != undefined)
  343. line.setAttribute("x2",p2.x);
  344. if (p2 && p2.y != undefined)
  345. line.setAttribute("y2",p2.y);
  346. };
  347. //设定初始的显示设置
  348. toggleDomClassName(controlBox.querySelector("#show-mon-id"),'not-show-mon-id',false);
  349. toggleDomClassName(controlBox.querySelector("#btn-show-mon-skill-cd"),'show-mon-skill-cd');
  350. toggleDomClassName(controlBox.querySelector("#btn-show-awoken-count"),'not-show-awoken-count',false);
  351. isGuideMod = Boolean(parseInt(getQueryString("guide")));
  352. formationBox = document.body.querySelector(".formation-box");
  353. editBox = document.body.querySelector(".edit-box");
  354. if (isGuideMod)
  355. {
  356. console.log('现在是 怪物图鉴 模式');
  357. document.body.classList.add('guide-mod');
  358. }
  359. if (location.hostname.includes("gitee")) { helpLink.hostname = "gitee.com"; }
  360. //▼添加语言列表开始
  361. const langSelectDom = controlBox.querySelector(".languages");
  362. languageList.forEach(lang=>
  363. langSelectDom.options.add(new Option(lang.name,lang.i18n))
  364. );
  365. const parameter_i18n = getQueryString("l") || getQueryString("lang"); //获取参数指定的语言
  366. const browser_i18n = (navigator.language || navigator.userLanguage); //获取浏览器语言
  367. currentLanguage = languageList.find(lang=>{ //筛选出符合的语言
  368. if (parameter_i18n) //如果已指定就用指定的语言
  369. return parameter_i18n.includes(lang.i18n);
  370. else //否则筛选浏览器默认语言
  371. return browser_i18n.includes(lang.i18n);
  372. }) ||
  373. languageList[0]; //没有找到指定语言的情况下,自动用第一个语言(英语)
  374. document.head.querySelector("#language-css").href = "languages/"+currentLanguage.i18n+".css";
  375. const langOptionArray = Array.from(langSelectDom.options);
  376. langOptionArray.find(langOpt=>langOpt.value == currentLanguage.i18n).selected = true;
  377. //▲添加语言列表结束
  378. //▼添加数据来源列表开始
  379. const dataSelectDom = controlBox.querySelector(".datasource");
  380. dataSourceList.forEach(ds=>
  381. dataSelectDom.options.add(new Option(ds.source,ds.code))
  382. );
  383. const parameter_dsCode = getQueryString("s"); //获取参数指定的数据来源
  384. currentDataSource = parameter_dsCode?
  385. (dataSourceList.find(ds => ds.code == parameter_dsCode) || dataSourceList[0]) ://筛选出符合的数据源
  386. dataSourceList[0]; //没有指定,直接使用日服
  387. document.body.classList.add("ds-"+currentDataSource.code);
  388. const dataSourceOptionArray = Array.from(dataSelectDom.options);
  389. dataSourceOptionArray.find(dataOpt=>dataOpt.value == currentDataSource.code).selected = true;
  390. const sourceDataFolder = "monsters-info";
  391. var newCkeys; //当前的Ckey
  392. var lastCkeys; //以前Ckey们
  393. statusLine.classList.add("loading-check-version");
  394. GM_xmlhttpRequest({
  395. method: "GET",
  396. url: `${sourceDataFolder}/ckey.json`, //版本文件
  397. onload: function(response) {
  398. dealCkeyData(response.response);
  399. },
  400. onerror: function(response) {
  401. const isChrome = navigator.userAgent.includes("Chrome");
  402. if (isChrome && location.host.length==0 && response.response.length>0)
  403. {
  404. console.info("因为是Chrome本地打开,正在尝试读取JSON");
  405. dealCkeyData(response.response);
  406. }else
  407. {
  408. console.error("Ckey JSON数据获取失败",response);
  409. }
  410. }
  411. });
  412. //处理返回的数据
  413. function dealCkeyData(responseText)
  414. { //处理数据版本
  415. try
  416. {
  417. newCkeys = JSON.parse(responseText);
  418. }catch(e)
  419. {
  420. console.log("Ckey数据JSON解码出错",e);
  421. return;
  422. }
  423. const currentCkey = newCkeys.find(ckey=>ckey.code == currentDataSource.code); //获取当前语言的ckey
  424. lastCkeys = localStorage.getItem("PADDF-ckey"); //读取本地储存的原来的ckey
  425. try
  426. {
  427. lastCkeys = JSON.parse(lastCkeys);
  428. if (lastCkeys == null || !(lastCkeys instanceof Array))
  429. lastCkeys = [];
  430. }catch(e)
  431. {
  432. console.log("上次的Ckey数据JSON解码出错",e);
  433. return;
  434. }
  435. let lastCurrentCkeys = lastCkeys.find(ckey=>ckey.code == currentDataSource.code);
  436. if (!lastCurrentCkeys)
  437. { //如果未找到上个ckey,则添加个新的
  438. lastCurrentCkeys = {
  439. code: currentDataSource.code,
  440. ckey: {},
  441. updateTime: null
  442. };
  443. lastCkeys.push(lastCurrentCkeys);
  444. }
  445. statusLine.classList.remove("loading-check-version");
  446. statusLine.classList.add("loading-mon-info");
  447. if (currentCkey.ckey.card == lastCurrentCkeys.ckey.card)
  448. {
  449. console.log("Cards ckey相等,直接读取已有的数据",currentCkey.ckey.card);
  450. localforage.getItem(`PADDF-${currentDataSource.code}-cards`).then(function(value) {
  451. // This code runs once the value has been loaded
  452. // from the offline store.
  453. dealCardsData(value);
  454. }).catch(function(err) {
  455. // This code runs if there were any errors
  456. alert("Local Database error. Please refresh.");
  457. localStorage.removeItem("PADDF-ckey");
  458. console.log(err);
  459. });
  460. }else
  461. {
  462. GM_xmlhttpRequest({
  463. method: "GET",
  464. url:`${sourceDataFolder}/mon_${currentDataSource.code}.json`, //Cards数据文件
  465. onload: function(response) {
  466. console.log("Cards ckey变化,储存新数据",currentCkey.ckey.card);
  467. localforage.setItem(`PADDF-${currentDataSource.code}-cards`, JSON.parse(response.response)).then(function(){
  468. lastCurrentCkeys.ckey.card = currentCkey.ckey.card;
  469. lastCurrentCkeys.updateTime = currentCkey.updateTime;
  470. localStorage.setItem("PADDF-ckey", JSON.stringify(lastCkeys));
  471. dealCardsData(response.response);
  472. }).catch(function(err) {
  473. // This code runs if there were any errors
  474. console.log(err);
  475. });
  476. },
  477. onerror: function(response) {
  478. const isChrome = navigator.userAgent.includes("Chrome");
  479. if (isChrome && location.host.length==0 && response.response.length>0)
  480. {
  481. console.info("因为是Chrome本地打开,正在尝试读取JSON");
  482. dealCardsData(response.response);
  483. }else
  484. {
  485. console.error("Cards JSON数据获取失败",response);
  486. }
  487. }
  488. });
  489. }
  490. }
  491. function dealCardsData(response)
  492. {
  493. try
  494. {
  495. if (typeof(response) == "string")
  496. Cards = JSON.parse(response);
  497. else
  498. Cards = response;
  499. }catch(e)
  500. {
  501. console.log("Cards数据JSON解码出错",e);
  502. return;
  503. }
  504. statusLine.classList.remove("loading-mon-info");
  505. statusLine.classList.add("loading-skill-info");
  506. const currentCkey = newCkeys.find(ckey=>ckey.code == currentDataSource.code); //获取当前语言的ckey
  507. const lastCurrentCkeys = lastCkeys.find(ckey=>ckey.code == currentDataSource.code);
  508. if (currentCkey.ckey.skill == lastCurrentCkeys.ckey.skill)
  509. {
  510. console.log("Skills ckey相等,直接读取已有的数据",currentCkey.ckey.skill);
  511. localforage.getItem(`PADDF-${currentDataSource.code}-skills`).then(function(value) {
  512. // This code runs once the value has been loaded
  513. // from the offline store.
  514. dealSkillData(value);
  515. }).catch(function(err) {
  516. // This code runs if there were any errors
  517. alert("Local Database error. Please refresh.");
  518. localStorage.removeItem("PADDF-ckey");
  519. console.log(err);
  520. });
  521. }else
  522. {
  523. GM_xmlhttpRequest({
  524. method: "GET",
  525. url:`${sourceDataFolder}/skill_${currentDataSource.code}.json`, //Skills数据文件
  526. onload: function(response) {
  527. console.log("Skills ckey变化,储存新数据",currentCkey.ckey.skill);
  528. localforage.setItem(`PADDF-${currentDataSource.code}-skills`, JSON.parse(response.response)).then(function(){
  529. lastCurrentCkeys.ckey.skill = currentCkey.ckey.skill;
  530. lastCurrentCkeys.updateTime = currentCkey.updateTime;
  531. localStorage.setItem("PADDF-ckey", JSON.stringify(lastCkeys));
  532. dealSkillData(response.response);
  533. }).catch(function(err) {
  534. // This code runs if there were any errors
  535. console.log(err);
  536. });
  537. },
  538. onerror: function(response) {
  539. let isChrome = navigator.userAgent.includes("Chrome");
  540. if (isChrome && location.host.length==0 && response.response.length>0)
  541. {
  542. console.info("因为是Chrome本地打开,正在尝试读取JSON");
  543. dealSkillData(response.response);
  544. }else
  545. {
  546. console.error("Skills JSON数据获取失败",response);
  547. }
  548. }
  549. });
  550. }
  551. }
  552. function dealSkillData(response)
  553. {
  554. try
  555. {
  556. if (typeof(response) == "string")
  557. Skills = JSON.parse(response);
  558. else
  559. Skills = response;
  560. }catch(e)
  561. {
  562. console.log("Skills数据JSON解码出错",e);
  563. return;
  564. }
  565. const currentCkey = newCkeys.find(ckey=>ckey.code == currentDataSource.code);
  566. const updateTime = controlBox.querySelector(".datasource-updatetime");
  567. updateTime.innerHTML = new Date(currentCkey.updateTime).toLocaleString(undefined,{hour12: false});
  568. initialize();//初始化
  569. statusLine.classList.remove("loading-skill-info");
  570. //如果通过的话就载入URL中的怪物数据
  571. reloadFormationData();
  572. }
  573. };
  574. //重新读取URL中的Data数据并刷新页面
  575. function reloadFormationData()
  576. {
  577. let formationData;
  578. try
  579. {
  580. let parameterDataString = getQueryString("d") || getQueryString("data");
  581. if (parameterDataString)
  582. {
  583. if (parameterDataString.charAt(0) != '{')
  584. {
  585. console.log('数据字符串:',parameterDataString.length,parameterDataString);
  586. parameterDataString = pako.inflate(parameterDataString,{to:'string'})
  587. console.log('数据字符串解压结果:',parameterDataString.length,parameterDataString);
  588. }
  589. formationData = JSON.parse(parameterDataString);
  590. }
  591. }catch(e)
  592. {
  593. console.error("URL中队伍数据JSON解码出错",e);
  594. return;
  595. }
  596. if (formationData)
  597. {
  598. formation.loadObj(formationData);
  599. refreshAll(formation);
  600. }
  601. }
  602. window.onpopstate = reloadFormationData; //前进后退时修改页面
  603. //创建新的分享地址
  604. function creatNewUrl(arg){
  605. if (arg == undefined) arg = {};
  606. if (!!(window.history && history.pushState))
  607. { // 支持History API
  608. const language_i18n = arg.language || getQueryString("l") || getQueryString("lang"); //获取参数指定的语言
  609. const datasource = arg.datasource || getQueryString("s");
  610. const outObj = formation.outObj();
  611. const newSearch = new URLSearchParams();
  612. if (language_i18n) newSearch.set("l",language_i18n);
  613. if (datasource && datasource!="ja") newSearch.set("s",datasource);
  614. const dataJsonStr = JSON.stringify(outObj); //数据部分的字符串
  615. if (zipURL.checked)
  616. {
  617. const deflate = pako.deflate(dataJsonStr,{to:'string'});
  618. const teamSearch1 = new URLSearchParams();
  619. const teamSearch2 = new URLSearchParams();
  620. teamSearch1.set('d',dataJsonStr);
  621. teamSearch2.set('d',deflate);
  622. if (outObj) newSearch.set("d",
  623. teamSearch2.length < teamSearch1.length ? //压缩后长度小于压缩前长度
  624. deflate : //使用压缩字符串
  625. dataJsonStr); //使用原始字符串
  626. }else
  627. {
  628. newSearch.set("d", dataJsonStr);
  629. }
  630. const newUrl = (arg.url || "") + '?' + newSearch.toString();
  631. if (!arg.notPushState)
  632. {
  633. history.pushState(null, null, newUrl);
  634. }
  635. else
  636. {
  637. return newUrl;
  638. }
  639. }
  640. }
  641. //截图
  642. function capture()
  643. {
  644. statusLine.classList.add("prepare-cauture");
  645. const titleBox = formationBox.querySelector(".title-box");
  646. const detailBox = formationBox.querySelector(".detail-box");
  647. const txtTitle = titleBox.querySelector(".title");
  648. const txtDetail = detailBox.querySelector(".detail");
  649. //去掉可能的空白文字的编辑状态
  650. titleBox.classList.remove("edit");
  651. detailBox.classList.remove("edit");
  652. const downLink = controlBox.querySelector(".down-capture");
  653. html2canvas(formationBox).then(canvas => {
  654. canvas.toBlob(function(blob) {
  655. window.URL.revokeObjectURL(downLink.href);
  656. downLink.href = URL.createObjectURL(blob);
  657. downLink.download = `${teamsCount}P formation cauture.png`;
  658. downLink.click();
  659. statusLine.classList.remove("prepare-cauture");
  660. //如果是空白文字,加回编辑状态
  661. if (txtTitle.value.length==0)
  662. titleBox.classList.add("edit");
  663. if (txtDetail.value.length==0)
  664. detailBox.classList.add("edit");
  665. });
  666. //document.body.appendChild(canvas);
  667. });
  668. }
  669. //初始化
  670. function initialize()
  671. {
  672. const monstersList = editBox.querySelector("#monsters-name-list");
  673. let fragment = document.createDocumentFragment();
  674. Cards.forEach(function(m){ //添加下拉框候选
  675. const opt = fragment.appendChild(document.createElement("option"));
  676. opt.value = m.id;
  677. opt.label = m.id + " - " + returnMonsterNameArr(m, currentLanguage.searchlist, currentDataSource.code).join(" | ");
  678. const linkRes = new RegExp("link:(\\d+)","ig").exec(m.specialAttribute);
  679. if (linkRes)
  680. {//每个有链接的符卡,把它们被链接的符卡的进化根修改到链接前的
  681. const _m = Cards[parseInt(linkRes[1],10)];
  682. _m.evoRootId = m.evoRootId;
  683. m.henshinFrom = true;
  684. _m.henshinTo = true;
  685. }
  686. });
  687. monstersList.appendChild(fragment);
  688. //标题和介绍文本框
  689. const titleBox = formationBox.querySelector(".title-box");
  690. const detailBox = formationBox.querySelector(".detail-box");
  691. const txtTitle = titleBox.querySelector(".title");
  692. const txtDetail = detailBox.querySelector(".detail");
  693. const txtTitleDisplay = titleBox.querySelector(".title-display");
  694. const txtDetailDisplay = detailBox.querySelector(".detail-display");
  695. txtTitle.onchange = function(){
  696. formation.title = this.value;
  697. //txtTitleDisplay.innerHTML = "";
  698. //txtTitleDisplay.appendChild(document.createTextNode(this.value));
  699. txtTitleDisplay.innerHTML = descriptionToHTML(this.value);
  700. creatNewUrl();
  701. };
  702. txtTitle.onblur = function(){
  703. if (this.value.length>0)
  704. titleBox.classList.remove("edit");
  705. };
  706. txtDetail.onchange = function(){
  707. formation.detail = this.value;
  708. /*txtDetailDisplay.innerHTML = "";
  709. const txtDetailLines = this.value.split("\n");
  710. txtDetailLines.forEach((line,idx)=>{
  711. if (idx>0) txtDetailDisplay.appendChild(document.createElement("br"));
  712. txtDetailDisplay.appendChild(document.createTextNode(line));
  713. });*/
  714. txtDetailDisplay.innerHTML = descriptionToHTML(this.value);
  715. creatNewUrl();
  716. };
  717. txtDetail.onblur = function(){
  718. if (this.value.length>0)
  719. detailBox.classList.remove("edit");
  720. this.style.height = txtDetailDisplay.scrollHeight+"px";
  721. };
  722. txtTitleDisplay.onclick = function(){
  723. titleBox.classList.add("edit");
  724. txtTitle.focus();
  725. };
  726. txtDetailDisplay.onclick = function(){
  727. detailBox.classList.add("edit");
  728. txtDetail.focus();
  729. };
  730. //这个写法的目的其实是为了确保添加顺序与1、2、3一致,即便打乱了顺序,也能正确添加
  731. for (let ti=0,ti_len=formationBox.querySelectorAll(".team-bigbox").length;ti<ti_len;ti++)
  732. {
  733. teamBigBoxs.push(formationBox.querySelector(`.teams .team-${ti+1}`));
  734. }
  735. //将所有怪物头像添加到全局数组
  736. teamBigBoxs.forEach(teamBigBox=>{
  737. const teamBox = teamBigBox.querySelector(".team-box");
  738. const menbers = Array.from(teamBox.querySelectorAll(".team-members .monster"));
  739. const assist = Array.from(teamBox.querySelectorAll(".team-assist .monster"));
  740. menbers.forEach(m=>{
  741. allMembers.push(m);
  742. });
  743. assist.forEach(m=>{
  744. allMembers.push(m);
  745. });
  746. });
  747. //所有怪物头像,添加拖动交换的代码
  748. allMembers.forEach(m=>{
  749. //点击
  750. m.onclick = clickMonHead;
  751. //拖动
  752. m.draggable = true;
  753. m.ondragstart = dragStartMonHead;
  754. m.ondragover = dropOverMonHead;
  755. m.ondrop = dropMonHead;
  756. //触摸
  757. m.ontouchstart = touchstartMonHead;
  758. m.ontouchmove = touchmoveMonHead;
  759. m.ontouchend = touchendMonHead;
  760. m.ontouchcancel = touchcancelMonHead;
  761. });
  762. //添加徽章
  763. const className_ChoseBadges = "show-all-badges";
  764. teamBigBoxs.forEach((teamBigBox,teamIdx)=>{
  765. //徽章
  766. const teamBadge = teamBigBox.querySelector(".team-badge");
  767. if (!teamBadge) return;
  768. const badges = Array.from(teamBadge.querySelectorAll(".badge-radio"));
  769. function setBadge(){
  770. if (teamBadge.classList.contains(className_ChoseBadges))
  771. {
  772. const team = formation.teams[teamIdx];
  773. teamBadge.classList.remove(className_ChoseBadges);
  774. team[2] = parseInt(this.value,10);
  775. const teamTotalInfoDom = teamBigBox.querySelector(".team-total-info"); //队伍能力值合计
  776. refreshTeamTotalHP(teamTotalInfoDom, team);
  777. creatNewUrl();
  778. }else
  779. {
  780. teamBadge.classList.add(className_ChoseBadges);
  781. }
  782. }
  783. badges.forEach(badge => badge.onclick = setBadge);
  784. });
  785. //编辑框
  786. editBox.mid = null; //储存怪物id
  787. editBox.latent = []; //储存潜在觉醒
  788. editBox.isAssist = false; //储存是否为辅助宠物
  789. editBox.monsterHead = null;
  790. editBox.latentBox = null;
  791. editBox.memberIdx = []; //储存队伍数组下标
  792. editBox.show = function(){
  793. this.classList.remove(className_displayNone);
  794. formationBox.classList.add("blur-bg");
  795. controlBox.classList.add("blur-bg");
  796. };
  797. editBox.hide = function(){
  798. this.classList.add(className_displayNone);
  799. formationBox.classList.remove("blur-bg");
  800. controlBox.classList.remove("blur-bg");
  801. };
  802. const smonsterinfoBox = editBox.querySelector(".monsterinfo-box");
  803. const mSeriesId = smonsterinfoBox.querySelector(".monster-seriesId");
  804. mSeriesId.onclick = function(){ //搜索系列
  805. const seriesId = parseInt(this.getAttribute('data-seriesId'),10);
  806. if (seriesId>0)
  807. {
  808. showSearch(Cards.filter(card=>{return card.seriesId == seriesId;}));
  809. }
  810. };
  811. const mCollabId = smonsterinfoBox.querySelector(".monster-collabId");
  812. mCollabId.onclick = function(){ //搜索合作
  813. const collabId = parseInt(this.getAttribute('data-collabId'),10);
  814. if (collabId>0);
  815. {
  816. searchColla(collabId);
  817. }
  818. };
  819. const mAltName = smonsterinfoBox.querySelector(".monster-altName");
  820. mAltName.onclick = function(){ //搜索合作
  821. const altName = this.getAttribute('data-altName');
  822. const splitAltName = altName.split("|");
  823. if (altName.length>0);
  824. {
  825. showSearch(Cards.filter(card=>{
  826. return splitAltName.some(alt=>{
  827. return alt.length > 0 && (card.altName.includes(alt) || card.name.includes(alt));
  828. });
  829. }));
  830. }
  831. };
  832. //创建一个新的怪物头像
  833. editBox.createCardHead = function(id)
  834. {
  835. function clickHeadToNewMon()
  836. {
  837. monstersID.value = this.getAttribute("data-cardid");
  838. monstersID.onchange();
  839. return false; //取消链接的默认操作
  840. }
  841. const cli = document.createElement("li");
  842. const cdom = cli.head = createCardA(id);
  843. cli.appendChild(cdom);
  844. changeid({id:id},cdom);
  845. cli.card = Cards[id];
  846. cdom.onclick = clickHeadToNewMon;
  847. return cli;
  848. };
  849. const searchBox = editBox.querySelector(".search-box");
  850. const settingBox = editBox.querySelector(".setting-box");
  851. const searchOpen = settingBox.querySelector(".row-mon-id .open-search");
  852. searchOpen.onclick = function(){
  853. s_includeSuperAwoken.onclick();
  854. s_canAssist.onclick();
  855. searchBox.classList.toggle(className_displayNone);
  856. };
  857. const s_attr1s = Array.from(searchBox.querySelectorAll(".attrs .attr-list-1 .attr-radio"));
  858. const s_attr2s = Array.from(searchBox.querySelectorAll(".attrs .attr-list-2 .attr-radio"));
  859. const s_fixMainColor = searchBox.querySelector("#fix-main-color");
  860. const s_types = Array.from(searchBox.querySelectorAll(".types-div .type-check"));
  861. const s_typeAndOr = searchBox.querySelector("#type-and-or");
  862. const s_awokensItems = Array.from(searchBox.querySelectorAll(".awoken-div .awoken-count"));
  863. const s_awokensIcons = s_awokensItems.map(it=>it.querySelector(".awoken-icon"));
  864. const s_awokensCounts = s_awokensItems.map(it=>it.querySelector(".count"));
  865. const searchMonList = searchBox.querySelector(".search-mon-list"); //搜索结果列表
  866. searchMonList.originalHeads = null; //用于存放原始搜索结果
  867. const s_awokensEquivalent = searchBox.querySelector("#consider-equivalent-awoken"); //搜索等效觉醒
  868. const s_canAssist = searchBox.querySelector("#can-assist"); //只搜索辅助
  869. s_canAssist.onclick = function(){
  870. toggleDomClassName(this, "only-display-can-assist", true, searchMonList);
  871. };
  872. const s_sawokenDiv = searchBox.querySelector(".sawoken-div");
  873. const s_sawokens = Array.from(s_sawokenDiv.querySelectorAll(".sawoken-check"));
  874. const s_includeSuperAwoken = searchBox.querySelector("#include-super-awoken"); //搜索超觉醒
  875. s_includeSuperAwoken.onclick = function(){
  876. toggleDomClassName(this, className_displayNone, true, s_sawokenDiv);
  877. };
  878. function search_awokenAdd1()
  879. {
  880. const countDom = this.parentNode.querySelector(".count");
  881. let count = parseInt(countDom.value,10);
  882. if (count<9)
  883. {
  884. count++;
  885. countDom.value = count;
  886. this.parentNode.classList.remove("zero");
  887. }
  888. }
  889. s_awokensIcons.forEach((b,idx)=>{ //每种觉醒增加1
  890. b.onclick = search_awokenAdd1;
  891. });
  892. function search_awokenSub1()
  893. {
  894. let count = parseInt(this.value,10);
  895. if (count>0)
  896. {
  897. count--;
  898. this.value = count;
  899. if (count === 0)
  900. {
  901. this.parentNode.parentNode.classList.add("zero");
  902. }
  903. }
  904. }
  905. s_awokensCounts.forEach((b,idx)=>{ //每种觉醒减少1
  906. b.onclick = search_awokenSub1;
  907. });
  908. const awokenClear = searchBox.querySelector(".awoken-div .awoken-clear");
  909. const sawokenClear = searchBox.querySelector(".sawoken-div .sawoken-clear");
  910. awokenClear.onclick = function(){ //清空觉醒选项
  911. s_awokensCounts.forEach(t=>{
  912. t.value = 0;
  913. });
  914. s_awokensItems.forEach(t=>{
  915. t.classList.add("zero");
  916. });
  917. };
  918. sawokenClear.onclick = function(){ //清空超觉醒选项
  919. s_sawokens.forEach(t=>{
  920. t.checked = false;
  921. });
  922. };
  923. const s_controlDiv = searchBox.querySelector(".control-div");
  924. const searchStart = s_controlDiv.querySelector(".search-start");
  925. const searchClose = s_controlDiv.querySelector(".search-close");
  926. const searchClear = s_controlDiv.querySelector(".search-clear");
  927. function returnCheckedInput(ipt)
  928. {
  929. return ipt.checked;
  930. }
  931. function returnInputValue(ipt)
  932. {
  933. return ipt.value;
  934. }
  935. function Str2Int(str)
  936. {
  937. return parseInt(str, 10);
  938. }
  939. //将搜索结果显示出来(也可用于其他的搜索)
  940. showSearch = function(searchArr){
  941. editBox.show();
  942. searchBox.classList.remove(className_displayNone);
  943. const createCardHead = editBox.createCardHead;
  944. searchMonList.classList.add(className_displayNone);
  945. searchMonList.innerHTML = ""; //清空旧的
  946. if (searchArr.length>0)
  947. {
  948. let fragment = document.createDocumentFragment(); //创建节点用的临时空间
  949. //获取原始排序的头像列表
  950. searchMonList.originalHeads = searchArr.map(card=>createCardHead(card.id));
  951. //对头像列表进行排序
  952. const headsArray = sortHeadsArray(searchMonList.originalHeads);
  953. headsArray.forEach(head=>fragment.appendChild(head));
  954. searchMonList.appendChild(fragment);
  955. }
  956. searchMonList.classList.remove(className_displayNone);
  957. };
  958. const startSearch = function(cards){
  959. const attr1Filter = s_attr1s.filter(returnCheckedInput).map(returnInputValue);
  960. const attr2Filter = s_attr2s.filter(returnCheckedInput).map(returnInputValue);
  961. let attr1,attr2;
  962. if (attr1Filter.length>0)
  963. {
  964. if (!isNaN(attr1Filter[0]))
  965. {
  966. attr1 = parseInt(attr1Filter[0],10);
  967. }else
  968. {
  969. attr1 = null;
  970. }
  971. }
  972. if (attr2Filter.length>0)
  973. {
  974. if (!isNaN(attr2Filter[0]))
  975. {
  976. attr2 = parseInt(attr2Filter[0],10);
  977. }else
  978. {
  979. attr2 = null;
  980. }
  981. }
  982. const typesFilter = s_types.filter(returnCheckedInput).map(returnInputValue).map(Str2Int);
  983. const sawokensFilter = s_sawokens.filter(returnCheckedInput).map(returnInputValue).map(Str2Int);
  984. const awokensFilter = s_awokensCounts.filter(btn=>parseInt(btn.value,10)>0).map(btn=>{
  985. const awokenIndex = parseInt(btn.parentNode.parentNode.querySelector(".awoken-icon").getAttribute("data-awoken-icon"),10);
  986. return {id:awokenIndex,num:parseInt(btn.value,10)};
  987. });
  988. const searchResult = searchCards(cards,
  989. attr1,attr2,
  990. s_fixMainColor.checked,
  991. typesFilter,
  992. s_typeAndOr.checked,
  993. awokensFilter,
  994. sawokensFilter,
  995. s_awokensEquivalent.checked,
  996. s_includeSuperAwoken.checked
  997. );
  998. console.log("搜索结果",searchResult);
  999. showSearch(searchResult);
  1000. };
  1001. searchBox.startSearch = startSearch;
  1002. searchStart.onclick = function(){
  1003. startSearch(Cards);
  1004. };
  1005. searchClose.onclick = function(){
  1006. searchBox.classList.add(className_displayNone);
  1007. };
  1008. searchClear.onclick = function(){ //清空搜索选项
  1009. s_attr1s[0].checked = true;
  1010. s_attr2s[0].checked = true;
  1011. s_types.forEach(t=>{
  1012. t.checked = false;
  1013. });
  1014. s_awokensCounts.forEach(t=>{
  1015. t.value = 0;
  1016. });
  1017. s_awokensItems.forEach(t=>{
  1018. t.classList.add("zero");
  1019. });
  1020. // 这些觉醒的选项干脆都不清除
  1021. //s_awokensEquivalent.checked = false;
  1022. //if (s_includeSuperAwoken.checked) s_includeSuperAwoken.click();
  1023. s_sawokens.forEach(t=>{
  1024. t.checked = false;
  1025. });
  1026. searchMonList.originalHeads = null;
  1027. searchMonList.innerHTML = "";
  1028. };
  1029. const s_sortList = s_controlDiv.querySelector(".sort-list");
  1030. const s_sortReverse = s_controlDiv.querySelector("#sort-reverse");
  1031. //对heads重新排序
  1032. function sortHeadsArray(heads)
  1033. {
  1034. if (!heads || heads.length === 0) return; //没有数据时,直接返回
  1035. const sortIndex = parseInt(s_sortList.value,10);
  1036. const reverse = s_sortReverse.checked;
  1037. let headsArray = heads.concat();
  1038. headsArray.sort((head_a,head_b)=>{
  1039. const card_a = head_a.card,card_b = head_b.card;
  1040. let sortNumber = sort_function_list[sortIndex].function(card_a,card_b);
  1041. //if (reverse) sortNumber *= -1; //会导致默认情况无法逆序
  1042. return sortNumber;
  1043. });
  1044. if (reverse) headsArray.reverse();
  1045. return headsArray;
  1046. }
  1047. //对搜索到的Cards重新排序
  1048. function reSortCards()
  1049. {
  1050. const headsArray = sortHeadsArray(searchMonList.originalHeads);
  1051. if (!headsArray || headsArray.length === 0) return; //没有数据时,直接返回
  1052. searchMonList.classList.add(className_displayNone);
  1053. let fragment = document.createDocumentFragment(); //创建节点用的临时空间
  1054. headsArray.forEach(head=>fragment.appendChild(head));
  1055. searchMonList.appendChild(fragment);
  1056. searchMonList.classList.remove(className_displayNone);
  1057. }
  1058. s_sortList.onchange = reSortCards;
  1059. s_sortReverse.onchange = reSortCards;
  1060. sort_function_list.forEach((sfunc,idx)=>{
  1061. const newOpt = new Option(sfunc.name,idx);
  1062. newOpt.setAttribute("data-tag",sfunc.tag);
  1063. s_sortList.options.add(newOpt);
  1064. });
  1065. //id搜索
  1066. const monstersID = settingBox.querySelector(".row-mon-id .m-id");
  1067. monstersID.onchange = function(){
  1068. if (/^\d+$/.test(this.value))
  1069. {
  1070. const newId = parseInt(this.value, 10);
  1071. if (editBox.mid != newId) //避免多次运行oninput、onchange
  1072. {
  1073. editBox.mid = newId;
  1074. editBoxChangeMonId(editBox.mid);
  1075. }
  1076. }
  1077. };
  1078. monstersID.oninput = monstersID.onchange;
  1079. //觉醒
  1080. const monEditAwokensRow = settingBox.querySelector(".row-mon-awoken");
  1081. const awokenCountLabel = monEditAwokensRow.querySelector(".awoken-count");
  1082. const monEditAwokens = Array.from(monEditAwokensRow.querySelectorAll(".awoken-ul input[name='awoken-number']"));
  1083. function checkAwoken(){
  1084. const card = Cards[editBox.mid];
  1085. const value = parseInt(this.value,10);
  1086. awokenCountLabel.innerHTML = value;
  1087. if (value>0 && value==(card.awakenings.length))
  1088. awokenCountLabel.classList.add("full-awoken");
  1089. else
  1090. awokenCountLabel.classList.remove("full-awoken");
  1091. reCalculateAbility();
  1092. }
  1093. monEditAwokens.forEach(akDom=>akDom.onclick = checkAwoken);
  1094. const monEditAwokensLabel = Array.from(monEditAwokensRow.querySelectorAll(".awoken-ul .awoken-icon"));
  1095. function playVoiceAwoken(){ //点击label才播放语音
  1096. const card = Cards[editBox.mid];
  1097. if (parseInt(this.getAttribute("data-awoken-icon"),10) === 63)
  1098. {
  1099. let decoder = new Adpcm(adpcm_wasm, pcmImportObj);
  1100. decoder.resetDecodeState(new Adpcm.State(0, 0));
  1101. decodeAudio(`sound/voice/${currentDataSource.code}/padv${PrefixInteger(card.voiceId,3)}.wav`, decoder.decode.bind(decoder));
  1102. }
  1103. }
  1104. monEditAwokensLabel.forEach(akDom=>akDom.onclick = playVoiceAwoken);
  1105. //超觉醒
  1106. const monEditSAwokensRow = settingBox.querySelector(".row-mon-super-awoken");
  1107. monEditSAwokensRow.swaokenIndex = -1;
  1108. const monEditSAwokens = Array.from(monEditSAwokensRow.querySelectorAll(".awoken-ul input[name='sawoken-choice']"));
  1109. function notCheckMyself(){
  1110. const value = parseInt(this.value,10);
  1111. if (value>=0 && monEditSAwokensRow.swaokenIndex === value)
  1112. {
  1113. monEditSAwokens[0].click();
  1114. }else
  1115. {
  1116. monEditSAwokensRow.swaokenIndex = value;
  1117. }
  1118. }
  1119. monEditSAwokens.forEach(akDom=>{
  1120. akDom.onclick = notCheckMyself;
  1121. });
  1122. //3个快速设置this.ipt为自己的value
  1123. function setIptToMyValue()
  1124. {
  1125. if (this.ipt.value != this.value)
  1126. {
  1127. this.ipt.value = this.value;
  1128. this.ipt.onchange();
  1129. }
  1130. }
  1131. //等级
  1132. const monEditLv = settingBox.querySelector(".m-level");
  1133. monEditLv.onchange = function(){
  1134. reCalculateExp();
  1135. reCalculateAbility();
  1136. };
  1137. const monEditLvMin = settingBox.querySelector(".m-level-btn-min");
  1138. const monLvExp = settingBox.querySelector(".m-level-exp");
  1139. monEditLvMin.ipt = monEditLv;
  1140. monEditLvMin.onclick = setIptToMyValue;
  1141. const monEditLvMax = settingBox.querySelector(".m-level-btn-max");
  1142. monEditLvMax.ipt = monEditLv;
  1143. monEditLvMax.onclick = setIptToMyValue;
  1144. const monEditLv110 = settingBox.querySelector(".m-level-btn-110");
  1145. monEditLv110.ipt = monEditLv;
  1146. monEditLv110.onclick = setIptToMyValue;
  1147. //编辑界面重新计算怪物的经验值
  1148. function reCalculateExp(){
  1149. const monid = parseInt(monstersID.value || 0, 10);
  1150. const level = parseInt(monEditLv.value || 0, 10);
  1151. const tempMon = {
  1152. id:monid,
  1153. level:level
  1154. };
  1155. const needExp = calculateExp(tempMon);
  1156. monLvExp.innerHTML = needExp ? parseBigNumber(needExp[0]) + (level>99?` + ${parseBigNumber(needExp[1])}` : "") : "";
  1157. }
  1158. editBox.reCalculateExp = reCalculateExp;
  1159. //三维
  1160. const rowMonAbility = settingBox.querySelector(".row-mon-ability");
  1161. const monEditHpValue = rowMonAbility.querySelector(".m-hp-li .ability-value");
  1162. const monEditAtkValue = rowMonAbility.querySelector(".m-atk-li .ability-value");
  1163. const monEditRcvValue = rowMonAbility.querySelector(".m-rcv-li .ability-value");
  1164. //加蛋
  1165. const rowMonPlus = settingBox.querySelector(".row-mon-plus");
  1166. const monEditAddHpLi = rowMonPlus.querySelector(".m-hp-li");
  1167. const monEditAddAtkLi = rowMonPlus.querySelector(".m-atk-li");
  1168. const monEditAddRcvLi = rowMonPlus.querySelector(".m-rcv-li");
  1169. const monEditAddHp = monEditAddHpLi.querySelector(".m-plus-hp");
  1170. monEditAddHp.onchange = reCalculateAbility;
  1171. const monEditAddAtk = monEditAddAtkLi.querySelector(".m-plus-atk");
  1172. monEditAddAtk.onchange = reCalculateAbility;
  1173. const monEditAddRcv = monEditAddRcvLi.querySelector(".m-plus-rcv");
  1174. monEditAddRcv.onchange = reCalculateAbility;
  1175. //3个快速设置按钮
  1176. const monEditAddHpBtn = monEditAddHpLi.querySelector(".m-plus-btn");
  1177. monEditAddHpBtn.ipt = monEditAddHp;
  1178. monEditAddHpBtn.onclick = setIptToMyValue;
  1179. const monEditAddAtkBtn = monEditAddAtkLi.querySelector(".m-plus-btn");
  1180. monEditAddAtkBtn.ipt = monEditAddAtk;
  1181. monEditAddAtkBtn.onclick = setIptToMyValue;
  1182. const monEditAddRcvBtn = monEditAddRcvLi.querySelector(".m-plus-btn");
  1183. monEditAddRcvBtn.ipt = monEditAddRcv;
  1184. monEditAddRcvBtn.onclick = setIptToMyValue;
  1185. //297按钮
  1186. const monEditAdd297 = rowMonPlus.querySelector(".m-plus-btn-297");
  1187. monEditAdd297.onclick = function(){
  1188. monEditAddHp.value = 99;
  1189. monEditAddAtk.value = 99;
  1190. monEditAddRcv.value = 99;
  1191. reCalculateAbility();
  1192. };
  1193. //潜觉
  1194. const monEditLatentUl = settingBox.querySelector(".m-latent-ul");
  1195. const monEditLatents = Array.from(monEditLatentUl.querySelectorAll("li"));
  1196. const monEditLatentAllowableUl = settingBox.querySelector(".m-latent-allowable-ul");
  1197. const monEditLatentsAllowable = Array.from(monEditLatentAllowableUl.querySelectorAll("li"));
  1198. editBox.refreshLatent = function(latent,monid) //刷新潜觉
  1199. {
  1200. refreshLatent(latent,monid,monEditLatents);
  1201. };
  1202. const hideClassName = 'hide-less-use-latent';
  1203. const s_hideLessUseLetent = settingBox.querySelector(`#${hideClassName}`);
  1204. s_hideLessUseLetent.onchange = function(){
  1205. toggleDomClassName(this, hideClassName, true, monEditLatentAllowableUl);
  1206. localStorage.setItem("PADDF-" + hideClassName, this.checked ? 1 : 0);
  1207. }
  1208. s_hideLessUseLetent.checked = Boolean(parseInt(localStorage.getItem("PADDF-" + hideClassName)));
  1209. s_hideLessUseLetent.onchange();
  1210. if (isGuideMod)
  1211. monEditLatentAllowableUl.querySelector('.latent-icon[data-latent-icon="11"]').classList.remove('frequent');
  1212. const rowSkill = settingBox.querySelector(".row-mon-skill");
  1213. const skillBox = rowSkill.querySelector(".skill-box");
  1214. const skillTitle = skillBox.querySelector(".skill-name");
  1215. const skillCD = skillBox.querySelector(".skill-cd");
  1216. const skillLevel = skillBox.querySelector(".m-skill-level");
  1217. const skillLevel_1 = skillBox.querySelector(".m-skill-lv-1");
  1218. const skillLevel_Max = skillBox.querySelector(".m-skill-lv-max");
  1219. skillTitle.onclick = function(){
  1220. const skillId = parseInt(this.getAttribute("data-skillid"),10); //获得当前技能ID
  1221. const s_cards = Cards.filter(card=>card.activeSkillId === skillId); //搜索同技能怪物
  1222. if (s_cards.length > 1)
  1223. {
  1224. showSearch(s_cards); //显示
  1225. }
  1226. };
  1227. skillLevel.onchange = function(){
  1228. const card = Cards[editBox.mid] || Cards[0]; //怪物固定数据
  1229. const skill = Skills[card.activeSkillId];
  1230. skillCD.innerHTML = skill.initialCooldown - this.value + 1;
  1231. };
  1232. skillLevel_1.ipt = skillLevel;
  1233. skillLevel_1.onclick = setIptToMyValue;
  1234. skillLevel_Max.ipt = skillLevel;
  1235. skillLevel_Max.onclick = setIptToMyValue;
  1236. //已有觉醒的去除
  1237. function deleteLatent(){
  1238. const aIdx = monEditLatents.filter(l=>!l.classList.contains(className_displayNone)).findIndex(l=>l==this);
  1239. editBox.latent.splice(aIdx,1);
  1240. editBox.reCalculateAbility(); //重计算三维
  1241. editBox.refreshLatent(editBox.latent,editBox.mid); //刷新潜觉
  1242. }
  1243. monEditLatents.forEach(la=>la.onclick = deleteLatent);
  1244. //可选觉醒的添加
  1245. function addLatent(){
  1246. if (this.classList.contains("unselected-latent")) return; //不能选的觉醒直接退出
  1247. const lIdx = parseInt(this.getAttribute("data-latent-icon"),10); //潜觉的序号
  1248. const maxLatentCount = getMaxLatentCount(editBox.mid); //最大潜觉数量
  1249. const usedHoleN = usedHole(editBox.latent); //已经使用了的格子
  1250. const enabledHole = maxLatentCount - usedHoleN; //还剩余的格子
  1251. if (latentUseHole(lIdx) <= enabledHole)
  1252. editBox.latent.push(lIdx);
  1253. else
  1254. return;
  1255. editBox.reCalculateAbility();
  1256. editBox.refreshLatent(editBox.latent,editBox.mid);
  1257. }
  1258. monEditLatentsAllowable.forEach(la=>la.onclick = addLatent);
  1259. //编辑界面重新计算怪物的能力
  1260. function reCalculateAbility(){
  1261. const monid = parseInt(monstersID.value || 0, 10);
  1262. const level = parseInt(monEditLv.value || 0, 10);
  1263. const mAwokenNumIpt = monEditAwokensRow.querySelector("input[name='awoken-number']:checked");
  1264. const awoken = mAwokenNumIpt ? parseInt(mAwokenNumIpt.value,10) : 0;
  1265. const plus = [
  1266. parseInt(monEditAddHp.value || 0, 10),
  1267. parseInt(monEditAddAtk.value || 0, 10),
  1268. parseInt(monEditAddRcv.value || 0, 10)
  1269. ];
  1270. const latent = editBox.latent;
  1271. const tempMon = {
  1272. id:monid,
  1273. level:level,
  1274. plus:plus,
  1275. awoken:awoken,
  1276. latent:latent
  1277. };
  1278. const abilitys = calculateAbility(tempMon, null, solo, teamsCount) || [0,0,0];
  1279. monEditHpValue.innerHTML = abilitys[0].toLocaleString();
  1280. monEditAtkValue.innerHTML = abilitys[1].toLocaleString();
  1281. monEditRcvValue.innerHTML = abilitys[2].toLocaleString();
  1282. }
  1283. editBox.reCalculateAbility = reCalculateAbility;
  1284. const btnCancel = editBox.querySelector(".button-cancel");
  1285. const btnDone = editBox.querySelector(".button-done");
  1286. const btnNull = editBox.querySelector(".button-null");
  1287. const btnDelay = editBox.querySelector(".button-delay");
  1288. btnCancel.onclick = function(){
  1289. btnDone.classList.remove("cant-assist");
  1290. btnDone.disabled = false;
  1291. editBox.memberIdx = [];
  1292. editBox.hide();
  1293. };
  1294. btnDone.onclick = function(){
  1295. if (parseInt(monEditLv.value,10) == 0)
  1296. {
  1297. btnNull.onclick();
  1298. return;
  1299. }
  1300. const mon = editBox.isAssist ? new MemberAssist() : new MemberTeam();
  1301. const teamData = formation.teams[editBox.memberIdx[0]];
  1302. const teamBigBox = teamBigBoxs[editBox.memberIdx[0]];
  1303. const teamBox = teamBigBox.querySelector(".team-box");
  1304. teamData[editBox.memberIdx[1]][editBox.memberIdx[2]] = mon;
  1305. mon.id = parseInt(monstersID.value,10);
  1306. const card = Cards[mon.id] || Cards[0];
  1307. const skill = Skills[card.activeSkillId];
  1308. mon.level = parseInt(monEditLv.value,10);
  1309. const mAwokenNumIpt = monEditAwokensRow.querySelector("input[name='awoken-number']:checked");
  1310. mon.awoken = mAwokenNumIpt ? parseInt(mAwokenNumIpt.value,10) : 0;
  1311. if (card.superAwakenings.length) //如果支持超觉醒
  1312. {
  1313. const mSAwokenChoIpt = monEditSAwokensRow.querySelector("input[name='sawoken-choice']:checked");
  1314. mon.sawoken = mSAwokenChoIpt ? parseInt(mSAwokenChoIpt.value,10) : -1;
  1315. }
  1316. if (card.types.some(t=>{return t == 0 || t == 12 || t == 14 || t == 15;}) &&
  1317. (!card.overlay || mon.level>= card.maxLevel))
  1318. { //当4种特殊type的时候是无法297和打觉醒的,但是不能叠加的在未满级时可以
  1319. mon.plus = [0,0,0];
  1320. }else
  1321. {
  1322. mon.plus[0] = parseInt(monEditAddHp.value) || 0;
  1323. mon.plus[1] = parseInt(monEditAddAtk.value) || 0;
  1324. mon.plus[2] = parseInt(monEditAddRcv.value) || 0;
  1325. if (!editBox.isAssist)
  1326. { //如果不是辅助,则可以设定潜觉
  1327. mon.latent = editBox.latent.concat()
  1328. .sort((a,b)=>latentUseHole(b) - latentUseHole(a)); //并排序
  1329. }
  1330. }
  1331. const skillLevelNum = parseInt(skillLevel.value,10);
  1332. if (skillLevelNum < skill.maxLevel)
  1333. {
  1334. mon.skilllevel = skillLevelNum;
  1335. }
  1336. changeid(mon,editBox.monsterHead,editBox.memberIdx[1] ? null : editBox.latentBox);
  1337. const teamAbilityDom = teamBigBox.querySelector(".team-ability");
  1338. refreshAbility(teamAbilityDom, teamData, editBox.memberIdx[2]); //本人能力值
  1339. const teamTotalInfoDom = teamBigBox.querySelector(".team-total-info"); //队伍能力值合计
  1340. if (teamTotalInfoDom) refreshTeamTotalHP(teamTotalInfoDom, teamData);
  1341. const formationTotalInfoDom = formationBox.querySelector(".formation-total-info"); //所有队伍能力值合计
  1342. if (formationTotalInfoDom) refreshFormationTotalHP(formationTotalInfoDom, formation.teams);
  1343. const teamAwokenDom = teamBigBox.querySelector(".team-awoken"); //队伍觉醒合计
  1344. if (teamAwokenDom) refreshTeamAwokenCount(teamAwokenDom,teamData);
  1345. const formationAwokenDom = formationBox.querySelector(".formation-awoken"); //所有队伍觉醒合计
  1346. if (formationAwokenDom) refreshFormationAwokenCount(formationAwokenDom, formation.teams);
  1347. //刷新改队员的CD
  1348. refreshMemberSkillCD(teamBox,teamData,editBox.memberIdx[2]);
  1349. creatNewUrl();
  1350. editBox.hide();
  1351. };
  1352. window.onkeydown = function(e){
  1353. if (!editBox.classList.contains(className_displayNone))
  1354. {
  1355. if (e.keyCode == 27)
  1356. { //按下ESC时,自动关闭编辑窗
  1357. btnCancel.onclick();
  1358. }
  1359. }
  1360. };
  1361. btnNull.onclick = function(){ //空位置
  1362. const mon = new Member();
  1363. const teamBigBox = teamBigBoxs[editBox.memberIdx[0]];
  1364. const teamData = formation.teams[editBox.memberIdx[0]];
  1365. teamData[editBox.memberIdx[1]][editBox.memberIdx[2]] = mon;
  1366. changeid(mon ,editBox.monsterHead, editBox.latentBox);
  1367. const teamAbilityDom = teamBigBox.querySelector(".team-ability");
  1368. refreshAbility(teamAbilityDom, teamData, editBox.memberIdx[2]); //本人能力值
  1369. const teamTotalInfoDom = teamBigBox.querySelector(".team-total-info"); //队伍能力值合计
  1370. if (teamTotalInfoDom) refreshTeamTotalHP(teamTotalInfoDom, teamData);
  1371. const formationTotalInfoDom = formationBox.querySelector(".formation-total-info"); //所有队伍能力值合计
  1372. if (formationTotalInfoDom) refreshFormationTotalHP(formationTotalInfoDom, formation.teams);
  1373. const teamAwokenDom = teamBigBox.querySelector(".team-awoken"); //队伍觉醒合计
  1374. if (teamAwokenDom) refreshTeamAwokenCount(teamAwokenDom,teamData);
  1375. const formationAwokenDom = formationBox.querySelector(".formation-awoken"); //所有队伍觉醒合计
  1376. if (formationAwokenDom) refreshFormationAwokenCount(formationAwokenDom, formation.teams);
  1377. //刷新改队员的CD
  1378. refreshMemberSkillCD(teamBigBox,teamData,editBox.memberIdx[2]);
  1379. creatNewUrl();
  1380. editBox.hide();
  1381. };
  1382. btnDelay.onclick = function(){ //应对威吓
  1383. const mon = new MemberDelay();
  1384. const teamBigBox = teamBigBoxs[editBox.memberIdx[0]];
  1385. const teamData = formation.teams[editBox.memberIdx[0]];
  1386. teamData[editBox.memberIdx[1]][editBox.memberIdx[2]] = mon;
  1387. changeid(mon, editBox.monsterHead, editBox.latentBox);
  1388. const teamAbilityDom = teamBigBox.querySelector(".team-ability");
  1389. refreshAbility(teamAbilityDom, teamData, editBox.memberIdx[2]); //本人能力值
  1390. const teamTotalInfoDom = teamBigBox.querySelector(".team-total-info"); //队伍能力值合计
  1391. if (teamTotalInfoDom) refreshTeamTotalHP(teamTotalInfoDom, teamData);
  1392. const formationTotalInfoDom = formationBox.querySelector(".formation-total-info"); //所有队伍能力值合计
  1393. if (formationTotalInfoDom) refreshFormationTotalHP(formationTotalInfoDom, formation.teams);
  1394. const teamAwokenDom = teamBigBox.querySelector(".team-awoken"); //队伍觉醒合计
  1395. if (teamAwokenDom) refreshTeamAwokenCount(teamAwokenDom,teamData);
  1396. const formationAwokenDom = formationBox.querySelector(".formation-awoken"); //所有队伍觉醒合计
  1397. if (formationAwokenDom) refreshFormationAwokenCount(formationAwokenDom, formation.teams);
  1398. //刷新改队员的CD
  1399. refreshMemberSkillCD(teamBigBox,teamData,editBox.memberIdx[2]);
  1400. creatNewUrl();
  1401. editBox.hide();
  1402. };
  1403. //语言选择
  1404. const langList = controlBox.querySelector(".languages");
  1405. langList.onchange = function(){
  1406. creatNewUrl({"language":this.value});
  1407. history.go();
  1408. };
  1409. //数据源选择
  1410. const dataList = controlBox.querySelector(".datasource");
  1411. dataList.onchange = function(){
  1412. creatNewUrl({datasource:this.value});
  1413. history.go();
  1414. };
  1415. /*添对应语言执行的JS*/
  1416. const languageJS = document.head.appendChild(document.createElement("script"));
  1417. languageJS.id = "language-js";
  1418. languageJS.type = "text/javascript";
  1419. languageJS.src = "languages/"+currentLanguage.i18n+".js";
  1420. if (isGuideMod) //图鉴模式直接打开搜索框
  1421. showSearch([]);
  1422. }
  1423. //编辑界面点击每个怪物的头像的处理
  1424. function clickMonHead(e)
  1425. {
  1426. let team = parseInt(this.getAttribute("data-team"),10);
  1427. let assist = parseInt(this.getAttribute("data-assist"),10);
  1428. let index = parseInt(this.getAttribute("data-index"),10);
  1429. editMon(team,assist,index);
  1430. return false; //没有false将会打开链接
  1431. }
  1432. //编辑界面每个怪物的头像的拖动
  1433. function dragStartMonHead(e)
  1434. {
  1435. let team = parseInt(this.getAttribute("data-team"),10);
  1436. let assist = parseInt(this.getAttribute("data-assist"),10);
  1437. let index = parseInt(this.getAttribute("data-index"),10);
  1438. e.dataTransfer.setData('from',[team,assist,index].join(","));
  1439. }
  1440. //编辑界面每个怪物的头像的经过,阻止事件发生
  1441. function dropOverMonHead(e)
  1442. {
  1443. e.preventDefault();
  1444. }
  1445. //从怪物头像获取队员的队伍编号
  1446. function getMemberArrayIndexFromMonHead(headDom)
  1447. {
  1448. return [
  1449. parseInt(headDom.getAttribute("data-team"),10),
  1450. parseInt(headDom.getAttribute("data-assist"),10),
  1451. parseInt(headDom.getAttribute("data-index"),10),
  1452. ];
  1453. }
  1454. //编辑界面每个怪物的头像的放下
  1455. function dropMonHead(e)
  1456. {
  1457. const dataFrom = e.dataTransfer.getData('from').split(",").map((i)=>{return parseInt(i,10);});
  1458. const dataTo = getMemberArrayIndexFromMonHead(this);
  1459. if ((dataTo[0] != dataFrom[0]) ||
  1460. (dataTo[1] != dataFrom[1]) ||
  1461. (dataTo[2] != dataFrom[2]))
  1462. { //必须有所不同才继续交换
  1463. interchangeCard(dataFrom,dataTo);
  1464. }
  1465. return false; //没有false将会打开链接
  1466. }
  1467. //移动端编辑界面每个怪物的头像的放下
  1468. function touchstartMonHead(e)
  1469. {
  1470. e.stopPropagation();
  1471. //console.log("开始触摸",e,this);
  1472. const tc = e.changedTouches[0];
  1473. const pX = tc.pageX, pY = tc.pageY;
  1474. interchangeSVG.style.display = "none";
  1475. interchangeSVG.changePoint({x:pX,y:pY},{x:pX,y:pY});
  1476. }
  1477. //移动端编辑界面每个怪物的头像的移动
  1478. function touchmoveMonHead(e)
  1479. {
  1480. //console.log("移动中",e,this);
  1481. const tc = e.changedTouches[0];
  1482. const pX = tc.pageX, pY = tc.pageY;
  1483. const rect = this.getBoundingClientRect();
  1484. const top = rect.top + document.documentElement.scrollTop;
  1485. const left = rect.left + document.documentElement.scrollLeft;
  1486. if ((pY < top) || (pY > (top + rect.height)) ||
  1487. (pX < left) || (pX > (left + rect.width)))
  1488. {
  1489. interchangeSVG.style.display = "block";
  1490. interchangeSVG.changePoint(null,{x:pX,y:pY});
  1491. }else
  1492. {
  1493. interchangeSVG.style.display = "none";
  1494. }
  1495. }
  1496. //移动端编辑界面每个怪物的头像的结束
  1497. function touchendMonHead(e)
  1498. {
  1499. const tc = e.changedTouches[0];
  1500. const pX = tc.pageX, pY = tc.pageY;
  1501. //console.log("移动结束",pX,pY,e,this);
  1502. interchangeSVG.style.display = "none";
  1503. interchangeSVG.changePoint(null,{x:pX,y:pY});
  1504. let target = allMembers.find(m=>{
  1505. const rect = m.getBoundingClientRect();
  1506. const top = rect.top + document.documentElement.scrollTop;
  1507. const left = rect.left + document.documentElement.scrollLeft;
  1508. const isInRect = (pY > top) && (pY < (top + rect.height)) &&
  1509. (pX > left) && (pX < (left + rect.width));
  1510. return isInRect;
  1511. });
  1512. if (target && this != target)
  1513. {
  1514. //console.log("找到的对象",targets[0]);
  1515. let dataFrom = getMemberArrayIndexFromMonHead(this);
  1516. let dataTo = getMemberArrayIndexFromMonHead(target);
  1517. if ((dataTo[0] != dataFrom[0]) ||
  1518. (dataTo[1] != dataFrom[1]) ||
  1519. (dataTo[2] != dataFrom[2]))
  1520. { //必须有所不同才继续交换
  1521. interchangeCard(dataFrom,dataTo);
  1522. }
  1523. }
  1524. }
  1525. //移动端编辑界面每个怪物的头像的取消
  1526. function touchcancelMonHead(e)
  1527. {
  1528. interchangeSVG.style.display = "none";
  1529. console.log("移动取消",e,this);
  1530. }
  1531. function interchangeCard(formArr,toArr)
  1532. {
  1533. function changeType(member,isAssist)
  1534. {
  1535. if (member.id == 0 || (isAssist && member.id == -1))
  1536. {
  1537. return new Member();
  1538. }else
  1539. {
  1540. const newMember = isAssist ? new MemberTeam() : new MemberAssist();
  1541. newMember.loadFromMember(member);
  1542. return newMember;
  1543. }
  1544. }
  1545. const changeSwapToCopy = controlBox.querySelector("#change-swap-to-copy");//储存交换“复制”和“替换”
  1546. const isCopy = changeSwapToCopy.checked;
  1547. let from = formation.teams[formArr[0]][formArr[1]][formArr[2]];
  1548. let to = formation.teams[toArr[0]][toArr[1]][toArr[2]];
  1549. if(formArr[1] != toArr[1]) //从武器拖到非武器才改变类型
  1550. {
  1551. from = changeType(from,formArr[1]);
  1552. if (!isCopy) to = changeType(to,toArr[1]);
  1553. }else if (isCopy)
  1554. {
  1555. const newFrom = new from.constructor();
  1556. newFrom.loadFromMember(from);
  1557. from = newFrom;
  1558. }
  1559. formation.teams[toArr[0]][toArr[1]][toArr[2]] = from;
  1560. if (!isCopy) formation.teams[formArr[0]][formArr[1]][formArr[2]] = to;
  1561. creatNewUrl(); //刷新URL
  1562. refreshAll(formation); //刷新全部
  1563. }
  1564. //改变一个怪物头像
  1565. function changeid(mon,monDom,latentDom)
  1566. {
  1567. let fragment = document.createDocumentFragment(); //创建节点用的临时空间
  1568. const parentNode = monDom.parentNode;
  1569. fragment.appendChild(monDom);
  1570. const monId = mon.id;
  1571. const card = Cards[monId] || Cards[0]; //怪物固定数据
  1572. monDom.setAttribute("data-cardid", monId); //设定新的id
  1573. if (monId<0) //如果是延迟
  1574. {
  1575. monDom.removeAttribute("href");
  1576. monDom.removeAttribute("title");
  1577. parentNode.classList.add("delay");
  1578. parentNode.classList.remove("null");
  1579. parentNode.appendChild(fragment);
  1580. if (latentDom) latentDom.classList.add(className_displayNone);
  1581. return;
  1582. }else if (monId==0) //如果是空
  1583. {
  1584. monDom.removeAttribute("href");
  1585. monDom.removeAttribute("title");
  1586. parentNode.classList.add("null");
  1587. parentNode.classList.remove("delay");
  1588. parentNode.appendChild(fragment);
  1589. if (latentDom) latentDom.classList.add(className_displayNone);
  1590. return;
  1591. }else if (monId>-1) //如果提供了id
  1592. {
  1593. parentNode.classList.remove("null");
  1594. parentNode.classList.remove("delay");
  1595. monDom.setAttribute("data-cards-pic-idx",Math.ceil(monId/100)); //添加图片编号
  1596. const idxInPage = (monId-1) % 100; //获取当前页面的总序号
  1597. monDom.setAttribute("data-cards-pic-x", idxInPage % 10); //添加X方向序号
  1598. monDom.setAttribute("data-cards-pic-y", Math.floor(idxInPage / 10)); //添加Y方向序号
  1599. monDom.querySelector(".property").setAttribute("data-property", card.attrs[0]); //主属性
  1600. monDom.querySelector(".subproperty").setAttribute("data-property", card.attrs[1]); //副属性
  1601. monDom.title = "No." + monId + " " + (card.otLangName ? (card.otLangName[currentLanguage.searchlist[0]] || card.name) : card.name);
  1602. monDom.href = currentLanguage.guideURL(monId, card.name);
  1603. if (card.canAssist)
  1604. monDom.classList.add("allowable-assist");
  1605. else
  1606. monDom.classList.remove("allowable-assist");
  1607. if (card.awakenings.includes(49))//武器
  1608. monDom.classList.add("wepon");
  1609. else
  1610. monDom.classList.remove("wepon");
  1611. }
  1612. const levelDom = monDom.querySelector(".level");
  1613. if (levelDom) //如果提供了等级
  1614. {
  1615. const level = mon.level || 1;
  1616. levelDom.innerHTML = level;
  1617. if (level == card.maxLevel)
  1618. { //如果等级刚好等于最大等级,则修改为“最大”的字
  1619. levelDom.classList.add("max");
  1620. }else
  1621. {
  1622. levelDom.classList.remove("max");
  1623. }
  1624. if (card.limitBreakIncr && level >= card.maxLevel)
  1625. { //如果支持超觉,并且等级超过99,就添加支持超觉的蓝色
  1626. levelDom.classList.add("_110");
  1627. }else
  1628. {
  1629. levelDom.classList.remove("_110");
  1630. }
  1631. }
  1632. const awokenIcon = monDom.querySelector(".awoken-count");
  1633. if (awokenIcon)
  1634. {
  1635. if (card.awakenings.length < 1 || mon.awoken == 0) //没觉醒
  1636. {
  1637. awokenIcon.classList.add(className_displayNone);
  1638. awokenIcon.innerHTML = "";
  1639. }else if (mon.awoken > 1) //如果提供了觉醒
  1640. {
  1641. awokenIcon.classList.remove(className_displayNone);
  1642. awokenIcon.innerHTML = mon.awoken;
  1643. if (mon.awoken == card.awakenings.length)
  1644. {
  1645. awokenIcon.classList.add("full-awoken");
  1646. }else
  1647. {
  1648. awokenIcon.classList.remove("full-awoken");
  1649. }
  1650. }
  1651. }
  1652. const sawoken = monDom.querySelector(".super-awoken");
  1653. if (sawoken) //如果存在超觉醒的DOM且提供了超觉醒
  1654. {
  1655. if (mon.sawoken != undefined && mon.sawoken>=0 && card.superAwakenings.length)
  1656. {
  1657. sawoken.classList.remove(className_displayNone);
  1658. const sawokenIcon = sawoken.querySelector(".awoken-icon");
  1659. sawokenIcon.setAttribute("data-awoken-icon",card.superAwakenings[mon.sawoken]);
  1660. }else
  1661. {
  1662. sawoken.classList.add(className_displayNone);
  1663. }
  1664. }
  1665. const m_id = monDom.querySelector(".id");
  1666. if (m_id) //怪物ID
  1667. {
  1668. m_id.innerHTML = monId;
  1669. }
  1670. const plusArr = mon.plus || [0,0,0];
  1671. const plusDom = monDom.querySelector(".plus");
  1672. if (plusArr && plusDom) //如果提供了加值,且怪物头像内有加值
  1673. {
  1674. const plusCount = plusArr[0]+plusArr[1]+plusArr[2];
  1675. if (plusCount <= 0)
  1676. {
  1677. plusDom.classList.add(className_displayNone);
  1678. }else if (plusCount >= 297)
  1679. {
  1680. plusDom.classList.add("has297");
  1681. plusDom.classList.remove(className_displayNone);
  1682. }else
  1683. {
  1684. plusDom.querySelector(".hp").innerHTML = plusArr[0];
  1685. plusDom.querySelector(".atk").innerHTML = plusArr[1];
  1686. plusDom.querySelector(".rcv").innerHTML = plusArr[2];
  1687. plusDom.classList.remove("has297");
  1688. plusDom.classList.remove(className_displayNone);
  1689. }
  1690. }
  1691. if (latentDom)
  1692. {
  1693. if (mon.latent) //如果提供了潜觉
  1694. {
  1695. const latent = mon.latent;
  1696. if (latent.length < 1)
  1697. {
  1698. latentDom.classList.add(className_displayNone);
  1699. }else
  1700. {
  1701. const latentDoms = Array.from(latentDom.querySelectorAll("li"));
  1702. refreshLatent(latent,mon.id,latentDoms);
  1703. latentDom.classList.remove(className_displayNone);
  1704. }
  1705. }else
  1706. {
  1707. latentDom.classList.add(className_displayNone);
  1708. }
  1709. }
  1710. const skillCdDom = monDom.querySelector(".skill");
  1711. if (skillCdDom) //如果存在技能CD DOM
  1712. {
  1713. //const skill = Skills[card.activeSkillId];
  1714. if (card.activeSkillId == 0)
  1715. {
  1716. skillCdDom.classList.add(className_displayNone);
  1717. }else
  1718. {
  1719. skillCdDom.classList.remove(className_displayNone);
  1720. }
  1721. }
  1722. parentNode.appendChild(fragment);
  1723. }
  1724. //刷新潜觉
  1725. function refreshLatent(latent,monid,iconArr)
  1726. {
  1727. const maxLatentCount = getMaxLatentCount(monid); //最大潜觉数量
  1728. let latentIndex = 0,usedHoleN = 0;
  1729. for (let ai = 0; ai<iconArr.length; ai++)
  1730. {
  1731. const icon = iconArr[ai];
  1732. if (latent[latentIndex] != undefined && ai >= usedHoleN && ai < maxLatentCount) //有潜觉
  1733. {
  1734. icon.setAttribute("data-latent-icon", latent[latentIndex]);
  1735. icon.classList.remove(className_displayNone);
  1736. usedHoleN += latentUseHole(latent[latentIndex]);
  1737. latentIndex++;
  1738. }
  1739. else if(ai < usedHoleN) //多格潜觉后方隐藏
  1740. {
  1741. icon.classList.add(className_displayNone);
  1742. }
  1743. else if(ai < maxLatentCount) //没有使用的空格觉醒
  1744. {
  1745. icon.removeAttribute("data-latent-icon");
  1746. icon.classList.remove(className_displayNone);
  1747. }
  1748. else //不需要显示的部分
  1749. {
  1750. icon.classList.add(className_displayNone);
  1751. }
  1752. }
  1753. };
  1754. //点击怪物头像,出现编辑窗
  1755. function editMon(teamNum,isAssist,indexInTeam)
  1756. {
  1757. //数据
  1758. const mon = formation.teams[teamNum][isAssist][indexInTeam];
  1759. const teamBigBox = teamBigBoxs[teamNum];
  1760. const teamBox = teamBigBox.querySelector(".team-box");
  1761. const memberBox = teamBox.querySelector(isAssist?".team-assist":".team-members");
  1762. const memberLi = memberBox.querySelector(`.member-${indexInTeam+1}`);
  1763. const monsterHead = memberLi.querySelector(".monster");
  1764. editBox.show();
  1765. editBox.isAssist = isAssist;
  1766. editBox.monsterHead = monsterHead;
  1767. editBox.memberIdx = [teamNum, isAssist, indexInTeam]; //储存队伍数组下标
  1768. if (!isAssist)
  1769. {
  1770. const latentBox = teamBox.querySelector(".team-latents .latents-"+(indexInTeam+1)+" .latent-ul");
  1771. editBox.latentBox = latentBox;
  1772. }
  1773. const settingBox = editBox.querySelector(".setting-box");
  1774. const monstersID = settingBox.querySelector(".row-mon-id .m-id");
  1775. monstersID.value = mon.id > 0 ? mon.id : 0;
  1776. monstersID.onchange();
  1777. //觉醒
  1778. const monEditAwokens = settingBox.querySelectorAll(".row-mon-awoken .awoken-ul input[name='awoken-number']");
  1779. //if (mon.awoken > 0 && monEditAwokens[mon.awoken]) monEditAwokens[mon.awoken].click(); //涉及到觉醒数字的显示,所以需要点一下,为了减少计算次数,把这一条移动到了最后面
  1780. //超觉醒
  1781. const monEditSAwokensRow = settingBox.querySelector(".row-mon-super-awoken");
  1782. const monEditSAwokens = monEditSAwokensRow.querySelectorAll(".awoken-ul input[name='sawoken-choice']"); //单选框,0号是隐藏的
  1783. monEditSAwokens[(mon.sawoken >= 0 && monEditSAwokens[mon.sawoken+1]) ? mon.sawoken+1 : 0].checked = true;
  1784. monEditSAwokensRow.swaokenIndex = mon.sawoken;
  1785. const monEditLv = settingBox.querySelector(".row-mon-level .m-level");
  1786. monEditLv.value = mon.level || 1;
  1787. const monEditAddHp = settingBox.querySelector(".row-mon-plus .m-plus-hp");
  1788. const monEditAddAtk = settingBox.querySelector(".row-mon-plus .m-plus-atk");
  1789. const monEditAddRcv = settingBox.querySelector(".row-mon-plus .m-plus-rcv");
  1790. if (mon.plus && mon.id>0)
  1791. {
  1792. monEditAddHp.value = mon.plus[0];
  1793. monEditAddAtk.value = mon.plus[1];
  1794. monEditAddRcv.value = mon.plus[2];
  1795. }
  1796. const rowMonLatent = settingBox.querySelector(".row-mon-latent");
  1797. const skillLevel = settingBox.querySelector(".row-mon-skill .skill-box .m-skill-level");
  1798. if (mon.skilllevel)
  1799. {
  1800. skillLevel.value = mon.skilllevel;
  1801. }
  1802. skillLevel.onchange();
  1803. const editBoxTitle = editBox.querySelector(".edit-box-title");
  1804. const btnDelay = editBox.querySelector(".button-box .button-delay");
  1805. if (!isAssist)
  1806. {
  1807. editBox.latent = mon.latent ? mon.latent.concat() : [];
  1808. editBox.refreshLatent(editBox.latent, mon.id);
  1809. btnDelay.classList.add(className_displayNone);
  1810. rowMonLatent.classList.remove(className_displayNone);
  1811. editBoxTitle.classList.remove("edit-box-title-assist");
  1812. }else
  1813. {
  1814. btnDelay.classList.remove(className_displayNone);
  1815. rowMonLatent.classList.add(className_displayNone);
  1816. editBoxTitle.classList.add("edit-box-title-assist");
  1817. }
  1818. editBox.reCalculateExp();
  1819. if (mon.awoken > 0 && monEditAwokens[mon.awoken])
  1820. monEditAwokens[mon.awoken].click(); //涉及到觉醒数字的显示,所以需要点一下
  1821. else
  1822. editBox.reCalculateAbility();
  1823. }
  1824. //编辑窗,修改怪物ID
  1825. function editBoxChangeMonId(id)
  1826. {
  1827. const card = Cards[id] || Cards[0]; //怪物固定数据
  1828. if (card.id == 0){
  1829. id = 0;
  1830. }
  1831. const skill = Skills[card.activeSkillId];
  1832. const leaderSkill = Skills[card.leaderSkillId];
  1833. let fragment = null;
  1834. const monInfoBox = editBox.querySelector(".monsterinfo-box");
  1835. const settingBox = editBox.querySelector(".setting-box");
  1836. //id搜索
  1837. const monHead = monInfoBox.querySelector(".monster");
  1838. changeid({id:id},monHead); //改变图像
  1839. const mId = monInfoBox.querySelector(".monster-id");
  1840. mId.innerHTML = id;
  1841. const mRare = monInfoBox.querySelector(".monster-rare");
  1842. mRare.setAttribute("data-rarity",card.rarity);
  1843. const mCost = monInfoBox.querySelector(".monster-cost");
  1844. mCost.innerHTML = card.cost;
  1845. /*const mExp = monInfoBox.querySelector(".monster-exp");
  1846. mExp.innerHTML = card.exp.max;*/
  1847. const mName = monInfoBox.querySelector(".monster-name");
  1848. mName.innerHTML = returnMonsterNameArr(card, currentLanguage.searchlist, currentDataSource.code)[0];
  1849. const mSeriesId = monInfoBox.querySelector(".monster-seriesId");
  1850. mSeriesId.innerHTML = card.seriesId;
  1851. mSeriesId.setAttribute("data-seriesId",card.seriesId);
  1852. if (card.seriesId == 0)
  1853. {
  1854. mSeriesId.classList.add(className_displayNone);
  1855. }else
  1856. {
  1857. mSeriesId.classList.remove(className_displayNone);
  1858. }
  1859. const mCollabId = monInfoBox.querySelector(".monster-collabId");
  1860. mCollabId.innerHTML = card.collabId;
  1861. mCollabId.setAttribute("data-collabId",card.collabId);
  1862. if (card.collabId == 0)
  1863. {
  1864. mCollabId.classList.add(className_displayNone);
  1865. }else
  1866. {
  1867. mCollabId.classList.remove(className_displayNone);
  1868. }
  1869. const mAltName = monInfoBox.querySelector(".monster-altName");
  1870. mAltName.innerHTML = card.altName;
  1871. mAltName.setAttribute("data-altName",card.altName);
  1872. if (card.altName.length == 0)
  1873. { //当没有合作名
  1874. mAltName.classList.add(className_displayNone);
  1875. }else
  1876. {
  1877. mAltName.classList.remove(className_displayNone);
  1878. }
  1879. const evoCardUl = settingBox.querySelector(".row-mon-id .evo-card-list");
  1880. evoCardUl.style.display = "none";
  1881. evoCardUl.innerHTML = ""; //据说直接清空HTML性能更好
  1882. const evoLinkCardsIdArray = Cards.filter(function(m){
  1883. return m.evoRootId == card.evoRootId;
  1884. }).map(function(m){return m.id;}); //筛选出相同进化链的
  1885. const createCardHead = editBox.createCardHead;
  1886. if (evoLinkCardsIdArray.length>1)
  1887. {
  1888. fragment = document.createDocumentFragment(); //创建节点用的临时空间
  1889. evoLinkCardsIdArray.forEach(function(mid){
  1890. const cli = createCardHead(mid);
  1891. if (mid == id)
  1892. {
  1893. cli.classList.add("unable-monster");
  1894. }
  1895. fragment.appendChild(cli);
  1896. });
  1897. evoCardUl.appendChild(fragment);
  1898. evoCardUl.style.display = "block";
  1899. }
  1900. const mType = monInfoBox.querySelectorAll(".monster-type li");
  1901. for (let ti=0;ti<mType.length;ti++)
  1902. {
  1903. if (ti<card.types.length && card.types[ti]>= 0)
  1904. {
  1905. mType[ti].setAttribute("data-type-name",card.types[ti]);
  1906. mType[ti].querySelector(".type-icon").setAttribute("data-type-icon",card.types[ti]);
  1907. mType[ti].classList.remove(className_displayNone);
  1908. }else
  1909. {
  1910. mType[ti].classList.add(className_displayNone);
  1911. }
  1912. }
  1913. const monEditAwokensRow = settingBox.querySelector(".row-mon-awoken .awoken-ul");
  1914. const mAwokenIcon = monEditAwokensRow.querySelectorAll(".awoken-icon");
  1915. const mAwokenIpt = monEditAwokensRow.querySelectorAll("input[name='awoken-number']");
  1916. if (card.canAssist)
  1917. {
  1918. monEditAwokensRow.classList.add("allowable-assist");
  1919. }else
  1920. {
  1921. monEditAwokensRow.classList.remove("allowable-assist");
  1922. }
  1923. for (let ai=0;ai<mAwokenIcon.length;ai++)
  1924. {
  1925. if (ai<card.awakenings.length)
  1926. {
  1927. mAwokenIcon[ai].setAttribute("data-awoken-icon",card.awakenings[ai]);
  1928. mAwokenIcon[ai].classList.remove(`display-none`);
  1929. }else
  1930. {
  1931. mAwokenIcon[ai].classList.add(`display-none`);
  1932. }
  1933. }
  1934. mAwokenIpt[card.awakenings.length].click(); //选择最后一个觉醒
  1935. //超觉醒
  1936. const monEditSAwokensRow = settingBox.querySelector(".row-mon-super-awoken");
  1937. const mSAwoken = monEditSAwokensRow.querySelectorAll(".awoken-ul .awoken-icon");
  1938. if (card.superAwakenings.length>0) //辅助时也还是加入超觉醒吧
  1939. {
  1940. for (let ai=0;ai<mSAwoken.length;ai++)
  1941. {
  1942. if (ai < card.superAwakenings.length)
  1943. {
  1944. mSAwoken[ai].setAttribute("data-awoken-icon",card.superAwakenings[ai]);
  1945. mSAwoken[ai].classList.remove(`display-none`);
  1946. }
  1947. else
  1948. {
  1949. mSAwoken[ai].classList.add(`display-none`);
  1950. }
  1951. }
  1952. monEditSAwokensRow.classList.remove(className_displayNone);
  1953. }else
  1954. {
  1955. monEditSAwokensRow.classList.add(className_displayNone);
  1956. }
  1957. monEditSAwokensRow.querySelector("#sawoken-choice--1").click(); //选中隐藏的空超觉
  1958. const monEditLvMax = settingBox.querySelector(".m-level-btn-max");
  1959. monEditLvMax.innerHTML = monEditLvMax.value = card.maxLevel;
  1960. const monEditLv = settingBox.querySelector(".m-level");
  1961. monEditLv.max = monEditLv.value = card.maxLevel + (card.limitBreakIncr ? 11 : 0); //默认等级为110
  1962. const monEditLv110 = settingBox.querySelector(".m-level-btn-110");
  1963. if (card.limitBreakIncr)
  1964. {
  1965. monEditLv110.classList.remove(className_displayNone);
  1966. }else
  1967. {
  1968. monEditLv110.classList.add(className_displayNone);
  1969. }
  1970. const rowPlus = settingBox.querySelector(".row-mon-plus");
  1971. const rowLatent = settingBox.querySelector(".row-mon-latent");
  1972. const monLatentAllowUl = rowLatent.querySelector(".m-latent-allowable-ul");
  1973. //该宠Type允许的杀,set不会出现重复的
  1974. const allowLatent = new Set();
  1975. card.types
  1976. .filter(i=>i>=0)
  1977. .map(type=>type_allowable_latent[type])
  1978. .forEach(tA => tA.forEach(t=>allowLatent.add(t)));
  1979. typekiller_for_type.forEach(type=>{ //显示允许的杀,隐藏不允许的杀
  1980. const latentDom = monLatentAllowUl.querySelector(`.latent-icon[data-latent-icon='${type.latent}']`);
  1981. if (!latentDom) return;
  1982. if (allowLatent.has(type.latent))
  1983. {
  1984. latentDom.classList.remove("unallowable-latent");
  1985. }else
  1986. {
  1987. latentDom.classList.add("unallowable-latent");
  1988. }
  1989. })
  1990. //怪物主动技能
  1991. const rowSkill = settingBox.querySelector(".row-mon-skill");
  1992. const skillBox = rowSkill.querySelector(".skill-box");
  1993. const skillTitle = skillBox.querySelector(".skill-name");
  1994. const skillCD = skillBox.querySelector(".skill-cd");
  1995. const skillLevel = skillBox.querySelector(".m-skill-level");
  1996. //const skillLevel_1 = skillBox.querySelector(".m-skill-lv-1");
  1997. const skillLevel_Max = skillBox.querySelector(".m-skill-lv-max");
  1998. const skillDetail = skillBox.querySelector(".skill-datail");
  1999. fragment = document.createDocumentFragment(); //创建节点用的临时空间
  2000. fragment.appendChild(skillBox);
  2001. skillTitle.innerHTML = descriptionToHTML(skill.name);
  2002. skillTitle.setAttribute("data-skillid", skill.id);
  2003. skillDetail.innerHTML = parseSkillDescription(skill);
  2004. const t_maxLevel = card.overlay || card.types.includes(15) ? 1 : skill.maxLevel; //遇到不能升技的,最大等级强制为1
  2005. skillLevel.max = t_maxLevel;
  2006. skillLevel.value = t_maxLevel;
  2007. skillLevel_Max.value = t_maxLevel;
  2008. skillLevel_Max.innerHTML = skill.maxLevel;
  2009. skillCD.innerHTML = skill.initialCooldown - t_maxLevel + 1;
  2010. rowSkill.appendChild(fragment);
  2011. //怪物队长技能
  2012. const rowLederSkill = settingBox.querySelector(".row-mon-leader-skill");
  2013. const lskillBox = rowLederSkill.querySelector(".skill-box");
  2014. const lskillTitle = lskillBox.querySelector(".skill-name");
  2015. const lskillDetail = lskillBox.querySelector(".skill-datail");
  2016. fragment = document.createDocumentFragment(); //创建节点用的临时空间
  2017. fragment.appendChild(lskillBox);
  2018. lskillTitle.innerHTML = descriptionToHTML(leaderSkill.name);
  2019. lskillDetail.innerHTML = parseSkillDescription(leaderSkill);
  2020. rowLederSkill.appendChild(fragment);
  2021. if (card.overlay || card.types[0] == 15 && card.types[1] == -1)
  2022. { //当可以叠加时,不能打297和潜觉
  2023. rowPlus.classList.add("disabled");
  2024. rowPlus.querySelector(".m-plus-hp").value = 0;
  2025. rowPlus.querySelector(".m-plus-atk").value = 0;
  2026. rowPlus.querySelector(".m-plus-rcv").value = 0;
  2027. rowLatent.classList.add("disabled");
  2028. skillLevel.setAttribute("readonly",true);
  2029. }else
  2030. {
  2031. rowPlus.classList.remove("disabled");
  2032. rowLatent.classList.remove("disabled");
  2033. skillLevel.removeAttribute("readonly");
  2034. }
  2035. if (editBox.isAssist)
  2036. {
  2037. const btnDone = editBox.querySelector(".button-done");
  2038. if (!card.canAssist)
  2039. {
  2040. btnDone.classList.add("cant-assist");
  2041. btnDone.disabled = true;
  2042. }else
  2043. {
  2044. btnDone.classList.remove("cant-assist");
  2045. btnDone.disabled = false;
  2046. }
  2047. }
  2048. const allKillerLatent = typekiller_for_type.map(type=>type.latent);
  2049. //去除所有不能再打的潜觉
  2050. editBox.latent = editBox.latent.filter(lat=>
  2051. !allKillerLatent.includes(lat) ||
  2052. allKillerLatent.includes(lat) && allowLatent.has(lat));
  2053. editBox.refreshLatent(editBox.latent,id);
  2054. editBox.reCalculateExp();
  2055. editBox.reCalculateAbility();
  2056. }
  2057. //搜索并显示合作
  2058. function searchColla(collabId)
  2059. {
  2060. if (typeof(collabId) == "string") collabId = parseInt(collabId,10);
  2061. showSearch(Cards.filter(card=>{return card.collabId == collabId;}));
  2062. }
  2063. //刷新整个队伍
  2064. function refreshAll(formationData){
  2065. let fragment = document.createDocumentFragment(); //创建节点用的临时空间
  2066. const titleBox = fragment.appendChild(formationBox.querySelector(".title-box"));
  2067. const detailBox = formationBox.querySelector(".detail-box");
  2068. const formationTotalInfoDom = formationBox.querySelector(".formation-total-info"); //所有队伍能力值合计
  2069. const formationAwokenDom = formationBox.querySelector(".formation-awoken"); //所有队伍觉醒合计
  2070. while(formationBox.childNodes.length>0)
  2071. {
  2072. fragment.appendChild(formationBox.childNodes[0]);
  2073. }
  2074. const txtTitle = titleBox.querySelector(".title");
  2075. const txtDetail = detailBox.querySelector(".detail");
  2076. txtTitle.value = formationData.title || "";
  2077. txtDetail.value = formationData.detail || "";
  2078. const txtTitleDisplay = titleBox.querySelector(".title-display");
  2079. const txtDetailDisplay = detailBox.querySelector(".detail-display");
  2080. txtTitleDisplay.innerHTML = descriptionToHTML(txtTitle.value);
  2081. txtDetailDisplay.innerHTML = descriptionToHTML(txtDetail.value);
  2082. if (txtTitle.value.length == 0)
  2083. titleBox.classList.add("edit");
  2084. else
  2085. titleBox.classList.remove("edit");
  2086. if (txtDetail.value.length == 0)
  2087. detailBox.classList.add("edit");
  2088. else
  2089. detailBox.classList.remove("edit");
  2090. teamBigBoxs.forEach((teamBigBox,teamNum)=>{
  2091. const teamBox = teamBigBox.querySelector(".team-box");
  2092. const teamData = formationData.teams[teamNum];
  2093. const badgeBox = teamBigBox.querySelector(".team-badge");
  2094. if (badgeBox)
  2095. {
  2096. const badge = badgeBox.querySelector(`#team-${teamNum+1}-badge-${teamData[2] || 0}`);
  2097. badge.checked = true;
  2098. }
  2099. const membersDom = teamBox.querySelector(".team-members");
  2100. const latentsDom = teamBox.querySelector(".team-latents");
  2101. const assistsDom = teamBox.querySelector(".team-assist");
  2102. const teamAbilityDom = teamBigBox.querySelector(".team-ability");
  2103. for (let ti=0,ti_len=membersDom.querySelectorAll(".member").length;ti<ti_len;ti++)
  2104. {
  2105. const member = membersDom.querySelector(`.member-${ti+1} .monster`);
  2106. const latent = latentsDom.querySelector(`.latents-${ti+1} .latent-ul`);
  2107. const assist = assistsDom.querySelector(`.member-${ti+1} .monster`);
  2108. changeid(teamData[0][ti],member,latent); //队员
  2109. changeid(teamData[1][ti],assist); //辅助
  2110. refreshMemberSkillCD(teamBox,teamData,ti); //技能CD
  2111. refreshAbility(teamAbilityDom, teamData, ti); //本人能力值
  2112. }
  2113. const teamTotalInfoDom = teamBigBox.querySelector(".team-total-info"); //队伍能力值合计
  2114. if (teamTotalInfoDom) refreshTeamTotalHP(teamTotalInfoDom, teamData);
  2115. const teamAwokenDom = teamBigBox.querySelector(".team-awoken"); //队伍觉醒合计
  2116. if (teamAwokenDom) refreshTeamAwokenCount(teamAwokenDom, teamData);
  2117. });
  2118. if (formationTotalInfoDom) refreshFormationTotalHP(formationTotalInfoDom, formation.teams);
  2119. if (formationAwokenDom) refreshFormationAwokenCount(formationAwokenDom, formation.teams);
  2120. formationBox.appendChild(fragment);
  2121. txtDetail.onblur(); //这个需要放在显示出来后再改才能生效
  2122. }
  2123. //刷新队伍觉醒统计
  2124. function refreshTeamAwokenCount(awokenDom,team){
  2125. let fragment = document.createDocumentFragment(); //创建节点用的临时空间
  2126. const awokenUL = fragment.appendChild(awokenDom.querySelector(".awoken-ul"));
  2127. function setCount(aicon,number){
  2128. if (!aicon) return; //没有这个觉醒就撤回
  2129. const ali = aicon.parentNode;
  2130. const countDom = ali.querySelector(".count");
  2131. countDom.innerHTML = number;
  2132. if (number)
  2133. ali.classList.remove(className_displayNone);
  2134. else
  2135. ali.classList.add(className_displayNone);
  2136. }
  2137. for (let ai=1;ai<=72;ai++)
  2138. {
  2139. const aicon = awokenUL.querySelector(`.awoken-icon[data-awoken-icon='${ai}']`);
  2140. if (!aicon) continue; //如果没有这个觉醒图,直接跳过
  2141. //搜索等效觉醒
  2142. const equalIndex = equivalent_awoken.findIndex(eak=>eak.small === ai || eak.big === ai);
  2143. if (equalIndex >= 0)
  2144. {
  2145. const equivalentAwoken = equivalent_awoken[equalIndex];
  2146. if (equivalentAwoken.small === ai)
  2147. {
  2148. const totalNum = awokenCountInTeam(team, equivalentAwoken.small, solo, teamsCount) +
  2149. awokenCountInTeam(team, equivalentAwoken.big, solo, teamsCount) * equivalentAwoken.times;
  2150. setCount(aicon, totalNum);
  2151. }else
  2152. {
  2153. continue;
  2154. }
  2155. }else
  2156. {
  2157. setCount(aicon,awokenCountInTeam(team,ai,solo, teamsCount));
  2158. }
  2159. }
  2160. awokenDom.appendChild(fragment);
  2161. }
  2162. //刷新阵型觉醒统计
  2163. function refreshFormationAwokenCount(awokenDom,teams){
  2164. let fragment = document.createDocumentFragment(); //创建节点用的临时空间
  2165. const awokenUL = fragment.appendChild(awokenDom.querySelector(".awoken-ul"));
  2166. function setCount(aicon,number){
  2167. if (!aicon) return; //没有这个觉醒就撤回
  2168. const ali = aicon.parentNode;
  2169. const countDom = ali.querySelector(".count");
  2170. countDom.innerHTML = number;
  2171. if (number)
  2172. ali.classList.remove(className_displayNone);
  2173. else
  2174. ali.classList.add(className_displayNone);
  2175. }
  2176. for (let ai=1;ai<=72;ai++)
  2177. {
  2178. const aicon = awokenUL.querySelector(`.awoken-icon[data-awoken-icon='${ai}']`);
  2179. if (!aicon) continue; //如果没有这个觉醒图,直接跳过
  2180. //搜索等效觉醒
  2181. const equalIndex = equivalent_awoken.findIndex(eak=>eak.small === ai || eak.big === ai);
  2182. if (equalIndex >= 0)
  2183. {
  2184. const equivalentAwoken = equivalent_awoken[equalIndex];
  2185. if (equivalentAwoken.small === ai)
  2186. {
  2187. const totalNum = awokenCountInFormation(teams, equivalentAwoken.small, solo) +
  2188. awokenCountInFormation(teams, equivalentAwoken.big, solo) * equivalentAwoken.times;
  2189. setCount(aicon, totalNum);
  2190. }else
  2191. {
  2192. continue;
  2193. }
  2194. }else
  2195. {
  2196. setCount(aicon,awokenCountInFormation(teams,ai,solo));
  2197. }
  2198. }
  2199. awokenDom.appendChild(fragment);
  2200. }
  2201. //刷新能力值
  2202. function refreshAbility(abilityDom,team,idx){
  2203. const memberData = team[0][idx];
  2204. const assistData = team[1][idx];
  2205. //基底三维,如果辅助是武器,还要加上辅助的觉醒
  2206. const mainAbility = calculateAbility(memberData, assistData, solo, teamsCount);
  2207. if (mainAbility && memberData.ability)
  2208. {
  2209. for (let ai=0;ai<3;ai++)
  2210. {
  2211. memberData.ability[ai] = mainAbility[ai];
  2212. }
  2213. }
  2214. if (!abilityDom) return; //如果没有dom,直接跳过
  2215. const abilityLi = abilityDom.querySelector(".abilitys-" + (idx+1));
  2216. const hpDom = abilityLi.querySelector(".hp");
  2217. const atkDom = abilityLi.querySelector(".atk");
  2218. const rcvDom = abilityLi.querySelector(".rcv");
  2219. [hpDom,atkDom,rcvDom].forEach(function(div,ai){
  2220. if (mainAbility)
  2221. {
  2222. div.classList.remove(className_displayNone);
  2223. div.innerHTML = memberData.ability[ai];
  2224. }else
  2225. {
  2226. div.classList.add(className_displayNone);
  2227. div.innerHTML = 0;
  2228. }
  2229. });
  2230. }
  2231. //刷新队伍能力值合计
  2232. function refreshTeamTotalHP(totalDom,team){
  2233. //计算总的生命值
  2234. if (!totalDom) return;
  2235. const tHpDom = totalDom.querySelector(".tIf-total-hp");
  2236. const tRcvDom = totalDom.querySelector(".tIf-total-rcv");
  2237. if (tHpDom)
  2238. {
  2239. //因为目前仅用于1P、3P,所以直接固定写了
  2240. const leader1id = team[0][0].id;
  2241. //const leader2 = teamsCount==2 ? Cards[team2[0][0].id] : Cards[team[0][5].id]; //这个写法无法获得队伍2的队长
  2242. const leader2id = team[0][5].id;
  2243. const teamHPArr = countTeamHp(team[0],leader1id,leader2id,solo);
  2244. const tHP = teamHPArr.reduce((pv,v)=>pv+v); //队伍计算的总HP
  2245. const teamHPAwoken = awokenCountInTeam(team,46,solo, teamsCount); //全队大血包个数
  2246. let badgeHPScale = 1; //徽章倍率
  2247. if (team[2] == 4 && (solo || teamsCount === 3))
  2248. {
  2249. badgeHPScale = 1.05;
  2250. }else if (team[2] == 11 && (solo || teamsCount === 3))
  2251. {
  2252. badgeHPScale = 1.15;
  2253. }
  2254. tHpDom.innerHTML = Math.round(tHP).toString() +
  2255. (teamHPAwoken>0||badgeHPScale!=1 ?
  2256. ("("+Math.round(Math.round(tHP * (1 + 0.05 * teamHPAwoken))*badgeHPScale).toString()+")") :
  2257. "");
  2258. }
  2259. if (tRcvDom)
  2260. {
  2261. const tRCV = team[0].reduce(function(value,mon){ //队伍计算的总回复
  2262. return value += mon.ability ? mon.ability[2] : 0;
  2263. },0);
  2264. const teamRCVAwoken = awokenCountInTeam(team,47,solo, teamsCount); //全队大回复个数
  2265. let badgeRCVScale = 1; //徽章倍率
  2266. if (team[2] == 3 && (solo || teamsCount === 3))
  2267. {
  2268. badgeRCVScale = 1.25;
  2269. }else if (team[2] == 10 && (solo || teamsCount === 3))
  2270. {
  2271. badgeRCVScale = 1.35;
  2272. }
  2273. tRcvDom.innerHTML = tRCV.toString() +
  2274. (teamRCVAwoken>0||badgeRCVScale!=1 ?
  2275. ("("+Math.round(Math.round(tRCV * (1 + 0.10 * teamRCVAwoken))*badgeRCVScale).toString()+")") :
  2276. "");
  2277. }
  2278. }
  2279. //刷新所有队伍能力值合计
  2280. function refreshFormationTotalHP(totalDom, teams){
  2281. //计算总的生命值
  2282. if (!totalDom) return;
  2283. const tHpDom = totalDom.querySelector(".tIf-total-hp");
  2284. const tRcvDom = totalDom.querySelector(".tIf-total-rcv");
  2285. if (tHpDom)
  2286. {
  2287. //因为目前仅用于2P,所以直接在外面固定写了
  2288. const leader1id = teams[0][0][0].id;
  2289. const leader2id = teams[1][0][0].id;
  2290. const tHPArr = teams.map(function(team){
  2291. const teamHPArr = countTeamHp(team[0],leader1id,leader2id,solo);
  2292. const teamTHP = teamHPArr.reduce((pv,v)=>pv+v); //队伍计算的总HP
  2293. const teamHPAwoken = awokenCountInTeam(team,46,solo, teamsCount); //全队大血包个数
  2294. return [teamTHP,teamHPAwoken];
  2295. });
  2296. const tHP = tHPArr.reduce(function(value, teamHP){
  2297. return [value[0] + teamHP[0], value[1] + Math.round(teamHP[0] * (1 + 0.05 * teamHP[1]))];
  2298. },[0,0]);
  2299. tHpDom.innerHTML = Math.round(tHP[0]).toString() +
  2300. (tHP[0] != tHP[1] ? `(${tHP[1]})` : "");
  2301. }
  2302. if (tRcvDom)
  2303. {
  2304. const tRCVArr = teams.map(function(team){
  2305. const teamTRCV = team[0].reduce(function(value,mon){ //队伍计算的总回复
  2306. return value += mon.ability ? mon.ability[2] : 0;
  2307. },0);
  2308. const teamRCVAwoken = awokenCountInTeam(team,47,solo, teamsCount); //全队大回复个数
  2309. return [teamTRCV,teamRCVAwoken];
  2310. },0);
  2311. const tRCV = tRCVArr.reduce(function(value, teamRCV){
  2312. return [value[0] + teamRCV[0], value[1] + Math.round(teamRCV[0] * (1 + 0.10 * teamRCV[1]))];
  2313. },[0,0]);
  2314. tRcvDom.innerHTML = tRCV[0].toString() +
  2315. (tRCV[0] != tRCV[1] ? `(${tRCV[1]})` : "");
  2316. }
  2317. }
  2318. //刷新单人技能CD
  2319. function refreshMemberSkillCD(teamDom,team,idx){
  2320. const memberMonDom = teamDom.querySelector(`.team-members .member-${idx+1} .monster`);
  2321. const assistMonDom = teamDom.querySelector(`.team-assist .member-${idx+1} .monster`);
  2322. const member = team[0][idx];
  2323. const assist = team[1][idx];
  2324. const memberCard = Cards[member.id] || Cards[0];
  2325. const memberSkill = Skills[memberCard.activeSkillId];
  2326. const assistCard = Cards[assist.id] || Cards[0];
  2327. const assistSkill = Skills[assistCard.activeSkillId];
  2328. const memberSkillCdDom = memberMonDom.querySelector(".skill");
  2329. const assistSkillCdDom = assistMonDom.querySelector(".skill");
  2330. const memberSkillCd = memberSkill ? (memberSkill.initialCooldown - (member.skilllevel||memberSkill.maxLevel) + 1) : 0;
  2331. const assistSkillCd = assistSkill ? (assistSkill.initialCooldown - (assist.skilllevel||assistSkill.maxLevel) + 1) : 0;
  2332. memberSkillCdDom.innerHTML = memberSkillCd;
  2333. assistSkillCdDom.innerHTML = memberSkillCd + assistSkillCd;
  2334. if (member.skilllevel != undefined && member.skilllevel < memberSkill.maxLevel)
  2335. {
  2336. memberSkillCdDom.classList.remove("max-skill");
  2337. }else
  2338. {
  2339. memberSkillCdDom.classList.add("max-skill");
  2340. }
  2341. if (assist.skilllevel != undefined && assist.skilllevel < assistSkill.maxLevel){
  2342. assistSkillCdDom.classList.remove("max-skill");
  2343. }else
  2344. {
  2345. assistSkillCdDom.classList.add("max-skill");
  2346. }
  2347. }
  2348. function localisation($tra)
  2349. {
  2350. if (!$tra) return;
  2351. document.title = $tra.webpage_title;
  2352. formationBox.querySelector(".title-box .title").placeholder = $tra.title_blank;
  2353. formationBox.querySelector(".detail-box .detail").placeholder = $tra.detail_blank;
  2354. const s_sortList = editBox.querySelector(".search-box .sort-div .sort-list");
  2355. const sortOptions = Array.from(s_sortList.options);
  2356. sortOptions.forEach(opt=>{
  2357. const tag = opt.getAttribute("data-tag");
  2358. const trans = $tra.sort_name[tag];
  2359. if (trans)
  2360. {
  2361. opt.text = trans;
  2362. }
  2363. });
  2364. }

智龙迷城队伍图制作工具