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