def updateMp(self,mp): '''更新角色魔力值 ''' maxmp = self.getMaxMp() if mp>maxmp: mp = maxmp elif mp<0: mp=0 self._mp = mp dbaccess.updateCharacter(self._owner.baseInfo.id, 'mp', mp)
def updateLevel(self,level): '''更新角色当前等级 @param level: int 等级 ''' from app.scense.serverconfig.chatnode import chatnoderemote self._level = level self._owner.quest.pushPlayerQuestProcessList() self._owner.daily.noticeDaily(1,0,level)#升级通知每日目标 chatnoderemote.callRemote('updateCharteLevel',self._owner.baseInfo.id,level)#同步聊天角色中的等级 dbaccess.updateCharacter(self._owner.baseInfo.id, 'level', level)
def updateLevel(self, level): '''更新角色当前等级 @param level: int 等级 ''' from app.scense.serverconfig.chatnode import chatnoderemote self._level = level self._owner.quest.pushPlayerQuestProcessList() self._owner.daily.noticeDaily(1, 0, level) #升级通知每日目标 chatnoderemote.callRemote('updateCharteLevel', self._owner.baseInfo.id, level) #同步聊天角色中的等级 dbaccess.updateCharacter(self._owner.baseInfo.id, 'level', level)
def updateGold(self,gold,state=1): delta = self._gold - gold if not delta: return if delta<0: msg = Lg().g(314)%abs(delta) else: msg = Lg().g(315)%abs(delta) if delta>0: self._owner.quest.UseGold(delta) self._gold = gold dbaccess.updateCharacter(self._owner.baseInfo.id, 'gold', gold) pushObjectNetInterface.pushUpdatePlayerInfo(self._owner.getDynamicId()) if state: if msg: pushPromptedMessage(msg, [self._owner.getDynamicId()]) else: self._owner.msgbox.putFightMsg(msg)#将消息加入战后消息处理中
def updateGold(self, gold, state=1): delta = self._gold - gold if not delta: return if delta < 0: msg = Lg().g(314) % abs(delta) else: msg = Lg().g(315) % abs(delta) if delta > 0: self._owner.quest.UseGold(delta) self._gold = gold dbaccess.updateCharacter(self._owner.baseInfo.id, 'gold', gold) pushObjectNetInterface.pushUpdatePlayerInfo(self._owner.getDynamicId()) if state: if msg: pushPromptedMessage(msg, [self._owner.getDynamicId()]) else: self._owner.msgbox.putFightMsg(msg) #将消息加入战后消息处理中
def updateVIPExp(self,exp): '''添加VIP经验 ''' if exp ==self._vipexp: return status = 0 if self._owner.baseInfo._viptype>=self.MAXVIP:#判断是否超过最大VIP等级 return self._vipexp = exp while self._vipexp >= self.getVipMaxExp(): self._vipexp -= self.getVipMaxExp() self._owner.baseInfo._viptype += 1 status = 1 if self._owner.baseInfo._viptype>=self.MAXVIP: break if status: self._owner.baseInfo.updateType(self._owner.baseInfo._viptype) self._owner.pushInfoChanged() dbaccess.updateCharacter(self._owner.baseInfo.id, 'vipexp', self._vipexp)
def updateVIPExp(self, exp): '''添加VIP经验 ''' if exp == self._vipexp: return status = 0 if self._owner.baseInfo._viptype >= self.MAXVIP: #判断是否超过最大VIP等级 return self._vipexp = exp while self._vipexp >= self.getVipMaxExp(): self._vipexp -= self.getVipMaxExp() self._owner.baseInfo._viptype += 1 status = 1 if self._owner.baseInfo._viptype >= self.MAXVIP: break if status: self._owner.baseInfo.updateType(self._owner.baseInfo._viptype) self._owner.pushInfoChanged() dbaccess.updateCharacter(self._owner.baseInfo.id, 'vipexp', self._vipexp)
def updateType(self ,viptype):#更新对应的值并修改数据库 self._viptype = viptype dbaccess.updateCharacter(self.id,'viptype', viptype)
def updateLocation(self): '''更新场景''' dbaccess.updateCharacter(self.id,'location', self._location)
def updateLifeStatus(self, lifeStatus): self._lifeStatus = lifeStatus dbaccess.updateCharacter(self._owner.baseInfo.id, 'lifeStatus', lifeStatus)
def updateLifeStatus(self,lifeStatus): self._lifeStatus = lifeStatus dbaccess.updateCharacter(self._owner.baseInfo.id, 'lifeStatus', lifeStatus)
def updateType(self, viptype): #更新对应的值并修改数据库 self._viptype = viptype dbaccess.updateCharacter(self.id, 'viptype', viptype)
def updateLocation(self): '''更新场景''' dbaccess.updateCharacter(self.id, 'location', self._location)
def updateTown(self): '''更新所属城镇''' dbaccess.updateCharacter(self.id, 'town', self._town)
def updateDescription(self, pronouncement): self._pronouncement = pronouncement dbaccess.updateCharacter(self.id, 'pronouncement', pronouncement)
def updateCoupon(self, coupon): self._coupon = coupon msg = u'消耗礼券%d' % (coupon - self._coin) dbaccess.updateCharacter(self._owner.baseInfo.id, 'coupon', coupon) pushPromptedMessage(msg, [self._owner.getDynamicId()])
def updateDescription(self ,pronouncement): self._pronouncement = pronouncement dbaccess.updateCharacter(self.id, 'pronouncement', pronouncement)
def updateCoupon(self,coupon): self._coupon = coupon msg = u'消耗礼券%d'%(coupon-self._coin) dbaccess.updateCharacter(self._owner.baseInfo.id, 'coupon', coupon) pushPromptedMessage(msg, [self._owner.getDynamicId()])
def updateTown(self ): '''更新所属城镇''' dbaccess.updateCharacter(self.id,'town',self._town)