From 25d85f98970d10a5489256c5066840530c04d20c Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 23 五月 2022 17:01:56 +0800
Subject: [PATCH] 9415 【BT】【后端】古神战场(召集队伍可设置是否仅召集本服玩家)

---
 ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBattlefield.py |   74 ++++++++++++++++++++++++++++++++++++-
 1 files changed, 72 insertions(+), 2 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBattlefield.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBattlefield.py
index 10a30f7..8869238 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBattlefield.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBattlefield.py
@@ -54,6 +54,7 @@
 value2:hmNum            时分场次编号
 value3:playerID        购买的玩家ID
 value4:factionID        所选择的阵营ID
+value5:serverOnly        是否仅本服玩家可加入,0-否,1-是
 
 StrValue3:[callPlayerID,...]    召集来的玩家ID,包含自己
 '''
@@ -71,6 +72,7 @@
         self.zoneID = 0
         self.playerID = 0
         self.factionID = 0
+        self.serverOnly = 0
         self.callPlayerIDList = []
         
         # 子服用,跨服服务器同步数据时负值; 不存库,玩家属性缓存信息,本服玩家取自己服务器最新缓存
@@ -88,7 +90,7 @@
                                              "RealmLV":cacheDict["RealmLV"], "FightPower":cacheDict["FightPower"]}
             
         return {"buyTime":self.buyTime, "hmNum":self.hmNum, "zoneID":self.zoneID, "playerID":self.playerID, "factionID":self.factionID,
-                "callPlayerIDList":self.callPlayerIDList, "callPlayerDict":self.callPlayerDict}
+                "serverOnly":self.serverOnly, "callPlayerIDList":self.callPlayerIDList, "callPlayerDict":self.callPlayerDict}
         
     def SetAttr(self, attrDict):
         for k, v in attrDict.items():
@@ -112,6 +114,7 @@
         hmNum = recData.GetValue2()
         playerID = recData.GetValue3()
         factionID = recData.GetValue4()
+        serverOnly = recData.GetValue5()
         
         strValue3 = recData.GetStrValue3()
             
@@ -121,6 +124,7 @@
         buyRec.hmNum = hmNum
         buyRec.playerID = playerID
         buyRec.factionID = factionID
+        buyRec.serverOnly = serverOnly
         buyRec.callPlayerIDList = eval(strValue3) if strValue3 else []
         
         buyPlayerInfo = GetBuyPlayerInfo(zoneID, hmNum)
@@ -152,6 +156,7 @@
                 recData.SetValue2(buyRec.hmNum)
                 recData.SetValue3(buyRec.playerID)
                 recData.SetValue4(buyRec.factionID)
+                recData.SetValue5(buyRec.serverOnly)
                 
                 recData.SetStrValue3(str(buyRec.callPlayerIDList).replace(" ", ""))
                 
@@ -655,6 +660,7 @@
     openHour = msgData["openHour"]
     openMinute = msgData["openMinute"]
     faction = msgData["faction"]
+    serverOnly = msgData.get("serverOnly", 0)
     
     hmNum = GetHMNum(openHour, openMinute)
     
@@ -707,9 +713,11 @@
     buyRec.playerID = playerID
     buyRec.factionID = faction
     buyRec.callPlayerIDList = [playerID]
+    buyRec.serverOnly = serverOnly
     buyPlayerInfo[playerID] = buyRec
     
-    GameWorld.DebugLog("玩家购买开启召集场次! zoneID=%s,openHour=%s,openMinute=%s" % (zoneID, openHour, openMinute), playerID)
+    GameWorld.DebugLog("玩家购买开启召集场次! zoneID=%s,openHour=%s,openMinute=%s,faction=%s,serverOnly=%s" 
+                       % (zoneID, openHour, openMinute, faction, serverOnly), playerID)
     
     # 上榜
     billboardCallCountLimit = IpyGameDataPY.GetFuncCfg("CrossBattlefieldBillboard", 1) # 周召集榜上榜至少次数
@@ -817,6 +825,36 @@
     
     serverGroupIDList = zoneIpyData.GetServerGroupIDList()
     msgData.update({"opType":"CallKick"})
+    Send_CrossServerMsg_BattlefieldBuy(zoneID, serverGroupIDList, msgData)
+    return
+
+def ClientServerMsg_BattlefieldCallChange(serverGroupID, msgData):
+    
+    openHour = msgData["openHour"]
+    openMinute = msgData["openMinute"]
+    serverOnly = msgData["serverOnly"]
+    playerID = msgData["playerID"]
+    
+    zoneIpyData = CrossRealmPK.GetCrossPKServerGroupZone(serverGroupID)
+    if not zoneIpyData:
+        return
+    zoneID = zoneIpyData.GetZoneID()
+    
+    hmNum = GetHMNum(openHour, openMinute)
+    buyPlayerInfo = GetBuyPlayerInfo(zoneID, hmNum)
+    if playerID not in buyPlayerInfo:
+        GameWorld.ErrLog("跨服战场不存在该玩家的召集队伍! hmNum=%s,playerID=%s" % (hmNum, playerID), playerID)
+        return
+    buyRec = buyPlayerInfo[playerID]
+    buyRec.serverOnly = 1 if serverOnly else 0
+    
+    GameWorld.DebugLog("玩家召集队伍修改! zoneID=%s,openHour=%s,openMinute=%s,serverOnly=%s" 
+                       % (zoneID, openHour, openMinute, serverOnly), playerID)
+    
+    #SyncMapServerCrossBattlefieldBuyInfo()
+    
+    serverGroupIDList = zoneIpyData.GetServerGroupIDList()
+    msgData.update({"opType":"CallChange"})
     Send_CrossServerMsg_BattlefieldBuy(zoneID, serverGroupIDList, msgData)
     return
 
@@ -1019,6 +1057,9 @@
     elif opType == "CallKick":
         pass
     
+    elif opType == "CallChange":
+        pass
+    
     return
 
 def SyncCrossBattlefieldBuyInfo(curPlayer, zoneID, hmNum=None):
@@ -1041,6 +1082,7 @@
             buyPlayerPack = ChPyNetSendPack.tagGCCrossBattlefieldBuyPlayer()
             buyPlayerPack.BuyPlayerID = buyPlayerID
             buyPlayerPack.Faction = buyRec.factionID
+            buyPlayerPack.ServerOnly = buyRec.serverOnly
             buyPlayerPack.FactionPlayerList = []
             
             for callPlayerID in buyRec.callPlayerIDList:
@@ -1126,6 +1168,11 @@
         GameWorld.DebugLog("召集人数已满! hmNum=%s,buyPlayerID=%s,callPlayerIDList=%s" % (hmNum, buyPlayerID, buyRec.callPlayerIDList), playerID)
         return
     
+    if buyRec.serverOnly and not PlayerControl.GetDBPlayerAccIDByID(buyPlayerID):
+        PlayerControl.NotifyCode(curPlayer, "CrossBattlefieldCallServerOnly")
+        #GameWorld.DebugLog("非本服玩家,无法加入其购买的召集队伍! hmNum=%s,buyPlayerID=%s,serverOnly=%s" % (hmNum, buyPlayerID, buyRec.serverOnly), playerID)
+        return
+    
     # 请求查询跨服服务器
     dataMsg = {"openHour":openHour, "openMinute":openMinute, "buyPlayerID":buyPlayerID, "tagPlayerID":tagPlayerID, "playerID":playerID}
     CrossRealmMsg.SendMsgToCrossServer(ShareDefine.ClientServerMsg_BattlefieldCallJoin, dataMsg)
@@ -1190,3 +1237,26 @@
     CrossRealmMsg.SendMsgToCrossServer(ShareDefine.ClientServerMsg_BattlefieldCallKick, dataMsg)
     return
 
+#// C0 09 跨服战场召集场次修改 #tagCGCrossBattlefieldCallChange
+#
+#struct    tagCGCrossBattlefieldCallChange
+#{
+#    tagHead        Head;
+#    BYTE    Hour;        //战场开启时
+#    BYTE    Minute;        //战场开启分
+#    BYTE    ServerOnly;    //是否仅本服玩家可加入,0-否,1-是
+#};
+def OnCrossBattlefieldCallChange(index, clientData, tick):
+    if GameWorld.IsCrossServer():
+        return
+    
+    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
+    playerID = curPlayer.GetPlayerID()
+    openHour = clientData.Hour
+    openMinute = clientData.Minute
+    serverOnly = clientData.ServerOnly
+    
+    # 请求查询跨服服务器
+    dataMsg = {"openHour":openHour, "openMinute":openMinute, "serverOnly":serverOnly, "playerID":playerID}
+    CrossRealmMsg.SendMsgToCrossServer(ShareDefine.ClientServerMsg_BattlefieldCallChange, dataMsg)
+    return

--
Gitblit v1.8.0