From 2eb39c9fe42c1ee32500f81c4bf7d735c6116d9d Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 30 七月 2019 00:26:20 +0800
Subject: [PATCH] 8180 【后端】【主干】优化打boss掉落套装体验

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossRealmPK.py |   87 +++++++++++++++----------------------------
 1 files changed, 30 insertions(+), 57 deletions(-)

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 3f3bafd..36e621f 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)
@@ -239,7 +240,6 @@
     # 进行匹配
     if requestType == 1:
         if not CheckHavePKCount(curPlayer):
-            GameWorld.DebugLog("PK次数不足,无法发起匹配!", curPlayer.GetPlayerID())
             return
         
         dataMsg = {
@@ -257,6 +257,7 @@
                    "pkScore":curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TotalScore), # 当前积分
                    "danLV":curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_DanLV), # 当前段位
                    "cWinCount":curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_CWinCount), # 连胜次数
+                   "cLoseCount":curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_CLoseCount), # 连败次数
                    "ondayScore":curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_OnDayScore), # 过天时的积分
                    }
         GameWorld.SendMsgToCrossServer(ShareDefine.ClientServerMsg_PKMatch, dataMsg)
@@ -279,6 +280,8 @@
         todayItemAddCount  = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_ItemAddCount)
         
         if todayPKCount >= (dayFreeMatchCountMax + todayBuyCount + todayItemAddCount):
+            GameWorld.DebugLog("PK次数不足,无法发起匹配! todayPKCount=%s >= (dayFreeMatchCountMax=%s + todayBuyCount=%s + todayItemAddCount=%s)" 
+                               % (todayPKCount, dayFreeMatchCountMax, todayBuyCount, todayItemAddCount), curPlayer.GetPlayerID())
             return False
     return True
 
@@ -340,10 +343,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:
@@ -374,61 +380,20 @@
     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)
+    
+    if GameWorld.IsCrossServer():
+        GameWorld.DebugLog("跨服服务器无法发起机器人结算!", 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)
+    if not CheckHavePKCount(curPlayer):
+        return
     
-    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.AddScore = addScore
-    overPack.Score = pkScore
-    overPack.DanLV = danLV
-    overPack.CWinCnt = cWinCount
-    NetPackCommon.SendFakePack(curPlayer, overPack)
-    
-    isToday = True # 机器人结算的默认当天
-    __DoAddPKOverData(curPlayer, zoneID, seasonID, danLV, pkScore, cWinCount, isWinner, isToday)
+    dataMsg = {
+               "playerID":playerID,
+               "isWinner":isWinner,
+               }
+    GameWorld.SendMsgToCrossServer(ShareDefine.ClientServerMsg_PKRobotOver, dataMsg)
+    GameWorld.Log("同步跨服服务器与机器人PK结算: %s" % str(dataMsg), playerID)
     return
 
 
@@ -447,11 +412,19 @@
     if not IsCrossRealmPKMatchState():
         GameWorld.DebugLog("跨服匹配未开启,不可进行购买次数!", playerID)
         return
-    if CheckHavePKCount(curPlayer):
-        GameWorld.DebugLog("有PK次数,不需要购买次数!", playerID)
+    dayFreeMatchCountMax = IpyGameDataPY.GetFuncCfg("CrossRealmPKMatchCount", 1)
+    if not dayFreeMatchCountMax:
+        GameWorld.DebugLog("每日匹配次数没有限制,不需要购买次数!", playerID)
+        return
+    todayPKCount  = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayPKCount)
+    todayBuyCount  = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayBuyCount)
+    todayItemAddCount  = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_ItemAddCount)
+    canPKCount = dayFreeMatchCountMax + todayBuyCount + todayItemAddCount - todayPKCount
+    if canPKCount >= dayFreeMatchCountMax:
+        GameWorld.DebugLog("可PK次数不能大于每日免费次数!", playerID)
         return
     dayBuyCountMax = IpyGameDataPY.GetFuncCfg("CrossRealmPKMatchCount", 2)
-    todayBuyCount  = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayBuyCount)
+    #todayBuyCount  = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayBuyCount)
     if dayBuyCountMax and todayBuyCount >= dayBuyCountMax:
         GameWorld.DebugLog("今日购买次数已满,无法购买!todayBuyCount=%s" % (todayBuyCount), playerID)
         return

--
Gitblit v1.8.0