示例#1
0
def del_chat(user_id, target_user_id):
    debug("ChatService _del_chat RPC ", user_id, target_user_id)
    rpcproxy = getRpcProxy(CHAT_GAME_ID, RPC_CALL_SAFE, RPC_TARGET_MOD_ONE)
    rfc = rpcproxy.srvutil.doDelChat(user_id, target_user_id)
    ret = rfc.getResult()
    debug("ChatService _del_chat RPC ", ret)
    return ret
示例#2
0
    def doAction(self, gameId, clientId, userAssets, item, timestamp, params):
        if item.isDied(timestamp):
            return items.TYItemActionResult(None, None, -30, '道具已经过期', None)
        # 消耗道具
        userBag = userAssets.getUserBag()
        count = userBag.consumeItemUnits(gameId, item, 1, timestamp,
                                         'ITEM_USE', item.kindId)
        if count != 1:
            return items.TYItemActionResult(None, None, -31, '道具数量不足', None)

        return items.TYItemActionResult(None, None, 0, 'ok, not implement',
                                        None)

        rpcproxy = typlugin.getRpcProxy(self.gameId, typlugin.RPC_CALL_SAFE,
                                        typlugin.RPC_TARGET_MOD_ONE)
        rfc = rpcproxy.gamemgr.setGameData(userBag.userId, self.gameId,
                                           self.field, self.value)
        if not rfc:
            return items.TYItemActionResult(None, None, -32, '系统错误,目标游戏服务不存在',
                                            None)
        if rfc.getException():
            return items.TYItemActionResult(
                None, None, -33, '系统错误,目标游戏服务异常:' + str(rfc.getException()),
                None)
        code, info = rfc.getResult()
        return items.TYItemActionResult(None, None, code, info, None)
示例#3
0
def doCasualMatchGameVSPlayer():
    for gameId in gameIdList:
        while DaoCasualGameMatch.getMatchGameQueueLength(gameId) >= 2:
            player_A_userId, player_B_userId = DaoCasualGameMatch.getMatchGameQueueUsers(
                gameId)
            if _DEBUG:
                debug("doCasualMatchGameVSPlayer @@@@ gameid = ", gameId,
                      "player_A_userId", player_A_userId, "player_B_userId",
                      player_B_userId)
            rpcproxy = getRpcProxy(gameId, RPC_CALL_SAFE, RPC_TARGET_MOD_ONE)
            rpcproxy.srvutil.doMatchCasualGamePlayers(player_A_userId,
                                                      player_B_userId)

            mo = MsgPack()
            mo.setCmd('match_result')
            mo.setResult('gameId', gameId)
            mo.setResult('other_userId', player_B_userId)
            mo.setResult('result', 'match success')
            tyrpcconn.sendToUser(player_A_userId, mo)

            mo = MsgPack()
            mo.setCmd('match_result')
            mo.setResult('gameId', gameId)
            mo.setResult('other_userId', player_A_userId)
            mo.setResult('result', 'match success')
            tyrpcconn.sendToUser(player_B_userId, mo)
示例#4
0
def system_chat(user_id, target_user_id, code):
    debug("ChatService _system_chat RPC ", user_id, target_user_id, code)
    rpcproxy = getRpcProxy(CHAT_GAME_ID, RPC_CALL_SAFE, RPC_TARGET_MOD_ONE)
    rfc = rpcproxy.srvchat.sns_system_message(user_id, target_user_id, code)
    ret = rfc.getResult()
    debug("ChatService _system_chat RPC ", ret)
    return ret
示例#5
0
def _upload_vs_record(user_id,target_user_id,mini_game_id, win_user_id):
    debug("SNSService _upload_vs_record RPC ", user_id, target_user_id, mini_game_id, win_user_id)
    rpcproxy = getRpcProxy(SNS_GAME_ID, RPC_CALL_SAFE, RPC_TARGET_MOD_ONE)
    rfc = rpcproxy.srvhttp.upload_vs_record(user_id,target_user_id, mini_game_id, win_user_id)
    ret = rfc.getResult()
    debug("SNSService _upload_vs_record RPC ", ret)
    return ret
示例#6
0
def _check_friend(user_id,target_user_id):
    debug("SNSService _check_friend RPC ", user_id, target_user_id)
    rpcproxy = getRpcProxy(SNS_GAME_ID, RPC_CALL_SAFE, RPC_TARGET_MOD_ONE)
    rfc = rpcproxy.srvhttp.verify_friend(user_id,target_user_id)
    ret = rfc.getResult()
    debug("SNSService _check_friend RPC ", ret)
    return ret
示例#7
0
 def test_chat2(self, request):
     """
     测试聊天.
     :param request:
     :return:
     """
     rpcproxy = getRpcProxy(9993, RPC_CALL_SAFE, RPC_TARGET_MOD_ONE)
     rfc = rpcproxy.srvutil.doSomething(10001, "hello,by test_http_chat2")
     result = rfc.getResult()
     debug("test_chat2", result)
     return 'chat send ok2'
示例#8
0
def _getSubGameDataVal(gameId, userId, attrName):
    rpcproxy = typlugin.getRpcProxy(gameId, typlugin.RPC_CALL_SAFE,
                                    typlugin.RPC_TARGET_MOD_ONE)
    rfc = rpcproxy.gamemgr.getGameData(userId, gameId, attrName)
    if not rfc:
        ftlog.warn('ERROR, the target game service not found !')
        return None

    elif rfc.getException():
        ftlog.warn('ERROR, the target game service got exception !',
                   str(rfc.getException()))
        return None
    return rfc.getResult()
示例#9
0
def doFriendMatch(userId_a, userId_b, gameId):
    if _DEBUG:
        debug("doFriendMatch @@@@ gameId =", gameId, " userId_a =", userId_a,
              " userId_b =", userId_b)
    rpcproxy = getRpcProxy(gameId, RPC_CALL_SAFE, RPC_TARGET_MOD_ONE)
    rpcproxy.srvutil.doMatchCasualGamePlayers(userId_a, userId_b)