@sjtdev/koishi-plugin-dota2tracker 1.2.0-hotfix → 1.2.1

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
@@ -642,12 +642,31 @@ function getFormattedMatchData(match) {
642
642
  break;
643
643
  }
644
644
  let items_timelist = {};
645
- player.supportItemsCount = { 30: 0, 40: 0, 42: 0, 43: 0, 188: 0 };
645
+ const supportItemIds = [30, 40, 42, 43, 188];
646
+ player.supportItemsCount = supportItemIds.reduce((obj, key) => {
647
+ obj[key] = 0;
648
+ return obj;
649
+ }, {});
646
650
  if (player.playbackData) {
651
+ const getNextElement = /* @__PURE__ */ __name(function() {
652
+ let currentIndex = 0;
653
+ return function() {
654
+ if (currentIndex >= this.length) {
655
+ return null;
656
+ }
657
+ const element = this[currentIndex];
658
+ currentIndex++;
659
+ return element;
660
+ };
661
+ }, "getNextElement");
647
662
  for (let item of player.playbackData.purchaseEvents) {
648
- items_timelist[item.itemId] = item.time;
649
- if (item.itemId == 42 || item.itemId == 43)
650
- items_timelist[218] = item.time;
663
+ if (!supportItemIds.includes(item.itemId)) {
664
+ if (!items_timelist[item.itemId]) {
665
+ items_timelist[item.itemId] = [];
666
+ items_timelist[item.itemId].getNextElement = getNextElement.call(items_timelist[item.itemId]);
667
+ }
668
+ items_timelist[item.itemId].push(item.time);
669
+ }
651
670
  switch (item.itemId) {
652
671
  case 30:
653
672
  case 40:
@@ -674,7 +693,7 @@ function getFormattedMatchData(match) {
674
693
  player.items.push({
675
694
  id: itemId,
676
695
  name: cleanName,
677
- time: items_timelist[itemId],
696
+ time: items_timelist[itemId]?.getNextElement ? items_timelist[itemId].getNextElement() : void 0,
678
697
  isRecipe
679
698
  });
680
699
  } else {
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.0-hotfix",
4
+ "version": "1.2.1",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
@@ -756,7 +756,7 @@
756
756
  <div class="titles">
757
757
  ${player.titles.map((item) => `<span style="color: ${item.color};">${item.name}</span>`).join("&nbsp;")}
758
758
  </div>
759
- ${player.hero.id != 80 ? `
759
+ ${player.hero.id != 80 ? `
760
760
  <div class="items">
761
761
  <div class="items_normal">
762
762
  ${player.items