From bbb59c63a8786e6bf6741e1de8f9c1265a37e326 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 15 八月 2024 11:55:01 +0800
Subject: [PATCH] 10202 【越南】【香港】【主干】【砍树】聚魂(增加聚魂重置功能;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/PrintSkill.py     |    2 ++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py         |    2 +-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGatherTheSoul.py |   45 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 48 insertions(+), 1 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/PrintSkill.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/PrintSkill.py
index c79346d..1f6dbe1 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/PrintSkill.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/PrintSkill.py
@@ -63,6 +63,8 @@
                 18 : "装备被动技能",
                 19 : "炼体技能",
                 20 : "神通技能",
+                21 : "精怪技能",
+                22 : "聚魂技能",
                 }
     
     for funcType, skillInfo in skillDict.items():
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py
index d9b8202..5e021b1 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py
@@ -2126,7 +2126,7 @@
         
     return
 
-def GivePlayerItem(curPlayer, itemID, itemCount, isAuctionItem, packIndexList, event=["", False, {}]):
+def GivePlayerItem(curPlayer, itemID, itemCount, isAuctionItem, packIndexList=None, event=["", False, {}]):
     '''给玩家物品
     @param isAuctionItem: 是否拍品
     '''
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 4411e59..f030502 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGatherTheSoul.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGatherTheSoul.py
@@ -50,6 +50,8 @@
         OnGatherTheSoulPuton(curPlayer, soulID)
     elif OpType == 2:
         OnGatherTheSoulTakeoff(curPlayer, soulID)
+    elif OpType == 3:
+        OnGatherTheSoulReset(curPlayer, soulID)
     return
 
 def OnGatherTheSoulUp(curPlayer, upSoulID):
@@ -169,6 +171,49 @@
     RefreshGatherTheSoulAttr(curPlayer, True)
     return
 
+def OnGatherTheSoulReset(curPlayer, soulID):
+    ## 聚魂重置
+    ipyData = IpyGameDataPY.GetIpyGameData("GatherTheSoul", soulID)
+    if not ipyData:
+        return
+    holeNum = ipyData.GetHoleNum()
+    pieceItemID = ipyData.GetPieceItemID()
+    if not pieceItemID:
+        return
+    soulLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GatherTheSoulLV % soulID)
+    if soulLV <= 1:
+        GameWorld.DebugLog("该聚魂等级不需要重置! soulID=%s,soulLV=%s" % (soulID, soulLV))
+        return
+    
+    costMoneyType, costMoneyValue = 0, 0
+    costMoneyInfo = IpyGameDataPY.GetFuncEvalCfg("GatherTheSoulHole", 2)
+    if costMoneyInfo and len(costMoneyInfo) == 2:
+        costMoneyType, costMoneyValue = costMoneyInfo
+        if not PlayerControl.HaveMoney(curPlayer, costMoneyType, costMoneyValue):
+            return
+        
+    # 重置保留激活的1级,从2级开始返还所有
+    pieceTotal = 0
+    soulValueTotal = 0
+    for resetLV in range(2, 1 + soulLV):
+        resetIpyData = IpyGameDataPY.GetIpyGameData("GatherTheSoulLV", soulID, resetLV)
+        if not resetIpyData:
+            continue
+        pieceTotal += resetIpyData.GetNeedPiece()
+        soulValueTotal += resetIpyData.GetNeedSoulValue()
+        
+    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 costMoneyType and costMoneyValue:
+        PlayerControl.PayMoney(curPlayer, costMoneyType, costMoneyValue, "GatherTheSoulReset", {"soulID":soulID})
+    ItemControler.GivePlayerItem(curPlayer, pieceItemID, pieceTotal, False, event=["GatherTheSoulReset", False, {"soulID":soulID}])
+    PlayerControl.GiveMoney(curPlayer, ShareDefine.TYPE_Price_GatherSoul, soulValueTotal, "GatherTheSoulReset", {"soulID":soulID})
+    
+    holeSoulChange = (soulID == curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GatherTheSoulHoleID % holeNum))
+    Sync_SoulInfo(curPlayer, [soulID])
+    RefreshGatherTheSoulAttr(curPlayer, holeSoulChange)
+    return
+
 def GetGatherTheSoulTotalLV(curPlayer):
     totalSoulLV = 0
     ipyDataMgr = IpyGameDataPY.IPY_Data()

--
Gitblit v1.8.0