async def serve_save_approved_as_is(request): enemy_id = int(request.args.get('id')) data_dir = os.path.join(es_dir, 'behavior_data') monster_file = os.path.join(data_dir, '{}.textproto'.format(enemy_id)) mbwo = enemy_skill_proto.load_from_file(monster_file) del mbwo.level_overrides[:] mbwo.level_overrides.extend(mbwo.levels) mbwo.status = MonsterBehaviorWithOverrides.APPROVED_AS_IS enemy_skill_proto.save_overrides(monster_file, mbwo) return text('ok')
async def serve_save_approved_with_changes(request): enemy_id = int(request.args.get('id')) data_dir = os.path.join(es_dir, 'behavior_data') monster_file = os.path.join(data_dir, '{}.textproto'.format(enemy_id)) mbwo = enemy_skill_proto.load_from_file(monster_file) del mbwo.level_overrides[:] mbwo_input = MonsterBehaviorWithOverrides() mbwo_input.ParseFromString(binascii.unhexlify(str(request.body.decode('ascii')))) mbwo.level_overrides.extend(mbwo_input.level_overrides) mbwo.status = MonsterBehaviorWithOverrides.APPROVED_WITH_CHANGES enemy_skill_proto.save_overrides(monster_file, mbwo) return text('ok')