예제 #1
0
def updateUtilMatchStatus(match_count, userId):
    if util_match_map.has_key(match_count):
        util_match_map[match_count][userId] = 1
        start = 1
        userId_b = 0
        for uid, status in util_match_map[match_count].items():
            if _DEBUG:
                debug("IN updateUtilMatchStatus @@@ in LOOP:  userId = ", userId, " status = ", status)
            if status == 0:
                start = 0
                break
            if uid != userId:
                userId_b = uid
                if _DEBUG:
                    debug("IN updateUtilMatchStatus @@@ userId_b = ", userId_b)

        if start == 1:
            #随机取出roomId
            roomid_key = choice(tyglobal.bigRoomIdsMap().keys())
            roomid = choice(tyglobal.bigRoomIdsMap()[roomid_key])
            #随机取出shadowRoomId
            allrooms = tyglobal.roomIdDefineMap()
            shadowRoomId = choice(allrooms[roomid].shadowRoomIds)
            if _DEBUG:
                debug("IN updateUtilMatchStatus @@@ roomid = ", roomid, " shadowRoomId = ", shadowRoomId,
                      "userId_a =", userId, "userId_b =", userId_b)

            gameRpcRoomOne.srvtable.doCreateNewTable(shadowRoomId, userId, userId_b)
예제 #2
0
 def buildMasterAndArea(self):
     ftlog.info('StageMatchRoomMixin.buildMaster'
                'roomId=', self.roomId, 'masterRoomId=', self.masterRoomId,
                'isMaster=', self.isMaster, 'bigmatchId=', self.bigmatchId)
     master = MatchMaster(self, self.bigmatchId, self.conf)
     area = MatchArea(self, self.bigmatchId, self.conf,
                      MatchMasterStubLocal(master))
     master.addAreaStub(MatchAreaStubLocal(master, area))
     if not self.conf.startConf.isUserCountType():
         ctrlRoomIdList = tyglobal.bigRoomIdsMap().get(self.bigRoomId, [])
         for ctrlRoomId in ctrlRoomIdList:
             if ctrlRoomId != area.roomId:
                 master.addAreaStub(MatchAreaStubRemote(master, ctrlRoomId))
     return master, area
예제 #3
0
def fetchAllRoomInfos(uid, gid, playMode):
    '''
    获取所有的现金桌房间信息
    '''
    if _DEBUG:
        debug('fetchAllRoomInfos->', uid, gid, playMode)
    roomInfos = []
    if playMode:
        ucount_infos = tybireport.getRoomOnLineUserCount(gid, True)
        bigRoomIds = tyglobal.bigRoomIdsMap().keys()
        bigRoomIds.sort()

        if _DEBUG:
            debug('bigRoomIds->', uid, gid, bigRoomIds)

        for bigRoomId in bigRoomIds:
            roomDef = tyconfig.getRoomDefine(bigRoomId)
            roomConfig = roomDef.configure
            if roomConfig.get('playMode', None) == playMode \
                and (not roomConfig.get('ismatch', 0)) \
                and (not roomConfig.get(MFTDefine.IS_CREATE, 0)):
                # 有playMode 非比赛 非自建桌
                roomDesc = {}
                roomDesc["play_mode"] = roomConfig["playMode"]
                roomDesc["min_coin"] = roomConfig[MTDefine.MIN_COIN]
                roomDesc["max_coin"] = roomConfig[MTDefine.MAX_COIN]
                roomDesc["max_table_coin"] = roomConfig.get(
                    MTDefine.MAX_TABLE_COIN, roomDesc["max_coin"])
                roomDesc["base_chip"] = roomConfig["tableConf"]["base_chip"]
                roomDesc["service_fee"] = roomConfig["tableConf"][
                    "service_fee"]
                roomDesc["maima"] = roomConfig["tableConf"].get("maima", 0)
                roomDesc["macount"] = roomConfig["tableConf"].get("macount", 0)
                roomDesc["laizi"] = roomConfig["tableConf"].get("laizi", 0)
                roomNameDesc = roomConfig['name']
                roomTaskDesc = roomConfig['tableConf'][
                    'taskDesc'] if 'taskDesc' in roomConfig['tableConf'] else ''
                playerCount = ucount_infos[1].get(str(roomDef.bigRoomId), 0)
                ftlog.debug('ucount_infos:', ucount_infos[1], ' bigRoomId:',
                            roomDef.bigRoomId, ' playerCount:', playerCount)

                roomInfos.append([
                    bigRoomId, playerCount, roomNameDesc, roomTaskDesc, "",
                    roomDesc
                ])
    return roomInfos
예제 #4
0
    def buildStageMatch(self):
        ctrlRoomIdList = tyglobal.bigRoomIdsMap().get(self.bigRoomId, [])
        if self.conf.startConf.isUserCountType():
            self.conf.startConf.userMaxCountPerMatch = self.conf.startConf.userMaxCount
            self.conf.startConf.signinMaxCount = self.conf.startConf.signinMaxCount
        else:
            self.conf.startConf.userMaxCountPerMatch = int(
                self.conf.startConf.userMaxCount / max(len(ctrlRoomIdList), 1))
            self.conf.startConf.signinMaxCountPerMatch = int(
                self.conf.startConf.signinMaxCount /
                max(len(ctrlRoomIdList), 1))

        master = None
        if self.isMaster:
            master, area = self.buildMasterAndArea()
        else:
            area = self.buildAreaOnly()

        ftlog.info('StageMatchRoomMixin.buildMatch roomId=', self.roomId,
                   'ctrlRoomIdList=', ctrlRoomIdList, 'ctrlRoomCount=',
                   len(ctrlRoomIdList), 'userMaxCount=',
                   self.conf.startConf.userMaxCount, 'signinMaxCount=',
                   self.conf.startConf.signinMaxCount)
        if master:
            master.matchStatusDao = StageMatchStatusDaoRedis()

        # 默认空实现,会被PokerMatchTableController覆盖
        area.tableController = self.tableController or MatchTableController()
        # 默认空实现,会被PokerMatchPlayerNotifier覆盖
        area.playerNotifier = self.playerNotifier or MatchPlayerNotifier()
        # 默认空实现,会被MatchRankRewardsIFStage覆盖
        area.matchRankRewardsIF = self.matchRankRewardsIF or MatchRankRewardsIF(
        )
        area.matchPlayerIF = self.matchPlayerIF or MatchPlayerIFDefault()
        area.matchSigninFeeIF = self.matchSigninFeeIF or MatchSigninFeeIFDefaut(
        )
        area.signinRecordDao = self.signinRecordDao or MatchSigninRecordDaoRedis(
        )

        return area, master
예제 #5
0
 def getMasterRoomId(self):
     if self.conf.startConf.isUserCountType():
         return self.roomId
     ctrlRoomIdList = sorted(tyglobal.bigRoomIdsMap().get(
         self.bigRoomId, []))
     return ctrlRoomIdList[0]