| | |
| | |
|
| | | 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
|