Пример #1
0
    def callLaterFunc(self,
                      interval,
                      func,
                      userId=0,
                      timer=None,
                      msgPackParams=None):
        '''延时调用table对象的一个函数
           原理:延时调用table.doTableCall命令,通过此命令调用table对象的一个函数
           意义:table.doTableCall函数会锁定table对象,保证数据操作的同步性
        '''

        if msgPackParams == None:
            msgPackParams = {}
        msgPackParams["userId"] = userId
        clientId = tysessiondata.getClientId(userId) if userId > 0 else None
        msgPackParams["clientId"] = clientId
        msgPackParams["func"] = func
        action = "CL_FUNC"

        if timer == None:
            timer = TYTableTimer(self)
        timer.setup(interval, action, msgPackParams, cancelLastTimer=False)

        funcName = func.func.func_name
        if ftlog.is_debug():
            ftlog.debug(">> |clientId, userId, tableId:",
                        clientId,
                        userId,
                        self.tableId,
                        "|action, func, interval:",
                        action,
                        funcName,
                        interval,
                        caller=self)
Пример #2
0
 def doStoreBuy(self, request):
     mo = MsgPack()
     mi = self.checkStoreBuy.check(request)
     if mi.error:
         mo.setError(1, mi.error)
     else:
         clientId = tysessiondata.getClientId(mi.userId)
         orderId = ftstr.uuid()
         params = {
             'appId': tyglobal.gameId(),
             'realGameId': tyglobal.gameId(),
             'clientId': clientId,
             'userId': mi.userId,
             'prodId': mi.productId,
             'prodCount': mi.count,
             'prodOrderId': orderId,
             '_test_': 1,
         }
         url = tyglobal.httpGame(
         ) + '/api/hall5/store/consume/transaction?' + ftstr.toHttpStr(
             params)
         _, ret = fthttp.queryHttp('GET', url, None, None, 5)
         if ret != 'ok':
             mo.setError(1, ret)
         else:
             mo.setResult('ok', 1)
     return mo
Пример #3
0
 def doHappyBagList(self, request):
     mo = MsgPack()
     mi = self.checkHttpUser.check(request)
     if mi.error:
         mo.setError(1, mi.error)
     else:
         clientId = tysessiondata.getClientId(mi.userId)
         tasks = hallRpcOne.halltaskhappybag._doHappyBagListFull(mi.userId, clientId).getResult()
         mo.setResult('tasks', tasks)
     return mo
Пример #4
0
 def needAutoCheckin(self, userId):
     try:
         if self.autoCheckinLimitVersion != -1:
             clientId = tysessiondata.getClientId(userId)
             _, clientVer, _ = tyconfig.parseClientId(clientId)
             if clientVer >= self.autoCheckinLimitVersion:
                 return False
     except:
         ftlog.error('TYMemberCardItemKind.needAutoCheckin userId=', userId)
     return True
Пример #5
0
    def doStoreSuccess(self, request):
        mo = MsgPack()
        mi = self.checkStoreAction.check(request)
        if mi.error:
            mo.setError(1, mi.error)
        else:
            clientId = tysessiondata.getClientId(mi.userId)
            if mi.buyType == '1':  # 钻石
                chargedRmbs = 0
                chargedDiamonds = 0
                consumeCoin = mi.price
            else:
                chargedRmbs = mi.price
                chargedDiamonds = mi.count * mi.prodDiamond
                consumeCoin = 0

            params = {
                'userId': mi.userId,
                'appId': tyglobal.gameId(),
                'realGameId': tyglobal.gameId(),
                'clientId': clientId,
                'prodOrderId': mi.orderId,
                'prodId': mi.productId,
                'prodCount': 1,
                'chargeType': 'tester',
                'chargedRmbs': chargedRmbs,
                'chargedDiamonds': chargedDiamonds,
                'consumeCoin': consumeCoin,
                '_test_': 1,
            }
            url = tyglobal.httpGame(
            ) + '/api/hall5/store/consume/delivery?' + ftstr.toHttpStr(params)
            _, ret = fthttp.queryHttp('GET', url, None, None, 5)
            if ret != 'success':
                mo.setError(1, ret)
            else:
                mo.setResult('ok', 1)

            if chargedRmbs > 0 or chargedDiamonds > 0:
                params = {
                    'appId': tyglobal.gameId(),
                    'clientId': clientId,
                    'userId': mi.userId,
                    'realGameId': tyglobal.gameId(),
                    'prodId': mi.productId,
                    'chargedRmbs': chargedRmbs,
                    'chargedDiamonds': chargedDiamonds,
                    '_test_': 1,
                }
                url = tyglobal.httpGame(
                ) + '/api/hall5/store/consume/notify?' + ftstr.toHttpStr(
                    params)
                ret = fthttp.queryHttp('GET', url, None, None, 5)

        return mo
Пример #6
0
 def doStoreQuery(self, request):
     mo = MsgPack()
     mi = self.checkStoreUser.check(request)
     if mi.error:
         mo.setError(1, mi.error)
     else:
         clientId = tysessiondata.getClientId(mi.userId)
         datas = hallRpcOne.hallstore._doStoreQueryUi(mi.userId,
                                                      clientId).getResult()
         mo.updateResult(datas)
     return mo
Пример #7
0
 def processWhenAdded(self, item, userAssets, gameId, timestamp):
     if item.checkinTime == 0:
         if self.checkinWhenAdded and self.needAutoCheckin(
                 userAssets.userId):
             # 从无到有需要checkin
             checkinAction = self.findActionByName('checkin')
             checkinAction.doAction(
                 gameId, tysessiondata.getClientId(userAssets.userId),
                 userAssets, item, timestamp, {})
         else:
             item.checkinTime = timestamp
         pluginCross.halldatanotify.sendDataChangeNotify(
             userAssets.userId, gameId, ['decoration'])
Пример #8
0
    def updateProcessor(self, actionId, seatId, chargeResult, dis=''):
        '''
        更新某个玩家的购买结果
        '''
        if self.getState() != MTableState.TABLE_STATE_CHARGE:
            return False

        if chargeResult == self.ASK_CHARGE_NO:
            self.chargeState[seatId] = self.CHARGE_FAIL
            ftlog.debug('MChargeProcessor.updateProcessor player name:',
                        self.players[seatId].name, 'confirmLoose')
            self.players[seatId].confirmLoose()
        else:
            self.chargeState[seatId] = self.CHARGE_OK
            # 带入金币
            userId = self.players[seatId].userId
            # 钻石数量
            uDiamond = userchip.getDiamond(userId)
            tfinal, final, delta = userchip.setTableChipToN(
                userId, self.gameId, self.chargeChip[seatId] +
                self.players[seatId].getTableCoin(self.gameId, self.tableId),
                'CHIP_TO_TABLE_TCHIP', 0, tysessiondata.getClientId(userId),
                self.tableId)
            dis += '已为您带入' + str(
                self.chargeChip[seatId]) + '金币,还有' + str(tfinal) + '金币,继续游戏...'
            ftlog.info(
                'Majiang2.logAnalyse userId:', userId, 'tableCoin:',
                self.players[seatId].getTableCoin(self.gameId, self.tableId),
                'ChargeChip:', self.chargeChip[seatId], 'tableId:',
                self.tableId, 'ChargeChip')
            self.players[seatId].setCoin(hallrpcutil.getChip(userId))
            tableCoin = hallrpcutil.getTableChip(userId, self.gameId,
                                                 self.tableId)
            self.players[seatId].setTableCoin(tableCoin)
            # 通知前端背包金币发生变化
            datachangenotify.sendDataChangeNotify(self.gameId, userId, 'udata')
            ftlog.debug(
                'MChargeProcessor.updateProcessor setTableChipToN, tfinal:',
                tfinal, ' final:', final, ' delta:', delta, ' uChip:',
                self.players[seatId].coin, ' tableChip:',
                self.players[seatId].getTableCoin(self.gameId,
                                                  self.tableId), ' userId:',
                userId, ' gameId:', self.gameId, ' seatId:', seatId)
            self.msgProcessor.table_call_coin_detail(seatId,
                                                     self.chargeChip[seatId],
                                                     final, uDiamond)
        self.msgProcessor.table_call_charged(seatId, actionId,
                                             self.chargeState[seatId], dis)
        if self.isAllCharged():
            self.reset()
        return True
Пример #9
0
 def reportBiGameEvent(self,
                       eventId,
                       userId,
                       roomId,
                       tableId,
                       roundId,
                       detalChip,
                       state1,
                       state2,
                       cardlist,
                       tag=''):
     finalUserChip = hallrpcutil.getChip(userId)
     finalTableChip = 0
     clientId = tysessiondata.getClientId(userId)
     tybireport.reportGameEvent(eventId, userId, self.gameId, roomId,
                                tableId, roundId, detalChip, state1, state2,
                                cardlist, clientId, finalTableChip,
                                finalUserChip)
Пример #10
0
 def doExchangeExchange(self, request):
     mo = MsgPack()
     mi = self.checkExchange.check(request)
     if mi.error:
         mo.setError(1, mi.error)
     else:
         clientId = tysessiondata.getClientId(mi.userId)
         msg = MsgPack()
         msg.setKey('apiVersion', 5.0)
         msg.setCmdAction('exchange5', 'exchange')
         msg.setParam('phone', request.getParamStr('phone'))
         msg.setParam('uName', request.getParamStr('uName'))
         msg.setParam('uAddres', request.getParamStr('uAddres'))
         msg.setParam('gameId', tyglobal.gameId())
         msg.setParam('itemId', mi.itemId)
         msg.setParam('userId', mi.userId)
         msg.setParam('extabName', request.getParamStr('extabName'))
         msg.setParam('clientId', clientId)
         msg.setParam('wxappid',
                      hallconf.getWeiXinAppId(mi.userId, clientId))
         msg.setParam('proviceId', request.getParamStr('proviceId'))
         msg.setParam('cityId', request.getParamStr('cityId'))
         msg.setParam('countyId', request.getParamStr('countyId'))
         msg.setParam('townId', request.getParamStr('townId'))
         msg.setParam('proviceName', request.getParamStr('proviceName'))
         msg.setParam('cityName', request.getParamStr('cityName'))
         msg.setParam('countyName', request.getParamStr('countyName'))
         msg.setParam('townName', request.getParamStr('townName'))
         msg = msg.getDict()
         try:
             ret = hallRpcOne.hallexchange.doExchangeRequest(mi.userId, msg)
             datas = ret.getResult()
             if datas:
                 exchangeId, errMsg = datas[0], datas[1]
                 if exchangeId:
                     mo.setResult('exchangeId', exchangeId)
                     mo.setResult('info', errMsg)
                 else:
                     mo.setError(1, errMsg)
             else:
                 mo.setError(1, 'doExchangeRequest return is None')
         except Exception, e:
             mo.setError(1, str(e))
Пример #11
0
 def doHappyBagGetReward(self, request):
     mo = MsgPack()
     mi = self.checkHttpTaskAction.check(request)
     if mi.error:
         mo.setError(1, mi.error)
     else:
         clientId = tysessiondata.getClientId(mi.userId)
         ret = hallRpcOne.halltaskhappybag._doGetReward(mi.userId,
                                                        mi.taskId,
                                                        mi.itemId,
                                                        clientId).getResult()
         if isinstance(ret, (list, tuple)):
             code, rewards = ret[0], ret[1]
             if code == 0:
                 mo.setResult('rwards', rewards)
             else:
                 mo.setError(1, rewards)
         else:
             mo.setError(1, ret)
     return mo
Пример #12
0
def doActionByItemId(userId, gameId, itemId, actionName, timestamp, params, clientId=None):
    """
    GDSS接口在用
    """
    if _DEBUG:
        debug('doActionByItemId IN', userId, gameId, itemId, actionName, timestamp, params, clientId)

    try:
        userAssets = itemsys.itemSystem.loadUserAssets(userId)
        if not userAssets:
            return items.TYItemActionResult(None, None, -1, '用户ID资产错误', None)

        userBag = userAssets.getUserBag()
        if not userBag:
            return items.TYItemActionResult(None, None, -2, '用户ID背包错误', None)

        item = userBag.findItem(itemId)
        if not item:
            return items.TYItemActionResult(None, None, -3, '不能识别的道具ID', None)

        action = item.itemKind.findActionByName(actionName)
        if not action:
            return items.TYItemActionResult(None, None, -4, '不能执行该动作', None)

        clientId = clientId or tysessiondata.getClientId(userId)

        # 基本参数类型检查 10
        result = action.checkParams(gameId, userId, timestamp, params)
        if result.code != 0:
            return result

        # 前提条件检查 20
        result = action.checkCondition(gameId, clientId, userId, item, timestamp, params)
        if result.code != 0:
            return result

        # 执行动作 30
        result = action.doAction(gameId, clientId, userAssets, item, timestamp, params)
    except Exception, e:
        ftlog.error()
        result = items.TYItemActionResult(None, None, -6, '系统错误' + str(e), None)
Пример #13
0
 def _encodeItem(self, userBag, item, timestamp):
     clientId = tysessiondata.getClientId(userBag.userId)
     ret = {
         'itemId':
         item.itemId,
         'kindId':
         item.kindId,
         'displayName':
         item.itemKind.displayName,
         'pic':
         item.itemKind.pic,
         'count':
         max(1, item.balance(timestamp)),
         'units':
         item.itemKind.units.displayName,
         'actions':
         ItemHelper.encodeItemActionList(HALL_GAMEID, clientId, userBag,
                                         item, timestamp),
         'visible':
         True if item.itemKind.visibleInBag and item.visibleInBag(timestamp)
         else False
     }
     if item.createTime > 0:
         ret['createTime'] = datetime.fromtimestamp(
             item.createTime).strftime('%Y-%m-%d %H:%M:%S')
     else:
         ret['createTime'] = ''
     if item.itemKind.units.isTiming and item.expiresTime > 0:
         ret['expires'] = datetime.fromtimestamp(
             item.expiresTime).strftime('%Y-%m-%d %H:%M:%S')
     else:
         ret['expires'] = ''
     extDatas = {}
     extNames = item.itemKind.newItemData()._getFieldNames()
     if extNames:
         for n in extNames:
             extDatas[n] = getattr(item, n, None)
     ret['extDatas'] = extDatas
     return ret
Пример #14
0
def incrDiamond(userId,
                gameid,
                deltaCount,
                chipNotEnoughOpMode,
                eventId,
                intEventParam,
                clientId,
                extentId=0,
                roomId=0,
                tableId=0,
                roundId=0,
                param01=0,
                param02=0):
    if not clientId:
        clientId = tysessiondata.getClientId(userId)
    lowLimit, highLimit = -1, -1
    trueDelta, finalCount, fixed = DaoUserData.HINCRBY_LIMIT(
        userId, UserKeys.ATT_DIAMOND, deltaCount, lowLimit, highLimit,
        chipNotEnoughOpMode)
    _chipReport(userId,
                gameid,
                deltaCount,
                lowLimit,
                highLimit,
                chipNotEnoughOpMode,
                eventId,
                intEventParam,
                CHIP_TYPE_DIAMOND,
                trueDelta,
                finalCount,
                fixed,
                extentId=extentId,
                roomId=roomId,
                tableId=tableId,
                roundId=roundId,
                param01=param01,
                param02=param02)
    return trueDelta, finalCount
Пример #15
0
    def doLeave(self, userId, msg):

        ftlog.hinfo("doLeave |userId, msg:", userId, msg, caller=self)

        reason = msg.getParam("reason", TYRoom.LEAVE_ROOM_REASON_ACTIVE)
        assert isinstance(reason, int)
        needSendRes = msg.getParam("needSendRes", True)
        assert isinstance(needSendRes, bool)
        clientRoomId = msg.getParam("clientRoomId", self.roomId)
        assert isinstance(clientRoomId, int)

        if not self._leave(userId, reason, needSendRes):
            reason = TYRoom.LEAVE_ROOM_REASON_FORBIT

        TYPluginCenter.event(
            TYPluginUtils.updateMsg(cmd='EV_LEAVE_ROOM',
                                    params=TYPluginUtils.mkdict(
                                        userId=userId,
                                        roomId=self.roomId,
                                        reason=reason)), self.gameId)

        msgRes = MsgPack()
        if not pokerconf.isOpenMoreTable(tysessiondata.getClientId(userId)):
            msgRes.setCmd("room_leave")
        else:
            msgRes.setCmd("room")
            msgRes.setResult("action", "leave")

        msgRes.setResult("reason", reason)
        msgRes.setResult("gameId", self.gameId)
        msgRes.setResult(
            "roomId",
            clientRoomId)  # 处理结果返回给客户端时,部分游戏(例如德州、三顺)需要判断返回的roomId是否与本地一致
        msgRes.setResult("userId", userId)

        if needSendRes or TYPlayer.isRobot(userId):  # 需要通知机器人stop
            tyrpcconn.sendToUser(userId, msgRes)
Пример #16
0
 def getClientId(self, uid):
     if uid < 10000:
         clientId = "robot_3.7_-hall6-robot"
     else:
         clientId = tysessiondata.getClientId(uid)
     return clientId
Пример #17
0
    def _remoteTableLeave(self,
                          userId,
                          reason=LEAVE_ROOM_REASON_ACTIVE,
                          locList=None):
        if not locList:
            locList = pluginCross.onlinedata.getOnLineLocList(userId)
        if ftlog.is_debug():
            ftlog.debug("<< |roomId, userId: ",
                        self.roomId,
                        userId,
                        "|locList:",
                        locList,
                        caller=self)
        for loc in locList:
            onlineRoomId, onlineTableId = loc[0], loc[1]
            onlineGameId = tyconfig.getRoomGameId(onlineRoomId)
            if onlineGameId <= 0:  # 房间已经无效
                pluginCross.onlinedata.removeOnLineLoc(userId, onlineRoomId,
                                                       onlineTableId)
                continue
            if onlineGameId != tyglobal.gameId():  # 不隶属与当前的游戏,不处理
                continue
            ctrlRoomId = tyconfig.getRoomDefine(onlineRoomId).parentId
            if ctrlRoomId == self.roomId:
                ftlog.hinfo(
                    "table leave |userId, onlineRoomId, onlineTableId:",
                    userId,
                    onlineRoomId,
                    onlineTableId,
                    caller=self)
                clientId = tysessiondata.getClientId(userId)
                tableLeaveResultStr = self.queryTableManageTableLeaveReq(
                    userId, onlineRoomId, onlineTableId, clientId,
                    {"reason": reason})
                if not tableLeaveResultStr:
                    ftlog.warn(
                        "table leave timeout, |userId, onlineRoomId, onlineTableId, reason:",
                        userId,
                        onlineRoomId,
                        onlineTableId,
                        reason,
                        caller=self)

                # 玩家离开牌桌只返回成功
#                 tableLeaveResult = json.loads(tableLeaveResultStr)
#                 ftlog.debug("|tableLeaveResult:", tableLeaveResult)
#                 if tableLeaveResult.get("error"):
#                     return False
#                 if not tableLeaveResult["result"]["isOK"]:
#                     return False

        if ftlog.is_debug():
            locList = pluginCross.onlinedata.getOnLineLocList(userId)
            ftlog.debug(">> |roomId, userId: ",
                        self.roomId,
                        userId,
                        "|locList:",
                        locList,
                        caller=self)
#                 return True

        return True
Пример #18
0
def _chipReport(uid,
                gameid,
                deltaCount,
                lowLimit,
                highLimit,
                chipNotEnoughOpMode,
                eventId,
                intEventParam,
                chipType,
                trueDelta,
                finalCount,
                fixed,
                extentId=0,
                roomId=0,
                tableId=0,
                roundId=0,
                param01=0,
                param02=0):
    clientId = tysessiondata.getClientId(uid)
    numberClientId = tyconfig.clientIdToNumber(clientId)
    appId = tysessiondata.getGameId(uid)

    args = {}
    args['clientId'] = clientId
    args['appId'] = appId
    args['deltaCount'] = deltaCount
    args['lowLimit'] = lowLimit
    args['highLimit'] = highLimit
    args['chipType'] = chipType
    args['mode'] = chipNotEnoughOpMode

    if fixed != 0:
        tybireport.reportBiChip(uid,
                                fixed,
                                fixed,
                                0,
                                EVENT_NAME_SYSTEM_REPAIR,
                                numberClientId,
                                gameid,
                                appId,
                                intEventParam,
                                chipType,
                                extentId=extentId,
                                roomId=roomId,
                                tableId=tableId,
                                roundId=roundId,
                                param01=param01,
                                param02=param02,
                                argdict=args)
    if trueDelta != 0 or deltaCount == 0:
        tybireport.reportBiChip(uid,
                                deltaCount,
                                trueDelta,
                                finalCount,
                                eventId,
                                numberClientId,
                                gameid,
                                appId,
                                intEventParam,
                                chipType,
                                extentId=extentId,
                                roomId=roomId,
                                tableId=tableId,
                                roundId=roundId,
                                param01=param01,
                                param02=param02,
                                argdict=args)
Пример #19
0
    def getValidIdleSeatId(self, userId, seatIndex, result):
        '''通用坐下合法性检查函数

        Returns
            idleSeatId:
                >0   :  为新玩家找到合适座位,需要继续处理
                <0   :   断线重连
                0    :  坐下失败
         '''

        clientId = tysessiondata.getClientId(userId)
        onlineSeatId = pluginCross.onlinedata.getOnLineLocSeatId(
            userId, self.table.roomId, self.table.tableId)
        if onlineSeatId and onlineSeatId <= self.maxSeatN:  # 断线重连, Note:旁观的人坐下此处不能返回负数,否则无法入座
            ftlog.hinfo('re-sit ok. |userId, tableId, seatId:',
                        userId,
                        self.tableId,
                        onlineSeatId,
                        caller=self)
            result["seatId"] = onlineSeatId
            result["reason"] = TYRoom.ENTER_ROOM_REASON_OK
            self.sendQuickStartRes(userId, clientId, result)
            return -onlineSeatId

        isOk, reason = self._checkSitCondition(userId)
        if not isOk:
            result["isOK"] = False
            result["reason"] = reason
            #             if reason == TYRoom.ENTER_ROOM_REASON_TABLE_FULL and userId in self.observers: #玩家从旁观状态点坐下排队,不下发quick_start
            if reason == TYRoom.ENTER_ROOM_REASON_TABLE_FULL:
                pass
            else:
                self.sendQuickStartRes(userId, clientId, result)
            return 0

        # 按指定座位坐下,如果座位上有人则随机分配座位。
        if seatIndex >= 0 and seatIndex < self.maxSeatN:
            if self.seats[seatIndex].isEmptySeat():
                return seatIndex + 1
            else:
                ftlog.warn(
                    "seatIndex >=0 but not self.seats[seatIndex].isEmptySeat()",
                    "|userId, roomId, tableId, seatIndex:",
                    userId,
                    self.table.roomId,
                    self.table.tableId,
                    seatIndex,
                    caller=self)

        idleSeatId = self.findIdleSeat(userId)

        if idleSeatId < 0:
            # 断线重连机制出错了??
            # 已经在座位上坐下, 返回成功消息和桌子信息
            ftlog.warn("idleSeatId < 0",
                       "|userId, roomId, tableId, idleSeatId:",
                       userId,
                       self.table.roomId,
                       self.table.tableId,
                       idleSeatId,
                       caller=self)
            result["seatId"] = abs(idleSeatId)
            result["reason"] = TYRoom.ENTER_ROOM_REASON_OK
            self.sendQuickStartRes(userId, clientId, result)
            return idleSeatId

        if idleSeatId == 0:  # 座位已经满了, 返回失败消息
            ftlog.warn("idleSeatId == 0",
                       "|userId, roomId, tableId, idleSeatId:",
                       userId,
                       self.table.roomId,
                       self.table.tableId,
                       idleSeatId,
                       caller=self)
            result["isOK"] = False
            result["reason"] = TYRoom.ENTER_ROOM_REASON_TABLE_FULL
            if userId not in self.observers:  # 玩家从旁观状态点坐下排队,不下发quick_start
                self.sendQuickStartRes(userId, clientId, result)
            return 0

        # 为了支持并发坐下,findIdleSeat后不应该有异步操作
        # 座位冲突检查
#         lastUserId = self.table.getLastSeatUserId(idleSeatId)
#         if lastUserId and lastUserId != userId :
#             ftlog.error(getMethodName(), 'seat Userid is not clean up !! tid=', self.table.tableId,
#                         'seatId=', idleSeatId, 'olduid=', lastUserId, 'newuid=', userId)
#             result["isOK"] = False
#             result["reason"] = TYRoom.ENTER_ROOM_REASON_INNER_ERROR
#             self.sendQuickStartRes(userId, clientId, result)
#             return 0

        return idleSeatId
Пример #20
0
def _setTableChipToRange(uid,
                         gameid,
                         _min,
                         _max,
                         eventId,
                         intEventParam,
                         clientId,
                         tableId,
                         extentId=0,
                         roomId=0,
                         roundId=0,
                         param01=0,
                         param02=0):
    assert (isinstance(_min, int) and (_min >= 0 or _min in (-1, -2, -3))
            and isinstance(_max, int) and (_max >= 0 or _max in (-1, -2, -3)))

    numberClientId = tyconfig.clientIdToNumber(tysessiondata.getClientId(uid))
    appId = tysessiondata.getGameId(uid)

    otherAttName = str(tableId)
    otherKey = DaoTableChip.MAINKEY % (uid)
    tdelta, tfinal, tfixed, delta, final, fixed = DaoUserData.MOVE_OTHER_INT_TO_RANGE(
        uid, _min, _max, UserKeys.ATT_CHIP, otherKey, otherAttName)

    if _DEBUG:
        debug('UserChip->_setTableChipToRange', uid, gameid, _min, _max,
              eventId, intEventParam, clientId, tableId, otherKey, roomId,
              roundId, param01, param02, 'result->', tdelta, tfinal, tfixed,
              delta, final, fixed)

    args = {}
    args['clientId'] = clientId
    args['appId'] = appId
    args['_min'] = _min
    args['_max'] = _max

    if tfixed != 0:
        tybireport.reportBiChip(uid,
                                tfixed,
                                tfixed,
                                0,
                                EVENT_NAME_SYSTEM_REPAIR,
                                numberClientId,
                                gameid,
                                appId,
                                intEventParam,
                                CHIP_TYPE_TABLE_CHIP,
                                extentId=extentId,
                                roomId=roomId,
                                tableId=tableId,
                                roundId=roundId,
                                param01=param01,
                                param02=param02,
                                argdict=args)
    if fixed != 0:
        tybireport.reportBiChip(uid,
                                fixed,
                                fixed,
                                0,
                                EVENT_NAME_SYSTEM_REPAIR,
                                numberClientId,
                                gameid,
                                appId,
                                intEventParam,
                                CHIP_TYPE_CHIP,
                                extentId=extentId,
                                roomId=roomId,
                                tableId=tableId,
                                roundId=roundId,
                                param01=param01,
                                param02=param02,
                                argdict=args)
    if tdelta != 0:
        tybireport.reportBiChip(uid,
                                tdelta,
                                tdelta,
                                tfinal,
                                eventId,
                                numberClientId,
                                gameid,
                                appId,
                                intEventParam,
                                CHIP_TYPE_TABLE_CHIP,
                                extentId=extentId,
                                roomId=roomId,
                                tableId=tableId,
                                roundId=roundId,
                                param01=param01,
                                param02=param02,
                                argdict=args)
    if delta != 0:
        tybireport.reportBiChip(uid,
                                delta,
                                delta,
                                final,
                                eventId,
                                numberClientId,
                                gameid,
                                appId,
                                intEventParam,
                                CHIP_TYPE_CHIP,
                                extentId=extentId,
                                roomId=roomId,
                                tableId=tableId,
                                roundId=roundId,
                                param01=param01,
                                param02=param02,
                                argdict=args)
        typlugin.asyncTrigerEvent(
            tygame.ChipChangedEvent(uid, gameid, delta, final))

    return tfinal, final, delta