@sjtdev/koishi-plugin-dota2tracker 1.2.10 → 1.2.11

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,3 +1,7 @@
1
+ # 1.2.11
2
+ **新增&改进**:
3
+ - 对战报模板添加命石显示,微调了其他信息的显示效果以适配此改动。
4
+
1
5
  # 1.2.10
2
6
  **新增**:
3
7
  - 添加对新英雄`百戏大王`的支持。(战报播报、查询英雄等)
@@ -63,8 +67,8 @@
63
67
  - 将战报中的播报评语由随机选取改为固定种子:比赛ID+玩家SteamID+玩家位置,确保在不同调用时刻、次数及平台下,对同一场比赛中的玩家评语保持一致。
64
68
  - `查询玩家`指令图片中,玩家近期比赛表中未解析的场次参战率由"?%"改为估算值,显示为"≈xx%"。
65
69
  - `查询英雄`指令图片中,由于命石带来的属性数值无法确定作用方式(增加或是替换等),去除命石属性前的“+”,请结合命石说明自行判断。(7.37版本更新带来的API变动,导致使用指令查询某些英雄报错问题,暂无法解决)
66
- - 比赛图片模板`match_2`中,现在冠绝排名数字位置更准确了。
67
- - 比赛图片模板`match_2`中,比赛段位可以显示星级了。
70
+ - 战报模板`match_2`中,现在冠绝排名数字位置更准确了。
71
+ - 战报模板`match_2`中,比赛段位可以显示星级了。
68
72
 
69
73
  <details>
70
74
  <summary>为什么未解析的比赛需要“估算”?</summary>
@@ -82,8 +86,8 @@
82
86
 
83
87
  ##### pre.2
84
88
  **改进**:
85
- - 比赛图片模板`match_2`中,现在冠绝排名数字位置更准确了。
86
- - 比赛图片模板`match_2`中,比赛段位可以显示星级了。
89
+ - 战报模板`match_2`中,现在冠绝排名数字位置更准确了。
90
+ - 战报模板`match_2`中,比赛段位可以显示星级了。
87
91
  </details>
88
92
 
89
93
  # 1.2.7
package/lib/index.js CHANGED
@@ -110,8 +110,12 @@ function MATCH_INFO(matchId) {
110
110
  id
111
111
  name
112
112
  shortName
113
+ facets {
114
+ facetId
115
+ }
113
116
  }
114
- dotaPlus{
117
+ variant
118
+ dotaPlus {
115
119
  level
116
120
  }
117
121
  leaverStatus
@@ -168,7 +172,6 @@ function MATCH_INFO(matchId) {
168
172
  goldPerMinute
169
173
  experiencePerMinute
170
174
  heroHealing
171
-
172
175
  stats {
173
176
  campStack
174
177
  heroDamageReport {
@@ -182,7 +185,7 @@ function MATCH_INFO(matchId) {
182
185
  }
183
186
  }
184
187
  }
185
- additionalUnit{
188
+ additionalUnit {
186
189
  item0Id
187
190
  item1Id
188
191
  item2Id
@@ -194,7 +197,6 @@ function MATCH_INFO(matchId) {
194
197
  backpack2Id
195
198
  neutral0Id
196
199
  }
197
-
198
200
  isRandom
199
201
  }
200
202
  pickBans {
@@ -204,6 +206,13 @@ function MATCH_INFO(matchId) {
204
206
  order
205
207
  }
206
208
  }
209
+ constants {
210
+ facets {
211
+ id
212
+ color
213
+ icon
214
+ }
215
+ }
207
216
  }
208
217
 
209
218
  `;
@@ -564,7 +573,8 @@ function getImageUrl(image, type = "local" /* Local */, format = "png" /* png */
564
573
  return `https://cdn.cloudflare.steamstatic.com/apps/dota2/images/dota_react/${type}/${image}.${format}`;
565
574
  }
566
575
  __name(getImageUrl, "getImageUrl");
567
- function getFormattedMatchData(match) {
576
+ function getFormattedMatchData(data) {
577
+ const { match, constants } = data;
568
578
  ["radiant", "dire"].forEach((team) => {
569
579
  match[team] = { killsCount: match[team + "Kills"]?.reduce((acc, cva) => acc + cva, 0) ?? 0, damageReceived: 0, heroDamage: 0, networth: 0, experience: 0 };
570
580
  });
@@ -772,6 +782,9 @@ function getFormattedMatchData(match) {
772
782
  }
773
783
  }
774
784
  }
785
+ if (player.variant != null) {
786
+ player.facet = constants.facets.find((facet) => facet.id == player.hero.facets[player.variant - 1].facetId);
787
+ }
775
788
  });
776
789
  let ComparisonMode;
777
790
  ((ComparisonMode2) => {
@@ -1383,7 +1396,7 @@ async function apply(ctx, config) {
1383
1396
  match = queryLocal[0].data;
1384
1397
  ctx.database.set("dt_previous_query_results", match.id, { queryTime: /* @__PURE__ */ new Date() });
1385
1398
  } else {
1386
- match = getFormattedMatchData((await query(MATCH_INFO(matchId))).data.match);
1399
+ match = getFormattedMatchData((await query(MATCH_INFO(matchId))).data);
1387
1400
  }
1388
1401
  if (match && (match.parsedDateTime || import_moment.default.unix(match.endDateTime).isBefore((0, import_moment.default)().subtract(config.dataParsingTimeoutMinutes, "minutes")))) {
1389
1402
  session.send((ctx.config.urlInMessageType.some((type) => type == "match") ? "https://stratz.com/matches/" + matchId : "") + await ctx.puppeteer.render(genImageHTML(match, config.template_match, "match" /* Match */)));
@@ -1735,7 +1748,7 @@ async function apply(ctx, config) {
1735
1748
  match = queryLocal[0].data;
1736
1749
  ctx.database.set("dt_previous_query_results", match.id, { queryTime: /* @__PURE__ */ new Date() });
1737
1750
  } else
1738
- match = getFormattedMatchData((await query(MATCH_INFO(pendingMatch.matchId))).data.match);
1751
+ match = getFormattedMatchData((await query(MATCH_INFO(pendingMatch.matchId))).data);
1739
1752
  if (match.parsedDateTime || import_moment.default.unix(match.endDateTime).isBefore(now.subtract(config.dataParsingTimeoutMinutes, "minutes"))) {
1740
1753
  pendingMatches = pendingMatches.filter((item) => item.matchId != match.id);
1741
1754
  const img = await ctx.puppeteer.render(genImageHTML(match, config.template_match, "match" /* Match */));
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.10",
4
+ "version": "1.2.11",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
@@ -246,8 +246,9 @@
246
246
 
247
247
  .hero .player_avatar .position {
248
248
  /* width: auto; */
249
+ line-height: 1.2;
249
250
  text-align: right;
250
- bottom: 1px;
251
+ top: 3px;
251
252
  right: 0;
252
253
  color: #cccccc;
253
254
  text-shadow: -1px -1px 0 rgba(0, 0, 0, 0.5), 1px -1px 0 rgba(0, 0, 0, 0.5), -1px 1px 0 rgba(0, 0, 0, 0.5), 1px 1px 0 rgba(0, 0, 0, 0.5); /* 描边效果 */
@@ -275,6 +276,40 @@
275
276
  text-shadow: 0 0 4px black;
276
277
  }
277
278
 
279
+ .hero .player_avatar .facet {
280
+ width: 24px;
281
+ height: 24px;
282
+ position: absolute;
283
+ right: 0;
284
+ bottom: 0;
285
+ border-radius: 4px;
286
+ display: flex;
287
+ justify-content: center;
288
+ align-items: center;
289
+ }
290
+ .hero .player_avatar .facet img{
291
+ width: 18px;
292
+ height: 18px;
293
+ }
294
+ .hero > .player_avatar > .facet.Red {
295
+ background: linear-gradient(to right, #9f3c3c, #4a2026);
296
+ }
297
+ .hero > .player_avatar > .facet.Yellow {
298
+ background: linear-gradient(to right, #c8a45c, #6f3d21);
299
+ }
300
+ .hero > .player_avatar > .facet.Green {
301
+ background: linear-gradient(to right, #a2b23e, #2d5a18);
302
+ }
303
+ .hero > .player_avatar > .facet.Blue {
304
+ background: linear-gradient(to right, #547ea6, #2a385e);
305
+ }
306
+ .hero > .player_avatar > .facet.Purple {
307
+ background: linear-gradient(to right, #675cae, #261c44);
308
+ }
309
+ .hero > .player_avatar > .facet.Gray {
310
+ background: linear-gradient(to right, #adb6be, #4e5557);
311
+ }
312
+
278
313
  .hero .player_info {
279
314
  /* width: 210px; */
280
315
  text-align: center;
@@ -726,6 +761,10 @@
726
761
  <p class="party_mark${player.partyId != null ? " party_" + match.party[player.partyId] : ""}"></p>
727
762
  <p class="position p${Math.floor(player.order / 4) + 1}">${player.isRandom ? "随机" : `第<span>${player.order == null ? "?" : player.order + 1}</span>手`}<br/>${d2a.position[player.position?.slice(-1)]??""}</p>
728
763
  <p class="level">${player.level}</p>
764
+ ${player.facet ? `
765
+ <div class="facet ${player.facet.color}">
766
+ <img src="${utils.getImageUrl(player.facet.icon, ImageType.IconsFacets)}">
767
+ </div>` : ""}
729
768
  </div>
730
769
  <div class="player_info">
731
770
  <summary class="player_name">${escapeHTML(player.steamAccount.name)}</summary>
@@ -167,9 +167,9 @@
167
167
 
168
168
  .player > .hero_avatar > .party_line {
169
169
  position: absolute;
170
- height: 100%;
170
+ height: 2px;
171
171
  top: 0;
172
- width: 3px;
172
+ width: 100%;
173
173
  }
174
174
 
175
175
  .player > .hero_avatar > .party_mark {
@@ -178,8 +178,8 @@
178
178
  text-align: center;
179
179
  width: 16px;
180
180
  font-size: 10px;
181
- top: 2px;
182
- left: 5px;
181
+ top: 3px;
182
+ left: 1px;
183
183
  background-color: rgba(0, 0, 0, 0.8);
184
184
  }
185
185
 
@@ -231,6 +231,41 @@
231
231
  content: "IV";
232
232
  }
233
233
 
234
+ .player > .hero_avatar > .facet {
235
+ position: absolute;
236
+ left: 4px;
237
+ left: 0;
238
+ bottom: 0;
239
+ width: 16px;
240
+ height: 16px;
241
+ display: flex;
242
+ justify-content: center;
243
+ align-items: center;
244
+ z-index: 1;
245
+ }
246
+ .player > .hero_avatar > .facet > img {
247
+ width: 12px;
248
+ height: 12px;
249
+ }
250
+ .player > .hero_avatar > .facet.Red {
251
+ background: linear-gradient(to right, #9f3c3c, #4a2026);
252
+ }
253
+ .player > .hero_avatar > .facet.Yellow {
254
+ background: linear-gradient(to right, #c8a45c, #6f3d21);
255
+ }
256
+ .player > .hero_avatar > .facet.Green {
257
+ background: linear-gradient(to right, #a2b23e, #2d5a18);
258
+ }
259
+ .player > .hero_avatar > .facet.Blue {
260
+ background: linear-gradient(to right, #547ea6, #2a385e);
261
+ }
262
+ .player > .hero_avatar > .facet.Purple {
263
+ background: linear-gradient(to right, #675cae, #261c44);
264
+ }
265
+ .player > .hero_avatar > .facet.Gray {
266
+ background: linear-gradient(to right, #adb6be, #4e5557);
267
+ }
268
+
234
269
  .player > .rank {
235
270
  position: relative;
236
271
  grid-row: 1 / span 3;
@@ -487,6 +522,10 @@
487
522
  <div class="player ${player.team}${player.hero.id==80?" bear":""}" style="order: ${player.team==="radiant"?1:100};">
488
523
  <div class="hero_avatar row-1${player.partyId != null ? " party_" + match.party[player.partyId] : ""}">
489
524
  <img src="${utils.getImageUrl(player.hero.shortName, ImageType.Heroes)}" />
525
+ ${player.facet ? `
526
+ <div class="facet ${player.facet.color}">
527
+ <img src="${utils.getImageUrl(player.facet.icon, ImageType.IconsFacets)}">
528
+ </div>` : ""}
490
529
  <p class="level">${player.level}</p>
491
530
  <p class="party_line"></p>
492
531
  <p class="party_mark"></p>