def ZhanXing(self, fatelevel):
        '''开始占星
        '''
        dynamicId = self._owner.dynamicId
        if self._owner.level.getLevel() < 16:  #功能等级开放限制
            msg = Lg().g(295)
            pushOtherMessage(905, msg, [dynamicId])
            return {'result': False, 'message': msg}
        if fatelevel > 1 and self.fateLevel != fatelevel:
            msg = Lg().g(296)
            pushOtherMessage(905, msg, [dynamicId])
            return {'result': False, 'message': msg}
        if len(self.outside) >= MAXOUTSIDE:
            return {'result': False, 'message': Lg().g(297)}
        cons = ZHANXING_CONFIG_CONS.get(fatelevel, 10000)
        if cons > self._owner.finance.getCoin():
            msg = Lg().g(88)
            pushOtherMessage(905, msg, [dynamicId])
            return {'result': False, 'message': msg}
        templateId = choiceFate(fatelevel)
        fateId = self.addFate(templateId)
        self.planFateLevel(fatelevel)
        self.score += 1
        fate = self.fates.get(fateId)
        data = {
            'showIndex': self.fateLevel,
            'maxCount': self.score,
            'fateIns': fate
        }
        self._owner.finance.addCoin(-cons)
        self._owner.daily.noticeDaily(21, 0, -1)  #通知每日目标
        name = fate.templateinfo['name']
        levelname = LEVELNAME.get(self.fateLevel)
        if self.fateLevel > 1:
            try:
                msg = Lg().g(298) % (name, levelname)
            except:
                msg = Lg().g(298) % (name.decode('utf8'), levelname)
        else:
            try:
                msg = Lg().g(299) % (name)
            except:
                msg = Lg().g(299) % (name.decode('utf8'))

        pushOtherMessage(905, msg, [dynamicId])
        self._owner.schedule.noticeSchedule(9)  #成功后的日程目标通知
        characterId = self._owner.baseInfo.id
        prop = {'score': self.score}
        dbCharacterFate.updateCharacterFateSetting(characterId, prop)
        return {'result': True, 'data': data}
 def ZhanXing(self,fatelevel):
     '''开始占星
     '''
     dynamicId = self._owner.dynamicId
     if self._owner.level.getLevel()<16:#功能等级开放限制
         msg = Lg().g(295)
         pushOtherMessage(905, msg, [dynamicId])
         return {'result':False,'message':msg}
     if fatelevel>1 and self.fateLevel!=fatelevel:
         msg = Lg().g(296)
         pushOtherMessage(905, msg, [dynamicId])
         return {'result':False,'message':msg}
     if len(self.outside)>=MAXOUTSIDE:
         return {'result':False,'message':Lg().g(297)}
     cons = ZHANXING_CONFIG_CONS.get(fatelevel,10000)
     if cons>self._owner.finance.getCoin():
         msg = Lg().g(88)
         pushOtherMessage(905, msg, [dynamicId])
         return {'result':False,'message':msg}
     templateId = choiceFate(fatelevel)
     fateId = self.addFate(templateId)
     self.planFateLevel(fatelevel)
     self.score += 1
     fate = self.fates.get(fateId)
     data ={'showIndex':self.fateLevel,'maxCount':self.score,'fateIns':fate}
     self._owner.finance.addCoin(-cons)
     self._owner.daily.noticeDaily(21,0,-1)#通知每日目标
     name = fate.templateinfo['name']
     levelname = LEVELNAME.get(self.fateLevel)
     if self.fateLevel>1:
         try:
             msg =Lg().g(298)%(name,levelname)
         except:
             msg =Lg().g(298)%(name.decode('utf8'),levelname)
     else:
         try:
             msg = Lg().g(299)%(name)
         except:
             msg = Lg().g(299)%(name.decode('utf8'))
     
     pushOtherMessage(905, msg, [dynamicId])
     self._owner.schedule.noticeSchedule(9)#成功后的日程目标通知
     characterId = self._owner.baseInfo.id
     prop = {'score':self.score}
     dbCharacterFate.updateCharacterFateSetting(characterId, prop)
     return {'result':True,'data':data}
 def ExchangeFate(self,templateId):
     '''积分兑换命格
     '''
     if self._owner.level.getLevel()<50:#功能等级开放限制
         return {'result':False,'message':Lg().g(301)}
     fateInfo = dbCharacterFate.FATE_TEMPLATE.get(templateId)
     if not fateInfo:
         return {'result':False,'message':Lg().g(302)}
     scorerequired = fateInfo['score']
     if scorerequired>self.score:
         return {'result':False,'message':Lg().g(303)}
     position = self.findZhanXingPackPosition()
     if position ==-1:
         return {'result':False,'message':Lg().g(297)}
     characterId = self._owner.baseInfo.id
     fate = Fate(templateId = templateId)
     fate.InsertIntoDB(characterId, equip = -1, position = position)
     self.fates[fate.id] = fate
     self.fatepack[position] = fate.id
     self.score -= scorerequired
     prop = {'score':self.score}
     dbCharacterFate.updateCharacterFateSetting(characterId, prop)
     return {'result':True,'message':Lg().g(304)}
 def ExchangeFate(self, templateId):
     '''积分兑换命格
     '''
     if self._owner.level.getLevel() < 50:  #功能等级开放限制
         return {'result': False, 'message': Lg().g(301)}
     fateInfo = dbCharacterFate.FATE_TEMPLATE.get(templateId)
     if not fateInfo:
         return {'result': False, 'message': Lg().g(302)}
     scorerequired = fateInfo['score']
     if scorerequired > self.score:
         return {'result': False, 'message': Lg().g(303)}
     position = self.findZhanXingPackPosition()
     if position == -1:
         return {'result': False, 'message': Lg().g(297)}
     characterId = self._owner.baseInfo.id
     fate = Fate(templateId=templateId)
     fate.InsertIntoDB(characterId, equip=-1, position=position)
     self.fates[fate.id] = fate
     self.fatepack[position] = fate.id
     self.score -= scorerequired
     prop = {'score': self.score}
     dbCharacterFate.updateCharacterFateSetting(characterId, prop)
     return {'result': True, 'message': Lg().g(304)}