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
+13 -4
View File
@@ -132,11 +132,14 @@ class BcmTool {
if (maxIterate < 0) { if (maxIterate < 0) {
break; break;
} }
const info = this.mgrMarket._map_player_infos[id]; const info = this.mgrMarket.GetSellPlayer(id);
if (!this.CheckInfo(info.playerId)) { if (!this.CheckInfo(info.playerId)) {
yield this.RefreshPlayerInTransaction(info.teamId, info.playerId); yield this.RefreshPlayerInTransaction(info.teamId, info.playerId);
yield this.Wait(100); yield this.Wait(100);
maxIterate -= 1; maxIterate -= 1;
if (!this.CheckInfo(info.playerId)) {
continue;
}
} }
if (conditions.every((e, i) => e(info.playerId, requireAttributes[i], requireValues[i]))) { if (conditions.every((e, i) => e(info.playerId, requireAttributes[i], requireValues[i]))) {
results.push(info); results.push(info);
@@ -150,10 +153,12 @@ class BcmTool {
const value = this.QueryInfo(result.playerId, requireAttributes[idx]); const value = this.QueryInfo(result.playerId, requireAttributes[idx]);
return `${search}:${value}`; return `${search}:${value}`;
}); });
console.log(`${result.playerName}(${result.playerAge})`, ...displayStr); console.log(`${result.playerName}(${this.QueryPlayerOwner(result.playerId)})`, ...displayStr);
} }
}); });
} }
QuickOpenPlayer(name) {
}
RefreshPlayerInTransaction(teamId, playerId) { RefreshPlayerInTransaction(teamId, playerId) {
return new Promise(resolve => { return new Promise(resolve => {
this.mgrTeamInfo.OpenPlayerDetailInTransaction(teamId, playerId, e => { this.mgrTeamInfo.OpenPlayerDetailInTransaction(teamId, playerId, e => {
@@ -170,11 +175,15 @@ class BcmTool {
} }
QueryName(playerId) { QueryName(playerId) {
const data = this.mgrTeamInfo.GetPlayerData(playerId); const data = this.mgrTeamInfo.GetPlayerData(playerId);
return data.playerName; return data === null || data === void 0 ? void 0 : data.playerName;
} }
QueryInfo(playerId, attri) { QueryInfo(playerId, attri) {
const data = this.mgrTeamInfo.GetPlayerData(playerId); const data = this.mgrTeamInfo.GetPlayerData(playerId);
return data.GetSingleAttribute(attri); return data === null || data === void 0 ? void 0 : data.GetSingleAttribute(attri);
}
QueryPlayerOwner(playerId) {
const data = this.mgrTeamInfo.GetPlayerData(playerId);
return data === null || data === void 0 ? void 0 : data.teamName;
} }
GetPlayerIds() { GetPlayerIds() {
return Object.keys(this.mgrTeamInfo._map_player_detail); return Object.keys(this.mgrTeamInfo._map_player_detail);
+23 -18
View File
@@ -47,7 +47,7 @@ class BcmTool
['防守技能', 48], ['防守技能', 48],
['身体素质', 50], ['身体素质', 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; private mgrMarket = g_game.mgr.mgr_market;
public ExportPlayerInfo(playersToQuery: string[]) public ExportPlayerInfo(playersToQuery: string[])
@@ -141,12 +141,16 @@ class BcmTool
{ {
break; break;
} }
const info = this.mgrMarket._map_player_infos[id]; const info = this.mgrMarket.GetSellPlayer(id);
if (!this.CheckInfo(info.playerId)) if (!this.CheckInfo(info.playerId))
{ {
await this.RefreshPlayerInTransaction(info.teamId, info.playerId); await this.OpenPlayerInTransaction(info.teamId, info.playerId);
await this.Wait(100); await this.Wait(100);
maxIterate -= 1; maxIterate -= 1;
if (!this.CheckInfo(info.playerId))
{
continue;
}
} }
if (conditions.every((e, i) => e(info.playerId, requireAttributes[i], requireValues[i]))) 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]); const value = this.QueryInfo(result.playerId, requireAttributes[idx]);
return `${search}:${value}`; return `${search}:${value}`;
}); });
// TODO TeamName console.log(`${result.playerName}(${this.QueryOwner(result.playerId)})`, ...displayStr);
console.log(`${result.playerName}(${result.playerAge})`, ...displayStr);
} }
} }
public QuickOpenPlayer(name:string) { private OpenPlayerInTransaction(teamId: string, playerId: string)
}
private RefreshPlayerInTransaction(teamId: string, playerId: string)
{ {
return new Promise<void>(resolve => return new Promise<void>(resolve =>
{ {
this.mgrTeamInfo.OpenPlayerDetailInTransaction(teamId, playerId, e => this.mgrPlayers.OpenPlayerDetailInTransaction(teamId, playerId, e =>
{ {
resolve() resolve()
return true; return true;
@@ -190,30 +189,36 @@ class BcmTool
public CheckInfo(playerId: string) public CheckInfo(playerId: string)
{ {
const data = this.mgrTeamInfo.GetPlayerData(playerId); const data = this.mgrPlayers.GetPlayerData(playerId);
return data != null; return data != null;
} }
public QueryName(playerId: string) public QueryName(playerId: string)
{ {
const data = this.mgrTeamInfo.GetPlayerData(playerId); const data = this.mgrPlayers.GetPlayerData(playerId);
return data.playerName; return data?.playerName;
} }
public QueryInfo(playerId: string, attri: number) public QueryInfo(playerId: string, attri: number)
{ {
const data = this.mgrTeamInfo.GetPlayerData(playerId); const data = this.mgrPlayers.GetPlayerData(playerId);
return data.GetSingleAttribute(attri); return data?.GetSingleAttribute(attri);
}
public QueryOwner(playerId: string)
{
const data = this.mgrPlayers.GetPlayerData(playerId);
return data?.teamName;
} }
public GetPlayerIds() public GetPlayerIds()
{ {
return Object.keys(this.mgrTeamInfo._map_player_detail); return Object.keys(this.mgrPlayers._map_player_detail);
} }
public ListPlayers() 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) for (const id of ids)
{ {
console.log(this.QueryName(id), id); console.log(this.QueryName(id), id);
+20
View File
@@ -6,6 +6,7 @@ declare global
{ {
public mgr_team_player_team_info: MgrTeamPlayerInfo; public mgr_team_player_team_info: MgrTeamPlayerInfo;
public mgr_market: MgrMarket; public mgr_market: MgrMarket;
public mgr_team_info: MgrTeamInfo;
} }
interface BGameTools interface BGameTools
@@ -24,6 +25,7 @@ declare global
interface MgrMarket interface MgrMarket
{ {
public _map_player_infos: { [key: string]: CMarketPlayerInfo }; public _map_player_infos: { [key: string]: CMarketPlayerInfo };
public GetSellPlayer(id: string): CMarketPlayerInfo;
public SendSynOpenMarketInfoByFilter(callback?: () => void); public SendSynOpenMarketInfoByFilter(callback?: () => void);
} }
@@ -47,6 +49,24 @@ declare global
} }
interface MgrTeamInfo
{
public _map_team_info: { [key: string]: CTeam };
public GetTeamInfoById(id: string): CTeam;
public OpenTeamDetails(player_id: string, turnState?: boolean);
public SendGetTeamInfo(arr_team_id: string[], callback: () => void);
}
interface CTeam
{
public name: string;
public unionName: string;
public webChat: string;
public qq: string;
public stadium: string;
}
var g_game: { var g_game: {
bcm_tool: BcmTool; bcm_tool: BcmTool;
mgr: BGameMgr; mgr: BGameMgr;