def autoUnloadCatch(self):
     '''自动卸载战斗技能'''
     realySpace = ''
     for key, value in self._equipActiveSkill.items():
         if value == self.CATCHPETSKILLGROUP:
             realySpace = key
             break
     if realySpace and not self.checkCanEquipCatchSkill():
         self._equipActiveSkill[realySpace] = 0
         dbSkill.updateCharacterSkillSet(self._owner.baseInfo.id,\
                                               realySpace, 0)
         self.pushAutoUnloadCatch()
 def autoUnloadCatch(self):
     '''自动卸载战斗技能'''
     realySpace = ''
     for key ,value in self._equipActiveSkill.items():
         if value == self.CATCHPETSKILLGROUP:
             realySpace = key
             break
     if realySpace and not self.checkCanEquipCatchSkill():
         self._equipActiveSkill[realySpace] = 0
         dbSkill.updateCharacterSkillSet(self._owner.baseInfo.id,\
                                               realySpace, 0)
         self.pushAutoUnloadCatch()
 def OpenBattleSpace(self, spacePos):
     """开启战斗技能位置"""
     if spacePos not in [0, 1, 2]:
         return {"result": False, "message": u"技能槽位置不符"}
     if self._equipActiveSkill[spacePos] != -1:
         return {"result": False, "message": u"技能槽位置已经激活"}
     self._equipActiveSkill[spacePos] = -1
     fieldName = "ActiveSkill_%d" % (spacePos + 1)
     result = dbSkill.updateCharacterSkillSet(self._owner.baseInfo.id, fieldName, 0)
     if result:
         return {"result": True}
     return {"result": False, "message": u"激活失败"}
    def OpenBattleSpace(self,spacePos):
        '''开启战斗技能位置'''
        if spacePos not in [0,1,2]:
            return {'result':False,'message':Lg().g(487)}
        fieldName = 'ActiveSkill_%d'%(spacePos+1)
        if self._equipActiveSkill[fieldName]!= -1:
            return {'result':False,'message':Lg().g(488)}
        result1 = self._owner.finance.addGold(-500)
        if not result1:
            msg = u'您的钻不足'
            return {'result':False,'message':msg}
        result = dbSkill.updateCharacterSkillSet(self._owner.baseInfo.id, fieldName, 0)

        if result:
            self._equipActiveSkill[fieldName] = 0
            return {'result':True,'message':Lg().g(489)}
        return {'result':False,'message':Lg().g(490)}
    def OpenBattleSpace(self, spacePos):
        '''开启战斗技能位置'''
        if spacePos not in [0, 1, 2]:
            return {'result': False, 'message': Lg().g(487)}
        fieldName = 'ActiveSkill_%d' % (spacePos + 1)
        if self._equipActiveSkill[fieldName] != -1:
            return {'result': False, 'message': Lg().g(488)}
        result1 = self._owner.finance.addGold(-500)
        if not result1:
            msg = u'您的钻不足'
            return {'result': False, 'message': msg}
        result = dbSkill.updateCharacterSkillSet(self._owner.baseInfo.id,
                                                 fieldName, 0)

        if result:
            self._equipActiveSkill[fieldName] = 0
            return {'result': True, 'message': Lg().g(489)}
        return {'result': False, 'message': Lg().g(490)}
 def updateSkillSetting(self, skillGroup, space):
     '''更新技能设置
     @param skillGroup:int 技能组的ID
     @param space: int 技能槽的位置  (1~5)主动技能槽的位置 (6~7)被动技能槽的位置
     '''
     if space < 0:
         realySpace = self.getSkillNullSpace()
     else:
         realySpace = space + 1
     if realySpace not in [1, 2, 3]:
         return {'result': False, 'message': Lg().g(480)}
     if self._equipActiveSkill.get('ActiveSkill_%d' % realySpace, -1) == -1:
         return {'result': False, 'message': Lg().g(481)}
     if self.checkSkillHasEquiped(skillGroup) and skillGroup:
         return {'result': False, 'message': Lg().g(482)}
     if not self.learned_skillpool.has_key(skillGroup) and skillGroup:
         return {'result': False, 'message': Lg().g(474)}
     if skillGroup == self.CATCHPETSKILLGROUP and not self.checkCanEquipCatchSkill(
     ):
         level = self.getCatchPetLevel()
         return {'result': False, 'message': Lg().g(483) % level}
     oldSkillGroup = self._equipActiveSkill['ActiveSkill_%d' % realySpace]
     self._equipActiveSkill['ActiveSkill_%d' % realySpace] = skillGroup
     fieldName = 'ActiveSkill_%d' % realySpace
     result = dbSkill.updateCharacterSkillSet(self._owner.baseInfo.id,\
                                               fieldName, skillGroup)
     if result:
         if skillGroup:
             self._owner.quest.specialTaskHandle(103)
             level = self.learned_skillpool[skillGroup].get('skillLevel', 0)
             nowskillInfo = dbSkill.SKILL_GROUP[skillGroup][level]
             skillname = nowskillInfo.get('skillName')
             msg = Lg().g(484) % (level, skillname)
         elif oldSkillGroup:
             oldlevel = self.learned_skillpool[oldSkillGroup].get(
                 'skillLevel', 0)
             oldkillInfo = dbSkill.SKILL_GROUP[oldSkillGroup][oldlevel]
             oldskillname = oldkillInfo.get('skillName')
             msg = Lg().g(485) % (oldlevel, oldskillname)
         else:
             return {'result': False}
         return {'result': True, 'message': msg}
     else:
         return {'result': False, 'message': Lg().g(486)}
 def updateSkillSetting(self, skillId, space):
     """更新技能设置
     @param skillId:int 技能的ID
     @param space: int 技能槽的位置  (1~5)主动技能槽的位置 (6~7)被动技能槽的位置
     """
     if self._equipActiveSkill[space] == -1:
         return {"result": False, "message": u"技能槽尚未激活"}
     if skillId not in self.learned_skillpool and skillId != 0:
         return {"result": False, "message": u"技能尚未学习"}
     try:
         self._equipActiveSkill[space] = skillId
     except Exception:
         return {"result": False, "message": u"技能设置失败"}
     fieldName = "ActiveSkill_%d" % (space + 1)
     result = dbSkill.updateCharacterSkillSet(self._owner.baseInfo.id, fieldName, skillId)
     if result:
         return {"result": True}
     else:
         return {"result": False, "message": u"技能设置失败"}
 def updateSkillSetting(self,skillGroup,space):
     '''更新技能设置
     @param skillGroup:int 技能组的ID
     @param space: int 技能槽的位置  (1~5)主动技能槽的位置 (6~7)被动技能槽的位置
     '''
     if space<0:
         realySpace = self.getSkillNullSpace()
     else:
         realySpace = space+1
     if realySpace not in [1,2,3]:
         return {'result':False,'message':Lg().g(480)}
     if self._equipActiveSkill.get('ActiveSkill_%d'%realySpace,-1)==-1:
         return {'result':False,'message':Lg().g(481)}
     if self.checkSkillHasEquiped(skillGroup) and skillGroup:
         return {'result':False,'message':Lg().g(482)}
     if  not self.learned_skillpool.has_key(skillGroup) and skillGroup:
         return {'result':False,'message':Lg().g(474)}
     if skillGroup == self.CATCHPETSKILLGROUP and not self.checkCanEquipCatchSkill():
         level = self.getCatchPetLevel()
         return {'result':False,'message':Lg().g(483)%level}
     oldSkillGroup = self._equipActiveSkill['ActiveSkill_%d'%realySpace]
     self._equipActiveSkill['ActiveSkill_%d'%realySpace] = skillGroup
     fieldName = 'ActiveSkill_%d'%realySpace
     result = dbSkill.updateCharacterSkillSet(self._owner.baseInfo.id,\
                                               fieldName, skillGroup)
     if result:
         if skillGroup:
             self._owner.quest.specialTaskHandle(103)
             level = self.learned_skillpool[skillGroup].get('skillLevel',0)
             nowskillInfo = dbSkill.SKILL_GROUP[skillGroup][level]
             skillname = nowskillInfo.get('skillName')
             msg = Lg().g(484)%(level,skillname)
         elif oldSkillGroup:
             oldlevel = self.learned_skillpool[oldSkillGroup].get('skillLevel',0)
             oldkillInfo = dbSkill.SKILL_GROUP[oldSkillGroup][oldlevel]
             oldskillname = oldkillInfo.get('skillName')
             msg = Lg().g(485)%(oldlevel,oldskillname)
         else:
             return {'result':False}
         return {'result':True,'message':msg}
     else:
         return {'result':False,'message':Lg().g(486)}