2020-10-11 15:31:16 +00:00
|
|
|
import { ParticipantBasic, ParticipantDetails } from './Models/Match'
|
2020-10-07 20:03:24 +00:00
|
|
|
|
2020-10-04 20:05:44 +00:00
|
|
|
/**
|
|
|
|
|
* League of Legends queues with defined role for each summoner
|
|
|
|
|
*/
|
2020-10-05 09:16:21 +00:00
|
|
|
export const queuesWithRole = [
|
2020-10-04 20:05:44 +00:00
|
|
|
0, // Custom
|
|
|
|
|
400, // Draft
|
|
|
|
|
420, // Solo/Duo
|
|
|
|
|
430, // Blind,
|
|
|
|
|
440, // Flex
|
|
|
|
|
700, // Clash
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* League of Legends seasons timestamps
|
|
|
|
|
*/
|
2020-10-05 09:16:21 +00:00
|
|
|
export const seasons = {
|
2020-10-04 20:05:44 +00:00
|
|
|
0: 9,
|
|
|
|
|
1578628800000: 10,
|
2020-11-13 20:54:29 +00:00
|
|
|
1604970061000: 10.5, // Preseason 11
|
2020-10-04 20:05:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* League of Legends all support item ids
|
|
|
|
|
*/
|
2020-10-05 09:16:21 +00:00
|
|
|
export const supportItems = [3850, 3851, 3853, 3854, 3855, 3857, 3858, 3859, 3860, 3862, 3863, 3864]
|
2020-10-04 20:05:44 +00:00
|
|
|
|
2020-10-05 09:16:21 +00:00
|
|
|
/**
|
|
|
|
|
* Get season number for a match
|
|
|
|
|
* @param timestamp
|
|
|
|
|
*/
|
2020-10-11 15:31:16 +00:00
|
|
|
export function getSeasonNumber (timestamp: number): number {
|
2020-10-05 09:16:21 +00:00
|
|
|
const arrSeasons = Object.keys(seasons).map(k => Number(k))
|
|
|
|
|
arrSeasons.push(timestamp)
|
|
|
|
|
arrSeasons.sort()
|
|
|
|
|
const indexSeason = arrSeasons.indexOf(timestamp) - 1
|
|
|
|
|
return seasons[arrSeasons[indexSeason]]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2020-10-11 15:31:16 +00:00
|
|
|
* Sort array of Players by roles according to a specific order
|
|
|
|
|
* @param a first player
|
|
|
|
|
* @param b second player
|
2020-10-05 09:16:21 +00:00
|
|
|
*/
|
2020-10-11 15:31:16 +00:00
|
|
|
export function sortTeamByRole (a: ParticipantBasic | ParticipantDetails, b: ParticipantBasic | ParticipantDetails) {
|
2020-10-05 09:16:21 +00:00
|
|
|
const sortingArr = ['TOP', 'JUNGLE', 'MIDDLE', 'BOTTOM', 'SUPPORT']
|
|
|
|
|
return sortingArr.indexOf(a.role) - sortingArr.indexOf(b.role)
|
2020-10-04 20:05:44 +00:00
|
|
|
}
|