@sjtdev/koishi-plugin-dota2tracker 1.2.9-pre.2 → 1.2.9-pre.3

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.
package/changelog.md CHANGED
@@ -1,12 +1,14 @@
1
+ ### 1.2.9-pre.3
2
+ **改进**:
3
+ - 尝试修改逻辑:在追踪到群友比赛后等待解析时,此前为按添加顺序等待队列中的比赛,现在修改了判断逻辑,对当前时间分钟数与等待队列的长度进行取余,周期性访问队列中每一场比赛,这样可以优先发送已解析完成的比赛而不会被早加入但迟迟未解析的比赛阻塞。
4
+
1
5
  ### 1.2.9-pre.2
2
6
  **改进**:
3
- - 现在可在战报模板`match_1`和玩家信息模板中正确显示打野玩家的对线结果为“野区霸主”并有对应的图标,而不是跟随默认的中路对线结果。
7
+ - 现在可在战报模板`match_1`和玩家信息模板中正确显示打野玩家的对线结果为“野区霸主”并有对应的图标,而不是跟随默认的中路对线结果。([wiki/match_1](https://github.com/sjtdev/koishi-plugin-dota2tracker/wiki/match_1)也已更新。)
4
8
 
5
9
  ### 1.2.9-pre
6
- **修复**:
10
+ **修复&改进**:
7
11
  - `查询英雄`:尝试修复DOTA2 7.37版本更新后API变动导致部分英雄查询报错。
8
-
9
- **改进**:
10
12
  - `查询英雄`:命石技能的技能名栏位添加对应命石图标与背景色用于标识。
11
13
 
12
14
  # 1.2.8
package/lib/index.js CHANGED
@@ -1209,31 +1209,7 @@ var inject = ["http", "database", "cron", "puppeteer"];
1209
1209
  var Config = import_koishi.Schema.intersect([
1210
1210
  import_koishi.Schema.object({
1211
1211
  STRATZ_API_TOKEN: import_koishi.Schema.string().required().description("※必须。stratz.com的API TOKEN,可在 https://stratz.com/api 获取。"),
1212
- dataParsingTimeoutMinutes: import_koishi.Schema.number().default(60).min(0).max(1440).description("等待比赛数据解析的时间(单位:分钟)。如果数据解析时间超过等待时间,将直接生成战报而不再等待解析完成。")
1213
- }).description("基础设置"),
1214
- import_koishi.Schema.object({
1215
- dailyReportSwitch: import_koishi.Schema.boolean().default(false).description("日报功能").experimental()
1216
- }),
1217
- import_koishi.Schema.union([
1218
- import_koishi.Schema.object({
1219
- dailyReportSwitch: import_koishi.Schema.const(true).required(),
1220
- dailyReportHours: import_koishi.Schema.number().min(0).max(23).default(6).description("日报时间小时"),
1221
- dailyReportShowCombi: import_koishi.Schema.boolean().default(true).description("日报是否显示组合")
1222
- }),
1223
- import_koishi.Schema.object({})
1224
- ]),
1225
- import_koishi.Schema.object({
1226
- weeklyReportSwitch: import_koishi.Schema.boolean().default(false).description("周报功能").experimental()
1227
- }),
1228
- import_koishi.Schema.union([
1229
- import_koishi.Schema.object({
1230
- weeklyReportSwitch: import_koishi.Schema.const(true).required(),
1231
- weeklyReportDayHours: import_koishi.Schema.tuple([import_koishi.Schema.number().min(1).max(7), import_koishi.Schema.number().min(0).max(23)]).default([1, 10]).description("周报发布于周(几)的(几)点"),
1232
- weeklyReportShowCombi: import_koishi.Schema.boolean().default(true).description("周报是否显示组合")
1233
- }),
1234
- import_koishi.Schema.object({})
1235
- ]),
1236
- import_koishi.Schema.object({
1212
+ dataParsingTimeoutMinutes: import_koishi.Schema.number().default(60).min(0).max(1440).description("等待比赛数据解析的时间(单位:分钟)。如果数据解析时间超过等待时间,将直接生成战报而不再等待解析完成。"),
1237
1213
  urlInMessageType: import_koishi.Schema.array(
1238
1214
  import_koishi.Schema.union([
1239
1215
  import_koishi.Schema.const("match").description("在查询比赛与战报消息中附带stratz比赛页面链接"),
@@ -1241,7 +1217,29 @@ var Config = import_koishi.Schema.intersect([
1241
1217
  import_koishi.Schema.const("hero").description("在查询英雄数据消息中附带刀塔百科对应英雄页面链接")
1242
1218
  ])
1243
1219
  ).role("checkbox").description("在消息中附带链接,<br/>请选择消息类型:")
1244
- }),
1220
+ }).description("基础设置"),
1221
+ import_koishi.Schema.intersect([
1222
+ import_koishi.Schema.object({
1223
+ dailyReportSwitch: import_koishi.Schema.boolean().default(false).description("日报功能").experimental()
1224
+ }).description("总结设置"),
1225
+ import_koishi.Schema.union([
1226
+ import_koishi.Schema.object({
1227
+ dailyReportSwitch: import_koishi.Schema.const(true).required(),
1228
+ dailyReportHours: import_koishi.Schema.number().min(0).max(23).default(6).description("日报时间小时"),
1229
+ dailyReportShowCombi: import_koishi.Schema.boolean().default(true).description("日报是否显示组合")
1230
+ })
1231
+ ]),
1232
+ import_koishi.Schema.object({
1233
+ weeklyReportSwitch: import_koishi.Schema.boolean().default(false).description("周报功能").experimental()
1234
+ }),
1235
+ import_koishi.Schema.union([
1236
+ import_koishi.Schema.object({
1237
+ weeklyReportSwitch: import_koishi.Schema.const(true).required(),
1238
+ weeklyReportDayHours: import_koishi.Schema.tuple([import_koishi.Schema.number().min(1).max(7), import_koishi.Schema.number().min(0).max(23)]).default([1, 10]).description("周报发布于周(几)的(几)点"),
1239
+ weeklyReportShowCombi: import_koishi.Schema.boolean().default(true).description("周报是否显示组合")
1240
+ })
1241
+ ])
1242
+ ]),
1245
1243
  import_koishi.Schema.object({
1246
1244
  template_match: import_koishi.Schema.union([...readDirectoryFilesSync(`./node_modules/@sjtdev/koishi-plugin-${name}/template/match`)]).default("match_1").description("生成比赛信息图片使用的模板,见 https://github.com/sjtdev/koishi-plugin-dota2tracker/wiki 有模板展示。"),
1247
1245
  template_player: import_koishi.Schema.union([...readDirectoryFilesSync(`./node_modules/@sjtdev/koishi-plugin-${name}/template/player`)]).default("player_1").description("生成玩家信息图片使用的模板。(目前仅有一张模板)"),
@@ -1723,7 +1721,8 @@ async function apply(ctx, config) {
1723
1721
  });
1724
1722
  }
1725
1723
  if (pendingMatches.length > 0) {
1726
- const pendingMatch = pendingMatches[0];
1724
+ const now = (0, import_moment.default)();
1725
+ const pendingMatch = pendingMatches[(now.hours() * 60 + now.minutes()) % pendingMatches.length];
1727
1726
  try {
1728
1727
  let match;
1729
1728
  let queryLocal = await ctx.database.get("dt_previous_query_results", pendingMatch.matchId, ["data"]);
@@ -1732,7 +1731,7 @@ async function apply(ctx, config) {
1732
1731
  ctx.database.set("dt_previous_query_results", match.id, { queryTime: /* @__PURE__ */ new Date() });
1733
1732
  } else
1734
1733
  match = getFormattedMatchData((await query(MATCH_INFO(pendingMatch.matchId))).data.match);
1735
- if (match.parsedDateTime || import_moment.default.unix(match.endDateTime).isBefore((0, import_moment.default)().subtract(config.dataParsingTimeoutMinutes, "minutes"))) {
1734
+ if (match.parsedDateTime || import_moment.default.unix(match.endDateTime).isBefore(now.subtract(config.dataParsingTimeoutMinutes, "minutes"))) {
1736
1735
  pendingMatches = pendingMatches.filter((item) => item.matchId != match.id);
1737
1736
  const img = await ctx.puppeteer.render(genImageHTML(match, config.template_match, "match" /* Match */));
1738
1737
  for (let commingGuild of pendingMatch.guilds) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sjtdev/koishi-plugin-dota2tracker",
3
3
  "description": "koishi插件-追踪群友的DOTA2对局",
4
- "version": "1.2.9-pre.2",
4
+ "version": "1.2.9-pre.3",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
@@ -313,6 +313,7 @@
313
313
  .hero .player_lane svg {
314
314
  width: 44px;
315
315
  height: 44px;
316
+ margin-bottom: 3px;
316
317
  }
317
318
 
318
319
  .hero .player_lane svg path {
@@ -670,15 +671,15 @@
670
671
  <body>
671
672
  <% const match = data;
672
673
  let kcndcStyle = {
673
- kc: function (num) {
674
- let red = (255 - (num * 255) / 100).toFixed(2);
675
- return `rgb(255,${red},${red})`;
676
- },
677
- dc: function (num) {
678
- let gray = ((50 - Math.min(num, 50)) * (255 / 50)).toFixed(2);
679
- return `rgb(${gray},${gray},${gray})`;
680
- },
681
- };
674
+ kc: function (num) {
675
+ let red = (255 - (num * 255) / 100).toFixed(2);
676
+ return `rgb(255,${red},${red})`;
677
+ },
678
+ dc: function (num) {
679
+ let gray = ((50 - Math.min(num, 50)) * (255 / 50)).toFixed(2);
680
+ return `rgb(${gray},${gray},${gray})`;
681
+ },
682
+ };
682
683
  // 对线结果的图标(来自免费SVG素材网)
683
684
  const laneSVG = {
684
685
  stomp: `<svg viewBox="0 0 24 24" class="hitagi__sc-1apuy4g-0 hmhZOG"><path d="M8.05731 22.3674L9.60454 22.8002L11.5974 21.6551L12.043 20.0773L13.5902 20.51L15.583 19.3649L16.0287 17.7871L17.5759 18.2199L19.5687 17.0748L20.0143 15.4969L21.5615 15.9297L23.5544 14.7846L24 13.2068L23.4492 12.2014L7.50651 21.3621L8.05731 22.3674ZM12.1328 3.50265L11.0312 1.49196C10.8798 1.21549 10.5316 1.11811 10.2576 1.27556L0.29345 7.00098C0.0194354 7.15843 -0.0808273 7.51346 0.0706444 7.78993L1.44766 10.3033L11.91 4.29159C12.184 4.13414 12.2843 3.77912 12.1328 3.50265ZM18.3935 8.4063L14.1658 9.60458L12.4221 10.6065C12.2851 10.6853 12.111 10.6366 12.0353 10.4983L11.7599 9.99565C11.6842 9.85742 11.7343 9.6799 11.8713 9.60118L13.615 8.59924L13.0642 7.59389L11.3205 8.59584C11.1835 8.67456 11.0094 8.62587 10.9337 8.48765L10.6583 7.98497C10.5826 7.84673 10.6327 7.66922 10.7697 7.5905L12.5134 6.58855L11.9626 5.58321L1.99846 11.3086L6.9557 20.3567L22.8984 11.196L22.2615 10.0336C21.5024 8.64813 19.9073 7.97847 18.3935 8.4063Z"></path></svg>`,