1
This commit is contained in:
parent
5fb29f563c
commit
372002bf25
48
server/tools/robot/virtualclient/metamgr.py
Normal file
48
server/tools/robot/virtualclient/metamgr.py
Normal file
@ -0,0 +1,48 @@
|
||||
import time
|
||||
import datetime
|
||||
import traceback
|
||||
import glm
|
||||
import csv
|
||||
import string
|
||||
|
||||
mapThingHash = {}
|
||||
|
||||
def _read(headers, row, name):
|
||||
return row[headers.index(name)]
|
||||
|
||||
def _readInt(headers, row, name):
|
||||
val = _read(headers, row, name)
|
||||
ret = 0
|
||||
try:
|
||||
ret = int(val)
|
||||
except ValueError:
|
||||
try:
|
||||
ret = float(val)
|
||||
except ValueError:
|
||||
pass
|
||||
return int(ret)
|
||||
|
||||
class MapThing(object):
|
||||
|
||||
def __init__(self, headers, row):
|
||||
self.thing_id =_readInt(headers, row, 'thing_id')
|
||||
self.thing_type = _readInt(headers, row, 'thing_type')
|
||||
self.type_ =_readInt(headers, row, 'type')
|
||||
self.height =_readInt(headers, row, 'height')
|
||||
self.width =_readInt(headers, row, 'width')
|
||||
self.interaction_mode = _readInt(headers, row, 'interaction_mode')
|
||||
self.bullet_hit =_readInt(headers, row, 'bullet_hit')
|
||||
self.collision_hit =_readInt(headers, row, 'collision_hit')
|
||||
self.explosion_hit =_readInt(headers, row, 'explosion_hit')
|
||||
|
||||
def load():
|
||||
baseDir = '../../../../../conf_test/game2005/gameserver.dev/res1/'
|
||||
with open(baseDir + 'mapThing@mapThing.csv') as f:
|
||||
csvReader = csv.reader(f)
|
||||
headers = next(csvReader)
|
||||
for row in csvReader:
|
||||
mapThingHash[_readInt(headers, row, 'thing_id')] = MapThing(headers, row)
|
||||
#end for
|
||||
|
||||
def getMapThingMeta(self, id):
|
||||
return _mapThingHash.get(id, None)
|
Loading…
x
Reference in New Issue
Block a user