少年修仙传客户端代码仓库
client_Wu Xijin
2019-02-20 a87120c155c48fa45b20a97c1a58bdbeb77318b7
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
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
 
using System;
using System.Linq;
using Snxxz.UI;
 
namespace Snxxz.UI
{
    [XLua.Hotfix]
    [XLua.LuaCallCSharp]
    public class MagicianModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk
    {
        public event Action onSelectUpdate;
 
        PlayerPackModel packModel
        {
            get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); }
        }
 
        bool serverInited = false;
 
        public override void Init()
        {
            ParseConfig();
            packModel.RefreshItemCountAct += RefreshPackItem;
            FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChangeEvent;
            PlayerDatas.Instance.PlayerDataRefreshInfoEvent += PlayerDataRefreshInfoEvent;
        }
 
        private void OnFuncStateChangeEvent(int func)
        {
            if (func == (int)FuncOpenEnum.GodWeapon)
            {
                UpdateRedPoint();
            }
        }
 
        private void RefreshPackItem(PackType packType, int index, int id)
        {
            if (packType != PackType.Item)
            {
                return;
            }
            UpdateRedPoint();
        }
 
        private void PlayerDataRefreshInfoEvent(PlayerDataRefresh refreshType)
        {
            if (refreshType == PlayerDataRefresh.LV)
            {
                UpdateRedPoint();
            }
        }
 
        public override void UnInit()
        {
            packModel.RefreshItemCountAct -= RefreshPackItem;
            FuncOpen.Instance.OnFuncStateChangeEvent -= OnFuncStateChangeEvent;
            PlayerDatas.Instance.PlayerDataRefreshInfoEvent -= PlayerDataRefreshInfoEvent;
        }
 
        public void OnBeforePlayerDataInitialize()
        {
            serverInited = false;
            foreach (var godWeapon in godWeaponInfoDict.Values)
            {
                godWeapon.level = 0;
                godWeapon.exp = 0;
            }
        }
 
        public void OnPlayerLoginOk()
        {
            serverInited = true;
            UpdateRedPoint();
            CheckGodWeaponEffectOn();
        }
 
        private Dictionary<int, int[]> godWeaponLevelUpCost = new Dictionary<int, int[]>();
        public List<int> godWeaponTypes { get; private set; }
        public Dictionary<int, int> godWeaponBoxDict { get; private set; } //key 神兵石礼包 value 神兵类型
        public List<int> godWeaponEffectTypes { get; private set; }
        public Dictionary<int, string> godWeaponIcons { get; private set; }
        public Dictionary<int, Dictionary<int, int>> godWeaponSkillDict = new Dictionary<int, Dictionary<int, int>>();
        Dictionary<int, List<GodWeaponCondition>> godWeaponConditions = new Dictionary<int, List<GodWeaponCondition>>();
        Dictionary<int, int> playerLevelConditions = new Dictionary<int, int>();
        public List<int> godWeaponSorts = new List<int>();
        Dictionary<int, AutoHammerCost> autoHammerCostDict = new Dictionary<int, AutoHammerCost>();
        Dictionary<int, List<int>> godWeaponStageDict = new Dictionary<int, List<int>>();
        Dictionary<int, int> exteriorPowerDict = new Dictionary<int, int>();
        Dictionary<int, int> godWeaponSkillEffect = new Dictionary<int, int>();
        Dictionary<int, int> singleHarmmerExp = new Dictionary<int, int>();
        Dictionary<int, List<GodWeaponEffectProperty>> effectPropertyDict =
            new Dictionary<int, List<GodWeaponEffectProperty>>();
        Dictionary<int, Dictionary<int, int>> effectFightPower = new Dictionary<int, Dictionary<int, int>>();
        Dictionary<int, int> godWeaponEffectEquipDict = new Dictionary<int, int>();
        Dictionary<int, List<GodWeaponEffectInfo>> godWeaponEffectInfos = new Dictionary<int, List<GodWeaponEffectInfo>>();
        int[] autoHammerExpArea { get; set; }
        int[] autoHammerCount { get; set; }
 
        int m_SelectType = 0;
        public int selectType
        {
            get { return m_SelectType; }
            set
            {
                if (m_SelectType != value)
                {
                    m_SelectType = value;
                    if (onSelectUpdate != null)
                    {
                        onSelectUpdate();
                    }
                }
            }
        }
 
        public int selectItemIndex = 0;
        public int gotoType = 0;
 
        public int autoHammerLevel { get; set; }
 
        public int hammerAudioId { get; private set; }
        public int audioLength { get; private set; }
        void ParseConfig()
        {
            var godWeaponBox = FuncConfigConfig.Get("GodWeaponBox");
            godWeaponBoxDict = ConfigParse.GetDic<int, int>(godWeaponBox.Numerical1);
 
            godWeaponTypes = GodWeaponConfig.GetGodWeaponType();
            for (int i = 0; i < godWeaponTypes.Count; i++)
            {
                GodWeaponInfo godWeapon = new GodWeaponInfo()
                {
                    exp = 0,
                    level = 0,
                    type = godWeaponTypes[i],
                };
                godWeaponInfoDict.Add(godWeapon.type, godWeapon);
 
                if (!redpointDict.ContainsKey(godWeapon.type))
                {
                    Redpoint redpoint = new Redpoint(MAGICAIN_REDPOINT, MAGICAIN_REDPOINT * MAGICAIN_INTERVAL + godWeapon.type);
                    redpointDict.Add(godWeapon.type, redpoint);
                    redpoint.state = RedPointState.None;
                }
 
                var config = FuncConfigConfig.Get(string.Format("GodWeapon{0}", godWeaponTypes[i]));
                int[] itemarray = ConfigParse.GetMultipleStr<int>(config.Numerical1);
                godWeaponLevelUpCost.Add(godWeaponTypes[i], itemarray);
            }
 
            godWeaponIcons = new Dictionary<int, string>();
            var _cfg = FuncConfigConfig.Get("GodModel");
            var _godWeaponJson = LitJson.JsonMapper.ToObject(_cfg.Numerical2);
            foreach (var _key in _godWeaponJson.Keys)
            {
                var _godWeaponType = int.Parse(_key);
                if (!godWeaponIcons.ContainsKey(_godWeaponType))
                {
                    godWeaponIcons.Add(_godWeaponType, _godWeaponJson[_key].ToString());
                }
            }
 
            var configs = GodWeaponConfig.GetValues();
            for (int i = 0; i < configs.Count; i++)
            {
                if (configs[i].SkillID != 0)
                {
                    Dictionary<int, int> _dict = null;
                    if (!godWeaponSkillDict.TryGetValue(configs[i].Type, out _dict))
                    {
                        _dict = new Dictionary<int, int>();
                        godWeaponSkillDict.Add(configs[i].Type, _dict);
                    }
                    _dict.Add(configs[i].Lv, configs[i].SkillID);
                }
            }
 
            var conditionConfig = FuncConfigConfig.Get("GodWeaponActive");
            var json = LitJson.JsonMapper.ToObject(conditionConfig.Numerical2);
            foreach (var key in json.Keys)
            {
                var type = int.Parse(key);
                List<GodWeaponCondition> list;
                if (!godWeaponConditions.TryGetValue(type, out list))
                {
                    list = new List<GodWeaponCondition>();
                    godWeaponConditions.Add(type, list);
                }
                int[][] conditions = LitJson.JsonMapper.ToObject<int[][]>(json[key].ToJson());
                for (int i = 0; i < conditions.Length; i++)
                {
                    var condition = conditions[i];
                    list.Add(new GodWeaponCondition()
                    {
                        type = condition[0],
                        level = condition[1],
                    });
                }
            }
 
            json = LitJson.JsonMapper.ToObject(conditionConfig.Numerical3);
            foreach (var key in json.Keys)
            {
                var type = int.Parse(key);
                playerLevelConditions.Add(type, int.Parse(json[key].ToString()));
            }
 
            var sortConfig = FuncConfigConfig.Get("GodWeaponSort");
            godWeaponSorts.AddRange(ConfigParse.GetMultipleStr<int>(sortConfig.Numerical1));
 
            var autoHammerConfig = FuncConfigConfig.Get("GodWeaponAutoHammer");
            if (autoHammerConfig != null)
            {
                autoHammerExpArea = ConfigParse.GetMultipleStr<int>(autoHammerConfig.Numerical1);
                autoHammerCount = ConfigParse.GetMultipleStr<int>(autoHammerConfig.Numerical2);
                singleHarmmerExp = ConfigParse.GetDic<int, int>(autoHammerConfig.Numerical3);
            }
 
            var funcConfig = FuncConfigConfig.Get("GodMagicExp");
            json = LitJson.JsonMapper.ToObject(funcConfig.Numerical1);
            foreach (var key in json.Keys)
            {
                var type = int.Parse(key);
                var array = LitJson.JsonMapper.ToObject<int[]>(json[key].ToJson());
                autoHammerCostDict.Add(type, new AutoHammerCost()
                {
                    cost = array[0],
                    exp = array[1],
                });
            }
 
            godWeaponEffectTypes = new List<int>();
            var godWeaponEffects = GodWeaponEffectConfig.GetValues();
            for (int i = 0; i < godWeaponEffects.Count; i++)
            {
                var config = godWeaponEffects[i];
                List<int> stages;
                if (!godWeaponStageDict.TryGetValue(config.type, out stages))
                {
                    stages = new List<int>();
                    godWeaponStageDict.Add(config.type, stages);
                }
                stages.Add(config.level);
                List<GodWeaponEffectProperty> list;
                if (!effectPropertyDict.TryGetValue(config.type, out list))
                {
                    list = new List<GodWeaponEffectProperty>();
                    effectPropertyDict.Add(config.type, list);
                }
                list.Add(new GodWeaponEffectProperty()
                {
                    level = config.level,
                    propertyDict = ConfigParse.GetDic<int, int>(config.attr),
                });
                Dictionary<int, int> dict;
                if (!effectFightPower.TryGetValue(config.type, out dict))
                {
                    dict = new Dictionary<int, int>();
                    effectFightPower.Add(config.type, dict);
                }
                dict.Add(config.level, config.fightPower);
 
                if (!godWeaponEffectTypes.Contains(config.type))
                {
                    godWeaponEffectTypes.Add(config.type);
                }
 
                List<GodWeaponEffectInfo> effectInfos;
                if (!godWeaponEffectInfos.TryGetValue(config.type, out effectInfos))
                {
                    effectInfos = new List<GodWeaponEffectInfo>();
                    godWeaponEffectInfos.Add(config.type, effectInfos);
                }
                Dictionary<int, string> skillIconDict = new Dictionary<int, string>();
                var iconJson = LitJson.JsonMapper.ToObject(config.icon);
                foreach (var key in iconJson.Keys)
                {
                    var job = int.Parse(key);
                    skillIconDict.Add(job, iconJson[key].ToString());
                }
                effectInfos.Add(new GodWeaponEffectInfo()
                {
                    level = config.level,
                    skillIconDict = skillIconDict,
                });
            }
 
            funcConfig = FuncConfigConfig.Get("MagicExterior");
            json = LitJson.JsonMapper.ToObject(funcConfig.Numerical1);
            foreach (var key in json.Keys)
            {
                var type = int.Parse(key);
                var power = int.Parse(json[key].ToString());
                exteriorPowerDict.Add(type, power);
            }
 
            funcConfig = FuncConfigConfig.Get("GodWeaponSkillEffect");
            if (funcConfig != null)
            {
                json = LitJson.JsonMapper.ToObject(funcConfig.Numerical1);
                foreach (var key in json.Keys)
                {
                    var skillId = int.Parse(key);
                    if (!godWeaponSkillEffect.ContainsKey(skillId))
                    {
                        godWeaponSkillEffect.Add(skillId, int.Parse(json[key].ToString()));
                    }
                }
            }
 
            funcConfig = FuncConfigConfig.Get("Godvideo");
            hammerAudioId = int.Parse(funcConfig.Numerical1);
            audioLength = int.Parse(funcConfig.Numerical2);
        }
 
        public int[] GetLevelUpItemByType(int type)
        {
            return godWeaponLevelUpCost[type];
        }
 
        public bool TryGetMagicType(int itemId,out int type)
        {
            type = 0;
            foreach(var key in godWeaponLevelUpCost.Keys)
            {
                var costlist = godWeaponLevelUpCost[key];
                if(costlist.Contains(itemId))
                {
                    type = key;
                    return true;
                }
            }
 
            if(godWeaponBoxDict.ContainsKey(itemId))
            {
                type = godWeaponBoxDict[itemId];
                return true;
            }
            return false;
        }
 
        #region 红点
        public const int MAGICAIN_REDPOINT = 10103;
        public const int MAGICAIN_INTERVAL = 100;
        public Dictionary<int, Redpoint> redpointDict = new Dictionary<int, Redpoint>();
        Redpoint magicianPoint = new Redpoint(101, MAGICAIN_REDPOINT);
        public Redpoint magicianRedpoint { get { return magicianPoint; } }
        public void UpdateRedPoint()
        {
            foreach (var redpoint in redpointDict.Values)
            {
                redpoint.state = RedPointState.None;
            }
            if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.GodWeapon))
            {
                return;
            }
            foreach (var key in redpointDict.Keys)
            {
                if (IsGodWeaponMaxLevel(key))
                {
                    continue;
                }
                if (!IsGodWeaponUnlock(key) && ContainsCondition(key))
                {
                    if (SatisfyUnlockCondition(key))
                    {
                        redpointDict[key].state = RedPointState.Simple;
                    }
                    continue;
                }
                int[] items = GetLevelUpItemByType((int)key);
                for (int i = 0; i < items.Length; i++)
                {
                    if (packModel.GetItemCountByID(PackType.Item, items[i]) > 0)
                    {
                        redpointDict[key].state = RedPointState.Simple;
                        break;
                    }
                }
            }
        }
 
        public bool GetRedpointLightByType(int _type)
        {
            if (redpointDict.ContainsKey(_type))
            {
                return redpointDict[_type].state == RedPointState.Simple;
            }
            return false;
        }
        #endregion
 
        public void HammerGodWeapon(int type)
        {
            GodWeaponInfo godWeaponInfo = GetGodWeaponInfo(type);
            if (godWeaponInfo == null)
            {
                return;
            }
            if (IsGodWeaponMaxLevel(type))
            {
                ServerTipDetails.DisplayNormalTip(Language.Get("L1054"));
                return;
            }
            int[] items = GetLevelUpItemByType(type);
            if (selectItemIndex >= items.Length)
            {
                return;
            }
            var itemId = items[selectItemIndex];
            ItemConfig itemConfig = ItemConfig.Get(itemId);
            var count = packModel.GetItemCountByID(PackType.Item, itemId);
            if (count < 1)
            {
                ModelCenter.Instance.GetModel<GetItemPathModel>().SetChinItemModel(itemId);
                if (!IsGodWeaponHammerItem(3, itemId) && !NewBieCenter.Instance.completeGuidesBuf.Contains(85))
                {
                    NewBieCenter.Instance.StartNewBieGuide(85);
                }
                return;
            }
            CA555_tagCMGodWeaponPlus pak = new CA555_tagCMGodWeaponPlus();
            pak.WeaponType = (uint)type;
            pak.ItemID = (uint)itemId;
            pak.ItemCount = 1;
            pak.IsAutoBuy = 0;
            GameNetSystem.Instance.SendInfo(pak);
            PlayHammerAudio();
        }
 
        DateTime lastAudioTime = DateTime.Now;
        public void PlayHammerAudio()
        {
            var seconds = (float)audioLength / 1000;
            if ((DateTime.Now - lastAudioTime).TotalSeconds < seconds)
            {
                return;
            }
            lastAudioTime = DateTime.Now;
            SoundPlayer.Instance.PlayUIAudio(hammerAudioId);
        }
 
        public event Action godWeaponUpdate;
        private Dictionary<int, GodWeaponInfo> godWeaponInfoDict = new Dictionary<int, GodWeaponInfo>();
        public void UpdateGodWeaponInfo(HA31D_tagMCGodWeaponLVList package)
        {
            for (byte i = 0; i < package.WeaponNum; i++)
            {
                HA31D_tagMCGodWeaponLVList.tagMCGodWeaponLVInfo data = package.WeaponInfoList[i];
                GodWeaponInfo godWeaponInfo = GetGodWeaponInfo(data.WeaponType);
                if (godWeaponInfo != null)
                {
                    var beforeLevel = godWeaponInfo.level;
                    godWeaponInfo.exp = data.WeaponExp;
                    godWeaponInfo.level = data.WeaponLV;
                    CheckActivate(godWeaponInfo.type, beforeLevel, data.WeaponLV);
                }
            }
            UpdateRedPoint();
            if (godWeaponUpdate != null)
            {
                godWeaponUpdate();
            }
        }
 
        void CheckActivate(int _type, int _beforeLv, int _nowLv)
        {
            if (serverInited)
            {
                var stage = 0;
                if (_beforeLv != _nowLv && TryGetUnlockStage(_type, _beforeLv, _nowLv, out stage))
                {
                    EquipShowSwitch.SendGodWeaponEffectOn(_type, stage, true);
                    if (WindowCenter.Instance.IsOpen<MagicianWin>()
                          && !NewBieCenter.Instance.inGuiding)
                    {
                        if (WindowCenter.Instance.IsOpen<GodWeaponPreviewWin>())
                        {
                            WindowCenter.Instance.Close<GodWeaponPreviewWin>();
                        }
                        if (WindowCenter.Instance.IsOpen<HowToPlayWin>())
                        {
                            WindowCenter.Instance.Close<HowToPlayWin>();
                        }
                        ActivateShow.GodWeaponStage(_type, _nowLv, _beforeLv, stage);
                    }
                    return;
                }
            }
            var _skillId = 0;
            if (serverInited && _beforeLv != _nowLv
                && (_beforeLv == 0 || TryGetUnlockSkill(_type, _beforeLv, _nowLv, out _skillId)))
            {
                if (WindowCenter.Instance.IsOpen<MagicianWin>()
                    && !NewBieCenter.Instance.inGuiding)
                {
                    if (WindowCenter.Instance.IsOpen<GodWeaponPreviewWin>())
                    {
                        WindowCenter.Instance.Close<GodWeaponPreviewWin>();
                    }
                    if (WindowCenter.Instance.IsOpen<HowToPlayWin>())
                    {
                        WindowCenter.Instance.Close<HowToPlayWin>();
                    }
                    ActivateShow.GodWeaponActivate(_type, _nowLv, _beforeLv);
                }
            }
        }
 
        public bool TryGetUnlockStage(int _type, int _beforeLv, int _nowLv, out int stage)
        {
            stage = 0;
            List<int> stages = null;
            if (TryGetGodWeaponStages(_type, out stages))
            {
                var beforeStage = 0;
                for (int i = 0; i < stages.Count; i++)
                {
                    if (stages[i] <= _beforeLv)
                    {
                        beforeStage = i + 1;
                    }
                }
                for (int i = 0; i < stages.Count; i++)
                {
                    if (stages[i] <= _nowLv)
                    {
                        stage = i + 1;
                    }
                }
                return stage > beforeStage;
            }
            return false;
        }
 
        public bool TryGetUnlockSkill(int _type, int _beforeLv, int _nowLv,out int _skillid)
        {
            _skillid = 0;
            if (godWeaponSkillDict.ContainsKey(_type))
            {
                var _dict = godWeaponSkillDict[_type];
                foreach (var _lv in _dict.Keys)
                {
                    if (_beforeLv < _lv && _lv <= _nowLv)
                    {
                        _skillid = _dict[_lv];
                        return true;
                    }
                }
            }
            return false;
        }
 
        public bool TryGetGodWeaponSkills(int type, out Dictionary<int, int> skills)
        {
            return godWeaponSkillDict.TryGetValue(type, out skills);
        }
 
        public GodWeaponInfo GetGodWeaponInfo(int type)
        {
            GodWeaponInfo data = null;
            godWeaponInfoDict.TryGetValue(type, out data);
            return data;
        }
 
        public bool IsGodWeaponMaxLevel(int _type)
        {
            var _data = GetGodWeaponInfo(_type);
            var config = GodWeaponConfig.GetConfig(_type, _data.level + 1);
            return config == null;
        }
 
        public bool IsGodWeaponHammerItem(int _type,int _itemId)
        {
            var items = GetLevelUpItemByType(_type);
            if (items == null)
            {
                return false;
            }
            for (int i = 0; i < items.Length; i++)
            {
                if (items[i] == _itemId)
                {
                    return true;
                }
            }
            return false;
        }
 
        public bool IsGodWeaponUnlock(int type)
        {
            var godWeaponInfo = GetGodWeaponInfo(type);
            if (godWeaponInfo != null && godWeaponInfo.level >= 1)
            {
                return true;
            }
            return false;
        }
 
        public bool SatisfyUnlockCondition(int type)
        {
            if (!playerLevelConditions.ContainsKey(type)
                && !godWeaponConditions.ContainsKey(type))
            {
                return true;
            }
            List<GodWeaponCondition> list;
            bool satisfyCondition = false;
            if (godWeaponConditions.TryGetValue(type, out list))
            {
                bool satisfy = true;
                for (int i = 0; i < list.Count; i++)
                {
                    var godWeaponInfo = GetGodWeaponInfo(list[i].type);
                    if (godWeaponInfo == null || godWeaponInfo.level < list[i].level)
                    {
                        satisfy = false;
                        break;
                    }
                }
                if (satisfy)
                {
                    satisfyCondition = true;
                }
            }
            var playerLevelLimit = 0;
            if (TryGetPlayerLevelCondition(type, out playerLevelLimit))
            {
                if (PlayerDatas.Instance.baseData.LV >= playerLevelLimit)
                {
                    satisfyCondition = true;
                }
            }
            return satisfyCondition;
        }
 
        public int GetAutoHammerCount(int type)
        {
            ulong totalExp = 0;
            var godWeaponInfo = GetGodWeaponInfo(type);
            if (godWeaponInfo == null || autoHammerExpArea == null || autoHammerCount == null)
            {
                return 1;
            }
            var config = GodWeaponConfig.GetConfig(type, godWeaponInfo.level);
            totalExp = (ulong)config.NeedExp;
            var index = 0;
            for (int i = 0; i < autoHammerExpArea.Length; i++)
            {
                if (totalExp < (ulong)autoHammerExpArea[i])
                {
                    index = i;
                    break;
                }
                else
                {
                    index++;
                }
            }
            if (index < autoHammerCount.Length)
            {
                return autoHammerCount[index];
            }
            return autoHammerCount[autoHammerCount.Length - 1];
        }
 
        public int GetAutoHammerCount(int type, int index)
        {
            var items = GetLevelUpItemByType(type);
            var moneyCount = GetAutoHammerCount(type);
            AutoHammerCost autoHammerCost;
            var totalExp = 0;
            if (TryGetAutoHammerCost(type, out autoHammerCost))
            {
                totalExp = moneyCount * autoHammerCost.exp;
            }
            else if (singleHarmmerExp.ContainsKey(type))
            {
                totalExp = moneyCount * singleHarmmerExp[type];
            }
            var itemId = items[index];
            var itemConfig = ItemConfig.Get(itemId);
            var expCount = Mathf.CeilToInt((float)totalExp / itemConfig.EffectValueA1);
            var packCount = packModel.GetItemCountByID(PackType.Item, itemId);
            return Mathf.Min(expCount, packCount);
        }
 
        public bool ContainsCondition(int type)
        {
            return godWeaponConditions.ContainsKey(type) || playerLevelConditions.ContainsKey(type);
        }
 
        public bool TryGetConditions(int type, out List<GodWeaponCondition> list)
        {
            return godWeaponConditions.TryGetValue(type, out list);
        }
 
        public bool TryGetPlayerLevelCondition(int type,out int level)
        {
            return playerLevelConditions.TryGetValue(type, out level);
        }
 
        public int GetGodWeaponStage(int type)
        {
            var stage = 0;
            var godWeaponInfo = GetGodWeaponInfo(type);
            if (godWeaponInfo != null)
            {
                var godWeaponStages = godWeaponStageDict[type];
                for (int i = 0; i < godWeaponStages.Count; i++)
                {
                    if (godWeaponInfo.level >= godWeaponStages[i])
                    {
                        stage = i + 1;
                    }
                    else
                    {
                        break;
                    }
                }
            }
            return stage;
        }
 
        public int GetGodWeaponStageRequireLevel(int type, int stage)
        {
            var godWeaponStages = godWeaponStageDict[type];
            if (stage > 0 && stage - 1 < godWeaponStages.Count)
            {
                return godWeaponStages[stage - 1];
            }
            return 0;
        }
 
        public bool TryGetGodWeaponStage(int type, int level, out int stage)
        {
            List<int> list;
            stage = 0;
            if (TryGetGodWeaponStages(type, out list))
            {
                for (int i = 0; i < list.Count; i++)
                {
                    if (list[i] == level)
                    {
                        stage = i + 1;
                        return true;
                    }
                }
            }
            return false;
        }
 
        public bool TryGetGodWeaponStages(int type, out List<int> stages)
        {
            return godWeaponStageDict.TryGetValue(type, out stages);
        }
 
        public bool IsGodWeaponMaxLevelByItem(int _itemId)
        {
            foreach (var _key in godWeaponLevelUpCost.Keys)
            {
                for (int i = 0; i < godWeaponLevelUpCost[_key].Length; i++)
                {
                    if (godWeaponLevelUpCost[_key][i] == _itemId)
                    {
                        return IsGodWeaponMaxLevel(_key);
                    }
                }
            }
            return false;
        }
 
        public bool TryGetAutoHammerCost(int type,out AutoHammerCost autoHammerCost)
        {
            return autoHammerCostDict.TryGetValue(type, out autoHammerCost);
        }
 
        public bool TryGetExteriorPower(int type, out int power)
        {
            return exteriorPowerDict.TryGetValue(type, out power);
        }
 
        public bool TryGetGodWeaponSkillEffect(int skillId, out int effect)
        {
            return godWeaponSkillEffect.TryGetValue(skillId, out effect);
        }
 
        public bool TryGetEffectProperty(int type, int level, out Dictionary<int, int> dict)
        {
            dict = null;
            if (effectPropertyDict.ContainsKey(type))
            {
                var effectProperty = effectPropertyDict[type].Find((x) =>
                  {
                      return x.level == level;
                  });
                if (!effectProperty.Equals(default(GodWeaponEffectProperty)))
                {
                    dict = effectProperty.propertyDict;
                    return true;
                }
            }
            return false;
        }
 
        public int TryGetEffectFightPower(int type, int stage)
        {
            var previousFightPower = 0;
            if (stage - 1 > 0)
            {
                var previousLevel = GetGodWeaponStageRequireLevel(type, stage - 1);
                if (effectFightPower.ContainsKey(type)
                    && effectFightPower[type].ContainsKey(previousLevel))
                {
                    previousFightPower = effectFightPower[type][previousLevel];
                }
            }
            var level = GetGodWeaponStageRequireLevel(type, stage);
            if (effectFightPower.ContainsKey(type)
                && effectFightPower[type].ContainsKey(level))
            {
                return effectFightPower[type][level] - previousFightPower;
            }
            return 0;
        }
 
        public int GetEffectRealFightPower(int type, int stage)
        {
            var level = GetGodWeaponStageRequireLevel(type, stage);
            if (effectFightPower.ContainsKey(type)
                && effectFightPower[type].ContainsKey(level))
            {
                return effectFightPower[type][level];
            }
            return 0;
        }
 
        Dictionary<int, int> propertyCacheDict = new Dictionary<int, int>();
        public Dictionary<int, int> GetEffectPropertyUpper(int type, int stage)
        {
            propertyCacheDict.Clear();
            Dictionary<int, int> previousPropertyDict = null;
            if (stage - 1 > 0)
            {
                var level = GetGodWeaponStageRequireLevel(type, stage - 1);
                TryGetEffectProperty(type, level, out previousPropertyDict);
            }
            var requireLevel = GetGodWeaponStageRequireLevel(type, stage);
            Dictionary<int, int> dict;
            if (TryGetEffectProperty(type, requireLevel, out dict))
            {
                foreach (var key in dict.Keys)
                {
                    if (previousPropertyDict != null && previousPropertyDict.ContainsKey(key))
                    {
                        propertyCacheDict.Add(key, dict[key] - previousPropertyDict[key]);
                    }
                    else
                    {
                        propertyCacheDict.Add(key, dict[key]);
                    }
                }
            }
            return propertyCacheDict;
        }
 
        public List<int> TryGetDisplaySkillLevels(int type)
        {
            List<int> displaySkillLevels = new List<int>();
            Dictionary<int, int> dict;
            if (TryGetGodWeaponSkills(type, out dict))
            {
                displaySkillLevels.AddRange(dict.Keys);
            }
            List<int> list;
            if (TryGetGodWeaponStages(type, out list))
            {
                displaySkillLevels.AddRange(list);
            }
            displaySkillLevels.Sort();
            return displaySkillLevels;
        }
 
        public string GetEffectSkillIcon(int type, int level)
        {
            var job = PlayerDatas.Instance.baseData.Job;
            if (godWeaponEffectInfos.ContainsKey(type))
            {
                var list = godWeaponEffectInfos[type];
                var index = list.FindIndex((x) =>
                 {
                     return x.level == level;
                 });
                if (index != -1)
                {
                    if (list[index].skillIconDict.ContainsKey(job))
                    {
                        return list[index].skillIconDict[job];
                    }
                }
            }
            return string.Empty;
        }
 
        void CheckGodWeaponEffectOn()
        {
            var value = PlayerDatas.Instance.baseData.equipShowSwitch;
            if (value == 7)
            {
                value = 0;
                foreach (var type in godWeaponEffectTypes)
                {
                    var stage = GetGodWeaponStage(type);
                    if (stage != 0 && stage <= 3)
                    {
                        var index = EquipShowSwitch.GetGodWeaponEquipShowIndex(type, stage);
                        value = (uint)MathUtility.SetBitValue((int)value, index, true);
                    }
                }
            }
            else
            {
                foreach (var type in godWeaponEffectTypes)
                {
                    var requireLevel = 0;
                    var godWeapon = GetGodWeaponInfo(type);
                    if (EquipShowSwitch.IsGodWeaponEffectOn(value, type, out requireLevel)
                        && (godWeapon == null || godWeapon.level < requireLevel))
                    {
                        var stage = 0;
                        if (TryGetGodWeaponStage(type, requireLevel, out stage))
                        {
                            var index = EquipShowSwitch.GetGodWeaponEquipShowIndex(type, stage);
                            value = (uint)MathUtility.SetBitValue((int)value, index, false);
                        }
                    }
                }
            }
            if (value != PlayerDatas.Instance.baseData.equipShowSwitch)
            {
                EquipShowSwitch.SendPackage(value);
            }
        }
    }
 
    public class GodWeaponInfo
    {
        public int type;
        public int level;
        public uint exp;
    }
 
    public struct GodWeaponCondition
    {
        public int type;
        public int level;
    }
 
    public struct AutoHammerCost
    {
        public int cost;
        public int exp;
    }
 
    public struct GodWeaponEffectProperty
    {
        public int level;
        public Dictionary<int, int> propertyDict;
    }
 
    public struct GodWeaponEffectInfo
    {
        public int level;
        public Dictionary<int, string> skillIconDict;
    }
}