示例#1
0
def getSegmentRooms(gameId, userId, clientId):
    ret = []
    sessions = hallconf.getHallSessionInfo(gameId, clientId)
    for session in sessions:
        if session.get('segment') == 1:
            return session['rooms']
    return ret
示例#2
0
    def _getQuickStartRoomList(cls, userId, playMode):
        ''' 获取快开房间列表 '''
        clientId = sessiondata.getClientId(userId)
        sessions = hallconf.getHallSessionInfo(DIZHU_GAMEID, clientId)
        sessionRoomInfoList = []
        for session in sessions:
            if session.get('playMode') == playMode:
                for room in session.get('rooms', []):
                    bigRoomId = room.get('id')
                    segment = room.get('segment')
                    ctrlRoomId = bigRoomId * 10000 + 1000
                    mixId = room.get('mixId')
                    roomConfig = cls._getRoomConfigure(ctrlRoomId, mixId)
                    sessionRoomInfoList.append({
                        'bigRoomId': bigRoomId,
                        'ctrlRoomId': ctrlRoomId,
                        'mixId': mixId,
                        'roomConfig': roomConfig,
                        'segment': segment})
                break

        # 房间过滤排序
        if playMode == 'match':
            sessionRoomInfoList.sort(key=lambda x: x['roomConfig'].get('minQuickStartDiamond'))
        else:
            sessionRoomInfoList.sort(key=lambda x: x['roomConfig'].get('minQuickStartChip'))

        if ftlog.is_debug():
            ftlog.debug('DizhuQuickStartWx._getQuickStartRoomList',
                        'userId=', userId,
                        'playMode=', playMode,
                        'sessionRoomInfoList=', sessionRoomInfoList)
        return sessionRoomInfoList
示例#3
0
 def doHallInfo(self, userId, gameId, clientId):
     roominfos = hallconf.getHallSessionInfo(gameId, clientId)
     msg = MsgPack()
     msg.setCmd('hall_info')
     msg.setResult('gameId', gameId)
     msg.setResult('userId', userId)
     msg.setResult('sessions', roominfos)
     router.sendToUser(msg, userId)
示例#4
0
 def doHallInfo(self, userId, gameId, clientId):
     roominfos = hallconf.getHallSessionInfo(gameId, clientId)
     msg = MsgPack()
     msg.setCmd('hall_info')
     msg.setResult('gameId', gameId)
     msg.setResult('userId', userId)
     msg.setResult('sessions', roominfos)
     router.sendToUser(msg, userId)
示例#5
0
def getMatchSessionName(gameId, clientId, bigRoomId):
    sessions = hallconf.getHallSessionInfo(gameId, clientId)
    for session in sessions:
        if session.get('match') == 1:
            for room in session.get('rooms', []):
                if room.get('id') == bigRoomId:
                    return room.get('name', '')
    return ''
示例#6
0
def getMatchSessionRankRewards(gameId, clientId, bigRoomId):
    sessions = hallconf.getHallSessionInfo(gameId, clientId)
    for session in sessions:
        if session.get('match') == 1:
            for room in session.get('rooms', []):
                if room.get('id') == bigRoomId:
                    return room.get('rank.rewards', [])
    return []
示例#7
0
def getWechatMatchRooms(gameId, userId, clientId):
    ret = []
    roomInfoMap = loadAllRoomInfo(gameId)
    timestamp = pktimestamp.getCurrentTimestamp()
    sessions = hallconf.getHallSessionInfo(gameId, clientId)
    for session in sessions:
        if session.get('match') == 1:
            return filterMatchSession(gameId, userId, clientId, roomInfoMap,
                                      session, timestamp)['rooms']
    return ret
示例#8
0
def getSessions(gameId, userId, clientId):
    ret = []
    roomInfoMap = loadAllRoomInfo(gameId)
    timestamp = pktimestamp.getCurrentTimestamp()
    sessions = hallconf.getHallSessionInfo(gameId, clientId)
    for session in sessions:
        session = filterSession(gameId, userId, clientId, roomInfoMap, session,
                                timestamp)
        if session:
            ret.append(session)
    return ret
示例#9
0
 def getMatchSessionRoomIds(cls, userId):   # 提审用
     clientId = sessiondata.getClientId(userId)
     sessions = hallconf.getHallSessionInfo(DIZHU_GAMEID, clientId)
     matchSession = {}
     matchSessionRoomIds = []
     for session in sessions:
         if session.get('match') == 1:
             matchSession = session
             break
     for room in matchSession.get('rooms', []):
         roomId = room.get('id')
         matchSessionRoomIds.append(roomId)
     return matchSessionRoomIds