-
Notifications
You must be signed in to change notification settings - Fork 0
/
sandbox.py
129 lines (113 loc) · 5.15 KB
/
sandbox.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
__author__ = 'ryan'
import copy
import riot_api_wrapper.RiotAPI as API
import key as KEY
import spell as Spell
def main ():
api = API.RiotAPI(KEY.KEY)
a = api.get_champion_list('spells')
# a = api.get_champion_list()
# print type(a['data']['MonkeyKing'])
# print a['data']['Leblanc']
x = 0
keys = []
for pairs in a['data'].iteritems(): # Get the list of keys from the API list of spells. Keys are essentially champ names.
keys.append(pairs[0])
"""for each in keys:
print each
print len(keys)"""
# print(api.get_champion_list('spells'))
"""print "Number of keys: ", len(keys)
print type(keys) # list
print type(a['data']) # a['data'] is a dictionary
print type(a['data']['MonkeyKing']) #dictionary
print type(a['data']['MonkeyKing']['spells']) #list
print len(a['data']['MonkeyKing']['spells']) #list with 4 things. all related to wukong.
print type(a['data']['MonkeyKing']['spells'][0]) # a dictionary """
"""for each in a['data']['Kassadin']['spells'][3]:
print each
print a['data']['Kassadin']['spells'][3][each]"""
"""for each in a['data']['Shaco']['spells'][0]:
print each
print a['data']['Shaco']['spells'][0][each]"""
#print a['data']['Xerath']['spells'][2].get('sanitizedTooltip')
print a['data']['Soraka']['spells'][1].get('sanitizedTooltip') #.get('cooldown')
#print a['data']['Lux']['spells'][2].get('sanitizedTooltip') #.get('cooldown')
#print a['data']['Lux']['spells'][3].get('sanitizedTooltip') #.get('cooldown')
stats = {}
for champ in keys:
for x in range(0, 4):
if a['data'][champ]['spells'][x].get('vars') is not None:
for sublist in a['data'][champ]['spells'][x]['vars']:
if sublist['link'][0] != '@' and sublist['link'][0] != '.':
stats[sublist['link']] = 100
stats['cdr'] = 0.10
LuxQ = Spell.Spell()
LuxQ.init_from_riot_api(a['data']['Soraka']['spells'][1])
print LuxQ.get_efficiency(stats)
"""spells = []
x = 0
for what in keys:
spellQ = Spell.Spell()
spellW = Spell.Spell()
spellE = Spell.Spell()
spellR = Spell.Spell()
spellQ.init_from_riot_api(a['data'][what]['spells'][0])
spellW.init_from_riot_api(a['data'][what]['spells'][1])
spellE.init_from_riot_api(a['data'][what]['spells'][2])
spellR.init_from_riot_api(a['data'][what]['spells'][3])
spells.append(spellQ)
spells.append(spellW)
spells.append(spellE)
spells.append(spellR)
# print spells[0]
# print a['data']['FiddleSticks']['spells']"""
"""print a['data']['MonkeyKing']['spells'][0]['sanitizedDescription']
print a['data']['MonkeyKing']['spells'][0]['sanitizedTooltip']
print a['data']['MonkeyKing']['spells'][0]['effect']"""
""" print type(a['data']['MonkeyKing']['spells'][3]['vars'])
print len(a['data']['MonkeyKing']['spells'][0]['vars'])
print a['data']['MonkeyKing']['spells'][0]['vars'][0]
print type(a['data']['MonkeyKing']['spells'][0])"""
#print a['data']['MonkeyKing']['spells'][3]['effect']
#print a['data']['MonkeyKing']['spells'][3]['effect'][0]
#print a['data']['MonkeyKing']['spells'][3]['effect'][1]
#print a['data']['MonkeyKing']['spells'][3]['effect'][2]
# https://developer.riotgames.com/docs/static-data
# IMPORTANT KEYS
# 'name' - Name of the spell
# 'cooldown' - a list of the cooldowns
# 'resource' - type of resource needed
# 'effect' - not entirely certain, it's a list. index 1 appears to be scaling for base effect.
# 'vars' - a list of "variables" for the spell. each index is a dictionary that has the keys:
# 'coeff' : [coeff], 'link' : scaling type, and 'key' : someKey
# 'cost' - the resource cost to cast the spell.
#
# Not necessarily important, but e1 seems to be base damage. guessing e is short for effect. the values for it seem
# to be stored in the 'effect' key
# cooldownBurn - cdr in seconds. returns in X/Y/Z
# cooldown - cdr in seconds, returns as [x, y, z]
# vars - returns a dict with keys 'coeff', scaling type, and 'key' (not sure what this is)
# leveltip - I thiiink this is tool tip.
# costType - what resource this consumes
# description - description (shocker)
#
# Dict looks like it goes JSONDICT['data'][keyForChampionName]['spells'][intForSpellQWER][keyForSpellAspect]
# keyForChampionName - This should be decided by getting a list of keys from iterating through JSONDICT['data'].iteritems()
# intForSpellQWER - This should be any value 0-3, maps to q, w, e, r
# keyForSpellAspect - probably just going to hardcode this or something. but can be attained by for each'ing in JSONDICT['data'][keyForChampionName][intForSpellQWER]
y = 0
"""for key, value in keys:
print key
print value
print value['spells'][3]['key']
y+=1"""
# Give
"""a = dummy()
b = copy.deepcopy(a)
print ("a: ", a.getTest1())
print ("b: ", b.getTest1())
print "changing b's value."
b.setTest(5)
print("a: ", a.getTest1())"""
main()