| | |
| | | return
|
| | |
|
| | | ## 登录
|
| | | def ShopItemOnLogin(curPlayer):
|
| | | if not GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_VersionFix, ChConfig.Def_VerFix_SuperGift):
|
| | | GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_VersionFix, ChConfig.Def_VerFix_SuperGift, 1)
|
| | | isGet = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldGiftFirstRecord)
|
| | | if isGet:#首充奖励已领取则代表超值礼包已开启过,
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SuperGiftHasOpen, 1)
|
| | | |
| | | |
| | | def ShopItemOnLogin(curPlayer): |
| | | SyncMysticalLimitShopInfo(curPlayer)
|
| | | SyncShopItemTodayBuyCount(curPlayer)
|
| | | SyncSuperGiftInfo(curPlayer)
|
| | | if not curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MysticalShopGoods % 0):
|
| | | __DoMysticalShopRefresh(curPlayer, True, GameWorld.GetGameWorld().GetTick())
|
| | | SyncMysticalShopInfo(curPlayer)
|
| | |
| | | # @return
|
| | | def ShopItemOnDay(curPlayer, onEventType):
|
| | | if onEventType == ShareDefine.Def_OnEventType:
|
| | | UpdataSuperGiftTime(curPlayer, True)
|
| | | OSSaleOpenMail(curPlayer)
|
| | | refreshType = [3]
|
| | | #神秘商店刷新次数重置
|
| | |
| | | diffTime = GameWorld.GetCurrentTime() - GameWorld.GetDateTimeByStr(createRoleTime, ChConfig.TYPE_Time_Format)
|
| | | pastSeconds = diffTime.days*24*60*60 + diffTime.seconds
|
| | | refreshTime = IpyGameDataPY.GetFuncCfg('MysteryShopRefresh', 4)
|
| | | if pastSeconds % refreshTime == 0:
|
| | | if refreshTime and pastSeconds % refreshTime == 0:
|
| | | __DoMysticalShopRefresh(curPlayer, True, tick)
|
| | | return
|
| | |
|
| | |
| | |
|
| | | def __DoMysticalShopRefresh(curPlayer, isFree, tick):
|
| | | global g_mysticalShopDict #{等级范围:[等级段,{金钱类型:库}]}
|
| | | |
| | | refreshTime = IpyGameDataPY.GetFuncCfg('MysteryShopRefresh', 4)
|
| | | if not refreshTime:
|
| | | return
|
| | |
|
| | | lastTime = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_MysticalShopLastTime)
|
| | | if lastTime and tick - lastTime < 1000:
|
| | | #GameWorld.DebugLog('神秘商店刷新,过于频繁!')
|
| | |
| | | lvRange = ipyData.GetLVRange()
|
| | | goodsID = ipyData.GetGoodsID()
|
| | | goodsIpyData = IpyGameDataPY.GetIpyGameData('Store', goodsID)
|
| | | if not goodsIpyData:
|
| | | continue
|
| | | moneyType = goodsIpyData.GetMoneyType()
|
| | | weight = goodsIpyData.GetLimitValue()
|
| | | lvkey = tuple(lvRange)
|
| | |
| | | g_mysticalShopDict[lvkey][1][moneyType] = []
|
| | | weightDict[moneyType] = weightDict.get(moneyType, 0) + weight
|
| | | g_mysticalShopDict[lvkey][1][moneyType].append([weightDict[moneyType], goodsID])
|
| | | |
| | | if not g_mysticalShopDict:
|
| | | return |
| | | playerLV = curPlayer.GetLV()
|
| | | curLVDan, shopDict = GameWorld.GetDictValueByRangeKey(g_mysticalShopDict, playerLV)
|
| | | if not shopDict:
|
| | |
| | |
|
| | | itemControl = ItemControler.PlayerItemControler(curPlayer)
|
| | | for itemID, itemCount, isBind in totalItemList:
|
| | | curItemObj = ItemControler.GetOutPutItemObj(itemID, itemCount, False)
|
| | | curItemObj = ItemControler.GetOutPutItemObj(itemID, itemCount, False, curPlayer=curPlayer)
|
| | | if not curItemObj:
|
| | | continue
|
| | | userData = curItemObj.GetUserData()
|
| | |
| | | return not PlayerFairyCeremony.IsCanBuyFireworks(curPlayer, itemIndex)
|
| | | if itemIndex in IpyGameDataPY.GetFuncEvalCfg('NewCeremonyFireParty', 1, {}).values():
|
| | | return not PlayerNewFairyCeremony.IsCanBuyFireworks(curPlayer, itemIndex)
|
| | | # if itemIndex in dict(IpyGameDataPY.GetFuncEvalCfg('SuperGiftTimeList')):
|
| | | # return not CheckSuperGiftBuy(curPlayer, itemIndex)
|
| | |
|
| | | if shopNPCID == 16:#神秘限购
|
| | | startTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ShopItemStartTime % itemIndex)
|
| | | curTime = int(time.time())
|
| | |
| | | PlayerControl.SendMailByKey('SellMail1', [curPlayer.GetID()], addItemList)
|
| | | return
|
| | |
|
| | | #超值礼包购买时间
|
| | | def UpdataSuperGiftTime(curPlayer, isOnday=False):
|
| | | curTime = int(time.time())
|
| | | if isOnday:
|
| | | startTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SuperGiftStartTime)
|
| | | if not startTime:
|
| | | return
|
| | | superGiftTimeList = IpyGameDataPY.GetFuncEvalCfg('SuperGiftTimeList')
|
| | | maxDay = max([info[1] for info in superGiftTimeList])
|
| | | if curTime - startTime >= maxDay * 86400:
|
| | | #活动结束 重置
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SuperGiftStartTime, 0)
|
| | | else:
|
| | | if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SuperGiftHasOpen):
|
| | | #老号已开启过超值礼包则不再开启
|
| | | return
|
| | | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SuperGiftStartTime, curTime)
|
| | | addItemList = IpyGameDataPY.GetFuncEvalCfg('SuperGiftTimeList', 2)
|
| | | PlayerControl.SendMailByKey('SellMail2', [curPlayer.GetID()], addItemList)
|
| | | SyncSuperGiftInfo(curPlayer)
|
| | | return True
|
| | |
|
| | | def SyncSuperGiftInfo(curPlayer):
|
| | | startTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SuperGiftStartTime)
|
| | | if not startTime:
|
| | | return
|
| | | packData = ChPyNetSendPack.tagMCSuperGiftInfo()
|
| | | packData.StartTime = startTime
|
| | | NetPackCommon.SendFakePack(curPlayer, packData)
|
| | | return
|
| | | def CheckSuperGiftBuy(curPlayer, giftID):
|
| | | #超值礼包是否可购买
|
| | | startTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SuperGiftStartTime)
|
| | | if not startTime:
|
| | | return
|
| | | |
| | | superGiftTimeDict = dict(IpyGameDataPY.GetFuncEvalCfg('SuperGiftTimeList'))
|
| | | totalDay = superGiftTimeDict.get(giftID, 0)
|
| | | if not totalDay:
|
| | | return
|
| | | curTime = int(time.time())
|
| | | if (curTime - startTime)/86400 >= totalDay:
|
| | | #已结束
|
| | | return
|
| | | return True
|
| | |
|
| | | ## 商店npcid
|
| | | # @param curPlayer 玩家实例
|