@sjtdev/koishi-plugin-dota2tracker 1.2.9-pre.3 → 1.2.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 +15 -0
- package/lib/index.js +34 -11
- package/package.json +1 -1
- package/template/images/lane_fail.svg +1 -0
- package/template/images/lane_jungle.svg +1 -0
- package/template/images/lane_stomp.svg +1 -0
- package/template/images/lane_stomped.svg +1 -0
- package/template/images/lane_tie.svg +1 -0
- package/template/images/lane_victory.svg +1 -0
- package/template/match/match_1.ejs +6 -6
- package/template/player/player_1.ejs +6 -6
- package/template/report/daily.ejs +174 -0
package/changelog.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# 1.2.9
|
|
2
|
+
**改进**:
|
|
3
|
+
- 现在周报与日报改为图片版,依旧由`ejs`生成。去除配置页中周报与日报的“实验性”标识。(目前周报与日报使用同一模板,未来可能会设计数据更丰富的周报,也可能不会_(:3」∠)_
|
|
4
|
+
- 优化播报评语随机选择算法离散性,以避免此前若是有多位玩家的随机种子相近则这些玩家选择结果总是相同。
|
|
5
|
+
- 优化追踪比赛逻辑:在追踪到群友比赛后等待解析时,此前为按添加顺序等待队列中的比赛,现在修改了判断逻辑,对当前时间分钟数与等待队列的长度进行取余,周期性访问队列中每一场比赛,这样可以优先发送已解析完成的比赛而不会被早加入但迟迟未解析的比赛阻塞。
|
|
6
|
+
- 现在可在战报模板`match_1`和玩家信息模板中正确显示打野玩家的对线结果为“野区霸主”并有对应的图标,而不是跟随默认的中路对线结果。([wiki/match_1](https://github.com/sjtdev/koishi-plugin-dota2tracker/wiki/match_1)也已更新。)
|
|
7
|
+
- `查询英雄`:命石技能的技能名栏位添加对应命石图标与背景色用于标识。
|
|
8
|
+
|
|
9
|
+
**修复**:
|
|
10
|
+
- `查询英雄`:修复DOTA2 7.37版本更新后API变动导致部分英雄查询报错。
|
|
11
|
+
|
|
12
|
+
<details>
|
|
13
|
+
<summary><b>1.2.9-pre更新日志</b></summary>
|
|
14
|
+
|
|
1
15
|
### 1.2.9-pre.3
|
|
2
16
|
**改进**:
|
|
3
17
|
- 尝试修改逻辑:在追踪到群友比赛后等待解析时,此前为按添加顺序等待队列中的比赛,现在修改了判断逻辑,对当前时间分钟数与等待队列的长度进行取余,周期性访问队列中每一场比赛,这样可以优先发送已解析完成的比赛而不会被早加入但迟迟未解析的比赛阻塞。
|
|
@@ -10,6 +24,7 @@
|
|
|
10
24
|
**修复&改进**:
|
|
11
25
|
- `查询英雄`:尝试修复DOTA2 7.37版本更新后API变动导致部分英雄查询报错。
|
|
12
26
|
- `查询英雄`:命石技能的技能名栏位添加对应命石图标与背景色用于标识。
|
|
27
|
+
</details>
|
|
13
28
|
|
|
14
29
|
# 1.2.8
|
|
15
30
|
**新增**:
|
package/lib/index.js
CHANGED
|
@@ -213,7 +213,7 @@ function MATCHES_FOR_DAILY(steamAccountIds, seconds) {
|
|
|
213
213
|
return `
|
|
214
214
|
{
|
|
215
215
|
players(steamAccountIds:${JSON.stringify(steamAccountIds)}) {
|
|
216
|
-
steamAccount{id name}
|
|
216
|
+
steamAccount{id name avatar}
|
|
217
217
|
matches(request:{startDateTime:${seconds} take:50}){
|
|
218
218
|
id
|
|
219
219
|
didRadiantWin
|
|
@@ -551,6 +551,8 @@ var ImageFormat = /* @__PURE__ */ ((ImageFormat2) => {
|
|
|
551
551
|
function getImageUrl(image, type = "local" /* Local */, format = "png" /* png */) {
|
|
552
552
|
if (type === "local" /* Local */) {
|
|
553
553
|
try {
|
|
554
|
+
if (format === "svg" /* svg */)
|
|
555
|
+
return import_fs.default.readFileSync(`./node_modules/@sjtdev/koishi-plugin-dota2tracker/template/images/${image}.svg`);
|
|
554
556
|
const imageData = import_fs.default.readFileSync(`./node_modules/@sjtdev/koishi-plugin-dota2tracker/template/images/${image}.png`);
|
|
555
557
|
const base64Data = imageData.toString("base64");
|
|
556
558
|
return `data:image/png;base64,${base64Data}`;
|
|
@@ -1553,6 +1555,8 @@ async function apply(ctx, config) {
|
|
|
1553
1555
|
const svs = ab.special_values.filter((sv) => sv.facet_bonus.name === facet.name);
|
|
1554
1556
|
svs.forEach((sv) => {
|
|
1555
1557
|
if (sv.heading_loc) {
|
|
1558
|
+
if (!facet.abilities)
|
|
1559
|
+
facet.abilities = [];
|
|
1556
1560
|
facet.abilities.find((ability) => ab.id == ability.id)?.attributes.push({ heading_loc: sv.heading_loc, values: [...sv.facet_bonus.values], is_percentage: sv.is_percentage });
|
|
1557
1561
|
}
|
|
1558
1562
|
});
|
|
@@ -1739,7 +1743,7 @@ async function apply(ctx, config) {
|
|
|
1739
1743
|
let idsToFind = commingGuild.players.map((player) => player.steamId);
|
|
1740
1744
|
let broadPlayers = match.players.filter((item) => idsToFind.includes(item.steamAccountId));
|
|
1741
1745
|
for (let player of broadPlayers) {
|
|
1742
|
-
const random2 = new import_koishi2.Random(() =>
|
|
1746
|
+
const random2 = new import_koishi2.Random(() => enhancedSimpleHashToSeed(`${match.id}-${player.steamAccountId}-${player.playerSlot}`));
|
|
1743
1747
|
let broadPlayerMessage = `${player.steamAccount.name}的${random2.pick(HEROES_CHINESE[player.hero.id])}`;
|
|
1744
1748
|
if (player.isRadiant == match.didRadiantWin) {
|
|
1745
1749
|
if (player.deathContribution < 0.2 || player.killContribution > 0.75 || player.heroDamage / player.networth > 1.5 || player.towerDamage > 1e4 || player.imp > 0)
|
|
@@ -1830,13 +1834,27 @@ KDA:${((player.kills + player.assists) / (player.deaths || 1)).toFixed(2)} [${
|
|
|
1830
1834
|
try {
|
|
1831
1835
|
await ctx.broadcast(
|
|
1832
1836
|
[`${guild.platform}:${guild.guildId}`],
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1837
|
+
await ctx.puppeteer.render(
|
|
1838
|
+
genImageHTML(
|
|
1839
|
+
{
|
|
1840
|
+
title,
|
|
1841
|
+
players: currentsubscribedPlayers.sort((a, b) => {
|
|
1842
|
+
if (a.matches.length > b.matches.length)
|
|
1843
|
+
return -1;
|
|
1844
|
+
else if (a.matches.length < b.matches.length)
|
|
1845
|
+
return 1;
|
|
1846
|
+
else
|
|
1847
|
+
return a.steamAccount.id - b.steamAccount.id;
|
|
1848
|
+
}),
|
|
1849
|
+
combinations,
|
|
1850
|
+
showCombi
|
|
1851
|
+
},
|
|
1852
|
+
"daily",
|
|
1853
|
+
"report" /* Report */
|
|
1854
|
+
)
|
|
1855
|
+
)
|
|
1838
1856
|
);
|
|
1839
|
-
ctx.logger.info(
|
|
1857
|
+
ctx.logger.info(`发布${title}于${guild.platform}:${guild.guildId}`);
|
|
1840
1858
|
} catch (error) {
|
|
1841
1859
|
ctx.logger.error(error);
|
|
1842
1860
|
}
|
|
@@ -1854,6 +1872,7 @@ function genImageHTML(data, template, type) {
|
|
|
1854
1872
|
data,
|
|
1855
1873
|
utils: utils_exports,
|
|
1856
1874
|
ImageType,
|
|
1875
|
+
ImageFormat,
|
|
1857
1876
|
d2a: dotaconstants_add_exports,
|
|
1858
1877
|
dotaconstants: dotaconstants3,
|
|
1859
1878
|
moment: import_moment.default
|
|
@@ -1870,15 +1889,19 @@ function genImageHTML(data, template, type) {
|
|
|
1870
1889
|
return result;
|
|
1871
1890
|
}
|
|
1872
1891
|
__name(genImageHTML, "genImageHTML");
|
|
1873
|
-
function
|
|
1892
|
+
function enhancedSimpleHashToSeed(inputString) {
|
|
1874
1893
|
const encoded = btoa(inputString);
|
|
1875
1894
|
let total = 0;
|
|
1895
|
+
let complexFactor = 1;
|
|
1876
1896
|
for (let i = 0; i < encoded.length; i++) {
|
|
1877
|
-
total += encoded.charCodeAt(i);
|
|
1897
|
+
total += encoded.charCodeAt(i) * complexFactor;
|
|
1898
|
+
complexFactor++;
|
|
1899
|
+
total %= 9973;
|
|
1878
1900
|
}
|
|
1901
|
+
total = total % 9973 * (total % 9973) % 9973;
|
|
1879
1902
|
return total % 1e3 / 1e3;
|
|
1880
1903
|
}
|
|
1881
|
-
__name(
|
|
1904
|
+
__name(enhancedSimpleHashToSeed, "enhancedSimpleHashToSeed");
|
|
1882
1905
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1883
1906
|
0 && (module.exports = {
|
|
1884
1907
|
Config,
|
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg viewBox="0 0 36 36"><path fill="#ff6961" d="M36 32a4 4 0 0 1-4 4H4a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4h28a4 4 0 0 1 4 4v28z"></path><circle fill="#FFF" cx="27" cy="7" r="3"></circle><path fill="#FFF" d="M13.06 13.06l2.367-2.366l3.859 1.158l-2.635 2.847a10.018 10.018 0 0 1 4.392 3.379l5.017-5.017a1.5 1.5 0 0 0-.63-2.497l-9.999-3a1.495 1.495 0 0 0-1.492.376l-3 3a1.5 1.5 0 1 0 2.121 2.12zm16.065 4.949a1.496 1.496 0 0 0-1.262-.503l-6.786.617a9.966 9.966 0 0 1 1.464 2.879l3.548-.322l-1.554 6.995a1.499 1.499 0 1 0 2.928.65l2-9a1.5 1.5 0 0 0-.338-1.316zM13 16a8 8 0 1 0 0 16a8 8 0 0 0 0-16zm0 14a6 6 0 1 1 .002-12.002A6 6 0 0 1 13 30z"></path></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg fill="#fff" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 395 395" xml:space="preserve"><g><path d="M313.002,0H82C36.785,0,0,36.784,0,81.998v230.993C0,358.211,36.785,395,82,395h231.002 C358.216,395,395,358.211,395,312.991V81.998C395,36.784,358.216,0,313.002,0z M380,312.991C380,349.94,349.944,380,313.002,380H82 c-36.944,0-67-30.06-67-67.009V81.998C15,45.055,45.056,15,82,15h231.002C349.944,15,380,45.055,380,81.998V312.991z"/><path d="M305.336,107.5c-21.492,0-38.915,17.422-38.915,38.912c0,21.495,17.423,38.915,38.915,38.915 c21.49,0,38.911-17.42,38.911-38.915C344.247,124.922,326.826,107.5,305.336,107.5z"/><path d="M309.227,186.313c-10.602,0-21.818,7.267-21.818,7.267l-20.557-20.553c-2.876-2.876-3.857-3.915-6.746-3.915H145.701 H65.539v-0.193c0-2.149-1.742-3.891-3.892-3.891c-2.149,0-3.892,1.742-3.892,3.891v0.193h-7.003c-4.298,0-7.782,3.484-7.782,7.783 c0,4.298,3.484,7.783,7.782,7.783h87.166v9.081c0,4.298,3.484,7.783,7.782,7.783h36.863c-0.523,5.762,2.184,11.588,7.477,14.765 l53.325,31.996c2.468,1.48,5.238,2.218,8.009,2.218c2.905,0,5.809-0.813,8.355-2.433l14.475-9.209V287.5h70.042v-66.164 C344.247,201.992,328.567,186.313,309.227,186.313z M251.135,216.658L225.94,201.54h26.137l8.872,8.873L251.135,216.658z"/><path d="M167.491,165.612h45.528c4.298,0,7.782-3.484,7.782-7.783s-3.484-7.783-7.782-7.783h-45.528 c-4.298,0-7.782,3.484-7.782,7.783S163.193,165.612,167.491,165.612z"/></g></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg viewBox="0 0 24 24" class="hitagi__sc-1apuy4g-0 hmhZOG"><path d="M8.05731 22.3674L9.60454 22.8002L11.5974 21.6551L12.043 20.0773L13.5902 20.51L15.583 19.3649L16.0287 17.7871L17.5759 18.2199L19.5687 17.0748L20.0143 15.4969L21.5615 15.9297L23.5544 14.7846L24 13.2068L23.4492 12.2014L7.50651 21.3621L8.05731 22.3674ZM12.1328 3.50265L11.0312 1.49196C10.8798 1.21549 10.5316 1.11811 10.2576 1.27556L0.29345 7.00098C0.0194354 7.15843 -0.0808273 7.51346 0.0706444 7.78993L1.44766 10.3033L11.91 4.29159C12.184 4.13414 12.2843 3.77912 12.1328 3.50265ZM18.3935 8.4063L14.1658 9.60458L12.4221 10.6065C12.2851 10.6853 12.111 10.6366 12.0353 10.4983L11.7599 9.99565C11.6842 9.85742 11.7343 9.6799 11.8713 9.60118L13.615 8.59924L13.0642 7.59389L11.3205 8.59584C11.1835 8.67456 11.0094 8.62587 10.9337 8.48765L10.6583 7.98497C10.5826 7.84673 10.6327 7.66922 10.7697 7.5905L12.5134 6.58855L11.9626 5.58321L1.99846 11.3086L6.9557 20.3567L22.8984 11.196L22.2615 10.0336C21.5024 8.64813 19.9073 7.97847 18.3935 8.4063Z"></path></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg viewBox="-1 0 19 19"><path d="M16.417 9.579A7.917 7.917 0 1 1 8.5 1.662a7.917 7.917 0 0 1 7.917 7.917zm-2.458 2.96a.396.396 0 0 0-.396-.397h-.667a1.527 1.527 0 0 0-1.249-1.114.777.777 0 0 0 .014-.145V9.378a.794.794 0 0 0-.792-.792H8.201a2.984 2.984 0 0 0-1.682-.516l-.11.002V7.42h2.997a.396.396 0 1 0 0-.792H6.41v-1.3a.396.396 0 0 0-.396-.397H4.891a.396.396 0 0 0 0 .792h.727V8.21a2.997 2.997 0 1 0 3.836 3.466h.71a1.526 1.526 0 1 0 2.732 1.26h.667a.396.396 0 0 0 .396-.397zM8.078 9.507a2.205 2.205 0 1 1-1.559-.646 2.19 2.19 0 0 1 1.559.646zm4.078 3.03a.734.734 0 1 1-.733-.734.735.735 0 0 1 .733.733z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg fill="#fff" viewBox="0 0 512.001 512.001"><g><g><path d="M120.988,239.868c-4.496,10.625-5.122,20.183-5.157,20.811c-0.267,4.607,3.243,8.547,7.849,8.829 c4.618,0.29,8.574-3.228,8.873-7.833c0.265-4.771,2.339-13.092,5.884-19.44C137.421,242.113,141.397,242.649,120.988,239.868z"/></g></g><g><g><path d="M391.178,255.418c-0.211,8.054-2.458,17.62-6.74,28.398c-1.708,4.299,0.393,9.168,4.692,10.875 c4.293,1.708,9.167-0.39,10.875-4.692c5.103-12.842,7.74-24.392,7.943-34.581H391.178z"/></g></g><g><g><path d="M164.769,210.51c1.046,3.339,1.397,6.953,0.893,10.65c-0.293,2.146-0.857,4.188-1.648,6.1c0,0,51.266,3.416,198.065,3.949 c-0.086-6.331,2.19-12.199,6.244-16.732C217.627,214.046,164.769,210.51,164.769,210.51z"/></g></g><g><g><circle cx="37.179" cy="128.669" r="29.491"/></g></g><g><g><path d="M510.146,391.511l-37.916-66.985c14.35-49.173,20.678-68.137,20.678-68.137l8.949-67.014 c1.502-10.977-6.248-21.075-17.235-22.468l-18.183-2.305c-10.984-1.393-20.996,6.445-22.293,17.431l-1.884,15.955l28.718-21.317 l-37.91,42.278h-46.432c-6.571,0-11.898,5.328-11.898,11.898c0,6.57,5.328,11.898,11.898,11.898h51.744 c3.381,0,6.601-1.438,8.859-3.956l41.456-46.234l-32.023,54.694c-5.28,9.018-14.374,8.169-18.293,8.167c-1.959,0-3.31,0-5.295,0 c-0.399,0.898,3.152-7.399-24.44,57.181c-0.548,1.284-0.907,2.642-1.06,4.031l-8.934,80.338 c-0.939,8.447,5.667,15.857,14.208,15.857c7.179,0,13.361-5.401,14.172-12.701l8.702-78.244l21.512-50.353l-14.121,50.463 c-1.158,3.756-0.718,7.823,1.218,11.243l40.949,72.345c3.885,6.864,12.596,9.276,19.459,5.392 C511.615,407.085,514.03,398.373,510.146,391.511z"/></g></g><g><g><circle cx="464.865" cy="128.702" r="29.491"/></g></g><g><g><path d="M142.923,206.051l-59.556-8.118l-39.135-18.451l13.626,2.292c-1.422-10.945-11.411-18.577-22.254-17.202l-18.182,2.305 C6.43,168.271-1.315,178.374,0.186,189.345l9.12,68.689l21.865,70.857l5.829,70.795c0.646,7.848,7.527,13.705,15.401,13.057 c7.859-0.647,13.705-7.542,13.058-15.401l-5.956-72.345c-0.084-1.031-0.281-2.05-0.585-3.039l-14.123-50.463l21.514,50.353 l8.702,78.244c0.873,7.86,7.96,13.486,15.768,12.612c7.838-0.871,13.483-7.931,12.612-15.768l-8.934-80.338 c-0.154-1.388-0.511-2.747-1.06-4.032l-27.336-61.43l-2.945-24.951l-29.029-25.179l40.79,19.231 c1.097,0.517,2.266,0.862,3.468,1.027l61.369,8.365c6.521,0.887,12.509-3.68,13.396-10.183 C153.994,212.936,149.435,206.939,142.923,206.051z"/></g></g></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg viewBox="0 0 512 512"><path d="M198.844 64.75c-.985 0-1.974.03-2.97.094-15.915 1.015-32.046 11.534-37.78 26.937-34.072 91.532-51.085 128.865-61.5 222.876 14.633 13.49 31.63 26.45 50.25 38.125l66.406-196.467 17.688 5.968L163.28 362.5c19.51 10.877 40.43 20.234 62 27.28l75.407-201.53 17.5 6.53-74.937 200.282c19.454 5.096 39.205 8.2 58.78 8.875L381.345 225.5l17.094 7.594-75.875 170.656c21.82-1.237 43.205-5.768 63.437-14.28 43.317-53.844 72.633-109.784 84.5-172.69 5.092-26.992-14.762-53.124-54.22-54.81l-6.155-.282-2.188-5.75c-8.45-22.388-19.75-30.093-31.5-32.47-11.75-2.376-25.267 1.535-35.468 7.376l-13.064 7.47-.906-15c-.99-16.396-10.343-29.597-24.313-35.626-13.97-6.03-33.064-5.232-54.812 9.906l-10.438 7.25-3.812-12.125c-6.517-20.766-20.007-27.985-34.78-27.97zM103.28 188.344C71.143 233.448 47.728 299.56 51.407 359.656c27.54 21.84 54.61 33.693 80.063 35.438 14.155.97 27.94-1.085 41.405-6.438-35.445-17.235-67.36-39.533-92.594-63.53l-3.343-3.157.5-4.595c5.794-54.638 13.946-91.5 25.844-129.03z"/></svg>
|
|
@@ -682,12 +682,12 @@
|
|
|
682
682
|
};
|
|
683
683
|
// 对线结果的图标(来自免费SVG素材网)
|
|
684
684
|
const laneSVG = {
|
|
685
|
-
stomp:
|
|
686
|
-
victory:
|
|
687
|
-
fail:
|
|
688
|
-
stomped:
|
|
689
|
-
tie:
|
|
690
|
-
jungle:
|
|
685
|
+
stomp: utils.getImageUrl("lane_stomp", undefined, ImageFormat.svg),
|
|
686
|
+
victory: utils.getImageUrl("lane_victory", undefined, ImageFormat.svg),
|
|
687
|
+
fail: utils.getImageUrl("lane_fail", undefined, ImageFormat.svg),
|
|
688
|
+
stomped: utils.getImageUrl("lane_stomped", undefined, ImageFormat.svg),
|
|
689
|
+
tie: utils.getImageUrl("lane_tie", undefined, ImageFormat.svg),
|
|
690
|
+
jungle: utils.getImageUrl("lane_jungle", undefined, ImageFormat.svg),
|
|
691
691
|
};
|
|
692
692
|
%>
|
|
693
693
|
<div class="wrapper">
|
|
@@ -307,12 +307,12 @@
|
|
|
307
307
|
}
|
|
308
308
|
};
|
|
309
309
|
const laneSVG = {
|
|
310
|
-
stomp:
|
|
311
|
-
victory:
|
|
312
|
-
fail:
|
|
313
|
-
stomped:
|
|
314
|
-
tie:
|
|
315
|
-
jungle:
|
|
310
|
+
stomp: utils.getImageUrl("lane_stomp", undefined, ImageFormat.svg),
|
|
311
|
+
victory: utils.getImageUrl("lane_victory", undefined, ImageFormat.svg),
|
|
312
|
+
fail: utils.getImageUrl("lane_fail", undefined, ImageFormat.svg),
|
|
313
|
+
stomped: utils.getImageUrl("lane_stomped", undefined, ImageFormat.svg),
|
|
314
|
+
tie: utils.getImageUrl("lane_tie", undefined, ImageFormat.svg),
|
|
315
|
+
jungle: utils.getImageUrl("lane_jungle", undefined, ImageFormat.svg),
|
|
316
316
|
};
|
|
317
317
|
const outcomeCounts = {
|
|
318
318
|
victory: 0,
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css" />
|
|
7
|
+
<title>Document</title>
|
|
8
|
+
<style>
|
|
9
|
+
html,
|
|
10
|
+
body {
|
|
11
|
+
background-color: black;
|
|
12
|
+
color: white;
|
|
13
|
+
width: 600px;
|
|
14
|
+
font-size: 14px;
|
|
15
|
+
}
|
|
16
|
+
body > * {
|
|
17
|
+
width: 100%;
|
|
18
|
+
border: 1px #fff solid;
|
|
19
|
+
border-radius: 5px;
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
}
|
|
22
|
+
img {
|
|
23
|
+
vertical-align: middle;
|
|
24
|
+
}
|
|
25
|
+
span {
|
|
26
|
+
min-width: 0;
|
|
27
|
+
white-space: nowrap; /* 不换行 */
|
|
28
|
+
overflow: hidden; /* 超出部分隐藏 */
|
|
29
|
+
text-overflow: ellipsis; /* 省略号 */
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.title {
|
|
33
|
+
margin: 0;
|
|
34
|
+
}
|
|
35
|
+
.players {
|
|
36
|
+
display: grid;
|
|
37
|
+
}
|
|
38
|
+
.player {
|
|
39
|
+
display: grid;
|
|
40
|
+
grid-template-columns: 24px 120px 128px 88px 160px;
|
|
41
|
+
grid-template-rows: 1fr;
|
|
42
|
+
width: 100%;
|
|
43
|
+
height: 24px;
|
|
44
|
+
align-items: center;
|
|
45
|
+
justify-items: center;
|
|
46
|
+
justify-content: space-between;
|
|
47
|
+
}
|
|
48
|
+
.avatar {
|
|
49
|
+
width: 24px;
|
|
50
|
+
height: 24px;
|
|
51
|
+
border-radius: 50%;
|
|
52
|
+
border: #fff 1px solid;
|
|
53
|
+
box-sizing: border-box;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.player > .name {
|
|
57
|
+
display: block;
|
|
58
|
+
width: 100%;
|
|
59
|
+
text-align: center;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.player > .performance {
|
|
63
|
+
display: flex;
|
|
64
|
+
align-items: center;
|
|
65
|
+
}
|
|
66
|
+
.player > .performance > .score_bar {
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
justify-content: center;
|
|
70
|
+
height: 10px;
|
|
71
|
+
width: 51px;
|
|
72
|
+
border-radius: 1px;
|
|
73
|
+
background-color: #333;
|
|
74
|
+
}
|
|
75
|
+
.player > .performance > .score_bar > * {
|
|
76
|
+
height: 100%;
|
|
77
|
+
}
|
|
78
|
+
.player > .performance > .score_bar.neg.over {
|
|
79
|
+
justify-content: flex-start;
|
|
80
|
+
}
|
|
81
|
+
.player > .performance > .score_bar.pos.over {
|
|
82
|
+
justify-content: flex-end;
|
|
83
|
+
}
|
|
84
|
+
.player > .performance > .score_bar.neg > .left {
|
|
85
|
+
background: linear-gradient(to right, #777, #888, #999, #888, #777);
|
|
86
|
+
}
|
|
87
|
+
.player > .performance > .score_bar.pos > .right {
|
|
88
|
+
background: linear-gradient(to right, #6cf, #7df, #6cf);
|
|
89
|
+
}
|
|
90
|
+
.player > .performance > .score_bar > .pipe {
|
|
91
|
+
height: 12px;
|
|
92
|
+
width: 1px;
|
|
93
|
+
background-color: #fff;
|
|
94
|
+
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
|
|
95
|
+
position: relative;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.player > .performance > .score_value {
|
|
99
|
+
display: block;
|
|
100
|
+
margin-left: 4px;
|
|
101
|
+
width: 28px;
|
|
102
|
+
text-align: center;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.combinations {
|
|
106
|
+
display: grid;
|
|
107
|
+
grid-template-columns: repeat(4, auto);
|
|
108
|
+
justify-content: start;
|
|
109
|
+
align-items: center;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.combinations > .players {
|
|
113
|
+
display: flex;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.combinations span:not(:first-child) {
|
|
117
|
+
margin-left: 4px;
|
|
118
|
+
}
|
|
119
|
+
span.win {
|
|
120
|
+
color: #006400;
|
|
121
|
+
}
|
|
122
|
+
span.lose {
|
|
123
|
+
color: #8b0000;
|
|
124
|
+
}
|
|
125
|
+
</style>
|
|
126
|
+
</head>
|
|
127
|
+
<body>
|
|
128
|
+
<% const { title, players, combinations, showCombi } = data; %>
|
|
129
|
+
<h3 class="title"><%= title %></h3>
|
|
130
|
+
<div class="players">
|
|
131
|
+
<% for( let index = 0; index < players.length; index++ ) { const player = players[index]; %>
|
|
132
|
+
<div class="player">
|
|
133
|
+
<img src="<%= player.steamAccount.avatar %>" class="avatar" />
|
|
134
|
+
<span class="name"><%= player.name %></span>
|
|
135
|
+
<span class="count">
|
|
136
|
+
<span class="win">胜<%= player.winCount %></span>
|
|
137
|
+
<span class="lose">负<%= player.loseCount %></span>
|
|
138
|
+
<span>胜率<%= Math.round((player.winCount / player.matches.length) * 100) %>%</span>
|
|
139
|
+
</span>
|
|
140
|
+
<div class="performance">
|
|
141
|
+
<% const imp = {sign : "", left : 0, right : 0} %>
|
|
142
|
+
<% if (player.avgImp > 0) imp.sign = "+"; %>
|
|
143
|
+
<% if (player.avgImp < 0) imp.sign = "-"; %>
|
|
144
|
+
<% if (Math.abs(player.avgImp) > 25) { %>
|
|
145
|
+
<% imp.isOver = true; %>
|
|
146
|
+
<% if (player.avgImp > 0) imp.right = player.avgImp; %>
|
|
147
|
+
<% if (player.avgImp < 0) imp.left = player.avgImp; %>
|
|
148
|
+
<% } else imp.left = imp.right = player.avgImp; %>
|
|
149
|
+
<div class="score_bar<%= Math.abs(player.avgImp) > 0 ? " pos" : " neg" %><%= Math.abs(player.avgImp) > 25 ? " over" : "" %>">
|
|
150
|
+
<div class="left" style="width: <%= imp.left %>px"></div>
|
|
151
|
+
<div class="pipe"></div>
|
|
152
|
+
<div class="right" style="width: <%= imp.right %>px"></div>
|
|
153
|
+
</div>
|
|
154
|
+
<span class="score_value"><%= `${player.avgImp > 0 ? imp.sign : ""}${player.avgImp}` %></span>
|
|
155
|
+
</div>
|
|
156
|
+
<span class="kda"><%= `${player.avgKills}/${player.avgDeaths}/${player.avgAssists} (${player.avgKDA})` %></span>
|
|
157
|
+
</div>
|
|
158
|
+
<% } %>
|
|
159
|
+
</div>
|
|
160
|
+
<div class="combinations"<%= !showCombi ? ` style="display:none;"` : "" %>>
|
|
161
|
+
<span style="grid-column: 1/-1">组合胜负情况:</span>
|
|
162
|
+
<% combinations.forEach((combi) => {%>
|
|
163
|
+
<div class="players">
|
|
164
|
+
<% combi.players.forEach(player => {%>
|
|
165
|
+
<img src="<%= player.steamAccount.avatar %>" class="avatar" />
|
|
166
|
+
<% }); %>
|
|
167
|
+
</div>
|
|
168
|
+
<span class="win">胜<%= combi.winCount %></span>
|
|
169
|
+
<span class="lose">负<%= combi.matches.length - combi.winCount %></span>
|
|
170
|
+
<span>胜率<%= Math.round((combi.winCount / combi.matches.length) * 100) %>%</span>
|
|
171
|
+
<% }); %>
|
|
172
|
+
</div>
|
|
173
|
+
</body>
|
|
174
|
+
</html>
|