| | |
| | | import GameWorld |
| | | import ChConfig |
| | | |
| | | def OnDay(curPlayer): |
| | | def OnDay(curPlayer, onEventType): |
| | | OnCheckRelateFuncAct(curPlayer) |
| | | if onEventType != ShareDefine.Def_OnEventType: |
| | | return |
| | | for actInfo in PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_BuyCountGift, {}).values(): |
| | | if not actInfo.get(ShareDefine.ActKey_State): |
| | | continue |
| | | actNum = actInfo.get(ShareDefine.ActKey_ActNum, 0) |
| | | cfgID = actInfo.get(ShareDefine.ActKey_CfgID, 0) |
| | | if not curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BuyCountGiftID % actNum): |
| | | continue |
| | | ipyData = IpyGameDataPY.GetIpyGameData("ActBuyCountGift", cfgID) |
| | | if not ipyData: |
| | | continue |
| | |
| | | actNum = actInfo.get(ShareDefine.ActKey_ActNum, 0) |
| | | isReset = __CheckPlayerBuyCountGiftAction(curPlayer, actNum) |
| | | # 活动中同步活动信息 |
| | | if not isReset and actInfo.get(ShareDefine.ActKey_State): |
| | | if not isReset and actInfo.get(ShareDefine.ActKey_State) and curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BuyCountGiftID % actNum): |
| | | Sync_BuyCountGiftActionInfo(curPlayer, actNum) |
| | | Sync_BuyCountGiftPlayerInfo(curPlayer, actNum) |
| | | |
| | | return |
| | | |
| | | def OnCheckRelateFuncAct(curPlayer, openFuncIDList=None): |
| | | ## 检查关联功能ID开启的活动 |
| | | for actInfo in PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_BuyCountGift, {}).values(): |
| | | if not actInfo.get(ShareDefine.ActKey_State): |
| | | continue |
| | | cfgID = actInfo.get(ShareDefine.ActKey_CfgID) |
| | | ipyData = IpyGameDataPY.GetIpyGameData("ActBuyCountGift", cfgID) |
| | | if not ipyData: |
| | | continue |
| | | if not hasattr(ipyData, "GetRelateFuncID"): |
| | | continue |
| | | relateFuncID = ipyData.GetRelateFuncID() |
| | | if not relateFuncID: |
| | | continue |
| | | if openFuncIDList and relateFuncID not in openFuncIDList: |
| | | continue |
| | | actNum = actInfo.get(ShareDefine.ActKey_ActNum, 0) |
| | | __CheckPlayerBuyCountGiftAction(curPlayer, actNum) |
| | | |
| | | return |
| | | |
| | |
| | | cfgID = actInfo.get(ShareDefine.ActKey_CfgID, 0) |
| | | |
| | | playerActID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BuyCountGiftID % actNum) # 玩家身上的活动ID |
| | | |
| | | funcActInfo = GameWorld.GetActRelateFuncInfo(curPlayer, "ActBuyCountGift", actInfo, playerActID) |
| | | if funcActInfo: |
| | | isInAct, actID = funcActInfo |
| | | if not isInAct: |
| | | return |
| | | |
| | | # 活动ID 相同的话不处理 |
| | | if actID == playerActID: |
| | |
| | | |
| | | if not actInfo.get(ShareDefine.ActKey_State): |
| | | GameWorld.DebugLog("购买次数礼包非活动中无法领取奖励! actNum=%s" % actNum, playerID) |
| | | return |
| | | if not curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BuyCountGiftID % actNum): |
| | | return |
| | | cfgID = actInfo.get(ShareDefine.ActKey_CfgID) |
| | | |
| | |
| | | actInfo = GameWorld.GetActInfo(ShareDefine.OperationActionName_BuyCountGift, actNum) |
| | | if not actInfo.get(ShareDefine.ActKey_State): |
| | | return |
| | | |
| | | playerActID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BuyCountGiftID % actNum) |
| | | if not playerActID: |
| | | return |
| | | cfgID = actInfo.get(ShareDefine.ActKey_CfgID) |
| | | ipyData = IpyGameDataPY.GetIpyGameData("ActBuyCountGift", cfgID) |
| | | if not ipyData: |
| | | return |
| | | CTGCountAwardInfo = ipyData.GetCTGCountAwardInfo() |
| | | |
| | | if hasattr(ipyData, "GetRelateFuncID") and ipyData.GetRelateFuncID(): |
| | | startDateStr, endDateStr = GameWorld.GetActRelateFuncDate(ipyData, playerActID, True) |
| | | else: |
| | | startDateStr, endDateStr = GameWorld.GetOperationActionDateStr(ipyData) |
| | | startDateSync = actInfo.get(ShareDefine.ActKey_StartDateSync, startDateStr) |
| | | actInfo = ChPyNetSendPack.tagMCActBuyCountGiftInfo() |