@sjtdev/koishi-plugin-dota2tracker 2.2.2 → 2.3.0

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.
Files changed (106) hide show
  1. package/changelog.md +32 -0
  2. package/dist/index.js +1 -1
  3. package/lib/index.js +128 -94
  4. package/{queries → lib/queries}/MatchInfo.graphql +13 -0
  5. package/lib/templates/common/components/building_icons.ejs +20 -0
  6. package/lib/templates/common/styles/normalize.min.css +1 -0
  7. package/lib/templates/hero/hero_1.ejs +69 -0
  8. package/lib/templates/images/7.38_simple_minimap.png +0 -0
  9. package/lib/templates/item/item/recipe.ejs +9 -0
  10. package/lib/templates/item/item/style.css +1 -0
  11. package/lib/templates/item/item.ejs +52 -0
  12. package/lib/templates/item/itemlist.ejs +11 -0
  13. package/lib/templates/match/match_1/base.css +1 -0
  14. package/lib/templates/match/match_1/item.ejs +1 -0
  15. package/lib/templates/match/match_1/main.ejs +8 -0
  16. package/lib/templates/match/match_1/player.ejs +1 -0
  17. package/lib/templates/match/match_1/style.css +1 -0
  18. package/lib/templates/match/match_1.ejs +18 -0
  19. package/lib/templates/match/match_2/original.css +1 -0
  20. package/lib/templates/match/match_2/original.ejs +10 -0
  21. package/lib/templates/match/match_2+/charts.ejs +1 -0
  22. package/lib/templates/match/match_2+/extra.css +1 -0
  23. package/lib/templates/match/match_2+/lane_outcome.ejs +56 -0
  24. package/lib/templates/match/match_2+/map.ejs +160 -0
  25. package/lib/templates/match/match_2+.ejs +1 -0
  26. package/lib/templates/match/match_2.ejs +1 -0
  27. package/lib/templates/player/player_1/base.css +1 -0
  28. package/lib/templates/player/player_1/private.ejs +1 -0
  29. package/lib/templates/player/player_1.ejs +78 -0
  30. package/lib/templates/rank/rank_fun.ejs +1 -0
  31. package/lib/templates/report/daily/base.css +1 -0
  32. package/lib/templates/report/daily.ejs +29 -0
  33. package/package.json +2 -2
  34. package/template/hero/hero_1.ejs +0 -900
  35. package/template/item/item/recipe.ejs +0 -51
  36. package/template/item/item/style.css +0 -244
  37. package/template/item/item.ejs +0 -140
  38. package/template/item/itemlist.ejs +0 -99
  39. package/template/match/match_1/item.ejs +0 -11
  40. package/template/match/match_1/main.ejs +0 -37
  41. package/template/match/match_1/player.ejs +0 -154
  42. package/template/match/match_1/style.css +0 -764
  43. package/template/match/match_1.ejs +0 -56
  44. package/template/match/match_2/original.css +0 -463
  45. package/template/match/match_2/original.ejs +0 -192
  46. package/template/match/match_2+/charts.ejs +0 -261
  47. package/template/match/match_2+/extra.css +0 -143
  48. package/template/match/match_2+/lane_outcome.ejs +0 -157
  49. package/template/match/match_2+.ejs +0 -27
  50. package/template/match/match_2.ejs +0 -18
  51. package/template/player/player_1/private.ejs +0 -5
  52. package/template/player/player_1.ejs +0 -654
  53. package/template/rank/rank_fun.ejs +0 -131
  54. package/template/report/daily.ejs +0 -191
  55. /package/{queries → lib/queries}/Constants.graphql +0 -0
  56. /package/{queries → lib/queries}/GetWeeklyMetaByPosition.graphql +0 -0
  57. /package/{queries → lib/queries}/PlayerExtraInfo.graphql +0 -0
  58. /package/{queries → lib/queries}/PlayerInfoWith25Matches.graphql +0 -0
  59. /package/{queries → lib/queries}/PlayerPerformanceForHeroRecommendation.graphql +0 -0
  60. /package/{queries → lib/queries}/PlayersInfoWith10MatchesForGuild.graphql +0 -0
  61. /package/{queries → lib/queries}/PlayersLastmatchRankinfo.graphql +0 -0
  62. /package/{queries → lib/queries}/PlayersMatchesForDaily.graphql +0 -0
  63. /package/{queries → lib/queries}/RequestMatchDataAnalysis.graphql +0 -0
  64. /package/{queries → lib/queries}/VerifyingPlayer.graphql +0 -0
  65. /package/{template → lib/templates}/images/bei.jpg +0 -0
  66. /package/{template → lib/templates}/images/disconnected.png +0 -0
  67. /package/{template → lib/templates}/images/flag_dire.png +0 -0
  68. /package/{template → lib/templates}/images/flag_radiant.png +0 -0
  69. /package/{template → lib/templates}/images/hero_badge_1.png +0 -0
  70. /package/{template → lib/templates}/images/hero_badge_2.png +0 -0
  71. /package/{template → lib/templates}/images/hero_badge_3.png +0 -0
  72. /package/{template → lib/templates}/images/hero_badge_4.png +0 -0
  73. /package/{template → lib/templates}/images/hero_badge_5.png +0 -0
  74. /package/{template → lib/templates}/images/hero_badge_6.png +0 -0
  75. /package/{template → lib/templates}/images/lane_fail.svg +0 -0
  76. /package/{template → lib/templates}/images/lane_jungle.svg +0 -0
  77. /package/{template → lib/templates}/images/lane_stomp.svg +0 -0
  78. /package/{template → lib/templates}/images/lane_stomped.svg +0 -0
  79. /package/{template → lib/templates}/images/lane_tie.svg +0 -0
  80. /package/{template → lib/templates}/images/lane_victory.svg +0 -0
  81. /package/{template → lib/templates}/images/logo_dire.png +0 -0
  82. /package/{template → lib/templates}/images/logo_radiant.png +0 -0
  83. /package/{template → lib/templates}/images/medal_0.png +0 -0
  84. /package/{template → lib/templates}/images/medal_1.png +0 -0
  85. /package/{template → lib/templates}/images/medal_2.png +0 -0
  86. /package/{template → lib/templates}/images/medal_3.png +0 -0
  87. /package/{template → lib/templates}/images/medal_4.png +0 -0
  88. /package/{template → lib/templates}/images/medal_5.png +0 -0
  89. /package/{template → lib/templates}/images/medal_6.png +0 -0
  90. /package/{template → lib/templates}/images/medal_7.png +0 -0
  91. /package/{template → lib/templates}/images/medal_8.png +0 -0
  92. /package/{template → lib/templates}/images/medal_8b.png +0 -0
  93. /package/{template → lib/templates}/images/medal_8c.png +0 -0
  94. /package/{template → lib/templates}/images/scepter.png +0 -0
  95. /package/{template → lib/templates}/images/scepter_0.png +0 -0
  96. /package/{template → lib/templates}/images/scepter_1.png +0 -0
  97. /package/{template → lib/templates}/images/shard.png +0 -0
  98. /package/{template → lib/templates}/images/shard_0.png +0 -0
  99. /package/{template → lib/templates}/images/shard_1.png +0 -0
  100. /package/{template → lib/templates}/images/star_0.png +0 -0
  101. /package/{template → lib/templates}/images/star_1.png +0 -0
  102. /package/{template → lib/templates}/images/star_2.png +0 -0
  103. /package/{template → lib/templates}/images/star_3.png +0 -0
  104. /package/{template → lib/templates}/images/star_4.png +0 -0
  105. /package/{template → lib/templates}/images/star_5.png +0 -0
  106. /package/{template → lib/templates}/images/xi.jpg +0 -0
@@ -1,131 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>Document</title>
7
- <style>
8
- * {
9
- margin: 0;
10
- padding: 0;
11
- }
12
- html {
13
- width: 1024px;
14
- height: 768px;
15
- }
16
- body {
17
- background: no-repeat center center / cover;
18
- }
19
- .wrapper {
20
- padding: 80px;
21
- padding-top: 180px;
22
- }
23
- .wrapper > p {
24
- font-size: 32px;
25
- line-height: 48px;
26
- height: 48px;
27
- text-align: center;
28
- }
29
- body.xi p.bei,
30
- body.bei p.xi {
31
- display: none;
32
- }
33
- .wrapper > p > span {
34
- margin: 0 10px;
35
- }
36
- .wrapper > p > span.prev {
37
- color: gray;
38
- }
39
- .wrapper > p > span.curr {
40
- font-weight: bold;
41
- color: red;
42
- }
43
-
44
- .wrapper > p > img {
45
- width: 48px;
46
- height: 48px;
47
- vertical-align: middle;
48
- line-height: 48px;
49
- }
50
-
51
- .ranks {
52
- margin-top: 40px;
53
- display: flex;
54
- width: 100%;
55
- height: 256px;
56
- justify-content: space-evenly;
57
- }
58
-
59
- div.rank {
60
- position: relative;
61
- width: 256px;
62
- height: 256px;
63
- }
64
-
65
- div.rank > img {
66
- position: absolute;
67
- }
68
-
69
- div.rank.prev {
70
- filter: grayscale(1);
71
- }
72
- div.rank.curr {
73
- transform: scale(1.25);
74
- }
75
- div.rank p {
76
- font-size: 36px;
77
- bottom: 20px;
78
- width: 100%;
79
- text-align: center;
80
- color: #fff;
81
- position: absolute;
82
- }
83
- </style>
84
-
85
- <% if (fontFamily) { %>
86
- <%- "<style>" %>
87
- <%- `body { font-family: ${fontFamily}; }` %>
88
- <%- "</style>" %>
89
- <% } %>
90
- </head>
91
- <% const {name, avatar, isRising, prevRank, currRank, date} = data; %>
92
- <% const kind = isRising ? "xi" : "bei"; %>
93
- <%
94
- // 1. 准备好要注入的 HTML
95
- const avatarHtml = `<img src="${avatar}" />`;
96
- const prevHtml = `<span class="rank prev">${$t("dota2tracker.template.ranks."+prevRank.medal)}${prevRank.leader ?? prevRank.star}</span>`;
97
- const currHtml = `<span class="rank curr">${$t("dota2tracker.template.ranks."+currRank.medal)}${currRank.leader ?? currRank.star}</span>`;
98
-
99
- // 2. 先处理文本插值
100
- const messageTemplate = isRising
101
- ? $t("dota2tracker.template.rank_fun_up_message", { name: name })
102
- : $t("dota2tracker.template.rank_fun_down_message", { name: name });
103
-
104
- // 3. 手动将占位符替换为 HTML
105
- const finalMessage = messageTemplate
106
- .replace('AVATAR_PLACEHOLDER', avatarHtml)
107
- .replace('PREV_PLACEHOLDER', prevHtml)
108
- .replace('CURR_PLACEHOLDER', currHtml);
109
- %>
110
- <body class="<%= kind %>" <%- `style="background-image: url( ${getImageUrl(kind, undefined, "jpg")} )"`%>>
111
- <div class="wrapper">
112
- <p class="<%= kind %>">
113
- <%- finalMessage %>
114
- </p>
115
- <p></p>
116
- <div class="ranks">
117
- <div class="rank prev">
118
- <img src="<%- getImageUrl('medal_' +(prevRank.inTop100 ?? prevRank.medal)) %>" alt="" />
119
- <img src="<%- getImageUrl('star_' + prevRank.star) %>" alt="" />
120
- <p><%= prevRank.leader ?? "" %></p>
121
- </div>
122
- <div class="rank curr">
123
- <img src="<%- getImageUrl('medal_' +(currRank.inTop100 ?? currRank.medal)) %>" alt="" />
124
- <img src="<%- getImageUrl('star_' + currRank.star) %>" alt="" />
125
- <p><%= currRank.leader ?? "" %></p>
126
- </div>
127
- </div>
128
- <p style="text-align: right; margin-top: 40px;">—— <%= date %></p>
129
- </div>
130
- </body>
131
- </html>
@@ -1,191 +0,0 @@
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
- }
29
-
30
- .title {
31
- margin: 0;
32
- }
33
- .players {
34
- display: grid;
35
- }
36
- .player {
37
- display: grid;
38
- grid-template-columns: 24px 120px 128px 88px 160px;
39
- grid-template-rows: 1fr;
40
- width: 100%;
41
- height: 24px;
42
- align-items: center;
43
- justify-items: center;
44
- justify-content: space-between;
45
- }
46
- .avatar {
47
- width: 24px;
48
- height: 24px;
49
- border-radius: 50%;
50
- border: #fff 1px solid;
51
- box-sizing: border-box;
52
- }
53
-
54
- .player > .name {
55
- display: block;
56
- width: 100%;
57
- text-align: center;
58
- overflow: hidden; /* 超出部分隐藏 */
59
- text-overflow: ellipsis; /* 省略号 */
60
- }
61
- .player > .count {
62
- display: grid;
63
- grid-template-columns: 1fr 1fr 1.8fr;
64
- width: 100%;
65
- }
66
-
67
- .player > .count > span {
68
- text-align: left;
69
- }
70
- .player > .count > span:last-child {
71
- text-align: right;
72
- }
73
- .player > .performance {
74
- display: flex;
75
- align-items: center;
76
- }
77
- .player > .performance > .score_bar {
78
- display: flex;
79
- align-items: center;
80
- justify-content: center;
81
- height: 10px;
82
- width: 51px;
83
- border-radius: 1px;
84
- background-color: #333;
85
- }
86
- .player > .performance > .score_bar > * {
87
- height: 100%;
88
- }
89
- .player > .performance > .score_bar.neg.over {
90
- justify-content: flex-start;
91
- }
92
- .player > .performance > .score_bar.pos.over {
93
- justify-content: flex-end;
94
- }
95
- .player > .performance > .score_bar.neg > .left {
96
- background: linear-gradient(to right, #777, #888, #888, #777);
97
- }
98
- .player > .performance > .score_bar.pos > .right {
99
- background: linear-gradient(to right, #6cf, #7df, #6cf);
100
- }
101
- .player > .performance > .score_bar > .pipe {
102
- height: 12px;
103
- width: 1px;
104
- background-color: #fff;
105
- box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
106
- position: relative;
107
- }
108
-
109
- .player > .performance > .score_value {
110
- display: block;
111
- margin-left: 4px;
112
- width: 28px;
113
- text-align: center;
114
- }
115
-
116
- .combinations {
117
- display: grid;
118
- grid-template-columns: repeat(4, auto);
119
- justify-content: start;
120
- align-items: center;
121
- }
122
-
123
- .combinations > .players {
124
- display: flex;
125
- }
126
-
127
- .combinations span:not(:first-child) {
128
- margin-left: 4px;
129
- }
130
- span.win {
131
- color: #007A00;
132
- }
133
- span.lose {
134
- color: #B30000;
135
- }
136
- </style>
137
-
138
- <% if (fontFamily) { %>
139
- <%- "<style>" %>
140
- <%- `body { font-family: ${fontFamily}; }` %>
141
- <%- "</style>" %>
142
- <% } %>
143
- </head>
144
- <body>
145
- <% const { title, players, combinations, showCombi } = data; %>
146
- <h3 class="title"><%= title %></h3>
147
- <div class="players">
148
- <% for( let index = 0; index < players.length; index++ ) { const player = players[index]; %>
149
- <div class="player">
150
- <img src="<%= player.steamAccount.avatar %>" class="avatar" />
151
- <span class="name"><%= player.name %></span>
152
- <span class="count">
153
- <span class="win"><%- $t("dota2tracker.template.report_won") %><%= player.winCount %></span>
154
- <span class="lose"><%- $t("dota2tracker.template.report_lost") %><%= player.loseCount %></span>
155
- <span><%- $t("dota2tracker.template.report_winrate") %> <%= Math.round((player.winCount / player.matches.length) * 100) %>%</span>
156
- </span>
157
- <div class="performance">
158
- <% const imp = {sign : "", left : 0, right : 0, absValue : Math.abs(player.avgImp)} %>
159
- <% if (player.avgImp > 0) imp.sign = "+"; %>
160
- <% if (player.avgImp < 0) imp.sign = "-"; %>
161
- <% if (imp.absValue > 25) { %>
162
- <% imp.isOver = true; %>
163
- <% if (player.avgImp > 0) imp.right = imp.absValue; %>
164
- <% if (player.avgImp < 0) imp.left = imp.absValue; %>
165
- <% } else imp.left = imp.right = imp.absValue; %>
166
- <div class="score_bar<%= player.avgImp > 0 ? " pos" : " neg" %><%= Math.abs(player.avgImp) > 25 ? " over" : "" %>">
167
- <div class="left" <%- `style="width: ${imp.left}px"` %>></div>
168
- <div class="pipe"></div>
169
- <div class="right" <%- `style="width: ${imp.right}px"` %>></div>
170
- </div>
171
- <span class="score_value"><%= `${player.avgImp > 0 ? imp.sign : ""}${player.avgImp}` %></span>
172
- </div>
173
- <span class="kda"><%= `${player.avgKills}/${player.avgDeaths}/${player.avgAssists} (${player.avgKDA})` %></span>
174
- </div>
175
- <% } %>
176
- </div>
177
- <div class="combinations"<%- !showCombi ? ` style="display:none;"` : "" %>>
178
- <span style="grid-column: 1/-1"><%- $t("dota2tracker.template.combined_win_loss_summary") %></span>
179
- <% combinations.forEach((combi) => {%>
180
- <div class="players">
181
- <% combi.players.forEach(player => {%>
182
- <img src="<%= player.steamAccount.avatar %>" class="avatar" />
183
- <% }); %>
184
- </div>
185
- <span class="win"><%- $t("dota2tracker.template.report_won") %><%= combi.winCount %></span>
186
- <span class="lose"><%- $t("dota2tracker.template.report_lost") %><%= combi.matches.length - combi.winCount %></span>
187
- <span><%- $t("dota2tracker.template.report_winrate") %> <%= Math.round((combi.winCount / combi.matches.length) * 100) %>%</span>
188
- <% }); %>
189
- </div>
190
- </body>
191
- </html>
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes