| | |
| | |
|
| | | import time
|
| | |
|
| | | def __TransferPlayerInvestDBKey(curPlayer):
|
| | | ## 转换玩家存储字典,换key名
|
| | | |
| | | # 旧版key
|
| | | # 投资理财 Def_PDictType_GoldInvest
|
| | | Def_PDict_GoldInvest_Time = "Invest_Time_%s" # 投资时的时间,参数为投资类型
|
| | | #Def_PDict_GoldInvest_Gold = "Invest_Gold_%s" # 投资的额度,参数为投资类型 标记是否已投资,可用投资时间即可,不处理
|
| | | #Def_PDict_GoldInvest_AwardData = "Invest_AwardData_%s" # 投资时的数据,参数为投资类型 默认1,无用,可不管
|
| | | Def_PDict_GoldInvest_GotRewardValue = "Invest_GotRewardValue_%s_%s" # 等级回报已领取数值,参数为投资类型 索引
|
| | | |
| | | playerID = curPlayer.GetPlayerID()
|
| | | for investType in [ChConfig.InvestType_NewMonth, ChConfig.InvestType_Month1]:
|
| | | investTimeKeyOld = Def_PDict_GoldInvest_Time % investType
|
| | | investTime = curPlayer.NomalDictGetProperty(investTimeKeyOld, 0, ChConfig.Def_PDictType_GoldInvest)
|
| | | if not investTime:
|
| | | continue
|
| | | |
| | | investTimeKeyNew = ChConfig.Def_PDict_InvestTime % investType
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, investTimeKeyNew, investTime)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, investTimeKeyOld, 0, ChConfig.Def_PDictType_GoldInvest)
|
| | | GameWorld.Log("转换投资key: investType=%s,investTimeKeyNew=%s,investTime=%s,investTimeKeyOld=%s" |
| | | % (investType, investTimeKeyNew, investTime, investTimeKeyOld), playerID)
|
| | | |
| | | maxDay = __GetInvestMaxDays(investType)
|
| | | for i in xrange(1, maxDay + 1):
|
| | | rewardKeyOld = Def_PDict_GoldInvest_GotRewardValue % (investType, i)
|
| | | reward = curPlayer.NomalDictGetProperty(rewardKeyOld, 0, ChConfig.Def_PDictType_GoldInvest)
|
| | | if not reward:
|
| | | continue
|
| | | |
| | | GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_InvestReward, i, 1, True, [investType])
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, rewardKeyOld, 0, ChConfig.Def_PDictType_GoldInvest)
|
| | | GameWorld.Log(" 转换投资已领取记录: i=%s,rewardKeyOld=%s" % (i, rewardKeyOld), playerID)
|
| | | |
| | | return
|
| | |
|
| | | ## 登录
|
| | | def OnLogin(curPlayer):
|
| | | __TransferPlayerInvestDBKey(curPlayer)
|
| | | for investType in ChConfig.InvestTypeList:
|
| | | if not curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_InvestTime % investType):
|
| | | continue
|
| | |
| | |
|
| | | GameWorld.DebugLog("投资理财成功: investType=%s" % (investType))
|
| | | Sync_InvestInfo(curPlayer, investType)
|
| | | PlayerControl.Sync_ExpRateChange(curPlayer)
|
| | | return
|
| | |
|
| | | def __GetTotalGetGold(investType):
|
| | |
| | | addFBCnt += lifeCardAddCnt
|
| | | return addFBCnt
|
| | |
|
| | | def GetAddBossBuyCnt(curPlayer, bossFuncIndex):
|
| | | ## 获取增加的boss购买次数上限
|
| | | addBossBuyCnt = 0
|
| | | if GetInvestState(curPlayer, ChConfig.InvestType_Life):
|
| | | lifeCardAddBossCntDict = IpyGameDataPY.GetFuncEvalCfg("InvestPower", 4, {})
|
| | | lifeCardAddCnt = lifeCardAddBossCntDict.get(str(bossFuncIndex), 0)
|
| | | addBossBuyCnt += lifeCardAddCnt
|
| | | return addBossBuyCnt
|
| | |
|
| | | def GetAddFBBuyCnt(curPlayer, mapID):
|
| | | ## 获取增加的副本购买次数上限
|
| | | addFBBuyCnt = 0
|
| | | if GetInvestState(curPlayer, ChConfig.InvestType_Life):
|
| | | lifeCardAddFBCntDict = IpyGameDataPY.GetFuncEvalCfg("InvestPower", 5, {})
|
| | | lifeCardAddCnt = lifeCardAddFBCntDict.get(str(mapID), 0)
|
| | | addFBBuyCnt += lifeCardAddCnt
|
| | | return addFBBuyCnt
|
| | |
|
| | | def GetAddFightExpRate(curPlayer):
|
| | | ## 杀怪经验加成
|
| | | fightExpRate = 0
|
| | | if GetInvestState(curPlayer, ChConfig.InvestType_Life):
|
| | | fightExpRate += IpyGameDataPY.GetFuncCfg("InvestPower2", 1)
|
| | | return fightExpRate
|
| | |
|
| | | def CanQuickFinishMissionFree(curPlayer):
|
| | | ## 可否免费快速完成任务
|
| | | for investType in IpyGameDataPY.GetFuncEvalCfg("InvestPower", 3):
|