| | |
| | | import ShareDefine
|
| | | import EventShell
|
| | | import EventReport
|
| | | import ChPlayer
|
| | | import FBHelpBattle
|
| | | import IpyGameDataPY
|
| | |
|
| | |
|
| | | #阶段时间
|
| | |
| | |
|
| | | #当前副本地图的状态
|
| | | (
|
| | | FB_Step_Open, # 副本开启
|
| | | FB_Step_CallHelp, # 助战召唤
|
| | | FB_Step_Prepare, # 副本等待
|
| | | FB_Step_Fighting, # 副本进行中
|
| | | FB_Step_Over, # 副本结束
|
| | |
| | | curPlayer.ResetPos(enterX, enterY)
|
| | | return
|
| | |
|
| | | ## 召唤助战完成
|
| | | def OnCallHelpBattleOK(curPlayer, tick):
|
| | | lineID = FBCommon.GetFBPropertyMark()
|
| | | DoQueenRelicsLinePrepare(curPlayer, lineID, tick)
|
| | | return
|
| | |
|
| | | ## 进副本
|
| | | # @param curPlayer
|
| | | # @param tick
|
| | |
| | | def DoEnterFB(curPlayer, tick):
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | GameWorld.DebugLog("DoEnterFB...", playerID)
|
| | | |
| | | isHelpFight = FBCommon.GetIsHelpFight(curPlayer)
|
| | |
|
| | | gameFB = GameWorld.GetGameFB()
|
| | |
|
| | | if not FBCommon.GetHadDelTicket(curPlayer):
|
| | |
| | | GameWorld.ErrLog("进入副本扣除门票失败!", curPlayer.GetPlayerID())
|
| | | return 0
|
| | | FBCommon.SetHadDelTicket(curPlayer)
|
| | | isHelpFight = FBCommon.SetIsHelpFight(curPlayer)
|
| | | GameWorld.DebugLog(" 是否助战: %s" % isHelpFight, playerID)
|
| | |
|
| | | mapID = ChConfig.Def_FBMapID_QueenRelics
|
| | | lineID = FBCommon.GetFBPropertyMark()
|
| | | reqLineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ReqFBFuncLine)
|
| | | joinType = FBCommon.GetFBJoinType(curPlayer, isHelpFight)
|
| | |
|
| | | if not FBCommon.GetHadSetFBPropertyMark() or reqLineID > lineID:
|
| | | FBCommon.SetFBPropertyMark(reqLineID, curPlayer)
|
| | | FBCommon.SetFBStep(FB_Step_Open, tick)
|
| | | lineID = reqLineID
|
| | | EventReport.WriteEvent_FB(curPlayer, ChConfig.Def_FBMapID_QueenRelics, lineID, ChConfig.CME_Log_Start, joinType)
|
| | | |
| | | # 最后一次请求的功能线路ID比副本当前的还小,代表掉线期间队友已经打到其他层了,这时候,需要直接切换过去
|
| | | elif reqLineID < lineID:
|
| | | GameWorld.DebugLog("掉线期间队友已经打到其他层了,直接切换到目标功能线路ID!", playerID)
|
| | | toPosX, toPosY = __GetQueenRelicsLinePos(mapID, lineID)
|
| | | PlayerControl.PlayerResetWorldPosFBLineID(curPlayer, mapID, toPosX, toPosY, lineID)
|
| | | EventReport.WriteEvent_FB(curPlayer, ChConfig.Def_FBMapID_QueenRelics, lineID, ChConfig.CME_Log_Start, joinType)
|
| | | return
|
| | | else:
|
| | | EventReport.WriteEvent_FB(curPlayer, ChConfig.Def_FBMapID_QueenRelics, lineID, ChConfig.CME_Log_Start, joinType)
|
| | | |
| | | #因为是组队副本,队员轮流进,所以只能设置一次
|
| | | fbStep = gameFB.GetFBStep()
|
| | | if fbStep < FB_Step_Prepare:
|
| | | if fbStep == FB_Step_CallHelp:
|
| | | FBCommon.SetFBPropertyMark(reqLineID, curPlayer)
|
| | | lineID = reqLineID
|
| | | FBHelpBattle.SendGameServer_RefreshHelpBattlePlayer(curPlayer, mapID, lineID)
|
| | | return
|
| | | |
| | | if reqLineID > lineID:
|
| | | FBCommon.SetFBPropertyMark(reqLineID, curPlayer)
|
| | | lineID = reqLineID
|
| | | DoQueenRelicsLinePrepare(curPlayer, lineID, tick)
|
| | | else:
|
| | | fbLineTime = FBCommon.GetFBLineStepTime(ChConfig.Def_FBMapID_QueenRelics, lineID)
|
| | |
| | | __RefreshQueenRelicsNPC(True, False, tick, curPlayer)
|
| | | fbLineTime = FBCommon.GetFBLineStepTime(ChConfig.Def_FBMapID_QueenRelics, lineID)
|
| | | curPlayer.Sync_TimeTick(IPY_GameWorld.tttWaitStart, 0, fbLineTime[Def_PrepareTime] * 1000, True)
|
| | | EventReport.WriteEvent_FB(curPlayer, ChConfig.Def_FBMapID_QueenRelics, lineID, ChConfig.CME_Log_Start)
|
| | | |
| | | helpIpyData = IpyGameDataPY.GetIpyGameData("FBHelpBattle", ChConfig.Def_FBMapID_QueenRelics, lineID)
|
| | | if helpIpyData:
|
| | | gameFB.SetGameFBDict(ChConfig.FBPD_HelpBattleFBBaseHurt, helpIpyData.GetRobotBaseHurt())
|
| | | gameFB.SetGameFBDict(ChConfig.FBPD_HelpBattleFBFightPower, helpIpyData.GetFightPowerMin())
|
| | | GameWorld.DebugLog(" 更新副本助战机器人基础伤害: lineID=%s,RobotBaseHurt=%s,fbFightPower=%s" |
| | | % (lineID, helpIpyData.GetRobotBaseHurt(), helpIpyData.GetFightPowerMin()))
|
| | | return
|
| | |
|
| | | ##副本总逻辑计时器
|
| | |
| | | FBCommon.NotifyFBHelp(curPlayer, lineID, fbHelpDict)
|
| | | return
|
| | |
|
| | | 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):
|
| | | curNPCID = curNPC.GetNPCID()
|
| | | gameFB = GameWorld.GetGameFB()
|
| | | killNPCCount = gameFB.GetGameFBDictByKey(FBKey_KillNPCCount % curNPCID) + 1
|
| | |
| | | continue
|
| | | DoFBHelp(curPlayer, tick)
|
| | |
|
| | | isHelpFight = FBCommon.GetIsHelpFight(curPlayer)
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | rewardLine = gameFB.GetPlayerGameFBDictByKey(playerID, FBPKey_RewardLine)
|
| | | needSyncFBData = False
|
| | | overDict = {}
|
| | | if isPass:
|
| | | overDict = {FBCommon.Over_costTime:costTime, FBCommon.Over_grade:grade}
|
| | | # 助战只算单次过关
|
| | | if isHelpFight:
|
| | | helpPoint = FBCommon.AddFBHelpPoint(curPlayer, dataMapID)
|
| | | overDict.update({FBCommon.Over_money:FBCommon.GetJsonMoneyList({ShareDefine.TYPE_Price_FBHelpPoint:helpPoint})})
|
| | | |
| | | curGrade = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, lineID, False, [dataMapID])
|
| | | if curGrade < grade:
|
| | | GameWorld.DebugLog(" 助战更新过关评级: dataMapID=%s,lineID=%s,curGrade=%s,grade=%s" % (dataMapID, lineID, curGrade, grade), curPlayer.GetPlayerID())
|
| | | GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, lineID, grade, False, [dataMapID])
|
| | | needSyncFBData = True
|
| | | |
| | | else:
|
| | | rewardRet = __GivePlayerQueenRelicsReward(curPlayer, dataMapID, rewardLine - 1, lineID, grade, maxGrade, rewardRateList)
|
| | | if rewardRet:
|
| | | needSyncFBData, startRewardLineID, totalSP, rewardItemList = rewardRet
|
| | | overDict.update({FBCommon.Over_sp:totalSP, FBCommon.Over_itemInfo:FBCommon.GetJsonItemList(rewardItemList), |
| | | "startRewardLineID":startRewardLineID})
|
| | | rewardRet = __GivePlayerQueenRelicsReward(curPlayer, dataMapID, rewardLine - 1, lineID, grade, maxGrade, rewardRateList)
|
| | | if rewardRet:
|
| | | needSyncFBData, startRewardLineID, totalSP, rewardItemList = rewardRet
|
| | | overDict.update({FBCommon.Over_sp:totalSP, FBCommon.Over_itemInfo:FBCommon.GetJsonItemList(rewardItemList), |
| | | "startRewardLineID":startRewardLineID})
|
| | | if lineID+1 > curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FBHistoryMaxLine % dataMapID):
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FBHistoryMaxLine % dataMapID, lineID+1)
|
| | | #成就
|
| | |
| | | EventShell.EventRespons_PassQueenRelecs(curPlayer, lineID, grade)
|
| | | #任务
|
| | | EventShell.EventRespons_FBEvent(curPlayer, "queenrelics_pass")
|
| | | FBCommon.NotifyFBOver(curPlayer, dataMapID, lineID, isPass, overDict)
|
| | |
|
| | | # 记录结算到的线路层,记录值+1
|
| | | updRewardLine = lineID + 1
|
| | | gameFB.SetPlayerGameFBDict(playerID, FBPKey_RewardLine, updRewardLine)
|
| | |
|
| | | if isPass and not rewardLine and not isHelpFight:
|
| | | if isPass and not rewardLine:
|
| | | isInFBOnDay = gameFB.GetPlayerGameFBDictByKey(playerID, FBPKey_IsInFBOnDay)
|
| | | if not isInFBOnDay:
|
| | | GameWorld.DebugLog("首次结算奖励,增加挑战次数!", playerID)
|
| | | needSyncFBData = True
|
| | | FBCommon.AddEnterFBCount(curPlayer, dataMapID)
|
| | | addXianyuanCoin, reason = FBHelpBattle.DoFBAddXianyuanCoin(curPlayer, mapID, lineID)
|
| | | overDict[FBCommon.Over_xianyuanCoin] = [addXianyuanCoin, reason]
|
| | | else:
|
| | | GameWorld.DebugLog("副本中过天,不增加挑战次数!", playerID)
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_QueenRelicsEx, 1)
|
| | |
| | |
|
| | | if needSyncFBData:
|
| | | FBCommon.Sync_FBPlayerFBInfoData(curPlayer, dataMapID) # 同步信息
|
| | | |
| | | FBCommon.NotifyFBOver(curPlayer, dataMapID, lineID, isPass, overDict)
|
| | | return
|
| | |
|
| | | def __GivePlayerQueenRelicsReward(curPlayer, dataMapID, rewardLineID, curLineID, passGrade, maxGrade, rewardRateList):
|
| | |
| | | GameWorld.ErrLog("没有目标功能线路!toLineID=%s" % toLineID)
|
| | | return
|
| | |
|
| | | if curPlayer.GetPlayerAction() == IPY_GameWorld.paDie:
|
| | | GameWorld.Log("进入下一层时玩家是死亡状态,先复活!", curPlayer.GetPlayerID())
|
| | | ChPlayer.PlayerRebornByType(curPlayer, ChConfig.rebornType_System, tick)
|
| | | |
| | | toPosX, toPosY = __GetQueenRelicsLinePos(mapID, toLineID, toLineIpyData)
|
| | | PlayerControl.PlayerResetWorldPosFBLineID(curPlayer, mapID, toPosX, toPosY, toLineID)
|
| | |
|