| | |
| | | import EventShell
|
| | | import NPCCommon
|
| | | import FBHelpBattle
|
| | | import PlayerActLogin
|
| | | import PlayerPet
|
| | | import PlayerHorse
|
| | |
|
| | | import math
|
| | |
|
| | |
| | | ##---获得副本刷怪配置---
|
| | | # @param None
|
| | | # @return 配置信息
|
| | | def __GetZMSLnpcCfg(lineID):
|
| | | mapID = GameWorld.GetMap().GetMapID()
|
| | | def __GetZMSLnpcCfg(lineID, mapID=0):
|
| | | if not mapID:
|
| | | mapID = GameWorld.GetMap().GetMapID()
|
| | | return FBCommon.GetFBLineRefreshNPC(mapID, lineID)
|
| | |
|
| | | def GetMTFBLineStepTime(lineID=-1):
|
| | |
| | | # @param tick 时间戳
|
| | | # @return 布尔值
|
| | | def OnEnterFBEvent(curPlayer, mapID, lineID, tick):
|
| | | if lineID == 0:
|
| | | return True
|
| | | historyStar = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, lineID-1, False, [mapID])
|
| | | needStar = IpyGameDataPY.GetFuncCfg('MunekadoLockLimit')
|
| | | if historyStar < needStar:
|
| | | GameWorld.DebugLog(' 上一层评级未达到%s,无法挑战本层!' % needStar)
|
| | | if lineID != 0:
|
| | | historyStar = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, lineID-1, False, [mapID])
|
| | | needStar = IpyGameDataPY.GetFuncCfg('MunekadoLockLimit')
|
| | | if historyStar < needStar:
|
| | | GameWorld.DebugLog(' 上一层评级未达到%s,无法挑战本层!' % needStar)
|
| | | return False
|
| | | #坐骑与灵宠总等级
|
| | | needSumLV = IpyGameDataPY.GetFuncEvalCfg('MunekadoLockLimit', 2, {}).get(lineID, 0)
|
| | | if PlayerPet.GetTotalPetLV(curPlayer) + PlayerHorse.GetHorseSumLV(curPlayer) < needSumLV:
|
| | | GameWorld.DebugLog(' 坐骑与灵宠总等级未达到%s,无法挑战本层!' % needSumLV)
|
| | | return False
|
| | | return True
|
| | |
|
| | |
| | | mapID = FBCommon.GetRecordMapID(mapID)
|
| | | gameFB = GameWorld.GetGameFB()
|
| | |
|
| | | enterCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_EnterFbCntDay % mapID)
|
| | | maxCnt = FBCommon.GetEnterFBMaxCnt(curPlayer, mapID)
|
| | | if enterCnt >= maxCnt:
|
| | | GameWorld.Log('进入次数已满,不可进!', curPlayer.GetID())
|
| | | PlayerControl.PlayerLeaveFB(curPlayer)
|
| | | return
|
| | | # 设置副本公共属性的单独处理,防止队员进入后被修改
|
| | | if not FBCommon.GetHadSetFBPropertyMark():
|
| | | lineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ReqFBFuncLine)
|
| | |
| | | notify_tick = ZMSLCfg[Def_FightTime] * 1000 - (tick - GameWorld.GetGameFB().GetFBStepTick())
|
| | | curPlayer.Sync_TimeTick(IPY_GameWorld.tttTowerTake, 0, max(notify_tick, 0), True)
|
| | |
|
| | | __UpdZMSLFBStar(tick, True, curPlayer)
|
| | | __UpdZMSLFBStar(tick, True, curPlayer)
|
| | | DoFBHelp(curPlayer, tick)
|
| | | return
|
| | |
|
| | |
| | | gameFB.SetGameFBDict(ZMSL_FBNextRefreshStep, refreshStep + 1)
|
| | | gameFB.SetGameFBDict(ZMSL_FBStepStartTick, tick)
|
| | | gameFB.SetGameFBDict(ZMSL_FBStepStar, gameFB.GetGameFBDictByKey(ChConfig.Def_FB_Grade))
|
| | | __UpdZMSLFBStar(tick, True)
|
| | |
|
| | | return
|
| | |
|
| | |
|
| | |
| | | if fbStep == FB_Step_Prepare:
|
| | | __DoLogic_FB_Prepare(tick)
|
| | | elif fbStep == FB_Step_Fight:
|
| | | __ProcessOverFight(tick)
|
| | | __UpdZMSLFBStar(tick)
|
| | | __ProcessOverFight(tick)
|
| | | elif fbStep == FB_Step_PickItem:
|
| | | __DoLogic_FB_PickItem(tick)
|
| | | elif fbStep == FB_Step_Over:
|
| | |
| | | costTime = tick - GameWorld.GetGameFB().GetFBStepTick()
|
| | | gameFB = GameWorld.GetGameFB()
|
| | | gameFB.SetGameFBDict(ZMSL_CostTime, costTime)
|
| | | GameWorld.DebugLog("__DoZMSLOver isPass=%s,killNPCID=%s" % (isPass, killNPCID))
|
| | | star = GameWorld.GetGameFB().GetGameFBDictByKey(ChConfig.Def_FB_Grade)
|
| | | GameWorld.DebugLog("__DoZMSLOver isPass=%s,killNPCID=%s,star=%s" % (isPass, killNPCID, star))
|
| | | #===============================================================================================
|
| | | # canDropPlayerList = GetCanDropPlayerList()
|
| | | # if isPass and canDropPlayerList:
|
| | |
| | | mapID = GameWorld.GetMap().GetMapID()
|
| | | mapID = FBCommon.GetRecordMapID(mapID)
|
| | | lineID = FBCommon.GetFBPropertyMark()
|
| | | star = GameWorld.GetGameFB().GetGameFBDictByKey(ChConfig.Def_FB_Grade)
|
| | | |
| | | #awardDict = FBCommon.GetFBLineReward(mapID, lineID)
|
| | | #prizeItemList = awardDict.get(star, [])
|
| | | overDict = {FBCommon.Over_grade:star,FBCommon.Over_dataMapID:mapID,FBCommon.Over_isPass:int(isPass), FBCommon.Over_costTime:costTime}
|
| | |
| | | else:
|
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_IsInFBOnDay, 0)
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_MunekadoTrialEx, 1)
|
| | | |
| | | PlayerActLogin.AddLoginAwardActionCnt(curPlayer, ChConfig.Def_LoginAct_MunekadoTrial, 1)
|
| | | #=======================================================================================
|
| | | # #给奖励
|
| | | # needSpace = len(prizeItemList)
|
| | |
| | | # GameWorld.DebugLog("背包空间不够,发送邮件: mailItemList=%s" % str(prizeItemList), curPlayer.GetPlayerID())
|
| | | # else:
|
| | | # for itemID, itemCnt, isBind in prizeItemList:
|
| | | # ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, isBind, [IPY_GameWorld.rptItem], event=["MunekadoTrial", False, {}])
|
| | | # ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, 0, [IPY_GameWorld.rptItem], event=["MunekadoTrial", False, {}])
|
| | | #overDict[FBCommon.Over_itemInfo] = FBCommon.GetJsonItemList(prizeItemList)
|
| | | #=======================================================================================
|
| | |
|
| | |
| | | GameWorld.DebugLog(' overDict=%s'%overDict, curPlayer.GetID())
|
| | | FBCommon.Notify_FB_Over(curPlayer, overDict)
|
| | | return
|
| | |
|
| | | ## 可否扫荡
|
| | | def OnPlayerFBSweepAsk(curPlayer, mapID, lineID, sweepCnt, isFinish, dataEx):
|
| | | if mapID != ChConfig.Def_FBMapID_MunekadoTrial:
|
| | | return
|
| | | # 暂写死,前两层不能扫
|
| | | if lineID < 2: |
| | | GameWorld.DebugLog("前两层不能扫荡!")
|
| | | return
|
| | | historyStar = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, lineID, False, [mapID])
|
| | | if historyStar < 5:
|
| | | GameWorld.DebugLog("没有S级不能扫荡!")
|
| | | return
|
| | | |
| | | return True
|
| | |
|
| | | ## 助战扫荡结果
|
| | | def OnPlayerFBHelpBattleSweepResult(curPlayer, mapID, lineID, helpBattlePlayerDict, addXianyuanCoin, reason):
|
| | | #扣门票要在公共逻辑中完成
|
| | | |
| | | refreshNPCList = __GetZMSLnpcCfg(lineID, mapID)[0]
|
| | | if not refreshNPCList:
|
| | | return
|
| | | lastNPCList = refreshNPCList[-1]
|
| | | if not lastNPCList:
|
| | | return
|
| | | killNPCID = lastNPCList[0][0] # 默认最后一波的NPCID为通关boss奖励ID
|
| | | GameWorld.DebugLog("扫荡宗门试炼: killNPCID=%s,addXianyuanCoin=%s,reason=%s,helpBattlePlayerDict=%s" |
| | | % (killNPCID, addXianyuanCoin, reason, helpBattlePlayerDict))
|
| | | |
| | | star = 5
|
| | | EventReport.WriteEvent_FB(curPlayer, mapID, lineID, ChConfig.CME_Log_End, 0, 1)
|
| | | |
| | | EventShell.EventRespons_FBEvent(curPlayer, "zmsl_%s_%s" % (lineID, star))
|
| | | EventShell.EventRespons_FBEvent(curPlayer, "passzmsl")
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_MunekadoTrialEx, 1)
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_MunekadoTrial, 1, [1, star, lineID+1])
|
| | | PlayerActLogin.AddLoginAwardActionCnt(curPlayer, ChConfig.Def_LoginAct_MunekadoTrial, 1)
|
| | | jsonItemList, totalExp, totalMoney = NPCCommon.GiveKillNPCDropPrize(curPlayer, ChConfig.Def_FBMapID_MunekadoTrial, {killNPCID:1}, curGrade=star)
|
| | | |
| | | # 通知结果
|
| | | overDict = {FBCommon.Over_grade:star,FBCommon.Over_dataMapID:mapID,FBCommon.Over_isPass:1, FBCommon.Over_isSweep:1}
|
| | | overDict[FBCommon.Over_helpPlayer] = helpBattlePlayerDict
|
| | | overDict[FBCommon.Over_xianyuanCoin] = [addXianyuanCoin, reason]
|
| | | overDict[FBCommon.Over_itemInfo] = jsonItemList
|
| | | FBCommon.Notify_FB_Over(curPlayer, overDict)
|
| | | return True
|
| | |
|
| | | ## 检查是否可攻击, 主判定不可攻击的情况,其他逻辑由外层决定
|
| | | # @param attacker 攻击方
|
| | |
| | |
|
| | | ## 更新当前副本星级
|
| | | def __UpdZMSLFBStar(tick, isEnter=False, curPlayer=None):
|
| | | #1-D 2-C 3-B 4-A 5-S
|
| | | gameFB = GameWorld.GetGameFB()
|
| | | curStar = gameFB.GetGameFBDictByKey(ChConfig.Def_FB_Grade)
|
| | | if curStar == 1:
|
| | | return curStar
|
| | | stepStartTick = gameFB.GetGameFBDictByKey(ZMSL_FBStepStartTick)
|
| | | if not stepStartTick:
|
| | | return curStar
|
| | | useSecond = int(math.ceil((tick - stepStartTick) / 1000.0))
|
| | | lineID = FBCommon.GetFBPropertyMark()
|
| | | starTimeList = IpyGameDataPY.GetFuncEvalCfg('MunekadoTrialStarTime').get(lineID,[])
|
| | | wheelNum = gameFB.GetGameFBDictByKey(ZMSL_FBNextRefreshStep)
|
| | | if wheelNum > len(starTimeList):
|
| | | GameWorld.DebugLog(" MunekadoTrialStarTime 配置错误 与波数不等")
|
| | | return
|
| | | stepStar = gameFB.GetGameFBDictByKey(ZMSL_FBStepStar)
|
| | | starTimeInfo = starTimeList[wheelNum-1]
|
| | | updStar = stepStar if stepStar else 5
|
| | | totalStarTime = 0
|
| | | for starTime in starTimeInfo:
|
| | | if updStar == 1:
|
| | | break
|
| | | totalStarTime +=starTime
|
| | | if useSecond >= totalStarTime:
|
| | | updStar = max(1, updStar-1)
|
| | | else:
|
| | | break
|
| | |
|
| | | diffSecond =max(0, totalStarTime -useSecond)
|
| | | |
| | | if curStar == updStar and not isEnter:
|
| | | return curStar
|
| | | |
| | | gameFB.SetGameFBDict(ChConfig.Def_FB_Grade, updStar)
|
| | | |
| | | GameWorld.DebugLog("__UpdFBStar useSecond=%s,curStar=%s,updStar=%s, diffSecond=%s" |
| | | % (useSecond, curStar, updStar, diffSecond))
|
| | | |
| | | if curPlayer:
|
| | | DoFBHelp(curPlayer, tick)
|
| | | if updStar != 1:
|
| | | curPlayer.Sync_TimeTick(IPY_GameWorld.tttFlagTake, 0, diffSecond * 1000, True)
|
| | | else:
|
| | | playerManager = GameWorld.GetMapCopyPlayerManager()
|
| | | for index in xrange(playerManager.GetPlayerCount()):
|
| | | curPlayer = playerManager.GetPlayerByIndex(index)
|
| | | if not curPlayer:
|
| | | continue
|
| | | DoFBHelp(curPlayer, tick)
|
| | | if updStar != 1:
|
| | | curPlayer.Sync_TimeTick(IPY_GameWorld.tttFlagTake, 0, diffSecond * 1000, True)
|
| | | |
| | | |
| | | return updStar
|
| | | FBCommon.UpdateFBGrade(tick, FBCommon.GetFBLineGrade(GameWorld.GetGameWorld().GetMapID(), lineID), curPlayer)
|
| | | return
|
| | | #1-D 2-C 3-B 4-A 5-S
|
| | | # gameFB = GameWorld.GetGameFB()
|
| | | # curStar = gameFB.GetGameFBDictByKey(ChConfig.Def_FB_Grade)
|
| | | # if curStar == 1:
|
| | | # return curStar
|
| | | # stepStartTick = gameFB.GetGameFBDictByKey(ZMSL_FBStepStartTick)
|
| | | # if not stepStartTick:
|
| | | # return curStar
|
| | | # useSecond = int(math.ceil((tick - stepStartTick) / 1000.0))
|
| | | # lineID = FBCommon.GetFBPropertyMark()
|
| | | # starTimeList = IpyGameDataPY.GetFuncEvalCfg('MunekadoTrialStarTime').get(lineID,[])
|
| | | # wheelNum = gameFB.GetGameFBDictByKey(ZMSL_FBNextRefreshStep)
|
| | | # if wheelNum > len(starTimeList):
|
| | | # GameWorld.DebugLog(" MunekadoTrialStarTime 配置错误 与波数不等")
|
| | | # return
|
| | | # stepStar = gameFB.GetGameFBDictByKey(ZMSL_FBStepStar)
|
| | | # starTimeInfo = starTimeList[wheelNum-1]
|
| | | # updStar = stepStar if stepStar else 5
|
| | | # totalStarTime = 0
|
| | | # for starTime in starTimeInfo:
|
| | | # if updStar == 1:
|
| | | # break
|
| | | # totalStarTime +=starTime
|
| | | # if useSecond >= totalStarTime:
|
| | | # updStar = max(1, updStar-1)
|
| | | # else:
|
| | | # break
|
| | | #
|
| | | # diffSecond =max(0, totalStarTime -useSecond)
|
| | | # |
| | | # if curStar == updStar and not isEnter:
|
| | | # return curStar
|
| | | # |
| | | # gameFB.SetGameFBDict(ChConfig.Def_FB_Grade, updStar)
|
| | | # |
| | | # GameWorld.DebugLog("__UpdFBStar useSecond=%s,curStar=%s,updStar=%s, diffSecond=%s" |
| | | # % (useSecond, curStar, updStar, diffSecond))
|
| | | # |
| | | # if curPlayer:
|
| | | # DoFBHelp(curPlayer, tick)
|
| | | # if updStar != 1:
|
| | | # curPlayer.Sync_TimeTick(IPY_GameWorld.tttFlagTake, 0, diffSecond * 1000, True)
|
| | | # else:
|
| | | # playerManager = GameWorld.GetMapCopyPlayerManager()
|
| | | # for index in xrange(playerManager.GetPlayerCount()):
|
| | | # curPlayer = playerManager.GetPlayerByIndex(index)
|
| | | # if not curPlayer:
|
| | | # continue
|
| | | # DoFBHelp(curPlayer, tick)
|
| | | # if updStar != 1:
|
| | | # curPlayer.Sync_TimeTick(IPY_GameWorld.tttFlagTake, 0, diffSecond * 1000, True)
|
| | | # |
| | | # |
| | | # return updStar
|
| | |
|
| | | ##副本帮助信息
|
| | | # @param curPlayer 玩家实例
|
| | |
| | | ItemCommon.DelCostItem(curPlayer, itemPack, delInfoDict)
|
| | |
|
| | | #给物品
|
| | | ItemControler.GivePlayerItem(curPlayer, exchangeItemID, exchangeItemCount, exchangeItemIsBind, [IPY_GameWorld.rptItem], |
| | | ItemControler.GivePlayerItem(curPlayer, exchangeItemID, exchangeItemCount, 0, [IPY_GameWorld.rptItem], |
| | | event=[ChConfig.ItemGive_TrialExchange, False, {}])
|
| | | #任务
|
| | | EventShell.EventRespons_TrialExchange(curPlayer, costItemID)
|