def updateLevel(self,level):
     '''更新角色当前等级
     @param level: int 等级
     '''
     from app.scense.core.PlayersManager import PlayersManager
     self._level = level
     dbCharacterPet.updatePetInfo(self._owner.baseInfo.getId(), {'level':self._level})
     player = PlayersManager().getPlayerByID(self._owner._owner)
     player.daily.noticeDaily(3,0,self._level)#通知有宠物升级
示例#2
0
 def updateLevel(self, level):
     '''更新角色当前等级
     @param level: int 等级
     '''
     from app.scense.core.PlayersManager import PlayersManager
     self._level = level
     dbCharacterPet.updatePetInfo(self._owner.baseInfo.getId(),
                                  {'level': self._level})
     player = PlayersManager().getPlayerByID(self._owner._owner)
     player.daily.noticeDaily(3, 0, self._level)  #通知有宠物升级
示例#3
0
 def updateExp(self, exp):
     '''更新当前血量'''
     state = 0
     while exp >= self.getMaxExp():
         print self.getMaxExp()
         exp = exp - self.getMaxExp()
         self.level += 1
         state = 1
     self.exp = exp
     if state:
         self.updateLevel(self.level)
     dbCharacterPet.updatePetInfo(self.baseInfo.id, {'exp': self.exp})
示例#4
0
 def updateExp(self,exp):
     '''更新当前血量'''
     state = 0
     while exp>=self.getMaxExp():
         print self.getMaxExp()
         exp = exp - self.getMaxExp()
         self.level += 1
         state = 1
     self.exp = exp
     if state:
         self.updateLevel(self.level)
     dbCharacterPet.updatePetInfo(self.baseInfo.id, {'exp':self.exp})
示例#5
0
 def updateName(self,petName):
     '''更新宠物名称'''
     prop = {'name':petName}
     result = dbCharacterPet.updatePetInfo(self.baseInfo.id, prop)
     if result:
         self.baseInfo.setName(petName)
         return 1
     return 0
示例#6
0
 def updateName(self, petName):
     '''更新宠物名称'''
     prop = {'name': petName}
     result = dbCharacterPet.updatePetInfo(self.baseInfo.id, prop)
     if result:
         self.baseInfo.setName(petName)
         return 1
     return 0
 def updateExp(self,exp):
     '''更新角色经验值
     @param exp: int 经验值
     @param status: int 表示是否及时推送升级消息
     '''
     if exp ==self._exp:
         return
     if self._level>=self.MAXLEVEL:
         return
     status = 0
     self._exp = exp
     while self._exp >= self.getMaxExp():
         self._exp -= self.getMaxExp()
         self._level += 1
         status = 1
     if status:
         self.updateLevel(self._level)
     dbCharacterPet.updatePetInfo(self._owner.baseInfo.getId(), {'exp':self._exp})
示例#8
0
 def Training(self, trainingLevel):
     '''培养
     @param trainingLevel: int 培养的级别
     '''
     prop = PetTrain(trainingLevel + 1)
     result = dbCharacterPet.updatePetInfo(self.baseInfo.id, prop)
     if result:
         for item in prop.items():
             self._extAttribute[item[0]] = item[1]
     return 1
示例#9
0
 def Training(self,trainingLevel):
     '''培养
     @param trainingLevel: int 培养的级别
     '''
     prop = PetTrain(trainingLevel+1)
     result = dbCharacterPet.updatePetInfo(self.baseInfo.id, prop)
     if result:
         for item in prop.items():
             self._extAttribute[item[0]] = item[1]
     return 1
示例#10
0
 def modifySlogan(self,slogan):
     '''更新战斗宣言
     @param slogan: string 战斗宣言
     '''
     prop = {'slogan':str(slogan)}
     result = dbCharacterPet.updatePetInfo(self.baseInfo.id, prop)
     if result:
         self._extAttribute['slogan'] = slogan
         return 1
     return 0
示例#11
0
 def updateExp(self, exp):
     '''更新角色经验值
     @param exp: int 经验值
     @param status: int 表示是否及时推送升级消息
     '''
     if exp == self._exp:
         return
     if self._level >= self.MAXLEVEL:
         return
     status = 0
     self._exp = exp
     while self._exp >= self.getMaxExp():
         self._exp -= self.getMaxExp()
         self._level += 1
         status = 1
     if status:
         self.updateLevel(self._level)
     dbCharacterPet.updatePetInfo(self._owner.baseInfo.getId(),
                                  {'exp': self._exp})
示例#12
0
 def modifySlogan(self, slogan):
     '''更新战斗宣言
     @param slogan: string 战斗宣言
     '''
     prop = {'slogan': str(slogan)}
     result = dbCharacterPet.updatePetInfo(self.baseInfo.id, prop)
     if result:
         self._extAttribute['slogan'] = slogan
         return 1
     return 0
示例#13
0
 def learnSkill(self):
     '''宠物学习(激活)技能'''
     skillSpace = self.foundSkillSpace()
     if not skillSpace:
         return -1  #技能槽已满
     newskill = getRandomPetSkill()
     self._skillInfo.append(newskill)
     prop = {skillSpace: newskill}
     result = dbCharacterPet.updatePetInfo(self.baseInfo.id, prop)
     if result:
         return 1, newskill
     return 0, newskill
示例#14
0
 def learnSkill(self):
     '''宠物学习(激活)技能'''
     skillSpace = self.foundSkillSpace()
     if not skillSpace:
         return -1#技能槽已满
     newskill = getRandomPetSkill()
     self._skillInfo.append(newskill)
     prop = {skillSpace:newskill}
     result = dbCharacterPet.updatePetInfo(self.baseInfo.id, prop)
     if result:
         return 1,newskill
     return 0,newskill
 def Tihuan(self):
     '''宠物属性替换'''
     self.StrGrowth += self.StrGrowthAdd
     self.WisGrowth += self.WisGrowthAdd
     self.DexGrowth += self.DexGrowthAdd
     self.VitGrowth += self.VitGrowthAdd
     props = {}
     if self.StrGrowthAdd:
         props['StrGrowth'] = self.StrGrowth
     if self.StrGrowthAdd:
         props['WisGrowth'] = self.WisGrowth
     if self.StrGrowthAdd:
         props['DexGrowth'] = self.DexGrowth
     if self.StrGrowthAdd:
         props['VitGrowth'] = self.VitGrowth
     if props:
         dbCharacterPet.updatePetInfo(self._owner.baseInfo.id, props)
     self.StrGrowthAdd = 0
     self.WisGrowthAdd = 0
     self.DexGrowthAdd = 0
     self.VitGrowthAdd = 0
     return {'result':True,'message':Lg().g(269)}
 def Tihuan(self):
     '''宠物属性替换'''
     self.StrGrowth += self.StrGrowthAdd
     self.WisGrowth += self.WisGrowthAdd
     self.DexGrowth += self.DexGrowthAdd
     self.VitGrowth += self.VitGrowthAdd
     props = {}
     if self.StrGrowthAdd:
         props['StrGrowth'] = self.StrGrowth
     if self.StrGrowthAdd:
         props['WisGrowth'] = self.WisGrowth
     if self.StrGrowthAdd:
         props['DexGrowth'] = self.DexGrowth
     if self.StrGrowthAdd:
         props['VitGrowth'] = self.VitGrowth
     if props:
         dbCharacterPet.updatePetInfo(self._owner.baseInfo.id, props)
     self.StrGrowthAdd = 0
     self.WisGrowthAdd = 0
     self.DexGrowthAdd = 0
     self.VitGrowthAdd = 0
     return {'result': True, 'message': Lg().g(269)}
示例#17
0
 def levelUpSkill(self, skillSpace):
     '''升级宠物技能
     @param skillSpace: int 技能的位置
     '''
     if 0 > skillSpace or len(self._skillInfo) <= skillSpace:
         return -2  #超过位置范围
     skillId = self._skillInfo[skillSpace]
     skillInfo = dbCharacterPet.PET_SKILL_POOL.get(skillId)
     if not skillInfo:
         return -1  #技能信息不存在
     groupId = skillInfo.get('skillGroup')  #技能组ID
     level = skillInfo.get('level')  #技能等级
     newskillInfo = dbCharacterPet.PET_SKILLGROUP[groupId].get(level + 1)
     if newskillInfo:
         propname = 'skill_%d' % (skillSpace + 1)
         newSkillId = newskillInfo.get('skillID')
         prop = {propname: newSkillId}
         result = dbCharacterPet.updatePetInfo(self.baseInfo.id, prop)
         if result:
             self._skillInfo[skillSpace] = newSkillId
             return 1  #成功
         else:
             return -3  #数据库写入出错
     return 0  #技能达到最高等级
示例#18
0
 def levelUpSkill(self,skillSpace):
     '''升级宠物技能
     @param skillSpace: int 技能的位置
     '''
     if  0 > skillSpace or len(self._skillInfo) <= skillSpace:
         return -2#超过位置范围
     skillId = self._skillInfo[skillSpace]
     skillInfo = dbCharacterPet.PET_SKILL_POOL.get(skillId)
     if not skillInfo:
         return -1#技能信息不存在
     groupId = skillInfo.get('skillGroup')#技能组ID
     level = skillInfo.get('level')#技能等级
     newskillInfo = dbCharacterPet.PET_SKILLGROUP[groupId].get(level+1)
     if newskillInfo:
         propname = 'skill_%d'%(skillSpace+1)
         newSkillId = newskillInfo.get('skillID')
         prop = {propname:newSkillId}
         result = dbCharacterPet.updatePetInfo(self.baseInfo.id, prop)
         if result:
             self._skillInfo[skillSpace] = newSkillId
             return 1#成功
         else:
             return -3#数据库写入出错
     return 0#技能达到最高等级
示例#19
0
 def update_ChuanCheng(self):
     '''更新该宠物已经被传承
     '''
     self._chuancheng = True
     prop = {'_chuancheng': 1}
     dbCharacterPet.updatePetInfo(self.baseInfo.id, prop)
示例#20
0
 def update_ChuanCheng(self):
     '''更新该宠物已经被传承
     '''
     self._chuancheng = True
     prop = {'_chuancheng':1}
     dbCharacterPet.updatePetInfo(self.baseInfo.id, prop)
示例#21
0
 def updateFlowFlag(self, flowFlag):
     '''更新跟随状态'''
     self.flowFlag = flowFlag
     dbCharacterPet.updatePetInfo(self.baseInfo.id, {'showed': flowFlag})
示例#22
0
 def updateHp(self, hp):
     '''更新当前血量'''
     self.setHp(hp)
     dbCharacterPet.updatePetInfo(self.baseInfo.id, {'hp': self.hp})
示例#23
0
 def updateLifeState(self, lifestate):
     '''设置生存状态'''
     self.lifestate = lifestate
     dbCharacterPet.updatePetInfo(self.baseInfo.id,
                                  {'lifestate': lifestate})
示例#24
0
 def updateLevel(self, level):
     '''更新宠物的等级'''
     self.level = level
     dbCharacterPet.updatePetInfo(self.baseInfo.id, {'level': level})
示例#25
0
 def updateLevel(self,level):
     '''更新宠物的等级'''
     self.level = level
     dbCharacterPet.updatePetInfo(self.baseInfo.id, {'level':level})
示例#26
0
 def updateLifeState(self,lifestate):
     '''设置生存状态'''
     self.lifestate = lifestate
     dbCharacterPet.updatePetInfo(self.baseInfo.id, {'lifestate':lifestate})
示例#27
0
 def updateFlowFlag(self,flowFlag):
     '''更新跟随状态'''
     self.flowFlag = flowFlag
     dbCharacterPet.updatePetInfo(self.baseInfo.id, {'showed':flowFlag})
示例#28
0
 def updateHp(self,hp):
     '''更新当前血量'''
     self.setHp(hp)
     dbCharacterPet.updatePetInfo(self.baseInfo.id, {'hp':self.hp})