forked from devilesk/dota-map-coordinates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
process_lanes.py
29 lines (26 loc) · 1015 Bytes
/
process_lanes.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
import json
import matplotlib.path as mplPath
import numpy as np
#targetname goes to target
lane_data = {}
with open('data/dota_pvp_prefab.vmap.txt', 'r') as f:
dump_on_next_brace = False
for line in f.readlines():
if '"origin"' in line:
origin = [x.replace('"', '') for x in line.strip('\n').split(" ")[-3:]]
if '"classname"' in line:
classname = line.strip('\n').split(" ")[-1].replace('"', '')
if '"targetname"' in line:
targetname = line.strip('\n').split(" ")[-1].replace('"', '')
if '"target"' in line:
target = line.strip('\n').split(" ")[-1].replace('"', '')
if '"path_corner"' in line:
dump_on_next_brace = True
if '}' in line and dump_on_next_brace:
dump_on_next_brace = False
# print (classname, target, origin, targetname)
lane_data[targetname] = {
'target': target,
'origin': origin
}
print (lane_data)