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
+15 -10
View File
@@ -1,5 +1,6 @@
"use strict"; "use strict";
function queryPlayerInfo(playersToQuery) { class BcmTool {
queryPlayerInfo(playersToQuery) {
const attributes = [ const attributes = [
['速度', 1], ['速度', 1],
['力量', 2], ['力量', 2],
@@ -47,28 +48,32 @@ function queryPlayerInfo(playersToQuery) {
['身体素质', 50], ['身体素质', 50],
]; ];
for (const playerId of playersToQuery) { for (const playerId of playersToQuery) {
if (!checkInfo(playerId)) { if (!this.checkInfo(playerId)) {
console.log('找不到id', playerId); console.log('找不到id', playerId);
continue; continue;
} }
console.log(queryName(playerId)); console.log(this.queryName(playerId));
for (const info of attributes) { for (const info of attributes) {
const name = info[0]; const name = info[0];
const id = info[1]; const id = info[1];
const record = queryInfo(playerId, id); const record = this.queryInfo(playerId, id);
console.log(name, record); console.log(name, record);
} }
} }
} }
function checkInfo(playerId) { checkInfo(playerId) {
const data = g_game.mgr.mgr_team_player_team_info.GetPlayerData(playerId); const data = g_game.mgr.mgr_team_player_team_info.GetPlayerData(playerId);
return data != null; return data != null;
} }
function queryName(playerId) { queryName(playerId) {
const data = g_game.mgr.mgr_team_player_team_info.GetPlayerData(playerId); const data = g_game.mgr.mgr_team_player_team_info.GetPlayerData(playerId);
return data.playerName; return data.playerName;
} }
function queryInfo(playerId, attri) { queryInfo(playerId, attri) {
const data = g_game.mgr.mgr_team_player_team_info.GetPlayerData(playerId); const data = g_game.mgr.mgr_team_player_team_info.GetPlayerData(playerId);
return data.GetSingleAttribute(attri); return data.GetSingleAttribute(attri);
}
} }
(() => {
g_game.bcm_tool = new BcmTool();
})();
+18 -10
View File
@@ -1,5 +1,7 @@
function queryPlayerInfo(playersToQuery:string[]) { class BcmTool {
public queryPlayerInfo(playersToQuery:string[]) {
const attributes = [ const attributes = [
['速度', 1], ['速度', 1],
['力量', 2], ['力量', 2],
@@ -48,31 +50,37 @@ function queryPlayerInfo(playersToQuery:string[]) {
]; ];
for (const playerId of playersToQuery) { for (const playerId of playersToQuery) {
if (!checkInfo(playerId)) { if (!this.checkInfo(playerId)) {
console.log('找不到id', playerId); console.log('找不到id', playerId);
continue; continue;
} }
console.log(queryName(playerId)); console.log(this.queryName(playerId));
for (const info of attributes) { for (const info of attributes) {
const name = info[0]; const name = info[0];
const id = info[1]; const id = info[1];
const record = queryInfo(playerId, id as number); const record = this.queryInfo(playerId, id as number);
console.log(name, record); console.log(name, record);
} }
} }
} }
function checkInfo(playerId:string) { public checkInfo(playerId:string) {
const data = g_game.mgr.mgr_team_player_team_info.GetPlayerData(playerId); const data = g_game.mgr.mgr_team_player_team_info.GetPlayerData(playerId);
return data != null; return data != null;
} }
function queryName(playerId:string) { public queryName(playerId:string) {
const data = g_game.mgr.mgr_team_player_team_info.GetPlayerData(playerId); const data = g_game.mgr.mgr_team_player_team_info.GetPlayerData(playerId);
return data.playerName; 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); const data = g_game.mgr.mgr_team_player_team_info.GetPlayerData(playerId);
return data.GetSingleAttribute(attri); return data.GetSingleAttribute(attri);
}
} }
(()=>{
g_game.bcm_tool = new BcmTool();
})();
+1
View File
@@ -18,5 +18,6 @@ declare global
var g_game: { var g_game: {
mgr: BGameMgr; mgr: BGameMgr;
bcm_tool: BcmTool;
}; };
} }