微件:Hydrogina/sandbox/searchgacha
<input type="button" onclick="main()" value="查找卡池">
<script>"use strict";function main(){jsonlist=[],poolist=[],showtext.innerText="";let e="https://raw.githubusercontent.com/Kengxxiao/ArknightsGameData/master/zh_CN/gamedata/excel/gacha_table.json";json_set("gacha",e),e="https://raw.githubusercontent.com/Kengxxiao/ArknightsGameData/master/zh_CN/gamedata/excel/character_table.json",json_set("chara",e),console.log(jsonlist),showresult("正在查找卡池\n"),json_sendrequest(0),json_sendrequest(1)}function json_set(e,t){jsonlist.push({url:t,name:e,json:null})}function json_sendrequest(e){console.log("json_sendrequest",jsonlist[e].name);let t=jsonlist[e].url,s=new XMLHttpRequest;s.i=e,s.open("GET",t),s.responseType="text",s.onload=json_getresponse,s.send()}function json_getresponse(){let e=this,t=e.i;console.log("json_getresponse",jsonlist[t].name);let s=e.response,o=JSON.parse(s);jsonlist[t].json=o,console.log(o),switch_cmd(t)}function switch_cmd(e){0==e&&(flagweedy++,deal(jsonlist[0].json)),1==e&&(character_table=jsonlist[1].json),e>=2&&(showresult("----------------------\n"),showresult(poolist[e-2].gachaPoolName+"\n"),deal_weedy(jsonlist[e].json))}function showresult(e){showtext.innerText+=e}function deal(e){console.log("deal--------------"),console.log(e);let t=e.gachaPoolClient;for(let e=0;e<t.length;e++){let s=t[e],o=s.endTime,n=(new Date).getTime()/1e3;o>n&&(showresult("--------------------\n"),showresult(s.gachaPoolId+"\n"),showresult(s.gachaPoolDetail+"\n"),showresult(s.gachaPoolSummary+"\n"),showresult(s.gachaPoolName+"\n"),numweedy++,poolist.push(s))}let s="https://weedy.prts.wiki/gacha/";for(let e=0;e<poolist.length;e++){let t=s+poolist[e].gachaPoolId;json_set("weedy "+e,t),json_sendrequest(jsonlist.length-1)}}function deal_weedy(e){console.log("deal_weedy"),console.log(e);let t=e.detail.up;for(let e=0;e<t.length;e++){let s=t[e];showresult(s.rarityRank+1+"\n");let o=s.charIdList;for(let e=0;e<o.length;e++){let t=o[e];showresult(t+": "+character_table[t].name+"\n")}}}console.log((new Date).getTime()/1e3);var character_table,showtext=document.getElementById("result"),jsonlist=[],poolist=[],flagweedy=0,numweedy=0;</script>