@sjtdev/koishi-plugin-dota2tracker 1.2.10 → 1.2.11-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 +5 -0
- package/lib/index.js +20 -7
- package/package.json +1 -1
- package/template/match/match_2.ejs +43 -4
package/changelog.md
CHANGED
package/lib/index.js
CHANGED
|
@@ -110,8 +110,12 @@ function MATCH_INFO(matchId) {
|
|
|
110
110
|
id
|
|
111
111
|
name
|
|
112
112
|
shortName
|
|
113
|
+
facets {
|
|
114
|
+
facetId
|
|
115
|
+
}
|
|
113
116
|
}
|
|
114
|
-
|
|
117
|
+
variant
|
|
118
|
+
dotaPlus {
|
|
115
119
|
level
|
|
116
120
|
}
|
|
117
121
|
leaverStatus
|
|
@@ -168,7 +172,6 @@ function MATCH_INFO(matchId) {
|
|
|
168
172
|
goldPerMinute
|
|
169
173
|
experiencePerMinute
|
|
170
174
|
heroHealing
|
|
171
|
-
|
|
172
175
|
stats {
|
|
173
176
|
campStack
|
|
174
177
|
heroDamageReport {
|
|
@@ -182,7 +185,7 @@ function MATCH_INFO(matchId) {
|
|
|
182
185
|
}
|
|
183
186
|
}
|
|
184
187
|
}
|
|
185
|
-
additionalUnit{
|
|
188
|
+
additionalUnit {
|
|
186
189
|
item0Id
|
|
187
190
|
item1Id
|
|
188
191
|
item2Id
|
|
@@ -194,7 +197,6 @@ function MATCH_INFO(matchId) {
|
|
|
194
197
|
backpack2Id
|
|
195
198
|
neutral0Id
|
|
196
199
|
}
|
|
197
|
-
|
|
198
200
|
isRandom
|
|
199
201
|
}
|
|
200
202
|
pickBans {
|
|
@@ -204,6 +206,13 @@ function MATCH_INFO(matchId) {
|
|
|
204
206
|
order
|
|
205
207
|
}
|
|
206
208
|
}
|
|
209
|
+
constants {
|
|
210
|
+
facets {
|
|
211
|
+
id
|
|
212
|
+
color
|
|
213
|
+
icon
|
|
214
|
+
}
|
|
215
|
+
}
|
|
207
216
|
}
|
|
208
217
|
|
|
209
218
|
`;
|
|
@@ -564,7 +573,8 @@ function getImageUrl(image, type = "local" /* Local */, format = "png" /* png */
|
|
|
564
573
|
return `https://cdn.cloudflare.steamstatic.com/apps/dota2/images/dota_react/${type}/${image}.${format}`;
|
|
565
574
|
}
|
|
566
575
|
__name(getImageUrl, "getImageUrl");
|
|
567
|
-
function getFormattedMatchData(
|
|
576
|
+
function getFormattedMatchData(data) {
|
|
577
|
+
const { match, constants } = data;
|
|
568
578
|
["radiant", "dire"].forEach((team) => {
|
|
569
579
|
match[team] = { killsCount: match[team + "Kills"]?.reduce((acc, cva) => acc + cva, 0) ?? 0, damageReceived: 0, heroDamage: 0, networth: 0, experience: 0 };
|
|
570
580
|
});
|
|
@@ -772,6 +782,9 @@ function getFormattedMatchData(match) {
|
|
|
772
782
|
}
|
|
773
783
|
}
|
|
774
784
|
}
|
|
785
|
+
if (player.variant != null) {
|
|
786
|
+
player.facet = constants.facets.find((facet) => facet.id == player.hero.facets[player.variant - 1].facetId);
|
|
787
|
+
}
|
|
775
788
|
});
|
|
776
789
|
let ComparisonMode;
|
|
777
790
|
((ComparisonMode2) => {
|
|
@@ -1383,7 +1396,7 @@ async function apply(ctx, config) {
|
|
|
1383
1396
|
match = queryLocal[0].data;
|
|
1384
1397
|
ctx.database.set("dt_previous_query_results", match.id, { queryTime: /* @__PURE__ */ new Date() });
|
|
1385
1398
|
} else {
|
|
1386
|
-
match = getFormattedMatchData((await query(MATCH_INFO(matchId))).data
|
|
1399
|
+
match = getFormattedMatchData((await query(MATCH_INFO(matchId))).data);
|
|
1387
1400
|
}
|
|
1388
1401
|
if (match && (match.parsedDateTime || import_moment.default.unix(match.endDateTime).isBefore((0, import_moment.default)().subtract(config.dataParsingTimeoutMinutes, "minutes")))) {
|
|
1389
1402
|
session.send((ctx.config.urlInMessageType.some((type) => type == "match") ? "https://stratz.com/matches/" + matchId : "") + await ctx.puppeteer.render(genImageHTML(match, config.template_match, "match" /* Match */)));
|
|
@@ -1735,7 +1748,7 @@ async function apply(ctx, config) {
|
|
|
1735
1748
|
match = queryLocal[0].data;
|
|
1736
1749
|
ctx.database.set("dt_previous_query_results", match.id, { queryTime: /* @__PURE__ */ new Date() });
|
|
1737
1750
|
} else
|
|
1738
|
-
match = getFormattedMatchData((await query(MATCH_INFO(pendingMatch.matchId))).data
|
|
1751
|
+
match = getFormattedMatchData((await query(MATCH_INFO(pendingMatch.matchId))).data);
|
|
1739
1752
|
if (match.parsedDateTime || import_moment.default.unix(match.endDateTime).isBefore(now.subtract(config.dataParsingTimeoutMinutes, "minutes"))) {
|
|
1740
1753
|
pendingMatches = pendingMatches.filter((item) => item.matchId != match.id);
|
|
1741
1754
|
const img = await ctx.puppeteer.render(genImageHTML(match, config.template_match, "match" /* Match */));
|
package/package.json
CHANGED
|
@@ -167,9 +167,9 @@
|
|
|
167
167
|
|
|
168
168
|
.player > .hero_avatar > .party_line {
|
|
169
169
|
position: absolute;
|
|
170
|
-
height:
|
|
170
|
+
height: 2px;
|
|
171
171
|
top: 0;
|
|
172
|
-
width:
|
|
172
|
+
width: 100%;
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
.player > .hero_avatar > .party_mark {
|
|
@@ -178,8 +178,8 @@
|
|
|
178
178
|
text-align: center;
|
|
179
179
|
width: 16px;
|
|
180
180
|
font-size: 10px;
|
|
181
|
-
top:
|
|
182
|
-
left:
|
|
181
|
+
top: 3px;
|
|
182
|
+
left: 1px;
|
|
183
183
|
background-color: rgba(0, 0, 0, 0.8);
|
|
184
184
|
}
|
|
185
185
|
|
|
@@ -231,6 +231,41 @@
|
|
|
231
231
|
content: "IV";
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
+
.player > .hero_avatar > .facet {
|
|
235
|
+
position: absolute;
|
|
236
|
+
left: 4px;
|
|
237
|
+
left: 0;
|
|
238
|
+
bottom: 0;
|
|
239
|
+
width: 16px;
|
|
240
|
+
height: 16px;
|
|
241
|
+
display: flex;
|
|
242
|
+
justify-content: center;
|
|
243
|
+
align-items: center;
|
|
244
|
+
z-index: 1;
|
|
245
|
+
}
|
|
246
|
+
.player > .hero_avatar > .facet > img {
|
|
247
|
+
width: 12px;
|
|
248
|
+
height: 12px;
|
|
249
|
+
}
|
|
250
|
+
.player > .hero_avatar > .facet.Red {
|
|
251
|
+
background: linear-gradient(to right, #9f3c3c, #4a2026);
|
|
252
|
+
}
|
|
253
|
+
.player > .hero_avatar > .facet.Yellow {
|
|
254
|
+
background: linear-gradient(to right, #c8a45c, #6f3d21);
|
|
255
|
+
}
|
|
256
|
+
.player > .hero_avatar > .facet.Green {
|
|
257
|
+
background: linear-gradient(to right, #a2b23e, #2d5a18);
|
|
258
|
+
}
|
|
259
|
+
.player > .hero_avatar > .facet.Blue {
|
|
260
|
+
background: linear-gradient(to right, #547ea6, #2a385e);
|
|
261
|
+
}
|
|
262
|
+
.player > .hero_avatar > .facet.Purple {
|
|
263
|
+
background: linear-gradient(to right, #675cae, #261c44);
|
|
264
|
+
}
|
|
265
|
+
.player > .hero_avatar > .facet.Gray {
|
|
266
|
+
background: linear-gradient(to right, #adb6be, #4e5557);
|
|
267
|
+
}
|
|
268
|
+
|
|
234
269
|
.player > .rank {
|
|
235
270
|
position: relative;
|
|
236
271
|
grid-row: 1 / span 3;
|
|
@@ -487,6 +522,10 @@
|
|
|
487
522
|
<div class="player ${player.team}${player.hero.id==80?" bear":""}" style="order: ${player.team==="radiant"?1:100};">
|
|
488
523
|
<div class="hero_avatar row-1${player.partyId != null ? " party_" + match.party[player.partyId] : ""}">
|
|
489
524
|
<img src="${utils.getImageUrl(player.hero.shortName, ImageType.Heroes)}" />
|
|
525
|
+
${player.facet ? `
|
|
526
|
+
<div class="facet ${player.facet.color}">
|
|
527
|
+
<img src="${utils.getImageUrl(player.facet.icon, ImageType.IconsFacets)}">
|
|
528
|
+
</div>` : ""}
|
|
490
529
|
<p class="level">${player.level}</p>
|
|
491
530
|
<p class="party_line"></p>
|
|
492
531
|
<p class="party_mark"></p>
|