少年修仙传客户端代码仓库
client_Wu Xijin
2019-04-17 7e843b60025a1c6988c17809a767f40d04df67b7
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
983
984
985
986
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Tuesday, March 12, 2019
//--------------------------------------------------------
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System.Collections.Generic;
 
namespace Snxxz.UI
{
 
    public enum TipType
    {
        Normal = 1,
        Good = 2,
    }
 
    public class EquipTipUtility
    {
 
        public class TipData
        {
            public int itemId;
            public string guid;
 
            public BaseInfo baseInfo;
            public BaseProperty baseProperty;
            public BaseProperty petMountBaseProperty;
            public LegendProperty legendProperty;
            public SkillInfo skillInfo;
            public SuitInfo suitInfo;
            public StarInfo starInfo;
            public StrengthenProperty strengthenProperty;
            public GemInfo gemInfo;
            public TrainProperty trainProperty;
            public List<ItemOperateType> operates;
 
        }
 
        public struct BaseInfo
        {
            public int itemId;
            public int count;
            public bool isAuction;
            public bool isEquiped;
 
            public int star;
            public int strengthenLevel;
            public int score;
            public int auctionSurplusTime;
            public int levelLimit;
            public int realmLimit;
        }
 
        public struct BaseProperty
        {
            public List<Int2> baseProperties;
            public int star;
            public List<Int2> starProperties;
        }
 
        public struct LegendProperty
        {
            public bool isPreview;
            public int trueCount;
            public List<Int2> properties;
        }
 
        public struct SuitInfo
        {
            public int job;
            public string name;
            public int level;
            public int maxSuitLevel;
            public List<int> places;
            public Dictionary<int, EquipSuitPropertyEntry> twoSuitProperties;
            public Dictionary<int, EquipSuitPropertyEntry> fiveSuitProperties;
            public Dictionary<int, bool> eightSuits;
        }
 
        public struct StarInfo
        {
            public Int2 equipPosition;
            public int starLevel;
            public int maxLevel;
        }
 
        public struct StrengthenProperty
        {
            public int strengthenLevel;
            public List<Int2> properties;
        }
 
        public struct GemInfo
        {
            public Dictionary<int, bool> activeStates;
            public Dictionary<int, int> gems;
        }
 
        public struct TrainProperty
        {
            public int level;
            public List<Int2> properties;
        }
 
        public struct SkillInfo
        {
            public List<int> skills;
        }
 
        static PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
        static EquipModel equipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } }
        static EquipStarModel starModel { get { return ModelCenter.Instance.GetModel<EquipStarModel>(); } }
        static EquipGemModel gemModel { get { return ModelCenter.Instance.GetModel<EquipGemModel>(); } }
        static EquipTrainModel trainModel { get { return ModelCenter.Instance.GetModel<EquipTrainModel>(); } }
        static EquipStrengthModel strengthenModel { get { return ModelCenter.Instance.GetModel<EquipStrengthModel>(); } }
        static MountModel mountModel { get { return ModelCenter.Instance.GetModel<MountModel>(); } }
        static PetModel perModel { get { return ModelCenter.Instance.GetModel<PetModel>(); } }
 
        public static TipType tipType { get; private set; }
        public static TipData mainTipData { get; private set; }
        public static TipData secondaryData { get; private set; }
 
        public static void Show(TipType type, int itemId)
        {
            tipType = type;
            secondaryData = null;
 
            var isEquip = ItemLogicUtility.Instance.IsEquip(itemId);
            if (isEquip)
            {
                mainTipData = CreateNormalEquipData(itemId);
            }
            else
            {
                mainTipData = CreateItemData(itemId);
            }
 
            var config = ItemConfig.Get(itemId);
            switch (type)
            {
                case TipType.Normal:
                    if (isEquip)
                    {
                        WindowCenter.Instance.Open<EquipTipWin>();
                    }
                    else
                    {
                        switch (config.Type)
                        {
                            case 26:
                            case 41:
                            case 42:
                                WindowCenter.Instance.Open<PetMountTipWin>();
                                break;
                            default:
                                WindowCenter.Instance.Open<ItemTipWin>();
                                break;
                        }
                    }
                    break;
                case TipType.Good:
                    WindowCenter.Instance.Open<GoodTipWin>();
                    break;
            }
        }
 
        public static void Show(string guid)
        {
            var item = packModel.GetItemByGuid(guid);
            if (item == null)
            {
                return;
            }
 
            secondaryData = null;
            var packType = item.packType;
            var isEquip = ItemLogicUtility.Instance.IsEquip(item.itemId);
            switch (packType)
            {
                case PackType.Equip:
                    tipType = TipType.Normal;
                    mainTipData = CreateNormalEquipData(guid);
                    break;
                default:
                    tipType = TipType.Normal;
 
                    if (isEquip)
                    {
                        if (item.isAuction)
                        {
                            mainTipData = CreateEquipAuctionData(guid);
                        }
                        else
                        {
                            mainTipData = CreateNormalEquipData(guid);
                            var equipedGuid = equipModel.GetEquip(new Int2(item.config.LV, item.config.EquipPlace));
                            if (equipedGuid != guid)
                            {
                                secondaryData = CreateNormalEquipData(equipedGuid);
                            }
                        }
                    }
                    else
                    {
                        mainTipData = CreateItemData(guid);
                    }
                    break;
            }
 
            switch (tipType)
            {
                case TipType.Normal:
                    if (isEquip)
                    {
                        WindowCenter.Instance.Open<EquipTipWin>();
                    }
                    else
                    {
                        switch (item.config.Type)
                        {
                            case 26:
                            case 41:
                            case 42:
                                WindowCenter.Instance.Open<PetMountTipWin>();
                                break;
                            default:
                                WindowCenter.Instance.Open<ItemTipWin>();
                                break;
                        }
                    }
                    break;
                case TipType.Good:
                    WindowCenter.Instance.Open<GoodTipWin>();
                    break;
            }
        }
 
        static TipData CreateNormalEquipData(string guid)
        {
            var item = packModel.GetItemByGuid(guid);
            if (item == null)
            {
                return default(TipData);
            }
 
            return new TipData()
            {
                itemId = item.itemId,
                guid = guid,
 
                baseInfo = GetBaseInfo(guid),
                baseProperty = GetBaseProperty(guid),
                legendProperty = GetLegendProperty(guid),
                skillInfo = GetSkillInfo(item.itemId),
                suitInfo = GetSuitInfo(guid),
                starInfo = GetStarInfo(guid),
                strengthenProperty = GetStrengthenProperty(guid),
                gemInfo = GetGemInfo(guid),
 
                trainProperty = GetTrainProperty(guid),
                operates = GetOperates(guid),
            };
        }
 
        static TipData CreateNormalEquipData(int itemId)
        {
            return new TipData()
            {
                itemId = itemId,
                guid = string.Empty,
 
                baseInfo = GetBaseInfo(itemId),
                baseProperty = GetBaseProperty(itemId),
                legendProperty = GetLegendProperty(itemId),
                skillInfo = GetSkillInfo(itemId),
                suitInfo = GetSuitInfo(itemId),
                gemInfo = GetGemInfo(itemId),
            };
        }
 
        static TipData CreateEquipAuctionData(string guid)
        {
            var item = packModel.GetItemByGuid(guid);
            if (item == null)
            {
                return default(TipData);
            }
 
            return new TipData()
            {
                itemId = item.itemId,
                guid = guid,
 
                baseInfo = GetBaseInfo(guid),
                baseProperty = GetBaseProperty(item.itemId),
                legendProperty = GetLegendProperty(item.itemId),
                skillInfo = GetSkillInfo(item.itemId),
                suitInfo = GetSuitInfo(item.itemId),
                operates = GetOperates(guid),
            };
        }
 
        static TipData CreateItemData(string guid)
        {
            var item = packModel.GetItemByGuid(guid);
            if (item == null)
            {
                return default(TipData);
            }
 
            return new TipData()
            {
                itemId = item.itemId,
                guid = guid,
 
                baseInfo = GetBaseInfo(guid),
                petMountBaseProperty = GetPetMountBaseProperty(item.itemId),
                operates = GetOperates(guid),
            };
        }
 
        static TipData CreateItemData(int itemId)
        {
            return new TipData()
            {
                itemId = itemId,
                baseInfo = GetBaseInfo(itemId),
                petMountBaseProperty = GetPetMountBaseProperty(itemId),
            };
        }
 
        public static void Operate(ItemOperateType type, string guid)
        {
            switch (type)
            {
                case ItemOperateType.putOn:
                    ItemOperateUtility.Instance.PutOnItem(guid);
                    break;
                case ItemOperateType.putOff:
                    ItemOperateUtility.Instance.PutOffEquip(guid);
                    break;
                case ItemOperateType.putAway:
                    ItemOperateUtility.Instance.PutAway(guid);
                    break;
                case ItemOperateType.putIn:
                    ItemOperateUtility.Instance.PutInWareHouse(guid);
                    break;
                case ItemOperateType.putOut:
                    ItemOperateUtility.Instance.TakeOutFromWarehouse(guid);
                    break;
                case ItemOperateType.sell:
                    var item = packModel.GetItemByGuid(guid);
                    ItemOperateUtility.Instance.SendSellQuest(PackType.Item, item.gridIndex);
                    break;
                case ItemOperateType.strength:
                    ItemOperateUtility.Instance.GotoStrengthen(guid);
                    break;
                case ItemOperateType.star:
                    ItemOperateUtility.Instance.GotoStarUpgrade(guid);
                    break;
                case ItemOperateType.inlay:
                    ItemOperateUtility.Instance.GotoInlayItem(guid);
                    break;
                case ItemOperateType.train:
                    ItemOperateUtility.Instance.GotoTrain(guid);
                    break;
                case ItemOperateType.makeUse:
                    ItemOperateUtility.Instance.GotoUseItem(guid);
                    break;
                case ItemOperateType.split:
                    ItemOperateUtility.Instance.OnClickSplitBtn(guid);
                    break;
            }
        }
 
        private static BaseInfo GetBaseInfo(int itemId)
        {
            var config = ItemConfig.Get(itemId);
            var baseInfo = new BaseInfo()
            {
                itemId = itemId,
                isAuction = false,
                isEquiped = false,
                score = ItemLogicUtility.Instance.GetEquipScore(PackType.Item, itemId, null, true),
                auctionSurplusTime = 0,
                levelLimit = config.UseLV,
                realmLimit = config.RealmLimit,
            };
 
            return baseInfo;
        }
 
        private static BaseInfo GetBaseInfo(string guid)
        {
            var item = packModel.GetItemByGuid(guid);
 
            var level = item.config.LV;
            var place = item.config.EquipPlace;
 
            var isEquiped = equipModel.GetEquip(new Int2(level, place)) == guid;
 
            var type = strengthenModel.GetEquipStrengthType(place);
            var star = starModel.GetEquipStarLevel(new Int2(level, place));
            var maxStar = EquipStarModel.GetMaxStarLevel(item.config.ItemColor, level);
            var maxStrengthenLevel = strengthenModel.GetEquipLevelMax(type, Mathf.Min(star, maxStar));
            var placeStrengthenLevel = strengthenModel.GetStrengthLevel(level, place);
 
            var baseInfo = new BaseInfo()
            {
                itemId = item.itemId,
                count = item.count,
                isAuction = item.isAuction,
                isEquiped = isEquiped,
                score = item.score,
                auctionSurplusTime = item.isAuction ? item.auctionSurplusTime : 0,
                levelLimit = item.isAuction ? 0 : item.config.UseLV,
                realmLimit = item.isAuction ? 0 : item.config.RealmLimit,
                star = isEquiped ? star : -1,
                strengthenLevel = isEquiped ? Mathf.Min(placeStrengthenLevel, maxStrengthenLevel) : 0
            };
 
            return baseInfo;
        }
 
        private static BaseProperty GetBaseProperty(int itemId)
        {
            var baseProperties = new List<Int2>();
            var config = ItemConfig.Get(itemId);
 
            if (config.Effect1 != 0)
            {
                baseProperties.Add(new Int2(config.Effect1, config.EffectValueA1));
            }
 
            if (config.Effect2 != 0)
            {
                baseProperties.Add(new Int2(config.Effect2, config.EffectValueA2));
            }
 
            if (config.Effect3 != 0)
            {
                baseProperties.Add(new Int2(config.Effect3, config.EffectValueA3));
            }
 
            if (config.Effect4 != 0)
            {
                baseProperties.Add(new Int2(config.Effect4, config.EffectValueA4));
            }
 
            if (config.Effect5 != 0)
            {
                baseProperties.Add(new Int2(config.Effect5, config.EffectValueA5));
            }
 
            var baseProperty = new BaseProperty()
            {
                baseProperties = baseProperties,
            };
 
            return baseProperty;
        }
 
        private static BaseProperty GetBaseProperty(string guid)
        {
            var item = packModel.GetItemByGuid(guid);
            var equipPosition = new Int2(item.config.LV, item.config.EquipPlace);
            var equiped = equipModel.GetEquip(equipPosition) == guid;
 
            var baseProperty = GetBaseProperty(item.itemId);
 
            if (equiped)
            {
                var starProperties = new List<Int2>();
                var currentStar = starModel.GetEquipStarLevel(equipPosition);
                var maxStar = EquipStarModel.GetMaxStarLevel(item.config.ItemColor, item.config.LV);
                var star = Mathf.Min(currentStar, maxStar);
                if (star > 0)
                {
                    baseProperty.star = star;
                    var starConfig = EquipStarConfig.Get(item.config.LV, item.config.EquipPlace, star);
                    starProperties.AddRange(starConfig.BaseAttrInfo);
                }
 
                baseProperty.starProperties = starProperties;
            }
 
            return baseProperty;
        }
 
        private static BaseProperty GetPetMountBaseProperty(int itemId)
        {
            var config = ItemConfig.Get(itemId);
            var baseProperty = new BaseProperty();
            Dictionary<int, int> properties = null;
            switch (config.Type)
            {
                case 26:
                    var petId = PetInfoConfig.GetItemUnLockPet(itemId);
                    properties = perModel.GetPetAttrAddDict(petId);
                    break;
                case 41:
                case 42:
                    var horseId = HorseConfig.GetItemUnLockHorse(itemId);
                    properties = mountModel.GetMountAttrAddDict(horseId);
                    break;
                default:
                    break;
            }
 
            if (properties != null)
            {
                baseProperty.baseProperties = new List<Int2>();
                foreach (var property in properties)
                {
                    baseProperty.baseProperties.Add(new Int2(property.Key, property.Value));
                }
            }
 
            return baseProperty;
        }
 
        private static LegendProperty GetLegendProperty(int itemId)
        {
            var data = new LegendProperty();
            data.isPreview = true;
            data.trueCount = LegendPropertyUtility.GetEquipPropertyCount(itemId);
            data.properties = LegendPropertyUtility.GetEquipProperties(itemId);
 
            return data;
        }
 
        private static LegendProperty GetLegendProperty(string guid)
        {
            var item = packModel.GetItemByGuid(guid);
            if (item == null)
            {
                return default(LegendProperty);
            }
 
            var data = new LegendProperty();
            data.isPreview = false;
 
            var ids = item.GetUseData(17);
            var values = item.GetUseData(19);
            if (!ids.IsNullOrEmpty() && !values.IsNullOrEmpty())
            {
                var properties = new List<Int2>();
                var count = Mathf.Min(ids.Count, values.Count);
                for (int i = 0; i < count; i++)
                {
                    properties.Add(new Int2(ids[i], values[i]));
                }
 
                data.properties = properties;
            }
 
            return data;
        }
 
        private static SuitInfo GetSuitInfo(int itemId)
        {
            var config = ItemConfig.Get(itemId);
            if (config == null || config.SuiteiD <= 0)
            {
                return default(SuitInfo);
            }
 
            var job = config.JobLimit;
            var twoConfigs = EquipSuitConfig.GetConfigs(job, config.LV, EquipSuitType.TwoSuit);
 
            var name = twoConfigs[0].name;
            var level = config.LV;
            var places = new List<int>();
            places.Add(config.EquipPlace);
            var suitInfo = new SuitInfo()
            {
                name = name,
                level = level,
                job = job,
                places = places,
            };
 
            return suitInfo;
        }
 
        private static SuitInfo GetSuitInfo(string guid)
        {
            var item = packModel.GetItemByGuid(guid);
            if (item == null)
            {
                return default(SuitInfo);
            }
 
            var config = ItemConfig.Get(item.itemId);
            if (config == null || config.SuiteiD <= 0)
            {
                return default(SuitInfo);
            }
 
            var equipPosition = new Int2(item.config.LV, item.config.EquipPlace);
            var equiped = equipModel.GetEquip(equipPosition) == guid;
 
            var job = config.JobLimit;
            var twoConfigs = EquipSuitConfig.GetConfigs(job, config.LV, EquipSuitType.TwoSuit);
            var name = twoConfigs[0].name;
 
            var level = config.LV;
            var maxSuitLevel = equiped ? EquipStarModel.GetMaxStarLevel(level) : -1;
 
            var places = new List<int>();
            if (equiped)
            {
                for (int i = 1; i <= 8; i++)
                {
                    var equip = packModel.GetItemByGuid(equipModel.GetEquip(new Int2(level, i)));
                    var hasSuit = equip != null && equip.config.SuiteiD > 0;
                    if (hasSuit)
                    {
                        places.Add(i);
                    }
                }
            }
 
            var twoSuitProperties = new Dictionary<int, EquipSuitPropertyEntry>();
            var fiveSuitProperties = new Dictionary<int, EquipSuitPropertyEntry>();
            var eightSuits = new Dictionary<int, bool>();
            var eightSuitLevel = equiped ? equipModel.GetSuitLevel(config.LV, EquipSuitType.EightSuit) : -1;
 
            var twoSuitProperties0 = equipModel.GetEquipSuitEntry(config.LV, 0, EquipSuitType.TwoSuit);
            var fiveSuitProperties0 = equipModel.GetEquipSuitEntry(config.LV, 0, EquipSuitType.FiveSuit);
 
            if (!equiped)
            {
                twoSuitProperties0.actived = false;
                fiveSuitProperties0.actived = false;
            }
 
            twoSuitProperties[0] = twoSuitProperties0;
            fiveSuitProperties[0] = fiveSuitProperties0;
            eightSuits[0] = eightSuitLevel >= 0;
 
            if (maxSuitLevel >= 3)
            {
                twoSuitProperties[3] = equipModel.GetEquipSuitEntry(config.LV, 3, EquipSuitType.TwoSuit);
                fiveSuitProperties[3] = equipModel.GetEquipSuitEntry(config.LV, 3, EquipSuitType.FiveSuit);
                eightSuits[3] = eightSuitLevel >= 3;
            }
 
            if (maxSuitLevel >= 6)
            {
                twoSuitProperties[6] = equipModel.GetEquipSuitEntry(config.LV, 6, EquipSuitType.TwoSuit);
                fiveSuitProperties[6] = equipModel.GetEquipSuitEntry(config.LV, 6, EquipSuitType.FiveSuit);
                eightSuits[6] = eightSuitLevel >= 3;
            }
 
            if (maxSuitLevel >= 9)
            {
                twoSuitProperties[9] = equipModel.GetEquipSuitEntry(config.LV, 9, EquipSuitType.TwoSuit);
                fiveSuitProperties[9] = equipModel.GetEquipSuitEntry(config.LV, 9, EquipSuitType.FiveSuit);
                eightSuits[9] = eightSuitLevel >= 9;
            }
 
            var suitInfo = new SuitInfo()
            {
                name = name,
                level = level,
                job = job,
                maxSuitLevel = maxSuitLevel,
                places = places,
                twoSuitProperties = twoSuitProperties,
                fiveSuitProperties = fiveSuitProperties,
                eightSuits = eightSuits
            };
 
            return suitInfo;
        }
 
        private static StarInfo GetStarInfo(int itemId)
        {
            var config = ItemConfig.Get(itemId);
            if (!EquipModel.IsRealmEquip(config.EquipPlace))
            {
                return default(StarInfo);
            }
 
            var starInfo = new StarInfo();
            starInfo.equipPosition = new Int2(config.LV, config.EquipPlace);
            starInfo.maxLevel = EquipStarModel.GetMaxStarLevel(config.ItemColor, config.LV);
            starInfo.starLevel = 0;
 
            return starInfo;
        }
 
        private static StarInfo GetStarInfo(string guid)
        {
            var item = packModel.GetItemByGuid(guid);
            if (item == null)
            {
                return default(StarInfo);
            }
 
            if (!EquipModel.IsRealmEquip(item.config.EquipPlace))
            {
                return default(StarInfo);
            }
 
            var starInfo = new StarInfo();
            var equipPosition = new Int2(item.config.LV, item.config.EquipPlace);
            var equiped = equipModel.GetEquip(equipPosition) == guid;
            starInfo.equipPosition = equipPosition;
            starInfo.maxLevel = EquipStarModel.GetMaxStarLevel(item.config.ItemColor, item.config.LV);
            starInfo.starLevel = equiped ? starModel.GetStarLevel(equipPosition) : 0;
 
            return starInfo;
        }
 
        private static StrengthenProperty GetStrengthenProperty(string guid)
        {
            var item = packModel.GetItemByGuid(guid);
            if (item == null)
            {
                return default(StrengthenProperty);
            }
 
            var level = item.config.LV;
            var place = item.config.EquipPlace;
            var equiped = equipModel.GetEquip(new Int2(level, place)) == guid;
            if (!equiped)
            {
                return default(StrengthenProperty);
            }
 
            var data = new StrengthenProperty();
 
            var strengthenLevel = strengthenModel.GetStrengthLevel(level, place);
            var type = strengthenModel.GetEquipStrengthType(place);
            var star = starModel.GetEquipStarLevel(new Int2(level, place));
            var maxStar = EquipStarModel.GetMaxStarLevel(item.config.ItemColor, item.config.LV);
            var maxStrengthenLevel = strengthenModel.GetEquipLevelMax(type, Mathf.Min(star, maxStar));
 
            data.strengthenLevel = Mathf.Min(strengthenLevel, maxStrengthenLevel);
 
            data.properties = new List<Int2>();
            var config = ItemPlusConfig.GetTypeAndLevel(type, data.strengthenLevel);
            for (int i = 0; i < config.attType.Length; i++)
            {
                data.properties.Add(new Int2(config.attType[i], config.attValue[i]));
            }
 
            return data;
        }
 
        private static GemInfo GetGemInfo(int itemId)
        {
            return default(GemInfo);
        }
 
        private static GemInfo GetGemInfo(string guid)
        {
            var item = packModel.GetItemByGuid(guid);
            if (item == null)
            {
                return default(GemInfo);
            }
 
            var level = item.config.LV;
            var place = item.config.EquipPlace;
 
            var gemInfo = new GemInfo();
            var maxStar = EquipStarModel.GetMaxStarLevel(item.config.ItemColor, item.config.LV);
            gemInfo.activeStates = new Dictionary<int, bool>();
            for (int i = 0; i < 4; i++)
            {
                gemInfo.activeStates[i] = IsEquipGemHoleOpen(new Int2(level, place), maxStar, i);
            }
 
            gemInfo.gems = new Dictionary<int, int>();
            if (item.packType == PackType.Equip)
            {
                int[] gems;
                if (gemModel.TryGetEquipGems(item.config.LV, item.config.EquipPlace, out gems))
                {
                    for (int i = 0; i < gems.Length; i++)
                    {
                        gemInfo.gems[i] = gems[i];
                    }
                }
            }
 
            return gemInfo;
        }
 
        private static TrainProperty GetTrainProperty(string guid)
        {
            var item = packModel.GetItemByGuid(guid);
            if (item == null)
            {
                return default(TrainProperty);
            }
 
            var equipPosition = new Int2(item.config.LV, item.config.EquipPlace);
            var equiped = equipModel.GetEquip(equipPosition) == guid;
            if (!equiped)
            {
                return default(TrainProperty);
            }
 
            var trainProperty = new TrainProperty();
            var star = Mathf.Min(EquipStarModel.GetMaxStarLevel(item.config.ItemColor, item.config.LV), starModel.GetEquipStarLevel(equipPosition));
            var type = EquipTrainModel.GetTrainType(equipPosition.y);
            var maxConfig = WashLevelMaxConfig.Get(type, star);
            var maxLevel = maxConfig == null ? 1 : maxConfig.levelMax;
            var trainLevel = Mathf.Min(maxLevel, trainModel.GetTrainLevel(equipPosition));
            trainProperty.level = trainLevel;
 
            var trainConfig = EquipWashConfig.Get(type, trainLevel);
            trainProperty.properties = new List<Int2>();
 
            if (trainConfig == null)
            {
                var trainConfigLevel1 = EquipWashConfig.Get(type, 1);
                trainProperty.properties.Add(new Int2(trainConfigLevel1.config.attType1, 0));
                trainProperty.properties.Add(new Int2(trainConfigLevel1.config.attType2, 0));
                trainProperty.properties.Add(new Int2(trainConfigLevel1.config.attType3, 0));
            }
            else
            {
                var trainedProperties = trainModel.GetTrainedProperties(equipPosition);
                trainProperty.properties.Add(new Int2(trainConfig.config.attType1, Mathf.Min(trainedProperties.x, trainConfig.config.attMax1)));
                trainProperty.properties.Add(new Int2(trainConfig.config.attType2, Mathf.Min(trainedProperties.y, trainConfig.config.attMax2)));
                trainProperty.properties.Add(new Int2(trainConfig.config.attType3, Mathf.Min(trainedProperties.z, trainConfig.config.attMax3)));
            }
 
            return trainProperty;
        }
 
        private static SkillInfo GetSkillInfo(int itemId)
        {
            var config = ItemConfig.Get(itemId);
            if (config == null)
            {
                return default(SkillInfo);
            }
 
            var skillInfo = new SkillInfo();
            skillInfo.skills = new List<int>();
 
            if (config.AddSkill1 != 0)
            {
                skillInfo.skills.Add(config.AddSkill1);
            }
 
            if (config.AddSkill2 != 0)
            {
                skillInfo.skills.Add(config.AddSkill2);
            }
 
            return skillInfo;
        }
 
        private static List<ItemOperateType> GetOperates(int itemId)
        {
            var config = ItemConfig.Get(itemId);
            var operates = new List<ItemOperateType>();
            if (config.CanSell == 1)
            {
                operates.Add(ItemOperateType.sell);
            }
 
            if (config.UseTag == 1)
            {
                operates.Add(ItemOperateType.makeUse);
            }
 
            if (config.Type == 25 || config.Effect1 == 225)
            {
                operates.Add(ItemOperateType.inlay);
            }
 
            return operates;
        }
 
        private static List<ItemOperateType> GetOperates(string guid)
        {
            var item = packModel.GetItemByGuid(guid);
            if (item == null)
            {
                return null;
            }
 
            var operates = new List<ItemOperateType>();
            var packType = item.packType;
 
            if (WindowCenter.Instance.IsOpen("DepotWin"))
            {
                switch (packType)
                {
                    case PackType.Warehouse:
                        operates.Add(ItemOperateType.putOut);
                        break;
                    default:
                        operates.Add(ItemOperateType.putIn);
                        break;
                }
 
                return operates;
            }
 
            switch (packType)
            {
                case PackType.Equip:
                    if (WindowCenter.Instance.IsOpen("RealmEquipWin"))
                    {
                        operates.Add(ItemOperateType.putOff);
 
                        if (FuncOpen.Instance.IsFuncOpen(1))
                        {
                            operates.Add(ItemOperateType.strength);
                        }
 
                        operates.Add(ItemOperateType.star);
                        if (FuncOpen.Instance.IsFuncOpen(1))
                        {
                            operates.Add(ItemOperateType.inlay);
                        }
 
                        operates.Add(ItemOperateType.train);
                    }
                    break;
                case PackType.Warehouse:
                    operates.Add(ItemOperateType.putOut);
                    break;
                default:
                    if (item.isAuction)
                    {
                        operates.Add(ItemOperateType.putAway);
                    }
                    else
                    {
                        var isEquip = ItemLogicUtility.Instance.IsEquip(item.itemId);
                        if (isEquip)
                        {
                            operates.Add(ItemOperateType.sell);
                            operates.Add(ItemOperateType.putOn);
                        }
                        else
                        {
                            operates.AddRange(GetOperates(item.itemId));
                            if (item.count > 1)
                            {
                                operates.Add(ItemOperateType.split);
                            }
                        }
                    }
                    break;
            }
 
            return operates;
        }
 
        private static bool IsEquipGemHoleOpen(Int2 equipPosition, int maxStar, int hole)
        {
            GemHoleCondition condition;
            if (gemModel.TryGetGemHoleCondition(hole, out condition))
            {
                var star = starModel.GetStarLevel(equipPosition);
                if (Mathf.Min(star, maxStar) < condition.equipStar)
                {
                    return false;
                }
 
                var vipLevel = PlayerDatas.Instance.baseData.VIPLv;
                if (vipLevel < condition.vipLevel)
                {
                    return false;
                }
            }
 
            return true;
        }
 
    }
 
}