少年修仙传客户端代码仓库
hch
2025-06-12 204ef05a831c9484e2abc561d27ecbff7c797453
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
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
 
 
public partial class FuncConfigConfig : IConfigPostProcess
{
    #region 宝石数据
    private const string GEM_TYPE1 = "GemType1";
    private const string GEM_TYPE2 = "GemType2";
    private static Dictionary<int, FuncConfigConfig> m_GemCfgs = new Dictionary<int, FuncConfigConfig>();
    #endregion
 
    #region 符印数据
    private static Regex RuneAttrRegex = new Regex(@"RuneAttr([0-9]+)", RegexOptions.Singleline);
    public static Dictionary<int, FuncConfigConfig> m_RuneAttrCfgs = new Dictionary<int, FuncConfigConfig>();
    #endregion
 
    #region 快捷回复
    private static Regex FastReplayRegex = new Regex(@"QuickReply([0-9]+)", RegexOptions.Singleline);
    private static List<FuncConfigConfig> fastReplay = new List<FuncConfigConfig>();
    #endregion
 
 
 
    public void OnConfigParseCompleted()
    {
        #region 宝石数据、符印数据、聊天快捷回复
        if (KEY == GEM_TYPE1 || KEY == GEM_TYPE2)
        {
            string[] strs = Numerical1.Split('|');
            for (int i = 0; i < strs.Length; i++)
            {
                int pos = int.Parse(strs[i]);
                if (!m_GemCfgs.ContainsKey(pos))
                {
                    m_GemCfgs.Add(pos, this);
                }
                else
                {
                    DebugEx.LogError("重复的装备位置ID:" + pos);
                }
            }
        }
        else if (RuneAttrRegex.IsMatch(KEY))
        {
            Match match = RuneAttrRegex.Match(KEY);
            int attrType = int.Parse(match.Groups[1].Value);
            m_RuneAttrCfgs.Add(attrType, this);
        }
        else if (FastReplayRegex.IsMatch(KEY))
        {
            fastReplay.Add(this);
        }
        #endregion
 
 
    }
 
    #region 宝石数据
    public static int GetGemTypeByEquipPos(int pos, out FuncConfigConfig cfg)
    {
        m_GemCfgs.TryGetValue(pos, out cfg);
        if (cfg != null)
        {
            string typeStr = System.Text.RegularExpressions.Regex.Replace(cfg.KEY, @"[^\d.\d]", "");
            int type = -1;
            if (int.TryParse(typeStr, out type))
            {
                return type;
            }
        }
        return -1;
    }
 
    public static int GetGemTypeByEquipPos(int pos)
    {
        FuncConfigConfig cfg = null;
        m_GemCfgs.TryGetValue(pos, out cfg);
        if (cfg != null)
        {
            string typeStr = System.Text.RegularExpressions.Regex.Replace(cfg.KEY, @"[^\d.\d]", "");
            int type = -1;
            if (int.TryParse(typeStr, out type))
            {
                return type;
            }
        }
        DebugEx.LogError("未找到的装备位置:" + pos);
        return -1;
    }
    #endregion
 
    public static FuncConfigConfig GetRuneAttrFormula(int attrType)
    {
        FuncConfigConfig cfg = null;
        m_RuneAttrCfgs.TryGetValue(attrType, out cfg);
        return cfg;
    }
 
    public static FuncConfigConfig GetRuneNeedExpFormula()
    {
        return FuncConfigConfig.Get("RuneExp");
    }
 
    public static List<FuncConfigConfig> GetFastReplay()
    {
        return fastReplay;
    }
 
}