From 7d3e1b11373f664833362b3887dfe96e44dbf0da Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期五, 25 一月 2019 16:07:51 +0800
Subject: [PATCH] 2954 【1.5.100】【1.5.0】跨服竞技场地图报错 -- 男号技能极光琉璃的减攻速buff  被敌方反弹导致报错问题

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossRealmPK.py |   50 +++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 43 insertions(+), 7 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 c282498..226837f 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossRealmPK.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossRealmPK.py
@@ -19,10 +19,12 @@
 import PlayerControl
 import NetPackCommon
 import IpyGameDataPY
+import PlayerActivity
 import ChPyNetSendPack
 import CrossRealmPlayer
 import FunctionNPCCommon
 import DataRecordPack
+import PlayerWeekParty
 import IPY_GameWorld
 import ItemControler
 import ItemCommon
@@ -31,9 +33,10 @@
 
 ## 是否匹配中
 def SetIsCrossPKMatching(curPlayer, isMatching):
-    curPlayer.SetDict(ChConfig.Def_PlayerKey_IsCrossPKMatching, isMatching)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PlayerKey_IsCrossPKMatching, isMatching)
     return
-def GetIsCrossPKMatching(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_IsCrossPKMatching)
+def GetIsCrossPKMatching(curPlayer):
+    return curPlayer.NomalDictGetProperty(ChConfig.Def_PlayerKey_IsCrossPKMatching) and IsCrossRealmPKMatchState()
 
 def DoPlayerOnDay(curPlayer):
     if GameWorld.IsCrossServer():
@@ -62,6 +65,7 @@
     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)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_ItemAddCount, 0)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_DayPKCountAwardState, 0)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_DayWinCountAwardState, 0)
     SyncCrossRealmPKPlayerInfo(curPlayer)
@@ -152,7 +156,7 @@
         DR_GetCrossPKAward(curPlayer, zoneID, seasonID, eventName, True, mailDetail)
         
     # 查询 GameServer 玩家赛季排名
-    if not curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_SeasonAwardState):
+    if not curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_SeasonAwardState) and playerDanLV:
         OnQueryCrossPKSeasonOrderAward(curPlayer, zoneID, seasonID, True)
         
     # 重置状态
@@ -165,6 +169,7 @@
     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)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_ItemAddCount, 0)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_DayPKCountAwardState, 0)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_DayWinCountAwardState, 0)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_DanLVAwardState, 0)
@@ -196,6 +201,10 @@
         GameWorld.DebugLog("跨服服务器无法发起匹配!", playerID)
         return
     
+    if not CrossRealmPlayer.IsCrossServerOpen():
+        PlayerControl.NotifyCode(curPlayer, "CrossMatching18")
+        return
+    
     if GameWorld.GetMap().GetMapFBType() != IPY_GameWorld.fbtNull:
         GameWorld.DebugLog("副本中,无法进行跨服匹配!", playerID)
         return
@@ -222,9 +231,11 @@
         if dayFreeMatchCountMax:
             todayPKCount  = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayPKCount)
             todayBuyCount  = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayBuyCount)
-            if todayPKCount >= (dayFreeMatchCountMax + todayBuyCount):
-                GameWorld.DebugLog("PK次数不足,无法发起匹配! todayPKCount=%s >= (dayFreeMatchCountMax=%s + todayBuyCount=%s)" 
-                                   % (todayPKCount, dayFreeMatchCountMax, todayBuyCount), playerID)
+            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
             
         dataMsg = {
@@ -236,6 +247,7 @@
                    "playerJob":curPlayer.GetJob(),
                    "playerLV":curPlayer.GetLV(),
                    "maxHP":curPlayer.GetMaxHP(),
+                   "maxProDef":PlayerControl.GetMaxProDef(curPlayer),
                    "fightPower":curPlayer.GetFightPower(),
                    "realmLV":curPlayer.GetOfficialRank(),
                    "pkScore":curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TotalScore), # 当前积分
@@ -274,6 +286,7 @@
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_ZoneID, zoneID)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_SeasonID, seasonID)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_SeasonDanLV % seasonID, danLV)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_SeasonScore % seasonID, pkScore)
     
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TotalScore, pkScore)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_DanLV, danLV)
@@ -299,6 +312,8 @@
             todayWinCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayWinCount) + 1
             PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TodayWinCount, todayWinCount)
             GameWorld.Log("    增加今日已获胜次数: todayWinCount=%s" % todayWinCount, playerID)
+        PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_CrossReamPK)
+        PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_CrossPK, 1)
     else:
         GameWorld.Log("    不同天的PK结算不增加今日PK次数! ", playerID)
         
@@ -333,6 +348,12 @@
 def OnCrossRealmPKBuy(index, clientData, tick):
     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
     playerID = curPlayer.GetPlayerID()
+    if not CrossRealmPlayer.IsCrossServerOpen():
+        PlayerControl.NotifyCode(curPlayer, "CrossMatching18")
+        return
+    if not IsCrossRealmPKMatchState():
+        GameWorld.DebugLog("跨服匹配未开启,不可进行购买次数!", playerID)
+        return
     dayFreeMatchCountMax = IpyGameDataPY.GetFuncCfg("CrossRealmPKMatchCount", 1)
     if not dayFreeMatchCountMax:
         GameWorld.DebugLog("每日匹配次数没有限制,不需要购买次数!", playerID)
@@ -440,6 +461,10 @@
         
     elif awardType == 4:
         GameWorld.DebugLog("玩家领取赛季结算奖励!", playerID)
+        totalScore = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TotalScore)
+        if not totalScore:
+            GameWorld.DebugLog("无赛季积分无法领取奖励!", playerID)
+            return
         if GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_CrossPKSeasonState) != 2:
             GameWorld.DebugLog("非赛季结算阶段,不可领取!", playerID)
             return
@@ -477,6 +502,9 @@
     drDataDict.update({"awardIndex":awardIndex, "awardState":awardState, "awardItemList":awardItemList})
     for itemID, itemCnt, isBind in awardItemList:
         ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, isBind, [IPY_GameWorld.rptItem])
+        
+    if awardType == 3:
+        PlayerControl.WorldNotify(0, "CrossMatching22", [curPlayer.GetPlayerName(), awardDanLV])
         
     DR_GetCrossPKAward(curPlayer, zoneID, seasonID, eventName, False, drDataDict)
     return
@@ -527,7 +555,8 @@
 
 def DoGetPKSeasonAward(curPlayer, eventName, zoneID, seasonID, order, danLV, isMail):
     ## 执行发放赛季结算奖励,名次奖励与最高段位奖励互斥,优先名次奖励
-    
+    isNotify = not isMail
+    notifyKey = ""
     awardItemList = []
     seasonAwardLV = danLV
     playerID = curPlayer.GetPlayerID()
@@ -552,6 +581,7 @@
                 seasonAwardLV = maxDanLV + (len(awardOrderList) - i)
                 GameWorld.Log("获得排名奖励, 更新奖励等级: awardOrderList=%s,i=%s,maxDanLV=%s,seasonAwardLV=%s" % (awardOrderList, i, maxDanLV, seasonAwardLV), playerID)
                 mailTypeKey = "CrossServer4"
+                notifyKey = "CrossMatching23"
                 mailParamList = [seasonID, fromOrder, toOrder]
                 break
             fromOrder = awardOrder + 1
@@ -563,6 +593,7 @@
             return
         awardItemList = danLVIpyData.GetSeasonDanLVAwardList()
         mailTypeKey = "CrossServer5"
+        notifyKey = "CrossMatching24"
         mailParamList = [seasonID, danLV]
         
     if not awardItemList:
@@ -594,6 +625,9 @@
     GameWorld.Log("领取成功! awardItemList=%s" % (awardItemList), playerID)
     drDataDict = {"awardItemList":awardItemList, "order":order, "danLV":danLV, "seasonAwardLV":seasonAwardLV, "isMail":isMail}
     DR_GetCrossPKAward(curPlayer, zoneID, seasonID, eventName, isMail, drDataDict)
+    
+    if isNotify and notifyKey:
+        PlayerControl.WorldNotify(0, notifyKey, [curPlayer.GetPlayerName()] + mailParamList + [awardItemList[0][0]])
     return
 
 def SyncCrossRealmPKPlayerInfo(curPlayer):
@@ -607,6 +641,7 @@
     pkPlayerInfo.DayPKCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayPKCount)
     pkPlayerInfo.DayWinCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayWinCount)
     pkPlayerInfo.DayBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayBuyCount)
+    pkPlayerInfo.DayItemAddCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_ItemAddCount)
     NetPackCommon.SendFakePack(curPlayer, pkPlayerInfo)
     return
     
@@ -628,6 +663,7 @@
         seasonInfo = ChPyNetSendPack.tagMCCrossRealmPKPlayerHisSeason()
         seasonInfo.SeasonID = seasonID
         seasonInfo.DanLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_SeasonDanLV % seasonID)
+        seasonInfo.Score = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_SeasonScore % seasonID)
         seasonInfo.Order = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_SeasonOrder % seasonID)
         seasonInfo.AwardLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_SeasonAwardLV % seasonID)
         hisSeasonInfo.SeasonList.append(seasonInfo)

--
Gitblit v1.8.0