Esempio n. 1
0
    def enterFriendTable(self, userId, gameId, clientId, ftId):
        """进入自建桌,插件实现具体功能"""
        if ftlog.is_debug():
            ftlog.debug('MAJIANG enterFriendTable userId:', userId
                        , ' gameId:', gameId
                        , ' clientId:', clientId
                        , ' ftId:', ftId)

        tableId0, roomId0 = CreateTableData.getTableIdByCreateTableNo(ftId)
        if ftlog.is_debug():
            ftlog.debug('MAJIANG enterFriendTable ftId:', ftId
                        , ' roomId:', roomId0
                        , ' tableId:', tableId0)

        if not tableId0 or not roomId0:
            from difang.majiang2.entity.util import sendPopTipMsg
            sendPopTipMsg(userId, '您要进入的朋友场房间不存在,请核对房间号')
            return

        config = {
            "type": "game",
            "pluginParams": {
                "gameType": 11,
                "ftId": ftId
            }
        }

        todotask = TodoTaskEnterGameNew(GAMEID, config)
        mo = MsgPack()
        mo.setCmd('todo_tasks')
        mo.setResult('gameId', gameId)
        mo.setResult('pluginId', GAMEID)
        mo.setResult('userId', userId)
        mo.setResult('tasks', TodoTaskHelper.encodeTodoTasks(todotask))
        router.sendToUser(mo, userId)
Esempio n. 2
0
    def checkFriendTable(self, ftId):
        '''
        检测自建桌ID是否继续使用,如果不使用,将回收次ftId
        0 - 有效
        1 - 无效
        
        返回值:
        False - 无用
        True - 有用
        '''
        tableId0, roomId0 = CreateTableData.getTableIdByCreateTableNo(ftId)
        if not tableId0 or not roomId0:
            # 房间无用,大厅可释放房间了
            return False

        return True
Esempio n. 3
0
    def checkFriendTable(self, ftId):
        '''
        检测自建桌ID是否继续使用,如果不使用,将回收次ftId
        0 - 有效
        1 - 无效
        
        返回值:
        False - 无用
        True - 有用
        '''
        tableId0, roomId0 = CreateTableData.getTableIdByCreateTableNo(ftId)
        if not tableId0 or not roomId0:
            # 房间无用,大厅可释放房间了
            return False

        return True
Esempio n. 4
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))