|  |  |  | 
|---|
|  |  |  | import PyGameData | 
|---|
|  |  |  | import EventShell | 
|---|
|  |  |  | import NPCCommon | 
|---|
|  |  |  | import FBHelpBattle | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import math | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 副本状态 | 
|---|
|  |  |  | ( | 
|---|
|  |  |  | FB_Step_Open, #开启 | 
|---|
|  |  |  | FB_Step_CallHelp, # 助战召唤 | 
|---|
|  |  |  | FB_Step_Prepare, #准备中 | 
|---|
|  |  |  | FB_Step_Fight, # 战斗中 | 
|---|
|  |  |  | FB_Step_PickItem, # 拾取物品中 | 
|---|
|  |  |  | 
|---|
|  |  |  | if not FBCommon.GetHadSetFBPropertyMark(): | 
|---|
|  |  |  | lineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ReqFBFuncLine) | 
|---|
|  |  |  | FBCommon.SetFBPropertyMark(lineID) | 
|---|
|  |  |  | if gameFB.GetFBStep() == FB_Step_Open: | 
|---|
|  |  |  | FBCommon.SetFBStep(FB_Step_Prepare, tick) | 
|---|
|  |  |  | gameFB.SetGameFBDict(ZMSL_FBNextRefreshStep, 0) | 
|---|
|  |  |  | gameFB.SetGameFBDict(ZMSL_FBNPCCnt, 0) | 
|---|
|  |  |  | gameFB.SetGameFBDict(ZMSL_FBNPCRefreshCnt, 0) | 
|---|
|  |  |  | #        if gameFB.GetFBStep() == FB_Step_Open: | 
|---|
|  |  |  | #            FBCommon.SetFBStep(FB_Step_Prepare, tick) | 
|---|
|  |  |  | #            gameFB.SetGameFBDict(ZMSL_FBNextRefreshStep, 0) | 
|---|
|  |  |  | #            gameFB.SetGameFBDict(ZMSL_FBNPCCnt, 0) | 
|---|
|  |  |  | #            gameFB.SetGameFBDict(ZMSL_FBNPCRefreshCnt, 0) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | lineID = FBCommon.GetFBPropertyMark() | 
|---|
|  |  |  | GameWorld.DebugLog("ZMSL DoEnterFB lineID=%s!" % lineID, curPlayer.GetID()) | 
|---|
|  |  |  | # 进入消耗处理 | 
|---|
|  |  |  | 
|---|
|  |  |  | FBCommon.SetHadDelTicket(curPlayer) | 
|---|
|  |  |  | PyGameData.g_fbPickUpItemDict.pop(curPlayer.GetPlayerID(), 0) | 
|---|
|  |  |  | curPlayer.SetDict(ChConfig.Def_PlayerKey_IsInFBOnDay, 0) | 
|---|
|  |  |  | isHelpFight = False | 
|---|
|  |  |  | if FBCommon.SetIsHelpFight(curPlayer): | 
|---|
|  |  |  | isHelpFight = True | 
|---|
|  |  |  | GameWorld.DebugLog("ZMSL 助战进入副本!", curPlayer.GetID()) | 
|---|
|  |  |  | joinType = FBCommon.GetFBJoinType(curPlayer, isHelpFight) | 
|---|
|  |  |  | EventReport.WriteEvent_FB(curPlayer, mapID, lineID, ChConfig.CME_Log_Start, joinType) | 
|---|
|  |  |  | #        isHelpFight = False | 
|---|
|  |  |  | #        if FBCommon.SetIsHelpFight(curPlayer): | 
|---|
|  |  |  | #            isHelpFight = True | 
|---|
|  |  |  | #            GameWorld.DebugLog("ZMSL 助战进入副本!", curPlayer.GetID()) | 
|---|
|  |  |  | #        joinType = FBCommon.GetFBJoinType(curPlayer, isHelpFight) | 
|---|
|  |  |  | #        EventReport.WriteEvent_FB(curPlayer, mapID, lineID, ChConfig.CME_Log_Start, joinType) | 
|---|
|  |  |  | if gameFB.GetFBStep() == FB_Step_CallHelp: | 
|---|
|  |  |  | FBHelpBattle.SendGameServer_RefreshHelpBattlePlayer(curPlayer, mapID, lineID) | 
|---|
|  |  |  | return | 
|---|
|  |  |  | ZMSLCfg = GetMTFBLineStepTime() | 
|---|
|  |  |  | fbStep = gameFB.GetFBStep() | 
|---|
|  |  |  | if fbStep <= FB_Step_Prepare: | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | __UpdZMSLFBStar(tick, True, curPlayer) | 
|---|
|  |  |  | DoFBHelp(curPlayer, tick) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ## 召唤助战完成 | 
|---|
|  |  |  | def OnCallHelpBattleOK(curPlayer, tick): | 
|---|
|  |  |  | ZMSLCfg = GetMTFBLineStepTime() | 
|---|
|  |  |  | FBCommon.SetFBStep(FB_Step_Prepare, tick) | 
|---|
|  |  |  | notify_tick = ZMSLCfg[Def_PrepareTime] * 1000 - (tick - GameWorld.GetGameFB().GetFBStepTick()) | 
|---|
|  |  |  | curPlayer.Sync_TimeTick(IPY_GameWorld.tttWaitStart, 0, max(notify_tick, 0), True) | 
|---|
|  |  |  | lineID = FBCommon.GetFBPropertyMark() | 
|---|
|  |  |  | EventReport.WriteEvent_FB(curPlayer, ChConfig.Def_FBMapID_MunekadoTrial, lineID, ChConfig.CME_Log_Start) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ## 刷怪 | 
|---|
|  |  |  | 
|---|
|  |  |  | GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, lineID, star, False, [mapID]) | 
|---|
|  |  |  | needSyncFBData = True | 
|---|
|  |  |  | isInFBOnDay = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_IsInFBOnDay) | 
|---|
|  |  |  | isHelpFight = FBCommon.GetIsHelpFight(curPlayer) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if star == 5: | 
|---|
|  |  |  | joinType = FBCommon.GetFBJoinType(curPlayer, isHelpFight) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | EventReport.WriteEvent_FB(curPlayer, mapID, lineID, ChConfig.CME_Log_End, joinType, 1) | 
|---|
|  |  |  | EventReport.WriteEvent_FB(curPlayer, mapID, lineID, ChConfig.CME_Log_End, 0, 1) | 
|---|
|  |  |  | EventShell.EventRespons_FBEvent(curPlayer, "zmsl_%s_%s" % (lineID, star)) | 
|---|
|  |  |  | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_MunekadoTrial, 1, [playerCount, star, lineID+1]) | 
|---|
|  |  |  | EventShell.EventRespons_FBEvent(curPlayer, "passzmsl") | 
|---|
|  |  |  | #增加助战积分 | 
|---|
|  |  |  | if isHelpFight: | 
|---|
|  |  |  | EventShell.EventRespons_FBEvent(curPlayer, "helpzmsl_%s"%lineID) | 
|---|
|  |  |  | FBCommon.AddFBHelpPoint(curPlayer, mapID, 1) | 
|---|
|  |  |  | overDict.pop(FBCommon.Over_itemInfo, 0) | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | #        if isHelpFight: | 
|---|
|  |  |  | #            EventShell.EventRespons_FBEvent(curPlayer, "helpzmsl_%s"%lineID) | 
|---|
|  |  |  | #            FBCommon.AddFBHelpPoint(curPlayer, mapID, 1) | 
|---|
|  |  |  | #            overDict.pop(FBCommon.Over_itemInfo, 0) | 
|---|
|  |  |  | #        else: | 
|---|
|  |  |  | # 如果在副本中过天,则只给物品奖励,不变更过关信息 | 
|---|
|  |  |  | if not isInFBOnDay: | 
|---|
|  |  |  | FBCommon.AddEnterFBCount(curPlayer, mapID, 1) | 
|---|
|  |  |  | FBHelpBattle.DoSingleFBAddXianyuanCoin(curPlayer, mapID, lineID) | 
|---|
|  |  |  | needSyncFBData = False | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | curPlayer.SetDict(ChConfig.Def_PlayerKey_IsInFBOnDay, 0) | 
|---|
|  |  |  | 
|---|
|  |  |  | npcIDList.append(npcid) | 
|---|
|  |  |  | return npcIDList | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def DoFB_Npc_KillNPC(attacker, curNPC, tick): | 
|---|
|  |  |  | __FBNPCOnKilled(curNPC, tick) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ##玩家杀死NPC | 
|---|
|  |  |  | # @param curPlayer:玩家实例 | 
|---|
|  |  |  | # @param curNPC:当前被杀死的NPC | 
|---|
|  |  |  | 
|---|
|  |  |  | # @return 返回值无意义 | 
|---|
|  |  |  | # @remarks 玩家主动离开副本. | 
|---|
|  |  |  | def DoFB_Player_KillNPC(curPlayer, curNPC, tick): | 
|---|
|  |  |  | __FBNPCOnKilled(curNPC, tick) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def __FBNPCOnKilled(curNPC, tick): | 
|---|
|  |  |  | if curNPC.GetNPCID() not in __GetAllNPCIDList(): | 
|---|
|  |  |  | return | 
|---|
|  |  |  | gameFB = GameWorld.GetGameFB() | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | GameWorld.DebugLog("DoFB_Player_KillNPC, npcID=%s,ZMSL_FBNPCCnt=%s,needRefreshCnt=%s" | 
|---|
|  |  |  | % (curNPC.GetNPCID(), npcCnt, needRefreshCnt)) | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if npcCnt <= 0 and needRefreshCnt <= 0: | 
|---|
|  |  |  | GameWorld.DebugLog("本波所有怪物已被击杀!") | 
|---|