From ca11e79c7981d66e3d8bdbe12b3f2b44b3ae7063 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 26 一月 2026 16:18:36 +0800
Subject: [PATCH] 438 【方案】方案预设-服务端(武将方案切换时如果为空方案则复制当前武将方案;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerHero.py |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerHero.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerHero.py
index 844e7e7..fbeee25 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerHero.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerHero.py
@@ -1418,21 +1418,30 @@
     shapeType = 0#clientData.ShapeType
     heroPosList = clientData.HeroPosList
     
-    heroPosDict = {}
-    indexList = []
+    itemIndexPosDict = {}
     for posInfo in heroPosList:
         posNum = posInfo.PosNum
         itemIndex = posInfo.ItemIndex
+        itemIndexPosDict[itemIndex] = posNum
+        
+    DoSaveHeroPreset(curPlayer, presetID, itemIndexPosDict, shapeType)
+    return
+
+def DoSaveHeroPreset(curPlayer, presetID, itemIndexPosDict, shapeType=0):
+        
+    if not PlayerPreset.GetFuncPresetIDState(curPlayer, presetID, ShareDefine.FuncPreset_Hero):
+        GameWorld.DebugLog("该武将阵容预设不可用! presetID=%s" % presetID)
+        return
+    
+    heroPosDict = {}
+    indexList = []
+    for itemIndex, posNum in itemIndexPosDict.items():
         if itemIndex in indexList:
             # 单武将只能一个位置,一个位置只能对应唯一武将单位
             continue
         indexList.append(itemIndex)
         heroPosDict[posNum] = itemIndex
         
-    if not PlayerPreset.GetFuncPresetIDState(curPlayer, presetID, ShareDefine.FuncPreset_Hero):
-        GameWorld.DebugLog("该武将阵容预设不可用! presetID=%s" % presetID)
-        return
-    
     GameWorld.DebugLog("保存武将预设阵容: presetID=%s, %s" % (presetID, heroPosDict), curPlayer.GetPlayerID())
     curPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptHero)
     # 直接重置旧阵型

--
Gitblit v1.8.0