query owner

This commit is contained in:
2026-01-22 11:23:57 +08:00
parent d60a9b0d8f
commit 03e912d31c
3 changed files with 56 additions and 22 deletions
+23 -18
View File
@@ -47,7 +47,7 @@ class BcmTool
['防守技能', 48],
['身体素质', 50],
]);
private mgrTeamInfo = g_game.mgr.mgr_team_player_team_info;
private mgrPlayers = g_game.mgr.mgr_team_player_team_info;
private mgrMarket = g_game.mgr.mgr_market;
public ExportPlayerInfo(playersToQuery: string[])
@@ -141,12 +141,16 @@ class BcmTool
{
break;
}
const info = this.mgrMarket._map_player_infos[id];
const info = this.mgrMarket.GetSellPlayer(id);
if (!this.CheckInfo(info.playerId))
{
await this.RefreshPlayerInTransaction(info.teamId, info.playerId);
await this.OpenPlayerInTransaction(info.teamId, info.playerId);
await this.Wait(100);
maxIterate -= 1;
if (!this.CheckInfo(info.playerId))
{
continue;
}
}
if (conditions.every((e, i) => e(info.playerId, requireAttributes[i], requireValues[i])))
{
@@ -163,20 +167,15 @@ class BcmTool
const value = this.QueryInfo(result.playerId, requireAttributes[idx]);
return `${search}:${value}`;
});
// TODO TeamName
console.log(`${result.playerName}(${result.playerAge})`, ...displayStr);
console.log(`${result.playerName}(${this.QueryOwner(result.playerId)})`, ...displayStr);
}
}
public QuickOpenPlayer(name:string) {
}
private RefreshPlayerInTransaction(teamId: string, playerId: string)
private OpenPlayerInTransaction(teamId: string, playerId: string)
{
return new Promise<void>(resolve =>
{
this.mgrTeamInfo.OpenPlayerDetailInTransaction(teamId, playerId, e =>
this.mgrPlayers.OpenPlayerDetailInTransaction(teamId, playerId, e =>
{
resolve()
return true;
@@ -190,30 +189,36 @@ class BcmTool
public CheckInfo(playerId: string)
{
const data = this.mgrTeamInfo.GetPlayerData(playerId);
const data = this.mgrPlayers.GetPlayerData(playerId);
return data != null;
}
public QueryName(playerId: string)
{
const data = this.mgrTeamInfo.GetPlayerData(playerId);
return data.playerName;
const data = this.mgrPlayers.GetPlayerData(playerId);
return data?.playerName;
}
public QueryInfo(playerId: string, attri: number)
{
const data = this.mgrTeamInfo.GetPlayerData(playerId);
return data.GetSingleAttribute(attri);
const data = this.mgrPlayers.GetPlayerData(playerId);
return data?.GetSingleAttribute(attri);
}
public QueryOwner(playerId: string)
{
const data = this.mgrPlayers.GetPlayerData(playerId);
return data?.teamName;
}
public GetPlayerIds()
{
return Object.keys(this.mgrTeamInfo._map_player_detail);
return Object.keys(this.mgrPlayers._map_player_detail);
}
public ListPlayers()
{
const ids = Object.keys(this.mgrTeamInfo._map_player_detail);
const ids = Object.keys(this.mgrPlayers._map_player_detail);
for (const id of ids)
{
console.log(this.QueryName(id), id);