def process_derived(cls, obj, replay): ## This try except block is bad. Look into a means to fix this. Not all sc2reader.Unit ## types have the 'location' attribute. Notably, those that are associated to observers. try: unit_type = UNIT_TYPE.select_from_object(obj._type_class, replay), ## killing_player = PLAYER.select_from_object(obj.killing_player, replay) ## killed_by = PLAYER.select_from_object(obj.killed_by, replay) owner = PLAYER.select_from_object(obj.owner, replay) return { 'name' : obj.name, 'location_x' : obj.location[0], 'location_y' : obj.location[1], '__OWNER__' : owner.__id__, 'owner' : owner, ## 'killing_player' : killing_player, ## 'killed_by' : killed_by, '__UNIT_TYPE__' : unit_type[0].__id__, 'unit_type' : unit_type[0] ## why is this returning a tuple? } except Exception as e: ## look to perhaps use logging here. print(e, obj) return {}
def process_dependancies(cls, obj, replay): info = None if not replay else INFO.select_from_object(replay) player = None if not obj.player else PLAYER.select_from_object(obj.player, replay) return { 'info' : info, 'player' : player, }
def process_dependancies(cls, obj, replay): info = None if not replay else INFO.select_from_object(replay) unit_controller = None if not obj.unit_controller else PLAYER.select_from_object( obj.unit_controller, replay) unit = None if not obj.unit else OBJECT.select_from_object( obj.unit, replay) return {'info': info, 'unit_controller': unit_controller, 'unit': unit}
def process_dependancies(cls, obj, replay): info = None if not replay else INFO.select_from_object(replay) player = None if not obj.player else PLAYER.select_from_object( obj.player, replay) ability = None if not obj.ability else ABILITY.select_from_object( obj.ability, replay) return {'info': info, 'player': player, 'ability': ability}
def process(cls, replay): MAP.process(replay) INFO.process(replay) PLAYER.process(replay) OBJECT.process(replay)