MCPcopy
hub / github.com/SYJun404/frank / QueryMatch

Class QueryMatch

src/main/views/teammate/queryMatch.ts:6–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4import {querySummonerPosition} from "@/lcu/utils";
5
6export class QueryMatch {
7
8 public timestampToDate = (timestamp: number) => {
9 var date = new Date(timestamp)
10 return (date.getMonth() + 1 < 10 ?
11 '0' + (date.getMonth() + 1) :
12 date.getMonth() + 1)
13 + '-' + (date.getDate() < 10 ? '0' + date.getDate() : date.getDate())
14 }
15
16 public queryGameType = (queueId: number) => {
17 switch (queueId) {
18 case 420 :
19 return '单双';
20 case 430 :
21 return '匹配';
22 case 440 :
23 return '灵活';
24 case 450 :
25 return '极地';
26 case 1700 :
27 return '斗魂';
28 case 1900 :
29 return '无限';
30 }
31 return '其它'
32 }
33
34 public getSimpleMatch = (match: Games): SimpleMatchTypes => {
35 const kills = match.participants[0].stats.kills
36 const deaths = match.participants[0].stats.deaths
37 const assists = match.participants[0].stats.assists
38 const kda = deaths === 0 ? kills + assists : Math.round((kills + assists) / deaths * 3)
39
40 return {
41 champId: match.participants[0].championId,
42 champImgUrl: `${champDict[String(match.participants[0].championId)].alias}.png`,
43 // 是否取得胜利
44 isWin: match.participants[0].stats.win === true ? true : false,
45 // 击杀数目
46 kills: kills,
47 // 死亡数目
48 deaths: deaths,
49 // 助攻数目
50 assists: assists,
51 // KDA
52 kda: kda,
53 // 游戏时间
54 matchTime: this.timestampToDate(match.gameCreation),
55 // 游戏模式
56 gameModel: this.queryGameType(match.queueId),
57 // 召唤师技能1
58 spell1Id: match.participants[0].spell1Id,
59 // 召唤师技能2
60 spell2Id: match.participants[0].spell2Id,
61 // 物品
62 itemList:
63 [match.participants[0].stats.item0, match.participants[0].stats.item1,

Callers

nothing calls this directly

Calls 2

querySummonerPositionFunction · 0.90
queryMatchHistoryFunction · 0.90

Tested by

no test coverage detected