From 5cb668b8883cc0f8c8930a1d4ed3db632eae7abf Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期五, 10 一月 2020 16:04:29 +0800 Subject: [PATCH] 8368 【开发】开服排行榜活动修改(强化、坐骑改为战力榜;增加洗练战力榜26) --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGoldInvest.py | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 101 insertions(+), 6 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGoldInvest.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGoldInvest.py index ae2e1f0..0fbd2e6 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGoldInvest.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGoldInvest.py @@ -30,6 +30,7 @@ import PlayerFamilyRedPacket import time +import re ## 获取投资理财玩家数据库字典信息值 @@ -55,6 +56,8 @@ # @param curPlayer 玩家 # @return def OnLogin(curPlayer): + CheckOldInvestMail(curPlayer) + __CheckInvestReset(curPlayer) for iType in ChConfig.GoldInvestTypeList: Sync_GoldInvestInfo(curPlayer, iType) return @@ -64,6 +67,7 @@ # @param curPlayer 玩家 # @return def OnDay(curPlayer): + CheckOldInvestMail(curPlayer) #vip投资过了整个周期则重置 __CheckInvestReset(curPlayer) @@ -80,7 +84,7 @@ for investType in ChConfig.CanRepeatInvestType: investGoldRecord = __GetPDictValue(curPlayer, ChConfig.Def_PDict_GoldInvest_Gold % investType) if not investGoldRecord: - return + continue curDay = __GetInvestCurDay(curPlayer, investType) investMaxDayDict = IpyGameDataPY.GetFuncEvalCfg('InvestMaxDay') maxDay = investMaxDayDict.get(str(investType), 0) @@ -91,6 +95,82 @@ __SetPDictValue(curPlayer, ChConfig.Def_PDict_GoldInvest_GotRewardValue % (investType, i), 0) Sync_GoldInvestInfo(curPlayer, investType, isForce=True) return + +def CheckOldInvestMail(curPlayer): + ## 老号旧投资邮件补偿 + investMaxDayDict = IpyGameDataPY.GetFuncEvalCfg('InvestMaxDay') + + for oldInvestType in [ChConfig.GoldInvestType_Month, ChConfig.GoldInvestType_Week]: + investGoldRecord = __GetPDictValue(curPlayer, ChConfig.Def_PDict_GoldInvest_Gold % oldInvestType) + if not investGoldRecord: + continue + curDay = __GetInvestCurDay(curPlayer, oldInvestType) + maxDay = investMaxDayDict.get(str(oldInvestType), 0) + hasGotGold, lostGold, notGetGold, notGetDays = 0, 0, 0, 0 #已领取,错过领取,未领取,还有几天可领 + for day in xrange(1, maxDay+1): + ipyData = IpyGameDataPY.GetIpyGameData('Invest', oldInvestType*100+day) + if not ipyData: + continue + rewardDict = ipyData.GetReward() + awardData = __GetPDictValue(curPlayer, ChConfig.Def_PDict_GoldInvest_AwardData % oldInvestType, 1) + if str(awardData) not in rewardDict: + GameWorld.DebugLog(' 旧投资邮件补偿, rewardDict=%s, 没有key=%s'%(rewardDict, awardData)) + continue + rewardList = rewardDict[str(awardData)] + gold = rewardList[0][1] + rewardRecord = __GetPDictValue(curPlayer, ChConfig.Def_PDict_GoldInvest_GotRewardValue % (oldInvestType, day)) + if rewardRecord: + hasGotGold += gold + elif day < curDay: + lostGold += gold + else: + notGetGold += gold + notGetDays += 1 + GameWorld.DebugLog('旧投资邮件补偿 oldInvestType=%s,hasGotGold=%s, lostGold=%s, notGetGold=%s,notGetDays=%s'% + (oldInvestType, hasGotGold, lostGold, notGetGold, notGetDays)) + if not notGetGold: + continue + if oldInvestType == ChConfig.GoldInvestType_Week: + PlayerControl.SendMailByKey('WeekCardMail', [curPlayer.GetID()], [], [notGetDays, notGetGold], notGetGold) + elif oldInvestType == ChConfig.GoldInvestType_Month: + newInvestType = ChConfig.GoldInvestType_NewMonth + newMaxDay = investMaxDayDict.get(str(newInvestType), 0) + newTotalGold = 0 + for day in xrange(1, newMaxDay+1): + ipyData = IpyGameDataPY.GetIpyGameData('Invest', newInvestType*100+day) + if not ipyData: + continue + rewardDict = ipyData.GetReward() + awardData = __GetPDictValue(curPlayer, ChConfig.Def_PDict_GoldInvest_AwardData % newInvestType, 1) + if str(awardData) not in rewardDict: + GameWorld.DebugLog(' 旧投资邮件补偿, rewardDict=%s, 没有key=%s'%(rewardDict, awardData)) + continue + rewardList = rewardDict[str(awardData)] + gold = rewardList[0][1] + newTotalGold+=gold + oldTotalGold = hasGotGold+ lostGold+notGetGold + giveGold = newTotalGold-oldTotalGold + notGetGold + if not giveGold: + continue + if lostGold: + paramList = [newTotalGold, oldTotalGold, hasGotGold, lostGold, notGetGold, notGetGold, newTotalGold-oldTotalGold] + else: + paramList = [newTotalGold, oldTotalGold, hasGotGold, notGetGold, notGetGold, newTotalGold-oldTotalGold] + PlayerControl.SendMailByKey('MonthCardMail2' if lostGold else 'MonthCardMail1', [curPlayer.GetID()], [], paramList, giveGold) + #重置数据 + valueKey = ChConfig.Def_PDict_GoldInvest_Time % oldInvestType + PlayerControl.NomalDictSetProperty(curPlayer, valueKey, 0, ChConfig.Def_PDictType_GoldInvest) + + valueKey = ChConfig.Def_PDict_GoldInvest_Gold % oldInvestType + PlayerControl.NomalDictSetProperty(curPlayer, valueKey, 0, ChConfig.Def_PDictType_GoldInvest) + + valueKey = ChConfig.Def_PDict_GoldInvest_AwardData % oldInvestType + PlayerControl.NomalDictSetProperty(curPlayer, valueKey, 0, ChConfig.Def_PDictType_GoldInvest) + for i in xrange(1, maxDay+1): + valueKey = ChConfig.Def_PDict_GoldInvest_GotRewardValue % (oldInvestType, i) + PlayerControl.NomalDictSetProperty(curPlayer, valueKey, 0, ChConfig.Def_PDictType_GoldInvest) + return + #// A5 40 投资理财 #tagCMGoldInvest # @@ -219,10 +299,10 @@ PlayerControl.WorldNotify(0, 'VIPInvestmentRadio', [curPlayer.GetName()]) elif investType in ChConfig.InvestGoldTypeList: PlayerControl.WorldNotify(0, 'JadeInvestmentRadio', [curPlayer.GetName(), investGold]) - elif investType == ChConfig.GoldInvestType_Month: - PlayerControl.WorldNotify(0, 'MonthInvestment', [curPlayer.GetName()]) - elif investType == ChConfig.GoldInvestType_Week: - PlayerControl.WorldNotify(0, 'WeekInPInvestment', [curPlayer.GetName()]) + elif investType == ChConfig.GoldInvestType_NewMonth: + PlayerControl.WorldNotify(0, 'MonthInvestment', [curPlayer.GetName(), __GetTotalGetGold(investType)]) + elif investType == ChConfig.GoldInvestType_Month1: + PlayerControl.WorldNotify(0, 'WeekInPInvestment', [curPlayer.GetName(), __GetTotalGetGold(investType)]) # 更新投资时时间,投资金额,重置回报记录 curTime = GameWorld.GetCurrentTime() @@ -247,7 +327,22 @@ GameWorld.DebugLog(" 投资成功!扣除钻石=%s" % deductGold) return - +def __GetTotalGetGold(investType): + investMaxDayDict = IpyGameDataPY.GetFuncEvalCfg('InvestMaxDay') + newMaxDay = investMaxDayDict.get(str(investType), 0) + newTotalGold = 0 + for day in xrange(1, newMaxDay+1): + ipyData = IpyGameDataPY.GetIpyGameData('Invest', investType*100+day) + if not ipyData: + continue + rewardDict = ipyData.GetReward() + awardData = 1 #__GetPDictValue(curPlayer, ChConfig.Def_PDict_GoldInvest_AwardData % newInvestType, 1) + if str(awardData) not in rewardDict: + continue + rewardList = rewardDict[str(awardData)] + gold = rewardList[0][1] + newTotalGold+=gold + return newTotalGold #// A5 41 领取投资理财回报 #tagCMGetInvestReward # -- Gitblit v1.8.0