| | |
| | | """Version = 2018-07-10 16:50"""
|
| | | #---------------------------------------------------------------------
|
| | |
|
| | | import IPY_GameWorld
|
| | | import GameWorld
|
| | | import ChConfig
|
| | | import IPY_GameWorld
|
| | | import IpyGameDataPY
|
| | | import ItemCommon
|
| | | import ChPyNetSendPack
|
| | | import PlayerControl
|
| | | import ItemControler
|
| | | import ChPyNetSendPack
|
| | | import NetPackCommon
|
| | |
|
| | | import time
|
| | |
| | | # @param curPlayer
|
| | | # @return None
|
| | | def OnLogin(curPlayer):
|
| | | openTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FreeGoodsOpenTime)
|
| | | if not openTime:
|
| | | return
|
| | | Sync_FreeGoodsInfo(curPlayer)
|
| | | return
|
| | |
|
| | |
| | | 若玩家在最后一个可领取返还仙玉倒计时结束的当天未领取仙玉,则在隔天凌晨5:00帮其把所有未领取仙玉领取通过邮件发放
|
| | | '''
|
| | | openTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FreeGoodsOpenTime)
|
| | | if not openTime:
|
| | | return
|
| | | curTimeNum = int(time.time())
|
| | | if curTimeNum - openTime <= IpyGameDataPY.GetFuncCfg('FreeGoodsOpenTime'):
|
| | | #GameWorld.DebugLog("极品白拿购买时间未到期,不处理!")
|
| | | return
|
| | | giveMoney = 0
|
| | | giveGoodsIDList = []
|
| | |
| | | goodsState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FreeGoodsBuyState % goodsID)
|
| | | if goodsState in [0, 1]:
|
| | | continue
|
| | | if curTimeNum - goodsState - ipyData.GetReturnTime() < 24*3600:
|
| | | buyTime = goodsState
|
| | | passDays = GameWorld.GetDiff_Day(curTimeNum, buyTime)
|
| | | if passDays <= ipyData.GetReturnDays():
|
| | | giveMoney = 0
|
| | | giveGoodsIDList = []
|
| | | #GameWorld.DebugLog(" 还有白拿奖励领奖时间未预期,不处理! goodsID=%s,passDays=%s" % (goodsID, passDays))
|
| | | break
|
| | | giveMoney += ipyData.GetNeedMoney()
|
| | | giveGoodsIDList.append(goodsID)
|
| | | if giveMoney:
|
| | | GameWorld.DebugLog(' 极品白拿帮领取返还 giveMoney=%s,giveGoodsIDList=%s'%(giveMoney, giveGoodsIDList), curPlayer.GetID())
|
| | | GameWorld.DebugLog(' 极品白拿邮件返还 giveMoney=%s,giveGoodsIDList=%s' % (giveMoney, giveGoodsIDList), curPlayer.GetID())
|
| | | for goodsID in giveGoodsIDList:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FreeGoodsBuyState % goodsID, 1)
|
| | | PlayerControl.SendMailByKey('WhiteTakeJade', [curPlayer.GetID()], [], [], giveMoney)
|
| | |
|
| | |
|
| | | Sync_FreeGoodsInfo(curPlayer)
|
| | | return
|
| | |
| | | goodsState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FreeGoodsBuyState % freeGoodsID)
|
| | | addDataDict = {"freeGoodsID":freeGoodsID}
|
| | | if goodsState == 1:
|
| | | GameWorld.DebugLog(' 极品白拿已领取该奖励!', curPlayer.GetID())
|
| | | return
|
| | | if goodsState != 0:
|
| | | #领取返还
|
| | | |
| | | if curTimeNum - goodsState < ipyData.GetReturnTime():
|
| | | GameWorld.DebugLog(' 极品白拿 未到返还时间!freeGoodsID=%s, passTime=%s' % (freeGoodsID, curTimeNum - goodsState), curPlayer.GetID())
|
| | | buyTime = goodsState
|
| | | passDays = GameWorld.GetDiff_Day(curTimeNum, buyTime)
|
| | | if passDays < ipyData.GetReturnDays():
|
| | | GameWorld.DebugLog(' 极品白拿 未到返还时间!freeGoodsID=%s, buyTime=%s, passDays=%s < %s' |
| | | % (freeGoodsID, GameWorld.ChangeTimeNumToStr(buyTime), passDays, ipyData.GetReturnDays()), curPlayer.GetID())
|
| | | return
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FreeGoodsBuyState % freeGoodsID, 1)
|
| | | returnMoney = ipyData.GetNeedMoney()
|
| | |
| | | #给物品
|
| | | awardItemDict = ipyData.GetAwardItem()
|
| | | awardItemList = awardItemDict.get(str(curPlayer.GetJob()), [])
|
| | | # 检查背包
|
| | | needSpace = len(awardItemList)
|
| | | packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)
|
| | | if needSpace > packSpace:
|
| | | PlayerControl.SendMailByKey('WhiteTakeBagFull', [curPlayer.GetID()], awardItemList, [freeGoodsID])
|
| | | else:
|
| | | # 给物品
|
| | | for itemID, itemCount, isBind in awardItemList:
|
| | | ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, 0, [IPY_GameWorld.rptItem])
|
| | | ItemControler.GivePlayerItemOrMail(curPlayer, awardItemList, "WhiteTakeBagFull", event=["FreeGoods", False, addDataDict])
|
| | |
|
| | | Sync_FreeGoodsInfo(curPlayer, [freeGoodsID])
|
| | | return
|
| | |
|
| | |
|
| | |
|
| | | def Sync_FreeGoodsInfo(curPlayer, freeGoodsIDList=[]):
|
| | | #通知极品白拿信息
|