update export method
This commit is contained in:
@@ -1 +1 @@
|
||||
g_game.bcm_tool.ExportPlayerInfo(g_game.bcm_tool.EetPlayerIds());
|
||||
g_game.bcm_tool.ExportPlayerInfo(g_game.bcm_tool.GetPlayerIds());
|
||||
Vendored
+30
-27
@@ -56,14 +56,15 @@ class BcmTool {
|
||||
['防守技能', 48],
|
||||
['身体素质', 50],
|
||||
]);
|
||||
this.mgrTeamInfo = g_game.mgr.mgr_team_player_team_info;
|
||||
this.mgrPlayers = g_game.mgr.mgr_team_player_team_info;
|
||||
this.mgrMarket = g_game.mgr.mgr_market;
|
||||
}
|
||||
ExportPlayerInfo(playersToQuery) {
|
||||
const lstAttributes = [...this.attributes];
|
||||
const form = new Form();
|
||||
form.SetCell(0, 1, "球队");
|
||||
for (let i = 0; i != lstAttributes.length; ++i) {
|
||||
form.SetCell(i + 1, 0, lstAttributes[i][0]);
|
||||
form.SetCell(0, i + 2, lstAttributes[i][0]);
|
||||
}
|
||||
for (let i = 0; i != playersToQuery.length; ++i) {
|
||||
const playerId = playersToQuery[i];
|
||||
@@ -71,10 +72,11 @@ class BcmTool {
|
||||
console.log('找不到id', playerId);
|
||||
continue;
|
||||
}
|
||||
form.SetCell(0, i + 1, this.QueryName(playerId));
|
||||
form.SetCell(i + 1, 0, this.QueryName(playerId));
|
||||
form.SetCell(i + 1, 1, this.QueryOwner(playerId));
|
||||
for (let j = 0; j != lstAttributes.length; ++j) {
|
||||
const record = this.QueryInfo(playerId, lstAttributes[j][1]);
|
||||
form.SetCell(j + 1, i + 1, record.toString());
|
||||
form.SetCell(i + 2, j + 1, record.toString());
|
||||
}
|
||||
}
|
||||
console.log(form);
|
||||
@@ -134,7 +136,7 @@ class BcmTool {
|
||||
}
|
||||
const info = this.mgrMarket.GetSellPlayer(id);
|
||||
if (!this.CheckInfo(info.playerId)) {
|
||||
yield this.RefreshPlayerInTransaction(info.teamId, info.playerId);
|
||||
yield this.OpenPlayerInTransaction(info.teamId, info.playerId);
|
||||
yield this.Wait(100);
|
||||
maxIterate -= 1;
|
||||
if (!this.CheckInfo(info.playerId)) {
|
||||
@@ -145,23 +147,24 @@ class BcmTool {
|
||||
results.push(info);
|
||||
}
|
||||
}
|
||||
const displays = new Set(requireAttributes);
|
||||
for (const result of results) {
|
||||
const displayStr = [...displays].map(e => {
|
||||
const idx = requireAttributes.indexOf(e);
|
||||
const search = requireSearch[idx];
|
||||
const value = this.QueryInfo(result.playerId, requireAttributes[idx]);
|
||||
return `${search}:${value}`;
|
||||
});
|
||||
console.log(`${result.playerName}(${this.QueryPlayerOwner(result.playerId)})`, ...displayStr);
|
||||
}
|
||||
// const displays = new Set<number>(requireAttributes);
|
||||
// for (const result of results)
|
||||
// {
|
||||
// const displayStr = [...displays].map(e =>
|
||||
// {
|
||||
// const idx = requireAttributes.indexOf(e);
|
||||
// const search = requireSearch[idx];
|
||||
// const value = this.QueryInfo(result.playerId, requireAttributes[idx]);
|
||||
// return `${search}:${value}`;
|
||||
// });
|
||||
// console.log(`${result.playerName}(${this.QueryOwner(result.playerId)})`, ...displayStr);
|
||||
// }
|
||||
this.ExportPlayerInfo(results.map(e => e.playerId));
|
||||
});
|
||||
}
|
||||
QuickOpenPlayer(name) {
|
||||
}
|
||||
RefreshPlayerInTransaction(teamId, playerId) {
|
||||
OpenPlayerInTransaction(teamId, playerId) {
|
||||
return new Promise(resolve => {
|
||||
this.mgrTeamInfo.OpenPlayerDetailInTransaction(teamId, playerId, e => {
|
||||
this.mgrPlayers.OpenPlayerDetailInTransaction(teamId, playerId, e => {
|
||||
resolve();
|
||||
return true;
|
||||
}, e => {
|
||||
@@ -170,26 +173,26 @@ class BcmTool {
|
||||
});
|
||||
}
|
||||
CheckInfo(playerId) {
|
||||
const data = this.mgrTeamInfo.GetPlayerData(playerId);
|
||||
const data = this.mgrPlayers.GetPlayerData(playerId);
|
||||
return data != null;
|
||||
}
|
||||
QueryName(playerId) {
|
||||
const data = this.mgrTeamInfo.GetPlayerData(playerId);
|
||||
const data = this.mgrPlayers.GetPlayerData(playerId);
|
||||
return data === null || data === void 0 ? void 0 : data.playerName;
|
||||
}
|
||||
QueryInfo(playerId, attri) {
|
||||
const data = this.mgrTeamInfo.GetPlayerData(playerId);
|
||||
return data === null || data === void 0 ? void 0 : data.GetSingleAttribute(attri);
|
||||
const data = this.mgrPlayers.GetPlayerData(playerId);
|
||||
return data === null || data === void 0 ? void 0 : data.GetSingleAttribute(attri, true);
|
||||
}
|
||||
QueryPlayerOwner(playerId) {
|
||||
const data = this.mgrTeamInfo.GetPlayerData(playerId);
|
||||
QueryOwner(playerId) {
|
||||
const data = this.mgrPlayers.GetPlayerData(playerId);
|
||||
return data === null || data === void 0 ? void 0 : data.teamName;
|
||||
}
|
||||
GetPlayerIds() {
|
||||
return Object.keys(this.mgrTeamInfo._map_player_detail);
|
||||
return Object.keys(this.mgrPlayers._map_player_detail);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
+20
-16
@@ -54,9 +54,11 @@ class BcmTool
|
||||
{
|
||||
const lstAttributes = [...this.attributes];
|
||||
const form = new Form();
|
||||
form.SetCell(0, 0, "姓名");
|
||||
form.SetCell(0, 1, "球队");
|
||||
for (let i = 0; i != lstAttributes.length; ++i)
|
||||
{
|
||||
form.SetCell(i + 1, 0, lstAttributes[i][0] as string);
|
||||
form.SetCell(0, i + 2, lstAttributes[i][0] as string);
|
||||
}
|
||||
for (let i = 0; i != playersToQuery.length; ++i)
|
||||
{
|
||||
@@ -66,11 +68,12 @@ class BcmTool
|
||||
console.log('找不到id', playerId);
|
||||
continue;
|
||||
}
|
||||
form.SetCell(0, i + 1, this.QueryName(playerId));
|
||||
form.SetCell(i + 1, 0, this.QueryName(playerId));
|
||||
form.SetCell(i + 1, 1, this.QueryOwner(playerId));
|
||||
for (let j = 0; j != lstAttributes.length; ++j)
|
||||
{
|
||||
const record = this.QueryInfo(playerId, lstAttributes[j][1] as number);
|
||||
form.SetCell(j + 1, i + 1, record.toString());
|
||||
form.SetCell(i + 2, j + 1, record.toString());
|
||||
}
|
||||
}
|
||||
console.log(form);
|
||||
@@ -157,18 +160,19 @@ class BcmTool
|
||||
results.push(info);
|
||||
}
|
||||
}
|
||||
const displays = new Set<number>(requireAttributes);
|
||||
for (const result of results)
|
||||
{
|
||||
const displayStr = [...displays].map(e =>
|
||||
{
|
||||
const idx = requireAttributes.indexOf(e);
|
||||
const search = requireSearch[idx];
|
||||
const value = this.QueryInfo(result.playerId, requireAttributes[idx]);
|
||||
return `${search}:${value}`;
|
||||
});
|
||||
console.log(`${result.playerName}(${this.QueryOwner(result.playerId)})`, ...displayStr);
|
||||
}
|
||||
// const displays = new Set<number>(requireAttributes);
|
||||
// for (const result of results)
|
||||
// {
|
||||
// const displayStr = [...displays].map(e =>
|
||||
// {
|
||||
// const idx = requireAttributes.indexOf(e);
|
||||
// const search = requireSearch[idx];
|
||||
// const value = this.QueryInfo(result.playerId, requireAttributes[idx]);
|
||||
// return `${search}:${value}`;
|
||||
// });
|
||||
// console.log(`${result.playerName}(${this.QueryOwner(result.playerId)})`, ...displayStr);
|
||||
// }
|
||||
this.ExportPlayerInfo(results.map(e => e.playerId));
|
||||
}
|
||||
|
||||
private OpenPlayerInTransaction(teamId: string, playerId: string)
|
||||
@@ -202,7 +206,7 @@ class BcmTool
|
||||
public QueryInfo(playerId: string, attri: number)
|
||||
{
|
||||
const data = this.mgrPlayers.GetPlayerData(playerId);
|
||||
return data?.GetSingleAttribute(attri);
|
||||
return data?.GetSingleAttribute(attri, true);
|
||||
}
|
||||
|
||||
public QueryOwner(playerId: string)
|
||||
|
||||
Reference in New Issue
Block a user