From 9ecc819548b23562caf3271c60334dc687d52e03 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 09 七月 2019 11:24:26 +0800
Subject: [PATCH] 7954 【主干】【后端】跨服PVP匹配机器人规则优化

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py           |  128 +++++++++++++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py             |   10 +
 PySysDB/PySysDBPY.h                                                                              |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/SetCrossPK.py    |   12 +
 ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py                                |  128 +++++++++++++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossRealmPK.py |   71 +++++++++--
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py                  |    4 
 7 files changed, 329 insertions(+), 26 deletions(-)

diff --git a/PySysDB/PySysDBPY.h b/PySysDB/PySysDBPY.h
index fd54c1e..83f3197 100644
--- a/PySysDB/PySysDBPY.h
+++ b/PySysDB/PySysDBPY.h
@@ -1503,6 +1503,8 @@
 {
 	BYTE		_DanLV;	//段位等级
 	WORD		LVUpScore;	//升段位所需积分
+	BYTE		MatchRobotRate;	//匹配机器人基础概率,百分率
+	BYTE		MatchRobotRateEx;	//匹配机器人失败次数附加概率,百分率
 };
 
 //跨服竞技场段位奖励表
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
index aac90ff..de47a18 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -10529,6 +10529,7 @@
     _fields_ = [
                   ("Cmd", c_ubyte),
                   ("SubCmd", c_ubyte),
+                  ("IsRobot", c_ubyte),    # 是否匹配机器人
                   ]
 
     def __init__(self):
@@ -10545,6 +10546,7 @@
     def Clear(self):
         self.Cmd = 0xC0
         self.SubCmd = 0x02
+        self.IsRobot = 0
         return
 
     def GetLength(self):
@@ -10556,11 +10558,13 @@
     def OutputString(self):
         DumpString = '''// C0 02 跨服PK开始匹配 //tagGCCrossRealmPKStartMatch:
                                 Cmd:%s,
-                                SubCmd:%s
+                                SubCmd:%s,
+                                IsRobot:%d
                                 '''\
                                 %(
                                 self.Cmd,
-                                self.SubCmd
+                                self.SubCmd,
+                                self.IsRobot
                                 )
         return DumpString
 
@@ -15289,6 +15293,126 @@
 
 
 #------------------------------------------------------
+# A3 12 通知骑宠觉醒信息 #tagMCHorsePetSkinData
+
+class  tagMCHorsePetSkinInfo(Structure):
+    _pack_ = 1
+    _fields_ = [
+                  ("Type", c_ubyte),    # 1-坐骑 2-灵宠
+                  ("ID", c_int),    # 对应坐骑表灵宠表ID
+                  ("Exp", c_int),    #经验
+                  ("SkinLV", c_ubyte),    #觉醒等级
+                  ("SkinIndex", c_ubyte),    #当前选择外观
+                  ]
+
+    def __init__(self):
+        self.Clear()
+        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.Type = 0
+        self.ID = 0
+        self.Exp = 0
+        self.SkinLV = 0
+        self.SkinIndex = 0
+        return
+
+    def GetLength(self):
+        return sizeof(tagMCHorsePetSkinInfo)
+
+    def GetBuffer(self):
+        return string_at(addressof(self), self.GetLength())
+
+    def OutputString(self):
+        DumpString = '''// A3 12 通知骑宠觉醒信息 //tagMCHorsePetSkinData:
+                                Type:%d,
+                                ID:%d,
+                                Exp:%d,
+                                SkinLV:%d,
+                                SkinIndex:%d
+                                '''\
+                                %(
+                                self.Type,
+                                self.ID,
+                                self.Exp,
+                                self.SkinLV,
+                                self.SkinIndex
+                                )
+        return DumpString
+
+
+class  tagMCHorsePetSkinData(Structure):
+    Head = tagHead()
+    Num = 0    #(BYTE Num)//个数
+    InfoList = list()    #(vector<tagMCHorsePetSkinInfo> InfoList)// 数据列表
+    data = None
+
+    def __init__(self):
+        self.Clear()
+        self.Head.Cmd = 0xA3
+        self.Head.SubCmd = 0x12
+        return
+
+    def ReadData(self, _lpData, _pos=0, _Len=0):
+        self.Clear()
+        _pos = self.Head.ReadData(_lpData, _pos)
+        self.Num,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        for i in range(self.Num):
+            temInfoList = tagMCHorsePetSkinInfo()
+            _pos = temInfoList.ReadData(_lpData, _pos)
+            self.InfoList.append(temInfoList)
+        return _pos
+
+    def Clear(self):
+        self.Head = tagHead()
+        self.Head.Clear()
+        self.Head.Cmd = 0xA3
+        self.Head.SubCmd = 0x12
+        self.Num = 0
+        self.InfoList = list()
+        return
+
+    def GetLength(self):
+        length = 0
+        length += self.Head.GetLength()
+        length += 1
+        for i in range(self.Num):
+            length += self.InfoList[i].GetLength()
+
+        return length
+
+    def GetBuffer(self):
+        data = ''
+        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
+        data = CommFunc.WriteBYTE(data, self.Num)
+        for i in range(self.Num):
+            data = CommFunc.WriteString(data, self.InfoList[i].GetLength(), self.InfoList[i].GetBuffer())
+        return data
+
+    def OutputString(self):
+        DumpString = '''
+                                Head:%s,
+                                Num:%d,
+                                InfoList:%s
+                                '''\
+                                %(
+                                self.Head.OutputString(),
+                                self.Num,
+                                "..."
+                                )
+        return DumpString
+
+
+m_NAtagMCHorsePetSkinData=tagMCHorsePetSkinData()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCHorsePetSkinData.Head.Cmd,m_NAtagMCHorsePetSkinData.Head.SubCmd))] = m_NAtagMCHorsePetSkinData
+
+
+#------------------------------------------------------
 # A3 52 法宝等级信息 #tagMCMagicWeaponLVInfo
 
 class  tagMCMagicWeaponInfo(Structure):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index 40eb694..3c75b8f 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -3810,7 +3810,9 @@
 Def_PDict_CrossPK_DanLV = "CrossPK_DanLV" # 当前段位
 Def_PDict_CrossPK_PKCount = "CrossPK_PKCount" # 当前总PK次数
 Def_PDict_CrossPK_WinCount = "CrossPK_WinCount" # 当前胜利次数
-Def_PDict_CrossPK_CWinCount = "CrossPK_CWinCount" # 跨当前连胜次数
+Def_PDict_CrossPK_CWinCount = "CrossPK_CWinCount" # 当前连胜次数
+Def_PDict_CrossPK_CLoseCount = "CrossPK_CLoseCount" # 当前连败次数
+Def_PDict_CrossPK_IsMatchRobot = "CrossPK_IsMatchRobot" # 本次是否匹配机器人,1-是,0-否
 Def_PDict_CrossPK_TodayPKCount = "CrossPK_TodayPKCount" # 今日已PK次数
 Def_PDict_CrossPK_TodayWinCount = "CrossPK_TodayWinCount" # 今日已胜利次数
 Def_PDict_CrossPK_TodayBuyCount = "CrossPK_TodayBuyCount" # 今日已购买PK次数
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
index aac90ff..de47a18 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -10529,6 +10529,7 @@
     _fields_ = [
                   ("Cmd", c_ubyte),
                   ("SubCmd", c_ubyte),
+                  ("IsRobot", c_ubyte),    # 是否匹配机器人
                   ]
 
     def __init__(self):
@@ -10545,6 +10546,7 @@
     def Clear(self):
         self.Cmd = 0xC0
         self.SubCmd = 0x02
+        self.IsRobot = 0
         return
 
     def GetLength(self):
@@ -10556,11 +10558,13 @@
     def OutputString(self):
         DumpString = '''// C0 02 跨服PK开始匹配 //tagGCCrossRealmPKStartMatch:
                                 Cmd:%s,
-                                SubCmd:%s
+                                SubCmd:%s,
+                                IsRobot:%d
                                 '''\
                                 %(
                                 self.Cmd,
-                                self.SubCmd
+                                self.SubCmd,
+                                self.IsRobot
                                 )
         return DumpString
 
@@ -15289,6 +15293,126 @@
 
 
 #------------------------------------------------------
+# A3 12 通知骑宠觉醒信息 #tagMCHorsePetSkinData
+
+class  tagMCHorsePetSkinInfo(Structure):
+    _pack_ = 1
+    _fields_ = [
+                  ("Type", c_ubyte),    # 1-坐骑 2-灵宠
+                  ("ID", c_int),    # 对应坐骑表灵宠表ID
+                  ("Exp", c_int),    #经验
+                  ("SkinLV", c_ubyte),    #觉醒等级
+                  ("SkinIndex", c_ubyte),    #当前选择外观
+                  ]
+
+    def __init__(self):
+        self.Clear()
+        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.Type = 0
+        self.ID = 0
+        self.Exp = 0
+        self.SkinLV = 0
+        self.SkinIndex = 0
+        return
+
+    def GetLength(self):
+        return sizeof(tagMCHorsePetSkinInfo)
+
+    def GetBuffer(self):
+        return string_at(addressof(self), self.GetLength())
+
+    def OutputString(self):
+        DumpString = '''// A3 12 通知骑宠觉醒信息 //tagMCHorsePetSkinData:
+                                Type:%d,
+                                ID:%d,
+                                Exp:%d,
+                                SkinLV:%d,
+                                SkinIndex:%d
+                                '''\
+                                %(
+                                self.Type,
+                                self.ID,
+                                self.Exp,
+                                self.SkinLV,
+                                self.SkinIndex
+                                )
+        return DumpString
+
+
+class  tagMCHorsePetSkinData(Structure):
+    Head = tagHead()
+    Num = 0    #(BYTE Num)//个数
+    InfoList = list()    #(vector<tagMCHorsePetSkinInfo> InfoList)// 数据列表
+    data = None
+
+    def __init__(self):
+        self.Clear()
+        self.Head.Cmd = 0xA3
+        self.Head.SubCmd = 0x12
+        return
+
+    def ReadData(self, _lpData, _pos=0, _Len=0):
+        self.Clear()
+        _pos = self.Head.ReadData(_lpData, _pos)
+        self.Num,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        for i in range(self.Num):
+            temInfoList = tagMCHorsePetSkinInfo()
+            _pos = temInfoList.ReadData(_lpData, _pos)
+            self.InfoList.append(temInfoList)
+        return _pos
+
+    def Clear(self):
+        self.Head = tagHead()
+        self.Head.Clear()
+        self.Head.Cmd = 0xA3
+        self.Head.SubCmd = 0x12
+        self.Num = 0
+        self.InfoList = list()
+        return
+
+    def GetLength(self):
+        length = 0
+        length += self.Head.GetLength()
+        length += 1
+        for i in range(self.Num):
+            length += self.InfoList[i].GetLength()
+
+        return length
+
+    def GetBuffer(self):
+        data = ''
+        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
+        data = CommFunc.WriteBYTE(data, self.Num)
+        for i in range(self.Num):
+            data = CommFunc.WriteString(data, self.InfoList[i].GetLength(), self.InfoList[i].GetBuffer())
+        return data
+
+    def OutputString(self):
+        DumpString = '''
+                                Head:%s,
+                                Num:%d,
+                                InfoList:%s
+                                '''\
+                                %(
+                                self.Head.OutputString(),
+                                self.Num,
+                                "..."
+                                )
+        return DumpString
+
+
+m_NAtagMCHorsePetSkinData=tagMCHorsePetSkinData()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCHorsePetSkinData.Head.Cmd,m_NAtagMCHorsePetSkinData.Head.SubCmd))] = m_NAtagMCHorsePetSkinData
+
+
+#------------------------------------------------------
 # A3 52 法宝等级信息 #tagMCMagicWeaponLVInfo
 
 class  tagMCMagicWeaponInfo(Structure):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/SetCrossPK.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/SetCrossPK.py
index b0f8b89..1e9e3e7 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/SetCrossPK.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/SetCrossPK.py
@@ -46,6 +46,7 @@
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_PKCount, 0)
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_WinCount, 0)
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_CWinCount, 0)
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_CLoseCount, 0)
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TodayPKCount, 0)
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TodayWinCount, 0)
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TodayBuyCount, 0)
@@ -74,9 +75,10 @@
                        3:[ChConfig.Def_PDict_CrossPK_PKCount, "PK次数"],
                        4:[ChConfig.Def_PDict_CrossPK_WinCount, "胜利次数"],
                        5:[ChConfig.Def_PDict_CrossPK_CWinCount, "连胜次数"],
-                       6:[ChConfig.Def_PDict_CrossPK_TodayPKCount, "今日PK次数"],
-                       7:[ChConfig.Def_PDict_CrossPK_TodayWinCount, "今日胜利次数"],
-                       8:[ChConfig.Def_PDict_CrossPK_TodayBuyCount, "今日购买次数"],
+                       6:[ChConfig.Def_PDict_CrossPK_CLoseCount, "连败次数"],
+                       7:[ChConfig.Def_PDict_CrossPK_TodayPKCount, "今日PK次数"],
+                       8:[ChConfig.Def_PDict_CrossPK_TodayWinCount, "今日胜利次数"],
+                       9:[ChConfig.Def_PDict_CrossPK_TodayBuyCount, "今日购买次数"],
                        }
         indexList = range(len(msgList))
         for i in indexList[::2]:
@@ -115,8 +117,8 @@
 def __PrintHelp(curPlayer):
     GameWorld.DebugAnswer(curPlayer, "重置数据: SetCrossPK 0")
     GameWorld.DebugAnswer(curPlayer, "设置数据: SetCrossPK 类型  值")
-    GameWorld.DebugAnswer(curPlayer, "类型:0-积分,1-过天积分,2-段位,3-PK次数,4-胜利次数,5-连胜次数")
-    GameWorld.DebugAnswer(curPlayer, "6-今日PK次数,7-今日胜利次数,8-今日购买次数")
+    GameWorld.DebugAnswer(curPlayer, "类型:0-积分,1-过天积分,2-段位,3-PK次数,4-胜利次数,5-连胜次数,6-连败次数")
+    GameWorld.DebugAnswer(curPlayer, "7-今日PK次数,8-今日胜利次数,9-今日购买次数")
     GameWorld.DebugAnswer(curPlayer, "设置历史记录: SetCrossPK 赛季ID 类型 数值")
     GameWorld.DebugAnswer(curPlayer, "类型:0-段位,1-名次,2-积分,3-奖励等级")
     return
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
index 0f433a0..49f2b6a 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
@@ -1180,6 +1180,8 @@
                 "CrossRealmPKDan":(
                         ("BYTE", "DanLV", 1),
                         ("WORD", "LVUpScore", 0),
+                        ("BYTE", "MatchRobotRate", 0),
+                        ("BYTE", "MatchRobotRateEx", 0),
                         ),
 
                 "CrossRealmPKDanAward":(
@@ -3883,11 +3885,15 @@
     
     def __init__(self):
         self.DanLV = 0
-        self.LVUpScore = 0
+        self.LVUpScore = 0
+        self.MatchRobotRate = 0
+        self.MatchRobotRateEx = 0
         return
         
     def GetDanLV(self): return self.DanLV # 段位等级
-    def GetLVUpScore(self): return self.LVUpScore # 升段位所需积分
+    def GetLVUpScore(self): return self.LVUpScore # 升段位所需积分
+    def GetMatchRobotRate(self): return self.MatchRobotRate # 匹配机器人基础概率,百分率
+    def GetMatchRobotRateEx(self): return self.MatchRobotRateEx # 匹配机器人失败次数附加概率,百分率
 
 # 跨服竞技场段位奖励表
 class IPY_CrossRealmPKDanAward():
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 a840f60..16cdb27 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossRealmPK.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossRealmPK.py
@@ -177,6 +177,7 @@
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_PKCount, 0)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_WinCount, 0)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_CWinCount, 0)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_CLoseCount, 0)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TodayPKCount, 0)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TodayWinCount, 0)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TodayBuyCount, 0)
@@ -240,6 +241,23 @@
     if requestType == 1:
         if not CheckHavePKCount(curPlayer):
             return
+        
+        danLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_DanLV)
+        danIpyData = IpyGameDataPY.GetIpyGameData("CrossRealmPKDan", danLV)
+        if not danIpyData:
+            return
+        cLoseCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_CLoseCount)
+        matchRobotRate = danIpyData.GetMatchRobotRate() + danIpyData.GetMatchRobotRateEx() * cLoseCount
+        isMatchRobot = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_IsMatchRobot)
+        GameWorld.Log("isMatchRobot=%s,danLV=%s,cLoseCount=%s,匹配机器人概率=%s" % (isMatchRobot, danLV, cLoseCount, matchRobotRate), playerID)
+        if isMatchRobot or (matchRobotRate and GameWorld.CanHappen(matchRobotRate, 100)):
+            GameWorld.Log("    本次匹配到机器人!", playerID)
+            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_IsMatchRobot, 1)
+            startMatchPack = ChPyNetSendPack.tagGCCrossRealmPKStartMatch()
+            startMatchPack.IsRobot = 1
+            NetPackCommon.SendFakePack(curPlayer, startMatchPack)
+            return
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_IsMatchRobot, 0)
         
         dataMsg = {
                    "seasonID":GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_CrossPKSeasonID), # 赛季ID
@@ -333,6 +351,7 @@
     
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TotalScore, pkScore)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_DanLV, danLV)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_IsMatchRobot, 0)
     
     pkCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_PKCount) + 1
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_PKCount, pkCount)
@@ -341,10 +360,13 @@
         winCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_WinCount) + 1
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_WinCount, winCount)
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_CWinCount, cWinCount)
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_CLoseCount, 0)
         GameWorld.Log("    winner winCount=%s,cWinCount=%s" % (winCount, cWinCount), playerID)
     else:
+        cLoseCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_CLoseCount) + 1
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_CLoseCount, cLoseCount)
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_CWinCount, 0)
-        GameWorld.Log("    loser cWinCount=0", playerID)
+        GameWorld.Log("    loser cLoseCount=%s" % cLoseCount, playerID)
         
     # 同一天的话增加当日PK次数
     if isToday:
@@ -375,18 +397,13 @@
     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
     
     if not CheckHavePKCount(curPlayer):
+        return
+    
+    isMatchRobot = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_IsMatchRobot)
+    if not isMatchRobot:
+        GameWorld.DebugLog("当前不允许结算跨服匹配机器人!IsMatchRobot=%s" % isMatchRobot, playerID)
         return
     
     zoneID = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_CrossPKZoneID)
@@ -422,7 +439,11 @@
     winIpyData = IpyGameDataPY.GetIpyGameData("CrossRealmPKDan", danLV)
     if winIpyData and winIpyData.GetLVUpScore() and pkScore >= winIpyData.GetLVUpScore():
         danLV += 1
-        
+            
+    isToday = True # 机器人结算的默认当天
+    if not __DoAddPKOverData(curPlayer, zoneID, seasonID, danLV, pkScore, cWinCount, isWinner, isToday):
+        return
+    
     # 只同步以下信息,其他信息前端自行补全
     overPack = ChPyNetSendPack.tagGCCrossRealmPKOverInfo()
     overPack.AddScore = addScore
@@ -431,8 +452,30 @@
     overPack.CWinCnt = cWinCount
     NetPackCommon.SendFakePack(curPlayer, overPack)
     
-    isToday = True # 机器人结算的默认当天
-    __DoAddPKOverData(curPlayer, zoneID, seasonID, danLV, pkScore, cWinCount, isWinner, isToday)
+    # 通知跨服更新榜单积分数据
+    billboardCfg = IpyGameDataPY.GetFuncEvalCfg("CrossRealmPKCfg", 1, [])
+    if billboardCfg and len(billboardCfg) > 1 or danLV >= billboardCfg[1]:
+        pass
+#        dataMsg = {
+#                   "seasonID":seasonID,
+#                   "pkZoneID":zoneID,
+#                   "accID":curPlayer.GetAccID(),
+#                   "playerID":playerID,
+#                   "playerName":CrossRealmPlayer.GetCrossPlayerName(curPlayer),
+#                   "playerJob":curPlayer.GetJob(),
+#                   "playerLV":curPlayer.GetLV(),
+#                   "maxHP":curPlayer.GetMaxHP(),
+#                   "maxProDef":PlayerControl.GetMaxProDef(curPlayer),
+#                   "fightPower":curPlayer.GetFightPower(),
+#                   "realmLV":curPlayer.GetOfficialRank(),
+#                   "pkScore":pkScore,
+#                   "danLV":danLV,
+#                   "cWinCount":cWinCount,
+#                   "ondayScore":curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_OnDayScore), # 过天时的积分
+#                   }
+#        GameWorld.SendMsgToCrossServer(ShareDefine.ClientServerMsg_PKMatch, dataMsg)
+#        GameWorld.Log("    更新积分到跨服服务器 dataMsg=%s" % str(dataMsg), playerID)
+        
     return
 
 

--
Gitblit v1.8.0