From 3b6d600c2fc137b9417fb632c15c649f05268843 Mon Sep 17 00:00:00 2001
From: lcy <1459594991@qq.com>
Date: 星期五, 05 六月 2026 16:52:46 +0800
Subject: [PATCH] 492 武将登场 修复武将登场和武将返场皮肤商店的物品读取

---
 Main/System/HeroReturn/HeroReturnManager.cs |   48 +++++++++---------------------------------------
 1 files changed, 9 insertions(+), 39 deletions(-)

diff --git a/Main/System/HeroReturn/HeroReturnManager.cs b/Main/System/HeroReturn/HeroReturnManager.cs
index 2fc1775..458b204 100644
--- a/Main/System/HeroReturn/HeroReturnManager.cs
+++ b/Main/System/HeroReturn/HeroReturnManager.cs
@@ -993,51 +993,21 @@
         return int.MaxValue;
     }
 
-    //<skinID,ctgID>
-    Dictionary<int, int> ctgDict = new();
     public int GetCtgIDBySkinID(int skinID)
     {
-        if (ctgDict.IsNullOrEmpty())
-        {
-            GetSkinIDToCtgIDDict();
-        }
+        var act = GetOperationHeroAppearInfo();
+        if (act == null) return 0;
 
-        int ctgID;
-        ctgDict.TryGetValue(skinID, out ctgID);
-        return ctgID;
-    }
+        var config = ActHeroAppearConfig.Get(act.CfgID);
+        if (config == null || config.ActHeroIDList == null || config.SkinCTGIDList == null) return 0;
 
-    Dictionary<int, int> GetSkinIDToCtgIDDict()
-    {
-        if (!ctgDict.IsNullOrEmpty())
-        {
-            return ctgDict;
-        }
+        int heroID = GetHeroIDBySkinID(skinID);
+        if (heroID == 0) return 0;
 
-        foreach (var config in ActHeroAppearConfig.GetValues())
-        {
-            if (config == null || config.SkinCTGIDList == null) return null;
+        int index = System.Array.IndexOf(config.ActHeroIDList, heroID);
+        if (index < 0 || index >= config.SkinCTGIDList.Length) return 0;
 
-            for (int i = 0; i < config.SkinCTGIDList.Length; i++)
-            {
-                var ctgID = config.SkinCTGIDList[i];
-                var ctgConfig = CTGConfig.Get(ctgID);
-                if (ctgConfig == null || ctgConfig.GainItemList == null) continue;
-
-                for (int j = 0; j < ctgConfig.GainItemList.Length; j++)
-                {
-                    var itemID = ctgConfig.GainItemList[j][0];
-                    var itemConfig = ItemConfig.Get(itemID);
-
-                    if (itemConfig == null) continue;
-                    if (!HeroSkinAttrConfig.TryGetSkinIDByItemID(itemID, out var skinID)) continue;
-                    if (ctgDict.ContainsKey(skinID)) continue;
-                    ctgDict[skinID] = ctgID;
-                }
-            }
-        }
-
-        return ctgDict;
+        return config.SkinCTGIDList[index];
     }
 
     public bool HasItemInSkinCTGIDList(int cfgID, int findItemID)

--
Gitblit v1.8.0