@sjtdev/koishi-plugin-dota2tracker 2.5.7 → 2.5.9

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,5 +1,29 @@
1
1
  # 更新日志
2
2
 
3
+ ### [2.5.9](https://github.com/sjtdev/koishi-plugin-dota2tracker/compare/v2.5.8...v2.5.9) (2026-04-06)
4
+
5
+ ### 🚀 功能优化
6
+
7
+ * **hero:** 重构精简数据处理逻辑,并进一步解决部分情况下的异常显示问题 ([a2dd5d4](https://github.com/sjtdev/koishi-plugin-dota2tracker/commit/a2dd5d4143b49ace1254031b43bd5c2f6b9a5a7c))
8
+
9
+ ### 🎨 样式
10
+
11
+ * **templates/hero:** 微调样式 ([89523c2](https://github.com/sjtdev/koishi-plugin-dota2tracker/commit/89523c2353f7f4166674dd21d322cda82cad9584))
12
+
13
+ ### 🐛 Bug 修复
14
+
15
+ * **weekly-report:** 修复文件名不匹配导致的周报发送失败的问题 ([1ed3270](https://github.com/sjtdev/koishi-plugin-dota2tracker/commit/1ed3270122987e0924176b04fb8d5f537f9a5048)), closes [#19](https://github.com/sjtdev/koishi-plugin-dota2tracker/issues/19)
16
+
17
+ ### [2.5.8](https://github.com/sjtdev/koishi-plugin-dota2tracker/compare/v2.5.7...v2.5.8) (2026-03-31)
18
+
19
+ ### 🚀 功能优化
20
+
21
+ * **templates/hero:** 优化部分显示逻辑,避免在数据失效时显示错误字符 ([480b418](https://github.com/sjtdev/koishi-plugin-dota2tracker/commit/480b4181310afaff45dfa7c98ff52390fe1e59f4))
22
+
23
+ ### 🐛 Bug 修复
24
+
25
+ * **opendota-adapter:** 提升`dotaconstants`依赖版本以修复使用`opendota`查询比赛数据失败的问题 ([81b56fd](https://github.com/sjtdev/koishi-plugin-dota2tracker/commit/81b56fdcc636b792e1371855fdbbcd9416d3eefc))
26
+
3
27
  ### [2.5.7](https://github.com/sjtdev/koishi-plugin-dota2tracker/compare/v2.5.6...v2.5.7) (2026-03-25)
4
28
 
5
29
  ### 🚀 功能优化
package/lib/index.js CHANGED
@@ -1143,7 +1143,7 @@ var HeroService = class _HeroService extends import_koishi2.Service {
1143
1143
  return _HeroService.formatHeroDetails(await this.ctx.dota2tracker.valveAPI.queryHeroDetailsFromValve(heroId, languageTag));
1144
1144
  }
1145
1145
  static formatHeroDetails(rawHero) {
1146
- let hero = Object.assign({}, rawHero);
1146
+ const hero = Object.assign({}, rawHero);
1147
1147
  hero.abilities.forEach((ab) => {
1148
1148
  ab.desc_loc = this.formatHeroDesc(ab.desc_loc, ab.special_values);
1149
1149
  ab.notes_loc = ab.notes_loc.map((note) => this.formatHeroDesc(note, ab.special_values));
@@ -1151,67 +1151,53 @@ var HeroService = class _HeroService extends import_koishi2.Service {
1151
1151
  if (ab.ability_has_shard) ab.shard_loc = this.formatHeroDesc(ab.shard_loc, ab.special_values, "shard" /* Shard */);
1152
1152
  });
1153
1153
  hero.talents.forEach((talent) => {
1154
- const regex = /\{s:(.*?)\}/g;
1155
- let match;
1156
- while ((match = regex.exec(talent.name_loc)) !== null) {
1157
- const specialValueName = match[1];
1154
+ talent.name_loc = talent.name_loc.replace(/\{s:(.*?)\}/g, (match, specialValueName) => {
1158
1155
  const target = talent.special_values?.find((sv) => sv.name === specialValueName);
1159
- if (target) {
1160
- talent.name_loc = talent.name_loc.replace(match[0], target.values_float.join("/"));
1161
- } else {
1162
- const abilities = hero.abilities.filter((ability) => ability.special_values.some((specialValue) => specialValue.bonuses.some((bonus) => bonus.name === talent.name)));
1163
- for (const ability of abilities) {
1164
- const specialValues = ability.special_values.filter((specialValue) => specialValue.bonuses.some((bonus) => bonus.name === talent.name));
1165
- const regex2 = /{s:bonus_(.*?)}/g;
1166
- let match2;
1167
- const replacements = [];
1168
- while ((match2 = regex2.exec(talent.name_loc)) !== null) {
1169
- const specialValue = specialValues.find((sv) => sv.name === String(match2[1]));
1170
- const replacement = specialValue?.bonuses.find((bonus) => bonus.name === talent.name)?.value;
1171
- if (replacement !== void 0) {
1172
- replacements.push({
1173
- original: match2[0],
1174
- replacement
1175
- });
1176
- }
1156
+ if (target) return target.values_float.join("/");
1157
+ const cleanVarName = specialValueName.replace(/^bonus_/, "");
1158
+ for (const ability of hero.abilities) {
1159
+ const svWithBonus = ability.special_values.find(
1160
+ (sv) => (sv.name === cleanVarName || sv.name === specialValueName) && sv.bonuses.some((bonus) => bonus.name === talent.name)
1161
+ );
1162
+ if (svWithBonus) {
1163
+ const bonusObj = svWithBonus.bonuses.find((bonus) => bonus.name === talent.name);
1164
+ if (bonusObj && bonusObj.value !== void 0) {
1165
+ return bonusObj.value;
1177
1166
  }
1178
- replacements.forEach(({ original, replacement }) => {
1179
- talent.name_loc = talent.name_loc.replace(original, replacement);
1180
- });
1181
1167
  }
1182
1168
  }
1183
- }
1169
+ return "?";
1170
+ });
1184
1171
  });
1185
1172
  return hero;
1186
1173
  }
1187
1174
  static formatHeroDesc(template, special_values, type = "normal" /* Normal */) {
1175
+ if (!template) return template;
1188
1176
  return template.replace(/%%|%([^%]+)%|\{([^}]+)\}/g, (match, p1, p2) => {
1177
+ if (match === "%%") return "%";
1189
1178
  const field = p1 || p2;
1190
- if (match === "%%") {
1191
- return "%";
1192
- } else {
1193
- const fieldName = field.replace(/^s:/, "").replace(/^shard_/, "").toLowerCase();
1194
- const specialValue = special_values.find((sv) => {
1195
- const nameLower = sv.name.toLowerCase();
1196
- return nameLower === fieldName || nameLower === `bonus_${fieldName}` || nameLower === `shard_${fieldName}` || `bonus_${nameLower}` === fieldName || `shard_${nameLower}` === fieldName;
1197
- });
1198
- if (specialValue) {
1199
- let valuesToUse = "";
1200
- switch (type) {
1201
- case "scepter" /* Scepter */:
1202
- valuesToUse = specialValue.values_scepter.length ? specialValue.values_scepter.join(" / ") : specialValue.values_float.join(" / ");
1203
- break;
1204
- case "shard" /* Shard */:
1205
- valuesToUse = specialValue.values_shard.length ? specialValue.values_shard.join(" / ") : specialValue.values_float.join(" / ");
1206
- break;
1207
- default:
1208
- valuesToUse = specialValue.values_float.join(" / ");
1209
- }
1210
- return `<span class="value">${valuesToUse}</span>`;
1211
- } else {
1212
- return match;
1179
+ const fieldName = field.replace(/^s:/, "").replace(/^shard_/, "").toLowerCase();
1180
+ const strippedFieldName = fieldName.replace(/_tooltip$/, "");
1181
+ const specialValue = special_values.find((sv) => {
1182
+ const nameLower = sv.name.toLowerCase();
1183
+ const strippedNameLower = nameLower.replace(/_tooltip$/, "");
1184
+ return nameLower === fieldName || nameLower === `bonus_${fieldName}` || nameLower === `shard_${fieldName}` || `bonus_${nameLower}` === fieldName || `shard_${nameLower}` === fieldName || strippedNameLower === strippedFieldName || nameLower === `ability${strippedFieldName}`;
1185
+ });
1186
+ if (specialValue) {
1187
+ let valuesToUse = "";
1188
+ switch (type) {
1189
+ case "scepter" /* Scepter */:
1190
+ valuesToUse = specialValue.values_scepter.length ? specialValue.values_scepter.join(" / ") : specialValue.values_float.join(" / ");
1191
+ break;
1192
+ case "shard" /* Shard */:
1193
+ valuesToUse = specialValue.values_shard.length ? specialValue.values_shard.join(" / ") : specialValue.values_float.join(" / ");
1194
+ break;
1195
+ default:
1196
+ valuesToUse = specialValue.values_float.join(" / ");
1213
1197
  }
1198
+ return `<span class="value">${valuesToUse}</span>`;
1214
1199
  }
1200
+ return match;
1215
1201
  });
1216
1202
  }
1217
1203
  };
@@ -1473,6 +1459,7 @@ var MatchService = class _MatchService extends import_koishi4.Service {
1473
1459
  super(ctx, "dota2tracker.match", true);
1474
1460
  this.pluginVersion = pluginVersion;
1475
1461
  }
1462
+ pluginVersion;
1476
1463
  static {
1477
1464
  __name(this, "MatchService");
1478
1465
  }
@@ -2419,7 +2406,7 @@ var StratzAPI = class extends import_koishi8.Service {
2419
2406
  }
2420
2407
  async queryPlayersMatchesForDaily_legacy(steamAccountIds, seconds) {
2421
2408
  return this.query(
2422
- "PlayersMatchesForDaily_Legacy",
2409
+ "PlayersMatchesForDaily_legacy",
2423
2410
  {
2424
2411
  steamAccountIds,
2425
2412
  seconds
@@ -2539,6 +2526,7 @@ var MiniQueue = class {
2539
2526
  this.ctx = ctx;
2540
2527
  this.interval = options.interval;
2541
2528
  }
2529
+ ctx;
2542
2530
  static {
2543
2531
  __name(this, "MiniQueue");
2544
2532
  }
@@ -2751,7 +2739,10 @@ var ViewRenderer = class extends import_koishi10.Service {
2751
2739
  async: true
2752
2740
  });
2753
2741
  }
2754
- if (process.env.NODE_ENV === "development") import_node_fs2.default.writeFileSync(import_node_path2.default.resolve(process.cwd(), "temp.html"), html);
2742
+ if (process.env.NODE_ENV === "development") {
2743
+ const debugFileName = template.source === "CODE" ? "code" : template.templateName;
2744
+ import_node_fs2.default.writeFileSync(import_node_path2.default.resolve(process.cwd(), "temp", `${debugFileName}.html`), html);
2745
+ }
2755
2746
  return html;
2756
2747
  } catch (error) {
2757
2748
  this.logger.error(error);
@@ -3691,6 +3682,8 @@ var TaskMessenger = class {
3691
3682
  this.session = session;
3692
3683
  this.options = options;
3693
3684
  }
3685
+ session;
3686
+ options;
3694
3687
  static {
3695
3688
  __name(this, "TaskMessenger");
3696
3689
  }
@@ -1 +1 @@
1
- html,body{background-color:#000;color:#fff;width:800px}.wrapper>*:not(.skills){margin:5px;box-shadow:0 0 5px #fff;display:flex}img{width:100%;vertical-align:middle}p{margin:0}.hero{position:relative}.hero img{width:25%}.hero .pri_attr{position:absolute;width:48px;left:25%}.hero .info{display:flex;width:75%;flex-direction:column;justify-content:space-around;align-items:center;padding:4px}.hero .info .name{font-size:24px}.hero .info .roles .role{font-size:14px}.hero .info .roles .role:not(:last-child){margin-right:12px}.hero .info .roles .role:after{margin-left:3px;font-size:22px}.hero .info .roles .role.level1:after{content:"\25a0\25a1\25a1"}.hero .info .roles .role.level2:after{content:"\25a0\25a0\25a1"}.hero .info .roles .role.level3:after{content:"\25a0\25a0\25a0"}.hero .info .attrs{height:16px;font-size:16px;line-height:1}.hero .info .attrs>span{margin:0 8px;vertical-align:middle}.hero .info .attrs>span:before{display:inline-block;content:"";background-size:100%;width:16px;height:16px;vertical-align:top}.hero .info .attrs>span.str:before{background-image:url("<%= getImageUrl('hero_strength', ImageType.Icons) %>")}.hero .info .attrs>span.agi:before{background-image:url("<%= getImageUrl('hero_agility', ImageType.Icons) %>")}.hero .info .attrs>span.int:before{background-image:url("<%= getImageUrl('hero_intelligence', ImageType.Icons) %>")}.details{flex-direction:row}.details>*{width:50%}.wrapper .hype{display:block;padding:8px;line-height:1.25}.wrapper .hype .npe{color:#a5e0f3;font-weight:700;line-height:1.25;margin-bottom:8px}.talents{display:grid;grid-template-rows:repeat(4,35px);gap:10px;border:#444 10px solid;box-sizing:border-box;position:relative}.talents:before{content:"";position:absolute;inset:0;background:#444;pointer-events:none;box-sizing:border-box;width:395px;transform:translate(-10px,-10px)}.talents .talent{width:375px;text-align:center;display:flex;align-items:center;background:#000;position:relative}.talents .talent .left,.talents .talent .right{width:170px;font-size:12px}.talents .talent .level{flex:0 0 auto;width:35px;height:35px;font-size:18px;line-height:35px;text-align:center;box-sizing:border-box;border-radius:100%;color:#e7d292;text-shadow:0px 0px 8px #ff531c;background-color:#444}.details .list table td{width:50%;text-align:center}.details .list table tr:nth-child(2n){background-color:#333}.details .list{display:flex;flex-direction:column;padding:6px}.details .list>*{flex-grow:1}.details .bars{height:64px;flex-grow:0}.details .bars>div{height:28px;margin-bottom:4px;border-radius:5px;box-shadow:inset 0 0 2px #00000080,0 0 2px #0000004d;position:relative;display:flex;align-items:center}.details .bars .health{background:linear-gradient(to top,#279027,#27a329 56%,#96e891 83%,#366a35)}.details .bars .mana{background:linear-gradient(to top,#4676c4,#2b76d5 56%,#95cdff)}.details .bars .mana.zero{background:none}.details .bars span{text-shadow:#000 1px 1px 4px}.details .bars .number{font-size:18px;position:absolute;left:50%;transform:translate(-50%)}.details .bars .suffix{margin-left:auto;font-size:14px;padding-right:10px}.details .stats{display:flex;justify-content:space-around;line-height:1.3}.details .stats>.column>p{padding:4px;color:#b2b2b2}.details .stats .stat img{width:20px}.facets{display:flex;flex-wrap:wrap;gap:10px}.facets>.facet,.skill>.facet{flex:1 1 calc(50% - 10px);box-sizing:border-box;background-color:#181f24;position:relative;border:1px solid #2b2f33}.facets>.facet:nth-child(odd):last-child{flex-basis:100%}.facets>.facet>.name_back,.skill>.facet>.name_back{position:absolute;height:50px;width:100%}.facet>.name_back.type_0{background:linear-gradient(to right,#9f3c3c,#4a2026)}.facet>.name_line.type_0{filter:invert(22%) sepia(100%) saturate(100%) hue-rotate(316deg) brightness(98%) contrast(100%)}.facet>.name_back.type_1{background:linear-gradient(to right,#c8a45c,#6f3d21)}.facet>.name_line.type_1{filter:invert(54%) sepia(99%) saturate(100%) hue-rotate(0deg) brightness(97%) contrast(100%)}.facet>.name_back.type_2{background:linear-gradient(to right,#a2b23e,#2d5a18)}.facet>.name_line.type_2{filter:invert(57%) sepia(100%) saturate(100%) hue-rotate(32deg) brightness(93%) contrast(100%)}.facet>.name_back.type_3{background:linear-gradient(to right,#547ea6,#2a385e)}.facet>.name_line.type_3{filter:invert(39%) sepia(100%) saturate(99%) hue-rotate(167deg) brightness(99%) contrast(100%)}.facet>.name_back.type_4{background:linear-gradient(to right,#675cae,#261c44)}.facet>.name_line.type_4{filter:invert(33%) sepia(100%) saturate(100%) hue-rotate(207deg) brightness(99%) contrast(100%)}.facet>.name_back.type_5{background:linear-gradient(to right,#adb6be,#4e5557)}.facet>.name_line.type_5{filter:invert(73%) sepia(23%) saturate(99%) hue-rotate(166deg) brightness(93%) contrast(94%)}.facet>.name_line{position:absolute;background-size:cover;height:50px;width:100%;background-image:url(https://cdn.akamai.steamstatic.com/apps/dota2/images/dota_react/icons/facets/ripple_texture.png)}.facet>.name{height:50px;line-height:50px;z-index:1;position:relative;display:flex}.facet>.name>img{width:24px;padding:13px;background-color:#0003}.facet>.name>span{margin-left:16px;letter-spacing:2px;text-shadow:2px 2px 3px rgba(0,0,0,.3),4px 4px 6px rgba(0,0,0,.2),6px 6px 9px rgba(0,0,0,.1)}.facet>.content{padding:12px;display:flex;flex-direction:column;gap:12px}.facet>.content>.ability{display:flex;flex-direction:column;gap:12px}.facet>.content>.ability>.name{background:linear-gradient(to right,#9bcdff17,#9bcdff09 30%,#d0e8ff00);line-height:1}.facet>.content>.ability>.name>img{width:30px}.facet>.content>.ability>.name>span{margin-left:10px;font-size:14px}.facet>.content .description{color:#9ab0cd}.facet>.content>.ability>.attributes{font-size:12px;display:flex;flex-direction:column;gap:5px}.facet>.content>.ability>.attributes .item{color:#737373}.facet>.content .value{color:#fff}.skills{width:800px;display:flex;flex-wrap:wrap}.skill{background-color:#141b1f;margin:5px;box-shadow:0 0 5px #fff;width:390px}.skill>*:not(:nth-child(2)){padding-left:8px}.skill>.title{position:relative;background-color:#1f272b;padding:8px;font-weight:100;height:auto;width:auto}.skill>.title>.name{font-family:KaiTi,\6977\4f53,\6977\4f53_GB2312,STKaiti,serif}.skill>.title>.is_innate{font-size:14px;line-height:18px;width:auto;display:inline;padding:2px 8px;box-sizing:content-box;background-color:#5b93d1}.skill>.title.name_back>img{width:16px}.skill img.scepter,.skill img.shard{position:absolute;width:24px;right:8px;top:50%;transform:translateY(-50%)}.skill .img_stats{display:flex;color:#546780;margin-bottom:16px;border-top:#2a363c 1px solid;border-bottom:#2a363c 1px solid}.skill .img_stats img{width:128px}.skill .img_stats .stats{padding:8px}.skill .stats .dmg_type.Physical span{color:#ae2f28}.skill .stats .dmg_type.Magical span{color:#5b93d1}.skill .stats .dmg_type.Pure span{color:#c29c4a}.skill .stats .dispellable.No span{color:red}.skill .stats .dispellable.Strong span{color:#9828ae}.skill .stats .bkbpierce.Yes span{color:#6add71}.skill>.description{color:#9bb1ce;margin-bottom:32px}.skill>.facet{padding-left:0;margin-bottom:16px}.skill .value{color:#fff}.skill .aghanim_description{padding-left:0;color:#9bb1ce;margin-bottom:16px;border:#263945 solid 3px;box-sizing:border-box}.skill .aghanim_description .title{display:block;font-size:20px;background-color:#263945;padding:12px}.skill .aghanim_description .desc{margin:12px;display:block}.skill .aghanim_description img{position:unset;transform:none;margin-right:8px}.skill .notes{padding:12px;margin-bottom:12px;color:#9fb7c6;background-color:#263945}.skill .attributes{line-height:1.2em;margin-bottom:12px}.skill .attributes .heading{color:#546780}.skill .attributes .values{color:#4b525d}.skill .attributes .values img{width:16px}.skill .attributes .facet{display:inline-flex;font-size:1em;align-items:center;line-height:1.2em;position:unset;color:#fff}.skill .attributes .facet span{height:auto;width:auto;position:unset;padding:0 2px}.skill .attributes .facet img{width:auto;height:1em;padding-right:.2em}.skill .attributes .alternative .plus{display:none}.skill .attributes .primary~.alternative .plus{display:inline}.skill .attributes .primary~.alternative:before{content:"("}.skill .attributes .primary~.alternative:after{content:")"}.skill .cooldown{padding-right:12px}.skill .cooldown:before,.skill .mana_cost:before{content:"";background-size:100%;width:21px;height:21px;display:inline-block;vertical-align:middle}.skill .cooldown:before{background-image:url(data:image/webp;base64,UklGRnABAABXRUJQVlA4TGMBAAAvE8AEEE2QTdqmkI5pRP/DS2wBEIT/bw8R/U8Ddq1NipSvGnd3eXJ3d3kmEM+GTDwBciCBTQCd7qpCeokBQdu2cc6f8tcQEBT5P9oEIGiwYuMBECqAbCUVIIAa19Py1I/AQMrJVGEABACe+DRqcl2GUxeOwIAzQkAAMCBxyi3BRcbSkzAKyIDTciQOAAgwyx43JA4CWRkeQXAAQKkGEs5+/siARwFHAHCUiAGwPwAEAGQSDgCAoCQUQc7OkwMbhgAAJBIKEAtkE9enBgcABEUxAIwyZ6cOx/lTkPiHsX+mqCQTMQRwcmAszPLUoTiCkVAAbDKEAWWUjWlGMYyEAR4n4wMeiBk8W9M1lphIQmAsmWxBJ1vfAJZIBMAoJwNQ0JTN04/yRaCCftofwWBkAMAjQ6BILaWMsEkFFVTTk/qEETyQlYFXnh9jmABKbkgzNQgemYwnTOKFEgAAOGJAeUbyhQIAAA==)}.skill .mana_cost:before{background-image:url(data:image/webp;base64,UklGRsYAAABXRUJQVlA4TLkAAAAvE8AEEIfBOIDbtEmdpEDhS8G2kSTF0eteuLOebJz/0KDREgwBAGEu/89yqe5LCyEaDT03NBcLpEXnJgkZKS2dmlqAlNSCgJXURBoNCHAY2bbSvEP0fxzi7sGh//rslRDR/xQxS0bXRkRMmr5Ho8iISY5523Ztr2vabBuaZZLVE99wRqWAUgGFAv4K+Cngo4CXAp4KeCjgroCbAi4KVv7pOnFwF8aP9+fRXeAaMZ63GbXWiIhxGJ0bEQA=)}.skill .lore{font-size:13px;color:#3e4f5b;padding:8px;line-height:1.25}body .wrapper>.lore{display:block;line-height:1.25;padding:8px;font-family:KaiTi,\6977\4f53,\6977\4f53_GB2312,STKaiti,serif;color:#aaa}
1
+ html,body{background-color:#000;color:#fff;width:800px}.wrapper>*:not(.skills){margin:5px;box-shadow:0 0 5px #fff;display:flex}img{width:100%;vertical-align:middle}p{margin:0}.hero{position:relative}.hero img{width:25%}.hero .pri_attr{position:absolute;width:48px;left:25%}.hero .info{display:flex;width:75%;flex-direction:column;justify-content:space-around;align-items:center;padding:4px}.hero .info .name{font-size:24px}.hero .info .roles .role{font-size:14px}.hero .info .roles .role:not(:last-child){margin-right:12px}.hero .info .roles .role:after{margin-left:3px;font-size:22px}.hero .info .roles .role.level1:after{content:"\25a0\25a1\25a1"}.hero .info .roles .role.level2:after{content:"\25a0\25a0\25a1"}.hero .info .roles .role.level3:after{content:"\25a0\25a0\25a0"}.hero .info .attrs{height:16px;font-size:16px;line-height:1}.hero .info .attrs>span{margin:0 8px;vertical-align:middle}.hero .info .attrs>span:before{display:inline-block;content:"";background-size:100%;width:16px;height:16px;vertical-align:top}.hero .info .attrs>span.str:before{background-image:url("<%= getImageUrl('hero_strength', ImageType.Icons) %>")}.hero .info .attrs>span.agi:before{background-image:url("<%= getImageUrl('hero_agility', ImageType.Icons) %>")}.hero .info .attrs>span.int:before{background-image:url("<%= getImageUrl('hero_intelligence', ImageType.Icons) %>")}.details{flex-direction:row}.details>*{width:50%}.wrapper .hype{display:block;padding:8px;line-height:1.25}.wrapper .hype .npe{color:#a5e0f3;font-weight:700;line-height:1.25;margin-bottom:8px}.talents{display:grid;grid-template-rows:repeat(4,35px);gap:10px;border:#444 10px solid;box-sizing:border-box;position:relative}.talents:before{content:"";position:absolute;inset:0;background:#444;pointer-events:none;box-sizing:border-box;width:395px;transform:translate(-10px,-10px)}.talents .talent{width:375px;text-align:center;display:flex;align-items:center;background:#000;position:relative}.talents .talent .left,.talents .talent .right{width:170px;font-size:12px}.talents .talent .level{flex:0 0 auto;width:35px;height:35px;font-size:18px;line-height:35px;text-align:center;box-sizing:border-box;border-radius:100%;color:#e7d292;text-shadow:0px 0px 8px #ff531c;background-color:#444}.details .list table td{width:50%;text-align:center}.details .list table tr:nth-child(2n){background-color:#333}.details .list{display:flex;flex-direction:column;padding:6px}.details .list>*{flex-grow:1}.details .bars{height:64px;flex-grow:0}.details .bars>div{height:28px;margin-bottom:4px;border-radius:5px;box-shadow:inset 0 0 2px #00000080,0 0 2px #0000004d;position:relative;display:flex;align-items:center}.details .bars .health{background:linear-gradient(to top,#279027,#27a329 56%,#96e891 83%,#366a35)}.details .bars .mana{background:linear-gradient(to top,#4676c4,#2b76d5 56%,#95cdff)}.details .bars .mana.zero{background:none}.details .bars span{text-shadow:#000 1px 1px 4px}.details .bars .number{font-size:18px;position:absolute;left:50%;transform:translate(-50%)}.details .bars .suffix{margin-left:auto;font-size:14px;padding-right:10px}.details .stats{display:flex;justify-content:space-around;line-height:1.3}.details .stats>.column>p{padding:4px;color:#b2b2b2}.details .stats .stat img{width:20px}.facets{display:flex;flex-wrap:wrap;gap:10px}.facets>.facet,.skill>.facet{flex:1 1 calc(50% - 10px);box-sizing:border-box;background-color:#181f24;position:relative;border:1px solid #2b2f33}.facets>.facet:nth-child(odd):last-child{flex-basis:100%}.facets>.facet>.name_back,.skill>.facet>.name_back{position:absolute;height:50px;width:100%}.facet>.name_back.type_0{background:linear-gradient(to right,#9f3c3c,#4a2026)}.facet>.name_line.type_0{filter:invert(22%) sepia(100%) saturate(100%) hue-rotate(316deg) brightness(98%) contrast(100%)}.facet>.name_back.type_1{background:linear-gradient(to right,#c8a45c,#6f3d21)}.facet>.name_line.type_1{filter:invert(54%) sepia(99%) saturate(100%) hue-rotate(0deg) brightness(97%) contrast(100%)}.facet>.name_back.type_2{background:linear-gradient(to right,#a2b23e,#2d5a18)}.facet>.name_line.type_2{filter:invert(57%) sepia(100%) saturate(100%) hue-rotate(32deg) brightness(93%) contrast(100%)}.facet>.name_back.type_3{background:linear-gradient(to right,#547ea6,#2a385e)}.facet>.name_line.type_3{filter:invert(39%) sepia(100%) saturate(99%) hue-rotate(167deg) brightness(99%) contrast(100%)}.facet>.name_back.type_4{background:linear-gradient(to right,#675cae,#261c44)}.facet>.name_line.type_4{filter:invert(33%) sepia(100%) saturate(100%) hue-rotate(207deg) brightness(99%) contrast(100%)}.facet>.name_back.type_5{background:linear-gradient(to right,#adb6be,#4e5557)}.facet>.name_line.type_5{filter:invert(73%) sepia(23%) saturate(99%) hue-rotate(166deg) brightness(93%) contrast(94%)}.facet>.name_line{position:absolute;background-size:cover;height:50px;width:100%;background-image:url(https://cdn.akamai.steamstatic.com/apps/dota2/images/dota_react/icons/facets/ripple_texture.png)}.facet>.name{height:50px;line-height:50px;z-index:1;position:relative;display:flex}.facet>.name>img{width:24px;padding:13px;background-color:#0003}.facet>.name>span{margin-left:16px;letter-spacing:2px;text-shadow:2px 2px 3px rgba(0,0,0,.3),4px 4px 6px rgba(0,0,0,.2),6px 6px 9px rgba(0,0,0,.1)}.facet>.content{padding:12px;display:flex;flex-direction:column;gap:12px}.facet>.content>.ability{display:flex;flex-direction:column;gap:12px}.facet>.content>.ability>.name{background:linear-gradient(to right,#9bcdff17,#9bcdff09 30%,#d0e8ff00);line-height:1}.facet>.content>.ability>.name>img{width:30px}.facet>.content>.ability>.name>span{margin-left:10px;font-size:14px}.facet>.content .description{color:#9ab0cd}.facet>.content>.ability>.attributes{font-size:12px;display:flex;flex-direction:column;gap:5px}.facet>.content>.ability>.attributes .item{color:#737373}.facet>.content .value{color:#fff}.skills{width:800px;display:flex;flex-wrap:wrap}.skill{background-color:#141b1f;margin:5px;box-shadow:0 0 5px #fff;width:390px}.skill>*:not(:nth-child(2)){padding:0 8px}.skill>.title{position:relative;background-color:#1f272b;padding:8px;font-weight:100;height:auto;width:auto}.skill>.title>.name{font-family:KaiTi,\6977\4f53,\6977\4f53_GB2312,STKaiti,serif}.skill>.title>.is_innate{font-size:14px;line-height:18px;width:auto;display:inline;padding:2px 8px;box-sizing:content-box;background-color:#5b93d1}.skill>.title.name_back>img{width:16px}.skill img.scepter,.skill img.shard{position:absolute;width:24px;right:8px;top:50%;transform:translateY(-50%)}.skill .img_stats{display:flex;color:#546780;margin-bottom:16px;border-top:#2a363c 1px solid;border-bottom:#2a363c 1px solid}.skill .img_stats img{width:128px}.skill .img_stats .stats{padding:8px}.skill .stats .dmg_type.Physical span{color:#ae2f28}.skill .stats .dmg_type.Magical span{color:#5b93d1}.skill .stats .dmg_type.Pure span{color:#c29c4a}.skill .stats .dispellable.No span{color:red}.skill .stats .dispellable.Strong span{color:#9828ae}.skill .stats .bkbpierce.Yes span{color:#6add71}.skill>.description{color:#9bb1ce;margin-bottom:32px}.skill>.facet{padding-left:0;margin-bottom:16px}.skill .value{color:#fff}.skill .aghanim_description{padding:0;color:#9bb1ce;margin-bottom:16px;border:#263945 solid 3px;box-sizing:border-box}.skill .aghanim_description .title{display:block;font-size:20px;background-color:#263945;padding:12px}.skill .aghanim_description .desc{margin:12px;display:block}.skill .aghanim_description img{position:unset;transform:none;margin-right:8px}.skill .notes{padding:12px;margin-bottom:12px;color:#9fb7c6;background-color:#263945}.skill .attributes{line-height:1.2em;margin-bottom:12px}.skill .attributes .heading{color:#546780}.skill .attributes .values{color:#4b525d}.skill .attributes .values img{width:16px}.skill .attributes .facet{display:inline-flex;font-size:1em;align-items:center;line-height:1.2em;position:unset;color:#fff}.skill .attributes .facet span{height:auto;width:auto;position:unset;padding:0 2px}.skill .attributes .facet img{width:auto;height:1em;padding-right:.2em}.skill .attributes .alternative .plus{display:none}.skill .attributes .primary~.alternative .plus{display:inline}.skill .attributes .primary~.alternative:before{content:"("}.skill .attributes .primary~.alternative:after{content:")"}.skill .cooldown{padding-right:12px}.skill .cooldown:before,.skill .mana_cost:before{content:"";background-size:100%;width:21px;height:21px;display:inline-block;vertical-align:middle}.skill .cooldown:before{background-image:url(data:image/webp;base64,UklGRnABAABXRUJQVlA4TGMBAAAvE8AEEE2QTdqmkI5pRP/DS2wBEIT/bw8R/U8Ddq1NipSvGnd3eXJ3d3kmEM+GTDwBciCBTQCd7qpCeokBQdu2cc6f8tcQEBT5P9oEIGiwYuMBECqAbCUVIIAa19Py1I/AQMrJVGEABACe+DRqcl2GUxeOwIAzQkAAMCBxyi3BRcbSkzAKyIDTciQOAAgwyx43JA4CWRkeQXAAQKkGEs5+/siARwFHAHCUiAGwPwAEAGQSDgCAoCQUQc7OkwMbhgAAJBIKEAtkE9enBgcABEUxAIwyZ6cOx/lTkPiHsX+mqCQTMQRwcmAszPLUoTiCkVAAbDKEAWWUjWlGMYyEAR4n4wMeiBk8W9M1lphIQmAsmWxBJ1vfAJZIBMAoJwNQ0JTN04/yRaCCftofwWBkAMAjQ6BILaWMsEkFFVTTk/qEETyQlYFXnh9jmABKbkgzNQgemYwnTOKFEgAAOGJAeUbyhQIAAA==)}.skill .mana_cost:before{background-image:url(data:image/webp;base64,UklGRsYAAABXRUJQVlA4TLkAAAAvE8AEEIfBOIDbtEmdpEDhS8G2kSTF0eteuLOebJz/0KDREgwBAGEu/89yqe5LCyEaDT03NBcLpEXnJgkZKS2dmlqAlNSCgJXURBoNCHAY2bbSvEP0fxzi7sGh//rslRDR/xQxS0bXRkRMmr5Ho8iISY5523Ztr2vabBuaZZLVE99wRqWAUgGFAv4K+Cngo4CXAp4KeCjgroCbAi4KVv7pOnFwF8aP9+fRXeAaMZ63GbXWiIhxGJ0bEQA=)}.skill .lore{font-size:13px;color:#3e4f5b;padding:8px;line-height:1.25}body .wrapper>.lore{display:block;line-height:1.25;padding:8px;font-family:KaiTi,\6977\4f53,\6977\4f53_GB2312,STKaiti,serif;color:#aaa}
@@ -21,15 +21,7 @@
21
21
  const hasScepterVal = sv.values_scepter && sv.values_scepter.length;
22
22
  const hasShardVal = sv.values_shard && sv.values_shard.length;
23
23
  const hasTalentVal = sv.bonuses.length > 0;
24
-
25
- // 如果基础值全为0,且没有任何额外加成(A杖/魔晶/命石),则该条目其实没意义,但在原逻辑里似乎是作为空 primary 渲染?
26
- // 原逻辑:如果 (全0) 且 (有任意额外加成) -> 显示空 primary。
27
- // 如果 (全0) 且 (无额外加成) -> 这条根本不会显示?不,原逻辑里 primary 即使全0也会渲染 span,只是加了 empty class。
28
-
29
- // 让我们遵循原逻辑:
30
- // Primary 部分:除非 (全0 且 有额外加成),否则渲染数值。
31
- // 如果 (全0 且 有额外加成) -> 渲染内容为空字符串。
32
- %> <p><span class="heading"><%= sv.heading_loc %></span><span class="values"> <% if (!isAllZero || (isAllZero && (hasScepterVal || hasShardVal))) { %> <span class="primary<%= isAllZero ? ' empty' : '' %>"> <% if (!isAllZero) { %> <%= sv.values_float.map(value => value + (sv.is_percentage ? "%" : "")).join(" / ") %> <% } %> </span> <% } %> <% if (hasScepterVal) { %> <span class="alternative scepter"><img src="<%= getImageUrl("scepter") %>"/> <%- sv.values_scepter.map(value => (value > 0 ? '<span class="plus">+</span>' : "") + value + (sv.is_percentage ? "%" : "")).join(" / ") %> </span> <% } %> <% if (hasShardVal) { %> <span class="alternative shard"><img src="<%= getImageUrl("shard") %>"/> <%- sv.values_shard.map(value => (value > 0 ? '<span class="plus">+</span>' : "") + value + (sv.is_percentage ? "%" : "")).join(" / ") %> </span> <% } %> <% if (hasTalentVal) { %> <span class="alternative talent"> <% sv.bonuses.forEach(bonus => { %> <img src="<%= getImageUrl("talents", "icons", "svg") %>"/> <%- (bonus.value > 0 ? '<span class="plus">+</span>' : "") + bonus.value + (sv.is_percentage ? "%" : "") %> <% }); %> </span> <% } %> </span></p> <% }); %> </div><p> <% if (hasCd) { %> <span class="cooldown"> <%= cdStats.values_float.join(" / ") %> </span> <% } %> <% if (hasMana) { %> <span class="mana_cost"> <%= manaStats.values_float.join(" / ") %> </span> <% } %> </p> <% if (item.lore_loc) { %> <p class="lore"><%= item.lore_loc %></p> <% } %> </div> <% }); %> </div><div class="lore"> <%- hero.bio_loc %> </div></div></body><script>document.addEventListener('DOMContentLoaded', function() {
24
+ %> <% if (!isAllZero || hasScepterVal || hasShardVal || hasTalentVal) { %> <p><span class="heading"><%- sv.heading_loc %></span><span class="values"> <% if (!isAllZero || (isAllZero && (hasScepterVal || hasShardVal))) { %> <span class="primary<%= isAllZero ? ' empty' : '' %>"> <% if (!isAllZero) { %> <%= sv.values_float.map(value => value + (sv.is_percentage ? "%" : "")).join(" / ") %> <% } %> </span> <% } %> <% if (hasScepterVal) { %> <span class="alternative scepter"><img src="<%= getImageUrl("scepter") %>"/> <%- sv.values_scepter.map(value => (value > 0 ? '<span class="plus">+</span>' : "") + value + (sv.is_percentage ? "%" : "")).join(" / ") %> </span> <% } %> <% if (hasShardVal) { %> <span class="alternative shard"><img src="<%= getImageUrl("shard") %>"/> <%- sv.values_shard.map(value => (value > 0 ? '<span class="plus">+</span>' : "") + value + (sv.is_percentage ? "%" : "")).join(" / ") %> </span> <% } %> <% if (hasTalentVal) { %> <span class="alternative talent"> <% sv.bonuses.forEach(bonus => { %> <img src="<%= getImageUrl("talents", "icons", "svg") %>"/> <%- (bonus.value > 0 ? '<span class="plus">+</span>' : "") + bonus.value + (sv.is_percentage ? "%" : "") %> <% }); %> </span> <% } %> </span></p> <% } %> <% }); %> </div><p> <% if (hasCd) { %> <span class="cooldown"> <%= cdStats.values_float.join(" / ") %> </span> <% } %> <% if (hasMana) { %> <span class="mana_cost"> <%= manaStats.values_float.join(" / ") %> </span> <% } %> </p> <% if (item.lore_loc) { %> <p class="lore"><%= item.lore_loc %></p> <% } %> </div> <% }); %> </div><div class="lore"> <%- hero.bio_loc %> </div></div></body><script>document.addEventListener('DOMContentLoaded', function() {
33
25
  const items = document.querySelectorAll('.skills > .skill');
34
26
  items.forEach(item => {
35
27
  // const name = item.getAttribute('data-name');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sjtdev/koishi-plugin-dota2tracker",
3
3
  "description": "koishi插件-追踪群友的DOTA2对局 | A Koishi plugin to track Dota 2 matches",
4
- "version": "2.5.7",
4
+ "version": "2.5.9",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
@@ -24,8 +24,8 @@
24
24
  "dota2"
25
25
  ],
26
26
  "dependencies": {
27
- "axios": "^1.13.5",
28
- "dotaconstants": "^10.7.0",
27
+ "axios": "^1.14.0",
28
+ "dotaconstants": "^10.8.0",
29
29
  "ejs": "^4.0.1",
30
30
  "fontkit": "^2.0.4",
31
31
  "https-proxy-agent": "^7.0.6",