test
This commit is contained in:
Vendored
+16
-10
@@ -11,7 +11,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
class BcmTool {
|
||||
constructor() {
|
||||
this.attributes = new Map([
|
||||
['年龄', -100],
|
||||
['速度', 1],
|
||||
['力量', 2],
|
||||
['内攻', 3],
|
||||
@@ -81,7 +80,8 @@ class BcmTool {
|
||||
console.log(form);
|
||||
g_game.tools.CopyStrToClipboard(form.ToString());
|
||||
}
|
||||
BulkSearchMarket(searchStr, maxIterate = 100) {
|
||||
BulkSearchMarket(searchStr_1) {
|
||||
return __awaiter(this, arguments, void 0, function* (searchStr, maxIterate = 100) {
|
||||
searchStr = searchStr.replace(/ /g, '');
|
||||
const strs = searchStr.split('&&');
|
||||
const operators = ['>', '<', '=='];
|
||||
@@ -126,7 +126,6 @@ class BcmTool {
|
||||
requireValues.push(value);
|
||||
requireSearch.push(requires[0]);
|
||||
}
|
||||
this.mgrMarket.SendSynOpenMarketInfoByFilter(() => __awaiter(this, void 0, void 0, function* () {
|
||||
var results = [];
|
||||
const ids = Object.keys(this.mgrMarket._map_player_infos);
|
||||
for (const id of ids) {
|
||||
@@ -134,23 +133,26 @@ class BcmTool {
|
||||
break;
|
||||
}
|
||||
const info = this.mgrMarket._map_player_infos[id];
|
||||
if (!this.CheckInfo(info.playerId)) {
|
||||
yield this.RefreshPlayerInTransaction(info.teamId, info.playerId);
|
||||
yield this.Wait(100);
|
||||
maxIterate -= 1;
|
||||
}
|
||||
if (conditions.every((e, i) => e(info.playerId, requireAttributes[i], requireValues[i]))) {
|
||||
results.push(info);
|
||||
}
|
||||
maxIterate -= 1;
|
||||
}
|
||||
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 = result.GetSingleAttribute(e, true);
|
||||
const value = this.QueryInfo(result.playerId, requireAttributes[idx]);
|
||||
return `${search}:${value}`;
|
||||
});
|
||||
console.log(result.playerName, ...displayStr);
|
||||
console.log(`${result.playerName}(${result.playerAge})`, ...displayStr);
|
||||
}
|
||||
}));
|
||||
});
|
||||
}
|
||||
RefreshPlayerInTransaction(teamId, playerId) {
|
||||
return new Promise(resolve => {
|
||||
@@ -172,9 +174,6 @@ class BcmTool {
|
||||
}
|
||||
QueryInfo(playerId, attri) {
|
||||
const data = this.mgrTeamInfo.GetPlayerData(playerId);
|
||||
if (attri == -100) {
|
||||
return data.playerAge;
|
||||
}
|
||||
return data.GetSingleAttribute(attri);
|
||||
}
|
||||
GetPlayerIds() {
|
||||
@@ -191,6 +190,13 @@ class BcmTool {
|
||||
console.log(this.mgrMarket._map_player_infos);
|
||||
});
|
||||
}
|
||||
Wait(time) {
|
||||
return new Promise(resolve => {
|
||||
setTimeout(() => {
|
||||
resolve();
|
||||
}, time);
|
||||
});
|
||||
}
|
||||
}
|
||||
class Logger {
|
||||
constructor() {
|
||||
|
||||
+23
-12
@@ -2,7 +2,6 @@
|
||||
class BcmTool
|
||||
{
|
||||
private attributes = new Map<string, number>([
|
||||
['年龄', -100],
|
||||
['速度', 1],
|
||||
['力量', 2],
|
||||
['内攻', 3],
|
||||
@@ -78,7 +77,7 @@ class BcmTool
|
||||
g_game.tools.CopyStrToClipboard(form.ToString());
|
||||
}
|
||||
|
||||
public BulkSearchMarket(searchStr: string, maxIterate = 100)
|
||||
public async BulkSearchMarket(searchStr: string, maxIterate = 100)
|
||||
{
|
||||
searchStr = searchStr.replace(/ /g, '');
|
||||
const strs = searchStr.split('&&');
|
||||
@@ -134,8 +133,6 @@ class BcmTool
|
||||
requireSearch.push(requires[0]);
|
||||
}
|
||||
|
||||
this.mgrMarket.SendSynOpenMarketInfoByFilter(async () =>
|
||||
{
|
||||
var results: CPlayerData[] = [];
|
||||
const ids = Object.keys(this.mgrMarket._map_player_infos);
|
||||
for (const id of ids)
|
||||
@@ -145,12 +142,16 @@ class BcmTool
|
||||
break;
|
||||
}
|
||||
const info = this.mgrMarket._map_player_infos[id];
|
||||
if (!this.CheckInfo(info.playerId))
|
||||
{
|
||||
await this.RefreshPlayerInTransaction(info.teamId, info.playerId);
|
||||
await this.Wait(100);
|
||||
maxIterate -= 1;
|
||||
}
|
||||
if (conditions.every((e, i) => e(info.playerId, requireAttributes[i], requireValues[i])))
|
||||
{
|
||||
results.push(info);
|
||||
}
|
||||
maxIterate -= 1;
|
||||
}
|
||||
const displays = new Set<number>(requireAttributes);
|
||||
for (const result of results)
|
||||
@@ -159,12 +160,16 @@ class BcmTool
|
||||
{
|
||||
const idx = requireAttributes.indexOf(e);
|
||||
const search = requireSearch[idx];
|
||||
const value = result.GetSingleAttribute(e, true);
|
||||
const value = this.QueryInfo(result.playerId, requireAttributes[idx]);
|
||||
return `${search}:${value}`;
|
||||
});
|
||||
console.log(result.playerName, ...displayStr);
|
||||
// TODO TeamName
|
||||
console.log(`${result.playerName}(${result.playerAge})`, ...displayStr);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public QuickOpenPlayer(name:string) {
|
||||
|
||||
}
|
||||
|
||||
private RefreshPlayerInTransaction(teamId: string, playerId: string)
|
||||
@@ -198,10 +203,6 @@ class BcmTool
|
||||
public QueryInfo(playerId: string, attri: number)
|
||||
{
|
||||
const data = this.mgrTeamInfo.GetPlayerData(playerId);
|
||||
if (attri == -100)
|
||||
{
|
||||
return data.playerAge;
|
||||
}
|
||||
return data.GetSingleAttribute(attri);
|
||||
}
|
||||
|
||||
@@ -227,6 +228,16 @@ class BcmTool
|
||||
});
|
||||
}
|
||||
|
||||
public Wait(time: number)
|
||||
{
|
||||
return new Promise<void>(resolve =>
|
||||
{
|
||||
setTimeout(() =>
|
||||
{
|
||||
resolve();
|
||||
}, time)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class Logger
|
||||
|
||||
Reference in New Issue
Block a user