yyl
12 小时以前 5d3366f2e0f687995eb7ad2107c4379fe7acd4e8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
using System.Collections.Generic;
using UnityEngine;
using LitJson;
 
public partial class HeroInfo
{
    //  武将服务器唯一ID
    public long sid;
 
    //  武将配置表ID
    public int heroId
    {
        get
        {
            #if UNITY_EDITOR
            if (null == itemHero)
            {
                return 520001;
            }
            #endif
 
            return itemHero.config.ID;
        }
    }
 
    //  武将等级
    public int heroLevel;
 
    //  武将星级
    public int heroStar;
 
    //  武将突破等级
    public int breakLevel;
 
    //  武将觉醒等级
    public int awakeLevel;
 
 
    public HeroCountry heroCountry
    {
        get
        {
            return (HeroCountry)heroConfig.Country;
        }
    }
 
    public int Quality
    {
        get
        {
            return heroConfig.Quality;
        }
    }
 
    public ItemModel itemHero;
 
    // public readonly CB122_tagSCHeroInfo.tagSCHero scHeroInfo;
 
    //  武将配置
    public HeroConfig heroConfig;
    //  觉醒配置
    public HeroAwakeConfig awakeConfig;
    //  突破配置
    public HeroBreakConfig breakConfig;
    //  羁绊配置
    public HeroFetterConfig fetterConfig;
    //  品质觉醒配置
    public HeroQualityAwakeConfig qualityAwakeConfig;
    //  品质配置
    public HeroQualityConfig qualityConfig;
    //  品质突破配置
    public HeroQualityBreakConfig qualityBreakConfig;
 
    public List<HeroFetterInfo> fetterInfoList = new List<HeroFetterInfo>();
    public List<HeroTalentInfo> talentList = new List<HeroTalentInfo>();
 
 
    public HeroInfo(/*CB122_tagSCHeroInfo.tagSCHero _scHeroInfo, */ItemModel _itemHero)
    {
        // scHeroInfo = _scHeroInfo;
        UpdateHero(_itemHero);
        
 
        
    }
 
    #if UNITY_EDITOR
    public HeroInfo()
    {
        heroLevel = 1;
        heroStar = 1;
        breakLevel = 1;
        awakeLevel = 1;
        SkinIndex = 0;
        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 HeroInfo Clone() => JsonMapper.ToObject<HeroInfo>(JsonMapper.ToJson(this));
 
    //  图鉴信息
    public void UpdateSCHero(CB122_tagSCHeroInfo.tagSCHero _scHeroInfo)
    {
 
    }
 
    public void UpdateHero(ItemModel _itemHero)
    {
        itemHero = _itemHero;
        // HeroConfigUtility
 
        // 70 # 英雄等级
        heroLevel = itemHero.GetUseData(70)[0];
        // 72 # 英雄星级
        heroStar = itemHero.GetUseData(72)[0];
        // 74 # 英雄突破等级
        breakLevel = itemHero.GetUseData(74)[0];
        // 76 # 英雄觉醒等级
        awakeLevel = itemHero.GetUseData(76)[0];
        // 78 # 英雄使用的皮肤索引
        SkinIndex = itemHero.GetUseData(78)[0];
 
 
        // 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);
 
        InitConfigs();
 
        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]));
        }
 
        //  羁绊
        fetterInfoList.Clear();
        for (int i = 0; i < heroConfig.FetterIDList.Length; i++)
        {
            fetterInfoList.Add(new HeroFetterInfo(this, heroConfig.FetterIDList[i]));
        }
 
// 77 # 英雄天赋洗炼随机ID列表
// 79 # 英雄觉醒时随机天赋选项ID列表
// 80 # 主阵型上阵位置
    }
 
    protected void InitConfigs()
    {
        //  武将配置
        heroConfig = HeroConfig.Get(heroId);
 
        //  觉醒配置 (满级为空)
        awakeConfig = HeroAwakeConfig.GetHeroAwakeConfig(heroId, awakeLevel);
 
        //  突破配置
        breakConfig = HeroBreakConfig.GetHeroBreakConfig(heroId, breakLevel);
 
        //  羁绊配置 可能需要fetterid 去检索效率太低
        // fetterConfig;
 
        //  品质觉醒配置
        qualityAwakeConfig = HeroQualityAwakeConfig.GetQualityAwakeConfig(Quality, awakeLevel);
 
        //  品质配置
        qualityConfig = HeroQualityConfig.Get(Quality);
 
        //  品质突破配置
        qualityBreakConfig = HeroQualityBreakConfig.GetQualityBreakConfig(Quality, awakeLevel);
 
    }
 
    public int GetInheritRate(HeroAttrType attrType)
    {
        return heroConfig.GetInheritPercent(attrType);
    }
}