hxp
2019-08-28 274da001f56cd650d57f35ae2f65aa58f969a8e7
8247 【主干】【400】【后端】聊天离线消息通知优化
3个文件已修改
68 ■■■■■ 已修改文件
ServerPython/CoreServerGroup/GameServer/Script/Player/ChPlayer.py 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerTalk.py 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/PyGameData.py 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/Player/ChPlayer.py
@@ -544,6 +544,11 @@
    AuctionHouse.OnPlayerLeaveServer(curPlayer)
    #------------镖车逻辑
    #TruckPlayerDisconnectProcess(curPlayer, tick)
    if not PlayerControl.GetIsTJG(curPlayer):
        playerID = curPlayer.GetPlayerID()
        PyGameData.g_unTJLogoffTime[playerID] = int(time.time())
    return
## 设置玩家离线时间
ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerTalk.py
@@ -496,13 +496,18 @@
    return
def NotifyTalkCache(curPlayer):
    ##上线通知聊天缓存
    sendPack = ChPyNetSendPack.tagGCTalkCache()
    sendPack.Clear()
    sendPack.InfoList = []
    ##上线通知非脱机离线后的聊天缓存
    if PlayerControl.GetIsTJG(curPlayer):
        return
    playerID = curPlayer.GetPlayerID()
    unTJLogoffTime = PyGameData.g_unTJLogoffTime.get(playerID, 0)
    familyCacheList, worldCacheList = [], []
    familyID = curPlayer.GetFamilyID()
    if familyID and familyID in PyGameData.g_familyTalkCache:
        for curTime, name, playerID, content, extras in PyGameData.g_familyTalkCache[familyID]:
            if curTime < unTJLogoffTime:
                continue
            contentInfo = ChPyNetSendPack.tagGCTalkCacheInfo()
            contentInfo.Clear()
            contentInfo.ChannelType = 2
@@ -513,20 +518,34 @@
            contentInfo.Content = content
            contentInfo.Len = len(content)
            contentInfo.Extras = extras
            sendPack.InfoList.append(contentInfo)
    elif PyGameData.g_worldTalkCache:
        for curTime, name, playerID, content, extras in PyGameData.g_worldTalkCache:
            contentInfo = ChPyNetSendPack.tagGCTalkCacheInfo()
            contentInfo.Clear()
            contentInfo.ChannelType = 1
            contentInfo.Name = name
            contentInfo.NameLen = len(name)
            contentInfo.PlayerID = playerID
            contentInfo.Time = curTime
            contentInfo.Content = content
            contentInfo.Len = len(content)
            contentInfo.Extras = extras
            sendPack.InfoList.append(contentInfo)
    sendPack.Count = len(sendPack.InfoList)
    NetPackCommon.SendFakePack(curPlayer, sendPack)
            familyCacheList.append(contentInfo)
    for curTime, name, playerID, content, extras in PyGameData.g_worldTalkCache:
        if curTime < unTJLogoffTime:
            continue
        contentInfo = ChPyNetSendPack.tagGCTalkCacheInfo()
        contentInfo.Clear()
        contentInfo.ChannelType = 1
        contentInfo.Name = name
        contentInfo.NameLen = len(name)
        contentInfo.PlayerID = playerID
        contentInfo.Time = curTime
        contentInfo.Content = content
        contentInfo.Len = len(content)
        contentInfo.Extras = extras
        worldCacheList.append(contentInfo)
    if familyCacheList:
        sendPack = ChPyNetSendPack.tagGCTalkCache()
        sendPack.Clear()
        sendPack.InfoList = familyCacheList
        sendPack.Count = len(sendPack.InfoList)
        NetPackCommon.SendFakePack(curPlayer, sendPack)
    if worldCacheList:
        sendPack = ChPyNetSendPack.tagGCTalkCache()
        sendPack.Clear()
        sendPack.InfoList = worldCacheList
        sendPack.Count = len(sendPack.InfoList)
        NetPackCommon.SendFakePack(curPlayer, sendPack)
    return
ServerPython/CoreServerGroup/GameServer/Script/PyGameData.py
@@ -109,4 +109,6 @@
g_crossFBFuncLinePlayerCountInfo = {} # 跨服副本功能线路人数信息,本服缓存 {mapID:{funcLineID:[playerCount], ...}, ...}
g_familyTalkCache = {} #{familyID:[[time,content,extras],..]}
g_worldTalkCache = [] #[[time,name, playerID, content,extras],..]
g_worldTalkCache = [] #[[time,name, playerID, content,extras],..]
g_unTJLogoffTime = {} #非脱机离线时间 {playerID:time, ...}