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

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" });
@@ -1307,6 +1307,7 @@ async function apply(ctx, config) {
1307
1307
  player.heroesPerformanceTop10 = playerExtra.heroesPerformance.slice(0, 10);
1308
1308
  } else
1309
1309
  throw 0;
1310
+ console.log(player);
1310
1311
  session.send(await ctx.puppeteer.render(genImageHTML(player, config.template_player, "player" /* Player */)));
1311
1312
  } catch (error) {
1312
1313
  ctx.logger.error(error);
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",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
@@ -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 = {
@@ -475,7 +475,7 @@
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("") %>
@@ -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>