From a9a7475c8b637b04843a5553a182a8fac9416bbb Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 16 一月 2019 11:50:09 +0800
Subject: [PATCH] 5722 【后端】【1.5】跨服BOSS开发(PK击杀全服广播、仙盟广播支援支持)
---
ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerControl.py | 59 +++++++++----------
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFamily.py | 11 +++
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py | 4 +
ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerQuery.py | 6 +-
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py | 1
ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py | 4 +
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py | 25 +++++---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py | 58 ++++++++++++-------
8 files changed, 102 insertions(+), 66 deletions(-)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerControl.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerControl.py
index 821d4e8..d7e90f7 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerControl.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerControl.py
@@ -52,36 +52,34 @@
curPlayer.NotifyCode(msgMark, __GetNotifyCodeList(msgParamList))
return
-def NotifyCodeToClientServer(serverGroupIDList, playerID, msgMark, msgParamList=[]):
- dataMsg = {"Type":"Player", "ID":playerID, "Mark":msgMark, "Param":msgParamList}
- CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_Notify, dataMsg, serverGroupIDList)
+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 函数获得返回值添加到列表
+ '''
+ CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_Notify, crossNotifyList, serverGroupIDList)
return
-def CrossServerMsg_Notify(notifyInfoDict):
- notifyType = notifyInfoDict["Type"]
- notifyID = notifyInfoDict["ID"]
- if notifyType == "Player":
- curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(notifyID)
- if not curPlayer:
- return
- NotifyCode(curPlayer, notifyInfoDict["Mark"], notifyInfoDict["Param"])
- return
-
-## 跨服世界广播
-# @param country 提示的国家
-# @param msgMark 提示信息Mark
-# @param msgParamList 信息参数列表
-# @param mergeMinOSD 该提示针对跨服子服有效的最小开服天, >=0时有限制
-# @param mergeMaxOSD 该提示针对跨服子服有效的最大开服天, >=0时有限制
-# @param mergeMapInfo 该提示所属的跨服活动地图信息, 主要用于不同子服对应所跨的活动地图ID
-# @remarks
-def MergeWorldNotify(country, msgMark, msgParamList=[], lineID=0, mergeMinOSD=-1, mergeMaxOSD=-1, mergeMapInfo=[], isMapNotify=0):
- # 非地图同步的广播才进行全服广播
- if not isMapNotify:
- GameWorld.GetPlayerManager().CountryNotifyCode(country, msgMark, __GetNotifyCodeList(msgParamList))
- notifyDict = {"country":country, "msgMark":msgMark, "msgParamList":msgParamList, "lineID":lineID,
- "mergeMinOSD":mergeMinOSD, "mergeMaxOSD":mergeMaxOSD, "mergeMapInfo":mergeMapInfo}
- #.SendBroadcastMerge(ChConfig.Def_MergeWorldNotify, 0, notifyDict, False)
+def CrossServerMsg_Notify(crossNotifyList):
+ GameWorld.DebugLog("收到跨服同步的广播提示内容: count=%s" % len(crossNotifyList))
+ for notifyInfo in crossNotifyList:
+ if "Type" not in notifyInfo or "Params" not in notifyInfo:
+ continue
+ notifyType = notifyInfo["Type"]
+ params = notifyInfo["Params"]
+ if notifyType == ShareDefine.CrossNotify_World:
+ country, msgMark, msgParamList = params
+ WorldNotify(country, msgMark, msgParamList)
+ elif notifyType == ShareDefine.CrossNotify_Family:
+ familyID, msgMark, msgParamList = params
+ FamilyNotify(familyID, msgMark, msgParamList)
+
return
## 世界广播
@@ -91,10 +89,7 @@
# @return 无返回值
# @remarks
def WorldNotify(country, msgMark, msgParamList=[]):
- if GameWorld.IsCrossServer():
- MergeWorldNotify(country, msgMark, msgParamList)
- else:
- GameWorld.GetPlayerManager().CountryNotifyCode(country, msgMark, __GetNotifyCodeList(msgParamList))
+ GameWorld.GetPlayerManager().CountryNotifyCode(country, msgMark, __GetNotifyCodeList(msgParamList))
return
#---------------------------------------------------------------------
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerQuery.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerQuery.py
index e32b133..d72f77f 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerQuery.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerQuery.py
@@ -509,9 +509,9 @@
CrossRealmPlayer.SetCrossPlayerAttrValue(eval(resultName), tick)
return
- if callName == 'MergeWorldNotify':
- country, msgMark, msgParamList, lineID, mergeMinOSD, mergeMaxOSD, mergeMapInfo = eval(resultName)
- PlayerControl.MergeWorldNotify(country, msgMark, msgParamList, lineID, mergeMinOSD, mergeMaxOSD, mergeMapInfo, 1)
+ if callName == 'CrossNotify':
+ serverGroupIDList, crossNotifyList = eval(resultName)
+ PlayerControl.CrossNotify(serverGroupIDList, crossNotifyList)
return
if callName == "CommMapServerInitOK":
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
index 6800cea..e675306 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
@@ -1227,6 +1227,10 @@
ClientServerMsg_SetPlayerAttrValue = "SetPlayerAttrValue" # 玩家属性数值更新
ClientServerMsg_CollectNPC = "CollectNPC" # 采集NPC
+#跨服广播类型定义
+CrossNotify_World = "World"
+CrossNotify_Family = "Family"
+
#角色改名结果
(
Def_Rename_Result_MoneyErr, # 金钱不足
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py
index 018883c..71e9bed 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py
@@ -324,6 +324,10 @@
if GameWorld.GetMap().GetMapFBType() != IPY_GameWorld.fbtNull:
return
+ crossNotifyList = []
+ isCrossServer = GameWorld.IsCrossServer()
+ atkServerGroupID = PlayerControl.GetPlayerServerGroupID(attacker)
+ defServerGroupID = PlayerControl.GetPlayerServerGroupID(defender)
lineID = GameWorld.GetGameWorld().GetLineID()
# 杀人玩家有帮会
if attacker.GetFamilyID() > 0:
@@ -338,30 +342,40 @@
notifyCode = 'PK_pan_318691'
paramList = [defFamilyMemberLv, defName, defMapID, atkName,defPosX, defPosY, lineID]
- PlayerControl.FamilyNotify(defFamilyID, notifyCode, paramList)
-
+ if isCrossServer:
+ crossNotifyList.append(PlayerControl.GetCrossFamilyNotifyInfo(defFamilyID, notifyCode, paramList))
+ else:
+ PlayerControl.FamilyNotify(defFamilyID, notifyCode, paramList)
+
# 有职位被杀,全服广播
- if defFamilyMemberLv <= 0:
- return
+ if defFamilyMemberLv > 0:
+ defFamilyName = defender.GetFamilyName()
- defFamilyName = defender.GetFamilyName()
-
- killCnt = attacker.GetDictByKey(ChConfig.Def_PlayerKey_KillPlayerCnt % defender.GetPlayerID()) + 1
- attacker.SetDict(ChConfig.Def_PlayerKey_KillPlayerCnt % defender.GetPlayerID(), killCnt)
- #被杀重置击杀数
- defender.SetDict(ChConfig.Def_PlayerKey_KillPlayerCnt % attacker.GetPlayerID(), 0)
-
- killPlayerNotifyDict = IpyGameDataPY.GetFuncEvalCfg('FamilyKilledNotify')
-
- killKeys = sorted(killPlayerNotifyDict.keys())
- notifyKey = 0
- for killCntKey in killKeys:
- if killCnt < killCntKey:
- break
- notifyKey = killCntKey
- if notifyKey in killPlayerNotifyDict:
- notifyMark = killPlayerNotifyDict[notifyKey]
- PlayerControl.WorldNotify(0, notifyMark, [atkName, defMapID, defFamilyName, defFamilyMemberLv, defName])
+ killCnt = attacker.GetDictByKey(ChConfig.Def_PlayerKey_KillPlayerCnt % defender.GetPlayerID()) + 1
+ attacker.SetDict(ChConfig.Def_PlayerKey_KillPlayerCnt % defender.GetPlayerID(), killCnt)
+ #被杀重置击杀数
+ defender.SetDict(ChConfig.Def_PlayerKey_KillPlayerCnt % attacker.GetPlayerID(), 0)
+
+ killPlayerNotifyDict = IpyGameDataPY.GetFuncEvalCfg('FamilyKilledNotify')
+
+ killKeys = sorted(killPlayerNotifyDict.keys())
+ notifyKey = 0
+ for killCntKey in killKeys:
+ if killCnt < killCntKey:
+ break
+ notifyKey = killCntKey
+ if notifyKey in killPlayerNotifyDict:
+ notifyMark = killPlayerNotifyDict[notifyKey]
+ msgParamList = [atkName, defMapID, defFamilyName, defFamilyMemberLv, defName]
+ if isCrossServer:
+ crossNotifyList.append(PlayerControl.GetCrossWorldNotifyInfo(0, notifyMark, msgParamList))
+ if atkServerGroupID != defServerGroupID:
+ PlayerControl.NotifyCode(attacker, notifyMark, msgParamList)
+ else:
+ PlayerControl.WorldNotify(0, notifyMark, msgParamList)
+
+ if crossNotifyList:
+ PlayerControl.CrossNotify([defServerGroupID], crossNotifyList)
return
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
index 3e66e3c..f32e1e6 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
@@ -408,6 +408,7 @@
#---玩家上线, 宠物逻辑处理---
PetControl.DoLogic_PetInfo_OnLogin(curPlayer, tick)
+ PlayerFamily.FamilyPlayerOnLoginCross(curPlayer)
#通知运行成功
curPlayer.BalanceServer_PlayerLoginInitOK()
return
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 dbfe3f7..ecdfbf6 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
@@ -233,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
#---------------------------------------------------------------------
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFamily.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFamily.py
index 33d1381..c390c49 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFamily.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFamily.py
@@ -107,6 +107,8 @@
EventShell.EventResponse_OnFamilyLVUp(curPlayer)
if curPlayer.GetFamilyMemberLV() != refreshPack.GetFamilyMemberLV():
+ # 因为仙盟职位没有存DBPlayer,而跨服后又没有Family信息,所以这里做个存储,用于跨服用
+ curPlayer.SetReceivedSalary(refreshPack.GetFamilyMemberLV())
curPlayer.SetFamilyMemberLV(refreshPack.GetFamilyMemberLV())
#通知周围玩家家族职位刷新
#curPlayer.Notify_FamilyMemberLVRefresh()
@@ -634,6 +636,15 @@
Sync_FamilyDayRewardState(curPlayer)
return
+def FamilyPlayerOnLoginCross(curPlayer):
+ ## 登录跨服服务器
+ crossFamilyMemberLV = curPlayer.GetReceivedSalary()
+ if crossFamilyMemberLV:
+ curPlayer.SetFamilyMemberLV(crossFamilyMemberLV)
+ GameWorld.DebugLog("跨服登录设置仙盟职位等级: %s" % crossFamilyMemberLV, curPlayer.GetPlayerID())
+
+ return
+
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
index 6800cea..e675306 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
@@ -1227,6 +1227,10 @@
ClientServerMsg_SetPlayerAttrValue = "SetPlayerAttrValue" # 玩家属性数值更新
ClientServerMsg_CollectNPC = "CollectNPC" # 采集NPC
+#跨服广播类型定义
+CrossNotify_World = "World"
+CrossNotify_Family = "Family"
+
#角色改名结果
(
Def_Rename_Result_MoneyErr, # 金钱不足
--
Gitblit v1.8.0