From d9611fb2b7b4616e5d40746ecda265dfa1d9a0b9 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 13 十二月 2021 16:00:24 +0800
Subject: [PATCH] 8901 【BT2】【后端】全服红包(报错防范)
---
ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFriend.py | 47 +++++++++++++++++++++++++++++++++++++++--------
1 files changed, 39 insertions(+), 8 deletions(-)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFriend.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFriend.py
index e65872c..fd8589d 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFriend.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFriend.py
@@ -28,7 +28,6 @@
import copy
import PlayerViewCache
import PlayerTeam
-import cPickle
#---------------------------------------------------------------------
@@ -77,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 = cPickle.loads(curCache.GetPropData())
- tagLV = cacheDict["LV"]
+ tagLV = curCache.LV
else:
tagLV = tagPlayer.GetLV()
@@ -216,6 +214,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)
@@ -226,6 +230,12 @@
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
@@ -266,7 +276,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')
@@ -324,7 +334,7 @@
PlayerControl.NotifyCode(srcPlayer, 'Friend_MakeFriend', [curPlayer.GetName()])
#srcPlayer.MapServer_QueryPlayerResult(0, 0, 'AddFriendSucceed', "", 0)
else:
- cacheDict = cPickle.loads(curCache.GetPropData())
+ cacheDict = PlayerViewCache.GetCachePropDataDict(curCache)
PlayerControl.NotifyCode(curPlayer, 'Friend_MakeFriend', [cacheDict['Name']])
# 记录等对方上线通知地图,任务等会用到触发逻辑,通用记录次数即可, MapServer_SyncFriendInfo为具体的好友数量,根据策划需求制作
pass
@@ -391,12 +401,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 = cPickle.loads(curCache.GetPropData())
+ cacheDict = PlayerViewCache.GetCachePropDataDict(curCache)
playerName = cacheDict['Name']
else:
playerName = tagPlayer.GetName()
@@ -412,6 +428,11 @@
PlayerControl.NotifyCode(curPlayer, 'AddBlackList', [playerName])
+ # 亲密度减少
+ decIntimacyPer = IpyGameDataPY.GetFuncCfg("IntimacyReduce", 2)
+ if decIntimacyPer:
+ PyDataManager.GetIntimacyManager().DelIntimacyBothPer(curPlayer.GetPlayerID(), tagID, decIntimacyPer)
+
return
@@ -475,6 +496,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 当前时间
@@ -488,6 +518,7 @@
__OnPlayerLoginEnemy(curPlayer, tick)
__OnPlayerLoginContacts(curPlayer, tick)
__OnPlayerLoginBlacklist(curPlayer, tick)
+ __OnPlayerLoginIntimacylist(curPlayer, tick)
# 向当前玩家通知相关联的所有玩家信息
PlayerSocial.Sync_AllSocialsInfo(curPlayer)
--
Gitblit v1.8.0