Exemple #1
0
    def initPlayerInfo(self):
        '''初始化角色信息'''
        pid = self.baseInfo.id
        pmmode = tb_character_admin.getObj(pid)
        data = pmmode.get("data")
        if not data:
            print "Inint_player _" + str(self.baseInfo.id)
        #------------初始化角色基础信息组件---------
        self.baseInfo.setType(data['viptype'])  #角色VIP类型
        self.baseInfo.setnickName(data['nickname'])  #角色昵称
        self.profession.setProfession(data['profession'])
        self.profession.setFigure(data['figure'])
        #------------初始化角色经验等级组件-----------
        self.level.setLevel(data['level'])
        self.level.setExp(data['exp'])
        self.level.setVipExp(data['vipexp'])
        #------------初始化角色属性信息组件-----------
        self.attribute.initEnergy(data['energy'])

        #------------初始化角色资产信息组件-------------
        self.finance.setCoin(data['coin'])
        self.finance.setGold(data['gold'])
        #------------初始化角色武将信息组件-------------
        self.pet.initCharacterPetInfo()
        #---------------初始化包裹---------------
        self.pack.initPack(packageSize=data['packageSize'])
        #-----------初始化角色好友数量------------------
        self.attribute.setHp(data['hp'])
 def initPlayerInfo(self):
     '''初始化角色信息'''
     pid = self.baseInfo.id
     pmmode = tb_character_admin.getObj(pid)
     data = pmmode.get("data")
     if not data:
         print "Inint_player _"+str(self.baseInfo.id)
     #------------初始化角色基础信息组件---------
     self.baseInfo.setType(data['viptype'])  #角色VIP类型
     self.baseInfo.setnickName(data['nickname']) #角色昵称
     self.profession.setProfession(data['profession'])
     self.profession.setFigure(data['figure'])
     #------------初始化角色经验等级组件-----------
     self.level.setLevel(data['level'])
     self.level.setExp(data['exp'])
     self.level.setVipExp(data['vipexp'])
     #------------初始化角色属性信息组件-----------
     self.attribute.initEnergy(data['energy'])
     
     #------------初始化角色资产信息组件-------------
     self.finance.setCoin(data['coin'])
     self.finance.setGold(data['gold'])
     #---------------初始化包裹---------------
     self.pack.initPack(packageSize=data['packageSize'])
     #-----------初始化角色好友数量------------------
     self.attribute.setHp(data['hp'])
 def updatePlayerDBInfo(self):
     '''更新角色在数据库中的数据'''
     pid = self.baseInfo.id
     pmmode = tb_character_admin.getObj(pid)
     mapping = {'level':self.level.getLevel(),'coin':self.finance.getCoin(),
                'gold':self.finance.getGold(),'exp':self.level.getExp(),
                'energy':self.attribute.getEnergy()}
     pmmode.update_multi(mapping)
     self.pack._equipmentSlot.updateEquipments(self.baseInfo.id)
 def updatePlayerDBInfo(self):
     '''更新角色在数据库中的数据'''
     pid = self.baseInfo.id
     pmmode = tb_character_admin.getObj(pid)
     mapping = {
         'level': self.level.getLevel(),
         'coin': self.finance.getCoin(),
         'gold': self.finance.getGold(),
         'exp': self.level.getExp(),
         'energy': self.attribute.getEnergy()
     }
     pmmode.update_multi(mapping)
     self.pack._equipmentSlot.updateEquipments(self.baseInfo.id)