hxp
2019-08-28 274da001f56cd650d57f35ae2f65aa58f969a8e7
8247 【主干】【400】【后端】聊天离线消息通知优化
3个文件已修改
40 ■■■■ 已修改文件
ServerPython/CoreServerGroup/GameServer/Script/Player/ChPlayer.py 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerTalk.py 33 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/PyGameData.py 2 ●●●●● 补丁 | 查看 | 原始文档 | 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,9 +518,11 @@
            contentInfo.Content = content
            contentInfo.Len = len(content)
            contentInfo.Extras = extras
            sendPack.InfoList.append(contentInfo)
    elif PyGameData.g_worldTalkCache:
            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
@@ -526,7 +533,19 @@
            contentInfo.Content = content
            contentInfo.Len = len(content)
            contentInfo.Extras = extras
            sendPack.InfoList.append(contentInfo)
        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
@@ -110,3 +110,5 @@
g_familyTalkCache = {} #{familyID:[[time,content,extras],..]}
g_worldTalkCache = [] #[[time,name, playerID, content,extras],..]
g_unTJLogoffTime = {} #非脱机离线时间 {playerID:time, ...}