From 7122760c297dd8b9572f8944f773cfd5fbeae9ad Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 02 四月 2020 15:54:00 +0800
Subject: [PATCH] 4697 【主干】活跃修炼修为收益显示错误(修复活跃修炼经验计算错误bug)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActivity.py |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 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 c994ea8..9143f68 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActivity.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActivity.py
@@ -760,11 +760,19 @@
     expSeconds = IpyGameDataPY.GetFuncCfg("ActivityPlaceExp", 1) # 活跃放置获得经验多少秒一次
     passTime = curTime - startTime
     
+    endCount = passTime / needSeconds
+    endCount = min(endCount, remainCount)
+    
     expCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityPlaceExpCount)
-    canGetExpCount = passTime / expSeconds
-    maxExpCount = needSeconds / expSeconds
-    addExpCount = min(maxExpCount, canGetExpCount - expCount)
+    maxExpCount = needSeconds / expSeconds # 单次放置最多可获得经验次数
+    # 由于结算时重置了开启下次的时间及经验次数,所以如果有需要结算,则溢出时间不计,放置多算经验次数
+    if endCount >= 1:
+        maxExpCount *= endCount
+    canGetExpCount = min(maxExpCount, passTime / expSeconds)
+    addExpCount = canGetExpCount - expCount
     if addExpCount > 0:
+        #GameWorld.DebugLog("活跃放置定时处理 : curTime=%s,startTime=%s,passTime=%s,endCount=%s,expCount=%s,canGetExpCount=%s,maxExpCount=%s,addExpCount=%s" 
+        #                   % (curTime, startTime, passTime, endCount, expCount, canGetExpCount, maxExpCount, addExpCount))
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceExpCount, expCount + addExpCount)
         lv = curPlayer.GetLV()
         reExp = PlayerControl.GetPlayerReExp(curPlayer)
@@ -776,7 +784,7 @@
                 break
         if not expLV:
             expLV, expFormat = lvFormatList[-1]
-        addExp = eval(FormulaControl.GetCompileFormula("ActivityPlaceExp_%s" % expLV, expFormat)) * expSeconds
+        addExp = eval(FormulaControl.GetCompileFormula("ActivityPlaceExp_%s" % expLV, expFormat)) * expSeconds * addExpCount
         playerControl = PlayerControl.PlayerControl(curPlayer)
         addExp = playerControl.AddExp(addExp, ShareDefine.Def_ViewExpType_Activity)
         
@@ -789,11 +797,8 @@
         #GameWorld.DebugLog("passTime=%s,canGetExpCount=%s,expCount=%s,addExpCount=%s,addExp=%s,todayTotalExp=%s" 
         #                   % (passTime, canGetExpCount, expCount, addExpCount, addExp, todayTotalExp))
         
-    if passTime < needSeconds:
-        #GameWorld.DebugLog("探索时间未到,不结算! curTime=%s,startTime=%s,passTime=%s < %s" % (curTime, startTime, passTime, needSeconds))
-        return
-    endCount = passTime / needSeconds
-    __DoActivityPlaceRewardEnd(curPlayer, endCount)
+    if endCount > 0:
+        __DoActivityPlaceRewardEnd(curPlayer, endCount)
     return
 
 def __DoActivityPlaceRewardEnd(curPlayer, endCount, isQuick=False):

--
Gitblit v1.8.0