From 01420d87cbfb1abc21023abccea970011e9b4fb0 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 15 八月 2024 15:34:50 +0800
Subject: [PATCH] 10202 【越南】【香港】【主干】【砍树】聚魂(优化聚魂重置到不需要公共材料的等级;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGatherTheSoul.py |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGatherTheSoul.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGatherTheSoul.py
index f030502..a137966 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGatherTheSoul.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGatherTheSoul.py
@@ -192,18 +192,26 @@
         if not PlayerControl.HaveMoney(curPlayer, costMoneyType, costMoneyValue):
             return
         
-    # 重置保留激活的1级,从2级开始返还所有
+    resetLV = soulLV
     pieceTotal = 0
     soulValueTotal = 0
-    for resetLV in range(2, 1 + soulLV):
-        resetIpyData = IpyGameDataPY.GetIpyGameData("GatherTheSoulLV", soulID, resetLV)
+    for sLV in range(2, 1 + soulLV)[::-1]:
+        resetIpyData = IpyGameDataPY.GetIpyGameData("GatherTheSoulLV", soulID, sLV)
         if not resetIpyData:
             continue
+        resetLV = sLV
+        soulValue = resetIpyData.GetNeedSoulValue()
+        if not soulValue:
+            # 重置到不需要公共材料的等级
+            break
         pieceTotal += resetIpyData.GetNeedPiece()
-        soulValueTotal += resetIpyData.GetNeedSoulValue()
+        soulValueTotal += soulValue
         
-    GameWorld.DebugLog("重置聚魂: soulID=%s,soulLV=%s,pieceTotal=%s,soulValueTotal=%s" % (soulID, soulLV, pieceTotal, soulValueTotal))
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GatherTheSoulLV % soulID, 1) # 重置到1级
+    if resetLV >= soulLV:
+        return
+    
+    GameWorld.DebugLog("重置聚魂: soulID=%s,soulLV=%s,resetLV=%s,pieceTotal=%s,soulValueTotal=%s" % (soulID, soulLV, resetLV, pieceTotal, soulValueTotal))
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GatherTheSoulLV % soulID, resetLV)
     if costMoneyType and costMoneyValue:
         PlayerControl.PayMoney(curPlayer, costMoneyType, costMoneyValue, "GatherTheSoulReset", {"soulID":soulID})
     ItemControler.GivePlayerItem(curPlayer, pieceItemID, pieceTotal, False, event=["GatherTheSoulReset", False, {"soulID":soulID}])

--
Gitblit v1.8.0