From bdbcaa4a377d15aacc88bbca9b0a6ff17b0456f8 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 18 十二月 2024 17:25:35 +0800
Subject: [PATCH] 10297 【越南】【英语】【砍树】【tqxbqy】轮回殿-服务端(活动结束邮件补发未领取奖励)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActLunhuidian.py |   72 +++++++++++++++++++++++++++++++++++-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py                   |    1 
 2 files changed, 71 insertions(+), 2 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index cfa0256..3799c0f 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -4196,6 +4196,7 @@
 
 #轮回殿活动
 Def_PDict_ActLunhuidianID = "ActLunhuidianID_%s"  # 玩家身上的活动ID,唯一标识,取活动开始日期time值,参数:(活动编号)
+Def_PDict_ActLunhuidianSet = "ActLunhuidianSet_%s_%s"  # 活动参与设定值,参数:(活动编号, 保存编号)
 Def_PDict_ActLunhuidianValue = "ActLunhuidianValue_%s_%s"  # 活动当前累计值,参数:(活动编号, 轮回类型)
 Def_PDict_ActLunhuidianRound = "ActLunhuidianRound_%s_%s"  # 活动当前轮次,参数:(活动编号, 轮回类型)
 Def_PDict_ActLunhuidianAward = "ActLunhuidianAward_%s_%s"  # 领奖记录,按奖励索引二进制记录是否已领取,参数:(活动编号, 轮回类型)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActLunhuidian.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActLunhuidian.py
index c1135d0..9bc3a02 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActLunhuidian.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActLunhuidian.py
@@ -85,7 +85,7 @@
         return
     GameWorld.DebugLog("轮回殿活动重置! actNum=%s,cfgID=%s,actID=%s,playerActID=%s,state=%s" 
                        % (actNum, cfgID, actID, playerActID, state), playerID)
-    
+    OnGiveUngetAward(curPlayer, actNum)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActLunhuidianID % actNum, actID)
     
     if state:
@@ -96,7 +96,8 @@
             ctgIDDict = ipyData.GetRoundCTGIDInfo()
             shopTypeDict = ipyData.GetRoundShopTypeInfo()
             resetCTGIDList, resetShopTypeList = [], []
-            for roundType in roundSetDict.keys():
+            for roundType, roundSet in roundSetDict.items():
+                SaveActRoundSet(curPlayer, actNum, roundType, roundSet)
                 PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActLunhuidianValue % (actNum, roundType), 0)
                 PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActLunhuidianRound % (actNum, roundType), 1) # 从第1轮开始
                 PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActLunhuidianAward % (actNum, roundType), 0)
@@ -111,6 +112,73 @@
             
     return True
 
+def SaveActRoundSet(curPlayer, actNum, roundType, roundSet):
+    ## 保存参与的活动轮回设定,用于活动结束邮件补发奖励
+    # 单次actNum活动最多支持同时开x个轮回类型,一般同个时间的轮回活动最多同时开2个或3个最多了
+    for num in range(20):
+        if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActLunhuidianSet % (actNum, num)):
+            continue
+        roundMax = GetRoundSetValue(roundSet, RoundSetIndex_RoundMax)
+        setValue = roundType * 100 + roundMax
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActLunhuidianSet % (actNum, num), setValue)
+        GameWorld.DebugLog("    保存轮回殿参与值! actNum=%s,roundType=%s,roundMax=%s,setValue=%s" 
+                           % (actNum, roundType, roundMax, setValue), curPlayer.GetPlayerID())
+        break
+    return
+
+def OnGiveUngetAward(curPlayer, actNum):
+    ## 补发未领取奖励
+    for num in range(20):
+        setValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActLunhuidianSet % (actNum, num))
+        if not setValue:
+            continue
+        __DoGiveUngetAwardByMail(curPlayer, actNum, setValue)
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActLunhuidianSet % (actNum, num), 0)                            
+    return
+
+def __DoGiveUngetAwardByMail(curPlayer, actNum, setValue):
+    playerID = curPlayer.GetPlayerID()
+    roundType = setValue / 100
+    roundMax = setValue % 100
+    curRound = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActLunhuidianRound % (actNum, roundType))
+    curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActLunhuidianValue % (actNum, roundType))
+    awardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActLunhuidianAward % (actNum, roundType))
+    awardIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActLunhuidianAward", roundType)
+    if not awardIpyDataList:
+        return
+    
+    mailItemList = []
+    doRound = curRound
+    doValue = curValue
+    doAwardState = awardState
+    while doValue > 0 and doRound <= roundMax:
+        GameWorld.DebugLog("处理补发轮回奖励: doRound=%s,doValue=%s,doAwardState=%s" % (doRound, doValue, doAwardState), playerID)
+        roundValueMax = 0
+        for awardIpyData in awardIpyDataList:
+            needV = awardIpyData.GetNeedValue()
+            aIndex = awardIpyData.GetAwardIndex()
+            awardItemList = awardIpyData.GetAwardItemList()
+            roundValueMax = max(roundValueMax, needV)
+            if doAwardState&pow(2, aIndex):
+                GameWorld.DebugLog("    已领取该奖励: doRound=%s,aIndex=%s,needV=%s" % (doRound, aIndex, needV), playerID)
+                continue
+            if doValue < needV:
+                GameWorld.DebugLog("    所需值不达标: doRound=%s,aIndex=%s,needV=%s > %s" % (doRound, aIndex, needV, doValue), playerID)
+                continue
+            mailItemList += awardItemList
+            GameWorld.DebugLog("    未领取补发奖: doRound=%s,aIndex=%s,needV=%s,%s" % (doRound, aIndex, needV, awardItemList), playerID)
+            
+        doRound += 1
+        doValue -= roundValueMax
+        doAwardState = 0
+        
+    if not mailItemList:
+        return
+    GameWorld.Log("处理补发轮回奖励完毕: actNum=%s,roundType=%s,roundMax=%s,curRound=%s,curValue=%s,awardState=%s,mailItemList=%s" 
+                       % (actNum, roundType, roundMax, curRound, curValue, awardState, mailItemList), playerID)
+    PlayerControl.SendMailByKey("LunhuidianUnget", [playerID], mailItemList)
+    return
+
 def GetRoundSetValue(roundSet, setIndex): return roundSet[setIndex] if len(roundSet) > setIndex else 0
 
 def AddLunhuidianValue(curPlayer, awardType, awardTypeValue, addValue):

--
Gitblit v1.8.0