| | |
| | | import ChPlayer
|
| | | import EventReport
|
| | | import ChNPC
|
| | | import ItemCommon
|
| | |
|
| | |
|
| | | FBPlayerDict_CurStep = 'FBPlayerDict_CurStep' # 当前阶段
|
| | | FBPlayerDict_StepState = 'FBPlayerDict_StepState' # 阶段状态
|
| | | # 副本通用配置
|
| | | (
|
| | | Def_PrepareTime, # 准备时间,秒
|
| | |
| | | Def_LeaveTime, # 退出时间, 秒
|
| | | Def_CollectTime, # 采集时间, 秒
|
| | | Def_RefreshBossMark, # 刷怪标识点
|
| | | ) = range(5)
|
| | | Def_RefreshBossMark1, # 刷怪标识点
|
| | | ) = range(6)
|
| | |
|
| | |
|
| | | #当前副本地图的状态
|
| | |
| | | # @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()
|
| | |
| | | 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) # 掉线重上强制开始
|
| | |
| | |
|
| | | 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)
|
| | |
| | | gameFB = GameWorld.GetGameFB()
|
| | |
|
| | | curStep = gameFB.GetGameFBDictByKey(FBPlayerDict_CurStep) + 1
|
| | | helpDict = {FBCommon.Help_step:curStep}
|
| | | helpDict = {FBCommon.Help_step:curStep, FBCommon.Help_npcTotal:gameFB.GetGameFBDictByKey(FBPlayerDict_StepState)}
|
| | | GameWorld.DebugLog("DoFBHelp %s" % str(helpDict))
|
| | | FBCommon.Notify_FBHelp(curPlayer, helpDict)
|
| | | return
|
| | |
| | | # @return 返回值无意义
|
| | | # @remarks 玩家主动离开副本.
|
| | | def DoExitFB(curPlayer, tick):
|
| | | PlayerControl.SetSight(curPlayer, ChConfig.Def_PlayerSight_Default)
|
| | | # 玩家退出默认关闭副本
|
| | | #GameWorldProcess.CloseFB(tick)
|
| | | return
|
| | |
| | | def DoFB_Player_KillNPC(curPlayer, curNPC, tick):
|
| | | mapID = GameWorld.GetMap().GetMapID()
|
| | | lineID = FBCommon.GetFBPropertyMark()
|
| | | bossID, boxID = FBCommon.GetFBLineRefreshNPC(mapID, lineID)
|
| | | 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])
|
| | | #NPCCustomRefresh.SetNPCRefresh(__GetFBTimeCfg()[Def_RefreshBossMark], [boxID])
|
| | | return
|
| | |
|
| | | ## 检查是否可攻击, 主判定不可攻击的情况,其他逻辑由外层决定
|
| | |
| | | # @return 无意义
|
| | | # @remarks
|
| | | def OnCanCollect(curPlayer, curNPC, tick):
|
| | | return True
|
| | | gameFB = GameWorld.GetGameFB()
|
| | | curStep = gameFB.GetGameFBDictByKey(FBPlayerDict_CurStep)
|
| | | return curStep == 1
|
| | |
|
| | |
|
| | | ##副本中,采集物需要Loading时间.
|
| | |
| | |
|
| | | ChNPC.OnCollectEnd(curPlayer, curNPC)
|
| | | GameWorld.DebugLog(' 采集成功!', playerID)
|
| | | |
| | | #DoFBHelp(curPlayer, 0)
|
| | | GameWorld.GetGameFB().SetGameFBDict(FBPlayerDict_StepState, 1)
|
| | | DoFBHelp(curPlayer, 0)
|
| | | #掉落给奖励
|
| | | DoFairyTreasureOver(curPlayer, tick, dropPosX, dropPosY)
|
| | |
|
| | |
| | | FBCommon.SetFBStep(FB_Step_Over, tick)
|
| | |
|
| | | lineID = FBCommon.GetFBPropertyMark()
|
| | | awardCfg = FBCommon.GetFBLineReward(ChConfig.Def_FBMapID_FairyTreasure, lineID)
|
| | | curAlchemyLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyLV)
|
| | | giveItemList = []
|
| | | for awardRateList in awardCfg:
|
| | | newItemInfoList = []
|
| | | for itemInfo in awardRateList:
|
| | | itemID = itemInfo[1][0]
|
| | | itemData = GameWorld.GetGameData().GetItemByTypeID(itemID)
|
| | | if not itemData:
|
| | | return
|
| | | if curAlchemyLV < itemData.GetLV() - 1:
|
| | | #丹炉等级不足
|
| | | ipyData = IpyGameDataPY.GetIpyGameDataByCondition('FairyDomain', {'MapID':ChConfig.Def_FBMapID_FairyTreasure, 'LineID':lineID})
|
| | | fdeventID = ipyData.GetID()
|
| | | 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:
|
| | | itemID = itemInfo[1][0]
|
| | | itemData = GameWorld.GetGameData().GetItemByTypeID(itemID)
|
| | | if not itemData:
|
| | | return
|
| | | if curAlchemyLV < ItemCommon.GetItemClassLV(itemData) - 1:
|
| | | #丹炉等级不足
|
| | | continue
|
| | | |
| | | newItemInfoList.append(itemInfo)
|
| | | if not newItemInfoList:
|
| | | continue
|
| | |
|
| | | newItemInfoList.append(itemInfo)
|
| | | if not newItemInfoList:
|
| | | continue
|
| | | giveItemList.append(GameWorld.GetResultByWeightList(newItemInfoList))
|
| | | randomitem = GameWorld.GetResultByWeightList(newItemInfoList)
|
| | | giveItemList.append(randomitem)
|
| | | for _ in xrange(randomitem[1]):
|
| | | dropItemList.append([randomitem[0],1,randomitem[2]])
|
| | | |
| | | if giveItemList:
|
| | | NPCCommon.DoVirtualItemDrop(curPlayer, giveItemList, dropPosX, dropPosY)
|
| | | 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)
|
| | | ipyData = IpyGameDataPY.GetIpyGameDataByCondition('FairyDomain', {'MapID':ChConfig.Def_FBMapID_FairyTreasure, 'LineID':lineID})
|
| | | fdeventID = ipyData.GetID()
|
| | | |
| | | PlayerFairyDomain.SetFairyDomainEventState(curPlayer, fdeventID, PlayerFairyDomain.FDEventState_Visited)
|
| | | return
|
| | |
|