From 06183f48470b7a31d3b4b7744ef3cf7a2385f80e Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 28 十一月 2024 16:48:32 +0800
Subject: [PATCH] 10312 【越南】【英文】【bt】【砍树】查看跨服玩家数据向对应子服查询

---
 ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFriend.py |   56 +++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 49 insertions(+), 7 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFriend.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFriend.py
index d88e04a..82dad65 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFriend.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFriend.py
@@ -27,6 +27,7 @@
 import PlayerSocial
 import copy
 import PlayerViewCache
+import PlayerTeam
 
 #---------------------------------------------------------------------
 
@@ -75,13 +76,12 @@
             return
     
     if not tagPlayer:
-        curCache = PlayerViewCache.ViewCacheMgr.FindCache(curTagPlayerID)
+        curCache = PlayerViewCache.FindViewCache(curTagPlayerID)
         if not curCache:
             #玩家的数据没有缓存过
             PlayerControl.NotifyCode(curPlayer, 'Friend_OffLine')
             return
-        cacheDict = eval(curCache.GetPropData())
-        tagLV = cacheDict["LV"]
+        tagLV = curCache.LV
     else:
         tagLV = tagPlayer.GetLV()
     
@@ -126,6 +126,8 @@
         askFriendPack.Name = curPlayer.GetName()
         askFriendPack.LV = curPlayer.GetLV()
         askFriendPack.RealmLV = curPlayer.GetOfficialRank()
+        askFriendPack.Face = curPlayer.GetFace()
+        askFriendPack.FacePic = curPlayer.GetFacePic()
         
         NetPackCommon.SendFakePack(tagPlayer, askFriendPack) 
 
@@ -214,6 +216,12 @@
         GameWorld.Log('DeleteFriend -> 封包异常 ->没有这个玩家', playerID)
         return
     
+    couple = PyDataManager.GetDBPyCoupleManager().GetCouple(playerID)
+    if couple and couple.GetCoupleID(playerID) == friendID:
+        #GameWorld.Log('DeleteFriend -> 封包异常 ->伴侣不能删除好友.friendID=%s' % friendID, playerID)
+        PlayerControl.NotifyCode(curPlayer, "DelFriendCoupleLimit")
+        return
+    
     #离线好友同时删除记录
     PyDataManager.GetFriendManager().DelFriendBoth(playerID, friendID)
     
@@ -223,6 +231,13 @@
     tagPlayer = GameWorld.GetPlayerManager().FindPlayerByID(friendID)
     if tagPlayer != None:
         PlayerControl.NotifyCode(tagPlayer, 'Friend_DeleteFriend2', [curPlayer.GetName()])
+    PlayerTeam.OnTeamMemFriendChange(curPlayer, friendID, False)
+    
+    # 亲密度减少
+    decIntimacyPer = IpyGameDataPY.GetFuncCfg("IntimacyReduce", 1)
+    if decIntimacyPer:
+        PyDataManager.GetIntimacyManager().DelIntimacyBothPer(playerID, friendID, decIntimacyPer)
+        
     return
 
 
@@ -263,7 +278,7 @@
     srcPlayer = playerManager.FindPlayerByID(srcPlayerID)
     if srcPlayer == None:
         # 玩家已下线
-        curCache = PlayerViewCache.ViewCacheMgr.FindCache(srcPlayerID)
+        curCache = PlayerViewCache.FindViewCache(srcPlayerID)
         if not curCache:
             #玩家的数据没有缓存过
             #PlayerControl.NotifyCode(curPlayer, 'Friend_OffLine')
@@ -321,10 +336,11 @@
         PlayerControl.NotifyCode(srcPlayer, 'Friend_MakeFriend', [curPlayer.GetName()])
         #srcPlayer.MapServer_QueryPlayerResult(0, 0, 'AddFriendSucceed', "", 0)
     else:
-        cacheDict = eval(curCache.GetPropData())
+        cacheDict = PlayerViewCache.GetCachePropDataDict(curCache)
         PlayerControl.NotifyCode(curPlayer, 'Friend_MakeFriend', [cacheDict['Name']])  
         # 记录等对方上线通知地图,任务等会用到触发逻辑,通用记录次数即可, MapServer_SyncFriendInfo为具体的好友数量,根据策划需求制作
         pass
+    PlayerTeam.OnTeamMemFriendChange(curPlayer, srcPlayerID, True)
     return
 
 
@@ -387,12 +403,18 @@
     #    return
     #===========================================================================
     
+    couple = PyDataManager.GetDBPyCoupleManager().GetCouple(curPlayer.GetID())
+    if couple and couple.GetCoupleID(curPlayer.GetID()) == tagID:
+        #GameWorld.DebugLog("伴侣不能加入黑名单! tagID=%s" % tagID, curPlayer.GetID())
+        PlayerControl.NotifyCode(curPlayer, "AddBlackCoupleLimit")
+        return
+    
     tagPlayer = GameWorld.GetPlayerManager().FindPlayerByID(tagID)
     if not tagPlayer:
-        curCache = PlayerViewCache.ViewCacheMgr.FindCache(tagID)
+        curCache = PlayerViewCache.FindViewCache(tagID)
         if not curCache:
             return
-        cacheDict = eval(curCache.GetPropData())
+        cacheDict = PlayerViewCache.GetCachePropDataDict(curCache)
         playerName = cacheDict['Name']
     else:
         playerName = tagPlayer.GetName()
@@ -408,6 +430,11 @@
     
     PlayerControl.NotifyCode(curPlayer, 'AddBlackList', [playerName])
     
+    # 亲密度减少
+    decIntimacyPer = IpyGameDataPY.GetFuncCfg("IntimacyReduce", 2)
+    if decIntimacyPer:
+        PyDataManager.GetIntimacyManager().DelIntimacyBothPer(curPlayer.GetPlayerID(), tagID, decIntimacyPer)
+        
     return
 
 
@@ -471,6 +498,15 @@
     players.Sync_SocialsInfo(curPlayer)
     return
 
+#亲密
+def __OnPlayerLoginIntimacylist(curPlayer, tick):
+    intimacys = PyDataManager.GetIntimacyManager().GetIntimacys(curPlayer.GetID())
+    if intimacys == None:
+        return
+    
+    intimacys.Sync_SocialsInfo(curPlayer)
+    return
+
 ## 玩家登陆
 #  @param curPlayer 当前玩家
 #  @param tick 当前时间
@@ -484,6 +520,7 @@
     __OnPlayerLoginEnemy(curPlayer, tick)
     __OnPlayerLoginContacts(curPlayer, tick)
     __OnPlayerLoginBlacklist(curPlayer, tick)
+    __OnPlayerLoginIntimacylist(curPlayer, tick)
     
     # 向当前玩家通知相关联的所有玩家信息
     PlayerSocial.Sync_AllSocialsInfo(curPlayer)
@@ -623,6 +660,8 @@
         rceFriendsData.LV = tagPlayer.GetLV()
         rceFriendsData.Job = tagPlayer.GetJob()
         rceFriendsData.RealmLV = tagPlayer.GetOfficialRank()
+        rceFriendsData.Face = tagPlayer.GetFace()
+        rceFriendsData.FacePic = tagPlayer.GetFacePic()
         sendPack.FriendsList.append(rceFriendsData)
         
     #GameWorld.DebugLog("Client_RecommendFriends:%s"%sendPack.FriendsList)
@@ -682,6 +721,9 @@
         rceFriendsData.Name = tagPlayer.GetName()
         rceFriendsData.LV = tagPlayer.GetLV()
         rceFriendsData.Job = tagPlayer.GetJob()
+        rceFriendsData.RealmLV = tagPlayer.GetOfficialRank()
+        rceFriendsData.Face = tagPlayer.GetFace()
+        rceFriendsData.FacePic = tagPlayer.GetFacePic()
         sendPack.FriendsList.append(rceFriendsData)
         
     

--
Gitblit v1.8.0