示例#1
0
    def _load(self):
        if self.__scenes is None:
            if not self.__loading:
                self.__loading = True
                gsattribs = yield GSAttribute.load(self.cid, GSSceneMgr._table)
                # 注意在收到返回消息后才能赋值
                self.__scenes = {}
                for gsattrib in gsattribs.itervalues():
                    if self.__scenes.has_key(gsattrib.scene_id):
                        _scene_data = self.__scenes[gsattrib.scene_id]
                        _scene_data[gsattrib.dungeon_id] = gsattrib
                    else:
                        _scene_data = {gsattrib.dungeon_id: gsattrib}
                        self.__scenes[gsattrib.scene_id] = _scene_data
                    self.total_star += gsattrib.dungeon_star
                    if gsattrib.scene_id > self.max_scene_id:
                        self.max_scene_id = gsattrib.scene_id

                for d in self.__defers:
                    d.callback(True)

                self.__loading = False
                self.__defers = []
            else:
                d = defer.Deferred()
                self.__defers.append(d)
                yield d
示例#2
0
    def _load(self):
        if self.__gsattribs is None:
            if not self.__loading:
                self.__loading = True
                #log.info('For Test. load. self.__gsattribs is None.')
                self.__gsattribs = yield GSAttribute.load( self.cid, GSBagEquipMgr._table )
                for gsattrib in self.__gsattribs.itervalues():
                    # 获取阵容中的装备信息
                    if gsattrib.camp_id > 0:
                        if gsattrib.camp_id in self.__camp_position:
                            _camp_equip = self.__camp_position[gsattrib.camp_id]
                        else:
                            _camp_equip = {}
                            self.__camp_position[gsattrib.camp_id] = _camp_equip
                        if not _camp_equip.has_key(gsattrib.position_id):
                            _camp_equip[gsattrib.position_id] = gsattrib.attrib_id

                for d in self.__defers:
                    d.callback(True)

                self.__loading = False
                self.__defers  = []
            else:
                d = defer.Deferred()
                self.__defers.append(d)
                yield d
示例#3
0
    def _load(self):
        if self.__gsattribs is None:
            if not self.__loading:
                self.__loading = True
                self.__gsattribs = yield GSAttribute.load( self.cid, GSBagTreasureMgr._table )

                # 获取阵容中的宝物信息
                for gsattrib in self.__gsattribs.itervalues():
                    if gsattrib.camp_id > 0:
                        if self.__camp_position.has_key( gsattrib.camp_id ):
                            _camp_treasure = self.__camp_position[gsattrib.camp_id]
                        else:
                            _camp_treasure = {}
                            self.__camp_position[gsattrib.camp_id] = _camp_treasure
                        if not _camp_treasure.has_key(gsattrib.position_id):
                            _camp_treasure[gsattrib.position_id] = gsattrib.attrib_id

                for d in self.__defers:
                    d.callback(True)

                self.__loading = False
                self.__defers  = []
            else:
                d = defer.Deferred()
                self.__defers.append(d)
                yield d
示例#4
0
    def _load(self):
        if self.__gsattribs is None:
            if not self.__loading:
                self.__loading = True
                self.__gsattribs = yield GSAttribute.load(
                    self.cid, GSBagJadeMgr._table)
                for gsattrib in self.__gsattribs.itervalues():
                    # 获取阵容中的玉魄信息
                    if gsattrib.camp_id > 0:
                        # 异常数据
                        if gsattrib.position_id < 1:
                            gsattrib.camp_id = 0

                # 获取鉴玉当前等级
                _level = yield redis.hget(HASH_RANDOM_JADE_LEVEL, self.cid)
                self.random_jade_level = int(_level) if _level else 1

                for d in self.__defers:
                    d.callback(True)

                self.__loading = False
                self.__defers = []
            else:
                d = defer.Deferred()
                self.__defers.append(d)
                yield d
示例#5
0
    def _load(self):
        if self.__scenes is None:
            if not self.__loading:
                self.__loading = True
                gsattribs     = yield GSAttribute.load( self.cid, GSSceneMgr._table )
                # 注意在收到返回消息后才能赋值
                self.__scenes = {}
                for gsattrib in gsattribs.itervalues():
                    if self.__scenes.has_key( gsattrib.scene_id ):
                        _scene_data = self.__scenes[gsattrib.scene_id]
                        _scene_data[gsattrib.dungeon_id] = gsattrib
                    else:
                        _scene_data = {gsattrib.dungeon_id: gsattrib}
                        self.__scenes[gsattrib.scene_id] = _scene_data
                    self.total_star += gsattrib.dungeon_star
                    if gsattrib.scene_id > self.max_scene_id:
                        self.max_scene_id = gsattrib.scene_id

                for d in self.__defers:
                    d.callback(True)

                self.__loading = False
                self.__defers  = []
            else:
                d = defer.Deferred()
                self.__defers.append(d)
                yield d
示例#6
0
    def _load(self):
        if self.__gsattribs is None:
            if not self.__loading:
                self.__loading = True
                self.__gsattribs = yield GSAttribute.load(
                    self.cid, GSBagTreasureMgr._table)

                # 获取阵容中的宝物信息
                for gsattrib in self.__gsattribs.itervalues():
                    if gsattrib.camp_id > 0:
                        if self.__camp_position.has_key(gsattrib.camp_id):
                            _camp_treasure = self.__camp_position[
                                gsattrib.camp_id]
                        else:
                            _camp_treasure = {}
                            self.__camp_position[
                                gsattrib.camp_id] = _camp_treasure
                        if not _camp_treasure.has_key(gsattrib.position_id):
                            _camp_treasure[
                                gsattrib.position_id] = gsattrib.attrib_id

                for d in self.__defers:
                    d.callback(True)

                self.__loading = False
                self.__defers = []
            else:
                d = defer.Deferred()
                self.__defers.append(d)
                yield d
    def _load(self):
        if self.__gsattribs is None:
            if not self.__loading:
                self.__loading = True
                self.__gsattribs = yield GSAttribute.load( self.cid, GSBagTreasureShardMgr._table )

                for d in self.__defers:
                    d.callback(True)

                self.__loading = False
                self.__defers  = []
            else:
                d = defer.Deferred()
                self.__defers.append(d)
                yield d
    def _load(self):
        if self.__gsattribs is None:
            if not self.__loading:
                self.__loading = True
                self.__gsattribs = yield GSAttribute.load(
                    self.cid, GSBagTreasureShardMgr._table)

                for d in self.__defers:
                    d.callback(True)

                self.__loading = False
                self.__defers = []
            else:
                d = defer.Deferred()
                self.__defers.append(d)
                yield d
示例#9
0
    def _load(self):
        if self.__gsattribs is None:
            if not self.__loading:
                self.__loading = True
                #log.info('For Test. load. self.__gsattribs is None.')
                self.__gsattribs = yield GSAttribute.load( self.cid, GSFellowMgr._table )
                for attrib in self.__gsattribs.itervalues():
                    self.initialize( attrib )

                for d in self.__defers:
                    d.callback(True)

                self.__loading = False
                self.__defers  = []
            else:
                d = defer.Deferred()
                self.__defers.append(d)
                yield d
示例#10
0
    def _load(self):
        if self.__gsattribs is None:
            if not self.__loading:
                self.__loading = True
                #log.info('For Test. load. self.__gsattribs is None.')
                self.__gsattribs = yield GSAttribute.load(
                    self.cid, GSFellowMgr._table)
                for attrib in self.__gsattribs.itervalues():
                    self.initialize(attrib)

                for d in self.__defers:
                    d.callback(True)

                self.__loading = False
                self.__defers = []
            else:
                d = defer.Deferred()
                self.__defers.append(d)
                yield d
示例#11
0
    def _load(self):
        '''
        data format: {fellow_id: gsattrib, ...}
        '''
        if self.__goodwills is None:
            if not self.__loading:
                self.__loading = True
                gsattribs = yield GSAttribute.load(self.cid,
                                                   GSGoodwillMgr._table)
                # 注意在收到返回消息后才能赋值
                self.__goodwills = OrderedDict()
                first_gsattrib = None

                for gsattrib in gsattribs.itervalues():
                    if first_gsattrib is None:
                        first_gsattrib = gsattrib
                    if self.__goodwills.has_key(gsattrib.fellow_id):
                        continue
                    self.__goodwills[gsattrib.fellow_id] = gsattrib

                    if gsattrib.last_gift:
                        if self.last_fellow_id > 0:
                            gsattrib.last_gift = 0
                        else:
                            self.last_fellow_id = gsattrib.fellow_id

                    self.total_goodwill_level += gsattrib.goodwill_level

                if first_gsattrib and not self.last_fellow_id:
                    self.last_fellow_id = first_gsattrib.fellow_id

                for d in self.__defers:
                    d.callback(True)

                self.__loading = False
                self.__defers = []
            else:
                d = defer.Deferred()
                self.__defers.append(d)
                yield d
示例#12
0
    def _load(self):
        '''
        data format: {fellow_id: gsattrib, ...}
        '''
        if self.__goodwills is None:
            if not self.__loading:
                self.__loading = True
                gsattribs = yield GSAttribute.load(self.cid, GSGoodwillMgr._table)
                # 注意在收到返回消息后才能赋值
                self.__goodwills = OrderedDict()
                first_gsattrib   = None

                for gsattrib in gsattribs.itervalues():
                    if first_gsattrib is None:
                        first_gsattrib = gsattrib
                    if self.__goodwills.has_key( gsattrib.fellow_id ):
                        continue
                    self.__goodwills[gsattrib.fellow_id] = gsattrib

                    if gsattrib.last_gift:
                        if self.last_fellow_id > 0:
                            gsattrib.last_gift = 0
                        else:
                            self.last_fellow_id = gsattrib.fellow_id

                    self.total_goodwill_level += gsattrib.goodwill_level

                if first_gsattrib and not self.last_fellow_id:
                    self.last_fellow_id = first_gsattrib.fellow_id

                for d in self.__defers:
                    d.callback(True)

                self.__loading = False
                self.__defers  = []
            else:
                d = defer.Deferred()
                self.__defers.append(d)
                yield d