示例#1
0
def pushChatToObjectList(id,tid):
	'''推送私聊角色列表'''
	from app.chatServer.core.ChaterManager import ChaterManager
	from app.chatServer.core.ChaterLogManager import ChaterLogManager
	response=ChatToObjectListInfo1010_pb2.ChatToObjectListResponse()
	clog=ChaterLogManager().addChatLog(id)#获取聊天类
	listid=clog.getFriends()#获取角色私聊对象id列表
	if len(listid)<0:
		return
	gamer=ChaterManager().getChaterByCharacterId(id)
	if not gamer:
		return
	gamerid=gamer.getDynamicId()
	for cid in listid:
		gamer1=ChaterManager().getChaterByCharacterId(cid)
		info=response.chatObjectInfo.add()
		info.chatObjectId=cid
		info.name=gamer1.getCharacterName()
		info.level=str(gamer1.level)
		if gamer1.island:
			info.chatObjectPos=gamer1.scenename
		else:
			info.chatObjectPos=lg().g(106)
		info.readFlag=ChaterLogManager().getFriendReaderState(id,cid)
	msg=response.SerializeToString()
	pushApplyMessage(1010,msg,[gamer1])
def pushChatToObjectList(id,tid):
    '''推送私聊角色列表'''
    from app.chatServer.core.ChaterManager import ChaterManager
    from app.chatServer.core.ChaterLogManager import ChaterLogManager
    response=ChatToObjectListInfo1010_pb2.ChatToObjectListResponse()
    clog=ChaterLogManager().addChatLog(id) #获取聊天类
    listid=clog.getFriends()#获取角色私聊对象id列表
    if len(listid)<0:
        return
    player=ChaterManager().getChaterByCharacterId(id)
#    player=PlayersManager().getPlayerByID(id)
    if not player:
        #print "推送私聊角色列表时没有角色"+str(id)
        return 
    #print "角色私聊角色列表发送给"+player.baseInfo.getNickName()
    playerid=player.getDynamicId()
    for cid in listid:
        player1=ChaterManager().getChaterByCharacterId(cid)
        info=response.chatObjectInfo.add()
        info.chatObjectId=cid
        info.name=player1.getCharacterName()
        #print "私聊信息角色列表:"+player1.baseInfo.getNickName()
        info.level=str(player1.level)
        info.perfession=player1.getProfessionName()
        if player1.island:
                info.chatObjectPos=player1.scenename
        else:
            info.chatObjectPos=Lg().g(106)
        info.readFlag=ChaterLogManager().getFriendReaderState(id, cid)
    #print "------------------------------------------------------------------"
    msg = response.SerializeToString()
    pushApplyMessage(1010,msg,[playerid])
示例#3
0
def pushChatToObjectList(id, tid):
    '''推送私聊角色列表'''
    from app.chatServer.core.ChaterManager import ChaterManager
    from app.chatServer.core.ChaterLogManager import ChaterLogManager
    response = ChatToObjectListInfo1010_pb2.ChatToObjectListResponse()
    clog = ChaterLogManager().addChatLog(id)  #获取聊天类
    listid = clog.getFriends()  #获取角色私聊对象id列表
    if len(listid) < 0:
        return
    gamer = ChaterManager().getChaterByCharacterId(id)
    if not gamer:
        return
    gamerid = gamer.getDynamicId()
    for cid in listid:
        gamer1 = ChaterManager().getChaterByCharacterId(cid)
        info = response.chatObjectInfo.add()
        info.chatObjectId = cid
        info.name = gamer1.getCharacterName()
        info.level = str(gamer1.level)
        if gamer1.island:
            info.chatObjectPos = gamer1.scenename
        else:
            info.chatObjectPos = lg().g(106)
        info.readFlag = ChaterLogManager().getFriendReaderState(id, cid)
    msg = response.SerializeToString()
    pushApplyMessage(1010, msg, [gamer1])
示例#4
0
def SendChatMessageRequest_1013(dynamicId,request_proto):
	'''当前角色发送私聊信息'''
	import time
	from app.chatServer.core.ChaterManager import ChaterManager
	argument=SendChatMessage1013_pb2.SendChatMessageRequest()
	argument.ParseFromString(request_proto)
	response=SendChatMessage1013_pb2.SendChatMessageResponse()
	id=argument.id
	tid=argument.chatId
	context=argument.chatMessage

	chater=ChaterManager().getChaterByCharacterId(id)
	if chater.donttalk==0:#不禁言
		timet=ste(time.strftime('%Y-%m-%d %X'))
		title="<font color='#ffffff'>"
		title+=chater.getrCharacterName()
		title+=":</font><br/>"
		title+=u"<font color='#ffffff'>&nbsp;&nbsp;%s</font><br/>"%context
		ChaterLogManager().addLog(id,tid,title,timet)
		response.result=True
		response.message=u''
	else:#禁言
		response.result=True
		response.message=Lg().g(644)
	return response.SerializeToString()
示例#5
0
def CloseChatWindowRequest_1014(dynamicId,request_proto):
	'''关闭私聊窗口'''
	argument=CloseChatWindow1014_pb2.CloseChatWindowRequest()
	argument.ParseFromString(request_proto)
	response=CloseChatWindow1014_pb2.CloseChatWindowResponse()

	id=argument.id
	ChaterLogManager().closeChat(id)
	response.result=True
	response.message=u''
	return response.SerializeToString()
示例#6
0
def GetChatInfoRequest_1011(dynamicId,request_proto):
	'''获取私聊信息'''
	argument=GetOneObjectChatInfo1011_pb2.GetOneObjectChatInfoRequest()
	argument.ParseFromString(request_proto)
	response=GetOneObjectChatInfo1011_pb2.GetOneObjectChatInfoResponse()

	id=argument.id
	tid=argument.chatObjectId
	val=ChaterLogManager().getLog(id,tid)
	if val.get('result',None):
		response.result=True
		response.message=u''
		response.chatMessage=val.get('result',u'')
		response.level=val.get('level',0)
		response.chatObjectPos=val.get('chatObjectPos',u'')
		response.name=val.get('name',u'')
	else:
		response.result=True
		response.message=u''
		response.chatMessage=val.get('result',u'')
		response.level=val.get('level',0)
		response.chatObjectPos=val.get('chatObjectPos',u'')
		response.name=val.get('name',u'')
	return response.SerializeToString()
示例#7
0
def GetChatInfoRequest_1011(dynamicId, request_proto):
    '''获取私聊信息'''
    argument=GetOneObjectChatInfo1011_pb2.GetOneObjectChatInfoRequest()
    argument.ParseFromString(request_proto)
    response = GetOneObjectChatInfo1011_pb2.GetOneObjectChatInfoResponse()
    
    id=argument.id
    tid=argument.chatObjectId
    val=ChaterLogManager().getLog(id, tid)
    if val.get('result',None):
        response.result =True
        response.message =u''
        response.chatMessage=val.get('result',u'')
        response.level=val.get('level',0)
        response.perfession=val.get('perfession',Lg().g(143))
        response.chatObjectPos=val.get('chatObjectPos',u'')
        response.name=val.get('name',u'')
        
    else:
        response.result =True
        response.message =u''
        response.chatMessage=val.get('result',u'')
        response.level=val.get('level',0)
        response.perfession=val.get('perfession',Lg().g(143))
        response.chatObjectPos=val.get('chatObjectPos',u'')
        response.name=val.get('name',u'')
    return response.SerializeToString()