def CloseChatWindowRequest_1014(dynamicId, request_proto): '''关闭私聊窗口''' argument = CloseChatWindow1014_pb2.CloseChatWindowRequest() argument.ParseFromString(request_proto) response = CloseChatWindow1014_pb2.CloseChatWindowResponse() id = argument.id #当前角色id ChaterLogManager().closeChat(id) response.result = True response.message = u'' return response.SerializeToString()
def pushChatToObjectList(id,tid): '''推送私聊角色列表''' from app.scense.protoFile.chat import ChatToObjectListInfo1010_pb2 from app.scense.core.ChaterLogManager import ChaterLogManager from app.scense.core.character.PlayerCharacter import PlayerCharacter response=ChatToObjectListInfo1010_pb2.ChatToObjectListResponse() clog=ChaterLogManager().addChatLog(id) #获取聊天类 listid=clog.getFriends()#获取角色私聊对象id列表 if len(listid)<0: return player=PlayersManager().getPlayerByID(id) if not player: #print "推送私聊角色列表时没有角色"+str(id) return #print "角色私聊角色列表发送给"+player.baseInfo.getNickName() playerid=player.getDynamicId() for cid in listid: players=PlayersManager().getPlayerByID(cid) player1=PlayerCharacter(cid)#角色实例 info=response.chatObjectInfo.add() info.chatObjectId=cid info.name=player1.baseInfo.getNickName() #print "私聊信息角色列表:"+player1.baseInfo.getNickName() info.level=str(player1.level._level) info.perfession=player1.profession.getProfessionName() del player1 if players: if players.baseInfo.getState()>0: info.chatObjectPos=Lg().g(316) info.chatObjectPos=players.baseInfo.getSceneName().decode('utf8') else: info.chatObjectPos=Lg().g(106) info.readFlag=ChaterLogManager().getFriendReaderState(id, cid) #print "------------------------------------------------------------------" msg = response.SerializeToString() pushApplyMessage(1010,msg,[playerid])
def SendChatMessageRequest_1013(dynamicId, request_proto): '''当前角色发送私聊信息''' argument = SendChatMessage1013_pb2.SendChatMessageRequest() argument.ParseFromString(request_proto) response = SendChatMessage1013_pb2.SendChatMessageResponse() id = argument.id tid = argument.chatId context = argument.chatMessage # print str(id)+" ############ "+str(tid) player = PlayersManager().getPlayerByID(id) timet = str(time.strftime('%Y-%m-%d %X')) title = "<font color='#ffffff'>" title += player.baseInfo.getNickName() title += " : " + timet + "</font><br/>" title += "<font color='#ffffff'>" + str(context) + "</font><br/>" ChaterLogManager().addLog(id, tid, title, timet) response.result = True response.message = u'' return response.SerializeToString()
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', '') response.level = val.get('level', 0) response.perfession = val.get('perfession', Lg().g(143)) response.chatObjectPos = val.get('chatObjectPos', '') response.name = val.get('name', '') else: response.result = True response.message = u'' response.chatMessage = val.get('result', '') response.level = val.get('level', 0) response.perfession = val.get('perfession', Lg().g(143)) response.chatObjectPos = val.get('chatObjectPos', '') response.name = val.get('name', '') return response.SerializeToString()
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','') response.level=val.get('level',0) response.perfession=val.get('perfession',Lg().g(143)) response.chatObjectPos=val.get('chatObjectPos','') response.name=val.get('name','') else: response.result =True response.message =u'' response.chatMessage=val.get('result','') response.level=val.get('level',0) response.perfession=val.get('perfession',Lg().g(143)) response.chatObjectPos=val.get('chatObjectPos','') response.name=val.get('name','') return response.SerializeToString()