10284 同步其他版本(修复查询离线玩家代币数值错误bug;优化GM命令ClearInvest、SetMoney;)
| | |
| | | if not msgList:
|
| | | GameWorld.DebugAnswer(curPlayer, "重置所有投资: ClearInvest 0")
|
| | | GameWorld.DebugAnswer(curPlayer, "重置指定投资: ClearInvest 类型")
|
| | | GameWorld.DebugAnswer(curPlayer, "激活指定投资: ClearInvest A 类型")
|
| | | GameWorld.DebugAnswer(curPlayer, "类型:7-永久卡;8-周卡;9-登录卡;10-等级卡;11-boss卡;;12-终身卡;")
|
| | | return
|
| | |
|
| | | investType = msgList[0]
|
| | | if not investType:
|
| | | investTypeList = ChConfig.InvestTypeList
|
| | | elif investType == "A":
|
| | | investType = msgList[1] if len(msgList) > 1 else 0
|
| | | if investType not in ChConfig.InvestTypeList:
|
| | | GameWorld.DebugAnswer(curPlayer, "不存在该投资类型!")
|
| | | return
|
| | | PlayerGoldInvest.__DoLogicInvest(curPlayer, investType)
|
| | | GameWorld.DebugAnswer(curPlayer, "激活投资: %s" % investType)
|
| | | return
|
| | | |
| | | elif investType not in ChConfig.InvestTypeList:
|
| | | GameWorld.DebugAnswer(curPlayer, "不存在该投资类型!")
|
| | | return
|
| | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_InvestReward % (itype, keyNum), 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_InvestProgress % (itype, keyNum), 0)
|
| | | PlayerGoldInvest.Sync_InvestInfo(curPlayer, itype)
|
| | | |
| | | return
|
| | |
|
| | |
| | | isOK = True
|
| | | if not isOK:
|
| | | GameWorld.DebugAnswer(curPlayer, "设置玩家货币失败,详见日志或流向")
|
| | | else:
|
| | | GameWorld.DebugAnswer(curPlayer, "设置%s%s=%s" % (moneyType, moneyNameDict.get(moneyType, moneyType), PlayerControl.GetMoneyReal(curPlayer, moneyType)))
|
| | |
|
| | | return
|
| | |
|
| | |
| | |
|
| | | 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
|
| | |
| | | # 需要额外同步的自定义货币
|
| | | CurrencyValueDict = {}
|
| | | for moneyType in [99]:
|
| | | CurrencyValueDict['PlayerCurrency_%s' % moneyType] = roleDict.get("PlayerCurrency_%s" % moneyType, 0)
|
| | | if moneyType == 99:
|
| | | moneyValue = dbPlayer.ExAttr11
|
| | | else:
|
| | | moneyValue = roleDict.get("PlayerCurrency_%s" % moneyType, 0)
|
| | | CurrencyValueDict['PlayerCurrency_%s' % moneyType] = moneyValue
|
| | | playerInfo.update(CurrencyValueDict)
|
| | | return GMCommon.Def_Success, playerInfo
|
| | |
|