少年修仙传客户端代码仓库
hch
2025-03-03 28785d6ddf9c08e49527ede9405c7b6c93c6ed32
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
 
using System;
using vnxbqy.UI;
 
namespace vnxbqy.UI
{
    
    public class RolePromoteModel : Model, IBeforePlayerDataInitialize, IAfterPlayerDataInitialize, IPlayerLoginOk
    {
        PackModel _playerPack;
        PackModel playerPack
        {
            get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PackModel>()); }
        }
 
        EquipGemModel equipGemModel { get { return ModelCenter.Instance.GetModel<EquipGemModel>(); } }
 
        public override void Init()
        {
            //ParseConfig();
            //playerPack.refreshItemCountEvent += RefreshItemCountAct;
            //MountModel.Event_MountHA301A += OnRefreshMountData;
            //PetModel.Event_H0704Add += OnRefreshPetData;
            //PetModel.Event_H0704Update += OnRefreshPetData;
            //petmodel.PlayerLoginOkData += OnRefreshPetData;
            //RedpointCenter.Instance.redpointValueChangeEvent += RedpointValueChangeEvent;
            //ItemLogicUtility.Instance.GetBetterEquipEvent += RefreshGetBetterEquipEvent;
            //MountModel.PlayerLoginOKData += PlayerLoginOKData;
            //PlayerDatas.Instance.playerDataRefreshEvent += PlayerDataRefreshInfoEvent;
            //OnBeforePlayerDataInitialize();
        }
 
        public override void UnInit()
        {
 
        }
 
        public void OnBeforePlayerDataInitialize()
        {
 
        }
 
        public void OnAfterPlayerDataInitialize()
        {
 
        }
 
        public void OnPlayerLoginOk()
        {
            //CheckPromoteDetailEffect();
            //RefreshData();
        }
 
        public void RefreshData()
        {
            GetPetCntDic();
            GetMountCntDic();
        }
 
        TreasureModel m_TreasureModel;
        TreasureModel treasureModel
        {
            get
            {
                return m_TreasureModel ?? (m_TreasureModel = ModelCenter.Instance.GetModel<TreasureModel>());
            }
        }
 
        MagicianModel m_MagicianModel;
        MagicianModel magicianModel
        {
            get
            {
                return m_MagicianModel ?? (m_MagicianModel = ModelCenter.Instance.GetModel<MagicianModel>());
            }
        }
 
        RuneModel runeModel
        {
            get
            {
                return ModelCenter.Instance.GetModel<RuneModel>();
            }
        }
        PetModel m_petModel;
        PetModel petmodel
        {
            get
            {
                return m_petModel ?? (m_petModel = ModelCenter.Instance.GetModel<PetModel>());
            }
        }
        MountModel m_HorseModel;
        MountModel horsemodel
        {
            get
            {
                return m_HorseModel ?? (m_HorseModel = ModelCenter.Instance.GetModel<MountModel>());
            }
        }
        StrengthenModel m_StrengthengModel;
        StrengthenModel strengthengmodel
        {
            get
            {
                return m_StrengthengModel ?? (m_StrengthengModel = ModelCenter.Instance.GetModel<StrengthenModel>());
            }
        }
 
 
        AlchemyModel alchemyModel { get { return ModelCenter.Instance.GetModel<AlchemyModel>(); } }
 
        RoleModel roleModel { get { return ModelCenter.Instance.GetModel<RoleModel>(); } }
 
        ReikiRootModel reikiRootModel { get { return ModelCenter.Instance.GetModel<ReikiRootModel>(); } }
 
        #region 配置
        public Dictionary<int, int> wingLv2GenerDict = new Dictionary<int, int>();
        public Dictionary<int, List<RoleStrongerConfig>> roleStrongerDic = new Dictionary<int, List<RoleStrongerConfig>>();
        List<int> promotePercents = new List<int>();
        public List<int> fightPowerPercents = new List<int>();
        void ParseConfig()
        {
            var dict = RoleStrongerConfig.GetValues();
            foreach (var cfg in dict)
            {
                List<RoleStrongerConfig> list = null;
                roleStrongerDic.TryGetValue(cfg.funcType, out list);
                if (list == null)
                {
                    list = new List<RoleStrongerConfig>();
                    roleStrongerDic.Add(cfg.funcType, list);
                }
                list.Add(cfg);
            }
            var funcConfig = FuncConfigConfig.Get("WingLV");
            LitJson.JsonData _json = LitJson.JsonMapper.ToObject(funcConfig.Numerical1);
            foreach (var _wingLv in _json.Keys)
            {
                wingLv2GenerDict.Add(int.Parse(_wingLv), int.Parse(_json[_wingLv].ToString()));
            }
            funcConfig = FuncConfigConfig.Get("FightpowerUp");
            promotePercents.AddRange(ConfigParse.GetMultipleStr<int>(funcConfig.Numerical1));
            fightPowerPercents.AddRange(ConfigParse.GetMultipleStr<int>(funcConfig.Numerical2));
        }
 
        public List<RoleStrongerConfig> GetStrongerConfigs(int funcType)
        {
            List<RoleStrongerConfig> list = null;
            roleStrongerDic.TryGetValue(funcType, out list);
            return list;
        }
 
        public int GetPromoteState(int percent)
        {
            for (int i = 0; i < promotePercents.Count; i++)
            {
                if (percent <= promotePercents[i])
                {
                    return i;
                }
            }
            return promotePercents.Count - 1;
        }
        #endregion
 
        public RoleStrongerConfig GetPresentRoleStronger(int funcType)
        {
            List<RoleStrongerConfig> list = GetStrongerConfigs(funcType);
            int i = 0;
            int presentLevel = PlayerDatas.Instance.baseData.LV;
            if (list != null && list.Count > 0)
            {
                for (i = 0; i < list.Count; i++)
                {
                    if (presentLevel < list[i].LV)
                    {
                        return list[i];
                    }
                }
                return list[list.Count - 1];
            }
            return null;
        }
 
        #region 装备
        private void RefreshItemCountAct(PackType packType, int itemPlace, int id)
        {
            if (packType == PackType.Equip || packType == PackType.Item)
            {
                CheckPromoteDetailEffect();
            }
            else if (packType == PackType.PetPack)
            {
                GetPetCntDic();
            }
            else if (packType == PackType.Horse)
            {
                GetMountCntDic();
            }
        }
 
        public int GetEquipCnt(int _color, int _starlv, int _lv)
        {
            int _count = 0;
            SinglePack packTypeModel = playerPack.GetSinglePack(PackType.Equip);
            if (packTypeModel == null || packTypeModel.GetAllItems() == null || packTypeModel.GetAllItems().Count == 0)
            {
                return _count;
            }
            foreach (var _itemModel in packTypeModel.GetAllItems().Values)
            {
                var _itemCfg = ItemConfig.Get(_itemModel.itemId);
                if (_itemCfg != null)
                {
                    if (_itemCfg.ItemColor < _color || _itemCfg.LV < _lv)
                    {
                        continue;
                    }
                    if (_itemCfg.ItemColor > _color)
                    {
                        _count++;
                        continue;
                    }
                    if (_itemCfg.ItemColor == _color)
                    {
                        if (_itemCfg.StarLevel >= _starlv)
                        {
                            _count++;
                        }
                    }
                }
            }
            return _count;
        }
        #endregion
 
        #region 坐骑
 
        private void PlayerLoginOKData()
        {
            GetMountCntDic();
        }
 
        private void OnRefreshMountData(int _HorseID)
        {
            GetMountCntDic();
        }
        private Dictionary<int, Dictionary<int, int>> mountCntDic = new Dictionary<int, Dictionary<int, int>>();
        private void GetMountCntDic()
        {
            foreach (var dict in mountCntDic.Values)
            {
                dict.Clear();
            }
            var mountDict = horsemodel._DicHorse;
            if (mountDict == null || mountDict.Count == 0) return;
            foreach (var horseID in mountDict.Keys)
            {
                HorseConfig _tagHorseModel = HorseConfig.Get(horseID);
                if (_tagHorseModel == null)
                {
                    continue;
                }
                ItemConfig _tagChinItemModel = ItemConfig.Get(_tagHorseModel.ItemID);
                Dictionary<int, int> dict = null;
                mountCntDic.TryGetValue(_tagChinItemModel.ItemColor, out dict);
                if (dict == null)
                {
                    dict = new Dictionary<int, int>();
                    mountCntDic.Add(_tagChinItemModel.ItemColor, dict);
                    dict[mountDict[horseID].Lv] = 0;
                }
                if (!dict.ContainsKey(mountDict[horseID].Lv))
                {
                    dict.Add(mountDict[horseID].Lv, 0);
                }
                dict[mountDict[horseID].Lv]++;
            }
        }
        public int GetMountCnt(int _itemColor, int _lv)
        {
            int val = 0;
            foreach (var itemColor in mountCntDic.Keys)
            {
                if (itemColor < _itemColor)
                {
                    continue;
                }
                foreach (var lv in mountCntDic[itemColor].Keys)
                {
                    if (lv < _lv)
                    {
                        continue;
                    }
                    val += mountCntDic[itemColor][lv];
                }
            }
            return val;
        }
        public int GetMountTotallv()
        {
            var mountDict = horsemodel._DicHorse;
            if (mountDict == null || mountDict.Count == 0)
            {
                return 0;
            }
            var _lv = 0;
            foreach (var _horse in mountDict.Values)
            {
                _lv += _horse.Lv;
            }
            return _lv;
        }
        #endregion
 
        #region 灵宠
        private void OnRefreshPetData(int info)
        {
            GetPetCntDic();
        }
        private void OnRefreshPetData()
        {
            GetPetCntDic();
        }
        private Dictionary<int, int> petCntDic = new Dictionary<int, int>();
        private void GetPetCntDic()
        {
            petCntDic.Clear();
            var dict = petmodel._DicPetBack;
            if (dict == null) return;
            foreach (var pet in dict.Values)
            {
                if (!petCntDic.ContainsKey(pet.PetClass))
                {
                    petCntDic.Add(pet.PetClass, 0);
                }
                petCntDic[pet.PetClass]++;
            }
        }
        public int GetPetCnt(int lv)
        {
            int val = 0;
            foreach (var key in petCntDic.Keys)
            {
                if (key >= lv)
                {
                    val += petCntDic[key];
                }
            }
            return val;
        }
        #endregion
 
        #region 洗炼
 
        #endregion
 
        #region 炼丹
        public int GetBlastFurnaceDragUseCount(int _lv)
        {
            var list = playerPack.makeDruglist;
            var count = 0;
            if (list != null)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    var config = ItemConfig.Get(list[i].ID);
                    if (config != null && config.LV == _lv)
                    {
                        count += playerPack.GetItemTotalUsedTimes(config.ID);
                    }
                }
            }
            return count;
        }
        #endregion
 
        #region 主界面提升
        PlayerMethodData methodData
        {
            get { return ModelCenter.Instance.GetModel<PlayerMethodData>(); }
        }
 
        RealmModel realmModel { get { return ModelCenter.Instance.GetModel<RealmModel>(); } }
 
        public Redpoint m_PromoteRedpoint = new Redpoint(31);
 
        private void RefreshGetBetterEquipEvent(string _str)
        {
            CheckPromoteDetailEffect();
        }
 
        public void CheckPromoteDetailEffect()
        {
            m_PromoteRedpoint.state = RedPointState.None;
            for (int i = 0; i < (int)PromoteDetailType.RolePromote; i++)
            {
                if (GetPromoteDetailShow((PromoteDetailType)i))
                {
                    m_PromoteRedpoint.state = RedPointState.Simple;
                    break;
                }
            }
        }
 
        private void BlastFurnacePromoteUpdate()
        {
            CheckPromoteDetailEffect();
        }
 
        private void PlayerDataRefreshInfoEvent(PlayerDataType refreshType)
        {
            if (refreshType == PlayerDataType.RealmLevel)
            {
                CheckPromoteDetailEffect();
            }
        }
 
        private void RedpointValueChangeEvent(int _id)
        {
            if (_id == 999999 /*strengthengmodel.StrengthRedpoint.id*/ ||
                _id == MainRedDot.RedPoint_MountPackKey ||
                _id == MainRedDot.Instance.redPonintPetFunc2.id ||
                _id == MainRedDot.Instance.redPointWashFunc.id ||
                _id == runeModel.redpoint.id ||
                _id == magicianModel.magicianRedpoint.id ||
                _id == methodData.fairyHeartRedpoint.id ||
                _id == realmModel.levelUpRedpoint.id ||
                _id == equipGemModel.redpoint.id ||
                _id == reikiRootModel.redpoint.id ||
                _id == alchemyModel.alchemyDrugRedpoint3.id ||
                _id == alchemyModel.alchemyDrugRedpoint4.id)
            {
                CheckPromoteDetailEffect();
            }
        }
 
        public bool GetPromoteDetailShow(PromoteDetailType _type)
        {
            switch (_type)
            {
                case PromoteDetailType.BetterEquip:
                    var dict = ItemLogicUtility.Instance.CheckBetterEquipByRealm();
                    return dict != null && dict.Count > 0;
                case PromoteDetailType.AddPoint:
                    return reikiRootModel.redpoint.state == RedPointState.Simple;
                case PromoteDetailType.EquipStrength:
                    return false;
                case PromoteDetailType.Mount:
                    return MainRedDot.Instance.redPointMountFunc.state == RedPointState.Simple;
                case PromoteDetailType.Pet:
                    return MainRedDot.Instance.redPonintPetFunc2.state == RedPointState.Simple;
                case PromoteDetailType.RuneMosaic:
                    return runeModel.redpoint.state == RedPointState.Simple;
                case PromoteDetailType.GodWeapon:
                    return magicianModel.magicianRedpoint.state == RedPointState.Simple;
                case PromoteDetailType.TreasurePotential:
                    return false;
                case PromoteDetailType.Gem:
                    return equipGemModel.redpoint.state == RedPointState.Simple;
                case PromoteDetailType.Wash:
                    return MainRedDot.Instance.redPointWashFunc.state == RedPointState.Simple;
                case PromoteDetailType.RolePromote:
                    return true;
                case PromoteDetailType.FairyHeart:
                    return ModelCenter.Instance.GetModel<PlayerMethodData>().fairyHeartRedpoint.state == RedPointState.Simple;
                case PromoteDetailType.BlastFurnace:
                    return alchemyModel.alchemyDrugRedpoint3.state == RedPointState.Simple
                        || alchemyModel.alchemyDrugRedpoint4.state == RedPointState.Simple;
                case PromoteDetailType.max:
                    break;
            }
            return false;
        }
        #endregion
 
        public enum PromoteDetailType
        {
            BetterEquip,
            AddPoint,
            EquipStrength,
            Mount,
            Pet,
            RuneMosaic,
            Gem,
            Wash,
            GodWeapon,
            FairyHeart,
            TreasurePotential,
            BlastFurnace,//八卦炉
            RolePromote,
            //后续IL开发添加预设
            default1,
            default2,
            default3,
            default4,
            default5,
            default6,
            default7,
            default8,
            default9,
            default10,
            max,
        }
    }
}