From 3b9231c63cdeb20e273cdff217e8673f18d338ce Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 26 三月 2019 17:45:03 +0800
Subject: [PATCH] 6373 【后端】【2.0】删除无用功能代码、封包、配置(页游节日集字)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActivity.py |   87 +++++++++++++++++++++++--------------------
 1 files changed, 46 insertions(+), 41 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActivity.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActivity.py
index b10c7de..3c2f580 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActivity.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActivity.py
@@ -69,7 +69,9 @@
     if onEventType == ShareDefine.Def_OnEventTypeEx:
         # 重置完成次数
         for i in xrange(ipyDataMgr.GetDailyQuestCount()):
-            key = ChConfig.Def_PDict_Activity_FinishCnt % (i+1)
+            ipyData = ipyDataMgr.GetDailyQuestByIndex(i)
+            
+            key = ChConfig.Def_PDict_Activity_FinishCnt % ipyData.GetID()
             curPBCnt = __GetPDictValue(curPlayer, key) #单次进度值
             if curPBCnt:
                 __SetPDictValue(curPlayer, key, 0)
@@ -77,14 +79,16 @@
         __SetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_TotalPoint, 0)
         # 重置领奖记录
         __SetPDictValue(curPlayer, ChConfig.Def_PDict_ActivityAwardRecord, 0)
+        #重置额外获得修行点数
+        __SetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_ExtraRealmPoint, 0)
         #重新计算奖励阶段
         __CalcAwardStage(curPlayer)
         #重置可领取修行点,未领取的发邮件
-        realmPoint = __GetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_RealmPoint)
-        if realmPoint and GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Official):
-            if GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_DailyQuest):
-                PlayerControl.SendMailByKey('XXDForgetToPick', [curPlayer.GetID()], [(ChConfig.Def_ItemID_RealmPoint, realmPoint, 1)], [realmPoint])
-            __SetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_RealmPoint, 0)
+#        realmPoint = __GetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_RealmPoint)
+#        if realmPoint and GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Official):
+#            if GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_DailyQuest):
+#                PlayerControl.SendMailByKey('XXDForgetToPick', [curPlayer.GetID()], [(ChConfig.Def_ItemID_RealmPoint, realmPoint, 1)], [realmPoint])
+#            __SetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_RealmPoint, 0)
         
         SyncDailyActivityInfo(curPlayer)
     else:
@@ -226,44 +230,37 @@
     
     __SetPDictValue(curPlayer, key, addPbCnt)
     
-    #curTotalPoint = __GetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_TotalPoint)
+    #
     multiple = 1
     if addValue:
-        #__SetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_TotalPoint, nuwTotalPoint)
-        multiple = __GetActionAddPer(curPlayer)
-        addValue *= multiple
-        
-        realmPoint = __GetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_RealmPoint)
-        __SetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_RealmPoint, realmPoint+addValue)
+        multiple, extraPointLimit = __GetActionAddPer(curPlayer)
+        curExtraPoint = __GetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_ExtraRealmPoint)
+        addExtraPoint = max(0, min(addValue*(multiple-1),extraPointLimit-curExtraPoint)) if extraPointLimit else addValue*(multiple-1)
+        __SetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_ExtraRealmPoint, curExtraPoint+addExtraPoint)
+        addValue = addValue + addExtraPoint
+        curTotalPoint = __GetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_TotalPoint)
+        __SetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_TotalPoint, curTotalPoint+addValue)
+        #realmPoint = __GetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_RealmPoint)
+        #__SetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_RealmPoint, realmPoint+addValue)
         SyncDailyActivityInfo(curPlayer)
         
-    GameWorld.DebugLog("增加活跃度任务次数,activityNum=%s,addPbCnt=%s,addValue=%s, multiple=%s"  
-                       % (activityNum, addPbCnt, addValue, multiple), curPlayer.GetPlayerID())
+        GameWorld.DebugLog("增加活跃度任务次数,activityNum=%s,addPbCnt=%s,addValue=%s, multiple=%s, addExtraPoint=%s,curExtraPoint=%s"  
+                           % (activityNum, addPbCnt, addValue, multiple, addExtraPoint, curExtraPoint), curPlayer.GetPlayerID())
     return
 
 def __GetActionAddPer(curPlayer):
-    multiple = 1
+    multiple, extraPointLimit = 1, 0 #倍数、额外可获得修行点上限
     actRealmPointInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_RealmPoint, {})# 多倍修行点活动
     if not actRealmPointInfo:
-        return multiple
-    if actRealmPointInfo.get(ShareDefine.ActKey_State) \
-            and curPlayer.GetLV() >= actRealmPointInfo.get(ShareDefine.ActKey_LVLimit, 0):
-        #从开始天的5点到结束天的5点
-        startData = GameWorld.GetDateTimeByStr(actRealmPointInfo[ShareDefine.ActKey_StartDate], ChConfig.TYPE_Time_Format_Day)
-        endData = GameWorld.GetDateTimeByStr(actRealmPointInfo[ShareDefine.ActKey_EndDate], ChConfig.TYPE_Time_Format_Day)
-        curTime = GameWorld.GetCurrentTime()
-        
-        curHour = GameWorld.GetCurrentTime().hour
-        if curTime.year == startData.year and curTime.month == startData.month and curTime.day == startData.day:
-            if 0<=curHour<5:
-                #GameWorld.DebugLog('多倍修行点开始天的0-5点不生效')
-                return multiple
-        if curTime.year == endData.year and curTime.month == endData.month and curTime.day == endData.day:
-            if curHour >=5:
-                #GameWorld.DebugLog('多倍修行点结束天的5点之后不生效')
-                return multiple
-        multiple = actRealmPointInfo.get(ShareDefine.ActKey_RealmPointMulti, 1)
-    return multiple
+        return multiple, extraPointLimit
+    if not actRealmPointInfo.get(ShareDefine.ActKey_State):
+        return multiple, extraPointLimit
+    actRealmPointIpyData = IpyGameDataPY.GetIpyGameData("ActRealmPoint", actRealmPointInfo.get(ShareDefine.ActKey_CfgID, 0))
+    if not actRealmPointIpyData:
+        return multiple, extraPointLimit
+    if curPlayer.GetLV() < actRealmPointIpyData.GetLVLimit():
+        return multiple, extraPointLimit
+    return actRealmPointIpyData.GetMultiple(), actRealmPointIpyData.GetPointLimit()
 
 ## 同步活跃度信息
 #  @param curPlayer
@@ -276,6 +273,7 @@
     sendPack.StageIndex = __GetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_AwardStage)
     sendPack.AwardRecord = __GetPDictValue(curPlayer, ChConfig.Def_PDict_ActivityAwardRecord)
     sendPack.RealmPoint = __GetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_RealmPoint)
+    sendPack.ExtraPoint = __GetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_ExtraRealmPoint)
     NetPackCommon.SendFakePack(curPlayer, sendPack)
     return
 
@@ -327,7 +325,7 @@
         return
     
     # 给物品
-    ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, isBind, [IPY_GameWorld.rptItem], True)
+    ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, 0, [IPY_GameWorld.rptItem])
 
     # 更新已领取成功标记
     updAwardRecord = getAwardRecord | (1 << awardIndex)
@@ -371,9 +369,11 @@
 #        return
     
     # 由GameServer决定
-    if not GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_DailyActionState % dailyID):
-        GameWorld.DebugLog("日常活动未开启!dailyID=%s" % dailyID)
-        return
+    # 目前跨服PK暂不需要判断,因为跨服PK次数结算在本服,玩家可能上次未结算离线,等非匹配期间上线,也需要加上,所以暂不判断
+    if dailyID not in [ShareDefine.DailyActionID_CrossReamPK]:
+        if not GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_DailyActionState % dailyID):
+            GameWorld.DebugLog("日常活动未开启!dailyID=%s" % dailyID)
+            return
     
     dayTimesLimit = GetMaxDayTimes(ipyData)#ipyData.GetDayTimes()
     weekTimesLimit = ipyData.GetWeekTimes()
@@ -383,6 +383,9 @@
     activityNum = GetActivityNum(RelatedType_1, dailyID)
     dailyQuestData = IpyGameDataPY.GetIpyGameDataNotLog('DailyQuest', activityNum)
     unLimitCnt = dailyQuestData and not dailyQuestData.GetTotalActiveValue()
+    funcID = dailyQuestData.GetUnLockFuncID() if dailyQuestData else 0
+    if funcID and not GameFuncComm.GetFuncCanUse(curPlayer, funcID):
+        return
         
     updDayTimes = 0
     if dayTimesLimit:
@@ -391,15 +394,17 @@
         if not unLimitCnt and curDayTimes >= dayTimesLimit:
             return
         updDayTimes =  curDayTimes+addCnt if unLimitCnt else min(dayTimesLimit, curDayTimes+addCnt)
+        addCnt = updDayTimes - curDayTimes
         PlayerControl.NomalDictSetProperty(curPlayer, key, updDayTimes)
         GameWorld.DebugLog('增加日常活动完成次数 dailyID=%s, curDayTimes=%s, updDayTimes=%s'%(dailyID, curDayTimes, updDayTimes))
-    
+    updWeekTimes = 0
     if weekTimesLimit:
         key = ChConfig.Def_PDict_DailyActionWeekTimes%dailyID
         curWeekTimes = curPlayer.NomalDictGetProperty(key)
         if not unLimitCnt and curWeekTimes >= weekTimesLimit:
             return
         updWeekTimes =  curWeekTimes+addCnt if unLimitCnt else min(weekTimesLimit, curWeekTimes+addCnt)
+        addCnt = updWeekTimes - curWeekTimes
         PlayerControl.NomalDictSetProperty(curPlayer, key, updWeekTimes)
         GameWorld.DebugLog('增加日常活动完成次数 dailyID=%s, curWeekTimes=%s, updWeekTimes=%s'%(dailyID, curWeekTimes, updWeekTimes))
 
@@ -407,7 +412,7 @@
     
     #对应的日常任务表ID
     updTimes = updDayTimes or updWeekTimes
-    if updTimes and dailyQuestData:
+    if addCnt and updTimes and dailyQuestData:
         AddActivityFinishCnt(curPlayer, activityNum, updTimes, addCnt)
     return True
 

--
Gitblit v1.8.0