-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjson_lookup.py
41 lines (35 loc) · 1.3 KB
/
json_lookup.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
from pydota2.lib.gfile import *
import json
def getNameOfKey(fname, key):
fname = JoinPath('pydota2', 'gen_data', fname)
with open(fname, 'r') as infile:
data = json.load(infile)
return data[key]['Name']
def isAbilityHidden(fname, key):
fname = JoinPath('pydota2', 'gen_data', fname)
with open(fname, 'r') as infile:
data = json.load(infile)
return 'Hidden' in data[key].keys()
def isAbilityUltimate(fname, key):
fname = JoinPath('pydota2', 'gen_data', fname)
with open(fname, 'r') as infile:
data = json.load(infile)
return 'Ultimate' in data[key].keys()
def getUltStartingLevel(fname, key):
fname = JoinPath('pydota2', 'gen_data', fname)
with open(fname, 'r') as infile:
data = json.load(infile)
if 'LevelAvailable' in data[key].keys():
return data[key]['LevelAvailable']
else:
return 6
def getUltLevelInterval(fname, key):
fname = JoinPath('pydota2', 'gen_data', fname)
with open(fname, 'r') as infile:
data = json.load(infile)
if 'LevelsBetweenUpgrades' in data[key].keys():
return data[key]['LevelsBetweenUpgrades']
else:
return 6
if __name__ == "__main__":
print(getNameOfKey('abilities.json', '5014'))