From 09bc892c7283df8757a07b646d5af21ddaa263d1 Mon Sep 17 00:00:00 2001
From: lcy <1459594991@qq.com>
Date: 星期四, 06 十一月 2025 18:22:34 +0800
Subject: [PATCH] 164 天子的考验-客户端

---
 Main/System/Hero/HeroInfo.cs |  165 +++++++++++++++++++++++++++++++-----------------------
 1 files changed, 94 insertions(+), 71 deletions(-)

diff --git a/Main/System/Hero/HeroInfo.cs b/Main/System/Hero/HeroInfo.cs
index 1839eac..e0b9657 100644
--- a/Main/System/Hero/HeroInfo.cs
+++ b/Main/System/Hero/HeroInfo.cs
@@ -9,7 +9,7 @@
     public int heroId;
 
     //  姝﹀皢閰嶇疆
-    public HeroConfig heroConfig;
+    public HeroConfig heroConfig { get; private set; }
     public ItemModel itemHero;  //寮曠敤鑳屽寘閲岀殑 鏁版嵁鍚屾
 
     public HeroCountry heroCountry
@@ -20,40 +20,40 @@
         }
     }
 
+    //  鍝佽川閰嶇疆
+    public HeroQualityConfig qualityConfig { get; private set; }
 
-    //鏄惁涓荤嚎涓婇樀 81 # 鎵�鍦ㄩ樀瀹逛俊鎭垪琛� [闃靛绫诲瀷*10000+闃靛瀷绫诲瀷*100+浣嶇疆缂栧彿, ...]
-    public bool isInMainBattle
+    public int Quality
     {
         get
         {
-            //浠庡垪琛ㄤ腑鎵惧埌 闃靛涓�1鐨� 涓荤嚎闃靛
-            var list = itemHero.GetUseData(81);
-            if (list != null && list.Count > 0)
-            {
-                var index = list.FindIndex((item) => item / 10000 == 1);
-                if (index >= 0)
-                {
-                    return true;
-                }
-            }
-            return false;
+            return heroConfig.Quality;
         }
     }
 
-    // 浼樺厛鍔熻兘鎻愰啋绫诲瀷锛�1瑙夐啋 2鍗囩骇 3绐佺牬 4鍗囨槦
-    // 浼樺厛椤哄簭锛�
-    public int funcState
+    //  姝﹀皢绛夌骇
+    public int heroLevel
     {
         get
         {
-            return 0;
+            if (itemHero == null)
+                return 0;
+            return itemHero.GetUseDataFirstValue(70);
         }
     }
 
 
+    public bool isLock
+    {
+        get
+        {
+            return itemHero.itemInfo.isLock;
+        }
+    }
 
-    public List<HeroFetterInfo> fetterInfoList = new List<HeroFetterInfo>();
-    public List<HeroTalentInfo> talentList = new List<HeroTalentInfo>();
+
+    //宸插涔犵殑鎵�鏈夋妧鑳藉彇鏈�楂樼骇鐨勬妧鑳�
+    Dictionary<int, int> allSkillTypeIDToID = new Dictionary<int, int>();  //鎶�鑳界被鍨婭D锛�  鏈�楂樻妧鑳絀D
 
 
     public HeroInfo(ItemModel _itemHero)
@@ -61,20 +61,7 @@
         UpdateHero(_itemHero);
     }
 
-#if UNITY_EDITOR
-    public HeroInfo()
-    {
-        heroId = 520001; // 榛樿鑻遍泟ID
 
-        heroConfig = HeroConfig.Get(heroId);
-        awakeConfig = HeroAwakeConfig.GetHeroAwakeConfig(heroId, awakeLevel);
-        breakConfig = HeroBreakConfig.GetHeroBreakConfig(heroId, breakLevel);
-        qualityAwakeConfig = HeroQualityAwakeConfig.GetQualityAwakeConfig(Quality, awakeLevel);
-        qualityConfig = HeroQualityConfig.Get(Quality);
-        qualityBreakConfig = HeroQualityBreakConfig.GetQualityBreakConfig(Quality, awakeLevel);
-        CalculateProperties();
-    }
-#endif
 
 
     public void UpdateHero(ItemModel _itemHero)
@@ -83,28 +70,9 @@
         // HeroConfigUtility
         heroId = itemHero.config.ID;
 
-
         InitConfigs();
-        // 71 # 鑻遍泟澶╄祴ID鍒楄〃
-        // List<int> talentSkillList = itemHero.GetUseData(71);
-        // // 73 # 鑻遍泟澶╄祴ID绛夌骇鍒楄〃锛屽搴�71澶╄祴ID鐨勭瓑绾�
-        // List<int> talentLvList = itemHero.GetUseData(73);
-        // // 75 # 鑻遍泟澶╄祴娲楃偧閿佸畾绱㈠紩鍒楄〃锛屽搴�71澶╄祴ID绱㈠紩
-        // List<int> talentLockList = itemHero.GetUseData(75);
 
-
-        // if (talentLockList.Count != talentLvList.Count || talentLvList.Count != talentSkillList.Count)
-        // {
-        //     Debug.LogError("澶╄祴ID鍒楄〃鍙婂悗缁殑鏁版嵁鏁伴噺娌″涓�");
-        // }
-
-        // //  澶╄祴
-        // talentList.Clear();
-        // for (int i = 0; i < talentSkillList.Count; i++)
-        // {
-        //     talentList.Add(new HeroTalentInfo(this, talentSkillList[i], talentLvList[i], talentLockList[i]));
-        // }
-
+        CalculateProperties();
         // //  缇佺粖
         // fetterInfoList.Clear();
         // for (int i = 0; i < heroConfig.FetterIDList.Length; i++)
@@ -112,8 +80,6 @@
         //     fetterInfoList.Add(new HeroFetterInfo(this, heroConfig.FetterIDList[i]));
         // }
 
-        // 77 # 鑻遍泟澶╄祴娲楃偧闅忔満ID鍒楄〃
-        // 79 # 鑻遍泟瑙夐啋鏃堕殢鏈哄ぉ璧嬮�夐」ID鍒楄〃
         // 80 # 涓婚樀鍨嬩笂闃典綅缃�
     }
 
@@ -121,29 +87,86 @@
     {
         //  姝﹀皢閰嶇疆
         heroConfig = HeroConfig.Get(heroId);
-
-        //  瑙夐啋閰嶇疆 (婊$骇涓虹┖)
-        awakeConfig = HeroAwakeConfig.GetHeroAwakeConfig(heroId, awakeLevel);
-
-        //  绐佺牬閰嶇疆
-        breakConfig = HeroBreakConfig.GetHeroBreakConfig(heroId, breakLevel);
-
-        //  缇佺粖閰嶇疆 鍙兘闇�瑕乫etterid 鍘绘绱㈡晥鐜囧お浣�
-        // fetterConfig;
-
-        //  鍝佽川瑙夐啋閰嶇疆
-        qualityAwakeConfig = HeroQualityAwakeConfig.GetQualityAwakeConfig(Quality, awakeLevel);
-
         //  鍝佽川閰嶇疆
         qualityConfig = HeroQualityConfig.Get(Quality);
 
         //  鍝佽川绐佺牬閰嶇疆
-        qualityBreakConfig = HeroQualityBreakConfig.GetQualityBreakConfig(Quality, awakeLevel);
+        qualityBreakConfig = HeroQualityBreakConfig.GetQualityBreakConfig(Quality, breakLevel);
+
+        breakConfig = HeroBreakConfig.GetHeroBreakConfig(heroId, breakLevel);
+        awakeConfig = HeroAwakeConfig.GetHeroAwakeConfig(heroId, awakeLevel);
+        qualityAwakeConfig = HeroQualityAwakeConfig.GetQualityAwakeConfig(Quality, awakeLevel);
 
     }
 
-    public int GetInheritRate(HeroAttrType attrType)
+
+
+    //鏄惁涓妜闃� 鏈嶅姟绔槦浼�
+    public bool IsInTeamByTeamType(TeamType teamType)
     {
-        return heroConfig.GetInheritPercent(attrType);
+        return TeamManager.Instance.GetTeam(teamType).HasHeroInServer(itemHero.guid);
     }
+
+    //鏄惁涓婁换浣曢樀瀹�
+    public bool IsInAnyTeam()
+    {
+        for (int i = 1; i < (int)TeamType.Max; i++)
+        {
+            if (TeamManager.Instance.GetTeam((TeamType)i).HasHeroInServer(itemHero.guid))
+            {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    //鏄惁涓婁换浣曢樀瀹癸紝涓斿彧鏈変竴鍙�
+    public bool IsInAnyTeamJustOne()
+    {
+        for (int i = 1; i < (int)TeamType.Max; i++)
+        {
+            var team = TeamManager.Instance.GetTeam((TeamType)i);
+            if (team.HasHeroInServer(itemHero.guid))
+            {
+                if (team.GetTeamHeroCount() == 1)
+                    return true;
+            }
+        }
+        return false;
+    }
+
+    //涓嬮樀鎵�鏈夐樀瀹�
+    public void LeaveAllTeam()
+    {
+        for (int i = 1; i < (int)TeamType.Max; i++)
+        {
+            int pos;
+            var team = TeamManager.Instance.GetTeam((TeamType)i);
+            if (TeamManager.Instance.GetTeam((TeamType)i).RemoveHero(this, out pos))
+            {
+                //濡傛灉鏄渶鍚庝竴涓灏嗭紝鍒欓粯璁や笂闃典竴涓�
+                team.SaveTeam();
+            }
+        }
+    }
+
+    public long GetSkillsFightPower()
+    {
+        long fightPower = 0;
+        foreach (var skillID in allSkillTypeIDToID.Values)
+        {
+            fightPower += SkillConfig.Get(skillID).FightPower;
+        }
+        return fightPower;
+    }
+    
+
+    public void ChangeLockState()
+    {
+        var pack = new CB238_tagCSHeroLock();
+        pack.ItemIndex = (ushort)itemHero.gridIndex;
+        pack.IsLock = isLock ? (byte)0 : (byte)1;
+        GameNetSystem.Instance.SendInfo(pack);
+    }
+
 }
\ No newline at end of file

--
Gitblit v1.8.0