| | |
| | | _fields_ = [
|
| | | ("DataMapID", c_int), # 地图ID
|
| | | ("RemainTime", c_int), # 剩余时间秒
|
| | | ("RegainCnt", c_ubyte), # 今日已恢复次数
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | |
| | | def Clear(self):
|
| | | self.DataMapID = 0
|
| | | self.RemainTime = 0
|
| | | self.RegainCnt = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | |
| | | def OutputString(self):
|
| | | DumpString = '''// B2 09 副本次数恢复剩余时间 //tagMCFBCntRegainRemainTime:
|
| | | DataMapID:%d,
|
| | | RemainTime:%d
|
| | | RemainTime:%d,
|
| | | RegainCnt:%d
|
| | | '''\
|
| | | %(
|
| | | self.DataMapID,
|
| | | self.RemainTime
|
| | | self.RemainTime,
|
| | | self.RegainCnt
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
| | | Def_Player_Dict_BuyFbCntDay = "BuyFbCntDay_%s" # 今日购买副本进入次数, 参数为副本ID
|
| | | Def_Player_Dict_RecoverFbCnt = "RecoverFbCnt_%s" # 今日找回的副本次数, 参数为副本ID
|
| | | Def_Player_Dict_ItemAddFbCnt = "ItemAddFbCnt_%s" # 使用物品增加的副本次数, 参数为副本ID
|
| | | Def_Player_Dict_RegainFbCnt = "RegainFbCnt_%s" # 时间恢复增加的副本次数, 参数为副本ID
|
| | | 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" # 刷新天书任务时的玩家等级
|
| | |
| | | Def_PDict_NobleExperState = "NobleExperState" # 体验贵族状态; 0-无效;1-有效; 2-可体验
|
| | |
|
| | | Def_PDict_RecoverFBCommonCnt = "RecoverFBCommonCnt_%s" # 资源找回副本普通次数 <%s-找回项索引>
|
| | | Def_PDict_RecoverFBExtraCnt = "RecoverFBExtraCnt_%s" # 资源找回副本普通次数 <%s-找回项索引>
|
| | | Def_PDict_RecoverFBBuyCnt = "RecoverFBBuyCnt_%s" # 资源找回副本普通次数 <%s-找回项索引>
|
| | | Def_PDict_RecoverFBItemAddCnt = "RecoverFBItemAddCnt_%s" # 资源找回副本普通次数 <%s-找回项索引>
|
| | | Def_PDict_RecoverFBNoBuyCnt = "RecoverFBNoBuyCnt_%s" # 资源找回副本普通次数 <%s-找回项索引>
|
| | | Def_PDict_RecoverFBRegainCnt = "RecoverFBRegainCnt_%s" # 资源找回副本时间恢复次数 <%s-找回项索引>
|
| | | Def_PDict_RecoverFBExtraCnt = "RecoverFBExtraCnt_%s" # 资源找回副本VIP额外次数 <%s-找回项索引>
|
| | | Def_PDict_RecoverFBBuyCnt = "RecoverFBBuyCnt_%s" # 资源找回副本购买次数 <%s-找回项索引>
|
| | | Def_PDict_RecoverFBItemAddCnt = "RecoverFBItemAddCnt_%s" # 资源找回副本物品增加次数 <%s-找回项索引>
|
| | | Def_PDict_RecoverFBNoBuyCnt = "RecoverFBNoBuyCnt_%s" # 资源找回副本未购买次数 <%s-找回项索引>
|
| | | Def_PDict_RecoverGainData = "RecoverGainData_%s" # 资源找回额外数据<%s-找回项索引>
|
| | | Def_PDict_RecoverGainDataEx = "RecoverGainDataEx_%s" # 资源找回额外数据<%s-找回项索引>
|
| | | Def_PDict_HaveRecover = "HaveRecover_%s" # 资源找回今日是否已找回<%s-找回项索引> 1:找回了普通 2:找回了vip 3:2个都有找回
|
| | |
| | | _fields_ = [
|
| | | ("DataMapID", c_int), # 地图ID
|
| | | ("RemainTime", c_int), # 剩余时间秒
|
| | | ("RegainCnt", c_ubyte), # 今日已恢复次数
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | |
| | | def Clear(self):
|
| | | self.DataMapID = 0
|
| | | self.RemainTime = 0
|
| | | self.RegainCnt = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | |
| | | def OutputString(self):
|
| | | DumpString = '''// B2 09 副本次数恢复剩余时间 //tagMCFBCntRegainRemainTime:
|
| | | DataMapID:%d,
|
| | | RemainTime:%d
|
| | | RemainTime:%d,
|
| | | RegainCnt:%d
|
| | | '''\
|
| | | %(
|
| | | self.DataMapID,
|
| | | self.RemainTime
|
| | | self.RemainTime,
|
| | | self.RegainCnt
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
| | |
|
| | | ## ---------------------------------- TD ---------------------------------------
|
| | | def GetEnterFBMaxCnt(curPlayer, mapID):
|
| | | ## 获取副本最大可进入次数: 基本次数 + VIP额外次数 + 购买次数 + 找回次数
|
| | | ## 获取副本最大可进入次数: 基本次数 + 时间已恢复次数 + VIP额外次数 + 购买次数 + 找回次数 + 使用道具增加次数
|
| | | fbIpyData = GetFBIpyData(mapID)
|
| | | maxTimes = fbIpyData.GetDayTimes()
|
| | | MWPrivilegeID = fbIpyData.GetExtraTimesMWPriID()
|
| | |
| | | buyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_BuyFbCntDay % mapID)
|
| | | recoverFbCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_RecoverFbCnt % mapID)
|
| | | itemAddCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ItemAddFbCnt % mapID)
|
| | | maxCnt = maxTimes + extraCnt + buyCnt + recoverFbCnt + mwAddCnt + itemAddCnt
|
| | | regainFbCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_RegainFbCnt % mapID)
|
| | | maxCnt = maxTimes + regainFbCnt + extraCnt + buyCnt + recoverFbCnt + mwAddCnt + itemAddCnt
|
| | | return maxCnt
|
| | |
|
| | | def GetFBDetailCntInfo(curPlayer, mapID):
|
| | | #返回FB剩余正常次数、vip额外次数、已买次数、道具增加次数、未买次数
|
| | | #返回FB剩余正常次数、时间恢复次数、vip额外次数、已买次数、道具增加次数、未买次数
|
| | | fbIpyData = GetFBIpyData(mapID)
|
| | | enterCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_EnterFbCntDay % mapID)
|
| | | maxTimes = fbIpyData.GetDayTimes()
|
| | | maxRegainFbCnt = 0
|
| | | recoverIntervalDict = IpyGameDataPY.GetFuncEvalCfg('FBCntRegainInterval', 1)
|
| | | if str(mapID) in recoverIntervalDict:
|
| | | maxRegainFbCnt = recoverIntervalDict[str(mapID)][0]
|
| | | |
| | | MWPrivilegeID = fbIpyData.GetExtraTimesMWPriID()
|
| | |
|
| | | mwAddCnt = 0#wmpIpyData.GetEffectValue() if wmpIpyData else 0
|
| | |
| | | buyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_BuyFbCntDay % mapID)
|
| | | recoverFbCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_RecoverFbCnt % mapID)
|
| | | itemAddCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ItemAddFbCnt % mapID)
|
| | | #先用找回来的次数,再用Vip额外次数,再用每日刷新次数和Vip买回来的次数,最后用卷轴加的次数
|
| | | cntList = [recoverFbCnt, extraCnt, maxTimes, buyCnt, itemAddCnt]
|
| | | #先用找回来的次数,再用Vip额外次数,再用每日刷新次数、时间恢复次数、和Vip买回来的次数,最后用卷轴加的次数
|
| | | cntList = [recoverFbCnt, extraCnt, maxTimes, maxRegainFbCnt, buyCnt, itemAddCnt]
|
| | | rCntList = copy.deepcopy(cntList)
|
| | | sumCnt = 0
|
| | | for i, cnt in enumerate(cntList):
|
| | |
| | | rCntList[i] = max(0, sumCnt - enterCnt)
|
| | | if enterCnt <= sumCnt:
|
| | | break
|
| | | rRecoverFbCnt, rExtraCnt,rCommonCnt,rBuyCnt,rItemAddCnt = rCntList
|
| | | rRecoverFbCnt, rExtraCnt, rCommonCnt, rRegainFbCnt, rBuyCnt, rItemAddCnt = rCntList
|
| | |
|
| | | #未买次数
|
| | | buyTimesVIPPriID = fbIpyData.GetBuyTimesVIPPriID()
|
| | | canBuyCnt = PlayerVip.GetPrivilegeValue(curPlayer, buyTimesVIPPriID)
|
| | | noBuyCnt = max(0, canBuyCnt-buyCnt)
|
| | | return [[rCommonCnt, rExtraCnt, rBuyCnt, rItemAddCnt, noBuyCnt], [maxTimes, extraCnt, canBuyCnt, 10000, canBuyCnt]]
|
| | | noBuyCnt = max(0, canBuyCnt - buyCnt)
|
| | | return [[rCommonCnt, rRegainFbCnt, rExtraCnt, rBuyCnt, rItemAddCnt, noBuyCnt], [maxTimes, maxRegainFbCnt, extraCnt, canBuyCnt, 10000, canBuyCnt]]
|
| | |
|
| | | ## 玩家进入副本次数
|
| | | # @param curPlayer 玩家实例
|
| | |
| | | PlayerActivity.OnEnterFBActivity(curPlayer, fbID, updCnt, addCount)
|
| | | PlayerSuccess.AddEnterFBSuccess(curPlayer, fbID, addCount)
|
| | | updValue = updCnt
|
| | | #由满到未满时记录开始恢复的时间
|
| | | if fbID == ChConfig.Def_FBMapID_SealDemon:
|
| | | fbIpyData = GetFBIpyData(fbID)
|
| | | dayTimes = fbIpyData.GetDayTimes()
|
| | | if maxCnt - enterCnt >= dayTimes and maxCnt - updCnt < dayTimes:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainStartTime % fbID, int(time.time()))
|
| | | NotifyFBCntRegainInfo(curPlayer)
|
| | | GameWorld.DebugLog(" AddEnterFBCount fbID=%s, addCount=%s, lineBit=%s, enterCnt=%s,updValue=%s"
|
| | | % (fbID, addCount, lineBit, enterCnt, updValue), curPlayer.GetPlayerID())
|
| | | Sync_FBPlayerFBInfoData(curPlayer, fbID)
|
| | | OnFBCountChangeEffectRecoverCount(curPlayer, fbID)
|
| | | return True
|
| | |
|
| | | def RegainFBCntProcess(curPlayer):
|
| | | #目前只有封魔坛可恢复次数 先特殊做
|
| | | mapID = ChConfig.Def_FBMapID_SealDemon
|
| | | enterCnt = GetEnterFBCount(curPlayer, mapID)
|
| | | fbIpyData = GetFBIpyData(mapID)
|
| | | maxDayTimes = fbIpyData.GetDayTimes()
|
| | | maxCnt = GetEnterFBMaxCnt(curPlayer, mapID)
|
| | | maxCanAdd = max(0, maxDayTimes - (maxCnt-enterCnt))
|
| | | #GameWorld.DebugLog('封魔坛最大可恢复次数 %s'%maxCanAdd)
|
| | |
|
| | | curTime = int(time.time())
|
| | | lastRegainTime = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FbCntRegainStartTime % mapID)
|
| | | if not lastRegainTime:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainStartTime % mapID, curTime)
|
| | | return
|
| | | recoverInterval = IpyGameDataPY.GetFuncCfg('FBCntRegainInterval')
|
| | | needTime = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FbCntRegainTotalTime % mapID)
|
| | | if not needTime:
|
| | | needTime = recoverInterval
|
| | | passTime = curTime - lastRegainTime
|
| | | if passTime < needTime:
|
| | | return
|
| | | 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))
|
| | | def OnFBCountChangeEffectRecoverCount(curPlayer, mapID):
|
| | | ## 副本相关次数变更,包含增加、扣除等影响副本按时间恢复次数相关逻辑处理
|
| | |
|
| | | if not maxCanAdd:
|
| | | recoverIntervalDict = IpyGameDataPY.GetFuncEvalCfg('FBCntRegainInterval', 1)
|
| | | if str(mapID) not in recoverIntervalDict:
|
| | | 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, curTime)
|
| | | maxCanRecoverCnt, recoverInterval = recoverIntervalDict[str(mapID)]
|
| | | curRegainFbCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_RegainFbCnt % mapID) # 当前已恢复次数
|
| | | if curRegainFbCnt >= maxCanRecoverCnt:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainStartTime % mapID, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainTotalTime % mapID, 0)
|
| | | GameWorld.DebugLog("副本时间恢复次数已达当日上限!")
|
| | | else:
|
| | | startTime = curTime- (passTime-needTime)%recoverInterval
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainStartTime % mapID, startTime)
|
| | | GameWorld.DebugLog(' 封魔坛恢复次数%s, passTime=%s, needTime=%s'%(recoverCnt, passTime, needTime))
|
| | | Sync_FBPlayerFBInfoData(curPlayer, mapID)
|
| | | NotifyFBCntRegainInfo(curPlayer)
|
| | | curTime = int(time.time())
|
| | | fbIpyData = GetFBIpyData(mapID)
|
| | | maxFreeTimes = fbIpyData.GetDayTimes() # 常规封顶次数
|
| | | enterCnt = GetEnterFBCount(curPlayer, mapID) # 已经进入次数
|
| | | maxCnt = GetEnterFBMaxCnt(curPlayer, mapID) # 当前可用最大次数
|
| | | remainCanEnterCnt = maxCnt - enterCnt # 剩余可进入次数
|
| | | regainStartTime = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FbCntRegainStartTime % mapID)
|
| | | passTime = curTime - regainStartTime
|
| | | # 到达常规次数上限,暂时恢复时间
|
| | | if remainCanEnterCnt >= maxFreeTimes:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainStartTime % mapID, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainTotalTime % mapID, 0)
|
| | | GameWorld.DebugLog("副本时间恢复次数已达常规次数!")
|
| | | elif passTime < recoverInterval:
|
| | | pass
|
| | | #GameWorld.DebugLog("副本时间恢复次数还未到达恢复CD!")
|
| | | else:
|
| | | if not regainStartTime:
|
| | | updRegainTotalTime = recoverInterval
|
| | | else:
|
| | | updRegainTotalTime = recoverInterval - passTime % recoverInterval
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainStartTime % mapID, curTime)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainTotalTime % mapID, updRegainTotalTime)
|
| | | GameWorld.DebugLog("副本还可按时间恢复次数!curTime=%s,regainStartTime=%s,passTime=%s,updRegainTotalTime=%s" |
| | | % (curTime, regainStartTime, passTime, updRegainTotalTime))
|
| | | NotifyFBCntRegainInfo(curPlayer, [mapID])
|
| | | return
|
| | |
|
| | | def NotifyFBCntRegainInfo(curPlayer):
|
| | | ##通知副本次数恢复剩余时间
|
| | | curTime = int(time.time())
|
| | | recoverInterval = IpyGameDataPY.GetFuncCfg('FBCntRegainInterval')
|
| | | def RegainFBCntProcess(curPlayer):
|
| | | ## 按时间恢复副本次数
|
| | |
|
| | | regainData = ChPyNetSendPack.tagMCFBCntRegainRemainTime()
|
| | | regainData.Clear()
|
| | | regainData.InfoList = []
|
| | | for mapID in [ChConfig.Def_FBMapID_SealDemon]:
|
| | | curTime = int(time.time())
|
| | | recoverIntervalDict = IpyGameDataPY.GetFuncEvalCfg('FBCntRegainInterval', 1)
|
| | | for mapIDStr, recoverInfo in recoverIntervalDict.items():
|
| | | mapID = int(mapIDStr)
|
| | | maxCanRecoverCnt, recoverInterval = recoverInfo
|
| | | curRegainFbCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_RegainFbCnt % mapID) # 当前已恢复次数
|
| | | if maxCanRecoverCnt and curRegainFbCnt >= maxCanRecoverCnt:
|
| | | #GameWorld.DebugLog("已到达副本恢复次数上限!mapID=%s,curRegainFbCnt(%s) >= maxCanRecoverCnt(%s)" % (mapID, curRegainFbCnt, maxCanRecoverCnt))
|
| | | continue
|
| | | fbIpyData = GetFBIpyData(mapID)
|
| | | maxFreeTimes = fbIpyData.GetDayTimes() # 常规封顶次数
|
| | | enterCnt = GetEnterFBCount(curPlayer, mapID) # 已经进入次数
|
| | | maxCnt = GetEnterFBMaxCnt(curPlayer, mapID) # 当前可用最大次数
|
| | | remainCanEnterCnt = maxCnt - enterCnt # 剩余可进入次数
|
| | | if remainCanEnterCnt >= maxFreeTimes:
|
| | | #GameWorld.DebugLog("可进入次数已经到达常规封顶次数!mapID=%s,remainCanEnterCnt=%s" % (mapID, remainCanEnterCnt))
|
| | | continue
|
| | | regainStartTime = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FbCntRegainStartTime % mapID)
|
| | | if not regainStartTime:
|
| | | #GameWorld.DebugLog("还未设置副本恢复次数倒计时!mapID=%s" % mapID)
|
| | | continue
|
| | | needTime = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FbCntRegainTotalTime % mapID)
|
| | | passTime = curTime - regainStartTime
|
| | | if passTime < needTime:
|
| | | continue
|
| | | remainTime = passTime - needTime # 扣除恢复单次后剩余的时间,离线上线后可能一次性恢复多次
|
| | | recoverCnt = 1 + remainTime / recoverInterval # 倒计时时间可恢复总次数
|
| | | realRecoverCnt = min(maxFreeTimes - remainCanEnterCnt, recoverCnt) # 实际最大可恢复总次数
|
| | | if maxCanRecoverCnt:
|
| | | realRecoverCnt = min(realRecoverCnt, maxCanRecoverCnt - curRegainFbCnt)
|
| | | if realRecoverCnt <= 0:
|
| | | continue
|
| | | |
| | | # 更新时间倒计时已恢复次数
|
| | | updRegainFbCnt = curRegainFbCnt + realRecoverCnt
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_RegainFbCnt % mapID, updRegainFbCnt)
|
| | | |
| | | OnFBCountChangeEffectRecoverCount(curPlayer, mapID)
|
| | | |
| | | return
|
| | |
|
| | | def NotifyFBCntRegainInfo(curPlayer, syncMapIDList=[]):
|
| | | ##通知副本次数恢复剩余时间
|
| | | recoverIntervalDict = IpyGameDataPY.GetFuncEvalCfg('FBCntRegainInterval', 1) # {mapID:[次数, 每次间隔], ...}
|
| | | if not recoverIntervalDict:
|
| | | return
|
| | | if not syncMapIDList:
|
| | | syncMapIDList = [int(mapIDStr) for mapIDStr in recoverIntervalDict.keys()]
|
| | | |
| | | infoList = []
|
| | | curTime = int(time.time())
|
| | | for mapID in syncMapIDList:
|
| | | if str(mapID) not in recoverIntervalDict:
|
| | | continue
|
| | | mapInfo = ChPyNetSendPack.tagMCFBCntRegain()
|
| | | mapInfo.Clear()
|
| | | mapInfo.DataMapID = mapID
|
| | | lastRegainTime = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FbCntRegainStartTime % mapID)
|
| | | needTime = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FbCntRegainTotalTime % mapID)
|
| | | if not needTime:
|
| | | needTime = recoverInterval
|
| | | passTime = curTime - lastRegainTime
|
| | | |
| | | if passTime >= needTime:
|
| | | continue
|
| | | mapInfo.RemainTime = needTime - passTime
|
| | | regainData.InfoList.append(mapInfo)
|
| | | if not regainData.InfoList:
|
| | | mapInfo.RemainTime = max(0, needTime - passTime)
|
| | | mapInfo.RegainCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_RegainFbCnt % mapID)
|
| | | infoList.append(mapInfo)
|
| | | if not infoList:
|
| | | return
|
| | | regainData = ChPyNetSendPack.tagMCFBCntRegainRemainTime()
|
| | | regainData.Clear()
|
| | | regainData.InfoList = infoList
|
| | | regainData.Cnt = len(regainData.InfoList)
|
| | | NetPackCommon.SendFakePack(curPlayer, regainData)
|
| | | return
|
| | |
| | | itemAddCntKey = ChConfig.Def_Player_Dict_ItemAddFbCnt % mapID
|
| | | itemAddCnt = curPlayer.NomalDictGetProperty(itemAddCntKey)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, itemAddCntKey, 0)
|
| | | |
| | | GameWorld.DebugLog(" 重置:mapID=%s,dayTimes=%s,buyCnt=%s,recoverCnt=%s,itemAddCnt=%s,maxCnt=%s,enterCnt=%s" |
| | | % (mapID, dayTimes, buyCnt, recoverCnt, itemAddCnt, maxCnt, enterCnt))
|
| | | # 按时间CD恢复次数类型的副本特殊处理,重置时间点不会重置,需要保持当前剩余次数不变, 如: 封魔坛
|
| | | 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:
|
| | | |
| | | # 时间恢复次数
|
| | | regainFBCntKey = ChConfig.Def_Player_Dict_RegainFbCnt % mapID
|
| | | regainFBCnt = curPlayer.NomalDictGetProperty(regainFBCntKey)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, regainFBCntKey, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainStartTime % mapID, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainTotalTime % mapID, 0)
|
| | | |
| | | GameWorld.DebugLog(" 重置:mapID=%s,dayTimes=%s,buyCnt=%s,recoverCnt=%s,itemAddCnt=%s,regainFBCnt=%s,maxCnt=%s,enterCnt=%s" |
| | | % (mapID, dayTimes, buyCnt, recoverCnt, itemAddCnt, regainFBCnt, maxCnt, enterCnt))
|
| | | if mapID == ChConfig.Def_FBMapID_ZhuXianBoss:
|
| | | if GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_ZhuXianBoss):
|
| | | curCnt = min(maxCnt - enterCnt + IpyGameDataPY.GetFuncCfg('ZhuXianBossCntCfg'), IpyGameDataPY.GetFuncCfg('ZhuXianBossCntCfg', 2))
|
| | | if curCnt > dayTimes:
|
| | |
| | | if mapIDInfo:
|
| | | Sync_FBPlayerFBInfoData(curPlayer, mapIDInfo)
|
| | | Sync_FBPlayerFBBuyCount(curPlayer, mapIDInfo)
|
| | | NotifyFBCntRegainInfo(curPlayer, mapIDInfo)
|
| | |
|
| | | return
|
| | |
|
| | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_BuyFbCntDay % mapID, hasBuyCnt + 1)
|
| | | Sync_FBPlayerFBBuyCount(curPlayer, [mapID])
|
| | | PlayerControl.NotifyCode(curPlayer, 'FBEnterTimeBuy', [mapID])
|
| | | lastRegainTime= curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FbCntRegainStartTime % mapID)
|
| | | if lastRegainTime:
|
| | | maxCnt = GetEnterFBMaxCnt(curPlayer, mapID)
|
| | | if maxCnt - enterCnt == maxDayTimes:
|
| | | curTime = int(time.time())
|
| | | needTime = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FbCntRegainTotalTime % mapID)
|
| | | if not needTime:
|
| | | needTime = IpyGameDataPY.GetFuncCfg('FBCntRegainInterval')
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainTotalTime % mapID, needTime - (curTime-lastRegainTime))
|
| | | NotifyFBCntRegainInfo(curPlayer)
|
| | | OnFBCountChangeEffectRecoverCount(curPlayer, mapID)
|
| | | return
|
| | |
|
| | | def DoFuncOpen_RunDaily(curPlayer): return EventReport.WriteFuncCMEAcceptable(curPlayer, ShareDefine.GameFuncID_RunDaily)
|
| | |
| | | import FBCommon
|
| | | import PlayerControl
|
| | | import ChConfig
|
| | | import IpyGameDataPY
|
| | | import time
|
| | |
|
| | | def BatchUseItem(curPlayer, curRoleItem, tick, useCnt, exData):
|
| | | ##批量使用物品
|
| | |
| | | curEff = curRoleItem.GetEffectByIndex(0)
|
| | | mapID = curEff.GetEffectValue(0)
|
| | | mapID = FBCommon.GetRecordMapID(mapID)
|
| | | oldMaxCnt = FBCommon.GetEnterFBMaxCnt(curPlayer, mapID)
|
| | | itemAddCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ItemAddFbCnt % mapID)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_ItemAddFbCnt % mapID, itemAddCnt+useCnt)
|
| | |
|
| | |
| | | FBCommon.Sync_FBPlayerFBInfoData(curPlayer, mapID)
|
| | | PlayerControl.NotifyCode(curPlayer, 'AddActivityCount_1', [itemTypeID, mapID, useCnt])
|
| | |
|
| | | #封魔坛次数超过上限时要记录倒计时剩余时间
|
| | | lastRegainTime = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FbCntRegainStartTime % mapID)
|
| | | if lastRegainTime:
|
| | | ipyData = FBCommon.GetFBIpyData(mapID)
|
| | | if ipyData:
|
| | | maxDayTimes = ipyData.GetDayTimes()
|
| | | enterCnt = FBCommon.GetEnterFBCount(curPlayer, mapID)
|
| | | if oldMaxCnt - enterCnt < maxDayTimes and oldMaxCnt - enterCnt + useCnt >= maxDayTimes:
|
| | | curTime = int(time.time())
|
| | | needTime = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FbCntRegainTotalTime % mapID)
|
| | | if not needTime:
|
| | | needTime = IpyGameDataPY.GetFuncCfg('FBCntRegainInterval')
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FbCntRegainTotalTime % mapID, needTime - (curTime-lastRegainTime))
|
| | | FBCommon.NotifyFBCntRegainInfo(curPlayer)
|
| | | FBCommon.OnFBCountChangeEffectRecoverCount(curPlayer, mapID)
|
| | | return True, useCnt
|
| | |
|
| | |
| | | playerLV = curPlayer.GetLV()
|
| | | if playerLV <= 1: #刚创角不增加次数
|
| | | return
|
| | | RecoverMaxDay = 2 # 最多可找回X天总次数
|
| | | lostOnDayNum = __GetLastRecoverPastDay(curPlayer)
|
| | | lostOnDayNum = max(0, lostOnDayNum - 1)
|
| | | GameWorld.DebugLog(' 增加可找回次数 lostOnDayNum=%s'%lostOnDayNum)
|
| | |
| | | continue
|
| | |
|
| | | remainInfo, limitInfo = FBCommon.GetFBDetailCntInfo(curPlayer, dataMapID)
|
| | | rCommonCnt, rExtraCnt, rBuyCnt, rItemAddCnt, noBuyCnt = remainInfo
|
| | | rCommonCntlimit, rExtraCntlimit, rBuyCntlimit, rItemAddCntlimit, noBuyCntlimit = limitInfo
|
| | | rCommonCnt, rRegainFbCnt, rExtraCnt, rBuyCnt, rItemAddCnt, noBuyCnt = remainInfo
|
| | | rCommonCntlimit, rRegainFbCntLimit, rExtraCntlimit, rBuyCntlimit, rItemAddCntlimit, noBuyCntlimit = limitInfo
|
| | | if max(remainInfo) == 0 and not lostOnDayNum:
|
| | | continue
|
| | | #限时活动判断当天是否有开启
|
| | |
| | | else:
|
| | | addCommonCnt = rCommonCnt + lostOnDayNum * rCommonCntlimit
|
| | |
|
| | | addRegainCnt = rRegainFbCnt + lostOnDayNum * rRegainFbCntLimit
|
| | | addExtraCnt = rExtraCnt + lostOnDayNum * rExtraCntlimit
|
| | | addBuyCnt = rBuyCnt
|
| | | addItemAddCnt = rItemAddCnt #使用物品增加的次数
|
| | | addnoBuyCnt = noBuyCnt + lostOnDayNum * noBuyCntlimit
|
| | | |
| | |
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RecoverGainData % index, historyMaxLine)
|
| | | if dataMapID == ChConfig.Def_FBMapID_MunekadoTrial:
|
| | |
| | |
|
| | | #更新可找回次数
|
| | | curCommonCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RecoverFBCommonCnt % index, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RecoverFBCommonCnt % index,
|
| | | min(addCommonCnt + curCommonCnt, rCommonCntlimit * 2))
|
| | | addCommonCnt = min(addCommonCnt + curCommonCnt, rCommonCntlimit * RecoverMaxDay)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RecoverFBCommonCnt % index, addCommonCnt)
|
| | | |
| | | curRegainCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RecoverFBRegainCnt % index, 0)
|
| | | addRegainCnt = min(addRegainCnt + curRegainCnt, rRegainFbCntLimit * RecoverMaxDay)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RecoverFBRegainCnt % index, addRegainCnt)
|
| | | |
| | | curExtraCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RecoverFBExtraCnt % index, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RecoverFBExtraCnt % index,
|
| | | min(addExtraCnt + curExtraCnt, rExtraCntlimit * 2))
|
| | | addExtraCnt = min(addExtraCnt + curExtraCnt, rExtraCntlimit * RecoverMaxDay)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RecoverFBExtraCnt % index, addExtraCnt)
|
| | | |
| | | curBuyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RecoverFBBuyCnt % index, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RecoverFBBuyCnt % index,
|
| | | min(addBuyCnt + curBuyCnt, rBuyCntlimit * 2))
|
| | | addBuyCnt = min(addBuyCnt + curBuyCnt, rBuyCntlimit * RecoverMaxDay)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RecoverFBBuyCnt % index, addBuyCnt)
|
| | | |
| | | curItemAddCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RecoverFBItemAddCnt % index, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RecoverFBItemAddCnt % index,
|
| | | min(addItemAddCnt + curItemAddCnt, rItemAddCntlimit * 2))
|
| | | addItemAddCnt = min(addItemAddCnt + curItemAddCnt, rItemAddCntlimit * RecoverMaxDay)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RecoverFBItemAddCnt % index, addItemAddCnt)
|
| | | |
| | | curnoBuyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RecoverFBNoBuyCnt % index, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RecoverFBNoBuyCnt % index,
|
| | | min(addnoBuyCnt + curnoBuyCnt, noBuyCntlimit * 2))
|
| | | GameWorld.DebugLog('增加找回次数index=%s,addCommonCnt=%s,addExtraCnt=%s,addBuyCnt=%s,addItemAddCnt=%s,addnoBuyCnt=%s'
|
| | | % (index, addCommonCnt, addExtraCnt, addBuyCnt, addItemAddCnt, addnoBuyCnt))
|
| | | addnoBuyCnt = min(addnoBuyCnt + curnoBuyCnt, noBuyCntlimit * RecoverMaxDay)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RecoverFBNoBuyCnt % index, addnoBuyCnt)
|
| | | |
| | | GameWorld.DebugLog('增加找回次数index=%s,addCommonCnt=%s,addRegainCnt=%s,addExtraCnt=%s,addBuyCnt=%s,addItemAddCnt=%s,addnoBuyCnt=%s'
|
| | | % (index, addCommonCnt, addRegainCnt, addExtraCnt, addBuyCnt, addItemAddCnt, addnoBuyCnt))
|
| | |
|
| | |
|
| | | recoverNumList.append(index)
|
| | |
| | | elif dailyID is ShareDefine.DailyActionID_WorldBOSS:
|
| | | canKillCnt, dayTimesLimit = BossHurtMng.GetCanKillBossCnt(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) + lostOnDay * dayTimesLimit
|
| | |
| | | continue
|
| | | curCommonCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RecoverFBCommonCnt % index, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RecoverFBCommonCnt % index,
|
| | | min(addCommonCnt + curCommonCnt, dayTimesLimit * 2))
|
| | | min(addCommonCnt + curCommonCnt, dayTimesLimit * RecoverMaxDay))
|
| | | recoverNumList.append(index)
|
| | | GameWorld.DebugLog('增加找回次数index=%s,addCommonCnt=%s'
|
| | | % (index, addCommonCnt))
|
| | |
| | | def __GetCanRecoverCnt(curPlayer, index):
|
| | | #获取可找回普通次数,vip次数
|
| | | curCommonCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RecoverFBCommonCnt % index, 0)
|
| | | curRegainCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RecoverFBRegainCnt % index, 0)
|
| | | curExtraCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RecoverFBExtraCnt % index, 0)
|
| | | curBuyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RecoverFBBuyCnt % index, 0)
|
| | | curItemAddCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RecoverFBItemAddCnt % index, 0)
|
| | | curnoBuyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RecoverFBNoBuyCnt % index, 0)
|
| | | return curCommonCnt + curExtraCnt + curBuyCnt + curItemAddCnt, curnoBuyCnt
|
| | | return curCommonCnt + curRegainCnt + curExtraCnt + curBuyCnt + curItemAddCnt, curnoBuyCnt
|
| | |
|
| | | def __SetRecoverNum(curPlayer, recoverCntDict):
|
| | | #更新找回次数
|
| | | #每日刷新次数>Vip买回来没用的次数>卷轴加的没用的次数>Vip额外次数>Vip可购买但未买次数
|
| | |
|
| | | #每日刷新次数>Vip买回来没用的次数>卷轴加的没用的次数>每日恢复次数>Vip额外次数>Vip可购买但未买次数
|
| | | |
| | | for index, recoverCnt in recoverCntDict.items():
|
| | | curCommonCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RecoverFBCommonCnt % index, 0)
|
| | | curRegainCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RecoverFBRegainCnt % index, 0)
|
| | | curExtraCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RecoverFBExtraCnt % index, 0)
|
| | | curBuyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RecoverFBBuyCnt % index, 0)
|
| | | curItemAddCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RecoverFBItemAddCnt % index, 0)
|
| | | curnoBuyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RecoverFBNoBuyCnt % index, 0)
|
| | | cntList = [curCommonCnt, curBuyCnt, curItemAddCnt, curExtraCnt, curnoBuyCnt]
|
| | | cntList = [curCommonCnt, curBuyCnt, curItemAddCnt, curRegainCnt, curExtraCnt, curnoBuyCnt]
|
| | | newCntList = copy.deepcopy(cntList)
|
| | |
|
| | | sumCnt = 0
|
| | |
| | | newCntList[i] = max(0, sumCnt - recoverCnt)
|
| | | if recoverCnt <= sumCnt:
|
| | | break
|
| | | newCommonCnt,newBuyCnt,newItemAddCnt,newExtraCnt,newnoBuyCnt = newCntList
|
| | | |
| | | newCommonCnt, newBuyCnt, newItemAddCnt, newRegainCnt, newExtraCnt, newnoBuyCnt = newCntList
|
| | | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RecoverFBCommonCnt % index, newCommonCnt)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RecoverFBRegainCnt % index, newRegainCnt)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RecoverFBBuyCnt % index, newBuyCnt)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RecoverFBItemAddCnt % index, newItemAddCnt)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RecoverFBExtraCnt % index, newExtraCnt)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RecoverFBNoBuyCnt % index, newnoBuyCnt)
|
| | | GameWorld.DebugLog("资源找回次数: index=%s,recoverCnt=%s" % (index, recoverCnt))
|
| | | GameWorld.DebugLog(" curCommonCnt=%s,curBuyCnt=%s,curItemAddCnt=%s,curRegainCnt=%s,curExtraCnt=%s,curnoBuyCnt=%s" |
| | | % (curCommonCnt, curBuyCnt, curItemAddCnt, curRegainCnt, curExtraCnt, curnoBuyCnt))
|
| | | GameWorld.DebugLog(" newCommonCnt=%s,newBuyCnt=%s,newItemAddCnt=%s,newRegainCnt=%s,newExtraCnt=%s,newnoBuyCnt=%s" |
| | | % (newCommonCnt, newBuyCnt, newItemAddCnt, newRegainCnt, newExtraCnt, newnoBuyCnt))
|
| | | if index != Def_TJGRecoverID:
|
| | | #1:找回了普通 2:找回了vip 3:2个都有找回
|
| | | recoverData = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HaveRecover % index, 0)
|
| | |
| | | elif recoverData == 0:
|
| | | updData = 1
|
| | | else:
|
| | | if max(curCommonCnt, curBuyCnt, curItemAddCnt, curExtraCnt) == 0:
|
| | | if max(curCommonCnt, curBuyCnt, curItemAddCnt, curRegainCnt, curExtraCnt) == 0:
|
| | | if recoverData == 0:
|
| | | updData = 2
|
| | | elif recoverData == 1:
|