From 789490b7d362160f7fca4580df6176498e1eb271 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期五, 15 十一月 2024 15:19:13 +0800 Subject: [PATCH] 10302 【越南】【英语】【砍树】【tqxbqy】【btgotq】仙缘-服务端 --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActBuyCountGift.py | 47 +++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 43 insertions(+), 4 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActBuyCountGift.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActBuyCountGift.py index 198b048..b58183b 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActBuyCountGift.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActBuyCountGift.py @@ -29,12 +29,17 @@ 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 @@ -56,10 +61,31 @@ 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 def RefreshBuyCountGiftActionInfo(actNum): @@ -85,6 +111,12 @@ 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: GameWorld.DebugLog("购买次数礼包活动ID不变,不处理! actNum=%s,cfgID=%s,actID=%s" % (actNum, cfgID, actID), curPlayer.GetPlayerID()) @@ -128,6 +160,8 @@ 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) @@ -187,14 +221,19 @@ 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() - startDateStr, endDateStr = GameWorld.GetOperationActionDateStr(ipyData) + 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() actInfo.ActNum = actNum -- Gitblit v1.8.0