少年修仙传客户端代码仓库
lcy
2024-12-16 a39c35fc6449430cd02bccb681c4a0a880e46cd9
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
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using LitJson;
using System.Linq;
 
 
namespace vnxbqy.UI
{
    //查看其他玩家的简短信息, 该模块处理数据,其他由各自功能模块处理 通过OnRevPackage
    public class RoleParticularModel : Model, IBeforePlayerDataInitialize
    {
 
        public override void Init()
        {
        }
 
        public override void UnInit()
        {
 
        }
 
        public void OnBeforePlayerDataInitialize()
        {
            viewPlayerType = -1;
        }
 
        public int viewPlayer { get; private set; }
 
        // 查询本服:0-查看其他玩家的简洁信息界面 1-查看战力界面 2(以上小于100)-返回数据不做处理,由调用者自行处理逻辑
        // 查询跨服:100-查看其他玩家的简洁信息界面 101-查看战力界面 102以上-返回数据不做处理,由调用者自行处理逻辑
        // 调用者需要的话自定义枚举值 EnumHelper的ViewPlayerType
        public int viewPlayerType { get; private set; }  
 
        private Dictionary<int, ViewPlayerData> viewPlayerDataDic = new Dictionary<int, ViewPlayerData>();
        private Dictionary<int, ulong> funcFightPowerDict = new Dictionary<int, ulong>();
        public event Action PowerUpdate;
        public static Action<int, int, ViewPlayerData> OnRevPackage;
 
        public ViewPlayerData GetViewPlayerData(int player)
        {
            ViewPlayerData viewPlayerData = null;
            viewPlayerDataDic.TryGetValue(player, out viewPlayerData);
            return viewPlayerData;
        }
 
        // 查看玩家模型展示,查玩家装备详情需另外处理
        // 本服查询:返回时打开查看其他玩家的简洁信息界面(可查看装备,宠物,坐骑等具体信息)RoleParticularsWin
        public void ViewRoleEquip(int playerID)
        {
            if (playerID == PlayerDatas.Instance.baseData.PlayerID)
            {
                return;
            }
            viewPlayerType = (int)ViewPlayerType.viewPlayerEquip;
            ViewRoleParticulars(playerID);
        }
 
        // 本服查询:返回时打开查看其他玩家战力界面(战力分布)ViewFuncPowerWin
        public void ViewRoleFightPower(int playerID)
        {
            if (playerID == PlayerDatas.Instance.baseData.PlayerID)
            {
                return;
            }
            viewPlayerType = (int)ViewPlayerType.viewPlayerFightPower;
            ViewRoleParticulars(playerID);
        }
 
        // 返回时不做任何操作,由调用者自行处理逻辑
        public void ViewPlayerCacheData(int _playerId, int viewType = (int)ViewPlayerType.viewPlayerData)
        {
            viewPlayerType = viewType;
            ViewRoleParticulars(_playerId);
        }
 
        // 查看玩家模型展示,查玩家装备详情需另外处理
        // 跨服查询:返回时打开查看其他玩家的简洁信息界面(可查看装备,宠物,坐骑等具体信息)RoleParticularsWin
        public void ViewCrossServerPlayerEquip(int _playerId)
        {
            if (_playerId == PlayerDatas.Instance.baseData.PlayerID)
            {
                return;
            }
            viewPlayerType = (int)ViewPlayerType.viewCrossPlayerEquip;
            ViewRoleParticulars(_playerId);
        }
 
        public void ViewCrossPlayerFightPower(int _playerId)
        {
            if (_playerId == PlayerDatas.Instance.baseData.PlayerID)
            {
                return;
            }
            viewPlayerType = (int)ViewPlayerType.viewCrossPlayerFightPower;
            ViewRoleParticulars(_playerId);
        }
 
        // 返回时不做任何操作,由调用者自行处理逻辑
        public void ViewCrossPlayerCacheData(int _playerId, int viewType = (int)ViewPlayerType.viewCrossPlayerData)
        {
            viewPlayerType = viewType;
            ViewRoleParticulars(_playerId);
        }
 
        public void ViewRoleParticulars(int playerID)
        {
            if (playerID == 0)
            {
                return;
            }
            viewPlayer = playerID;
            if (viewPlayerDataDic.ContainsKey(playerID))
            {
                ViewPlayerData viewPlayerData = viewPlayerDataDic[playerID];
                if ((DateTime.Now - viewPlayerData.getTime).TotalSeconds < 30)
                {
                    ShowRoleParticulars(viewPlayerData);
                    return;
                }
            }
            if (viewPlayerType >= (int)ViewPlayerType.viewCrossPlayerEquip)
            {
                //由子服服务器向跨服服务器查询; 会优先查本服数据(gameserver)
                CC002_tagCGViewCrossPlayerInfo c002 = new CC002_tagCGViewCrossPlayerInfo();
                c002.PlayerID = (uint)playerID;
                GameNetSystem.Instance.SendInfo(c002);
            }
            else
            {
                //只查本服数据,有可能本地图有数据,就不查gameserver
                CA212_tagCMViewPlayerInfo pak = new CA212_tagCMViewPlayerInfo();
                pak.PlayerID = (uint)playerID;
                GameNetSystem.Instance.SendInfo(pak);
            }
        }
 
 
        //本服竞技场假查询模拟封包,返回查看机器人数据 打开RoleParticularsWin界面,专用接口其他地方不要调用
        public void ViewFairyArenaRobot(int playerID, ViewPlayerData _viewPlayerData)
        {
            ViewPlayerData viewPlayerData = null;
            viewPlayer = playerID;
            if (!viewPlayerDataDic.TryGetValue(playerID, out viewPlayerData))
            {
                viewPlayerDataDic.Add(playerID, _viewPlayerData);
            }
            else
            {
                viewPlayerDataDic[playerID] = _viewPlayerData;
            }
 
            viewPlayerType = (int)ViewPlayerType.viewCrossPlayerEquip;
            ShowRoleParticulars(_viewPlayerData);
        }
 
 
 
        public void OnRevRoleEquip(HA705_tagSCQueryPlayerCacheResult package)
        {
            //需要对空数据进行防范
            if (viewPlayer != package.PlayerID || viewPlayerType == -1 || 
                (package.PropDataSize == 0 && package.ItemDataSize == 0 && package.PlusDataSize == 0))
            {
                return;
            }
 
            ViewPlayerData viewPlayerData = null;
            if (!viewPlayerDataDic.TryGetValue((int)package.PlayerID, out viewPlayerData))
            {
                viewPlayerData = new ViewPlayerData();
                viewPlayerData.getTime = DateTime.Now;
                viewPlayerDataDic.Add((int)package.PlayerID, viewPlayerData);
            }
 
            viewPlayerData.getTime = DateTime.Now;
            if (package.PropDataSize != 0)
                viewPlayerData.rolePropData = JsonMapper.ToObject<RolePropData>(package.PropData);
 
            if (package.PlusDataSize != 0)
            { 
                viewPlayerData.rolePlusData = new RolePlusData();
                viewPlayerData.rolePlusData.AnalysisRolePlusData(package.PlusData);
            }
            if (viewPlayerData.rolePlusData == null)
            {
                //第一次初始化
                viewPlayerData.rolePlusData = new RolePlusData();
            }
 
 
 
            if (package.PropDataSize != 0)
            { 
                JsonData data = JsonMapper.ToObject(package.PropData);
                Dictionary<string, long> properties = new Dictionary<string, long>();
                var keyList = data.Keys.ToList();
                for (int i = 0; i < keyList.Count; i++)
                {
                    string key = keyList[i];
                    JsonData valueData = data[key];
                    long value = 0;
                    if (long.TryParse(valueData.ToString(), out value))
                    {
                        properties[key] = value;
                    }
                    else
                    {
                        properties[key] = 0;
                    }
                }
                viewPlayerData.propertiesDict = properties;
            }
            if (viewPlayerData.propertiesDict == null)
            {
                //第一次初始化
                viewPlayerData.propertiesDict = new Dictionary<string, long>();
            }
 
            ShowRoleParticulars(viewPlayerData);
        }
 
        public void OnRevRoleFuncPower(HA3A1_tagMCModuleFightPowerInfo package)
        {
            if (package.MFPCnt == 0)
                return;
            for (int i = 0; i < package.MFPList.Length; i++)
            {
                funcFightPowerDict[package.MFPList[i].MfpType] = package.MFPList[i].FightPower;
            }
            if (PowerUpdate != null)
            {
                PowerUpdate();
            }
        }
 
        public ulong GetFuncFightPower(int type)
        {
            if (funcFightPowerDict.ContainsKey(type))
            {
                return funcFightPowerDict[type];
            }
            return 0;
        }
 
        #region 查看玩家坐骑灵宠属性
        List<int> skills = new List<int>();
        Dictionary<int, float> propertyDict = new Dictionary<int, float>();
        public int GetHorseFightPower(List<HorseInfo> horses)
        {
            var fightPower = 0;
            for (int i = 0; i < horses.Count; i++)
            {
                fightPower += GetHorseFightPower(horses[i].id, horses[i].lv);
            }
            return fightPower;
        }
 
        public int GetHorseFightPower(int _id, int lv)
        {
            var fightPower = GetHorseSkillFightPower(_id, lv);
 
            return fightPower;
        }
 
        public int GetHorseSkillFightPower(int _id, int lv)
        {
            var fightPower = 0;
 
            return fightPower;
        }
 
        public void GetHorseProperty(List<HorseInfo> horses, ref Dictionary<int, int> propertyDict)
        {
            if (propertyDict == null)
            {
                return;
            }
            propertyDict.Clear();
 
        }
 
        public void GetHorseProperty(int _id, int lv, ref Dictionary<int, int> propertyDict)
        {
 
        }
 
        private void PastePropertyDict(Dictionary<int, int> source, Dictionary<int, int> target)
        {
            foreach (var key in source.Keys)
            {
                if (!target.ContainsKey(key))
                {
                    target.Add(key, source[key]);
                }
                else
                {
                    target[key] += source[key];
                }
            }
        }
 
        int[] qualitys;
        string[] qualityTitles;
        public string GetQualityDisplay(int quality)
        {
            if (qualitys == null)
            {
                var config = FuncConfigConfig.Get("PetQuality");
                qualitys = ConfigParse.GetMultipleStr<int>(config.Numerical1);
                qualityTitles = ConfigParse.GetMultipleStr(config.Numerical2);
            }
            for (int i = 0; i < qualitys.Length; i++)
            {
                if (quality == qualitys[i])
                {
                    return qualityTitles[i];
                }
            }
            return string.Empty;
        }
        private Dictionary<int, int> GetHorseSkillProperty(int condition, int property, int percent, bool single)
        {
            Dictionary<int, int> dict = new Dictionary<int, int>();
 
            return dict;
        }
 
        public int GetPetFightPower(List<PetInfo> pets)
        {
            var fightPower = 0;
            for (int i = 0; i < pets.Count; i++)
            {
                fightPower += GetPetFightPower(pets[i].id, pets[i].lv);
            }
            return fightPower;
        }
 
        public int GetPetFightPower(int id, int lv)
        {
            var fightPower = 0;
            var config = PetInfoConfig.Get(id);
            var _init_fightpower = 0;
            int.TryParse(config.InitFightPower, out _init_fightpower);
            fightPower += _init_fightpower;
            PetInfoConfig.GetPetSkills(id, lv, true, ref skills);
            var petUpConfig = PetClassCostConfig.GetPetIdAndRank(id, lv);
            if (petUpConfig != null)
            {
                Dictionary<int, int> propertyDict = new Dictionary<int, int>();
                propertyDict.Add(77, petUpConfig.AtkAdd);
                propertyDict.Add(78, petUpConfig.AtkAdd);
                fightPower += UIHelper.GetFightPower(propertyDict);// Mathf.FloorToInt(petUpConfig.AtkAdd * 2.5f);
            }
            for (int i = 0; i < skills.Count; i++)
            {
                var skillConfig = SkillConfig.Get(skills[i]);
                if (skillConfig != null)
                {
                    fightPower += skillConfig.FightPower;
                }
            }
            return fightPower;
        }
 
        public int GetPetAtkProperty(List<PetInfo> pets)
        {
            var atk = 0;
            for (int i = 0; i < pets.Count; i++)
            {
                atk += GetPetAtkProperty(pets[i].id, pets[i].lv, pets);
            }
            return atk;
        }
 
        public int GetPetAtkProperty(int id, int lv, List<PetInfo> pets)
        {
            var atk = 0;
            var petUpConfig = PetClassCostConfig.GetPetIdAndRank(id, lv);
            if (petUpConfig != null)
            {
                atk += petUpConfig.AtkAdd;
            }
            PetInfoConfig.GetPetSkills(id, lv, true, ref skills);
            for (int i = 0; i < skills.Count; i++)
            {
                atk += GetPetAtkSkillProperty(skills[i], pets);
            }
            return atk;
        }
 
        public int GetPetAtkSkillProperty(int skillId, List<PetInfo> pets)
        {
            SkillConfig skillconfig = SkillConfig.Get(skillId);
            if (skillconfig == null)
            {
                return 0;
            }
            if (skillconfig.Effect1 == (int)RidingAndPetActivationModel.RidingAndPetProperty.PetAttack)
            {
                return GetPetAttack(skillconfig.EffectValue11, skillconfig.EffectValue12, pets);
            }
            else if (skillconfig.Effect2 == (int)RidingAndPetActivationModel.RidingAndPetProperty.PetAttack)
            {
                return GetPetAttack(skillconfig.EffectValue21, skillconfig.EffectValue22, pets);
            }
            else if (skillconfig.Effect3 == (int)RidingAndPetActivationModel.RidingAndPetProperty.PetAttack)
            {
                return GetPetAttack(skillconfig.EffectValue31, skillconfig.EffectValue32, pets);
            }
            else if (skillconfig.Effect4 == (int)RidingAndPetActivationModel.RidingAndPetProperty.PetAttack)
            {
                return GetPetAttack(skillconfig.EffectValue41, skillconfig.EffectValue42, pets);
            }
            else if (skillconfig.Effect5 == (int)RidingAndPetActivationModel.RidingAndPetProperty.PetAttack)
            {
                return GetPetAttack(skillconfig.EffectValue51, skillconfig.EffectValue52, pets);
            }
            else if (skillconfig.Effect6 == (int)RidingAndPetActivationModel.RidingAndPetProperty.PetAttack)
            {
                return GetPetAttack(skillconfig.EffectValue61, skillconfig.EffectValue62, pets);
            }
            return 0;
        }
 
        int GetPetAttack(int quality, int value, List<PetInfo> pets)
        {
            var atk = 0;
            for (int i = 0; i < pets.Count; i++)
            {
                var config = PetInfoConfig.Get(pets[i].id);
                if (config != null && config.Quality == quality)
                {
                    var petUpConfig = PetClassCostConfig.GetPetIdAndRank(pets[i].id, pets[i].lv);
                    atk += petUpConfig == null ? 0 : petUpConfig.AtkAdd;
                }
            }
            return (int)(atk * ((float)value / 10000));
        }
 
        public bool viewPetStone { get; set; }
        #endregion
 
        private void ShowRoleParticulars(ViewPlayerData _viewPlayerData)
        {
            if (viewPlayerType == (int)ViewPlayerType.viewPlayerEquip || viewPlayerType == (int)ViewPlayerType.viewCrossPlayerEquip)
            {
                if (!WindowCenter.Instance.IsOpen<RoleParticularsWin>())
                {
                    RoleParticularsWin.viewType = viewPlayerType;
                    WindowCenter.Instance.Open<RoleParticularsWin>();
                }
            }
            else if (viewPlayerType == (int)ViewPlayerType.viewPlayerFightPower || viewPlayerType == (int)ViewPlayerType.viewCrossPlayerFightPower)
            {
                if (!WindowCenter.Instance.IsOpen<ViewFuncPowerWin>())
                {
                    WindowCenter.Instance.Open<ViewFuncPowerWin>();
                }
            }
                
            OnRevPackage?.Invoke(viewPlayerType, viewPlayer, _viewPlayerData);
            viewPlayerType = -1;
        }
 
        public class ViewPlayerData
        {
            public ItemData[] itemDatas;
            public RolePropData rolePropData;
            public RolePlusData rolePlusData;
            public Dictionary<string, long> propertiesDict;
 
            public DateTime getTime;
 
            public int GetEquipSuitLevel()
            {
                return 0;
            }
 
            public int GetItemId(RoleEquipType type)
            {
                if (rolePropData.EquipShowID != null)
                {
                    foreach (var id in rolePropData.EquipShowID)
                    {
                        var itemConfig = ItemConfig.Get(id);
                        if (itemConfig != null && itemConfig.EquipPlace == (int)type)
                        {
                            return id;
                        }
                    }
                }
                return 0;
            }
 
            public bool IsCrossServerPlayer()
            {
                return rolePropData.ServerGroupID != 0
                    && rolePropData.ServerGroupID != PlayerDatas.Instance.baseData.ServerGroupId;
            }
        }
 
        [Serializable]
        public class ItemData
        {
            public int ItemID;
            public string UserData;
            public int ItemIndex;
            public int IsSuit;
            public int IsBind;
            public Dictionary<int, List<int>> useDataDict { get; set; }
            public void AnalysisUserData()
            {
                if (UserData != null && UserData != string.Empty)
                {
                    useDataDict = ConfigParse.Analysis(UserData);
                }
            }
        }
 
        [Serializable]
        public struct RolePropData
        {
            public int LV;
            public int RealmLV;
            public string Name;
            public string FamilyName;
            public string CoupleName;
            public int Job;
            public int JobRank;
            public int FamilyID;
            public long FightPower;
            public uint EquipShowSwitch;
            public int ServerGroupID;
            public int VIPLV;
            public int[] EquipShowID;
            public int[] LingGenPoint;
            public long MaxHP;
            public int TitleID;
 
            public int MinAtk;
            public int MaxAtk;
            public int Def;
            public int Hit;
            public int Miss;
            public int SkillAtkRate;                              // 技能攻击比例加成
            public int SkillAtkRateReduce;                 // 技能攻击比例减少
            public int LuckyHitRate;                          // 会心一击几率
            public int LuckyHitVal;                             // 会心一击伤害固定值
            public int LuckyHitRateReduce;               // 会心一击概率抗性
            public int LuckyHitReduce;                      // 会心一击伤害减免固定值
            public int SuperHitRate;                         // 暴击概率
            public int SuperHit;                              // 暴击伤害固定值
            public int SuperHitRateReduce;            // 暴击概率抗性
            public int SuperHitReduce;                    // 暴击伤害抗性固定值
            public int IceAtk;                                   // 真实伤害            固定值
            public int IceDef;                                  // 真实伤害防御        固定值
            public int IgnoreDefRate;                      // 无视防御几率
            public int IgnoreDefRateReduce;          // 无视防御概率抗性
            public int IgnoreDefReducePer;          // 无视防御伤害减免
            public int DamagePVE;                       //伤害输出计算固定值PVE
            public int DamagePerPVP;                  // 伤害输出计算百分比PVP
            public int DamagePerPVPReduce;      //伤害输出计算百分比PVP减少
            public int DamagePVP;                       // PVP固定伤害
            public int DamagePVPReduce;          // PVP固定减伤
            public int FinalHurt;                            // 最终固定伤害增加
            public int FinalHurtReduce;               // 最终固定伤害减少
            public int FinalHurtPer;                     // 最终伤害百分比
            public int FinalHurtReducePer;         // 最终伤害减少百分比
            public int OnlyFinalHurt;                   // 额外输出伤害
            public int DamChanceDef;              // 20%的概率抵御伤害比率
            public int NPCHurtAddPer;              // 对怪物伤害加成
            public int AtkBackHPPer;               // 攻击回复血量固定值
            public int PVPAtkBackHP;              // PVP攻击回血
            public int FaintRate;                       // 击晕概率
            public int FaintDefRate;                 // 击晕抵抗概率
            public int ModelMark;   // 模型标识
            public int AtkBackRate;         //反击
            public int AtkBackDefRate;      //抗反击
            public int ComboRate;           //连击
            public int ComboDefRate;        //抗连击
            public int FamilyEmblemID;
            public int Face;    //脸型
            public int FacePic;    //脸型外框
        }
 
 
        public class RolePlusData
        {
            Dictionary<int, ulong> fightPowerDict = new Dictionary<int, ulong>();
            Dictionary<int, int> godWeaponDict = new Dictionary<int, int>();
            Dictionary<int, int> treasureDict = new Dictionary<int, int>();
            public List<HorseInfo> horses = new List<HorseInfo>();
            public List<PetInfo> pets = new List<PetInfo>();
            public List<AlchemyDrug> alchemyDrugs = new List<AlchemyDrug>();
            public int Horse { get; private set; } //改为等级
            public int Pet { get; private set; }
 
            public int AtkSpeed { get; private set; }
            public int Rune { get; private set; }
            public int orangeEquipsCount { get; private set; }
            public int totalGemsLevel { get; private set; }
            public int totalEquipWashLevel { get; private set; }
            public int totalEquipStarLevel { get; private set; }
            public int totalEquipStrengthLevel { get; private set; }
            public int totalEquipEvolveLevel { get; private set; }
            public int totalSkillLevel { get; private set; }
 
            public ulong GetFightPower(int type)
            {
                if (fightPowerDict != null && fightPowerDict.ContainsKey(type))
                {
                    return fightPowerDict[type];
                }
                return 0;
            }
 
            public int GetTreasureCount(int _type)
            {
                if (treasureDict.ContainsKey(_type))
                {
                    return treasureDict[_type];
                }
                return 0;
            }
 
            public int GetGodWeaponLevel(int type)
            {
                if (godWeaponDict.ContainsKey(type))
                {
                    return godWeaponDict[type];
                }
                return 0;
            }
 
            public int GetUseAlchemyDrugsCount()
            {
                var count = 0;
                foreach (var alchemyDrug in alchemyDrugs)
                {
                    var config = AttrFruitConfig.Get(alchemyDrug.item);
                    if (config != null && config.FuncID == 2)
                    {
                        count += alchemyDrug.count;
                    }
                }
                return count;
            }
 
 
            public void AnalysisRolePlusData(string jsonStr)
            {
                try
                {
                    var jsonData = JsonMapper.ToObject(jsonStr);
                    if (jsonData.Keys.Contains("FightPowerDict"))
                    {
                        var jsonPlusData = jsonData["FightPowerDict"];
                        if (jsonPlusData.IsObject)
                        {
                            foreach (var key in jsonPlusData.Keys)
                            {
                                int type = int.Parse(key);
                                fightPowerDict.Add(type, ulong.Parse(jsonPlusData[key].ToString()));
                            }
                        }
                    }
                    if (jsonData.Keys.Contains("EquipOrangeCount"))
                    {
                        var jsonPlusData = jsonData["EquipOrangeCount"];
                        orangeEquipsCount = int.Parse(jsonPlusData.ToString());
                    }
                    if (jsonData.Keys.Contains("TotalEquipStar"))
                    {
                        var jsonPlusData = jsonData["TotalEquipStar"];
                        totalEquipStarLevel = int.Parse(jsonPlusData.ToString());
                    }
                    if (jsonData.Keys.Contains("TotalPlusLV"))
                    {
                        var jsonPlusData = jsonData["TotalPlusLV"];
                        totalEquipStrengthLevel = int.Parse(jsonPlusData.ToString());
                    }
                    if (jsonData.Keys.Contains("TotalPlusEvolveLV"))
                    {
                        var jsonPlusData = jsonData["TotalPlusEvolveLV"];
                        totalEquipEvolveLevel = int.Parse(jsonPlusData.ToString());
                    }
                    if (jsonData.Keys.Contains("TotalStoneLV"))
                    {
                        var jsonPlusData = jsonData["TotalStoneLV"];
                        totalGemsLevel = int.Parse(jsonPlusData.ToString());
                    }
                    if (jsonData.Keys.Contains("TotalEquipWashLV"))
                    {
                        var jsonPlusData = jsonData["TotalEquipWashLV"];
                        totalEquipWashLevel = int.Parse(jsonPlusData.ToString());
                    }
                    if (jsonData.Keys.Contains("TotalSkillLV"))
                    {
                        var jsonPlusData = jsonData["TotalSkillLV"];
                        totalSkillLevel = int.Parse(jsonPlusData.ToString());
                    }
                    if (jsonData.Keys.Contains("GodWeapon"))
                    {
                        var jsonPlusData = jsonData["GodWeapon"];
                        if (jsonPlusData.IsObject)
                        {
                            foreach (var key in jsonPlusData.Keys)
                            {
                                int id = int.Parse(key);
                                godWeaponDict.Add(id, int.Parse(jsonPlusData[key].ToString()));
                            }
                        }
                    }
                    if (jsonData.Keys.Contains("Horse"))
                    {
                        var jsonPlusData = jsonData["Horse"];
                        //if (jsonPlusData.IsArray)
                        //{
                        //    var horseInfos = JsonMapper.ToObject<HorseInfo[]>(jsonPlusData.ToJson());
                        //    if (horseInfos != null && horseInfos.Length > 0)
                        //    {
                        //        horses.AddRange(horseInfos);
                        //    }
                        //    horses.Sort(Compare);
                        //}
 
                        if (jsonPlusData.IsObject)
                        {
                            foreach (var key in jsonPlusData.Keys)
                            {
                                if (key == "LV")
                                {
                                    Horse = int.Parse(jsonPlusData[key].ToString());
                                }
                            }
                        }
 
 
                    }
                    else
                    {
                        Horse = 0;
                    }
                    if (jsonData.Keys.Contains("Pet"))
                    {
                        var jsonPlusData = jsonData["Pet"];
                        if (jsonPlusData.IsObject)
                        {
                            foreach (var _key in jsonPlusData.Keys)
                            {
                                if (_key.Equals("AtkSpeed"))
                                {
                                    AtkSpeed = int.Parse(jsonPlusData[_key].ToString());
                                }
                                else if (_key.Equals("PetLV"))
                                {
                                    var petInfos = JsonMapper.ToObject<PetInfo[]>(jsonPlusData[_key].ToJson());
                                    if (petInfos != null && petInfos.Length > 0)
                                    {
                                        for (int i = 0; i < petInfos.Length; i++)
                                        {
                                            var petInfo = petInfos[i];
                                            pets.Add(new PetInfo()
                                            {
                                                id = petInfo.id,
                                                lv = petInfo.lv + 1,
                                            });
                                        }
                                    }
                                }
                            }
                            pets.Sort(Compare);
                        }
                        Pet = pets.Count;
                    }
                    else
                    {
                        Pet = 0;
                    }
                    if (jsonData.Keys.Contains("Rune"))
                    {
                        var jsonPlusData = jsonData["Rune"];
                        Rune = int.Parse(jsonPlusData.ToString());
                    }
                    else
                    {
                        Rune = 0;
                    }
                    if (jsonData.Keys.Contains("MagicWeapon"))
                    {
                        var jsonPlusData = jsonData["MagicWeapon"];
                        if (jsonPlusData.IsObject)
                        {
                            foreach (var _key in jsonPlusData.Keys)
                            {
                                int _type = int.Parse(_key);
                                treasureDict.Add(_type, int.Parse(jsonPlusData[_key].ToString()));
                            }
                        }
                    }
                    if (jsonData.Keys.Contains("Fruit"))
                    {
                        var jsonPlusData = jsonData["Fruit"];
                        if (jsonPlusData.IsObject)
                        {
                            foreach (var _key in jsonPlusData.Keys)
                            {
                                var _itemId = int.Parse(_key);
                                var _count = int.Parse(jsonPlusData[_key].ToString());
                                alchemyDrugs.Add(new AlchemyDrug()
                                {
                                    item = _itemId,
                                    count = _count,
                                });
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    DebugEx.Log(e.StackTrace);
                }
            }
 
            int Compare(PetInfo x, PetInfo y)
            {
                var config_x = PetInfoConfig.Get(x.id);
                var config_y = PetInfoConfig.Get(y.id);
                if (config_x == null || config_y == null)
                {
                    return 0;
                }
                return -config_x.Sort.CompareTo(config_y.Sort);
            }
 
            int Compare(HorseInfo x, HorseInfo y)
            {
                var config_x = HorseConfig.Get(x.id);
                var config_y = HorseConfig.Get(y.id);
                if (config_x == null || config_y == null)
                {
                    return 0;
                }
                return -config_x.Sort.CompareTo(config_y.Sort);
            }
        }
 
        public struct HorseInfo
        {
            public int id;
            public int lv;
        }
 
        public struct PetInfo
        {
            public int id;
            public int lv;
        }
 
        public struct AlchemyDrug
        {
            public int item;
            public int count;
        }
    }
}