-
Notifications
You must be signed in to change notification settings - Fork 2
/
classes.py
executable file
·161 lines (127 loc) · 3.28 KB
/
classes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
from dataclasses import dataclass, asdict
from champions import *
from typing import Dict
@dataclass
class Player:
name: str
tag: str
def get_opgg_name(self):
new_name = self.name.replace(" ", "%20")
return f"{new_name}-{self.tag}"
def __hash__(self):
return hash(self.get_opgg_name())
class Lane(Enum):
TOP = 1
JUNGLE = 2
MID = 3
ADC = 4
SUPPORT = 5
lane_name_to_enum = {
"top": Lane.TOP,
"jungle": Lane.JUNGLE,
"mid": Lane.MID,
"adc": Lane.ADC,
"support": Lane.SUPPORT,
}
class MatchResult(Enum):
RED = 1
BLUE = 2
REMAKE = 3
class Tier(Enum):
IRON = "iron"
BRONZE = "bronze"
SILVER = "silver"
GOLD = "gold"
PLATINUM = "platinum"
EMERALD = "emerald"
DIAMOND = "diamond"
MASTER = "master"
GRANDMASTER = "grandmaster"
CHALLENGER = "challenger"
ALL = ""
class ChampionTier(Enum):
TIER1 = 1
TIER2 = 2
TIER3 = 3
TIER4 = 4
TIER5 = 5
champion_tier_name_to_enum = {
"5 Tier": ChampionTier.TIER5,
"4 Tier": ChampionTier.TIER4,
"3 Tier": ChampionTier.TIER3,
"2 Tier": ChampionTier.TIER2,
"1 Tier": ChampionTier.TIER1,
"OP Tier": ChampionTier.TIER1,
}
champion_tier_enum_to_name = {
value: key for key, value in champion_tier_name_to_enum.items()
}
@dataclass
class OpggMatch:
team_red: list[(Player, Champion, Lane)]
team_blue: list[(Player, Champion, Lane)]
winner: MatchResult
@dataclass
class PlayerStatsOnChamp:
player: Player
champion: Champion
mastery: int
total_games_played: int
win_rate: float
kda_ratio: float
average_gold_per_minute: float
average_cs_per_minute: float
@dataclass
class PlayerInfo:
player: Player
overall_win_rate: float
rank: str # type Tier? ===========================================================================================
total_games_played: int
level: int
last_twenty_games_kda_ratio: float
last_twenty_games_kill_participation: float
preferred_positions: list[(Lane, float)]
last_twenty_games_win_rate: float
def show(self):
for key, value in asdict(self).items():
print(f"{key} - {value}")
@dataclass
class ChampStats:
champion: Champion
lane: Lane
champion_tier: ChampionTier
win_rate: float
ban_rate: float
pick_rate: float
match_up_win_rate: Dict[Champion, float]
@dataclass
class DataEntryForPlayer:
player_mastery_on_champ: int
player_wr_on_champ: float
player_kda_ratio_on_champ: float
player_gpm_on_champ: float
player_cspm_on_champ: float
player_overall_wr: float
@dataclass
class DataEntryTeam:
total_mastery: int
average_mastery: float
average_player_wr: float
average_champion_specific_player_wr: float
average_champion_specific_match_up_wr: float
@dataclass
class ChampionEntry:
tier: int
wr: float
br: float
pr: float
match_up_wr: float
@dataclass
class DataVector:
match_result: MatchResult
blue_team_players_entries: list[DataEntryForPlayer]
blue_team_champions_entries: list[ChampionEntry]
blue_team_team_entry: DataEntryTeam
red_team_players_entries: list[DataEntryForPlayer]
red_team_champions_entries: list[ChampionEntry]
red_team_team_entry: DataEntryTeam