7429 【后端】【2.0】资源找回(封魔坛 世界boss)
| | |
| | | if not GameFuncComm.GetFuncCanUse(atkPlayer, funcID):
|
| | | PlayerControl.NotifyCode(atkPlayer, funcSysMark)
|
| | | return
|
| | |
|
| | | hasKillCnt = atkPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Boss_KillCnt%index, 0)
|
| | | itemAddKillCnt = atkPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Boss_KillCntItemAddCnt%index, 0)
|
| | | killLimitPrivilege = IpyGameDataPY.GetFuncEvalCfg('KillBossCntLimit', 4, {}).get(index, 0)
|
| | | if killLimitPrivilege:
|
| | | limitCnt = PlayerVip.GetPrivilegeValue(atkPlayer, killLimitPrivilege)
|
| | | else:
|
| | | limitCnt = IpyGameDataPY.GetFuncEvalCfg('KillBossCntLimit', 2, {}).get(index, 0)
|
| | | canKillCnt, limitCnt = GetBossCanKillRemainCnt(atkPlayer, index)
|
| | |
|
| | | |
| | | if hasKillCnt >= limitCnt + itemAddKillCnt:
|
| | | if canKillCnt <= 0:
|
| | | #if BossHurtMng.GetPlayerBossHurt(atkPlayer, defender):
|
| | | # GameWorld.DebugLog("攻击过该boss可继续攻击")
|
| | | # return True
|
| | |
| | | return False
|
| | | return True
|
| | |
|
| | | def GetBossCanKillRemainCnt(curPlayer, funcIndex):
|
| | | #获取BOSS剩余可击杀数量与最大数量
|
| | | hasKillCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Boss_KillCnt%funcIndex, 0)
|
| | | itemAddKillCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Boss_KillCntItemAddCnt%funcIndex, 0)
|
| | | killLimitPrivilege = IpyGameDataPY.GetFuncEvalCfg('KillBossCntLimit', 4, {}).get(funcIndex, 0)
|
| | | if killLimitPrivilege:
|
| | | limitCnt = PlayerVip.GetPrivilegeValue(curPlayer, killLimitPrivilege)
|
| | | else:
|
| | | limitCnt = IpyGameDataPY.GetFuncEvalCfg('KillBossCntLimit', 2, {}).get(funcIndex, 0)
|
| | | return max(0, limitCnt + itemAddKillCnt - hasKillCnt), limitCnt
|
| | |
|
| | | def CheckAttackNPCByCnt(attacker, defender, isNotify=True):
|
| | | ''' 判断当日攻击该NPC次数是否已满 '''
|
| | |
| | | Def_Player_Dict_EnterFbCntWeek = "EnterFbCntWeek_%s" # 本周进入副本次数, 参数为副本ID
|
| | | Def_Player_Dict_FbCntRegainStartTime = "FbCntRegainStartTime_%s" # 副本次数恢复开始时间, 参数为副本ID
|
| | | Def_Player_Dict_FbCntRegainTotalTime = "FbCntRegainTotalTime_%s" # 副本次数恢复还需时间, 参数为副本ID
|
| | | Def_Player_Dict_FbCntRegainOverTime = "FbCntRegainOverTime_%s" # 副本次数恢复超出的次数, 参数为副本ID
|
| | | Def_Player_Dict_FBHistoryMaxLine = "FBHistoryMaxLine_%s" # 副本历史最高通关, 参数为副本ID
|
| | | Def_Player_Dict_IceLoadLineID = "IceLoadLineID_%s" # 副本星级星级信息, 参数为[key编号], 按位存储每个lineID是否选中
|
| | | Def_Player_Dict_RefurbishGoodBookPlayerLv = "RefurbishGoodBookPlayerLv_97" # 刷新天书任务时的玩家等级
|
| | |
| | | maxCnt = GetEnterFBMaxCnt(curPlayer, mapID)
|
| | | maxCanAdd = max(0, maxDayTimes - (maxCnt-enterCnt))
|
| | | #GameWorld.DebugLog('封魔坛最大可恢复次数 %s'%maxCanAdd)
|
| | | if not maxCanAdd:
|
| | | return
|
| | |
|
| | | curTime = int(time.time())
|
| | | recoverInterval = IpyGameDataPY.GetFuncCfg('FBCntRegainInterval')
|
| | | lastRegainTime = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FbCntRegainStartTime % mapID)
|
| | |
| | | passTime = curTime - lastRegainTime
|
| | | if passTime < needTime:
|
| | | return
|
| | | recoverCnt = min(maxCanAdd, 1 + (passTime-needTime) / recoverInterval) # 恢复次数
|
| | | recoverCnt = 1 + (passTime-needTime) / recoverInterval # 恢复次数
|
| | | if recoverCnt > maxCanAdd:
|
| | | #记录超出的次数,用于资源找回
|
| | | beyondTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FbCntRegainOverTime % mapID)
|
| | | updBeyondTimes = recoverCnt - maxCanAdd + beyondTimes
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainOverTime % mapID, updBeyondTimes)
|
| | | if not maxCanAdd:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainStartTime % mapID, curTime)
|
| | | GameWorld.DebugLog(' 封魔坛恢复次数 记录超出的次数addOverCnt=%s, updBeyondTimes=%s'%(recoverCnt-maxCanAdd, updBeyondTimes))
|
| | | |
| | | if not maxCanAdd:
|
| | | return
|
| | | recoverCnt = min(maxCanAdd, recoverCnt)
|
| | | |
| | | enterCntKey = ChConfig.Def_Player_Dict_EnterFbCntDay % mapID
|
| | | newEnterCnt = max(0, enterCnt-recoverCnt)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, enterCntKey, newEnterCnt)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainTotalTime % mapID, 0)
|
| | | if recoverCnt == maxCanAdd:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainStartTime % mapID, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainStartTime % mapID, curTime)
|
| | | else:
|
| | | startTime = curTime- (passTime-needTime)%recoverInterval
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainStartTime % mapID, startTime)
|
| | |
| | | if mapID in [ChConfig.Def_FBMapID_SealDemon]:
|
| | | newEnterCnt = max(0, dayTimes - (maxCnt - enterCnt))
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, enterCntKey, newEnterCnt)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainOverTime % mapID, 0)
|
| | | GameWorld.DebugLog(" 特殊副本已进入次数更新: newEnterCnt=%s" % newEnterCnt)
|
| | | elif mapID == ChConfig.Def_FBMapID_ZhuXianBoss:
|
| | | if GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_ZhuXianBoss):
|
| | |
| | | import PlayerActivity
|
| | | import PlayerSuccess
|
| | | import PyGameData
|
| | | import AttackCommon
|
| | |
|
| | | import copy
|
| | | import datetime
|
| | |
| | | recoverNumList.append(index)
|
| | | elif dailyQuestData.GetRelatedType() == 1:#每日活动
|
| | | dailyID = dailyQuestData.GetRelatedID()
|
| | | lostOnDay = lostOnDayNum
|
| | | curDayTimes, dayTimesLimit = PlayerActivity.GetDailyActionFinishCnt(curPlayer, dailyID)
|
| | | if dailyID in [ShareDefine.DailyActionID_Dice, ShareDefine.DailyActionID_IceLode]:#我要太极只分是否参加过,没参加过才能找回,次数算1次
|
| | | dayTimesLimit = 1
|
| | | if curDayTimes:
|
| | | curDayTimes = dayTimesLimit
|
| | | |
| | | if curDayTimes >= dayTimesLimit and not lostOnDayNum:
|
| | | elif dailyID is ShareDefine.DailyActionID_WorldBOSS:
|
| | | canKillCnt, dayTimesLimit = AttackCommon.GetBossCanKillRemainCnt(curPlayer, 0)
|
| | | curDayTimes = dayTimesLimit - canKillCnt
|
| | | elif dailyID is ShareDefine.DailyActionID_SealDemon:
|
| | | #找回前先立即刷新一次
|
| | | FBCommon.RegainFBCntProcess(curPlayer)
|
| | | beyondTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FbCntRegainOverTime % ChConfig.Def_FBMapID_SealDemon)
|
| | | recoverInterval = IpyGameDataPY.GetFuncCfg('FBCntRegainInterval')
|
| | | dayTimesLimit = 24*3600/recoverInterval
|
| | | curDayTimes = dayTimesLimit - beyondTimes
|
| | | lostOnDay = 0
|
| | | if curDayTimes >= dayTimesLimit and not lostOnDay:
|
| | | continue
|
| | | addCommonCnt = (dayTimesLimit - curDayTimes) + lostOnDayNum * dayTimesLimit
|
| | | addCommonCnt = (dayTimesLimit - curDayTimes) + lostOnDay * dayTimesLimit
|
| | | if addCommonCnt <=0:
|
| | | continue
|
| | | curCommonCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RecoverFBCommonCnt % index, 0)
|
| | |
| | | expRate = PlayerControl.GetLimitExpRate(curPlayer, ChConfig.ExpRateLimitType_Recover)
|
| | | extraData = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RecoverGainData % index, 0)
|
| | | dataEx = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RecoverGainDataEx % index, 0)
|
| | | |
| | | realmLV = curPlayer.GetOfficialRank()
|
| | | tjgExp = 0 #脱机挂找回经验
|
| | | exp = 0
|
| | | sp = 0
|