Пример #1
0
 def doGetCreateTableRecord(self, userId, gameId, clientId):
     """全量请求牌桌记录
     """
     MJCreateTableRecord.sendAllRecordToUser(userId, gameId)
     if router.isQuery():
         mo = runcmd.newOkMsgPack(1)
         router.responseQurery(mo, '', str(userId))
Пример #2
0
 def doRoomQuickStart(self, roomId, tableId0, userId):
     msg = runcmd.getMsgPack()
     ftlog.debug('msg=', msg, caller=self)
     gdata.rooms()[roomId].doQuickStart(msg)
     if router.isQuery():
         mo = runcmd.newOkMsgPack(1)
         router.responseQurery(mo, '', str(userId))
Пример #3
0
 def doRoomQuickStart(self, roomId, userId):
     msg = runcmd.getMsgPack()
     ftlog.debug('msg=', msg, caller=self)
     gdata.rooms()[roomId].doQuickStart(msg)
     if router.isQuery():
         mo = runcmd.newOkMsgPack(1)
         router.responseQurery(mo, '', str(userId))
Пример #4
0
 def doTableLeave(self, userId, roomId, tableId, clientId):
     msg = runcmd.getMsgPack()
     room = gdata.rooms()[roomId]
     table = room.maptable[tableId]
     table.doLeave(msg, userId, clientId)
     if router.isQuery() :
         mo = runcmd.newOkMsgPack(1)
         router.responseQurery(mo, str(tableId), str(userId))
Пример #5
0
 def doTableSit(self, userId, roomId, tableId, seatId0, clientId):
     msg = runcmd.getMsgPack()
     room = gdata.rooms()[roomId]
     table = room.maptable[tableId]
     table.doSit(msg, userId, seatId0, clientId)
     if router.isQuery():
         mo = runcmd.newOkMsgPack(1)
         router.responseQurery(mo, str(tableId), str(userId))
Пример #6
0
 def doRoomQuickStart(self, roomId, userId):
     msg = runcmd.getMsgPack()
     room = gdata.rooms()[roomId]
     if isinstance(room, DizhuRoom):
         room.handleMsg(msg)
     else:
         msg = runcmd.getMsgPack()
         room.doQuickStart(msg)
     if router.isQuery():
         mo = runcmd.newOkMsgPack(1)
         router.responseQurery(mo, '', str(userId))
Пример #7
0
 def doTableSit(self, userId, roomId, tableId, seatId0, clientId):
     msg = runcmd.getMsgPack()
     room = gdata.rooms()[roomId]
     table = room.maptable[tableId]
     if isinstance(table, DizhuTableCtrl):
         table.proto.handleMsg(msg)
     else:
         table.doSit(msg, userId, seatId0, clientId)
     if router.isQuery():
         mo = runcmd.newOkMsgPack(1)
         router.responseQurery(mo, str(tableId), str(userId))
Пример #8
0
 def doTableCall(self, userId, roomId, tableId, clientId):
     msg = runcmd.getMsgPack()
     room = gdata.rooms()[roomId]
     table = room.maptable[tableId]
     action = msg.getParam('action')
     seatId = msg.getParam('seatId', -1) # 旁观时没有seatId参数
     assert isinstance(seatId, int)
     table.doTableCall(msg, userId, seatId, action, clientId)
     if router.isQuery() :
         mo = runcmd.newOkMsgPack(1)
         router.responseQurery(mo, str(tableId), str(userId))
Пример #9
0
 def doJoinCreateTable(self, userId, gameId, roomId):
     """加入自建桌
     """
     msg = runcmd.getMsgPack()
     ftlog.debug('RoomTcpHandler.doJoinCreateTable msg=', userId,
                 gameId, roomId, msg, caller=self)
     room = gdata.rooms()[roomId]
     self._doJoinCreateTable(room, msg)
     if router.isQuery():
         mo = runcmd.newOkMsgPack(1)
         router.responseQurery(mo, '', str(userId))
Пример #10
0
 def doTableCall(self, userId, roomId, tableId, clientId):
     msg = runcmd.getMsgPack()
     room = gdata.rooms()[roomId]
     table = room.maptable[tableId]
     action = msg.getParam('action')
     seatId = msg.getParam('seatId', -1)  # 旁观时没有seatId参数
     assert isinstance(seatId, int)
     table.doTableCall(msg, userId, seatId, action, clientId)
     if router.isQuery():
         mo = runcmd.newOkMsgPack(1)
         router.responseQurery(mo, str(tableId), str(userId))
Пример #11
0
 def doGameQuickStart(self, userId, gameId, clientId, roomId0, tableId0, kindId):
     """
     TCP 发送的至UTIL服务的quick_start暂时不能用lock userid的方式,
     因为,消息流 CO->UT->GR->GT->UT会死锁
     """
     msg = runcmd.getMsgPack()
     ftlog.debug("doGameQuickStart", userId, gameId, clientId, roomId0, tableId0, caller=self)
     FishQuickStartDispatcher.dispatchQuickStart(msg, userId, gameId, roomId0, tableId0, clientId, kindId)
     if router.isQuery():
         mo = runcmd.newOkMsgPack()
         router.responseQurery(mo, "", str(userId))
Пример #12
0
    def doGameQuickStart(self, userId, gameId, clientId, roomId0, tableId0,
                         playMode, sessionIndex):
        '''
        TCP 发送的至UTIL服务的quick_start暂时不能用lock userid的方式, 
        因为,消息流 CO->UT->GR->GT->UT会死锁
        '''
        msg = runcmd.getMsgPack()
        ftlog.debug('doGameQuickStart',
                    userId,
                    gameId,
                    clientId,
                    roomId0,
                    tableId0,
                    playMode,
                    sessionIndex,
                    caller=self)
        if not playMode and roomId0 <= 0 and tableId0 <= 0:
            try:
                # 前端对于sessionIndex是写死的, 不会更具hall_info中的顺序改变而改变
                if sessionIndex == 0:
                    playMode = majiang_conf.PLAYMODE_GUOBIAO
                elif sessionIndex == 1:
                    playMode = majiang_conf.PLAYMODE_SICHUAN
                elif sessionIndex == 2:
                    playMode = majiang_conf.PLAYMODE_GUOBIAO_EREN
                elif sessionIndex == 3:
                    playMode = majiang_conf.PLAYMODE_HARBIN
                elif sessionIndex == 4:
                    playMode = majiang_conf.PLAYMODE_SICHUAN_DQ
                elif sessionIndex == 5:
                    playMode = majiang_conf.PLAYMODE_SICHUAN_XLCH
                elif sessionIndex == 6:
                    playMode = majiang_conf.PLAYMODE_GUOBIAO_VIP
                else:
                    playMode = majiang_conf.PLAYMODE_GUOBIAO
                msg.setParam('playMode', playMode)  # 透传playMode, 以便发送高倍房引导弹窗
            except:
                ftlog.error('doGameQuickStart', msg)
            ftlog.debug('doGameQuickStart sessionIndex=', sessionIndex,
                        'playMode=', playMode)

        if roomId0 < 1000:
            roomIdx = roomId0
            roomId0 = 0
            ftlog.info("quickstart roomID error, from %d change to %d" %
                       (roomIdx, roomId0))

        MajiangQuickStartDispatcher.dispatchQuickStart(msg, userId, gameId,
                                                       roomId0, tableId0,
                                                       playMode, clientId)
        if router.isQuery():
            mo = runcmd.newOkMsgPack(1)
            router.responseQurery(mo, '', str(userId))
Пример #13
0
 def doTableStandUp(self, userId, roomId, tableId, seatId, clientId):
     '''
     此命令一定是由客户端发送的命令, 如果是内部控制命令,那么需要进行区分命令,不能混合调用
     主要是为了避免站起的原因混乱,
     '''
     msg = runcmd.getMsgPack()
     room = gdata.rooms()[roomId]
     table = room.maptable[tableId]
     table.doStandUp(msg, userId, roomId, tableId, seatId, TableStandUpEvent.REASON_USER_CLICK_BUTTON, clientId)
     if router.isQuery():
         mo = runcmd.newOkMsgPack(1)
         router.responseQurery(mo, str(tableId), str(userId))
Пример #14
0
 def _do_room__quick_start(self, msg):
     '''
     用户快速开始,随机选择一个troom,把用户分发到troom
     '''
     userId = msg.getParam('userId')
     shadowRoomId = msg.getParam('clientRoomId')
     tableId = msg.getParam('tableId')
     continueBuyin = True if msg.getParam('buyin', 0) else False
     self.quickStart(userId, shadowRoomId, tableId, continueBuyin)
     if router.isQuery():
         mo = runcmd.newOkMsgPack(1)
         router.responseQurery(mo, '', str(userId))
Пример #15
0
 def doTableStandUp(self, userId, roomId, tableId, seatId, clientId):
     '''
     此命令一定是由客户端发送的命令, 如果是内部控制命令,那么需要进行区分命令,不能混合调用
     主要是为了避免站起的原因混乱,
     '''
     msg = runcmd.getMsgPack()
     room = gdata.rooms()[roomId]
     table = room.maptable[tableId]
     table.doStandUp(msg, userId, roomId, tableId, seatId, TableStandUpEvent.REASON_USER_CLICK_BUTTON, clientId)
     if router.isQuery() :
         mo = runcmd.newOkMsgPack(1)
         router.responseQurery(mo, str(tableId), str(userId))
Пример #16
0
    def doCreateTable(self, userId, gameId, roomId):
        """自建桌创建
            1.通过roomId得到房间对象
            2.得到合适的tableId,然后sit
        """
        ftlog.info("<< doCreateTable | userId, clientId, roomId, msg:", userId, gameId, roomId)

        msg = runcmd.getMsgPack()
        room = gdata.rooms()[roomId]
        self._doCreateTable(room, msg, gameId)
        if router.isQuery():
            mo = runcmd.newOkMsgPack(1)
            router.responseQurery(mo, '', str(userId))
Пример #17
0
 def doGetCreateTableRecord(self, userId, gameId, clientId):
     """全量请求牌桌记录
     """
     msg = runcmd.getMsgPack()
     startRecordIndex = msg.getParam('startRecordIndex', None)
     if not startRecordIndex:
         startRecordIndex = 0
     endRecordIndex = msg.getParam('endRecordIndex', None)
     if not endRecordIndex:
         endRecordIndex = 19
         
     MJCreateTableRecord.sendAllRecordToUser(userId, gameId, startRecordIndex, endRecordIndex)
     if router.isQuery() :
         mo = runcmd.newOkMsgPack(1)
         router.responseQurery(mo, '', str(userId))
Пример #18
0
    def doHandleCommonRoomCmdAction(self, userId, gameId, roomId, clientId):
        room = gdata.rooms()[roomId]
        msg = runcmd.getMsgPack()
        params = msg.getKey('params')
        params.update({'room': room})

        if ftlog.is_debug():
            ftlog.debug("<< |userId, gameId, roomId, clientId, msg:", userId, gameId, roomId, clientId, msg,
                        caller=self)

        TYPluginCenter.event(msg, gameId)

        if router.isQuery():
            mo = runcmd.newOkMsgPack(1)
            router.responseQurery(mo)
Пример #19
0
    def doJoinCreateTable(self, userId, gameId, clientId, roomId0, tableId0,
                          playMode):
        """用户加入自建牌桌
        """
        loc = onlinedata.checkUserLoc(userId, clientId, gameId)
        lgameId, lroomId, ltableId, lseatId = loc.split('.')
        lgameId, lroomId, ltableId, lseatId = strutil.parseInts(
            lgameId, lroomId, ltableId, lseatId)
        if lgameId > 0 and lroomId > 0 and ltableId > 0 and lseatId >= 0:
            ftlog.warn('create_table error, user in table')
            sendPopTipMsg(userId, "请稍候,正在进桌...")
            config = {
                "type": "quickstart",
                "pluginParams": {
                    "roomId": lroomId,
                    "tableId": ltableId,
                    "seatId": lseatId
                }
            }
            todotask = TodoTaskEnterGameNew(lgameId, config)
            mo = MsgPack()
            mo.setCmd('todo_tasks')
            mo.setResult('gameId', gameId)
            mo.setResult('pluginId', lgameId)
            mo.setResult('userId', userId)
            mo.setResult('tasks', TodoTaskHelper.encodeTodoTasks(todotask))
            router.sendToUser(mo, userId)
        else:
            msg = runcmd.getMsgPack()
            createTableNo = msg.getParam('createTableNo', 0)
            if not createTableNo:
                return
            tableId0, roomId0 = CreateTableData.getTableIdByCreateTableNo(
                createTableNo)
            if not tableId0 or not roomId0:
                sendPopTipMsg(userId, "找不到您输入的房间号")
                return
            msg = runcmd.getMsgPack()
            msg.setParam("shadowRoomId", roomId0)
            msg.setParam("roomId", roomId0)
            msg.setParam("tableId", tableId0)
            msg.setCmdAction("room", "join_create_table")
            router.sendRoomServer(msg, roomId0)

            if router.isQuery():
                mo = runcmd.newOkMsgPack(1)
                router.responseQurery(mo, '', str(userId))
Пример #20
0
    def doGetCreateTableRecord(self, userId, gameId, clientId):
        """全量请求牌桌记录
        """
        msg = runcmd.getMsgPack()
        startRecordIndex = msg.getParam('startRecordIndex', None)
        if not startRecordIndex:
            startRecordIndex = 0
        endRecordIndex = msg.getParam('endRecordIndex', None)
        if not endRecordIndex:
            endRecordIndex = 19

        MJCreateTableRecord.sendAllRecordToUser(userId, gameId,
                                                startRecordIndex,
                                                endRecordIndex)
        if router.isQuery():
            mo = runcmd.newOkMsgPack(1)
            router.responseQurery(mo, '', str(userId))
Пример #21
0
    def doAwardCertificate(self, userId, gameId, match_id, clientId):
        '''
        TCP 发送的至UTIL服务的quick_start暂时不能用lock userid的方式, 
        因为,消息流 CO->UT->GR->GT->UT会死锁
        '''
        msg = runcmd.getMsgPack()
        roomId = msg.getParam("roomId")
        ftlog.debug('doAwardCertificate',
                    userId,
                    gameId,
                    roomId,
                    match_id,
                    caller=self)
        if len(str(roomId)) != 4 and len(str(roomId)) != 8 and len(
                str(roomId)) != 0:
            roomIdx = roomId
            roomId = roomId * 100
            ftlog.info(
                "doAwardCertificate roomID error, from %d change to %d" %
                (roomIdx, roomId))

        allrooms = gdata.roomIdDefineMap()
        ctrlRoomId = roomId
        if roomId in allrooms:
            roomDef = allrooms[roomId]
            if roomDef.parentId > 0:  # this roomId is shadowRoomId
                ctrlRoomId = roomDef.parentId
        else:
            ftlog.warn("doAwardCertificate, error roomId", roomId)
            return

        ftlog.debug("ctrlRoomId:", ctrlRoomId)

        msg1 = MsgPack()
        msg1.setCmd('room')
        msg1.setParam('gameId', gameId)
        msg1.setParam('userId', userId)
        msg1.setParam('roomId', ctrlRoomId)
        msg1.setParam('action', "match_award_certificate")
        msg1.setParam('match_id', match_id)
        msg1.setParam('clientId', clientId)
        router.sendRoomServer(msg1, roomId)
        if router.isQuery():
            mo = runcmd.newOkMsgPack(1)
            router.responseQurery(mo, '', str(userId))
Пример #22
0
    def doJoinCreateTable(self, userId, gameId, clientId, roomId0, tableId0, playMode):
        """用户加入自建牌桌
        """
        loc = onlinedata.checkUserLoc(userId, clientId, gameId)
        lgameId, lroomId, ltableId, lseatId = loc.split('.')
        lgameId, lroomId, ltableId, lseatId = strutil.parseInts(lgameId, lroomId, ltableId, lseatId)
        if lgameId > 0 and lroomId > 0 and ltableId > 0 and lseatId >= 0:
            ftlog.warn('create_table error, user in table')
            sendPopTipMsg(userId, "请稍候,正在进桌...")
            config = {
                "type": "quickstart",
                "pluginParams": {
                    "roomId": lroomId,
                    "tableId": ltableId,
                    "seatId": lseatId
                }
            }
            todotask = TodoTaskEnterGameNew(lgameId, config)
            mo = MsgPack()
            mo.setCmd('todo_tasks')
            mo.setResult('gameId', gameId)
            mo.setResult('pluginId', lgameId)
            mo.setResult('userId', userId)
            mo.setResult('tasks', TodoTaskHelper.encodeTodoTasks(todotask))
            router.sendToUser(mo, userId)
        else:
            msg = runcmd.getMsgPack()
            createTableNo = msg.getParam('createTableNo', 0)
            if not createTableNo:
                return
            tableId0, roomId0 = CreateTableData.getTableIdByCreateTableNo(createTableNo)
            if not tableId0 or not roomId0:
                sendPopTipMsg(userId, "找不到您输入的房间号")
                return
            msg = runcmd.getMsgPack()
            msg.setParam("shadowRoomId", roomId0)
            msg.setParam("roomId", roomId0)
            msg.setParam("tableId", tableId0)
            msg.setCmdAction("room", "join_create_table")
            router.sendRoomServer(msg, roomId0)

            if router.isQuery():
                mo = runcmd.newOkMsgPack(1)
                router.responseQurery(mo, '', str(userId))
Пример #23
0
    def doGetCreateTableRecordForCustomer(self, userId, gameId, clientId):
        """全量请求他人的牌桌记录
        """
        msg = runcmd.getMsgPack()
        targetUserId = msg.getParam('targetUserId', None)
        targetTableNo = msg.getParam('targetTableNo', None)
        playMode = msg.getParam('playMode', None)

        startRecordIndex = msg.getParam('startRecordIndex', None)
        if not startRecordIndex:
            startRecordIndex = 0
        endRecordIndex = msg.getParam('endRecordIndex', None)
        if not endRecordIndex:
            endRecordIndex = 19

        MJCreateTableRecord.sendAllRecordToUserForCustomer(userId, gameId, playMode, targetUserId, targetTableNo, startRecordIndex, endRecordIndex)
        if router.isQuery():
            mo = runcmd.newOkMsgPack(1)
            router.responseQurery(mo, '', str(userId))
Пример #24
0
    def doHandleCommonRoomCmdAction(self, userId, gameId, roomId, clientId):
        room = gdata.rooms()[roomId]
        msg = runcmd.getMsgPack()
        params = msg.getKey('params')
        params.update({'room': room})

        if ftlog.is_debug():
            ftlog.debug("<< |userId, gameId, roomId, clientId, msg:",
                        userId,
                        gameId,
                        roomId,
                        clientId,
                        msg,
                        caller=self)

        TYPluginCenter.event(msg, gameId)

        if router.isQuery():
            mo = runcmd.newOkMsgPack(1)
            router.responseQurery(mo)
Пример #25
0
    def doGameQuickStart(self, userId, gameId, clientId, roomId0, tableId0, playMode, sessionIndex):
        '''
        TCP 发送的至UTIL服务的quick_start暂时不能用lock userid的方式, 
        因为,消息流 CO->UT->GR->GT->UT会死锁
        '''
        msg = runcmd.getMsgPack()
        ftlog.debug('doGameQuickStart', userId, gameId, clientId, roomId0, tableId0, playMode, sessionIndex,
                    caller=self)
        if not playMode and roomId0 <= 0 and tableId0 <= 0:
            try:
                # 前端对于sessionIndex是写死的, 不会更具hall_info中的顺序改变而改变
                if sessionIndex == 0:
                    playMode = majiang_conf.PLAYMODE_GUOBIAO
                elif sessionIndex == 1:
                    playMode = majiang_conf.PLAYMODE_SICHUAN
                elif sessionIndex == 2:
                    playMode = majiang_conf.PLAYMODE_GUOBIAO_EREN
                elif sessionIndex == 3:
                    playMode = majiang_conf.PLAYMODE_HARBIN
                elif sessionIndex == 4:
                    playMode = majiang_conf.PLAYMODE_SICHUAN_DQ
                elif sessionIndex == 5:
                    playMode = majiang_conf.PLAYMODE_SICHUAN_XLCH
                elif sessionIndex == 6:
                    playMode = majiang_conf.PLAYMODE_GUOBIAO_VIP
                else:
                    playMode = majiang_conf.PLAYMODE_GUOBIAO
                msg.setParam('playMode', playMode)  # 透传playMode, 以便发送高倍房引导弹窗
            except:
                ftlog.error('doGameQuickStart', msg)
            ftlog.debug('doGameQuickStart sessionIndex=', sessionIndex, 'playMode=', playMode)

        if roomId0 < 1000:
            roomIdx = roomId0
            roomId0 = 0
            ftlog.info("quickstart roomID error, from %d change to %d" % (roomIdx, roomId0))

        MajiangQuickStartDispatcher.dispatchQuickStart(msg, userId, gameId, roomId0, tableId0, playMode, clientId)
        if router.isQuery():
            mo = runcmd.newOkMsgPack(1)
            router.responseQurery(mo, '', str(userId))
Пример #26
0
    def doGetCreateTableRecordForCustomer(self, userId, gameId, clientId):
        """全量请求他人的牌桌记录
        """
        msg = runcmd.getMsgPack()
        targetUserId = msg.getParam('targetUserId', None)
        targetTableNo = msg.getParam('targetTableNo', None)
        playMode = msg.getParam('playMode', None)

        startRecordIndex = msg.getParam('startRecordIndex', None)
        if not startRecordIndex:
            startRecordIndex = 0
        endRecordIndex = msg.getParam('endRecordIndex', None)
        if not endRecordIndex:
            endRecordIndex = 19

        MJCreateTableRecord.sendAllRecordToUserForCustomer(
            userId, gameId, playMode, targetUserId, targetTableNo,
            startRecordIndex, endRecordIndex)
        if router.isQuery():
            mo = runcmd.newOkMsgPack(1)
            router.responseQurery(mo, '', str(userId))
Пример #27
0
    def doAwardCertificate(self, userId, gameId, match_id, clientId):
        '''
        TCP 发送的至UTIL服务的quick_start暂时不能用lock userid的方式, 
        因为,消息流 CO->UT->GR->GT->UT会死锁
        '''
        msg = runcmd.getMsgPack()
        roomId = msg.getParam("roomId")
        ftlog.debug('doAwardCertificate', userId, gameId, roomId, match_id, caller=self)
        if len(str(roomId)) != 4 and len(str(roomId)) != 8 and len(str(roomId)) != 0:
            roomIdx = roomId
            roomId = roomId * 100
            ftlog.info("doAwardCertificate roomID error, from %d change to %d" % (roomIdx, roomId))

        allrooms = gdata.roomIdDefineMap()
        ctrlRoomId = roomId
        if roomId in allrooms:
            roomDef = allrooms[roomId]
            if roomDef.parentId > 0:  # this roomId is shadowRoomId
                ctrlRoomId = roomDef.parentId
        else:
            ftlog.warn("doAwardCertificate, error roomId", roomId)
            return

        ftlog.debug("ctrlRoomId:", ctrlRoomId)

        msg1 = MsgPack()
        msg1.setCmd('room')
        msg1.setParam('gameId', gameId)
        msg1.setParam('userId', userId)
        msg1.setParam('roomId', ctrlRoomId)
        msg1.setParam('action', "match_award_certificate")
        msg1.setParam('match_id', match_id)
        msg1.setParam('clientId', clientId)
        router.sendRoomServer(msg1, roomId)
        if router.isQuery():
            mo = runcmd.newOkMsgPack(1)
            router.responseQurery(mo, '', str(userId))
Пример #28
0
 def doTableChange(self):
     msg = runcmd.getMsgPack()
     ftlog.error('NotImplementedError, doTableChange, msg=', msg)
     return runcmd.newOkMsgPack(code=1)
Пример #29
0
 def doRoomCreateTable(self):
     msg = runcmd.getMsgPack()
     ftlog.error('NotImplementedError, doRoomCreateTable, msg=',
                 msg,
                 caller=self)
     return runcmd.newOkMsgPack(code=1)
Пример #30
0
 def doRoomResultList(self):
     msg = runcmd.getMsgPack()
     ftlog.error('NotImplementedError, doRoomResultList, msg=',
                 msg,
                 caller=self)
     return runcmd.newOkMsgPack(code=1)
Пример #31
0
 def doMasterGetRank(self):
     msg = runcmd.getMsgPack()
     ftlog.error('NotImplementedError, doMasterGetRank, msg=', msg)
     return runcmd.newOkMsgPack(code=1)
Пример #32
0
 def doPromoteQueryState(self):
     msg = runcmd.getMsgPack()
     ftlog.error('NotImplementedError, doPromoteQueryState, msg=', msg)
     return runcmd.newOkMsgPack(code=1)
Пример #33
0
 def doPromoteGetFriendPrize(self):
     msg = runcmd.getMsgPack()
     ftlog.error('NotImplementedError, doPromoteGetFriendPrize, msg=', msg)
     return runcmd.newOkMsgPack(code=1)
Пример #34
0
 def doRoomResultList(self):
     msg = runcmd.getMsgPack()
     ftlog.error('NotImplementedError, doRoomResultList, msg=', msg, caller=self)
     return runcmd.newOkMsgPack(code=1)
Пример #35
0
 def doHallLoginReward(self):
     msg = runcmd.getMsgPack()
     ftlog.error('NotImplementedError, doHallLoginReward, msg=', msg)
     return runcmd.newOkMsgPack(code=1)
Пример #36
0
 def doHallMatchRoomList(self):
     msg = runcmd.getMsgPack()
     ftlog.error('NotImplementedError, doHallMatchRoomList, msg=', msg)
     return runcmd.newOkMsgPack(code=1)
Пример #37
0
 def doVipGift(self):
     msg = runcmd.getMsgPack()
     ftlog.debug('msg=', msg)
     return runcmd.newOkMsgPack(code=1)
Пример #38
0
    def doCreateTable(self, userId, gameId, clientId, roomId0, tableId0, playMode, hasRobot = 0):
        
        #临时硬编码,解决91晃晃提审问题
        if gameId==791 and playMode=="queshou-lianjiang" and clientId=="IOS_3.901_weixin.appStore,weixinPay.0-hall791.queshou.iostsljmj":
            hasRobot=1
	if gameId == 790 and playMode == 'luosihu-luosihuts' and clientId=="IOS_3.901_weixin.appStore,weixinPay.0-hall790.laodao.iostsxjmj":
	    hasRobot=1
        """房主创建牌桌"""
        if not playMode:
            ftlog.error('game_handler, cat not create table without playMode...')
        
        loc = onlinedata.checkUserLoc(userId, clientId, gameId)
        lgameId, lroomId, ltableId, lseatId = loc.split('.')
        lgameId, lroomId, ltableId, lseatId = strutil.parseInts(lgameId, lroomId, ltableId, lseatId)
        if lgameId > 0 and lroomId > 0 and ltableId > 0 and lseatId >=0:
            ftlog.warn('create_table error, user in table',lgameId, lroomId, ltableId, lseatId)
            sendPopTipMsg(userId, "请稍候,正在进桌...")
            config = {
                      "type":"quickstart",
                      "pluginParams": {
                          "roomId": lroomId,
                          "tableId": ltableId,
                          "seatId": lseatId
                          }
                      }
            todotask = TodoTaskEnterGameNew(lgameId, config)
            mo = MsgPack()
            mo.setCmd('todo_tasks')
            mo.setResult('gameId', gameId)
            mo.setResult('pluginId', lgameId)
            mo.setResult('userId', userId)
            mo.setResult('tasks', TodoTaskHelper.encodeTodoTasks(todotask))
            router.sendToUser(mo, userId)
        elif self._canEnterGame(userId, gameId):
            # 保存建桌时间戳
            gamedata.setGameAttr(userId, gameId, 'createTableTime', pktimestamp.getCurrentTimestamp())
            
            msg = runcmd.getMsgPack()
            itemParams = msg.getParam("itemParams")
            
            playerCount = 4
            playerTypeId = itemParams.get(MFTDefine.PLAYER_TYPE, 1)
            playerTypeConfig = majiang_conf.getCreateTableConfig(gameId, playMode, MFTDefine.PLAYER_TYPE, playerTypeId)
            if not playerTypeConfig:
                sendPopTipMsg(userId, '人数配置有误,请稍后重试')
                return
            
            playerCount = playerTypeConfig.get('count', 4)
            ftlog.debug('MajiangCreateTable.create_table playerCount:', playerCount)
            cardCountKey = playerTypeConfig.get(MFTDefine.CARD_COUNT, MFTDefine.CARD_COUNT)

            cardCountId = itemParams.get(cardCountKey, 0)
            cardCountConfig = majiang_conf.getCreateTableConfig(gameId, playMode, cardCountKey, cardCountId)
            if not cardCountConfig:
                sendPopTipMsg(userId, '房卡配置有误,请稍后重试')
                return
            
            if hasRobot == 1 and 'hasRobot' in cardCountConfig:
                cardCountConfig = cardCountConfig.get('hasRobot', {})
                ftlog.debug('MajiangCreateTable.create_table hasRobot == 1:')
            fangka_count = cardCountConfig.get('fangka_count', 1)
            ftlog.debug('MajiangCreateTable.create_table fangka_count:', fangka_count
                        , ' cardCountConfig:', cardCountConfig)
            
            msg.setParam('isCreateTable', 1) #标记创建的桌子是 自建桌
            from poker.entity.game.rooms.room import TYRoom
            '''
            根据五个因素筛选合适的房间
            1)gameId         游戏ID
            2)playMode       游戏玩法
            3)playerCount    玩家个数
            4)hasRobot       是否有机器人
            5)itemId         房卡道具
            '''
            itemId = hall_fangka.queryFangKaItem(gameId, userId, clientId)
            if itemId:
                ftlog.debug('MajiangCreateTable._chooseCreateRoom fangKa itemId:', itemId)
            roomId, checkResult = MajiangCreateTable._chooseCreateRoom(userId, gameId, playMode, playerCount, hasRobot, itemId)
            ftlog.debug('MajiangCreateTable._chooseCreateRoom roomId:', roomId, ' checkResult:', checkResult)

            if checkResult==TYRoom.ENTER_ROOM_REASON_OK:
                msg = runcmd.getMsgPack()
                msg.setCmdAction("room", "create_table")
                msg.setParam("roomId", roomId)
                msg.setParam("itemParams", itemParams)
                msg.setParam('needFangka', fangka_count)
                ftlog.debug('MajiangCreateTable._chooseCreateRoom send message to room:', msg)

                router.sendRoomServer(msg, roomId)
            else:
                sendPopTipMsg(userId, "暂时无法创建请稍后重试")
                
            if router.isQuery() :
                mo = runcmd.newOkMsgPack(1)
                router.responseQurery(mo, '', str(userId))
        else:
            ftlog.info('majiang2 game_handler, ignore enter game request...')
Пример #39
0
 def doRoomCreateTable(self):
     msg = runcmd.getMsgPack()
     ftlog.error('NotImplementedError, doRoomCreateTable, msg=', msg, caller=self)
     return runcmd.newOkMsgPack(code=1)
Пример #40
0
 def doPromoteQueryState(self):
     msg = runcmd.getMsgPack()
     ftlog.error('NotImplementedError, doPromoteQueryState, msg=', msg)
     return runcmd.newOkMsgPack(code=1)
Пример #41
0
 def doPromoteCodeCheck(self):
     msg = runcmd.getMsgPack()
     ftlog.error('NotImplementedError, doPromoteCodeCheck, msg=', msg)
     return runcmd.newOkMsgPack(code=1)
Пример #42
0
    def doCreateTable(self,
                      userId,
                      gameId,
                      clientId,
                      roomId0,
                      tableId0,
                      playMode,
                      hasRobot=0):

        #临时硬编码,解决91晃晃提审问题
        if gameId == 791 and playMode == "queshou-lianjiang" and clientId == "IOS_3.901_weixin.appStore,weixinPay.0-hall791.queshou.iostsljmj":
            hasRobot = 1
        if gameId == 790 and playMode == 'luosihu-luosihuts' and clientId == "IOS_3.901_weixin.appStore,weixinPay.0-hall790.laodao.iostsxjmj":
            hasRobot = 1
        """房主创建牌桌"""
        if not playMode:
            ftlog.error(
                'game_handler, cat not create table without playMode...')

        loc = onlinedata.checkUserLoc(userId, clientId, gameId)
        lgameId, lroomId, ltableId, lseatId = loc.split('.')
        lgameId, lroomId, ltableId, lseatId = strutil.parseInts(
            lgameId, lroomId, ltableId, lseatId)
        if lgameId > 0 and lroomId > 0 and ltableId > 0 and lseatId >= 0:
            ftlog.warn('create_table error, user in table', lgameId, lroomId,
                       ltableId, lseatId)
            sendPopTipMsg(userId, "请稍候,正在进桌...")
            config = {
                "type": "quickstart",
                "pluginParams": {
                    "roomId": lroomId,
                    "tableId": ltableId,
                    "seatId": lseatId
                }
            }
            todotask = TodoTaskEnterGameNew(lgameId, config)
            mo = MsgPack()
            mo.setCmd('todo_tasks')
            mo.setResult('gameId', gameId)
            mo.setResult('pluginId', lgameId)
            mo.setResult('userId', userId)
            mo.setResult('tasks', TodoTaskHelper.encodeTodoTasks(todotask))
            router.sendToUser(mo, userId)
        elif self._canEnterGame(userId, gameId):
            # 保存建桌时间戳
            gamedata.setGameAttr(userId, gameId, 'createTableTime',
                                 pktimestamp.getCurrentTimestamp())

            msg = runcmd.getMsgPack()
            itemParams = msg.getParam("itemParams")

            playerCount = 4
            playerTypeId = itemParams.get(MFTDefine.PLAYER_TYPE, 1)
            playerTypeConfig = majiang_conf.getCreateTableConfig(
                gameId, playMode, MFTDefine.PLAYER_TYPE, playerTypeId)
            if not playerTypeConfig:
                sendPopTipMsg(userId, '人数配置有误,请稍后重试')
                return

            playerCount = playerTypeConfig.get('count', 4)
            ftlog.debug('MajiangCreateTable.create_table playerCount:',
                        playerCount)
            cardCountKey = playerTypeConfig.get(MFTDefine.CARD_COUNT,
                                                MFTDefine.CARD_COUNT)

            cardCountId = itemParams.get(cardCountKey, 0)
            cardCountConfig = majiang_conf.getCreateTableConfig(
                gameId, playMode, cardCountKey, cardCountId)
            if not cardCountConfig:
                sendPopTipMsg(userId, '房卡配置有误,请稍后重试')
                return

            if hasRobot == 1 and 'hasRobot' in cardCountConfig:
                cardCountConfig = cardCountConfig.get('hasRobot', {})
                ftlog.debug('MajiangCreateTable.create_table hasRobot == 1:')
            fangka_count = cardCountConfig.get('fangka_count', 1)
            ftlog.debug('MajiangCreateTable.create_table fangka_count:',
                        fangka_count, ' cardCountConfig:', cardCountConfig)

            msg.setParam('isCreateTable', 1)  #标记创建的桌子是 自建桌
            from poker.entity.game.rooms.room import TYRoom
            '''
            根据五个因素筛选合适的房间
            1)gameId         游戏ID
            2)playMode       游戏玩法
            3)playerCount    玩家个数
            4)hasRobot       是否有机器人
            5)itemId         房卡道具
            '''
            itemId = hall_fangka.queryFangKaItem(gameId, userId, clientId)
            if itemId:
                ftlog.debug(
                    'MajiangCreateTable._chooseCreateRoom fangKa itemId:',
                    itemId)
            roomId, checkResult = MajiangCreateTable._chooseCreateRoom(
                userId, gameId, playMode, playerCount, hasRobot, itemId)
            ftlog.debug('MajiangCreateTable._chooseCreateRoom roomId:', roomId,
                        ' checkResult:', checkResult)

            if checkResult == TYRoom.ENTER_ROOM_REASON_OK:
                msg = runcmd.getMsgPack()
                msg.setCmdAction("room", "create_table")
                msg.setParam("roomId", roomId)
                msg.setParam("itemParams", itemParams)
                msg.setParam('needFangka', fangka_count)
                ftlog.debug(
                    'MajiangCreateTable._chooseCreateRoom send message to room:',
                    msg)

                router.sendRoomServer(msg, roomId)
            else:
                sendPopTipMsg(userId, "暂时无法创建请稍后重试")

            if router.isQuery():
                mo = runcmd.newOkMsgPack(1)
                router.responseQurery(mo, '', str(userId))
        else:
            ftlog.info('majiang2 game_handler, ignore enter game request...')
Пример #43
0
 def doPromoteCodeCheck(self):
     msg = runcmd.getMsgPack()
     ftlog.error('NotImplementedError, doPromoteCodeCheck, msg=', msg)
     return runcmd.newOkMsgPack(code=1)
Пример #44
0
 def doTableChange(self):
     msg = runcmd.getMsgPack()
     ftlog.error('NotImplementedError, doTableChange, msg=', msg)
     return runcmd.newOkMsgPack(code=1)
Пример #45
0
 def doHallMatchRoomList(self):
     msg = runcmd.getMsgPack()
     ftlog.error('NotImplementedError, doHallMatchRoomList, msg=', msg)
     return runcmd.newOkMsgPack(code=1)
Пример #46
0
    def doCreateTable(self, userId, gameId, clientId, roomId0, tableId0, playMode):
        """
        房主创建牌桌
        """
        if not playMode:
            ftlog.error('game_handler, cat not create table without playMode...')

        loc = onlinedata.checkUserLoc(userId, clientId, gameId)
        lgameId, lroomId, ltableId, lseatId = loc.split('.')
        lgameId, lroomId, ltableId, lseatId = strutil.parseInts(lgameId, lroomId, ltableId, lseatId)
        if lgameId > 0 and lroomId > 0 and ltableId > 0 and lseatId >= 0:
            ftlog.warn('create_table error, user in table', lgameId, lroomId, ltableId, lseatId)
            sendPopTipMsg(userId, "请稍候,正在进桌...")
            config = {
                "type": "quickstart",
                "pluginParams": {
                    "roomId": lroomId,
                    "tableId": ltableId,
                    "seatId": lseatId
                }
            }
            todotask = TodoTaskEnterGameNew(lgameId, config)
            mo = MsgPack()
            mo.setCmd('todo_tasks')
            mo.setResult('gameId', gameId)
            mo.setResult('pluginId', lgameId)
            mo.setResult('userId', userId)
            mo.setResult('tasks', TodoTaskHelper.encodeTodoTasks(todotask))
            router.sendToUser(mo, userId)
        elif self._canEnterGame(userId, gameId):
            # 保存建桌时间戳
            gamedata.setGameAttr(userId, gameId, 'createTableTime', pktimestamp.getCurrentTimestamp())

            msg = runcmd.getMsgPack()
            itemParams = msg.getParam("itemParams")
            # cardCount为总局数
            if "cardCount" in itemParams:
                cardCountId = itemParams.get('cardCount', 0)
                cardCountConfig = majiang_conf.getCreateTableConfig(gameId, playMode, 'cardCount', cardCountId)
                fangka_count = cardCountConfig.get('fangka_count', 1)
                ftlog.debug('MajiangCreateTable.create_table fangka_count:', fangka_count)

                playerCount = 4
                playerTypeId = itemParams.get('playerType', 1)
                if playerTypeId:
                    playerTypeConfig = majiang_conf.getCreateTableConfig(gameId, playMode, 'playerType', playerTypeId)
                    playerCount = playerTypeConfig.get('count', 4)
                    ftlog.debug('MajiangCreateTable.create_table playerCount:', playerCount)

                msg.setParam('isCreateTable', 1)  # 标记创建的桌子是 自建桌
                from poker.entity.game.rooms.room import TYRoom
                roomId, checkResult = MajiangCreateTable._chooseCreateRoom(userId, gameId, playMode, playerCount)
                ftlog.debug('MajiangCreateTable._chooseCreateRoom roomId:', roomId, ' checkResult:', checkResult)

                if checkResult == TYRoom.ENTER_ROOM_REASON_OK:
                    msg = runcmd.getMsgPack()
                    msg.setCmdAction("room", "create_table")
                    msg.setParam("roomId", roomId)
                    msg.setParam("itemParams", itemParams)
                    msg.setParam('needFangka', fangka_count)
                    ftlog.debug('MajiangCreateTable._chooseCreateRoom send message to room:', msg)

                    router.sendRoomServer(msg, roomId)
                else:
                    sendPopTipMsg(userId, "暂时无法创建请稍后重试")
            else:
                sendPopTipMsg(userId, "暂时无法创建请稍后重试")

            if router.isQuery():
                mo = runcmd.newOkMsgPack(1)
                router.responseQurery(mo, '', str(userId))
        else:
            ftlog.info('majiang2 game_handler, ignore enter game request...')
Пример #47
0
 def doHallLoginReward(self):
     msg = runcmd.getMsgPack()
     ftlog.error('NotImplementedError, doHallLoginReward, msg=', msg)
     return runcmd.newOkMsgPack(code=1)
Пример #48
0
 def doVipGift(self):
     msg = runcmd.getMsgPack()
     ftlog.debug('msg=', msg)
     return runcmd.newOkMsgPack(code=1)
Пример #49
0
 def doProductDelivery(self):
     msg = runcmd.getMsgPack()
     ftlog.error('NotImplementedError, doProductDelivery, msg=', msg)
     return runcmd.newOkMsgPack(code=1)
Пример #50
0
 def doPromoteGetFriendPrize(self):
     msg = runcmd.getMsgPack()
     ftlog.error('NotImplementedError, doPromoteGetFriendPrize, msg=', msg)
     return runcmd.newOkMsgPack(code=1)
Пример #51
0
 def doUserToDoTask(self):
     msg = runcmd.getMsgPack()
     ftlog.error('NotImplementedError, doUserToDoTask, msg=', msg)
     return runcmd.newOkMsgPack(code=1)
Пример #52
0
 def doMedal(self):
     msg = runcmd.getMsgPack()
     ftlog.error('NotImplementedError, doMedal, msg=', msg)
     return runcmd.newOkMsgPack(code=1)
Пример #53
0
 def doVipInfo(self):
     msg = runcmd.getMsgPack()
     ftlog.error('NotImplementedError, doVipInfo, msg=', msg)
     return runcmd.newOkMsgPack(code=1)