@sjtdev/koishi-plugin-dota2tracker 1.1.2-beta.6 → 1.1.2-hotfix.2

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/lib/index.js CHANGED
@@ -536,7 +536,7 @@ function getFormattedMatchData(match) {
536
536
  match[player.team].experience += Math.floor(player.experiencePerMinute / 60 * match.durationSeconds);
537
537
  player.titles = [];
538
538
  player.mvpScore = // 计算MVP分数
539
- player.kills * 5 + player.assists * 3 + player.stats.heroDamageReport.dealtTotal.stunDuration / 100 * 0.1 + (player.stats.heroDamageReport.dealtTotal.slowDuration + player.stats.heroDamageReport.dealtTotal.disableDuration) / 100 * 0.05 + player.heroDamage * 1e-3 + player.towerDamage * 0.01 + player.heroHealing * 2e-3 + player.imp * 0.25;
539
+ player.kills * 5 + player.assists * 3 + player.stats.heroDamageReport.dealtTotal.stunDuration / 100 * 0.1 + player.stats.heroDamageReport.dealtTotal.disableDuration / 100 * 0.05 + player.stats.heroDamageReport.dealtTotal.slowDuration / 100 * 0.025 + player.heroDamage * 1e-3 + player.towerDamage * 0.01 + player.heroHealing * 2e-3 + player.imp * 0.25;
540
540
  player.order = heroOrderList[player.hero.id];
541
541
  if (player.partyId != null) {
542
542
  if (!match.party[player.partyId])
@@ -695,7 +695,7 @@ function getFormattedMatchData(match) {
695
695
  findMaxByProperty("networth").titles.push({ name: "富", color: "#FFD700" });
696
696
  findMaxByProperty("experiencePerMinute").titles.push({ name: "睿", color: "#8888FF" });
697
697
  match.players.reduce(
698
- (max, player) => player.stats.heroDamageReport.dealtTotal.stunDuration + player.stats.heroDamageReport.dealtTotal.disableDuration + player.stats.heroDamageReport.dealtTotal.slowDuration / 2 > max.stats.heroDamageReport.dealtTotal.stunDuration + max.stats.heroDamageReport.dealtTotal.disableDuration + max.stats.heroDamageReport.dealtTotal.slowDuration / 2 ? player : max
698
+ (max, player) => player.stats.heroDamageReport.dealtTotal.stunDuration + player.stats.heroDamageReport.dealtTotal.disableDuration / 2 + player.stats.heroDamageReport.dealtTotal.slowDuration / 4 > max.stats.heroDamageReport.dealtTotal.stunDuration + max.stats.heroDamageReport.dealtTotal.disableDuration / 2 + max.stats.heroDamageReport.dealtTotal.slowDuration / 4 ? player : max
699
699
  ).titles.push({ name: "控", color: "#FF00FF" });
700
700
  findMaxByProperty("heroDamage").titles.push({ name: "爆", color: "#CC0088" });
701
701
  findMaxByProperty("kills", "heroDamage").titles.push({ name: "破", color: "#DD0000" });
@@ -1347,7 +1347,7 @@ async function apply(ctx, config) {
1347
1347
  session.send("初次使用或版本更新,正在更新英雄技能数据中……");
1348
1348
  let queryRes2 = await query(ALL_ABILITIES_CHINESE_NAME());
1349
1349
  if (queryRes2.status == 200) {
1350
- AbilitiesConstantsCN.data = queryRes2.data.data.constants;
1350
+ AbilitiesConstantsCN = { data: queryRes2.data.data.constants };
1351
1351
  await ctx.database.upsert("dt_constants_abilities_cn", (row) => [
1352
1352
  { id: 1, data: AbilitiesConstantsCN, gameVersionId: queryConstants.gameVersions[0].id, gameVersionName: queryConstants.gameVersions[0].name }
1353
1353
  ]);
@@ -1513,6 +1513,7 @@ KDA:${((player.kills + player.assists) / (player.deaths || 1)).toFixed(2)} [${
1513
1513
  broadMatchMessage += broadPlayerMessage + "\n";
1514
1514
  }
1515
1515
  await ctx.broadcast([`${commingGuild.platform}:${commingGuild.guildId}`], broadMatchMessage + img);
1516
+ ctx.logger.info(`已解析${match.id}并发布于${commingGuild.platform}:${commingGuild.guildId}。`);
1516
1517
  }
1517
1518
  ctx.database.upsert("dt_previous_query_results", (row) => [{ matchId: match.id, data: match, queryTime: /* @__PURE__ */ new Date() }]);
1518
1519
  ctx.database.create("dt_sended_match_id", { matchId: match.id, sendTime: /* @__PURE__ */ new Date() });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sjtdev/koishi-plugin-dota2tracker",
3
3
  "description": "",
4
- "version": "1.1.2-beta.6",
4
+ "version": "1.1.2-hotfix.2",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
package/readme.md CHANGED
@@ -11,6 +11,7 @@ DOTA2Bot插件-提供自动追踪群友的最新对局的功能(需群友绑
11
11
  在希望推送战报信息的群组使用指令【-订阅本群】,玩家可使用指令【-绑定】来将自身账号与Steam账号绑定,bot会尝试追踪已订阅群组中的绑定玩家的最新对局信息。
12
12
  其他查询功能见下方指令说明。
13
13
  **直接调用help指令可获取更详细的说明,调用【指令 -h】还会有用法示例。(例如:订阅本群 -h)**
14
+ **更新日志见[changelog](changelog.md)
14
15
 
15
16
  ### 指令
16
17
  指令 <必填参数> [可选参数]
@@ -395,7 +395,7 @@
395
395
  matchCount : currentPositionMatches.length,
396
396
  winCount : winCount,
397
397
  loseCount : currentPositionMatches.length - winCount,
398
- imp : Math.round(currentPositionMatches.reduce((acc,match)=>acc+match.players[0].imp,0)/currentPositionMatches.length)
398
+ imp : currentPositionMatches.length>0? Math.round(currentPositionMatches.reduce((acc,match)=>acc+match.players[0].imp,0)/currentPositionMatches.length):"-"
399
399
  })
400
400
  }
401
401
  const highestCountsPosition = {
@@ -408,7 +408,7 @@
408
408
  <div class="wrapper">
409
409
  <div class="player">
410
410
  <%- `
411
- <div class="avatar"><img src="${player.steamAccount.avatar}" alt="" /></div>
411
+ <div class="avatar"><img src="${player.steamAccount?.avatar}" alt="" /></div>
412
412
  <div class="info">
413
413
  <p class="name">${player.steamAccount.name}${player.guildMember ? ` <span class="guild ${guildLevel(player.guildMember.guild.currentPercentile)}">[${player.guildMember.guild.tag}]</span></p>` : ""}
414
414
  <p class="matches"><span>场次:${player.matchCount}(<span class="win">${player.winCount}</span>/<span class="lose">${player.matchCount - player.winCount}</span>)</span>胜率:<span style="color:${utils.winRateColor(
@@ -475,13 +475,13 @@
475
475
  .map((position) => `
476
476
  <span><img src="${utils.getImageUrl(position.icon,ImageType.Items)}"></span>
477
477
  <span class="count">${position.matchCount}</span>
478
- <span class="win_rate">${((position.winCount / position.matchCount) * 100).toFixed(0)}%</span>
478
+ <span class="win_rate">${position.matchCount>0?(((position.winCount / position.matchCount) * 100).toFixed(0)):"-"}%</span>
479
479
  <span class="imp">${(position.imp > 0 ? "+" : "") + position.imp}</span>
480
480
  <span class="win" style="${position.winCount == 0 ? "visibility:hidden;" : ""}width: ${position.winCount * pixelOfPerMatchInPosition}px">${position.winCount}</span>
481
481
  <span class="lose" style="${position.matchCount - position.winCount == 0 ? "visibility:hidden;" : ""}width: ${(position.matchCount - position.winCount) * pixelOfPerMatchInPosition}px">${position.matchCount - position.winCount}</span>`).join("") %>
482
482
  </div>
483
483
  </div>
484
- <%- player.streak>1?`<div class="streak" style="box-shadow:none;color:${utils.winRateColor((player.streak + 10) / 20)};">${Math.abs(player.streak) + (player.streak > 0 ? "连胜" : "连败")}</div>`:"" %>
484
+ <%- Math.abs(player.streak)>1?`<div class="streak" style="box-shadow:none;color:${utils.winRateColor((player.streak + 10) / 20)};">${Math.abs(player.streak) + (player.streak > 0 ? "连胜" : "连败")}</div>`:"" %>
485
485
  <table class="matches">
486
486
  <colgroup>
487
487
  <col style="width: auto" />
@@ -518,14 +518,14 @@
518
518
  <td><img alt="" src="${utils.getImageUrl(match.players[0].hero.shortName, ImageType.HeroIcons)}" /></td>
519
519
  <td style="line-height: 20px">
520
520
  <p>${((match.players[0].kills + match.players[0].assists) / Math.max(1, match.players[0].deaths)).toFixed(2)} (${(((match.players[0].kills + match.players[0].assists) /
521
- (match.players[0].isRadiant ? match.radiantKills.reduce((acc, cva) => acc + cva, 0) : match.direKills.reduce((acc, cva) => acc + cva, 0))) * 100).toFixed(0)}%)</p>
521
+ (match.players[0].isRadiant ? match.radiantKills?.reduce((acc, cva) => acc + cva, 0) : match.direKills?.reduce((acc, cva) => acc + cva, 0))) * 100)?.toFixed(0)}%)</p>
522
522
  <p>${match.players[0].kills}/${match.players[0].deaths}/${match.players[0].assists}</p>
523
523
  </td>
524
524
  <td><div class="player_lane ${match.laneResult}">${laneSVG[match.laneResult]}</div></td>
525
525
  <td style="line-height: 20px">${moment(new Date(match.startDateTime * 1000)).format("YYYY-MM-DD HH:mm:ss").slice(2)}</td>
526
526
  <td>${utils.sec2time(match.durationSeconds)}</td>
527
527
  <td>${(match.players[0].imp > 0 ? "+" : "") + match.players[0].imp}</td>
528
- <td><img class="medal" src="${utils.getImageUrl("medal_" + match.rank.toString().split("")[0])}" style="width: 100%" /></td>
528
+ <td><img class="medal" src="${utils.getImageUrl("medal_" + match.rank?.toString().split("")[0])}" style="width: 100%" /></td>
529
529
  </tr>`).join("")%>
530
530
  </tbody>
531
531
  </table>