From a20d1ef24191c07fc7150303ca2aa965a2262f19 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 27 五月 2019 14:50:23 +0800
Subject: [PATCH] 3724 【BUG】【2.0】快速连续点击进入草园不弹结算(优化自定义场景采集判断,优化进入自定义场景验证)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFB.py                                   |   35 +++++++++++++----
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py                            |    4 +-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py                                     |   17 +++++---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_CrossGrassland.py |    5 ++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_FairyTreasure.py  |    4 +-
 5 files changed, 45 insertions(+), 20 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py
index 5b39e56..f761133 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py
@@ -2207,14 +2207,14 @@
         
     return
 
-## 自定义场景采集OK
+## 自定义场景采集OK,需自带是否允许采集的判断
 def OnCustomSceneCollectOK(curPlayer, mapID, lineID, npcID):
     do_FBLogic_ID = __GetFBLogic_MapID(mapID)
     
     callFunc = GameWorld.GetExecFunc(FBProcess, "GameLogic_%s.%s" % (do_FBLogic_ID, "OnCustomSceneCollectOK"))
     
     if callFunc:
-        callFunc(curPlayer, mapID, lineID, npcID)
+        return callFunc(curPlayer, mapID, lineID, npcID)
         
     return
 
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_CrossGrassland.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_CrossGrassland.py
index 481a950..c5c510a 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_CrossGrassland.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_CrossGrassland.py
@@ -167,6 +167,11 @@
             
     return
 
+## 自定义场景采集OK,需自带是否允许采集的判断
+def OnCustomSceneCollectOK(curPlayer, mapID, lineID, npcID):
+    curState = PlayerFairyDomain.GetFairyDomainFBEventState(curPlayer, mapID, lineID)
+    return curState == PlayerFairyDomain.FDEventState_Visiting
+
 def DecCustomSceneNPCCount(curPlayer, npcID):
     ## 减少草园自定义场景NPC,默认减少一个
     mapID = GetGrasslandMapID(curPlayer)[0]
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_FairyTreasure.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_FairyTreasure.py
index f055deb..c679175 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_FairyTreasure.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_FairyTreasure.py
@@ -37,7 +37,7 @@
         return
     return True
 
-## 自定义场景采集OK
+## 自定义场景采集OK,需自带是否允许采集的判断
 def OnCustomSceneCollectOK(curPlayer, mapID, lineID, npcID):
     
     curState = PlayerFairyDomain.GetFairyDomainFBEventState(curPlayer, mapID, lineID)
@@ -76,6 +76,6 @@
         
     overDict = {FBCommon.Over_itemInfo:FBCommon.GetJsonItemList(giveItemList)}
     FBCommon.NotifyFBOver(curPlayer, ChConfig.Def_FBMapID_FairyTreasure, lineID, 1, overDict)
-    return
+    return True
 
 
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
index 342bef8..2b9d7b3 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
@@ -5830,19 +5830,22 @@
 #};
 def OnGetCustomSceneCollectAward(index, clientData, tick):
     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
+    playerID = curPlayer.GetPlayerID()
     npcID = clientData.NPCID
     if not curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomScene):
-        GameWorld.DebugLog("非自定义场景中,无法获取定义采集奖励!")
+        GameWorld.ErrLog("非自定义场景中,无法获取定义采集奖励!", playerID)
         return
     mapID = PlayerControl.GetCustomMapID(curPlayer)
     lineID = PlayerControl.GetCustomLineID(curPlayer)
-    GameWorld.DebugLog("前端场景采集: mapID=%s,lineID=%s,npcID=%s" % (mapID, lineID, npcID))
+    GameWorld.Log("前端场景采集: mapID=%s,lineID=%s,npcID=%s" % (mapID, lineID, npcID), playerID)
+    if not mapID:
+        GameWorld.ErrLog("无自定义场景地图ID,不允许采集!", playerID)
+        return
     
-    if mapID:
-        #if FBCommon.GetCustomMapStep(curPlayer, mapID, lineID) != ChConfig.CustomMapStep_Fight:
-        #    return
-        FBLogic.OnCustomSceneCollectOK(curPlayer, mapID, lineID, npcID)
-                
+    if not FBLogic.OnCustomSceneCollectOK(curPlayer, mapID, lineID, npcID):
+        GameWorld.ErrLog("自定义场景地图不允许采集! mapID=%s,lineID=%s,npcID=%s" % (mapID, lineID, npcID), playerID)
+        return
+    
     collectNPCIpyData = IpyGameDataPY.GetIpyGameData("CollectNPC", npcID)
     if collectNPCIpyData:
         DoGiveCollectNPCAward(curPlayer, npcID, collectNPCIpyData)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFB.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFB.py
index 751177c..693d3c0 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFB.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFB.py
@@ -481,31 +481,48 @@
 
 def DoEnterCustomScene(curPlayer, mapID, lineID, tick):
     ## 进入自定义场景状态
-    
-    resultPack = ChPyNetSendPack.tagMCStartCustomSceneResult()
-    resultPack.MapID = mapID
-    resultPack.FuncLineID = lineID
+    playerID = curPlayer.GetPlayerID()
+    GameWorld.Log("玩家请求进入自定义场景!mapID=%s,lineID=%s" % (mapID, lineID), playerID)
+    if curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomScene):
+        curMapID = PlayerControl.GetCustomMapID(curPlayer)
+        curLineID = PlayerControl.GetCustomLineID(curPlayer)
+        if mapID == curMapID and lineID == curLineID:
+            GameWorld.Log("    玩家当前已经在自定义场景中!无需重新请求!", playerID)
+            result = 1
+        else:
+            GameWorld.Log("    玩家当前在不同的自定义场景中!不允许进入!curMapID=%s,curLineID=%s" 
+                          % (curMapID, curLineID), playerID)
+            result = 0
+        StartCustomSceneResult(curPlayer, mapID, lineID, result)
+        return
     
     #进入副本通用检查
     if mapID:
         fbIpyData = FBCommon.GetFBIpyData(mapID)
         fbLineIpyData = FBCommon.GetFBLineIpyData(mapID, lineID)
         if PlayerControl.CheckMoveToFB(curPlayer, mapID, lineID, fbIpyData, fbLineIpyData, tick) != ShareDefine.EntFBAskRet_OK:
-            resultPack.Result = 0
-            NetPackCommon.SendFakePack(curPlayer, resultPack)
-            PlayerControl.SetCustomMap(curPlayer, 0, 0)
+            StartCustomSceneResult(curPlayer, mapID, lineID, 0)
             return
     
     PlayerControl.SetPlayerSightLevel(curPlayer, curPlayer.GetID())
         
     curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomScene, 1) # 由于前端不一定有发mapID,所以这里额外记录这个状态,不能直接用mapID判断
     PlayerControl.SetCustomMap(curPlayer, mapID, lineID)
-    GameWorld.Log("玩家开始自定义场景!mapID=%s,lineID=%s" % (mapID, lineID), curPlayer.GetPlayerID())
+    GameWorld.Log("玩家开始自定义场景!mapID=%s,lineID=%s" % (mapID, lineID), playerID)
     if mapID:
         FBLogic.OnEnterCustomScene(curPlayer, mapID, lineID)
         
     #通知进入状态
-    resultPack.Result = 1
+    StartCustomSceneResult(curPlayer, mapID, lineID, 1)
+    return
+
+def StartCustomSceneResult(curPlayer, mapID, lineID, result):
+    if result != 1:
+        DoExitCustomScene(curPlayer)
+    resultPack = ChPyNetSendPack.tagMCStartCustomSceneResult()
+    resultPack.MapID = mapID
+    resultPack.FuncLineID = lineID
+    resultPack.Result = result
     NetPackCommon.SendFakePack(curPlayer, resultPack)
     return
 

--
Gitblit v1.8.0