From 7cf1869b1e6ee737eebb37c6e6d8721100229daf Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期二, 13 十一月 2018 17:16:15 +0800
Subject: [PATCH] 4710 【1.3】【后端】魔族法宝副本修改(新增多个小关卡)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_MagicWeapon.py |  154 ++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 115 insertions(+), 39 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_MagicWeapon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_MagicWeapon.py
index 59657d2..50416c8 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_MagicWeapon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_MagicWeapon.py
@@ -28,42 +28,43 @@
 import PlayerControl
 import EventReport
 import PlayerGoldGift
-
+import PlayerMagicWeapon
 
 #---副本配置对应key值---
 (
-Def_IsPointType, #是否积分类副本
-Def_PrepareTime, # 副本准备时间(秒)
-Def_FightTime, # 进行时间(秒)
-Def_LeaveTime, # 退出时间(秒)
+Def_IsPointType,  #是否积分类副本
+Def_PrepareTime,  # 副本准备时间(秒)
+Def_FightTime,  # 进行时间(秒)
+Def_LeaveTime,  # 退出时间(秒)
 ) = range(4)
 
 (
-DL_RefreshMark, # 刷怪标识点
-DL_NPCID, # NPCID
-DL_SingleNPCCnt, # 单次刷NPC个数
-DL_maxCnt, #当前点最大怪物数
-DL_TotalNPCCnt, # 累计刷NPC总个数
-DL_NeedKillCnt, # 需要击杀数量
-DL_RefreshCD, # 刷新间隔
+DL_RefreshMark,  # 刷怪标识点
+DL_NPCID,  # NPCID
+DL_SingleNPCCnt,  # 单次刷NPC个数
+DL_maxCnt,  #当前点最大怪物数
+DL_TotalNPCCnt,  # 累计刷NPC总个数
+DL_NeedKillCnt,  # 需要击杀数量
+DL_RefreshCD,  # 刷新间隔
 ) = range(7)
-
 
 #当前副本地图的状态
 (
-FB_Step_Open, # 副本开启
-FB_Step_Prepare, # 副本等待
-FB_Step_Fighting, # 副本进行中
-FB_Step_Over, # 副本结束
-FB_Step_Close, # 副本关闭
+FB_Step_Open,  # 副本开启
+FB_Step_Prepare,  # 副本等待
+FB_Step_Fighting,  # 副本进行中
+FB_Step_Over,  # 副本结束
+FB_Step_Close,  # 副本关闭
 ) = range(5)
 
-FBPlayerDict_MissionID = 'FBPlayerDict_MissionID'   #副本任务ID
-FBPlayerDict_CostTime = 'FBPlayerDict_CostTime'   #副本耗时
-FBPlayerDict_TotalPoint = 'FBPlayerDict_TotalPoint'   # 获得的总积分
-FBPlayerDict_NPCRemainCnt = 'FBPlayerDict_NPCRemainCnt_%s'   # NPC剩余数量
-FBPlayerDict_TotalExp = 'FBPlayerDict_TotalExp'   # 获得的总经验
-FBPlayerDict_TotalExpPoint = 'FBPlayerDict_TotalExpPoint'   # 获得的总经验点
+FBPlayerDict_MissionID = 'FBPlayerDict_MissionID'  #副本任务ID
+FBPlayerDict_CostTime = 'FBPlayerDict_CostTime'  #副本耗时
+FBPlayerDict_TotalPoint = 'FBPlayerDict_TotalPoint'  # 获得的总积分
+FBPlayerDict_NPCRemainCnt = 'FBPlayerDict_NPCRemainCnt_%s'  # NPC剩余数量
+FBPlayerDict_TotalExp = 'FBPlayerDict_TotalExp'  # 获得的总经验
+FBPlayerDict_TotalExpPoint = 'FBPlayerDict_TotalExpPoint'  # 获得的总经验点
+FBPlayerDict_Level = 'FBPlayerDict_Level'  #关卡
+FBPlayerDict_MaxLevel = 'FBPlayerDict_MaxLevel'  #最大关卡
 
 
 ##---获得副本配置---
@@ -77,13 +78,22 @@
 
 
 def GetClearDevilNPCCfg(lineID):
+    level = GameWorld.GetGameFB().GetGameFBDictByKey(FBPlayerDict_Level)
+    if level:
+        ipyData = IpyGameDataPY.GetIpyGameDataByCondition('MagicWeaponFB', {'LineID':lineID, 'Level':level})
+        if not ipyData:
+            return []
+        return ipyData.GetRefreshNPC()
+    
     mapID = GameWorld.GetMap().GetMapID()
     return FBCommon.GetFBLineRefreshNPC(mapID, lineID)
+
 
 def GetPointByNPCID(npcid):
     '''通过NPCID获取对应的积分'''
     npcPointDict = IpyGameDataPY.GetFuncEvalCfg('ClearDevilPoint', 2)
     return npcPointDict.get(npcid, 0)
+
 
 def GetIsPointFBType(lineID):
     #是否积分类副本
@@ -91,6 +101,7 @@
     if not FBLineStepTimeCfg:
         return
     return FBLineStepTimeCfg[Def_IsPointType]
+
 
 ## 是否能够通过活动查询进入
 #  @param curPlayer 玩家实例
@@ -132,11 +143,27 @@
     mapID = FBCommon.GetRecordMapID(mapID)
     gameFB = GameWorld.GetGameFB()
     lineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ReqFBFuncLine)
-    GameWorld.DebugLog("DoEnterFB...lineID=%s,playerLV=%s" % (lineID, playerLV), playerID)
+    level, maxLevel = 0, 0
+    ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition('MagicWeaponFB', {'LineID':lineID}, True)
+    if ipyDataList:
+        mwID = ipyDataList[0].GetMWID()
+        level = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MWFBPassLevel % mwID)
+        maxLevel = ipyDataList[-1].GetLevel()
+        if level >= maxLevel:
+            GameWorld.Log('DoEnterFB 已通关该线路最大关卡!! lineID=%s, maxLevel=%s' % (lineID, maxLevel))
+            PlayerControl.PlayerLeaveFB(curPlayer)
+            return
+        level +=1
+    GameWorld.DebugLog("DoEnterFB...lineID=%s,playerLV=%s, level=%s" % (lineID, playerLV, level), playerID)
     hadDelTicket = FBCommon.GetHadDelTicket(curPlayer)
     if not hadDelTicket:
+        
+        gameFB.SetGameFBDict(FBPlayerDict_Level, level)
+        gameFB.SetGameFBDict(FBPlayerDict_MaxLevel, maxLevel)
+        
         FBCommon.SetHadDelTicket(curPlayer)
         FBCommon.SetFBPropertyMark(lineID)
+        
         EventReport.WriteEvent_FB(curPlayer, mapID, 0, ChConfig.CME_Log_Start)
 #        if mapID == ChConfig.Def_FBMapID_ClearDevil2:
 #            # 新手剧情副本重置所有技能CD
@@ -153,8 +180,8 @@
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_ReqFBMissionID, 0)
 
     if not hadDelTicket \
-        and IpyGameDataPY.GetIpyGameDataByCondition("NPCShow", {"MapID":mapID, "LineID":lineID}, isLogNone=False):
-        GameWorld.DebugLog("法宝挑战刚进入时不直接开始,需等前端通知开始才开始!", playerID) # 掉线重上强制开始
+        and IpyGameDataPY.GetIpyGameDataByCondition("NPCShow", {"MapID":mapID, "LineID":lineID}, isLogNone=False) and level == maxLevel:
+        GameWorld.DebugLog("法宝挑战刚进入时不直接开始,需等前端通知开始才开始!", playerID)  # 掉线重上强制开始
         return
     
     fbStep = gameFB.GetFBStep()
@@ -173,6 +200,7 @@
     DoFBHelp(curPlayer, tick, not hadDelTicket)
     return
 
+
 ## 客户端发送开始副本
 def OnClientStartFB(curPlayer, tick):
     gameFB = GameWorld.GetGameFB()
@@ -190,6 +218,7 @@
     DoFBHelp(curPlayer, tick, True)
     return
 
+
 ##玩家退出副本
 # @param curPlayer 玩家实例
 # @param tick 时间戳
@@ -201,12 +230,14 @@
 #        GameWorldProcess.CloseFB(tick)
     return
 
+
 ##玩家主动离开副本.
 # @param curPlayer 玩家实例
 # @param tick 时间戳
 # @return 返回值无意义
 def DoPlayerLeaveFB(curPlayer, tick):
     return
+
 
 ## 获得副本帮助信息
 #  @param curPlayer 当前玩家(被通知对象)
@@ -232,7 +263,7 @@
             if isEnter:
                 killCnt = 0
             else:
-                killCnt= info[DL_NeedKillCnt] - remainCnt
+                killCnt = info[DL_NeedKillCnt] - remainCnt
             npcDict[npcID] = killCnt
         helpDict = {FBCommon.Help_npc:FBCommon.GetJsonNPCKillList(npcDict)}
             
@@ -260,9 +291,11 @@
         __DoLogic_FB_Fighting(tick)
     # 副本结束
     elif fbStep == FB_Step_Over:
+        pass
         __DoLogic_FB_Over(tick)
     
     return
+
 
 ## 副本准备逻辑
 #  @param tick:时间戳
@@ -288,7 +321,7 @@
         gameFB.SetGameFBDict(FBPlayerDict_NPCRemainCnt % npcID, npcInfo[DL_NeedKillCnt])
         refreshCD = npcInfo[DL_RefreshCD]
         NPCCustomRefresh.SetNPCRefresh(npcInfo[DL_RefreshMark], [(npcID, npcInfo[DL_SingleNPCCnt])], npcInfo[DL_maxCnt], npcInfo[DL_TotalNPCCnt], refreshTick=refreshCD)
-    NPCCustomRefresh.ProcessAllNPCRefresh(tick) # 立即出发一次标识点刷新
+    NPCCustomRefresh.ProcessAllNPCRefresh(tick)  # 立即出发一次标识点刷新
     
     playerManager = GameWorld.GetMapCopyPlayerManager()
     if playerManager.GetPlayerCount() > 0:
@@ -326,9 +359,10 @@
         return
     
     #副本关闭
-    GameWorldProcess.CloseFB(tick)
-    FBCommon.SetFBStep(FB_Step_Close, tick)
+    #GameWorldProcess.CloseFB(tick)
+    #FBCommon.SetFBStep(FB_Step_Close, tick)
     return
+
 
 ## 获得经验
 #  @param curPlayer 当前玩家
@@ -351,11 +385,11 @@
     gameFB.SetPlayerGameFBDict(playerID, FBPlayerDict_TotalExp, updExp)
     gameFB.SetPlayerGameFBDict(playerID, FBPlayerDict_TotalExpPoint, updExpPoint)
     
-    
     GameWorld.DebugLog("OnGetExp() totalExp=%s,addExp=%s,updTotalExp=%s" 
                        % (totalExp, addExp, updTotalExp), playerID)
     
     return
+
 
 ## 执行副本杀怪逻辑
 #  @param curPlayer 杀怪的人
@@ -370,9 +404,9 @@
     
     npcid = curNPC.GetNPCID()
     lineID = FBCommon.GetFBPropertyMark()
-    isFinish = False #是否完成
+    isFinish = False  #是否完成
     
-    if GetIsPointFBType(lineID):#积分类
+    if GetIsPointFBType(lineID):  #积分类
         addPoint = GetPointByNPCID(npcid)
         if not addPoint:
             return
@@ -406,8 +440,15 @@
         if fbMissionID:
             EventShell.EventRespons_FBEvent(curPlayer, "cleardevil_pass_%s" % fbMissionID)
         # 成就
-        PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_PassWagicWeapon, 1, [lineID+1])
-        
+        level = gameFB.GetGameFBDictByKey(FBPlayerDict_Level)
+        PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_PassWagicWeapon, 1, [lineID + 1, level])
+        # 更新关卡
+        if level:
+            ipyData = IpyGameDataPY.GetIpyGameDataByCondition('MagicWeaponFB', {'LineID':lineID, 'Level':level})
+            if ipyData:
+                mwID = ipyData.GetMWID()
+                PlayerMagicWeapon.UptateMWFBPasslv(curPlayer, mwID, level)
+                
     
     DoFBHelp(curPlayer, tick)
     return
@@ -426,7 +467,7 @@
     exp = addExp % ChConfig.Def_PerPointValue
     expPoint = addExp / ChConfig.Def_PerPointValue
     fbMissionID = gameFB.GetGameFBDictByKey(FBPlayerDict_MissionID)
-    GameWorld.DebugLog("任务专用,触发事件(副本内完成某任务) curMissionID=%s, fbMissionID=%s, exp=%s,moneyDict=%s,itemList=%s" % (curMissionID, fbMissionID, exp, moneyDict,itemList))
+    GameWorld.DebugLog("任务专用,触发事件(副本内完成某任务) curMissionID=%s, fbMissionID=%s, exp=%s,moneyDict=%s,itemList=%s" % (curMissionID, fbMissionID, exp, moneyDict, itemList))
     if fbMissionID != curMissionID:
         return
     costTime = gameFB.GetGameFBDictByKey(FBPlayerDict_CostTime)
@@ -440,11 +481,13 @@
     __SendOverInfo(curPlayer, awardDict)
     return
 
+
 ## 是否副本复活
 #  @param None
 #  @return 是否副本复活
 def OnPlayerReborn():
     return True
+
 
 ##玩家死亡.
 # @param curPlayer:死亡的玩家 
@@ -455,6 +498,7 @@
     __DoClearDevilOver(False)
     return
 
+
 ## 检查是否可攻击, 主判定不可攻击的情况,其他逻辑由外层决定
 #  @param attacker 攻击方
 #  @param defender 防守方
@@ -464,6 +508,36 @@
     if gameFB.GetFBStep() != Def_FightTime:
         return False
     return True
+
+
+## 副本行为
+#  @param curPlayer 玩家
+#  @param actionType 行为类型
+#  @param actionInfo 行为信息
+#  @param tick 当前时间
+#  @return None
+def DoFBAction(curPlayer, actionType, actionInfo, tick):
+    gameFB = GameWorld.GetGameFB()
+    fbStep = gameFB.GetFBStep()
+    if fbStep != FB_Step_Over:
+        return
+    
+    level = gameFB.GetGameFBDictByKey(FBPlayerDict_Level)
+    maxLevel = gameFB.GetGameFBDictByKey(FBPlayerDict_MaxLevel)
+    if level <= 0 or maxLevel <= 0:
+        return
+    if level >= maxLevel:
+        return
+    gameFB.SetGameFBDict(FBPlayerDict_Level, level+1)
+    playerID = curPlayer.GetID()
+    FBCommon.SetFBStep(FB_Step_Open, tick)
+    lineID = FBCommon.GetFBPropertyMark()
+    if level+1 == maxLevel and IpyGameDataPY.GetIpyGameDataByCondition("NPCShow", {"MapID":ChConfig.Def_FBMapID_MagicWeapon, "LineID":lineID}, isLogNone=False):
+        GameWorld.DebugLog(" 副本行为 法宝挑战刚进入时不直接开始,需等前端通知开始才开始!", playerID)  # 掉线重上强制开始
+        return
+    OnClientStartFB(curPlayer, tick)
+    return
+
 
 ## 副本结束处理
 def __DoClearDevilOver(isPass):
@@ -490,8 +564,8 @@
     gameFB.SetGameFBDict(FBPlayerDict_CostTime, costTime)
     fbMissionID = gameFB.GetGameFBDictByKey(FBPlayerDict_MissionID)
     # 通知结果 此处只通知失败,成功在完成任务时通知, 不是通过任务进的副本也通知
-    if not isPass or not fbMissionID:# or mapID == ChConfig.Def_FBMapID_ClearDevil2:
-        __SendOverInfo(curPlayer, {FBCommon.Over_isPass:int(isPass), FBCommon.Over_exp:exp,FBCommon.Over_expPoint:expPoint, FBCommon.Over_costTime:costTime})
+    if not isPass or not fbMissionID:  # or mapID == ChConfig.Def_FBMapID_ClearDevil2:
+        __SendOverInfo(curPlayer, {FBCommon.Over_isPass:int(isPass), FBCommon.Over_exp:exp, FBCommon.Over_expPoint:expPoint, FBCommon.Over_costTime:costTime})
     
     # 进入离开阶段
     FBCommon.SetFBStep(FB_Step_Over, tick)
@@ -515,10 +589,12 @@
             PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FirstGoldTry, 0)
     return
 
+
 ## 发送挑战结果信息
 def __SendOverInfo(curPlayer, overDict):
     overDict[FBCommon.Over_dataMapID] = FBCommon.GetRecordMapID(GameWorld.GetMap().GetMapID())
     overDict[FBCommon.Over_lineID] = FBCommon.GetFBPropertyMark()
+    overDict[FBCommon.Over_wheel] = GameWorld.GetGameFB().GetGameFBDictByKey(FBPlayerDict_Level)
     GameWorld.DebugLog("__SendOverInfo overDict=%s" % (str(overDict)), curPlayer.GetPlayerID())
     FBCommon.Notify_FB_Over(curPlayer, overDict)
     return

--
Gitblit v1.8.0