koishi-plugin-dew-bot 1.0.206 → 1.0.208

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/index.js +18 -0
  2. package/{lib → dist}/inits.js +6 -19
  3. package/{lib → dist}/plugin/messageQueue.js +9 -7
  4. package/{lib → dist}/plugin/puppeteer.js +4 -6
  5. package/{lib → dist}/plugin/server.js +49 -36
  6. package/{lib → dist}/plugin/serverHandel/handel_base.js +11 -6
  7. package/{lib → dist}/plugin/serverHandel/image.js +4 -5
  8. package/{lib → dist}/plugin/serverHandel/text.js +3 -1
  9. package/{lib → dist}/plugin/sessions.js +2 -0
  10. package/dist/shared/bot/AnalysisClass/class_battleLog.js +104 -0
  11. package/dist/shared/bot/AnalysisClass/class_skillDetail.js +152 -0
  12. package/{lib/shared → dist/shared/bot}/PtlMessage.js +3 -1
  13. package/dist/shared/bot/analysisMsg.js +62 -0
  14. package/{lib/shared → dist/shared/bot}/serviceProto.js +141 -196
  15. package/dist/shared/face/index.js +22 -0
  16. package/package.json +4 -4
  17. package/lib/face/enums.js +0 -204
  18. package/lib/face/index.js +0 -10
  19. package/lib/index.js +0 -56
  20. package/lib/msgCsl.js +0 -100
  21. package/lib/plugin/console.js +0 -17
  22. package/lib/plugin/rateLimiter.js +0 -104
  23. package/lib/shared/IBody.js +0 -2
  24. package/lib/shared/IMassage.js +0 -9
  25. package/lib/shared/MsgMessage.js +0 -4
  26. package/lib/shared/PtlSys.js +0 -4
  27. package/lib/shared/PtlTest.js +0 -4
  28. package/lib/shared/face/base.js +0 -2
  29. package/lib/shared/face/enums.js +0 -200
  30. package/lib/shared/face/index.js +0 -10
  31. /package/{lib → dist}/html/css/body.css +0 -0
  32. /package/{lib → dist}/html/css/panel_common.css +0 -0
  33. /package/{lib → dist}/html/css/ranking.css +0 -0
  34. /package/{lib → dist}/html/page/body.html +0 -0
  35. /package/{lib → dist}/html/page/panel_common.html +0 -0
  36. /package/{lib → dist}/html/page/ranking.html +0 -0
  37. /package/{lib → dist}/html/res/avatar.jpg +0 -0
  38. /package/{lib → dist}/html/res/body/box.png +0 -0
  39. /package/{lib → dist}/html/res/body/share/test.png +0 -0
  40. /package/{lib → dist}/html/res/body/title/test.png +0 -0
  41. /package/{lib → dist}/html/res/body/title/test1.png +0 -0
  42. /package/{lib → dist}/html/res/font/cn.ttf +0 -0
  43. /package/{lib → dist}/html/res/font/xiaomai.ttf +0 -0
  44. /package/{lib → dist}/html/res/vue2.js +0 -0
  45. /package/{lib → dist}/plugin/serverHandel/none.js +0 -0
  46. /package/{lib/face/base.js → dist/shared/bot/MsgMessage.js} +0 -0
  47. /package/{lib/shared → dist/shared/bot/protocols}/base.js +0 -0
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Config = exports.inject = exports.name = void 0;
7
+ exports.apply = apply;
8
+ const koishi_1 = require("koishi");
9
+ const inits_1 = __importDefault(require("./inits"));
10
+ exports.name = 'dew-bot';
11
+ exports.inject = ['puppeteer'];
12
+ exports.Config = koishi_1.Schema.object({
13
+ // ws://127.0.0.1:3009
14
+ 服务器地址: koishi_1.Schema.string().default('ws://dew-bot.cn:3009').description('游戏服地址'),
15
+ });
16
+ function apply(ctx, config) {
17
+ ctx.plugin(inits_1.default, config);
18
+ }
@@ -19,25 +19,12 @@ function apply(ctx, config) {
19
19
  server_1.default.init(ctx, config);
20
20
  // 设置连接成功后的回调
21
21
  server_1.default.onConnected(() => {
22
- try {
23
- server_1.default.lisentMsg('Message', ((data) => {
24
- try {
25
- // 使用消息队列处理消息
26
- const success = messageQueue_1.messageQueue.addToQueue(data, ctx);
27
- if (!success) {
28
- console.error('消息队列已满,无法处理新消息');
29
- }
30
- }
31
- catch (error) {
32
- console.error('添加消息到队列失败:', error);
33
- }
34
- }), this);
35
- }
36
- catch (error) {
37
- console.error('消息监听设置失败:', error);
38
- }
22
+ server_1.default.lisentMsg('Message', ((data) => {
23
+ messageQueue_1.messageQueue.addToQueue(data, ctx);
24
+ }), this);
39
25
  });
40
- ctx.on('dispose', () => {
41
- messageQueue_1.messageQueue.clearQueue();
26
+ /** 监听消息 上传到服务器 **/
27
+ ctx.on('message', (session) => {
28
+ server_1.default.uploadMessage(session);
42
29
  });
43
30
  }
@@ -9,7 +9,6 @@ class MessageQueue {
9
9
  queue = [];
10
10
  isProcessing = false;
11
11
  processingTimeout = null;
12
- MAX_QUEUE_SIZE = 9999; // 最大队列长度
13
12
  PROCESSING_TIMEOUT = 5000; // 5秒处理超时
14
13
  initialized = false;
15
14
  ctx;
@@ -21,8 +20,13 @@ class MessageQueue {
21
20
  */
22
21
  init(ctx) {
23
22
  this.ctx = ctx;
24
- console.log('初始化消息队列');
25
23
  this.initialized = true;
24
+ ctx.on('dispose', () => {
25
+ this.dispose();
26
+ });
27
+ }
28
+ dispose() {
29
+ this.clearQueue();
26
30
  }
27
31
  /**
28
32
  * 添加消息到队列
@@ -32,9 +36,6 @@ class MessageQueue {
32
36
  */
33
37
  addToQueue(data, ctx) {
34
38
  // 检查队列是否已满
35
- if (this.queue.length >= this.MAX_QUEUE_SIZE) {
36
- return false;
37
- }
38
39
  const queueItem = {
39
40
  id: this.generateQueueId(),
40
41
  data,
@@ -99,7 +100,8 @@ class MessageQueue {
99
100
  */
100
101
  async processMessage(item) {
101
102
  try {
102
- const module = require(`./serverHandel/${item.data.action}`).default;
103
+ const handleType = item.data.handleType;
104
+ const module = require(`./serverHandel/${handleType}`).default;
103
105
  let handel = new module(item.data);
104
106
  handel.set(item.ctx);
105
107
  await handel.start(item.data);
@@ -126,7 +128,7 @@ class MessageQueue {
126
128
  this.queue = [];
127
129
  this.isProcessing = false;
128
130
  this.processingTimeout = null;
129
- console.log('队列已清空');
131
+ console.log('messageQueue:clear');
130
132
  }
131
133
  }
132
134
  exports.MessageQueue = MessageQueue;
@@ -6,16 +6,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const fs_1 = __importDefault(require("fs"));
7
7
  const koishi_1 = require("koishi");
8
8
  const path = require('path');
9
- const console_1 = require("./console");
10
- class puppeteer extends console_1.console {
9
+ class puppeteer {
11
10
  commonCss;
12
11
  pageContents = new Map();
13
12
  ctx;
14
13
  tempDir;
15
14
  init(ctx, config) {
16
- super.init(ctx);
17
15
  this.ctx = ctx;
18
- this.log('初始化 puppeteer');
16
+ console.info('初始化 puppeteer');
19
17
  const pagesDir = path.resolve(__dirname, '../html/page');
20
18
  const files = fs_1.default.readdirSync(pagesDir);
21
19
  this.tempDir = path.resolve(path.resolve(__dirname, '../html/'), 'temp');
@@ -63,7 +61,7 @@ class puppeteer extends console_1.console {
63
61
  page.close();
64
62
  let leaderboardImage;
65
63
  // if (sendBuff.length < 200 * 1024) { // 如果小于200kb
66
- this.log(`not compress ${sendBuff.length / 1024}KB`);
64
+ console.info(`not compress ${sendBuff.length / 1024}KB`);
67
65
  leaderboardImage = koishi_1.h.image(sendBuff, 'image/jpeg');
68
66
  // } else {
69
67
  // let req = await server.api('open/CompressImg', { imgBuf: sendBuff });
@@ -74,7 +72,7 @@ class puppeteer extends console_1.console {
74
72
  }
75
73
  catch (error) {
76
74
  page.close();
77
- this.log(error);
75
+ console.error(error);
78
76
  }
79
77
  }
80
78
  }
@@ -1,9 +1,12 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  const tsrpc_1 = require("tsrpc");
4
- const console_1 = require("./console");
5
- const serviceProto_1 = require("../shared/serviceProto");
6
- class server extends console_1.console {
7
+ const serviceProto_1 = require("../shared/bot/serviceProto");
8
+ const sessions_1 = __importDefault(require("./sessions"));
9
+ class server {
7
10
  httpClient;
8
11
  apiUrl;
9
12
  wsClient;
@@ -12,10 +15,8 @@ class server extends console_1.console {
12
15
  messageListenerSetup = false; // 标记消息监听器是否已设置
13
16
  _init = false;
14
17
  constructor() {
15
- super();
16
18
  }
17
19
  async init(ctx, config) {
18
- super.init(ctx, config);
19
20
  this.ctx = ctx;
20
21
  // 设置 dispose 事件监听器
21
22
  ctx.on('dispose', () => {
@@ -26,22 +27,16 @@ class server extends console_1.console {
26
27
  if (this.wsClient) {
27
28
  await this.dispose();
28
29
  }
29
- // 根据服务器环境选择对应的地址
30
- const serverUrlMap = {
31
- '测试服': 'ws://127.0.0.1:3000',
32
- '开发服': 'ws://dew-bot.cn:3000',
33
- '正式服': 'ws://dew-bot.cn:3000'
34
- };
35
- const serverUrl = serverUrlMap[config.服务器环境];
36
- if (!serverUrl) {
37
- throw new Error(`未知的服务器环境: ${config.服务器环境}`);
30
+ /** 直接使用配置中的服务器地址 **/
31
+ const serverUrl = config.服务器地址;
32
+ if (!serverUrl || serverUrl.trim() === '') {
33
+ throw new Error('服务器地址不能为空');
38
34
  }
39
- this.log(`选择环境: ${config.服务器环境}`);
40
- this.log(`尝试连接到: ${serverUrl}`);
41
- // 异步连接但不阻塞初始化
35
+ console.log(`尝试连接到: ${serverUrl}`);
36
+ /** 异步连接但不阻塞初始化 **/
42
37
  this.setWsUrl(serverUrl).catch(error => {
43
- this.log('初始化连接失败:', error);
44
- this.log('请检查服务器地址是否正确,以及服务器是否正在运行');
38
+ console.log('初始化连接失败:', error);
39
+ console.log('请检查服务器地址是否正确,以及服务器是否正在运行');
45
40
  });
46
41
  }
47
42
  // 设置连接成功的回调
@@ -55,7 +50,7 @@ class server extends console_1.console {
55
50
  }
56
51
  // 卸载
57
52
  async dispose() {
58
- this.log('卸载:server');
53
+ console.log('卸载:server');
59
54
  this._init = false;
60
55
  if (this.wsClient) {
61
56
  this.wsClient.unlistenMsgAll(/.*/);
@@ -91,13 +86,13 @@ class server extends console_1.console {
91
86
  }
92
87
  flowsResConnect(client) {
93
88
  if (!client || !client.flows) {
94
- this.log('客户端无效,无法设置断线重连');
89
+ console.log('客户端无效,无法设置断线重连');
95
90
  return;
96
91
  }
97
92
  client.flows.postDisconnectFlow.push((v) => {
98
93
  if (!v.isManual && this._init) {
99
94
  this.connect();
100
- this.log('开始断线重连');
95
+ console.log('开始断线重连');
101
96
  }
102
97
  // Bot_client.emit(Emitter_bot.server_off);
103
98
  return v;
@@ -105,16 +100,16 @@ class server extends console_1.console {
105
100
  }
106
101
  async connect() {
107
102
  if (!this._init) {
108
- this.log('插件已卸载,停止重连');
103
+ console.log('插件已卸载,停止重连');
109
104
  return;
110
105
  }
111
106
  if (!this.wsClient) {
112
- this.log('WebSocket 客户端未初始化,无法重连');
107
+ console.log('WebSocket 客户端未初始化,无法重连');
113
108
  return;
114
109
  }
115
110
  let res = await this.wsClient.connect();
116
111
  if (!res.isSucc) {
117
- this.log('重试断线准备重连');
112
+ console.log('重试断线准备重连');
118
113
  if (this._init) {
119
114
  this.ctx.setTimeout(async () => {
120
115
  this.connect();
@@ -122,20 +117,20 @@ class server extends console_1.console {
122
117
  }
123
118
  }
124
119
  else {
125
- this.log('断线重连成功');
120
+ console.log('断线重连成功');
126
121
  // 断线重连成功时不需要重新设置监听器
127
122
  }
128
123
  return res;
129
124
  }
130
125
  lisentMsg(msgName, handler, self) {
131
126
  if (!this._init || !this.wsClient) {
132
- this.log('WebSocket 未连接,无法监听消息');
127
+ console.log('WebSocket 未连接,无法监听消息');
133
128
  return;
134
129
  }
135
130
  return this.wsClient.listenMsg(msgName, ((data) => { handler.call(self, data); }));
136
131
  }
137
132
  async setWsUrl(link, maxRetries = 99999) {
138
- this.log(`server link:${link}`);
133
+ console.log(`server link:${link}`);
139
134
  this._init = true;
140
135
  return new Promise(async (resolve, reject) => {
141
136
  this.apiUrl = link;
@@ -153,7 +148,7 @@ class server extends console_1.console {
153
148
  if (this.wsClient) {
154
149
  this.flowsResConnect(this.wsClient);
155
150
  }
156
- this.log('connect success');
151
+ console.log('connect success');
157
152
  // 调用连接成功的回调(仅第一次连接)
158
153
  if (this.onConnectedCallback && !this.messageListenerSetup) {
159
154
  this.onConnectedCallback();
@@ -164,11 +159,11 @@ class server extends console_1.console {
164
159
  else {
165
160
  retryCount++;
166
161
  if (retryCount < maxRetries) {
167
- this.log(`连接失败,${retryCount}/${maxRetries},5秒后重试...`);
162
+ console.log(`连接失败,${retryCount}/${maxRetries},5秒后重试...`);
168
163
  this.ctx.setTimeout(attemptConnect, 5000);
169
164
  }
170
165
  else {
171
- this.log('connect failed', connect.errMsg);
166
+ console.log('connect failed', connect.errMsg);
172
167
  this._init = false; // 连接失败时设置为未初始化状态
173
168
  reject(connect.errMsg);
174
169
  }
@@ -179,28 +174,46 @@ class server extends console_1.console {
179
174
  }
180
175
  async api(apiName, posData) {
181
176
  if (!this._init) {
182
- this.log('插件未初始化,无法调用 API');
177
+ console.log('插件未初始化,无法调用 API');
183
178
  return;
184
179
  }
185
180
  let client = this.wsClient || this.httpClient;
186
181
  if (!client) {
187
- this.log('客户端未连接,无法调用 API');
182
+ console.log('客户端未连接,无法调用 API');
188
183
  return;
189
184
  }
190
185
  try {
191
186
  let start = Date.now();
192
187
  let req = await client.callApi(apiName, posData);
193
188
  if (req.isSucc) {
194
- this.log('apiReq', apiName, (Date.now() - start) / 1000, 's');
189
+ console.log('apiReq', apiName, (Date.now() - start) / 1000, 's');
195
190
  return req.res;
196
191
  }
197
192
  else {
198
- this.log('请求出错', apiName, req.err.message);
193
+ console.log('请求出错', apiName, req.err.message);
199
194
  }
200
195
  }
201
196
  catch (error) {
202
- this.log('API 调用异常:', apiName, error.message);
197
+ console.log('API 调用异常:', apiName, error.message);
203
198
  }
204
199
  }
200
+ /**bot专属业务逻辑 */
201
+ uploadMessage(session) {
202
+ /** 存储会话信息 **/
203
+ sessions_1.default.set(session.author.id, session);
204
+ /** 发送消息到服务器 **/
205
+ this.api('Message', {
206
+ bot: {
207
+ id: session.bot.userId,
208
+ platform: session.bot.platform,
209
+ },
210
+ user: {
211
+ id: session.author.id,
212
+ },
213
+ content: session.content,
214
+ }).catch(error => {
215
+ console.error('发送消息到服务器失败:', error);
216
+ });
217
+ }
205
218
  }
206
219
  exports.default = new server();
@@ -7,21 +7,26 @@ const sessions_1 = __importDefault(require("../sessions"));
7
7
  class handel_base {
8
8
  ctx;
9
9
  constructor(data) {
10
- console.log('handel_base:::', data);
10
+ // console.log('handel_base:::', data)
11
11
  }
12
12
  set(ctx) {
13
13
  this.ctx = ctx;
14
14
  }
15
15
  async send(data, content) {
16
- let sendInfo = data.Message;
17
- let session = sessions_1.default.get(sendInfo.userId);
18
- if (session.bot.platform) {
19
- content = '\n' + content;
16
+ // console.log('handel_base:::send', data, content)
17
+ // let sendInfo = data.Message;
18
+ let session = sessions_1.default.get(data.userId);
19
+ if (!session) {
20
+ this.ctx.logger.info('session not found', data.userId);
21
+ return;
20
22
  }
23
+ // if(session.bot.platform){
24
+ // content = '\n' + content;
25
+ // }
21
26
  await session.send(content);
22
27
  }
23
28
  start(data) {
24
- console.log('handel_base:::', data);
29
+ // console.log('handel_base:::', data)
25
30
  }
26
31
  }
27
32
  exports.default = handel_base;
@@ -3,17 +3,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const puppeteer_1 = __importDefault(require("../puppeteer"));
7
6
  const handel_base_1 = __importDefault(require("./handel_base"));
8
7
  class handelr_image extends handel_base_1.default {
9
8
  constructor(data) {
10
9
  super(data);
11
10
  }
12
11
  async start(data) {
13
- let renderName = data.info.render;
14
- puppeteer_1.default.render(renderName, data.data || {}).then(async (e) => {
15
- await this.send(data, e);
16
- });
12
+ // let renderName = data.info.render;
13
+ // puppeteer.render(renderName, data.data || {}).then(async (e) => {
14
+ // await this.send(data, e)
15
+ // })
17
16
  }
18
17
  }
19
18
  exports.default = handelr_image;
@@ -3,13 +3,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ const analysisMsg_1 = require("../../shared/bot/analysisMsg");
6
7
  const handel_base_1 = __importDefault(require("./handel_base"));
7
8
  class handelr_text extends handel_base_1.default {
8
9
  constructor(data) {
9
10
  super(data);
10
11
  }
11
12
  async start(data) {
12
- await this.send(data, data.data);
13
+ let content = new analysisMsg_1.AnalysisMsg().parse(data);
14
+ await this.send(data, content);
13
15
  }
14
16
  }
15
17
  exports.default = handelr_text;
@@ -7,6 +7,8 @@ class sessions {
7
7
  }
8
8
  init(ctx) {
9
9
  ctx.on('dispose', () => {
10
+ console.log('sessions clear');
11
+ this.clear();
10
12
  });
11
13
  }
12
14
  /**
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * 数据格式: I战斗结束Data
5
+ * 由于此文件在 shared 文件夹,不能引用服务器类型定义
6
+ * 以下类型定义仅用于说明数据结构,实际使用时通过 any 接收
7
+ */
8
+ /** 战斗胜者枚举 */
9
+ var IBattleWinner;
10
+ (function (IBattleWinner) {
11
+ IBattleWinner[IBattleWinner["\u4E3B\u573A\u80DC\u5229"] = 0] = "\u4E3B\u573A\u80DC\u5229";
12
+ IBattleWinner[IBattleWinner["\u5BA2\u573A\u80DC\u5229"] = 1] = "\u5BA2\u573A\u80DC\u5229";
13
+ IBattleWinner[IBattleWinner["\u5E73\u5C40"] = 2] = "\u5E73\u5C40";
14
+ })(IBattleWinner || (IBattleWinner = {}));
15
+ class class_battleLog {
16
+ constructor() {
17
+ return this;
18
+ }
19
+ /** 格式化战斗日志数据为文本 */
20
+ analysis(data) {
21
+ const battleData = data.content;
22
+ if (!battleData) {
23
+ return '战斗数据为空\n';
24
+ }
25
+ let result = '';
26
+ /** 战斗结果 */
27
+ result += this.formatBattleResult(battleData);
28
+ /** Flarum战斗日志链接 */
29
+ if (battleData.flarumUrl) {
30
+ result += `📋战斗日志:${battleData.flarumUrl}\n`;
31
+ }
32
+ /** 奖励信息 */
33
+ result += this.formatRewards(battleData);
34
+ return result;
35
+ }
36
+ /** 格式化战斗结果 */
37
+ formatBattleResult(battleData) {
38
+ let result = '';
39
+ /** 优先使用个性化战斗结果 */
40
+ const personalResult = battleData.personalResult;
41
+ if (personalResult?.emoji && personalResult?.text) {
42
+ result += ` ┄━═${personalResult.emoji}${personalResult.text}═━┄\n`;
43
+ result += `⏱️ 战斗回合:${battleData.totalRounds}\n`;
44
+ return result;
45
+ }
46
+ /** 战斗结果 */
47
+ const winner = battleData.winner;
48
+ let winnerText = '未知';
49
+ let emoji = '❓';
50
+ switch (winner) {
51
+ case IBattleWinner.主场胜利:
52
+ winnerText = '主场胜利';
53
+ emoji = '🎉';
54
+ break;
55
+ case IBattleWinner.客场胜利:
56
+ winnerText = '客场胜利';
57
+ emoji = '💀';
58
+ break;
59
+ case IBattleWinner.平局:
60
+ winnerText = '旗鼓相当';
61
+ emoji = '🤝';
62
+ break;
63
+ }
64
+ result += ` ┄━═${emoji}${winnerText}═━┄\n`;
65
+ result += `⏱️ 战斗回合:${battleData.totalRounds}\n`;
66
+ return result;
67
+ }
68
+ /** 格式化奖励信息 */
69
+ formatRewards(battleData) {
70
+ let result = '';
71
+ if (!battleData.rewards) {
72
+ return result;
73
+ }
74
+ /** rewards 是一个 Map<string, I单位奖励> */
75
+ const rewards = battleData.rewards;
76
+ /** 检查是否有奖励 */
77
+ let hasRewards = false;
78
+ if (rewards instanceof Map && rewards.size > 0) {
79
+ hasRewards = true;
80
+ }
81
+ else if (typeof rewards === 'object' && Object.keys(rewards).length > 0) {
82
+ hasRewards = true;
83
+ }
84
+ if (!hasRewards) {
85
+ return result;
86
+ }
87
+ /** 添加战斗收获分隔线 */
88
+ result += ` ┄━═🎉战斗收获═━┄\n`;
89
+ /** 遍历奖励 */
90
+ const rewardsIterator = rewards instanceof Map ? rewards.entries() : Object.entries(rewards);
91
+ for (const [unitId, unitReward] of rewardsIterator) {
92
+ if (!unitReward)
93
+ continue;
94
+ /** 显示所有奖励物品 */
95
+ if (unitReward.items && unitReward.items.length > 0) {
96
+ unitReward.items.forEach((item) => {
97
+ result += `${item.icon}${item.name}+${item.count}\n`;
98
+ });
99
+ }
100
+ }
101
+ return result;
102
+ }
103
+ }
104
+ exports.default = new class_battleLog();