From 57d60ef7648868c76189d3a127dc3e5f0800f6f3 Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期四, 27 六月 2019 14:27:31 +0800
Subject: [PATCH] 7589 【2.0.100】【后端】资源找回优化

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_FairyTreasure.py |  362 ++-------------------------------------------------
 1 files changed, 18 insertions(+), 344 deletions(-)

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 e5addb7..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
@@ -11,6 +11,7 @@
 # @date 2019-04-09
 # @version 1.0
 # 详细描述: 缥缈宝藏
+# 本副本做前端自定义场景处理,后端无实际地图
 #
 #---------------------------------------------------------------------
 #"""Version = 2019-04-09 11:00"""
@@ -18,56 +19,15 @@
 
 import FBCommon
 import GameWorld
-import IPY_GameWorld
-import NPCCustomRefresh
 import IpyGameDataPY
-import PlayerControl
 import PlayerFairyDomain
-import GameWorldProcess
-import ItemControler
+import PlayerControl
+import ItemCommon
 import NPCCommon
 import ChConfig
-import ChPlayer
-import EventReport
-import ChNPC
-import ItemCommon
 
-
-FBPlayerDict_CurStep = 'FBPlayerDict_CurStep'   # 当前阶段
-FBPlayerDict_StepState = 'FBPlayerDict_StepState'   # 阶段状态
-# 副本通用配置
-(
-Def_PrepareTime, # 准备时间,秒
-Def_FightTime, # 战斗时间,秒
-Def_LeaveTime, # 退出时间, 秒
-Def_CollectTime, # 采集时间, 秒
-Def_RefreshBossMark, # 刷怪标识点
-Def_RefreshBossMark1, # 刷怪标识点
-) = range(6)
-
-
-#当前副本地图的状态
-(
-FB_Step_Open,  # 副本开启
-FB_Step_Prepare,  # 副本等待
-FB_Step_Fighting,  # 副本进行中
-#FB_Step_Collect,  # 副本采集中
-#FB_Step_PickItem, # 拾取物品中
-FB_Step_Over,  # 副本结束
-FB_Step_Close,  # 副本关闭
-) = range(5)
-
-def __GetFBTimeCfg(lineID=0):
-    if not lineID:
-        lineID = FBCommon.GetFBPropertyMark()
-    return FBCommon.GetFBLineStepTime(ChConfig.Def_FBMapID_FairyTreasure, lineID)
 
 ## 是否可进入
-#  @param curPlayer
-#  @param mapID 地图ID
-#  @param lineId 分线ID
-#  @param tick
-#  @return 是否可进入
 def OnEnterFBEvent(curPlayer, mapID, lineId, tick):
     ipyData = IpyGameDataPY.GetIpyGameDataByCondition('FairyDomain', {'MapID':mapID, 'LineID':lineId})
     if not ipyData:
@@ -77,288 +37,23 @@
         return
     return True
 
-
-
-##副本玩家进入点
-# @param curPlayer 玩家实例
-# @param mapID 地图ID
-# @param lineId 分线ID
-# @param ipyEnterPosInfo 功能线路IPY配置坐标信息
-# @param tick 时间戳
-# @return posX, posY, 随机半径(可选)
-def OnGetFBEnterPos(curPlayer, mapID, lineId, ipyEnterPosInfo, tick):
-    return ipyEnterPosInfo
-
-
-## 是否可以进入
-#  @param ask 请求信息
-#  @param tick
-#  @return 回复是否通过请求
-def OnChangeMapAsk(ask, tick):
-    return IPY_GameWorld.cmeAccept
-
-## 进副本
-#  @param curPlayer
-#  @param tick
-#  @return None
-def DoEnterFB(curPlayer, tick):
-    PlayerControl.SetSight(curPlayer, ChConfig.Def_PlayerSight_Default * 3)
-    mapID = GameWorld.GetMap().GetMapID()
-    mapID = FBCommon.GetRecordMapID(mapID)
-    gameFB = GameWorld.GetGameFB()
-    lineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ReqFBFuncLine)
-    playerID = curPlayer.GetID()
-    hadDelTicket = FBCommon.GetHadDelTicket(curPlayer)
-    if not hadDelTicket:
-        FBCommon.SetHadDelTicket(curPlayer)
-        FBCommon.SetFBPropertyMark(lineID)
-        boxIDList = FBCommon.GetFBLineRefreshNPC(mapID, lineID)[1:]
-        npcCnt = len(boxIDList)
-        NPCCustomRefresh.SetNPCRefresh(__GetFBTimeCfg()[Def_RefreshBossMark1], [[npcID,1] for npcID in boxIDList], npcCnt, npcCnt)
-    if gameFB.GetGameFBDictByKey(FBPlayerDict_CurStep) == 0:
-        FBCommon.SyncDynamicBarrierState(IpyGameDataPY.GetFuncEvalCfg('HazyTreasure'), 1, curPlayer) # 准备期间有动态障碍点
-    if not hadDelTicket \
-        and IpyGameDataPY.GetIpyGameDataByCondition("NPCShow", {"MapID":mapID, "LineID":lineID}, isLogNone=False):
-        GameWorld.DebugLog("刚进入时不直接开始,需等前端通知开始才开始!", playerID)  # 掉线重上强制开始
+## 自定义场景采集OK,需自带是否允许采集的判断
+def OnCustomSceneCollectOK(curPlayer, mapID, lineID, npcID):
+    
+    curState = PlayerFairyDomain.GetFairyDomainFBEventState(curPlayer, mapID, lineID)
+    if curState != PlayerFairyDomain.FDEventState_Visiting:
+        GameWorld.DebugLog("非寻访中,不能结算缥缈宝藏采集!", curPlayer.GetPlayerID())
         return
-    
-    fbStep = gameFB.GetFBStep()
-
-    if fbStep < FB_Step_Prepare:
-        FBCommon.SetFBStep(FB_Step_Prepare, tick)
-    
-    if fbStep <= FB_Step_Prepare:
-        notify_tick = __GetFBTimeCfg(lineID)[Def_PrepareTime] * 1000 - (tick - GameWorld.GetGameFB().GetFBStepTick())
-        curPlayer.Sync_TimeTick(IPY_GameWorld.tttWaitStart, 0, max(notify_tick, 0), True)
-        
-    elif fbStep == FB_Step_Fighting:
-        notify_tick = __GetFBTimeCfg(lineID)[Def_FightTime] * 1000 - (tick - GameWorld.GetGameFB().GetFBStepTick())
-        curPlayer.Sync_TimeTick(IPY_GameWorld.tttTowerTake, 0, max(notify_tick, 0), True)
-    else:
-        PlayerControl.PlayerLeaveFB(curPlayer)
-        return
-    DoFBHelp(curPlayer, tick)
-    return
-
-
-
-## 客户端发送开始副本
-def OnClientStartFB(curPlayer, tick):
-    gameFB = GameWorld.GetGameFB()
-    fbStep = gameFB.GetFBStep()
-    if fbStep >= FB_Step_Prepare:
-        GameWorld.ErrLog("前端请求正式开始副本, 但副本已经开始了,不可重复开始!", curPlayer.GetPlayerID())
-        return
-    
-    lineID = FBCommon.GetFBPropertyMark()
-    GameWorld.DebugLog("前端场景秀已播放完毕,请求正式开始副本!lineID=%s" % lineID, curPlayer.GetPlayerID())
-    FBCommon.SetFBStep(FB_Step_Prepare, tick)
-    notify_tick = __GetFBTimeCfg(lineID)[Def_PrepareTime] * 1000 - (tick - GameWorld.GetGameFB().GetFBStepTick())
-    curPlayer.Sync_TimeTick(IPY_GameWorld.tttWaitStart, 0, max(notify_tick, 0), True)
-    DoFBHelp(curPlayer, tick)
-    return
-
-
-## 副本时间到关闭
-#  @param tick 当前时间
-#  @return None
-#  @remarks 函数详细说明.
-def OnCloseFB(tick):
-    return
-
-
-## 获得副本帮助信息
-#  @param curPlayer 当前玩家(被通知对象)
-#  @param tick 当前时间
-#  @return None
-def DoFBHelp(curPlayer, tick):
-    gameFB = GameWorld.GetGameFB()
-    
-    curStep = gameFB.GetGameFBDictByKey(FBPlayerDict_CurStep) + 1
-    helpDict = {FBCommon.Help_step:curStep, FBCommon.Help_npcTotal:gameFB.GetGameFBDictByKey(FBPlayerDict_StepState)}
-    GameWorld.DebugLog("DoFBHelp %s" % str(helpDict))
-    FBCommon.Notify_FBHelp(curPlayer, helpDict)
-    return
-
-##玩家退出副本.
-# @param curPlayer 玩家实例
-# @param tick 时间戳
-# @return 返回值无意义
-# @remarks 玩家主动离开副本.
-def DoExitFB(curPlayer, tick):
-    PlayerControl.SetSight(curPlayer, ChConfig.Def_PlayerSight_Default)
-    # 玩家退出默认关闭副本
-    #GameWorldProcess.CloseFB(tick)
-    return
-
-
-##副本总逻辑计时器
-# @param tick 时间戳
-# @return 无意义
-# @remarks 副本总逻辑计时器
-def OnProcess(tick):
-    gameFB = GameWorld.GetGameFB()
-    fbStep = gameFB.GetFBStep()
-    # 副本准备
-    if fbStep == FB_Step_Prepare:
-        __DoLogic_FB_Prepare(tick)    
-    # 副本进行中
-    elif fbStep == FB_Step_Fighting:
-        __DoLogic_FB_Fighting(tick)
-#    # 副本拾取中
-#    elif fbStep == FB_Step_PickItem:
-#        __DoLogic_FB_PickItem(tick)
-    # 副本结束
-    elif fbStep == FB_Step_Over:
-        __DoLogic_FB_Over(tick)
-    
-    return
-
-
-##战斗准备时间
-# @param tick  时钟
-# @return 无意义
-def __DoLogic_FB_Prepare(tick):
-    gameFB = GameWorld.GetGameFB()
-    mapID = GameWorld.GetMap().GetMapID()
-    lineID = FBCommon.GetFBPropertyMark()
-    trialCfg = __GetFBTimeCfg(lineID)
-    if tick - gameFB.GetFBStepTick() < trialCfg[Def_PrepareTime] * 1000:
-        return
-    FBCommon.Sync_Player_TimeTick(IPY_GameWorld.tttTowerTake, trialCfg[Def_FightTime] * 1000)
-    bossID = FBCommon.GetFBLineRefreshNPC(mapID, lineID)[0]
-    NPCCustomRefresh.SetNPCRefresh(trialCfg[Def_RefreshBossMark], [bossID])
-    #转入战斗
-    FBCommon.SetFBStep(FB_Step_Fighting, tick)
-    return
-
-
-##战斗时间
-# @param tick  时钟
-# @return 无意义
-def __DoLogic_FB_Fighting(tick):
-    gameFB = GameWorld.GetGameFB()
-    #判断时间结束
-    if tick - gameFB.GetFBStepTick() < __GetFBTimeCfg()[Def_FightTime] * 1000:
-        return
-    
-    #游戏结束
-    FBCommon.SetFBStep(FB_Step_Over, tick)
-    return
-
-
-        
-##副本关闭中
-# @param tick:时间戳
-# @return 无意义
-# @remarks 副本关闭中
-def __DoLogic_FB_Over(tick):
-    # 间隔未到
-    if tick - GameWorld.GetGameFB().GetFBStepTick() < __GetFBTimeCfg()[Def_LeaveTime] * 1000:
-        return
-    
-    #副本关闭
-    GameWorldProcess.CloseFB(tick)
-    FBCommon.SetFBStep(FB_Step_Close, tick)
-    return
-
-
-## 杀怪
-#  @param curPlayer
-#  @param curNPC 被杀的怪
-#  @param tick
-#  @return None
-def DoFB_Player_KillNPC(curPlayer, curNPC, tick):
-    mapID = GameWorld.GetMap().GetMapID()
-    lineID = FBCommon.GetFBPropertyMark()
-    bossID = FBCommon.GetFBLineRefreshNPC(mapID, lineID)[0]
-    if bossID != curNPC.GetNPCID():
-        return
-    #刷宝箱进入采集阶段
-    GameWorld.GetGameFB().SetGameFBDict(FBPlayerDict_CurStep, 1)
-    
-    DoFBHelp(curPlayer, tick)
-    FBCommon.SyncDynamicBarrierState(IpyGameDataPY.GetFuncEvalCfg('HazyTreasure'), 0, curPlayer)
-    #特效NPC消失
-    FBCommon.ClearFBNPCEx(FBCommon.GetFBLineRefreshNPC(mapID, lineID)[2:])
-    
-    #FBCommon.SetFBStep(FB_Step_Collect, tick)
-    #NPCCustomRefresh.SetNPCRefresh(__GetFBTimeCfg()[Def_RefreshBossMark], [boxID])
-    return
-
-## 检查是否可攻击, 主判定不可攻击的情况,其他逻辑由外层决定
-#  @param attacker 攻击方
-#  @param defender 防守方
-#  @return bool
-def CheckCanAttackTagObjInFB(attacker, defender):
-    gameFB = GameWorld.GetGameFB()
-    if gameFB.GetFBStep() != FB_Step_Fighting:
-        return False
-    return True
-
-
-##是否可以采集
-# @param curPlayer 玩家实例
-# @param curNPC NPC实例
-# @param tick 时间戳
-# @return 无意义
-# @remarks
-def OnCanCollect(curPlayer, curNPC, tick):
-    gameFB = GameWorld.GetGameFB()
-    curStep = gameFB.GetGameFBDictByKey(FBPlayerDict_CurStep)
-    return curStep == 1
-
-
-##副本中,采集物需要Loading时间.
-# @param curPlayer 玩家实例
-# @param curNPC NPC实例
-# @return 返回值, Loading时间
-# @remarks 副本中,采集物需要Loading时间
-def GetFBPrepareTime(curPlayer, curNPC):
-    return __GetFBTimeCfg()[Def_CollectTime] * 1000
-
-
-##玩家收集成功(塔, 旗)
-# @param curPlayer 玩家实例
-# @param tick 时间戳
-# @return 无意义
-# @remarks
-def OnCollectOK(curPlayer, npcID, tick):
-    playerID = curPlayer.GetID()
-    tagObj = curPlayer.GetActionObj()
-    if not tagObj:
-        return
-    if tagObj.GetGameObjType() != IPY_GameWorld.gotNPC:
-        return
-    
-    curNPC = GameWorld.GetNPCManager().GetNPCByIndex(tagObj.GetIndex())
-    if not curNPC:
-        return
-    dropPosX, dropPosY = curNPC.GetPosX(), curNPC.GetPosY()
-    
-    ChNPC.OnCollectEnd(curPlayer, curNPC)
-    GameWorld.DebugLog('    采集成功!', playerID)
-    GameWorld.GetGameFB().SetGameFBDict(FBPlayerDict_StepState, 1)
-    DoFBHelp(curPlayer, 0)
-    #掉落给奖励
-    DoFairyTreasureOver(curPlayer, tick, dropPosX, dropPosY)
-    
-    
-    return
-
-def DoFairyTreasureOver(curPlayer, tick, dropPosX, dropPosY):
-    #[[(4000,[141,1,1])],[(4000,[141,1,1])]]
-    FBCommon.SetFBStep(FB_Step_Over, tick)
-    
-    lineID = FBCommon.GetFBPropertyMark()
     ipyData = IpyGameDataPY.GetIpyGameDataByCondition('FairyDomain', {'MapID':ChConfig.Def_FBMapID_FairyTreasure, 'LineID':lineID})
     fdeventID = ipyData.GetID()
+    PlayerFairyDomain.SetFairyDomainEventState(curPlayer, fdeventID, PlayerFairyDomain.FDEventState_Visited)
+    PlayerControl.SetCustomMap(curPlayer, 0, 0)
+    
     giveItemList = PlayerFairyDomain.GetFairyAppointAward(curPlayer, fdeventID)
     if not giveItemList:
         awardCfg = FBCommon.GetFBLineReward(ChConfig.Def_FBMapID_FairyTreasure, lineID)
         curAlchemyLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyLV)
         giveItemList = []
-        dropItemList = []
         for awardRateList in awardCfg:
             newItemInfoList = []
             for itemInfo in awardRateList:
@@ -375,33 +70,12 @@
                 continue
             randomitem = GameWorld.GetResultByWeightList(newItemInfoList)
             giveItemList.append(randomitem)
-            for _ in xrange(randomitem[1]):
-                dropItemList.append([randomitem[0],1,randomitem[2]])
-        
+            
     if giveItemList:
-        NPCCommon.DoVirtualItemDrop(curPlayer, dropItemList, dropPosX, dropPosY)
-        ItemControler.GivePlayerItemOrMail(curPlayer, giveItemList)
-        leaveTick = __GetFBTimeCfg(lineID)[Def_LeaveTime] * 1000
-        curPlayer.Sync_TimeTick(IPY_GameWorld.tttLeaveMap, 0, leaveTick, True)
-        overDict = {FBCommon.Over_itemInfo:FBCommon.GetJsonItemList(giveItemList)}
-        FBCommon.NotifyFBOver(curPlayer, ChConfig.Def_FBMapID_FairyTreasure, lineID, 1, overDict)
-    
-    PlayerFairyDomain.SetFairyDomainEventState(curPlayer, fdeventID, PlayerFairyDomain.FDEventState_Visited)
-    return
-
-
-## 是否副本复活
-#  @param None
-#  @return 是否副本复活
-def OnPlayerReborn():
+        NPCCommon.DoGiveItemByVirtualDrop(curPlayer, giveItemList, npcID)
+        
+    overDict = {FBCommon.Over_itemInfo:FBCommon.GetJsonItemList(giveItemList)}
+    FBCommon.NotifyFBOver(curPlayer, ChConfig.Def_FBMapID_FairyTreasure, lineID, 1, overDict)
     return True
 
-## 副本行为
-#  @param curPlayer 玩家
-#  @param actionType 行为类型
-#  @param actionInfo 行为信息
-#  @param tick 当前时间
-#  @return None
-def DoFBAction(curPlayer, actionType, actionInfo, tick):
-    
-    return
+

--
Gitblit v1.8.0