少年修仙传客户端代码仓库
client_linchunjie
2018-09-25 78bfe524ea4776c47f6314e56e97f39970b00fce
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
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Friday, September 07, 2018
//--------------------------------------------------------
using Snxxz.UI;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using TableConfig;
using UnityEngine;
 
// 关于神兽强化
public class GodBeastModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk
{
    public Dictionary<int, int> Absorption_Dic = new Dictionary<int, int>();//获取选择的物品
    public event Action AbsorbEvent;
    public int ItemInde = 0;//物品下标
    public ItemModel Crystal_ItemModel;//当前所选中的水晶物品
    public int ItemPlace = -1;//神兽装备位置信息
    public  Dictionary<int, int> QualityLimit = new Dictionary<int, int>();//对应品质所能选择的最大强化等级
    DogzModel Dogz_model;
    DogzModel dogz_model { get { return Dogz_model ?? (Dogz_model = ModelCenter.Instance.GetModel<DogzModel>()); } }
    PlayerPackModel _playerPack;
    PlayerPackModel playerPack { get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PlayerPackModel>()); } }
    public override void Init()
    {
        if (QualityLimit.Count <= 0)
        {
            string DogzAssist = Config.Instance.Get<FuncConfigConfig>("DogzAssist").Numerical4;//获取不同品质的神兽强化上限
            QualityLimit = ConfigParse.GetDic<int, int>(DogzAssist);
        }
    }
 
    public void OnBeforePlayerDataInitialize()
    {
 
    }
 
    public void OnPlayerLoginOk()
    {
 
    }
 
    public override void UnInit()
    {
 
    }
 
    public void AbsorbEventUpdate()
    {
        if (AbsorbEvent != null)
        {
            AbsorbEvent();
        }
    }
 
    private Dictionary<int, int> AllEnhancedPropertiesDic = new Dictionary<int, int>();//key:为属性编号,value是属性值
    public Dictionary<int, int> AllEnhancedProperties(int GodBeastNumber)//获取整只神兽强化属性
    {
        AllEnhancedPropertiesDic.Clear();
        List<ItemModel> itemModel = dogz_model.GetDogzEquips(GodBeastNumber);
        if (itemModel == null)
        {
            return AllEnhancedPropertiesDic;
        }
        for (int i = 0; i < itemModel.Count; i++)
        {
            ItemModel item = itemModel[i];
            var IudetDogzEquipPlus = item.GetUseDataModel((int)ItemUseDataKey.Def_IudetDogzEquipPlus);
            if (IudetDogzEquipPlus != null)
            {
                int lv = IudetDogzEquipPlus[0];
                if (lv > 0)
                {
                    var DogzEquipConfig = DogzEquipPlusConfig.GetEquipplaceAndLevel(item.EquipPlace, lv);
                    int[] AttType = ConfigParse.GetMultipleStr<int>(DogzEquipConfig.attType);
                    int[] AttValue = ConfigParse.GetMultipleStr<int>(DogzEquipConfig.attValue);
                    for (int j = 0; j < AttType.Length; j++)
                    {
                        if (AllEnhancedPropertiesDic.ContainsKey(AttType[j]))
                        {
                            var value = AllEnhancedPropertiesDic[(AttType[j])];
                            AllEnhancedPropertiesDic[(AttType[j])] = value + AttValue[j];
                        }
                        else
                        {
                            AllEnhancedPropertiesDic.Add(AttType[j], AttValue[j]);
                        }
                    }
                }
            }
        }
        return AllEnhancedPropertiesDic;
    }
    private Dictionary<int, int> SiteEnhancementAttributeDic = new Dictionary<int, int>();//key:为属性编号,value是属性值
    public Dictionary<int, int> SiteEnhancementAttribute(PackType PackTypeGodBeast, int GodBeastIndex)//获取某只神兽身上某个装备属性值
    {
        SiteEnhancementAttributeDic.Clear();
        ItemModel item = playerPack.GetItemModelByIndex(PackTypeGodBeast, GodBeastIndex);
        if (item == null)
        {
            return SiteEnhancementAttributeDic;
        }
        var IudetDogzEquipPlus = item.GetUseDataModel((int)ItemUseDataKey.Def_IudetDogzEquipPlus);
        if (IudetDogzEquipPlus != null && IudetDogzEquipPlus[0] > 0)
        {
            var DogzEquipConfig = DogzEquipPlusConfig.GetEquipplaceAndLevel(item.EquipPlace, IudetDogzEquipPlus[0]);
            int[] AttType = ConfigParse.GetMultipleStr<int>(DogzEquipConfig.attType);
            int[] AttValue = ConfigParse.GetMultipleStr<int>(DogzEquipConfig.attValue);
            for (int j = 0; j < AttType.Length; j++)
            {
                if (SiteEnhancementAttributeDic.ContainsKey(AttType[j]))
                {
                    SiteEnhancementAttributeDic[(AttType[j])] = AttValue[j];
                }
                else
                {
                    SiteEnhancementAttributeDic.Add(AttType[j], AttValue[j]);
                }
            }
        }
        return SiteEnhancementAttributeDic;
    }
 
    public int DogZBagIndex = 0;
    public bool IsFullLevel()//是都满级能够继续吸收
    {
        bool IsBool = false;
        int DogZLV = 0;//获取当前神兽等级
        int DogProficiency = 0;//当前神兽的熟练度
        int SingleProficiency = 0;//单倍熟练度
        int DoubleProficiency = 0;//双倍熟练度
        ItemModel itemModel = playerPack.GetItemModelByIndex(PackType.rptDogzEquip, DogZBagIndex);
        if (itemModel == null)
        {
            return false;
        }
        int lv = QualityLimit[itemModel.chinItemModel.ItemColor];
        var DogzEquipMaxConfig = DogzEquipPlusConfig.GetEquipplaceAndLevel(itemModel.chinItemModel.EquipPlace, lv);    
        var IudetDogzEquipPlus = itemModel.GetUseDataModel((int)ItemUseDataKey.Def_IudetDogzEquipPlus);
 
        if (IudetDogzEquipPlus != null)
        {
            DogZLV = IudetDogzEquipPlus[0];
            DogProficiency = IudetDogzEquipPlus[1];
        }
        foreach (var key in Absorption_Dic.Keys)
        {
            ItemModel item_Model = playerPack.GetItemModelByIndex(PackType.rptDogzItem, key);
            if (item_Model != null)
            {
                if (item_Model.chinItemModel.Effect1 == 235)
                {
                    var _IudetDogzEquipPlus = item_Model.GetUseDataModel((int)ItemUseDataKey.Def_IudetDogzEquipPlus);
                    SingleProficiency += item_Model.chinItemModel.EffectValueA1 * Absorption_Dic[key];
                    if (_IudetDogzEquipPlus != null)
                    {
                        SingleProficiency += _IudetDogzEquipPlus[1];
                        DoubleProficiency += item_Model.chinItemModel.EffectValueA1;
                    }
                    else
                    {
                        DoubleProficiency += item_Model.chinItemModel.EffectValueA1 * 2 * Absorption_Dic[key];
                    }
                }
            }
        }
        if (true)
        {
            if (DogProficiency + DoubleProficiency >= DogzEquipMaxConfig.upExpTotal)
            {
                return true;
            }
            else
            {
                return false;
            }         
        }
        else
        {
            if (DogProficiency + SingleProficiency >= DogzEquipMaxConfig.upExpTotal)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}