Files
bcm-tool/dist/bcm_tool.js
T
2026-01-20 16:56:27 +08:00

143 lines
4.2 KiB
JavaScript

"use strict";
class BcmTool {
constructor() {
this.mgrTeamInfo = g_game.mgr.mgr_team_player_team_info;
}
queryPlayerInfo(playersToQuery) {
const attributes = [
['速度', 1],
['力量', 2],
['内攻', 3],
['中投', 4],
['三分', 5],
['三分急停跳投倾向', 6],
['内线防守能力', 7],
['外线防守能力', 8],
['突破能力', 9],
['上篮能力', 10],
['控球能力', 11],
['传球能力', 12],
['传球视野', 13],
['干扰投篮', 14],
['篮板能力', 15],
['*出手时间', 16],
['*进攻IQ', 17],
['*防守IQ', 18],
['体能', 19],
['卡位能力', 20],
['罚球能力', 21],
['抢断能力', 22],
['盖帽能力', 23],
['*进攻犯规', 24],
['*防守犯规', 25],
['扣篮能力', 26],
['勾手倾向', 27],
['*后仰倾向', 28],
['打板倾向', 29],
['*反应时间', 30],
['拉开空间', 31],
['补防、协防', 32],
['*造进攻犯规', 33],
['快下', 34],
['无球跑动', 35],
['挡拆', 36],
['*造防守犯规', 37],
['无球掩护', 38],
['进攻篮板', 39],
['*假动作', 40],
['攻转守', 41],
['进攻技能', 44],
['防守技能', 48],
['身体素质', 50],
];
var form = new Form();
for (let i = 0; i != attributes.length; ++i) {
form.SetCell(i + 1, 0, attributes[i][0]);
}
for (let i = 0; i != playersToQuery.length; ++i) {
const playerId = playersToQuery[i];
if (!this.checkInfo(playerId)) {
console.log('找不到id', playerId);
continue;
}
form.SetCell(0, i + 1, this.queryName(playerId));
for (let j = 0; j != attributes.length; ++j) {
const record = this.queryInfo(playerId, attributes[j][1]);
form.SetCell(j + 1, i + 1, record.toString());
}
}
console.log(form);
g_game.tools.CopyStrToClipboard(form.ToString());
}
checkInfo(playerId) {
const data = this.mgrTeamInfo.GetPlayerData(playerId);
return data != null;
}
queryName(playerId) {
const data = this.mgrTeamInfo.GetPlayerData(playerId);
return data.playerName;
}
queryInfo(playerId, attri) {
const data = this.mgrTeamInfo.GetPlayerData(playerId);
return data.GetSingleAttribute(attri).toFixed(2);
}
getPlayerIds() {
return Object.keys(this.mgrTeamInfo._map_player_detail);
}
listPlayers() {
const ids = Object.keys(this.mgrTeamInfo._map_player_detail);
for (const id of ids) {
console.log(this.queryName(id), id);
}
}
}
class Logger {
constructor() {
this.msgs = '';
}
Info(...msgs) {
for (const msg of msgs) {
this.msgs += String(msg);
}
}
NextLine() {
this.msgs += '\n';
}
GetContent() {
return this.msgs;
}
Clear() {
this.msgs = '';
}
}
class Form {
constructor() {
this.records = [];
}
SetCell(col, row, data) {
if (this.records[col] == null) {
this.records[col] = [];
}
this.records[col][row] = data;
}
ToString() {
var _a;
var logger = new Logger();
for (let col = 0; col != this.records.length; ++col) {
for (let row = 0; row != this.records[col].length; ++row) {
logger.Info((_a = this.records[col][row]) !== null && _a !== void 0 ? _a : '');
if (row < this.records[col].length - 1) {
logger.Info(',');
}
}
if (col < this.records.length - 1) {
logger.NextLine();
}
}
return logger.GetContent();
}
}
(() => {
g_game.bcm_tool = new BcmTool();
})();