| | |
| | |
|
| | | import datetime
|
| | |
|
| | | def GetActNumDictType(actNum):
|
| | | '''获取活动分组编号对应的字典类型
|
| | | 因为本功能用了 ClearNomalDict 不同的活动分组必须不一样的字典类型,不能可能导致不同活动分组数据异常
|
| | | '''
|
| | | actType = actNum / 10
|
| | | if actType == ShareDefine.ActType_OpenComm:
|
| | | return ChConfig.Def_PDictType_FlashSale
|
| | | if actType == ShareDefine.ActType_MixServer:
|
| | | return ChConfig.Def_PDictType_FlashSaleMix
|
| | | if actType == ShareDefine.ActType_Feast:
|
| | | return ChConfig.Def_PDictType_FlashSaleFeast
|
| | | return 0
|
| | |
|
| | | def GetShopTypeList(cfgID, dayIndex, state, woldLV):
|
| | | if cfgID == 0 or state == 0:
|
| | |
| | | cfgID = actInfo.get(ShareDefine.ActKey_CfgID, 0)
|
| | | dayIndex = actInfo.get(ShareDefine.ActKey_DayIndex, 0)
|
| | | woldLV = actInfo.get(ShareDefine.ActKey_WorldLV, 0)
|
| | | playerActID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleID % actNum, 0, ChConfig.Def_PDictType_FlashSale) # 玩家身上的活动ID
|
| | | playerActState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleState % actNum, 0, ChConfig.Def_PDictType_FlashSale) # 玩家身上的活动State
|
| | | playerMailState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleMailState % actNum, 0, ChConfig.Def_PDictType_FlashSale) # 玩家身上的活动提醒邮件状态
|
| | | dType = GetActNumDictType(actNum)
|
| | | |
| | | playerActID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleID % actNum, 0, dType) # 玩家身上的活动ID
|
| | | playerActState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleState % actNum, 0, dType) # 玩家身上的活动State
|
| | | playerMailState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleMailState % actNum, 0, dType) # 玩家身上的活动提醒邮件状态
|
| | | isReset = False
|
| | | if actID != playerActID or (state != playerActState):
|
| | | isReset = True
|
| | |
| | | else:
|
| | | startTimeNum = 0
|
| | | if playerMailState != startTimeNum:
|
| | | GameWorld.DebugLog(' 限时抢购活动重置!')
|
| | | curPlayer.ClearNomalDict(ChConfig.Def_PDictType_FlashSale)
|
| | | |
| | | GameWorld.DebugLog(' 限时抢购活动重置! actNum=%s,dType=%s' % (actNum, dType), playerID)
|
| | | curPlayer.ClearNomalDict(dType)
|
| | | |
| | | shopTypeList = GetShopTypeList(cfgID, dayIndex, state, woldLV)
|
| | | if shopTypeList:
|
| | | FunctionNPCCommon.ResetShopItemBuyCountByShopType(curPlayer, shopTypeList)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FlashSaleID % actNum, actID, ChConfig.Def_PDictType_FlashSale)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FlashSaleState % actNum, state, ChConfig.Def_PDictType_FlashSale)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FlashSaleID % actNum, actID, dType)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FlashSaleState % actNum, state, dType)
|
| | | #Sync_flashSaleActionInfo(curPlayer)
|
| | | GameWorld.DebugLog("限时抢购单场重置! actNum=%s,actID=%s,playerActID=%s,dayIndex=%s,state=%s,playerActState=%s,shopTypeList=%s,playerMailState=%s" % (actNum, actID, playerActID, dayIndex, state, playerActState, shopTypeList,playerMailState), playerID)
|
| | | else:
|
| | |
| | | cfgID = actInfo.get(ShareDefine.ActKey_CfgID, 0)
|
| | | if not cfgID:
|
| | | continue
|
| | | playerMailState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleMailState % actNum, 0, ChConfig.Def_PDictType_FlashSale) # 玩家身上的活动提醒邮件状态
|
| | | dType = GetActNumDictType(actNum)
|
| | | playerMailState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleMailState % actNum, 0, dType) # 玩家身上的活动提醒邮件状态
|
| | | if playerMailState:
|
| | | continue
|
| | | flashSaleIpyData = IpyGameDataPY.GetIpyGameData("ActFlashSale", cfgID)
|
| | |
| | | paramList = [startDate.replace('-','/'), endDate.replace('-','/'), GameWorld.GbkToCode('、').join(startTimeList)]
|
| | | PlayerControl.SendMailByKey(mailKey, [curPlayer.GetID()], flashSaleIpyData.GetMailItemPrize(), paramList)
|
| | | startTimeNum = GameWorld.ChangeTimeStrToNum(startDate, timeFormat=ChConfig.TYPE_Time_Format_Day)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FlashSaleMailState % actNum, startTimeNum, ChConfig.Def_PDictType_FlashSale)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FlashSaleMailState % actNum, startTimeNum, dType)
|
| | | GameWorld.DebugLog(" 发送新限时抢购邮件提醒!", curPlayer.GetID())
|
| | | # else:
|
| | | # GameWorld.DebugLog(" 发送新限时抢购邮件提醒 时间没到!startTime=%s,endTime=%s,curDateTime=%s"%(startTime,endTime,curDateTime), curPlayer.GetID())
|
| | |
| | | cfgID = actInfo.get(ShareDefine.ActKey_CfgID, 0)
|
| | | if not cfgID:
|
| | | return
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FlashSaleYY % (actNum, goodsID), packData.State, ChConfig.Def_PDictType_FlashSale)
|
| | | dType = GetActNumDictType(actNum)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FlashSaleYY % (actNum, goodsID), packData.State, dType)
|
| | | Sync_FlashSaleAppointmentInfo(curPlayer, actNum, goodsID)
|
| | | return
|
| | |
|
| | |
| | | if not flashSaleIpyData:
|
| | | return
|
| | | woldLV = actInfo.get(ShareDefine.ActKey_WorldLV, 0)
|
| | | dType = GetActNumDictType(actNum)
|
| | |
|
| | | packInfo = ChPyNetSendPack.tagMCFlashSaleAppointmentInfo()
|
| | | packInfo.ActNum = actNum
|
| | |
| | | continue
|
| | | for i in xrange(len(shopItemIpyDataList)):
|
| | | goodsMark = dayIndex * 10000 + timeIndex * 100 + i #商品标识
|
| | | isAppointment = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleYY % (actNum, goodsMark), 0, ChConfig.Def_PDictType_FlashSale)
|
| | | isAppointment = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleYY % (actNum, goodsMark), 0, dType)
|
| | | if isAppointment:
|
| | | appoinetmentPack = ChPyNetSendPack.tagMCFlashSaleAppointmentState()
|
| | | appoinetmentPack.GoodsMark = goodsMark
|
| | |
| | | packInfo.GoodsList.append(appoinetmentPack)
|
| | | else:
|
| | | packInfo.IsAll = 0
|
| | | isAppointment = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleYY % (actNum, goodsID), 0, ChConfig.Def_PDictType_FlashSale)
|
| | | isAppointment = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleYY % (actNum, goodsID), 0, dType)
|
| | | appoinetmentPack = ChPyNetSendPack.tagMCFlashSaleAppointmentState()
|
| | | appoinetmentPack.GoodsMark = goodsID
|
| | | appoinetmentPack.State = isAppointment
|