logger
This commit is contained in:
Vendored
+15
-7
@@ -1,5 +1,11 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const logger_1 = require("./logger");
|
||||||
class BcmTool {
|
class BcmTool {
|
||||||
|
constructor() {
|
||||||
|
this.mgrTeamInfo = g_game.mgr.mgr_team_player_team_info;
|
||||||
|
this.logger = new logger_1.Logger();
|
||||||
|
}
|
||||||
queryPlayerInfo(playersToQuery) {
|
queryPlayerInfo(playersToQuery) {
|
||||||
const attributes = [
|
const attributes = [
|
||||||
['速度', 1],
|
['速度', 1],
|
||||||
@@ -52,29 +58,31 @@ class BcmTool {
|
|||||||
console.log('找不到id', playerId);
|
console.log('找不到id', playerId);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
console.log(this.queryName(playerId));
|
this.logger.Info(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 = this.queryInfo(playerId, id);
|
const record = this.queryInfo(playerId, id);
|
||||||
console.log(name, record);
|
this.logger.Info(name, record);
|
||||||
}
|
}
|
||||||
|
g_game.mgr.tools.CopyStrToClipboard(this.logger.GetOutput());
|
||||||
|
this.logger.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
checkInfo(playerId) {
|
checkInfo(playerId) {
|
||||||
const data = g_game.mgr.mgr_team_player_team_info.GetPlayerData(playerId);
|
const data = this.mgrTeamInfo.GetPlayerData(playerId);
|
||||||
return data != null;
|
return data != null;
|
||||||
}
|
}
|
||||||
queryName(playerId) {
|
queryName(playerId) {
|
||||||
const data = g_game.mgr.mgr_team_player_team_info.GetPlayerData(playerId);
|
const data = this.mgrTeamInfo.GetPlayerData(playerId);
|
||||||
return data.playerName;
|
return data.playerName;
|
||||||
}
|
}
|
||||||
queryInfo(playerId, attri) {
|
queryInfo(playerId, attri) {
|
||||||
const data = g_game.mgr.mgr_team_player_team_info.GetPlayerData(playerId);
|
const data = this.mgrTeamInfo.GetPlayerData(playerId);
|
||||||
return data.GetSingleAttribute(attri);
|
return data.GetSingleAttribute(attri).toFixed(2);
|
||||||
}
|
}
|
||||||
listPlayers() {
|
listPlayers() {
|
||||||
const ids = Object.keys(g_game.mgr.mgr_team_player_team_info._map_player_detail);
|
const ids = Object.keys(this.mgrTeamInfo._map_player_detail);
|
||||||
for (const id of ids) {
|
for (const id of ids) {
|
||||||
console.log(this.queryName(id), id);
|
console.log(this.queryName(id), id);
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+21
@@ -0,0 +1,21 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.Logger = void 0;
|
||||||
|
class Logger {
|
||||||
|
constructor() {
|
||||||
|
this.msgs = '';
|
||||||
|
}
|
||||||
|
Info(...msgs) {
|
||||||
|
for (const msg of msgs) {
|
||||||
|
this.msgs += String(msg);
|
||||||
|
}
|
||||||
|
this.msgs += '\n';
|
||||||
|
}
|
||||||
|
GetOutput() {
|
||||||
|
return this.msgs;
|
||||||
|
}
|
||||||
|
Clear() {
|
||||||
|
this.msgs = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.Logger = Logger;
|
||||||
+12
-7
@@ -1,5 +1,8 @@
|
|||||||
|
import { Logger } from "./logger";
|
||||||
|
|
||||||
class BcmTool {
|
class BcmTool {
|
||||||
|
private mgrTeamInfo = g_game.mgr.mgr_team_player_team_info;
|
||||||
|
private logger = new Logger();
|
||||||
|
|
||||||
public queryPlayerInfo(playersToQuery:string[]) {
|
public queryPlayerInfo(playersToQuery:string[]) {
|
||||||
const attributes = [
|
const attributes = [
|
||||||
@@ -54,33 +57,35 @@ class BcmTool {
|
|||||||
console.log('找不到id', playerId);
|
console.log('找不到id', playerId);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
console.log(this.queryName(playerId));
|
this.logger.Info(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 = this.queryInfo(playerId, id as number);
|
const record = this.queryInfo(playerId, id as number);
|
||||||
console.log(name, record);
|
this.logger.Info(name, record);
|
||||||
}
|
}
|
||||||
|
g_game.mgr.tools.CopyStrToClipboard(this.logger.GetOutput());
|
||||||
|
this.logger.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public checkInfo(playerId:string) {
|
public checkInfo(playerId:string) {
|
||||||
const data = g_game.mgr.mgr_team_player_team_info.GetPlayerData(playerId);
|
const data = this.mgrTeamInfo.GetPlayerData(playerId);
|
||||||
return data != null;
|
return data != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public queryName(playerId:string) {
|
public queryName(playerId:string) {
|
||||||
const data = g_game.mgr.mgr_team_player_team_info.GetPlayerData(playerId);
|
const data = this.mgrTeamInfo.GetPlayerData(playerId);
|
||||||
return data.playerName;
|
return data.playerName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public 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 = this.mgrTeamInfo.GetPlayerData(playerId);
|
||||||
return data.GetSingleAttribute(attri);
|
return data.GetSingleAttribute(attri).toFixed(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public listPlayers() {
|
public listPlayers() {
|
||||||
const ids = Object.keys(g_game.mgr.mgr_team_player_team_info._map_player_detail);
|
const ids = Object.keys(this.mgrTeamInfo._map_player_detail);
|
||||||
for (const id of ids) {
|
for (const id of ids) {
|
||||||
console.log(this.queryName(id), id);
|
console.log(this.queryName(id), id);
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+5
@@ -4,6 +4,11 @@ declare global
|
|||||||
{
|
{
|
||||||
interface BGameMgr {
|
interface BGameMgr {
|
||||||
public mgr_team_player_team_info: MgrTeamPlayerInfo;
|
public mgr_team_player_team_info: MgrTeamPlayerInfo;
|
||||||
|
public tools: BGameTools;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface BGameTools {
|
||||||
|
public CopyStrToClipboard(str:string, success?:Function);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface MgrTeamPlayerInfo {
|
interface MgrTeamPlayerInfo {
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
|
||||||
|
export 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 = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user