From 4551dd1308ab484688ca96be2be8b811fd3a23e6 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 12 二月 2019 21:02:45 +0800
Subject: [PATCH] 6196 【后端】【1.6】跨服匹配添加机器人

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini                       |   12 +
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py               |  100 ++++++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py             |    7 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py           |   42 ++++++
 PySysDB/PySysDBPY.h                                                                              |    1 
 ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py                                    |  100 ++++++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py      |   10 +
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossRealmPK.py |   98 ++++++++++++-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py                  |    1 
 9 files changed, 356 insertions(+), 15 deletions(-)

diff --git a/PySysDB/PySysDBPY.h b/PySysDB/PySysDBPY.h
index 17088d8..7ee816c 100644
--- a/PySysDB/PySysDBPY.h
+++ b/PySysDB/PySysDBPY.h
@@ -1478,6 +1478,7 @@
 struct tagCrossRealmPKDan
 {
 	BYTE		_DanLV;	//段位等级
+	WORD		LVUpScore;	//升段位所需积分
 };
 
 //跨服竞技场段位奖励表
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
index 0116cd3..108b33c 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
@@ -3772,6 +3772,54 @@
 
 
 #------------------------------------------------------
+# A2 31 前端开始自定义场景 #tagCMClientStartCustomScene
+
+class  tagCMClientStartCustomScene(Structure):
+    _pack_ = 1
+    _fields_ = [
+                  ("Cmd", c_ubyte),
+                  ("SubCmd", c_ubyte),
+                  ]
+
+    def __init__(self):
+        self.Clear()
+        self.Cmd = 0xA2
+        self.SubCmd = 0x31
+        return
+
+    def ReadData(self, stringData, _pos=0, _len=0):
+        self.Clear()
+        memmove(addressof(self), stringData[_pos:], self.GetLength())
+        return _pos + self.GetLength()
+
+    def Clear(self):
+        self.Cmd = 0xA2
+        self.SubCmd = 0x31
+        return
+
+    def GetLength(self):
+        return sizeof(tagCMClientStartCustomScene)
+
+    def GetBuffer(self):
+        return string_at(addressof(self), self.GetLength())
+
+    def OutputString(self):
+        DumpString = '''// A2 31 前端开始自定义场景 //tagCMClientStartCustomScene:
+                                Cmd:%s,
+                                SubCmd:%s
+                                '''\
+                                %(
+                                self.Cmd,
+                                self.SubCmd
+                                )
+        return DumpString
+
+
+m_NAtagCMClientStartCustomScene=tagCMClientStartCustomScene()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMClientStartCustomScene.Cmd,m_NAtagCMClientStartCustomScene.SubCmd))] = m_NAtagCMClientStartCustomScene
+
+
+#------------------------------------------------------
 # A2 24 触碰NPC #tagCMTouchNPC
 
 class  tagCMTouchNPC(Structure):
@@ -15786,6 +15834,58 @@
 
 
 #------------------------------------------------------
+# C1 08 跨服PK挑战机器人结算 #tagCMCrossRealmPKRobotOver
+
+class  tagCMCrossRealmPKRobotOver(Structure):
+    _pack_ = 1
+    _fields_ = [
+                  ("Cmd", c_ubyte),
+                  ("SubCmd", c_ubyte),
+                  ("IsWin", c_ubyte),    #是否获胜
+                  ]
+
+    def __init__(self):
+        self.Clear()
+        self.Cmd = 0xC1
+        self.SubCmd = 0x08
+        return
+
+    def ReadData(self, stringData, _pos=0, _len=0):
+        self.Clear()
+        memmove(addressof(self), stringData[_pos:], self.GetLength())
+        return _pos + self.GetLength()
+
+    def Clear(self):
+        self.Cmd = 0xC1
+        self.SubCmd = 0x08
+        self.IsWin = 0
+        return
+
+    def GetLength(self):
+        return sizeof(tagCMCrossRealmPKRobotOver)
+
+    def GetBuffer(self):
+        return string_at(addressof(self), self.GetLength())
+
+    def OutputString(self):
+        DumpString = '''// C1 08 跨服PK挑战机器人结算 //tagCMCrossRealmPKRobotOver:
+                                Cmd:%s,
+                                SubCmd:%s,
+                                IsWin:%d
+                                '''\
+                                %(
+                                self.Cmd,
+                                self.SubCmd,
+                                self.IsWin
+                                )
+        return DumpString
+
+
+m_NAtagCMCrossRealmPKRobotOver=tagCMCrossRealmPKRobotOver()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMCrossRealmPKRobotOver.Cmd,m_NAtagCMCrossRealmPKRobotOver.SubCmd))] = m_NAtagCMCrossRealmPKRobotOver
+
+
+#------------------------------------------------------
 # C1 05 进入跨服地图 #tagCMEnterCrossServer
 
 class  tagCMEnterCrossServer(Structure):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
index 2689b26..1415d89 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
@@ -343,7 +343,7 @@
 Writer = hxp
 Releaser = hxp
 RegType = 0
-RegisterPackCount = 19
+RegisterPackCount = 20
 
 PacketCMD_1 = 0xA5
 PacketSubCMD_1 = 0x04
@@ -420,6 +420,10 @@
 PacketCMD_19=0xA1
 PacketSubCMD_19=0x08
 PacketCallFunc_19=OnRefreshMainServerRole
+
+PacketCMD_20=0xA2
+PacketSubCMD_20=0x31
+PacketCallFunc_20=OnClientStartCustomScene
 
 ;购买相关的
 [BuySomething]
@@ -570,7 +574,7 @@
 Writer = hxp
 Releaser = hxp
 RegType = 0
-RegisterPackCount = 3
+RegisterPackCount = 4
 
 PacketCMD_1=0xC1
 PacketSubCMD_1=0x01
@@ -584,6 +588,10 @@
 PacketSubCMD_3=0x03
 PacketCallFunc_3=OnCrossRealmPKGetAward
 
+PacketCMD_4=0xC1
+PacketSubCMD_4=0x08
+PacketCallFunc_4=OnCrossRealmPKRobotOver
+
 ;跨服玩家
 [CrossRealmPlayer]
 ScriptName = Player\CrossRealmPlayer.py
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index ac64b2c..6a81e0a 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -3063,6 +3063,7 @@
 Def_PlayerKey_SomersaultTime = "Somersault"     # 翻滚一定时间内无敌,表现为MISS
 Def_PlayerKey_CopyFuncAttr = "CopyFuncAttr%s"     # 玩家属性刷新中的计算属性缓存,便于buff刷新计算
 Def_Player_RefreshAttrByBuff = "PlayerAttrByBuff"   # 玩家属性刷新功能属性缓存,便于buff刷新计算, 间隔刷新
+Def_PlayerKey_ClientCustomScene = "ClientCustomScene"     # 客户端自定义场景状态
 Def_PlayerKey_ChangeMapID = "ChangeMapID"     # 请求切换的地图ID
 Def_PlayerKey_ResetFBLinePosX = "ResetFBLinePosX"     # 请求切换副本多合一地图功能线路ID
 Def_PlayerKey_ResetFBLinePosY = "ResetFBLinePosY"     # 请求切换副本多合一地图功能线路ID
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
index 0116cd3..108b33c 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
@@ -3772,6 +3772,54 @@
 
 
 #------------------------------------------------------
+# A2 31 前端开始自定义场景 #tagCMClientStartCustomScene
+
+class  tagCMClientStartCustomScene(Structure):
+    _pack_ = 1
+    _fields_ = [
+                  ("Cmd", c_ubyte),
+                  ("SubCmd", c_ubyte),
+                  ]
+
+    def __init__(self):
+        self.Clear()
+        self.Cmd = 0xA2
+        self.SubCmd = 0x31
+        return
+
+    def ReadData(self, stringData, _pos=0, _len=0):
+        self.Clear()
+        memmove(addressof(self), stringData[_pos:], self.GetLength())
+        return _pos + self.GetLength()
+
+    def Clear(self):
+        self.Cmd = 0xA2
+        self.SubCmd = 0x31
+        return
+
+    def GetLength(self):
+        return sizeof(tagCMClientStartCustomScene)
+
+    def GetBuffer(self):
+        return string_at(addressof(self), self.GetLength())
+
+    def OutputString(self):
+        DumpString = '''// A2 31 前端开始自定义场景 //tagCMClientStartCustomScene:
+                                Cmd:%s,
+                                SubCmd:%s
+                                '''\
+                                %(
+                                self.Cmd,
+                                self.SubCmd
+                                )
+        return DumpString
+
+
+m_NAtagCMClientStartCustomScene=tagCMClientStartCustomScene()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMClientStartCustomScene.Cmd,m_NAtagCMClientStartCustomScene.SubCmd))] = m_NAtagCMClientStartCustomScene
+
+
+#------------------------------------------------------
 # A2 24 触碰NPC #tagCMTouchNPC
 
 class  tagCMTouchNPC(Structure):
@@ -15786,6 +15834,58 @@
 
 
 #------------------------------------------------------
+# C1 08 跨服PK挑战机器人结算 #tagCMCrossRealmPKRobotOver
+
+class  tagCMCrossRealmPKRobotOver(Structure):
+    _pack_ = 1
+    _fields_ = [
+                  ("Cmd", c_ubyte),
+                  ("SubCmd", c_ubyte),
+                  ("IsWin", c_ubyte),    #是否获胜
+                  ]
+
+    def __init__(self):
+        self.Clear()
+        self.Cmd = 0xC1
+        self.SubCmd = 0x08
+        return
+
+    def ReadData(self, stringData, _pos=0, _len=0):
+        self.Clear()
+        memmove(addressof(self), stringData[_pos:], self.GetLength())
+        return _pos + self.GetLength()
+
+    def Clear(self):
+        self.Cmd = 0xC1
+        self.SubCmd = 0x08
+        self.IsWin = 0
+        return
+
+    def GetLength(self):
+        return sizeof(tagCMCrossRealmPKRobotOver)
+
+    def GetBuffer(self):
+        return string_at(addressof(self), self.GetLength())
+
+    def OutputString(self):
+        DumpString = '''// C1 08 跨服PK挑战机器人结算 //tagCMCrossRealmPKRobotOver:
+                                Cmd:%s,
+                                SubCmd:%s,
+                                IsWin:%d
+                                '''\
+                                %(
+                                self.Cmd,
+                                self.SubCmd,
+                                self.IsWin
+                                )
+        return DumpString
+
+
+m_NAtagCMCrossRealmPKRobotOver=tagCMCrossRealmPKRobotOver()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMCrossRealmPKRobotOver.Cmd,m_NAtagCMCrossRealmPKRobotOver.SubCmd))] = m_NAtagCMCrossRealmPKRobotOver
+
+
+#------------------------------------------------------
 # C1 05 进入跨服地图 #tagCMEnterCrossServer
 
 class  tagCMEnterCrossServer(Structure):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
index 046d524..0ac851a 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
@@ -1169,6 +1169,7 @@
 
                 "CrossRealmPKDan":(
                         ("BYTE", "DanLV", 1),
+                        ("WORD", "LVUpScore", 0),
                         ),
 
                 "CrossRealmPKDanAward":(
@@ -3737,10 +3738,12 @@
 class IPY_CrossRealmPKDan():
     
     def __init__(self):
-        self.DanLV = 0
+        self.DanLV = 0
+        self.LVUpScore = 0
         return
         
-    def GetDanLV(self): return self.DanLV # 段位等级
+    def GetDanLV(self): return self.DanLV # 段位等级
+    def GetLVUpScore(self): return self.LVUpScore # 升段位所需积分
 
 # 跨服竞技场段位奖励表
 class IPY_CrossRealmPKDanAward():
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 c90555d..91c0f21 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
@@ -229,6 +229,45 @@
     
     return
 
+#// A2 31 前端开始自定义场景 #tagCMClientStartCustomScene
+#
+#struct    tagCMClientStartCustomScene
+#{
+#    tagHead        Head;
+#};
+def OnClientStartCustomScene(index, clientData, tick):
+    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
+    DoEnterCustomScene(curPlayer)
+    return
+
+def DoEnterCustomScene(curPlayer):
+    ## 进入自定义场景状态
+    curPlayer.SetCanAttack(False)
+    curPlayer.SetVisible(False)
+    curPlayer.SetSight(0)
+    curPet = curPlayer.GetPetMgr().GetFightPet()
+    if curPet:
+        curPet.SetVisible(False)
+        
+    curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomScene, 1)
+    GameWorld.Log("玩家开始自定义场景!", curPlayer.GetPlayerID())
+    return
+
+def DoExitCustomScene(curPlayer):
+    ## 退出自定义场景状态
+    curPlayer.SetCanAttack(True)
+    curPlayer.SetVisible(True)
+    curPlayer.SetSight(1)
+    curPlayer.RefreshView()
+    curPlayer.SetSight(ChConfig.Def_PlayerSight_Default)
+    curPlayer.RefreshView()
+    curPet = curPlayer.GetPetMgr().GetFightPet()
+    if curPet:
+        curPet.SetVisible(True)
+    curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomScene, 0)
+    GameWorld.Log("玩家退出自定义场景!", curPlayer.GetPlayerID())
+    return
+
 #// A1 08 刷新主服角色信息 #tagCMRefreshMainServerRole
 #
 #struct tagCMRefreshMainServerRole
@@ -257,6 +296,9 @@
     if PlayerControl.GetCrossMapID(curPlayer):
         CrossRealmPlayer.DoExitCrossRealm(curPlayer)
         
+    if curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomScene):
+        DoExitCustomScene(curPlayer)
+        
     msgInfo = ""
     GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(curPlayer.GetPlayerID(), 0, 0, "RefreshMainServerRole", msgInfo, len(msgInfo))
     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 fbcebed..d174759 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
@@ -533,6 +533,10 @@
         NotifyCode(curPlayer, "CrossMap10") 
         return False
     
+    if curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomScene):
+        GameWorld.Log("客户端自定义场景下无法传送!", curPlayer.GetPlayerID())
+        return False
+    
     return True
 
 
@@ -1817,6 +1821,12 @@
             NotifyCode(curPlayer, "Carry_lhs_697674")
         return ShareDefine.EntFBAskRet_Sit
     
+    if curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomScene):
+        if isNotify:
+            NotifyCode(curPlayer, "Carry_lhs_697674")
+        GameWorld.Log("客户端自定义场景下无法进入副本!", curPlayer.GetPlayerID())
+        return ShareDefine.EntFBAskRet_Other
+    
     if playerAction in ChConfig.Def_Player_Cannot_TransState:
         #Carry_lhs_697674:您当前所处的状态不能进行传送!
         if isNotify:
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossRealmPK.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossRealmPK.py
index 9c53acb..98026a1 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossRealmPK.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossRealmPK.py
@@ -284,6 +284,32 @@
     isWinner = winnerID == playerID
     GameWorld.Log("地图收到跨服PK结算: isWinner=%s,roomID=%s,zoneID=%s,seasonID=%s,timeStr=%s,overType=%s,winnerID=%s,roundWinnerIDList=%s,pkScore=%s,danLV=%s,cWinCount=%s,addScore=%s,tagPlayerID=%s,notifyState=%s" 
                   % (isWinner, roomID, zoneID, seasonID, timeStr, overType, winnerID, roundWinnerIDList, pkScore, danLV, cWinCount, addScore, tagPlayerID, notifyState), playerID)
+    
+    isToday = GameWorld.CheckTimeIsSameServerDayEx(GameWorld.ChangeTimeStrToNum(timeStr))
+    if not __DoAddPKOverData(curPlayer, zoneID, seasonID, danLV, pkScore, cWinCount, isWinner, isToday):
+        return
+    
+    ## 跨服已经通知过了,证明还在跨服服务器,不做以下的处理
+    if notifyState:
+        return
+    
+    overPack = ChPyNetSendPack.tagGCCrossRealmPKOverInfo()
+    overPack.TimeStr = timeStr
+    overPack.OverType = overType
+    overPack.WinnerID = winnerID
+    overPack.RoundWinnerID = roundWinnerIDList
+    overPack.RoundCount = len(overPack.RoundWinnerID)
+    overPack.AddScore = addScore
+    overPack.Score = pkScore
+    overPack.DanLV = danLV
+    overPack.CWinCnt = cWinCount
+    overPack.TagName = tagPlayerName
+    overPack.TagNameLen = len(overPack.TagName)
+    NetPackCommon.SendFakePack(curPlayer, overPack)
+    return
+
+def __DoAddPKOverData(curPlayer, zoneID, seasonID, danLV, pkScore, cWinCount, isWinner, isToday):
+    playerID = curPlayer.GetPlayerID()
     curSeasonID = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_CrossPKSeasonID)
     if curSeasonID != seasonID:
         GameWorld.Log("    非本赛季的结算信息,不处理!curSeasonID=%s,seasonID=%s" % (curSeasonID, seasonID), playerID)
@@ -315,7 +341,7 @@
         GameWorld.Log("    loser cWinCount=0", playerID)
         
     # 同一天的话增加当日PK次数
-    if GameWorld.CheckTimeIsSameServerDayEx(GameWorld.ChangeTimeStrToNum(timeStr)):
+    if isToday:
         todayPKCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayPKCount) + 1
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TodayPKCount, todayPKCount)
         GameWorld.Log("    同一天的PK结算增加今日PK次数: todayPKCount=%s" % todayPKCount, playerID)
@@ -330,24 +356,74 @@
         GameWorld.Log("    不同天的PK结算不增加今日PK次数! ", playerID)
         
     SyncCrossRealmPKPlayerInfo(curPlayer)
-    
-    ## 跨服已经通知过了,证明还在跨服服务器,不做以下的处理
-    if notifyState:
+    return True
+
+#// C1 08 跨服PK挑战机器人结算 #tagCMCrossRealmPKRobotOver
+#
+#struct    tagCMCrossRealmPKRobotOver
+#{
+#    tagHead        Head;
+#    BYTE        IsWin;    //是否获胜
+#};
+def OnCrossRealmPKRobotOver(index, clientData, tick):
+    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
+    playerID = curPlayer.GetPlayerID()
+    isWinner = clientData.IsWin
+    billboardCfg = IpyGameDataPY.GetFuncEvalCfg("CrossRealmPKCfg", 1, [])
+    if not billboardCfg or len(billboardCfg) != 2:
+        GameWorld.ErrLog("跨服竞技场排行榜配置错误!")
+        return
+    danLVLimit = billboardCfg[1]
+    playerDanLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_DanLV)
+    #策划设计该机器人目的为了前期体验,这里只验证是否超过上榜段位即可,即使作弊也不管,只要有次数即可
+    if playerDanLV >= danLVLimit:
+        GameWorld.ErrLog("该段位不允许与机器人匹配PK!playerDanLV=%s,danLVLimit=%s" % (playerDanLV, danLVLimit), playerID)
         return
     
+    zoneID = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_CrossPKZoneID)
+    seasonID = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_CrossPKSeasonID)
+    pkScore = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TotalScore)
+    danLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_DanLV)
+    cWinCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_CWinCount)
+    
+    ondayScore = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_OnDayScore)
+    dayScore = max(0, pkScore - ondayScore) # 今日已获得积分,正积分
+    
+    baseScoreList = IpyGameDataPY.GetFuncEvalCfg("CrossRealmPKScore", 2) # 胜负保底分
+    wBaseScore = baseScoreList[0] if len(baseScoreList) > 0 else 0
+    lBaseScore = baseScoreList[1] if len(baseScoreList) > 1 else 0
+    wExScore = eval(IpyGameDataPY.GetFuncCompileCfg("CrossRealmPKScore", 3)) # 胜方附加分
+    lExScore = 0
+    
+    if isWinner:
+        addScore = wBaseScore + wExScore
+        cWinCount += 1
+    else:
+        addScore = lBaseScore + lExScore
+        cWinCount = 0
+        
+    dayMaxScore = IpyGameDataPY.GetFuncCfg("CrossRealmPKScore", 1) # 每日获得积分上限,0为不限制
+    if dayMaxScore and addScore:
+        addScore = min(dayMaxScore - dayScore, addScore)
+        
+    GameWorld.Log("机器人跨服PK结算: isWinner=%s,zoneID=%s,seasonID=%s,pkScore=%s,danLV=%s,cWinCount=%s,addScore=%s" 
+                  % (isWinner, zoneID, seasonID, pkScore, danLV, cWinCount, addScore), playerID)
+    
+    pkScore += addScore
+    winIpyData = IpyGameDataPY.GetIpyGameData("CrossRealmPKDan", danLV)
+    if winIpyData and winIpyData.GetLVUpScore() and pkScore >= winIpyData.GetLVUpScore():
+        danLV += 1
+        
+    # 只同步以下信息,其他信息前端自行补全
     overPack = ChPyNetSendPack.tagGCCrossRealmPKOverInfo()
-    overPack.TimeStr = timeStr
-    overPack.OverType = overType
-    overPack.WinnerID = winnerID
-    overPack.RoundWinnerID = roundWinnerIDList
-    overPack.RoundCount = len(overPack.RoundWinnerID)
     overPack.AddScore = addScore
     overPack.Score = pkScore
     overPack.DanLV = danLV
     overPack.CWinCnt = cWinCount
-    overPack.TagName = tagPlayerName
-    overPack.TagNameLen = len(overPack.TagName)
     NetPackCommon.SendFakePack(curPlayer, overPack)
+    
+    isToday = True # 机器人结算的默认当天
+    __DoAddPKOverData(curPlayer, zoneID, seasonID, danLV, pkScore, cWinCount, isWinner, isToday)
     return
 
 

--
Gitblit v1.8.0