Skip to content

Commit

Permalink
fix names missing in draft on TR
Browse files Browse the repository at this point in the history
  • Loading branch information
Himyu committed Sep 21, 2024
1 parent 654acc7 commit 4fb962f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 13 deletions.
2 changes: 1 addition & 1 deletion electron/module/LCUModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class LCUModule {
protected lcu: LCU,
protected server: Server,
private menu: Menu,
private dataPoints?: Array<string>
protected dataPoints?: Array<string>
) {
this.logger = log.scope(id)

Expand Down
40 changes: 28 additions & 12 deletions electron/module/Lobby.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class Lobby extends LCUModule {
* @param puuid string
* @param elo tier: string, division: string
*/
private players: Map<string, { tier: string, division: string }> = new Map()
private players: Map<string, { tier: string, division: string, summonerName: string }> = new Map()

// eslint-disable-next-line @typescript-eslint/no-explicit-any
async handleData(data: any, event: any): Promise<void> {
Expand All @@ -20,13 +20,20 @@ export class Lobby extends LCUModule {
/* this.data.push({data, event}) */

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const selectedData: { [n: string]: any } = data
let selectedData: { [n: string]: any } = {}

if (data) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
await Promise.all(data.gameConfig.customTeam100.map((m: any) => this.getPlayerElo(m)))
// eslint-disable-next-line @typescript-eslint/no-explicit-any
await Promise.all(data.gameConfig.customTeam200.map((m: any) => this.getPlayerElo(m)))
if (!this.dataPoints) selectedData = data
else {
for (const key of this.dataPoints) {
selectedData[key] = data[key]
}
}

if (data) {
const members = await Promise.all(data.members.map((m: any) => this.getPlayer(m)))

Check failure on line 33 in electron/module/Lobby.ts

View workflow job for this annotation

GitHub Actions / Run linters

Unexpected any. Specify a different type

data.gameConfig.customTeam100 = data.gameConfig.customTeam100.map((p: any) => members.find(m => m.puuid === p.puuid))

Check failure on line 35 in electron/module/Lobby.ts

View workflow job for this annotation

GitHub Actions / Run linters

Unexpected any. Specify a different type
data.gameConfig.customTeam200 = data.gameConfig.customTeam200.map((p: any) => members.find(m => m.puuid === p.puuid))

Check failure on line 36 in electron/module/Lobby.ts

View workflow job for this annotation

GitHub Actions / Run linters

Unexpected any. Specify a different type
}

try {
Expand Down Expand Up @@ -55,14 +62,21 @@ export class Lobby extends LCUModule {
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
async getPlayerElo(m: any): Promise<any> {
async getPlayer(m: any): Promise<any> {
if (!this.players.has(m.puuid)) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const elo = await this.lcu.request<any>({
method: 'GET',
url: `/lol-ranked/v1/ranked-stats/${m.puuid}`
})

const player = await this.lcu.request<any>({

Check failure on line 73 in electron/module/Lobby.ts

View workflow job for this annotation

GitHub Actions / Run linters

Unexpected any. Specify a different type
method: 'GET',
url: `lol-summoner/v2/summoners/puuid/${m.puuid}`
})

m.summonerName = player.gameName

if (elo === undefined) {
m.elo = {
tier: 'NONE',
Expand All @@ -82,17 +96,18 @@ export class Lobby extends LCUModule {
}
this.players.set(m.puuid, {
tier: soloQueue.tier,
division: soloQueue.division
division: soloQueue.division,
summonerName: player.gameName
})
} else if (flexQueue.tier !== 'NONE') {
m.elo = {
tier: flexQueue.tier,
division: flexQueue.division
}
this
this.players.set(m.puuid, {
tier: flexQueue.tier,
division: flexQueue.division
division: flexQueue.division,
summonerName: player.gameName
})
} else {
m.elo = {
Expand All @@ -101,7 +116,8 @@ export class Lobby extends LCUModule {
}
this.players.set(m.puuid, {
tier: 'NONE',
division: 'NA'
division: 'NA',
summonerName: player.gameName
})
}

Expand Down

0 comments on commit 4fb962f

Please sign in to comment.