示例#1
0
def consumeEmoticonNameToBIEventId(ename):
    numDict = {
        'egg': pokerconf.biEventIdToNumber("EMOTICON_EGG_CONSUME"),
        'bomb': pokerconf.biEventIdToNumber("EMOTICON_BOMB_CONSUME"),
        'flower': pokerconf.biEventIdToNumber("EMOTICON_FLOWER_CONSUME"),
        'diamond': pokerconf.biEventIdToNumber("EMOTICON_DIAMOND_CONSUME"),
        'eggs': pokerconf.biEventIdToNumber("EMOTICON_EGG_CONSUME"),
        'rose': pokerconf.biEventIdToNumber("EMOTICON_FLOWER_CONSUME"),
        'ring': pokerconf.biEventIdToNumber("EMOTICON_DIAMOND_CONSUME"),
    }
    num = numDict.get(ename, pokerconf.biEventIdToNumber("UNKNOWN"))

    return num
示例#2
0
def addChip(userId, gameId, clientId, chip, leagueId, homewin, winPos):
    trueDelta, final = userchip.incrChip(
        userId, gameId, chip, userchip.ChipNotEnoughOpMode.NOOP,
        pokerconf.biEventIdToNumber("HALL_SPORTLOTTERY"), leagueId, clientId,
        0, int(homewin * 100), winPos)
    if trueDelta != 0:
        datachangenotify.sendDataChangeNotify(gameId, userId, 'udata')

    ftlog.hinfo('sportlottery addchip', 'userId=', userId, 'chip=', chip,
                'trueDelta=', trueDelta, 'final=', final)

    return trueDelta, final
示例#3
0
文件: util.py 项目: zhaozw/hall37
def consumeEmoticonNameToBIEventId(ename):
    numDict = {
        'egg': pokerconf.biEventIdToNumber("EMOTICON_EGG_CONSUME"),
        'bomb': pokerconf.biEventIdToNumber("EMOTICON_BOMB_CONSUME"),
        'flower': pokerconf.biEventIdToNumber("EMOTICON_FLOWER_CONSUME"),
        'diamond': pokerconf.biEventIdToNumber("EMOTICON_DIAMOND_CONSUME"),

        'eggs': pokerconf.biEventIdToNumber("EMOTICON_EGG_CONSUME"),
        'rose': pokerconf.biEventIdToNumber("EMOTICON_FLOWER_CONSUME"),
        'ring': pokerconf.biEventIdToNumber("EMOTICON_DIAMOND_CONSUME"),
    }
    num = numDict.get(ename, pokerconf.biEventIdToNumber("UNKNOWN"))

    return num
示例#4
0
文件: bireport.py 项目: zhaozw/hall37
def reportCardEvent(eventId, user_id, gameId, roomId, tableId, roundId, detalChip, state1, state2, cardlist, clientId,
                    finalTableChip=0, finalUserChip=0,
                    arglist=[], argdict={}, logtag='card_event'):
    '''
    游戏出牌事件的HTTP远程BI汇报
    '''
    # fmt = "I I H I Q Q I q q q B B 20B"
    #        | | | | | | | | | | | | |
    #        | | | | | | | | | | | | └- cardlist 当前事件操作的牌, 数字(0~54), 0xFF为无效
    #        | | | | | | | | | | | └- state2 当前事件操作的状态2(例如:托管,超时)
    #        | | | | | | | | | | └- state1 当前事件操作的状态1(例如:托管,超时)
    #        | | | | | | | | | └- finalUserChip 当前事件用户的最终所有金币数量
    #        | | | | | | | | └- finalTableChip 当前事件用户的最终桌子金币数量
    #        | | | | | | | └- detalChip 当前事件操作涉及的金币数量
    #        | | | | | | └- roundId 当前事件的游戏局ID(如果为比赛事件,即为比赛的ID, 如果为普通牌桌,即为牌局ID或时间戳)
    #        | | | | | └- tableId 游戏事件发生的房间桌子ID
    #        | | | | └- roomId 游戏事件发生的房间
    #        | | | └- clientId 客户端的clientId
    #        | | └- gameId 后端服务操作时使用的gameId
    #        | └- userId 事件产生的用户
    #        └- eventId 事件ID
    eventId = pokerconf.biEventIdToNumber(eventId)
    user_id = int(user_id)
    gameId = int(gameId)
    _, clientId = sessiondata.getClientIdNum(user_id, clientId)
    assert (isinstance(eventId, (int, long)))
    assert (isinstance(user_id, (int, long)))
    assert (isinstance(gameId, (int, long)))
    assert (isinstance(roomId, (int, long)))
    assert (isinstance(tableId, (int, long)))
    assert (isinstance(roundId, (int, long)))
    assert (isinstance(detalChip, (int, long)))
    assert (isinstance(state1, (int, long)))
    assert (isinstance(state2, (int, long)))
    assert (isinstance(clientId, (int, long)))
    assert (isinstance(finalUserChip, (int, long)))
    assert (isinstance(finalTableChip, (int, long)))
    cards = [0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
             0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
             0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
             0xFF, 0xFF, 0xFF, 0xFF, 0xFF]
    if cardlist:
        for x in xrange(min(20, len(cardlist))):
            cards[x] = int(cardlist[x])
    # 本地日志
    alist = [logtag, eventId, user_id, gameId, roomId, tableId, roundId, detalChip, state1, state2, cardlist, clientId,
             finalTableChip, finalUserChip]
    alist.extend(arglist)
    _report(alist, argdict)
    if _ENABLE_BIFILE:
        return 1
示例#5
0
def addAssetnpw(userId, itemId, count, biEventId):
    timestamp = pktimestamp.getCurrentTimestamp()
    userAssets = hallitem.itemSystem.loadUserAssets(userId)

    assetKind, _consumecount, _finalcount = userAssets.addAsset(
        HALL_GAMEID, itemId, count, timestamp,
        pokerconf.biEventIdToNumber(biEventId), 0)

    ftlog.hinfo("addAssetnpw|reward|addAsset|", biEventId, userId, itemId,
                count)
    # 通知用户道具和消息存在改变
    if assetKind.keyForChangeNotify:
        datachangenotify.sendDataChangeNotify(
            HALL_GAMEID, userId, [assetKind.keyForChangeNotify, 'message'])
示例#6
0
def addChip(userId, gameId, clientId, chip):
    trueDelta, final = userchip.incrChip(userId, gameId, chip,
                                         ChipNotEnoughOpMode.NOOP,
                                         pokerconf.biEventIdToNumber("HALL_VIPCOMPLEMENT"),
                                         0, clientId)
    ftlog.hinfo("newcheckin|complementByVip|", gameId, userId, chip, trueDelta, final)

    if ftlog.is_debug():
        ftlog.debug('complementByVip.add gameId=', gameId,
                    'userId=', userId,
                    'count=', chip,
                    'trueDelta=', trueDelta,
                    'final=', final)

    return final
示例#7
0
文件: bireport.py 项目: zhaozw/hall37
def reportBiChip(user_id, delta, trueDelta, final, eventId,
                 clientId, gameId, appId, eventParam, chipType, extentId=0,
                 arglist=[], argdict={}, logtag='chip_update'):
    '''
    用户货币变化的HTTP远程BI汇报
    '''
    # fmt = "I q q q I I H H I B I"
    #        | | | | | | | | | | └-- extentId 扩展类型类型, 目前当为道具的时候为道具的kindId
    #        | | | | | | | | | └-- chipType 金币类型, 参考: CHIP_TYPE_ALL
    #        | | | | | | | | └-- eventParam 事件的参数
    #        | | | | | | | └- appId 客户端登录时产生的appId
    #        | | | | | | └- gameId 后端服务操作时使用的gameId
    #        | | | | | └- clientId 客户端终端的ID
    #        | | | | └- eventId 事件ID
    #        | | | └- final 最终的数量
    #        | | └- trueDelta 实际变化的数量
    #        | └- delta 期望发生的数量
    #        └- userId 事件产生的用户
    eventId = pokerconf.biEventIdToNumber(eventId)
    assert (isinstance(user_id, (int, long)))
    assert (isinstance(delta, (int, long)))
    assert (isinstance(trueDelta, (int, long)))
    assert (isinstance(final, (int, long)))
    assert (isinstance(eventId, (int, long)))
    assert (isinstance(clientId, (int, long)))
    assert (isinstance(gameId, (int, long)))
    assert (isinstance(appId, (int, long)))
    assert (isinstance(eventParam, (int, long)))
    assert (chipType in CHIP_TYPE_ALL)
    assert (isinstance(extentId, (int, long)))
    # 本地日志
    alist = [logtag, user_id, delta, trueDelta, final, eventId, clientId, gameId, appId, eventParam, chipType, extentId]
    alist.extend(arglist)
    _report(alist, argdict)
    if _ENABLE_BIFILE:
        return 1
    # 远程日志
    return reportHttpBi(user_id, 'chip', 'IqqqIIHHIBI',
                        user_id, delta, trueDelta, final, eventId,
                        clientId, gameId, appId, eventParam, chipType, extentId)