2026-01-20 10:21:38 +08:00
|
|
|
|
2026-01-20 16:56:27 +08:00
|
|
|
class BcmTool
|
|
|
|
|
{
|
2026-01-20 18:38:37 +08:00
|
|
|
private attributes = new Map<string, number>([
|
|
|
|
|
['速度', 1],
|
|
|
|
|
['力量', 2],
|
|
|
|
|
['内攻', 3],
|
|
|
|
|
['中投', 4],
|
|
|
|
|
['三分', 5],
|
|
|
|
|
['三分急停跳投倾向', 6],
|
|
|
|
|
['内线防守能力', 7],
|
|
|
|
|
['外线防守能力', 8],
|
|
|
|
|
['突破能力', 9],
|
|
|
|
|
['上篮能力', 10],
|
|
|
|
|
['控球能力', 11],
|
|
|
|
|
['传球能力', 12],
|
|
|
|
|
['传球视野', 13],
|
|
|
|
|
['干扰投篮', 14],
|
|
|
|
|
['篮板能力', 15],
|
|
|
|
|
['*出手时间', 16],
|
|
|
|
|
['*进攻IQ', 17],
|
|
|
|
|
['*防守IQ', 18],
|
|
|
|
|
['体能', 19],
|
|
|
|
|
['卡位能力', 20],
|
|
|
|
|
['罚球能力', 21],
|
|
|
|
|
['抢断能力', 22],
|
|
|
|
|
['盖帽能力', 23],
|
|
|
|
|
['*进攻犯规', 24],
|
|
|
|
|
['*防守犯规', 25],
|
|
|
|
|
['扣篮能力', 26],
|
|
|
|
|
['勾手倾向', 27],
|
|
|
|
|
['*后仰倾向', 28],
|
|
|
|
|
['打板倾向', 29],
|
|
|
|
|
['*反应时间', 30],
|
|
|
|
|
['拉开空间', 31],
|
|
|
|
|
['补防、协防', 32],
|
|
|
|
|
['*造进攻犯规', 33],
|
|
|
|
|
['快下', 34],
|
|
|
|
|
['无球跑动', 35],
|
|
|
|
|
['挡拆', 36],
|
|
|
|
|
['*造防守犯规', 37],
|
|
|
|
|
['无球掩护', 38],
|
|
|
|
|
['进攻篮板', 39],
|
|
|
|
|
['*假动作', 40],
|
|
|
|
|
['攻转守', 41],
|
|
|
|
|
['进攻技能', 44],
|
|
|
|
|
['防守技能', 48],
|
|
|
|
|
['身体素质', 50],
|
|
|
|
|
]);
|
2026-01-22 11:23:57 +08:00
|
|
|
private mgrPlayers = g_game.mgr.mgr_team_player_team_info;
|
2026-01-20 18:38:37 +08:00
|
|
|
private mgrMarket = g_game.mgr.mgr_market;
|
2026-01-20 16:22:31 +08:00
|
|
|
|
2026-01-20 18:38:37 +08:00
|
|
|
public ExportPlayerInfo(playersToQuery: string[])
|
2026-01-20 16:56:27 +08:00
|
|
|
{
|
2026-01-20 18:38:37 +08:00
|
|
|
const lstAttributes = [...this.attributes];
|
|
|
|
|
const form = new Form();
|
2026-03-13 18:19:12 +08:00
|
|
|
form.SetCell(0, 0, "姓名");
|
|
|
|
|
form.SetCell(0, 1, "球队");
|
2026-01-20 18:38:37 +08:00
|
|
|
for (let i = 0; i != lstAttributes.length; ++i)
|
2026-01-20 16:56:27 +08:00
|
|
|
{
|
2026-03-13 18:19:12 +08:00
|
|
|
form.SetCell(0, i + 2, lstAttributes[i][0] as string);
|
2026-01-20 16:56:27 +08:00
|
|
|
}
|
|
|
|
|
for (let i = 0; i != playersToQuery.length; ++i)
|
|
|
|
|
{
|
|
|
|
|
const playerId = playersToQuery[i];
|
2026-01-20 18:38:37 +08:00
|
|
|
if (!this.CheckInfo(playerId))
|
2026-01-20 16:56:27 +08:00
|
|
|
{
|
2026-01-20 10:28:10 +08:00
|
|
|
console.log('找不到id', playerId);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2026-03-13 18:19:12 +08:00
|
|
|
form.SetCell(i + 1, 0, this.QueryName(playerId));
|
|
|
|
|
form.SetCell(i + 1, 1, this.QueryOwner(playerId));
|
2026-01-20 18:38:37 +08:00
|
|
|
for (let j = 0; j != lstAttributes.length; ++j)
|
2026-01-20 16:56:27 +08:00
|
|
|
{
|
2026-01-20 18:38:37 +08:00
|
|
|
const record = this.QueryInfo(playerId, lstAttributes[j][1] as number);
|
2026-03-13 18:19:12 +08:00
|
|
|
form.SetCell(i + 2, j + 1, record.toString());
|
2026-01-20 10:28:10 +08:00
|
|
|
}
|
2026-01-20 10:21:38 +08:00
|
|
|
}
|
2026-01-20 16:56:27 +08:00
|
|
|
console.log(form);
|
|
|
|
|
g_game.tools.CopyStrToClipboard(form.ToString());
|
2026-01-20 10:21:38 +08:00
|
|
|
}
|
2026-01-20 16:56:27 +08:00
|
|
|
|
2026-01-20 19:41:40 +08:00
|
|
|
public async BulkSearchMarket(searchStr: string, maxIterate = 100)
|
2026-01-20 18:38:37 +08:00
|
|
|
{
|
|
|
|
|
searchStr = searchStr.replace(/ /g, '');
|
|
|
|
|
const strs = searchStr.split('&&');
|
|
|
|
|
const operators = ['>', '<', '=='];
|
|
|
|
|
const handlers: ((id: string, attri: number, value: number) => boolean)[] = [
|
|
|
|
|
(id: string, attri: number, value: number) =>
|
|
|
|
|
{
|
|
|
|
|
return this.QueryInfo(id, attri) > value;
|
|
|
|
|
},
|
|
|
|
|
(id: string, attri: number, value: number) =>
|
|
|
|
|
{
|
|
|
|
|
return this.QueryInfo(id, attri) < value;
|
|
|
|
|
},
|
|
|
|
|
(id: string, attri: number, value: number) =>
|
|
|
|
|
{
|
|
|
|
|
return Math.floor(this.QueryInfo(id, attri)) == value;
|
|
|
|
|
},
|
|
|
|
|
(id: string, attri: number, value: number) =>
|
|
|
|
|
{
|
|
|
|
|
return this.QueryInfo(id, attri) >= value;
|
|
|
|
|
},
|
|
|
|
|
(id: string, attri: number, value: number) =>
|
|
|
|
|
{
|
|
|
|
|
return this.QueryInfo(id, attri) <= value;
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
const conditions: ((id: string, attri: number, value: number) => boolean)[] = [];
|
|
|
|
|
const requireAttributes: number[] = [];
|
|
|
|
|
const requireSearch: string[] = [];
|
|
|
|
|
const requireValues: number[] = [];
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i != strs.length; ++i)
|
|
|
|
|
{
|
|
|
|
|
const str = strs[i];
|
|
|
|
|
const operator = operators.find(e => str.search(e) != -1);
|
|
|
|
|
if (operator == null)
|
|
|
|
|
{
|
|
|
|
|
console.log('条件解析失败', str);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
const handler = handlers[operators.indexOf(operator)];
|
|
|
|
|
const requires = str.split(operator);
|
|
|
|
|
const attribute = this.attributes.get(requires[0]);
|
|
|
|
|
const value = Number(requires[1]);
|
|
|
|
|
if (attribute == null || handler == null)
|
|
|
|
|
{
|
|
|
|
|
console.log('条件解析失败', str);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
conditions.push(handler);
|
|
|
|
|
requireAttributes.push(attribute);
|
|
|
|
|
requireValues.push(value);
|
|
|
|
|
requireSearch.push(requires[0]);
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-20 19:41:40 +08:00
|
|
|
var results: CPlayerData[] = [];
|
|
|
|
|
const ids = Object.keys(this.mgrMarket._map_player_infos);
|
|
|
|
|
for (const id of ids)
|
2026-01-20 18:38:37 +08:00
|
|
|
{
|
2026-01-20 19:41:40 +08:00
|
|
|
if (maxIterate < 0)
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
2026-01-22 11:23:57 +08:00
|
|
|
const info = this.mgrMarket.GetSellPlayer(id);
|
2026-01-20 19:41:40 +08:00
|
|
|
if (!this.CheckInfo(info.playerId))
|
2026-01-20 18:38:37 +08:00
|
|
|
{
|
2026-01-22 11:23:57 +08:00
|
|
|
await this.OpenPlayerInTransaction(info.teamId, info.playerId);
|
2026-01-20 19:41:40 +08:00
|
|
|
await this.Wait(100);
|
2026-01-20 18:38:37 +08:00
|
|
|
maxIterate -= 1;
|
2026-01-22 11:23:57 +08:00
|
|
|
if (!this.CheckInfo(info.playerId))
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2026-01-20 18:38:37 +08:00
|
|
|
}
|
2026-01-20 19:41:40 +08:00
|
|
|
if (conditions.every((e, i) => e(info.playerId, requireAttributes[i], requireValues[i])))
|
2026-01-20 18:38:37 +08:00
|
|
|
{
|
2026-01-20 19:41:40 +08:00
|
|
|
results.push(info);
|
2026-01-20 18:38:37 +08:00
|
|
|
}
|
2026-01-20 19:41:40 +08:00
|
|
|
}
|
2026-03-13 18:19:12 +08:00
|
|
|
// 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));
|
2026-01-20 19:41:40 +08:00
|
|
|
}
|
|
|
|
|
|
2026-01-22 11:23:57 +08:00
|
|
|
private OpenPlayerInTransaction(teamId: string, playerId: string)
|
2026-01-20 18:38:37 +08:00
|
|
|
{
|
|
|
|
|
return new Promise<void>(resolve =>
|
|
|
|
|
{
|
2026-01-22 11:23:57 +08:00
|
|
|
this.mgrPlayers.OpenPlayerDetailInTransaction(teamId, playerId, e =>
|
2026-01-20 18:38:37 +08:00
|
|
|
{
|
|
|
|
|
resolve()
|
|
|
|
|
return true;
|
|
|
|
|
}, e =>
|
|
|
|
|
{
|
|
|
|
|
resolve();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public CheckInfo(playerId: string)
|
2026-01-20 16:56:27 +08:00
|
|
|
{
|
2026-01-22 11:23:57 +08:00
|
|
|
const data = this.mgrPlayers.GetPlayerData(playerId);
|
2026-01-20 10:28:10 +08:00
|
|
|
return data != null;
|
|
|
|
|
}
|
2026-01-20 16:56:27 +08:00
|
|
|
|
2026-01-20 18:38:37 +08:00
|
|
|
public QueryName(playerId: string)
|
2026-01-20 16:56:27 +08:00
|
|
|
{
|
2026-01-22 11:23:57 +08:00
|
|
|
const data = this.mgrPlayers.GetPlayerData(playerId);
|
|
|
|
|
return data?.playerName;
|
2026-01-20 10:28:10 +08:00
|
|
|
}
|
2026-01-20 16:56:27 +08:00
|
|
|
|
2026-01-20 18:38:37 +08:00
|
|
|
public QueryInfo(playerId: string, attri: number)
|
2026-01-20 16:56:27 +08:00
|
|
|
{
|
2026-01-22 11:23:57 +08:00
|
|
|
const data = this.mgrPlayers.GetPlayerData(playerId);
|
2026-03-13 18:19:12 +08:00
|
|
|
return data?.GetSingleAttribute(attri, true);
|
2026-01-22 11:23:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public QueryOwner(playerId: string)
|
|
|
|
|
{
|
|
|
|
|
const data = this.mgrPlayers.GetPlayerData(playerId);
|
|
|
|
|
return data?.teamName;
|
2026-01-20 10:28:10 +08:00
|
|
|
}
|
2026-01-20 10:21:38 +08:00
|
|
|
|
2026-01-20 18:38:37 +08:00
|
|
|
public GetPlayerIds()
|
2026-01-20 16:56:27 +08:00
|
|
|
{
|
2026-01-22 11:23:57 +08:00
|
|
|
return Object.keys(this.mgrPlayers._map_player_detail);
|
2026-01-20 16:29:43 +08:00
|
|
|
}
|
|
|
|
|
|
2026-01-20 18:38:37 +08:00
|
|
|
public ListPlayers()
|
2026-01-20 16:56:27 +08:00
|
|
|
{
|
2026-01-22 11:23:57 +08:00
|
|
|
const ids = Object.keys(this.mgrPlayers._map_player_detail);
|
2026-01-20 16:56:27 +08:00
|
|
|
for (const id of ids)
|
|
|
|
|
{
|
2026-01-20 18:38:37 +08:00
|
|
|
console.log(this.QueryName(id), id);
|
2026-01-20 11:43:33 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-20 18:38:37 +08:00
|
|
|
public ListMarketPlayers()
|
|
|
|
|
{
|
|
|
|
|
this.mgrMarket.SendSynOpenMarketInfoByFilter(() =>
|
|
|
|
|
{
|
|
|
|
|
console.log(this.mgrMarket._map_player_infos);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-20 19:41:40 +08:00
|
|
|
public Wait(time: number)
|
|
|
|
|
{
|
|
|
|
|
return new Promise<void>(resolve =>
|
|
|
|
|
{
|
|
|
|
|
setTimeout(() =>
|
|
|
|
|
{
|
|
|
|
|
resolve();
|
|
|
|
|
}, time)
|
|
|
|
|
});
|
|
|
|
|
}
|
2026-01-20 10:21:38 +08:00
|
|
|
}
|
|
|
|
|
|
2026-01-20 16:56:27 +08:00
|
|
|
class Logger
|
|
|
|
|
{
|
2026-01-20 16:24:17 +08:00
|
|
|
private msgs = '';
|
|
|
|
|
|
2026-01-20 16:56:27 +08:00
|
|
|
public Info(...msgs: any[])
|
|
|
|
|
{
|
|
|
|
|
for (const msg of msgs)
|
|
|
|
|
{
|
2026-01-20 16:24:17 +08:00
|
|
|
this.msgs += String(msg);
|
|
|
|
|
}
|
2026-01-20 16:56:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public NextLine()
|
|
|
|
|
{
|
2026-01-20 16:24:17 +08:00
|
|
|
this.msgs += '\n';
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-20 16:56:27 +08:00
|
|
|
public GetContent()
|
|
|
|
|
{
|
2026-01-20 16:24:17 +08:00
|
|
|
return this.msgs;
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-20 16:56:27 +08:00
|
|
|
public Clear()
|
|
|
|
|
{
|
2026-01-20 16:24:17 +08:00
|
|
|
this.msgs = '';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-20 16:56:27 +08:00
|
|
|
class Form
|
|
|
|
|
{
|
|
|
|
|
private records: string[][] = [];
|
|
|
|
|
|
|
|
|
|
public SetCell(col: number, row: number, data: string)
|
|
|
|
|
{
|
|
|
|
|
if (this.records[col] == null)
|
|
|
|
|
{
|
|
|
|
|
this.records[col] = [];
|
|
|
|
|
}
|
|
|
|
|
this.records[col][row] = data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ToString()
|
|
|
|
|
{
|
2026-01-20 18:38:37 +08:00
|
|
|
const logger = new Logger();
|
2026-01-20 16:56:27 +08:00
|
|
|
for (let col = 0; col != this.records.length; ++col)
|
|
|
|
|
{
|
|
|
|
|
for (let row = 0; row != this.records[col].length; ++row)
|
|
|
|
|
{
|
|
|
|
|
logger.Info(this.records[col][row] ?? '');
|
|
|
|
|
if (row < this.records[col].length - 1)
|
|
|
|
|
{
|
|
|
|
|
logger.Info(',');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (col < this.records.length - 1)
|
|
|
|
|
{
|
|
|
|
|
logger.NextLine();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return logger.GetContent();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
(() =>
|
|
|
|
|
{
|
2026-01-20 10:28:10 +08:00
|
|
|
g_game.bcm_tool = new BcmTool();
|
|
|
|
|
})();
|