From c64bb9ef583f2d456c56b0593901da573e9adab1 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期三, 16 一月 2019 20:11:22 +0800 Subject: [PATCH] 5722 【后端】【1.5】跨服BOSS开发(跨服状态下断线重连设置视野逻辑优化) --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py | 54 +++++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 41 insertions(+), 13 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py index 6ffbb43..ecdfbf6 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py @@ -118,6 +118,7 @@ Def_Max_Move_Tick = 5000 if abs(gameWorldTick - clientWorldTick) >= Def_Max_Move_Tick: + curPlayer.Sync_ClientTick() #时间相差过大,可能因网络引起,拉回 GameWorld.DebugLog("PlayerMoveCheckClientWorldTick -- 服务器tick %s-客户端%s时间相差过大,可能因网络引起,拉回" % ( gameWorldTick, clientWorldTick), curPlayer.GetID()) @@ -232,15 +233,22 @@ # @param mergeMapInfo 该提示所属的跨服活动地图信息, 主要用于不同子服对应所跨的活动地图ID # @return 无返回值 def WorldNotify(country, msgMark, msgParamList=[], lineID=0, mergeMinOSD=-1, mergeMaxOSD=-1, mergeMapInfo=[]): - # 如果是跨服服务器,则广播子服 - if GameWorld.IsCrossServer(): - sendMsg = str([country, msgMark, msgParamList, lineID, mergeMinOSD, mergeMaxOSD, mergeMapInfo]) - GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'MergeWorldNotify', - sendMsg, len(sendMsg)) - FBNotify(msgMark, msgParamList) # 跨服中的全服广播只在地图中做广播即可,防止不同跨服分区的地图会相互看到广播,体验不好 - else: - GameWorld.GetPlayerManager().BroadcastCountry_NotifyCode(country, 0, msgMark, - __GetNotifyCodeList(msgParamList), lineID) + GameWorld.GetPlayerManager().BroadcastCountry_NotifyCode(country, 0, msgMark, __GetNotifyCodeList(msgParamList), lineID) + return + +def GetCrossWorldNotifyInfo(country, msgMark, msgParamList=[]): + return {"Type":ShareDefine.CrossNotify_World, "Params":[country, msgMark, msgParamList]} + +def GetCrossFamilyNotifyInfo(familyID, msgMark, msgParamList=[]): + return {"Type":ShareDefine.CrossNotify_Family, "Params":[familyID, msgMark, msgParamList]} + +def CrossNotify(serverGroupIDList, crossNotifyList): + ''' 跨服广播信息提示,支持同步多条,同时也建议多条一起同步 + @param serverGroupIDList: 需要同步到的目标服务器组ID列表 + @param crossNotifyList: 信息提示列表,通过 GetCrossWorldNotifyInfo GetCrossFamilyNotifyInfo 函数获得返回值添加到列表 + ''' + sendMsg = str([serverGroupIDList, crossNotifyList]) + GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, "CrossNotify", sendMsg, len(sendMsg)) return #--------------------------------------------------------------------- @@ -516,6 +524,10 @@ if GameWorld.GetMap().GetMapID() not in IpyGameDataPY.GetFuncEvalCfg('DungeonDeliver', 1): NotifyCode(curPlayer, "Carry_lhs_844170") return False + + if not GameWorld.IsCrossServer() and GetCrossMapID(curPlayer): + NotifyCode(curPlayer, "CrossMap10") + return False return True @@ -1574,12 +1586,20 @@ GameWorld.DebugLog("跨服服务器不允许该操作!") return - if GetCrossRealmState(curPlayer): + if GetCrossMapID(curPlayer): GameWorld.ErrLog("玩家当前为跨服状态,不允许再次请求进入跨服!", curPlayer.GetPlayerID()) return if not CrossRealmPlayer.IsCrossServerOpen(): NotifyCode(curPlayer, "CrossMatching18") + return + + if curPlayer.GetHP() <= 0: + NotifyCode(curPlayer, "CrossMap4") + return + + if PlayerCrossRealmPK.GetIsCrossPKMatching(curPlayer): + NotifyCode(curPlayer, "CrossMap3") return GY_Query_CrossRealmReg.RegisterEnterCrossServer(curPlayer, mapID) @@ -1740,6 +1760,12 @@ if isNotify: NotifyCode(curPlayer, "CrossMatching8", [mapID]) return ShareDefine.EntFBAskRet_CrossPKMatching + + ## 跨服地图中 + if GetCrossMapID(curPlayer) and mapID not in ChConfig.Def_CrossMapIDList: + if isNotify: + NotifyCode(curPlayer, "CrossMap5", [mapID]) + return ShareDefine.EntFBAskRet_InCrossMap #=============================================================================================== # # 这里不做状态限制,由前端处理,因为策划要根据界面来处理,同一传送功能有可能在不同界面 @@ -5710,9 +5736,11 @@ def SetFBFuncLineID(curPlayer, funcLineID): return curPlayer.SetExAttr3(funcLineID, False, False) def GetFBFuncLineID(curPlayer): return curPlayer.GetExAttr3() -## 跨服状态: 0-非跨服状态,1-跨服状态 -def GetCrossRealmState(curPlayer): return curPlayer.GetExAttr5() -def SetCrossRealmState(curPlayer, value): curPlayer.SetExAttr5(value, False, True) +## 跨服状态所在地图ID: 0-非跨服状态,非0-跨服状态对应的地图ID +def GetCrossMapID(curPlayer): return curPlayer.GetExAttr5() +def SetCrossMapID(curPlayer, value): + curPlayer.SetExAttr5(value, False, True) + return ## 铜钱点, 支持铜钱超20亿 def GetSilver(curPlayer): return curPlayer.GetExAttr6() * ChConfig.Def_PerPointValue + curPlayer.GetSilver() -- Gitblit v1.8.0