-
Notifications
You must be signed in to change notification settings - Fork 0
/
GetPlayerPerformance.py
125 lines (104 loc) · 4.41 KB
/
GetPlayerPerformance.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
from GetMatchDetails import GetMatchDetails
from GetPlayerTournamentMatches import GetPlayerTournamentMatches
from GetTeamRank import GetTeamRank
def GetOneMatchPerformance(match_id,account_id):
dict = GetMatchDetails(match_id)
for i in dict:
if i['account_id'] != str(account_id):
continue
else:
score = i['kills']*2+i['deaths']*(-1)+i['assists']*1.6
return score
def GetRecentlyPerformance(account_id):
matchlist = GetPlayerTournamentMatches(account_id)
total_score = 0
for match_id in matchlist:
score = GetOneMatchPerformance(match_id, account_id)
total_score = total_score + score
recent_score = round(total_score/5, 1)
return recent_score
def GetPlayerPrice(account_id, team_id):
recent_score = GetRecentlyPerformance(account_id)
rank = int(GetTeamRank(team_id))
if rank > 0 and rank <= 3:
price = recent_score*100*(1.2)
elif rank >3 and rank <= 10:
price = recent_score*100*(1.1)
elif rank > 10 and rank <= 20:
price = recent_score*100*(1)
else:
price = recent_score*100*(0.8)
return price
'''
total_Radiant_hero_damage = 0
total_Dire_hero_damage = 0
total_Radiant_Death = 0
total_Dire_Death = 0
total_Radiant_last_hit = 0
total_Dire_last_hit =0
total_Radiant_XPM = 0
total_Dire_XPM = 0
total_Radiant_GPM = 0
total_Dire_GPM = 0
for i in dict:
if int(i['player_slot']) < 128:
total_Radiant_hero_damage = total_Radiant_hero_damage + i['hero_damage']
total_Radiant_Death = total_Radiant_Death +i['deaths']
total_Radiant_last_hit = total_Radiant_last_hit + i['last_hits']
total_Radiant_XPM = total_Radiant_XPM + i['xp_per_min']
total_Radiant_GPM = total_Radiant_GPM + i['gold_per_min']
else:
total_Dire_hero_damage = total_Dire_hero_damage + i['hero_damage']
total_Dire_Death = total_Dire_Death +i['deaths']
total_Dire_last_hit = total_Dire_last_hit + i['last_hits']
total_Dire_XPM = total_Dire_XPM + i['xp_per_min']
total_Dire_GPM = total_Dire_GPM + i['gold_per_min']
average_Radiant_Death = total_Radiant_Death/5
average_Dire_Death = total_Dire_Death/5
average_Radiant_last_hit = total_Radiant_last_hit / 5
average_Dire_last_hit = total_Dire_last_hit / 5
average_Radiant_XPM = total_Radiant_XPM / 5
average_Dire_XPM = total_Dire_XPM / 5
average_Radiant_GPM = total_Radiant_GPM / 5
average_Dire_GPM = total_Dire_GPM / 5
for i in dict:
data = {
'camp': 'Radiant' if int(i['player_slot']) < 128 else 'Dire',
'account_id': i['account_id'],
'f': i['kills']*2+i['deaths']*(-1)+i['assists']*1.6
}
print(data)
for i in dict:
if int(i['player_slot']) < 128:
f = (i['hero_damage']/total_Radiant_hero_damage)/i['gold_per_min']
else:
f = (i['hero_damage']/total_Dire_hero_damage)/i['gold_per_min']
data = {
'camp': 'Radiant' if int(i['player_slot']) < 128 else 'Dire',
'account_id': i['account_id'],
'f': f*1000
}
print(data)
for i in dict:
if int(i['player_slot']) < 128:
f = 4*(i['last_hits']/average_Radiant_last_hit)+10*i['hero_damage']/total_Radiant_hero_damage-1.5*i['deaths']/average_Radiant_Death+10*i['gold_per_min']/average_Radiant_GPM+2*i['xp_per_min']/average_Radiant_XPM
else:
f = 4*(i['last_hits']/average_Dire_last_hit)+10*i['hero_damage']/total_Dire_hero_damage-1.5*i['deaths']/average_Dire_Death+10*i['gold_per_min']/average_Dire_GPM+2*i['xp_per_min']/average_Dire_XPM
data = {
'camp': 'Radiant' if int(i['player_slot']) < 128 else 'Dire',
'account_id': i['account_id'],
'f': f
}
print(data)
for i in dict:
data = {
'camp': 'Radiant' if int(i['player_slot']) < 128 else 'Dire',
'account_id':i['account_id'],
'death':i['deaths'],
'GPM':i['gold_per_min'],
'XPM':i['xp_per_min'],
'last_hit':i['last_hits'],
'hero_damage':i['hero_damage'],
'hero_damage_rate': format(i['hero_damage']/total_Radiant_hero_damage,'.1%') if int(i['player_slot']) < 128 else format(i['hero_damage']/total_Dire_hero_damage,'.1%')
}
print(data)'''