加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
sum.js 1.25 KB
一键复制 编辑 原始数据 按行查看 历史
NeeGo 提交于 2021-11-23 11:19 . 修复sum的BUG
const dotenv = require('dotenv');
const result = dotenv.config();
if (result.error) {
throw result.error;
}
const config = require('./config');
const MetamonApi = require('./metamon_api');
async function sum() {
let metamonApi = new MetamonApi(config.address, config.chain, config.privateKey);
let accessToken = await metamonApi.login();
metamonApi.setAccessToken(accessToken);
let metamons = await metamonApi.getMetamonList();
let b320T324 = 0 ;
let b315T319 = 0;
let l314 = 0;
let g325 = 0;
for(let i=0; i<metamons.length; i++) {
let item = metamons[i];
console.log("宠物#"+item.tokenId+",等级:"+item.level+",稀有度:"+item.rarity+",能力值:"+item.sca);
let sca = item.sca;
if (sca <= 314) {
l314 ++;
} else if (315 <= sca && sca <= 319) {
b315T319 ++;
} else if (320 <= sca && sca <= 324) {
b320T324 ++;
} else {
g325 ++;
}
}
console.log("===================================================================");
console.log("元兽数量:"+metamons.length);
console.log("能力统计:325以上:"+g325+",320-324:"+b320T324+",315-319:"+b315T319+",314以下:"+l314);
}
sum();
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化