|  |  |  | 
|---|
|  |  |  | import PlayerSocial | 
|---|
|  |  |  | import copy | 
|---|
|  |  |  | import PlayerViewCache | 
|---|
|  |  |  | import PlayerTeam | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #--------------------------------------------------------------------- | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | 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() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | return curFriends | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return PyDataManager.GetFriendManager().AddFriends(playerID) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def IsFriend(playerID, tagPlayerID): | 
|---|
|  |  |  | ## 判断双方是否好友 | 
|---|
|  |  |  | curFriends = PyDataManager.GetFriendManager().GetFriends(playerID) | 
|---|
|  |  |  | if not curFriends: | 
|---|
|  |  |  | return False | 
|---|
|  |  |  | return curFriends.Find(tagPlayerID) != None | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #--------------------------------------------------------------------- | 
|---|
|  |  |  | ##好友检查 | 
|---|
|  |  |  | 
|---|
|  |  |  | tagPlayer = GameWorld.GetPlayerManager().FindPlayerByID(friendID) | 
|---|
|  |  |  | if tagPlayer != None: | 
|---|
|  |  |  | PlayerControl.NotifyCode(tagPlayer, 'Friend_DeleteFriend2', [curPlayer.GetName()]) | 
|---|
|  |  |  | PlayerTeam.OnTeamMemFriendChange(curPlayer, friendID, False) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | srcPlayer = playerManager.FindPlayerByID(srcPlayerID) | 
|---|
|  |  |  | if srcPlayer == None: | 
|---|
|  |  |  | # 玩家已下线 | 
|---|
|  |  |  | curCache = PlayerViewCache.ViewCacheMgr.FindCache(srcPlayerID) | 
|---|
|  |  |  | curCache = PlayerViewCache.FindViewCache(srcPlayerID) | 
|---|
|  |  |  | if not curCache: | 
|---|
|  |  |  | #玩家的数据没有缓存过 | 
|---|
|  |  |  | #PlayerControl.NotifyCode(curPlayer, 'Friend_OffLine') | 
|---|
|  |  |  | 
|---|
|  |  |  | GameWorld.Log("JoinFriendAnswer -> 封包异常 ->玩家没有这个请求", playerID) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if not clientData.Answer and srcPlayer: | 
|---|
|  |  |  | #XW_SJ_RefuseApply  XXX拒绝把你加为好友 | 
|---|
|  |  |  | PlayerControl.NotifyCode(srcPlayer, 'Friend_RejectFriend', [curPlayer.GetName()]) | 
|---|
|  |  |  | if not clientData.Answer: | 
|---|
|  |  |  | if srcPlayer: | 
|---|
|  |  |  | #XW_SJ_RefuseApply  XXX拒绝把你加为好友 | 
|---|
|  |  |  | PlayerControl.NotifyCode(srcPlayer, 'Friend_RejectFriend', [curPlayer.GetName()]) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 黑名单检查 | 
|---|
|  |  |  | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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() | 
|---|