| | |
| | | import GameFuncComm
|
| | | import PlayerTJG
|
| | | import PlayerActivity
|
| | | import PlayerSuccess
|
| | | import PyGameData
|
| | | import BossHurtMng
|
| | |
|
| | | import copy
|
| | | import datetime
|
| | |
| | | ) = range(2)
|
| | |
|
| | | Def_TJGRecoverID = 1 #脱机挂找回索引ID
|
| | |
|
| | | Def_QueenRelics = 11 #娲皇遗迹找回索引ID
|
| | | ## OnDay处理
|
| | | # @param curPlayer
|
| | | # @return None
|
| | |
| | | recoverNumList.append(index)
|
| | | elif dailyQuestData.GetRelatedType() == 1:#每日活动
|
| | | dailyID = dailyQuestData.GetRelatedID()
|
| | | lostOnDay = lostOnDayNum
|
| | | curDayTimes, dayTimesLimit = PlayerActivity.GetDailyActionFinishCnt(curPlayer, dailyID)
|
| | | if dailyID == ShareDefine.DailyActionID_Dice:#我要太极只分是否参加过,没参加过才能找回,次数算1次
|
| | | 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 = 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) + lostOnDayNum * dayTimesLimit
|
| | | addCommonCnt = (dayTimesLimit - curDayTimes) + lostOnDay * dayTimesLimit
|
| | | if addCommonCnt <=0:
|
| | | continue
|
| | | curCommonCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RecoverFBCommonCnt % index, 0)
|
| | |
| | |
|
| | | infoDict = {ChConfig.Def_Cost_Reason_SonKey:recoverWay}
|
| | | for moneyType, moneyCnt in costMoneyDict.items():
|
| | | PlayerControl.PayMoney(curPlayer, moneyType, moneyCnt, ChConfig.Def_Cost_RecoverGain, infoDict)
|
| | | costMoneyList = PlayerControl.HaveMoneyEx(curPlayer, moneyType, moneyCnt)
|
| | | GameWorld.DebugLog(' moneyType=%s,moneyCnt=%s,costMoneyList=%s'%(moneyType, moneyCnt, costMoneyList))
|
| | | if not costMoneyList:
|
| | | return
|
| | | for mType, mCnt in costMoneyList:
|
| | | PlayerControl.PayMoney(curPlayer, mType, mCnt, ChConfig.Def_Cost_RecoverGain, infoDict)
|
| | |
|
| | |
|
| | | if totalExp > 0:
|
| | |
| | |
|
| | | else:
|
| | | for itemID, itemCnt in totalItemDict.items():
|
| | | ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, 1, [IPY_GameWorld.rptItem, IPY_GameWorld.rptAnyWhere], True, showSysInfo=True)
|
| | | ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, 0, [IPY_GameWorld.rptItem, IPY_GameWorld.rptAnyWhere])
|
| | | if Def_TJGRecoverID in recoverCntDict:
|
| | | #脱机挂经验找回后重置
|
| | | PlayerTJG.ResetTJGDeadInfo(curPlayer)
|
| | | |
| | | if Def_QueenRelics in recoverCntDict:
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_QueenRelicsEx, recoverCntDict[Def_QueenRelics])
|
| | | DataRecordPack.DR_PlayerRecover(curPlayer, recoverWay, recoverCntDict, totalExp, totalMoney, totalSP, totalItemDict)
|
| | | __SetRecoverNum(curPlayer, recoverCntDict)
|
| | | __NotifyRecoverNum(curPlayer)
|
| | |
| | | costMoney = int(normalCostJade * recoverSecond / float(3600))
|
| | | else:
|
| | | costMoney = min(commonCnt, recoverCnt) * normalCostJade + vipCostJade * max(0, recoverCnt - commonCnt)
|
| | | costMoneyList = PlayerControl.HaveMoneyEx(curPlayer, ShareDefine.TYPE_Price_Gold_Paper_Money, costMoney)
|
| | | costMoneyList = [[ShareDefine.TYPE_Price_Gold_Paper_Money, costMoney]]
|
| | | else:
|
| | | costCopper = ipyData.GetCostCopper()
|
| | | if index == Def_TJGRecoverID:
|
| | | costMoney = int(costCopper * recoverSecond / float(3600))
|
| | | else:
|
| | | costMoney = recoverCnt * costCopper
|
| | | if PlayerControl.HaveMoney(curPlayer, IPY_GameWorld.TYPE_Price_Silver_Money, costMoney, False):
|
| | | costMoneyList = [[IPY_GameWorld.TYPE_Price_Silver_Money, costMoney]]
|
| | | else:
|
| | | costMoneyList = []
|
| | | |
| | | costMoneyList = [[IPY_GameWorld.TYPE_Price_Silver_Money, costMoney]]
|
| | | |
| | | return costMoneyList, recoverCnt
|
| | |
|
| | | def __GetCanRecoverCnt(curPlayer, index):
|
| | |
| | | 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)
|
| | | if max(newCommonCnt, newBuyCnt, newItemAddCnt, newExtraCnt, newnoBuyCnt) == 0 and index != Def_TJGRecoverID:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_HaveRecover % index, 1)
|
| | | if index != Def_TJGRecoverID:
|
| | | #1:找回了普通 2:找回了vip 3:2个都有找回 |
| | | recoverData = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HaveRecover % index, 0)
|
| | | updData = recoverData
|
| | | if i < len(cntList) -1:
|
| | | if recoverData == 2:
|
| | | updData = 3
|
| | | elif recoverData == 0:
|
| | | updData = 1
|
| | | else:
|
| | | if max(curCommonCnt, curBuyCnt, curItemAddCnt, curExtraCnt) == 0:
|
| | | if recoverData == 0:
|
| | | updData = 2
|
| | | elif recoverData == 1:
|
| | | updData = 3
|
| | | else:
|
| | | updData = 3
|
| | | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_HaveRecover % index, updData)
|
| | | |
| | |
|
| | | return
|
| | |
|
| | |
| | | reExp = PlayerControl.GetPlayerReExp(curPlayer)
|
| | | expRate = PlayerControl.GetLimitExpRate(curPlayer, ChConfig.ExpRateLimitType_Recover)
|
| | | extraData = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RecoverGainData % index, 0)
|
| | | extraData2 = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RecoverGainDataEx % index, 0)
|
| | | |
| | | dataEx = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RecoverGainDataEx % index, 0)
|
| | | realmLV = curPlayer.GetOfficialRank()
|
| | | tjgExp = 0 #脱机挂找回经验
|
| | | exp = 0
|
| | | sp = 0
|
| | |
| | |
|
| | | itemInfoList = awardDict.get("item", [])
|
| | | if itemInfoList:
|
| | | job = curPlayer.GetJob()
|
| | | jobItemList = ipyData.GetJobItemList()
|
| | | for itemInfo in itemInfoList:
|
| | | itemID = itemInfo.get('ItemID', 0)
|
| | | itemcntFormula = itemInfo.get('ItemCount', '')
|
| | |
| | | itemcnt = recoverCnt * eval(FormulaControl.GetCompileFormula('ResourcesBackitem%s_%s_%s' % (recoverWay, index, itemID), itemcntFormula))
|
| | | if not itemcnt:
|
| | | continue
|
| | | itemID = __GetJobItem(job, itemID, jobItemList)
|
| | | itemDict[itemID] = itemcnt
|
| | |
|
| | | return exp, sp, money, itemDict
|
| | |
|
| | | def __GetJobItem(job, itemID, jobItemList):
|
| | | ## 获取物品对应的职业物品, 职业从1开始
|
| | | for jobItemIDList in jobItemList:
|
| | | if type(jobItemIDList) not in [list, tuple]:
|
| | | GameWorld.ErrLog("资源找回职业物品组格式错误!itemID=%s,jobItemList=%s" % (itemID, jobItemList))
|
| | | return itemID
|
| | | if itemID in jobItemIDList:
|
| | | if job <= 0 or job > len(jobItemIDList):
|
| | | GameWorld.ErrLog("资源找回职业物品配置错误,没有该职业对应物品ID!itemID=%s,job=%s" % (itemID, job))
|
| | | return itemID
|
| | | return jobItemIDList[job - 1]
|
| | | return itemID
|
| | |
|
| | | ## 通知找回次数
|
| | | # @param curPlayer
|
| | |
| | | numInfoPack.Index = index
|
| | | numInfoPack.RecoverCnt = commonCnt
|
| | | numInfoPack.ExtraCnt = vipExtraCnt
|
| | | numInfoPack.HaveRecover = haveRecover
|
| | | numInfoPack.ExtraData = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RecoverGainData % index, 0)
|
| | | numInfoPack.ExtraData2 = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_RecoverGainDataEx % index, 0)
|
| | | sendPack.NumInfo.append(numInfoPack)
|