From a54e403db134f1a6ead3096a5518614db4641d94 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期一, 27 九月 2021 16:20:34 +0800 Subject: [PATCH] 9198 【后端】【主干】【BT3】【BT4】LoginOut的流向增加玩家当前经验记录 --- ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerSocial.py | 49 ++++++++++++++++++++++++++++--------------------- 1 files changed, 28 insertions(+), 21 deletions(-) diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerSocial.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerSocial.py index 624de77..770c385 100644 --- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerSocial.py +++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerSocial.py @@ -26,7 +26,6 @@ import IpyGameDataPY import PlayerViewCache import PyGameData - #--------------------社交圈基本结构------------------- # 社交圈 class SocialPlayers(object): @@ -99,6 +98,8 @@ def GetCount(self): return len(self.SocialDict) + def GetSocialIDList(self): return self.SocialDict.keys() + def Find(self, tagID): return self.SocialDict.get(tagID, None) @@ -147,7 +148,10 @@ sendPack.Count = 1 sendPack.Player = [] socialManager = PyDataManager.GetPersonalSocialManager() - socialInfo = socialManager.GetSocialPlayer(tagID).GetPackStruct(ChPyNetSendPack.tagGCSocialPlayer()) + socialPlayer = socialManager.GetSocialPlayer(tagID) + if not socialPlayer: + return + socialInfo = socialPlayer.GetPackStruct(ChPyNetSendPack.tagGCSocialPlayer()) sendPack.Player.append(socialInfo) NetPackCommon.SendFakePack(curPlayer, sendPack) @@ -189,18 +193,21 @@ # 通知地图好友信息 def MapServer_SyncFriendInfo(self, curPlayer): - if not curPlayer: - return - sendPack = ChGameToMapPyPack.tagGMFriendInfo() - sendPack.PlayerID = curPlayer.GetPlayerID() - sendPack.FriendCnt = self.GetCount() - sendPack.Friends = [] - - for friendInfo in self.SocialDict.values(): - playerFriend = ChGameToMapPyPack.tagGMPlayerFrendInfo() - playerFriend.TagID = friendInfo.PlayerID - sendPack.Friends.append(playerFriend) - NetPackCommon.SendPyPackToMapServer(curPlayer.GetLineNO(), curPlayer.GetRealMapID(), sendPack) + return + #======================================================================= + # if not curPlayer: + # return + # sendPack = ChGameToMapPyPack.tagGMFriendInfo() + # sendPack.PlayerID = curPlayer.GetPlayerID() + # sendPack.FriendCnt = self.GetCount() + # sendPack.Friends = [] + # + # for friendInfo in self.SocialDict.values(): + # playerFriend = ChGameToMapPyPack.tagGMPlayerFrendInfo() + # playerFriend.TagID = friendInfo.TagID + # sendPack.Friends.append(playerFriend) + # NetPackCommon.SendPyPackToMapServer(curPlayer.GetLineNO(), curPlayer.GetRealMapID(), sendPack) + #======================================================================= # 整个游戏的好友管理 @@ -261,7 +268,7 @@ cnt += 1 savaData += friend.getBuffer() - GameWorld.Log("SaveFriendData cnt :%s"%cnt) + GameWorld.Log("SaveFriendData cnt :%s len=%s" % (cnt, len(savaData))) return CommFunc.WriteDWORD(cntData, cnt) + savaData # 从数据库载入好友数据 @@ -378,7 +385,7 @@ cnt += 1 savaData += socialPlayer.getBuffer() - GameWorld.Log("!!SaveEnemyData cnt :%s"%cnt) + GameWorld.Log("!!SaveEnemyData cnt :%s len=%s" % (cnt, len(savaData))) return CommFunc.WriteDWORD(cntData, cnt) + savaData # 从数据库载入 @@ -534,7 +541,7 @@ cnt += 1 savaData += socialPlayer.getBuffer() - GameWorld.Log("!!SaveContactsData cnt :%s"%cnt) + GameWorld.Log("!!SaveContactsData cnt :%s len=%s" % (cnt, len(savaData))) return CommFunc.WriteDWORD(cntData, cnt) + savaData # 从数据库载入 @@ -615,7 +622,7 @@ cnt += 1 savaData += socialPlayer.getBuffer() - GameWorld.Log("!!SaveBlacklistData cnt :%s"%cnt) + GameWorld.Log("!!SaveBlacklistData cnt :%s len=%s" % (cnt, len(savaData))) return CommFunc.WriteDWORD(cntData, cnt) + savaData # 从数据库载入 @@ -706,7 +713,7 @@ # 增加社交对象信息,针对不在社交圈记录并且不在线玩家的情况 def AddPlayerInfoByViewCache(self, playerID): - curCache = PlayerViewCache.ViewCacheMgr.FindCache(playerID) + curCache = PlayerViewCache.FindViewCache(playerID) playerSocial = PyGameDataStruct.tagPersonalSocial() if not curCache: # 实在找不到设置为初始化数据 @@ -718,7 +725,7 @@ playerSocial.RealmLV = 1 playerSocial.OnlineType = ChConfig.Def_Offline else: - cacheDict = eval(curCache.GetPropData()) + cacheDict = PlayerViewCache.GetCachePropDataDict(curCache) playerSocial.clear() playerSocial.PlayerID = playerID @@ -758,7 +765,7 @@ cnt += 1 savaData += socialPlayer.playerInfo.getBuffer() - GameWorld.Log("SaveSocialData cnt :%s"%cnt) + GameWorld.Log("SaveSocialData cnt :%s len=%s" % (cnt, len(savaData))) return CommFunc.WriteDWORD(cntData, cnt) + savaData -- Gitblit v1.8.0