This commit is contained in:
2026-01-20 10:28:10 +08:00
parent 11fe49c020
commit cccd01e841
3 changed files with 157 additions and 143 deletions
+12 -7
View File
@@ -1,5 +1,6 @@
"use strict";
function queryPlayerInfo(playersToQuery) {
class BcmTool {
queryPlayerInfo(playersToQuery) {
const attributes = [
['速度', 1],
['力量', 2],
@@ -47,28 +48,32 @@ function queryPlayerInfo(playersToQuery) {
['身体素质', 50],
];
for (const playerId of playersToQuery) {
if (!checkInfo(playerId)) {
if (!this.checkInfo(playerId)) {
console.log('找不到id', playerId);
continue;
}
console.log(queryName(playerId));
console.log(this.queryName(playerId));
for (const info of attributes) {
const name = info[0];
const id = info[1];
const record = queryInfo(playerId, id);
const record = this.queryInfo(playerId, id);
console.log(name, record);
}
}
}
function checkInfo(playerId) {
checkInfo(playerId) {
const data = g_game.mgr.mgr_team_player_team_info.GetPlayerData(playerId);
return data != null;
}
function queryName(playerId) {
queryName(playerId) {
const data = g_game.mgr.mgr_team_player_team_info.GetPlayerData(playerId);
return data.playerName;
}
function queryInfo(playerId, attri) {
queryInfo(playerId, attri) {
const data = g_game.mgr.mgr_team_player_team_info.GetPlayerData(playerId);
return data.GetSingleAttribute(attri);
}
}
(() => {
g_game.bcm_tool = new BcmTool();
})();
+15 -7
View File
@@ -1,5 +1,7 @@
function queryPlayerInfo(playersToQuery:string[]) {
class BcmTool {
public queryPlayerInfo(playersToQuery:string[]) {
const attributes = [
['速度', 1],
['力量', 2],
@@ -48,31 +50,37 @@ function queryPlayerInfo(playersToQuery:string[]) {
];
for (const playerId of playersToQuery) {
if (!checkInfo(playerId)) {
if (!this.checkInfo(playerId)) {
console.log('找不到id', playerId);
continue;
}
console.log(queryName(playerId));
console.log(this.queryName(playerId));
for (const info of attributes) {
const name = info[0];
const id = info[1];
const record = queryInfo(playerId, id as number);
const record = this.queryInfo(playerId, id as number);
console.log(name, record);
}
}
}
function checkInfo(playerId:string) {
public checkInfo(playerId:string) {
const data = g_game.mgr.mgr_team_player_team_info.GetPlayerData(playerId);
return data != null;
}
function queryName(playerId:string) {
public queryName(playerId:string) {
const data = g_game.mgr.mgr_team_player_team_info.GetPlayerData(playerId);
return data.playerName;
}
function queryInfo(playerId:string, attri:number) {
public queryInfo(playerId:string, attri:number) {
const data = g_game.mgr.mgr_team_player_team_info.GetPlayerData(playerId);
return data.GetSingleAttribute(attri);
}
}
(()=>{
g_game.bcm_tool = new BcmTool();
})();
+1
View File
@@ -18,5 +18,6 @@ declare global
var g_game: {
mgr: BGameMgr;
bcm_tool: BcmTool;
};
}