Files
bcm-tool/src/bcm_tool.ts
T

116 lines
2.5 KiB
TypeScript
Raw Normal View History

2026-01-20 10:21:38 +08:00
2026-01-20 10:28:10 +08:00
class BcmTool {
2026-01-20 16:22:31 +08:00
private mgrTeamInfo = g_game.mgr.mgr_team_player_team_info;
private logger = new Logger();
2026-01-20 10:28:10 +08:00
public queryPlayerInfo(playersToQuery:string[]) {
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],
];
for (const playerId of playersToQuery) {
if (!this.checkInfo(playerId)) {
console.log('找不到id', playerId);
continue;
}
2026-01-20 16:22:31 +08:00
this.logger.Info(this.queryName(playerId));
2026-01-20 10:28:10 +08:00
for (const info of attributes) {
const name = info[0];
const id = info[1];
const record = this.queryInfo(playerId, id as number);
2026-01-20 16:22:31 +08:00
this.logger.Info(name, record);
2026-01-20 10:28:10 +08:00
}
2026-01-20 16:22:31 +08:00
g_game.mgr.tools.CopyStrToClipboard(this.logger.GetOutput());
this.logger.Clear();
2026-01-20 10:21:38 +08:00
}
}
2026-01-20 10:28:10 +08:00
public checkInfo(playerId:string) {
2026-01-20 16:22:31 +08:00
const data = this.mgrTeamInfo.GetPlayerData(playerId);
2026-01-20 10:28:10 +08:00
return data != null;
}
public queryName(playerId:string) {
2026-01-20 16:22:31 +08:00
const data = this.mgrTeamInfo.GetPlayerData(playerId);
2026-01-20 10:28:10 +08:00
return data.playerName;
}
public queryInfo(playerId:string, attri:number) {
2026-01-20 16:22:31 +08:00
const data = this.mgrTeamInfo.GetPlayerData(playerId);
return data.GetSingleAttribute(attri).toFixed(2);
2026-01-20 10:28:10 +08:00
}
2026-01-20 10:21:38 +08:00
2026-01-20 11:43:33 +08:00
public listPlayers() {
2026-01-20 16:22:31 +08:00
const ids = Object.keys(this.mgrTeamInfo._map_player_detail);
2026-01-20 11:43:33 +08:00
for (const id of ids) {
console.log(this.queryName(id), id);
}
}
2026-01-20 10:21:38 +08:00
}
2026-01-20 16:24:17 +08:00
class Logger {
private msgs = '';
public Info(...msgs:any[]) {
for (const msg of msgs) {
this.msgs += String(msg);
}
this.msgs += '\n';
}
public GetOutput() {
return this.msgs;
}
public Clear() {
this.msgs = '';
}
}
2026-01-20 10:28:10 +08:00
(()=>{
g_game.bcm_tool = new BcmTool();
})();