@sjtdev/koishi-plugin-dota2tracker 1.2.8 → 1.2.9-pre

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,10 @@
1
+ ### 1.2.9-pre
2
+ **修复**:
3
+ - `查询英雄`:尝试修复DOTA2 7.37版本更新后API变动导致部分英雄查询报错。
4
+
5
+ **改进**:
6
+ - `查询英雄`:命石技能的技能名栏位添加对应命石图标与背景色用于标识。
7
+
1
8
  # 1.2.8
2
9
  **新增**:
3
10
  - 新增周报功能,效果等同日报。
package/lib/index.js CHANGED
@@ -1531,6 +1531,7 @@ async function apply(ctx, config) {
1531
1531
  else
1532
1532
  hero.facets[i].description_loc = formatHeroDesc(hero.facets[i].description_loc, ab.special_values, "facet" /* Facet */);
1533
1533
  ab.ability_is_facet = true;
1534
+ ab.facet = hero.facets[i];
1534
1535
  hero.abilities.push(ab);
1535
1536
  });
1536
1537
  }
@@ -1538,6 +1539,9 @@ async function apply(ctx, config) {
1538
1539
  const all_special_values = [...hero.abilities.flatMap((ab) => ab.special_values), ...hero.facet_abilities.flatMap((fas) => fas.abilities.flatMap((fa) => fa.special_values))];
1539
1540
  hero.abilities.forEach((ab) => {
1540
1541
  ab.facets_loc.forEach((facet, i) => {
1542
+ i = i + (hero.facets.length - ab.facets_loc.length);
1543
+ if (i < 0)
1544
+ return;
1541
1545
  if (facet) {
1542
1546
  if (!hero.facets[i].abilities)
1543
1547
  hero.facets[i].abilities = [];
@@ -1735,7 +1739,6 @@ async function apply(ctx, config) {
1735
1739
  for (let player of broadPlayers) {
1736
1740
  const random2 = new import_koishi2.Random(() => simpleHashToSeed(`${match.id}-${player.steamAccountId}-${player.playerSlot}`));
1737
1741
  let broadPlayerMessage = `${player.steamAccount.name}的${random2.pick(HEROES_CHINESE[player.hero.id])}`;
1738
- console.log([player.deathContribution, player.killContribution]);
1739
1742
  if (player.isRadiant == match.didRadiantWin) {
1740
1743
  if (player.deathContribution < 0.2 || player.killContribution > 0.75 || player.heroDamage / player.networth > 1.5 || player.towerDamage > 1e4 || player.imp > 0)
1741
1744
  broadPlayerMessage += random2.pick(WIN_POSITIVE);
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.8",
4
+ "version": "1.2.9-pre",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
@@ -204,7 +204,8 @@
204
204
  gap: 10px; /* 可选:设置项目之间的间距 */
205
205
  }
206
206
 
207
- .facet {
207
+ .facets > .facet ,
208
+ .skill > .facet {
208
209
  flex: 1 1 calc(50% - 10px); /* 每行两个项目 */
209
210
  box-sizing: border-box; /* 包含padding和border在宽度和高度的计算中 */
210
211
  background-color: #181f24;
@@ -212,10 +213,11 @@
212
213
  border: 1px solid #2b2f33;
213
214
  }
214
215
 
215
- .facet:nth-child(odd):last-child {
216
+ .facets > .facet:nth-child(odd):last-child {
216
217
  flex-basis: 100%; /* 最后一个奇数项目占据整行 */
217
218
  }
218
- .facet > .name_back {
219
+ .facets > .facet > .name_back ,
220
+ .skill > .facet > .name_back {
219
221
  position: absolute;
220
222
  height: 50px;
221
223
  width: 100%;
@@ -343,6 +345,8 @@
343
345
  background-color: #1f272b;
344
346
  padding: 8px;
345
347
  font-weight: 100;
348
+ height: auto;
349
+ width: auto;
346
350
  }
347
351
  .skill > .title > .name {
348
352
  font-family: "KaiTi", "楷体", "楷体_GB2312", "STKaiti", serif;
@@ -357,6 +361,10 @@
357
361
  background-color: #5b93d1;
358
362
  }
359
363
 
364
+ .skill > .title.name_back > img{
365
+ width: 16px;
366
+ }
367
+
360
368
  .skill img.scepter,
361
369
  .skill img.shard {
362
370
  position: absolute;
@@ -685,8 +693,9 @@
685
693
  <div class="skills">
686
694
  ${hero.abilities//.filter((item) => dotaconstants.abilities[item.name]?.behavior != "Hidden")
687
695
  .map((item) => `
688
- <div class="skill" data-innate="${item.ability_is_innate&&!item.ability_is_facet}">
689
- <p class="title">
696
+ <div class="skill${item.facet?' facet':''}" data-innate="${item.ability_is_innate&&!item.ability_is_facet}">
697
+ <p class="title${item.facet?(' name_back type_' + item.facet?.color):''}">
698
+ ${item.facet?`<img src="${utils.getImageUrl(item.facet?.icon, ImageType.IconsFacets)}">`:""}
690
699
  <span class="name">${item.name_loc}</span>
691
700
  ${item.ability_is_innate&&!item.ability_is_facet?`<span class="is_innate">先天技能</span>`:""}
692
701
  ${item.ability_is_granted_by_scepter ?`<img src="${utils.getImageUrl("scepter")}" class="scepter">`:""}
@@ -712,7 +721,12 @@
712
721
  </div>
713
722
  </div>
714
723
  <p class="description">${item.desc_loc}</p>
715
- ${item.facets_loc.map((facet_loc,index)=>(facet_loc!=""?`
724
+ ${item.facets_loc
725
+ .reduce((acc, facet_loc, index) => {
726
+ index = index + (hero.facets.length - item.facets_loc.length);
727
+ if (index >= 0) acc.push(facet_loc);
728
+ return acc;},[])
729
+ .map((facet_loc,index)=>(facet_loc!=""?`
716
730
  <div class="facet">
717
731
  <div class="name_back type_${hero.facets[index].color}"></div>
718
732
  <div class="name_line type_${hero.facets[index].color}"></div>
@@ -727,12 +741,12 @@
727
741
  </div>
728
742
  </div>
729
743
  `:"")).join("")}
730
- ${item.ability_has_scepter&&!item.ability_is_granted_by_scepter
744
+ ${item.ability_has_scepter&&!item.ability_is_granted_by_scepter&&item.scepter_loc
731
745
  ? `<p class="aghanim_description">
732
746
  <span class="title"><img src="${utils.getImageUrl("scepter")}"class="scepter">阿哈利姆神杖</span>
733
747
  <span class="desc">${item.scepter_loc}</span>
734
748
  </p>` : ""}
735
- ${item.ability_has_shard&&!item.ability_is_granted_by_shard
749
+ ${item.ability_has_shard&&!item.ability_is_granted_by_shard&&item.shard_loc
736
750
  ? `<p class="aghanim_description">
737
751
  <span class="title"><img src="${utils.getImageUrl("shard")}"class="shard">阿哈利姆魔晶</span>
738
752
  <span class="desc">${item.shard_loc}</span>
@@ -760,7 +774,7 @@
760
774
  `<span class="alternative shard">
761
775
  <img src="${utils.getImageUrl("shard")}"/>${sv.values_shard.map(value => (value > 0 ? '<span class="plus">+</span>' : "") + value + (sv.is_percentage ? "%" : "")).join(" / ")}
762
776
  </span>` : "" }
763
- ${sv.facet_bonus.name ?
777
+ ${sv.facet_bonus.name && hero.facets.some(facet=>facet.name==sv.facet_bonus.name) ?
764
778
  `<span class="alternative facet">
765
779
  <span class="facet"><span class="name_back type_${hero.facets.find(facet=>facet.name==sv.facet_bonus.name).color}"><img src="${utils.getImageUrl(hero.facets.find(facet=>facet.name==sv.facet_bonus.name).icon, ImageType.IconsFacets)}" />${sv.facet_bonus.values.map(value => value + (sv.is_percentage ? "%" : "")).join(" / ")}</span></span>
766
780
  </span>` : "" }