From 9d5f1996ab520ab5ede2b153a15c3b8b74be662e Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 29 三月 2019 17:19:17 +0800
Subject: [PATCH] 3040 【BUG】【1.6】跨服pk,快速点击购买次数,可以超出上限

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossRealmPK.py |   32 ++++++++++++++++++--------------
 1 files changed, 18 insertions(+), 14 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 7beab65..3f3bafd 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossRealmPK.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossRealmPK.py
@@ -238,17 +238,10 @@
     
     # 进行匹配
     if requestType == 1:
-        dayFreeMatchCountMax = IpyGameDataPY.GetFuncCfg("CrossRealmPKMatchCount", 1)
-        if dayFreeMatchCountMax:
-            todayPKCount  = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayPKCount)
-            todayBuyCount  = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayBuyCount)
-            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), playerID)
-                return
-            
+        if not CheckHavePKCount(curPlayer):
+            GameWorld.DebugLog("PK次数不足,无法发起匹配!", curPlayer.GetPlayerID())
+            return
+        
         dataMsg = {
                    "seasonID":GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_CrossPKSeasonID), # 赛季ID
                    "pkZoneID":GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_CrossPKZoneID), # PK赛区
@@ -276,6 +269,18 @@
         GameWorld.Log("    发送取消匹配到GameServer sendMsg=%s" % str(sendMsg), playerID)
         
     return
+
+def CheckHavePKCount(curPlayer):
+    ## 检查是否有PK次数
+    dayFreeMatchCountMax = IpyGameDataPY.GetFuncCfg("CrossRealmPKMatchCount", 1)
+    if dayFreeMatchCountMax:
+        todayPKCount  = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayPKCount)
+        todayBuyCount  = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayBuyCount)
+        todayItemAddCount  = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_ItemAddCount)
+        
+        if todayPKCount >= (dayFreeMatchCountMax + todayBuyCount + todayItemAddCount):
+            return False
+    return True
 
 def CrossServerMsg_PKOverInfo(curPlayer, overInfo):
     ## 收到跨服服务器的PK结算信息
@@ -442,9 +447,8 @@
     if not IsCrossRealmPKMatchState():
         GameWorld.DebugLog("跨服匹配未开启,不可进行购买次数!", playerID)
         return
-    dayFreeMatchCountMax = IpyGameDataPY.GetFuncCfg("CrossRealmPKMatchCount", 1)
-    if not dayFreeMatchCountMax:
-        GameWorld.DebugLog("每日匹配次数没有限制,不需要购买次数!", playerID)
+    if CheckHavePKCount(curPlayer):
+        GameWorld.DebugLog("有PK次数,不需要购买次数!", playerID)
         return
     dayBuyCountMax = IpyGameDataPY.GetFuncCfg("CrossRealmPKMatchCount", 2)
     todayBuyCount  = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayBuyCount)

--
Gitblit v1.8.0