少年修仙传客户端代码仓库
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
using vnxbqy.UI;
using System;
using System.Collections.Generic;
using UnityEngine.UI;
using System.Linq;
using LitJson;
 
public class InvestModel : ILModel<InvestModel>
{
    public ILOpenServerActivityProxy activity;
 
    public const int activityType = (int)OpenServerActivityCenter.ActivityType.AT_JCHD;
    //精彩活动表中的ID
    public const int activityID = 31;
    public const int FuncID = 192;
 
    //投资类型
    public const int InvestType_Login = 9;
    public const int InvestType_Level = 10;
    public const int InvestType_Boss = 11;
 
 
    //投资对应奖励
    Dictionary<int, Dictionary<int, List<ItemEx>>> m_InvestItems = new Dictionary<int, Dictionary<int, List<ItemEx>>>();
    //投资对应充值ID
    Dictionary<int, List<int>> m_InvestRechargeIds = new Dictionary<int, List<int>>();
    //投资对应购买情况
    Dictionary<int, InvestInfo> m_InvestInfos = new Dictionary<int, InvestInfo>();
    //{投资类型:[领取天,当前天]} 天从1开始
    Dictionary<int, List<List<int>>> m_InvestSingleInfos = new Dictionary<int, List<List<int>>>();
    //投资对应的红点
    Dictionary<int, Redpoint> m_Redpoints = new Dictionary<int, Redpoint>();
    //投资类型
    public List<int> investTypes = new List<int>();
 
    public Dictionary<int, int> rechargeSumDict = new Dictionary<int, int>(); //投资类型激活对应的充值总额
 
 
    //永久卡 权限
    public const int foreverCardType = 12; //投资类型
    public Dictionary<int, int> bossMaxCntDict = new Dictionary<int, int>(); //增加boss最大挑战次数
    public Dictionary<int, int> bossBuyCntDict = new Dictionary<int, int>(); //增加boss购买次数
    public Dictionary<int, int> fbMaxCntDict = new Dictionary<int, int>(); //增加副本最大挑战次数
    public Dictionary<int, int> fbBuyCntDict = new Dictionary<int, int>(); //增加副本购买次数
    public List<int> missionQuickFinishType = new List<int>(); //快速完成任务的投资类型
    public Dictionary<int, int[][]> foreverCardDayAwardDict = new Dictionary<int, int[][]>(); //永久卡用的 累充每日奖励
 
    //登录投资,等级投资,BOSS投资
    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 jumpType { get; set; }
 
 
    public event Action onSelectUpdate;
    public event Action onInvestUpdate;
 
    public const int redpointID = 20931;
    public Redpoint redpoint = new Redpoint(MainRedDot.REDPOINT_OPENSERVER, redpointID);
 
    VipModel vipModel { get { return ModelCenter.Instance.GetModelEx<VipModel>(); } }
    RoleModel roleModel { get { return ModelCenter.Instance.GetModel<RoleModel>(); } }
    public int AWARD_TYPE = 79;  //永久卡特殊额外的累充每日奖励
 
    protected override void Init()
    {
        FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChangeEvent;
        GameEvent.beforePlayerDataInitializeEvent += OnBeforePlayerDataInitialize;
        GameEvent.playerLoginOkEvent += OnPlayerLoginOk;
        WindowCenter.Instance.windowAfterOpenEvent += Instance_windowAfterOpenEvent;
        vipModel.rechargeChangeEvent += OnRechargeEvent;
        roleModel.OnPlayerRewardEvent += OnPlayerRewardEvent;
 
        //通过配置决定是否有此投资项,如港台没有登录投资
        ParseConfig();
 
        activity = new ILOpenServerActivityProxy(IsOpen, IsAdvance, priorityOpen);
        OpenServerActivityCenter.Instance.Register(activityID, activity, activityType);
    }
 
    private void Instance_windowAfterOpenEvent(Window obj)
    {
        if (obj.name == "MainInterfaceWin")
        {
            AutoOpenForeverCardWin(1);
        }
    }
 
    protected override void UnInit()
    {
        FuncOpen.Instance.OnFuncStateChangeEvent -= OnFuncStateChangeEvent;
        GameEvent.beforePlayerDataInitializeEvent -= OnBeforePlayerDataInitialize;
        GameEvent.playerLoginOkEvent -= OnPlayerLoginOk;
        WindowCenter.Instance.windowAfterOpenEvent -= Instance_windowAfterOpenEvent;
        vipModel.rechargeChangeEvent -= OnRechargeEvent;
        roleModel.OnPlayerRewardEvent -= OnPlayerRewardEvent;
    }
 
    void OnPlayerRewardEvent(int type)
    {
        if (type == AWARD_TYPE)
        {
            //永久卡每日奖励 和 额外的累充每日奖励 是两个不同的奖励
            //当未激活永久卡时,显示额外的累充每日奖励,红点规则根据额外的累充每日奖励的领取情况
            //当激活永久卡时,显示永久卡每日奖励,红点规则根据永久卡每日奖励的领取情况
            UpdateRedpoint();
        }
    }
 
    //额外的累充每日奖励状态
    // 0 -未激活 1-可领取 2-已领取 3 - 可激活永久卡跳过额外的累充每日奖励
    public int GetForeverCardDayAwardState()
    {
        if (vipModel.realRecharge >= rechargeSumDict[foreverCardType])
            return 3;
        int value = vipModel.realRecharge;
        var keys = foreverCardDayAwardDict.Keys.ToList();
        keys.Sort();
        int activeValue = 0;
        //找出激活的阶段
        for (int i = 0; i < keys.Count; i++)
        {
            if (value >= keys[i])
            {
                activeValue = keys[i];
            }
            else
            {
                break;
            }
        }
        if (activeValue == 0)
            return 0;
 
        //领取最高档位的奖励,或者未领取时0
        if (activeValue > roleModel.GetPlayerRewardState(AWARD_TYPE))
            return 1;
        return 2;
    }
 
 
    public int GetDayAwardRechargeValue()
    {
        if (vipModel.realRecharge >= rechargeSumDict[foreverCardType])
            return 0;
        int value = vipModel.realRecharge;
        var keys = foreverCardDayAwardDict.Keys.ToList();
        keys.Sort();
        int activeValue = 0;
        //找出激活的阶段
        for (int i = 0; i < keys.Count; i++)
        {
            if (value >= keys[i])
            {
                activeValue = keys[i];
            }
            else
            {
                break;
            }
        }
        if (activeValue == 0)
            activeValue = keys[0];
        return activeValue;
 
    }
 
 
    public bool IsOpen()
    {
        return FuncOpen.Instance.IsFuncOpen(FuncID);
    }
 
    public bool IsAdvance()
    {
        return false;
    }
 
    public bool priorityOpen()
    {
        //红点
        return redpoint.state == RedPointState.Simple;
    }
 
 
    public void OnBeforePlayerDataInitialize()
    {
        m_InvestInfos.Clear();
        m_InvestSingleInfos.Clear();
    }
 
    public void OnPlayerLoginOk()
    {
 
        UpdateRedpoint();
    }
 
    void OnRechargeEvent()
    {
        if (GetSingleInvestState(foreverCardType, GetIdsByType(foreverCardType)[0]) == 0 && vipModel.realRecharge >= rechargeSumDict[foreverCardType] || GetForeverCardDayAwardState() == 1)
        {
            PopupWindowsProcessor.Instance.Add("ForeverCardWin");
        }
 
        UpdateRedpoint();
    }
 
    void ParseConfig()
    {
        investTypes.Clear();
        var funcConfig = FuncConfigConfig.Get("InvestCost");
        var json = JsonMapper.ToObject(funcConfig.Numerical3);
        var jsonList = json.Keys.ToList();
        for (int i = 0; i < jsonList.Count; i++)
        {
            var typeKey = jsonList[i];
            var type = int.Parse(typeKey);
            if (type == InvestType_Login || type == InvestType_Level || type == InvestType_Boss || type == foreverCardType)
            {
                m_InvestRechargeIds[type] = new List<int>(JsonMapper.ToObject<int[]>(json[typeKey].ToJson()));
                //if (type == foreverCardType)
                //{
                //    m_Redpoints.Add(type, new Redpoint(MainRedDot.ForeverCardRedPoint));
                //}
                //else
                {
                    //IL 处理新增的投资 type=9之后
                    m_Redpoints.Add(type, new Redpoint(redpointID, redpointID * 100 + type));
                }
            }
        }
        //变成累充激活
        m_Redpoints.Add(foreverCardType, new Redpoint(MainRedDot.ForeverCardRedPoint));
 
        rechargeSumDict = ConfigParse.ParseIntDict(funcConfig.Numerical4);
 
        investTypes = m_InvestRechargeIds.Keys.ToList();
        investTypes.Add(foreverCardType);
        investTypes.Sort();
 
        var configs = InvestConfig.GetValues();
        for (int i = 0; i < configs.Count; i++)
        {
            var config = configs[i];
            if (!investTypes.Contains(config.type))
            {
                continue;
            }
 
            Dictionary<int, List<ItemEx>> dict;
            if (!m_InvestItems.TryGetValue(config.type, out dict))
            {
                dict = new Dictionary<int, List<ItemEx>>();
                m_InvestItems.Add(config.type, dict);
            }
 
            List<ItemEx> items;
            if (!dict.TryGetValue(config.id, out items))
            {
                items = new List<ItemEx>();
                dict.Add(config.id, items);
            }
 
            var itemJson = JsonMapper.ToObject(config.award);
            var itemArray = JsonMapper.ToObject<int[][]>(itemJson["1"].ToJson());
            for (int j = 0; j < itemArray.Length; j++)
            {
                items.Add(new ItemEx()
                {
                    id = itemArray[j][0],
                    count = itemArray[j][1],
                    bind = itemArray[j][2],
                });
            }
        }
        funcConfig = FuncConfigConfig.Get("InvestPower");
        json = JsonMapper.ToObject(funcConfig.Numerical1);
        jsonList = json.Keys.ToList();
        for (int i = 0; i < jsonList.Count; i++)
        {
            var typeKey = jsonList[i];
            var type = int.Parse(typeKey);
            var value = int.Parse(json[typeKey].ToJson());
            bossMaxCntDict.Add(type, value);
        }
        json = JsonMapper.ToObject(funcConfig.Numerical2);
        jsonList = json.Keys.ToList();
        for (int i = 0; i < jsonList.Count; i++)
        {
            var typeKey = jsonList[i];
            var type = int.Parse(typeKey);
            var value = int.Parse(json[typeKey].ToJson());
            fbMaxCntDict.Add(type, value);
        }
        missionQuickFinishType = JsonMapper.ToObject<List<int>>(funcConfig.Numerical3);
 
 
        json = JsonMapper.ToObject(funcConfig.Numerical4);
        jsonList = json.Keys.ToList();
        for (int i = 0; i < jsonList.Count; i++)
        {
            var typeKey = jsonList[i];
            var type = int.Parse(typeKey);
            var value = int.Parse(json[typeKey].ToJson());
            bossBuyCntDict.Add(type, value);
        }
        json = JsonMapper.ToObject(funcConfig.Numerical5);
        jsonList = json.Keys.ToList();
        for (int i = 0; i < jsonList.Count; i++)
        {
            var typeKey = jsonList[i];
            var type = int.Parse(typeKey);
            var value = int.Parse(json[typeKey].ToJson());
            fbBuyCntDict.Add(type, value);
        }
 
        //永久卡增加领取真实累充的每日奖励 和 永久卡自己的每日奖励不一样
        funcConfig = FuncConfigConfig.Get("RechargeDayAward");
        foreverCardDayAwardDict = ConfigParse.ParseIntArray2Dict(funcConfig.Numerical1);
    }
 
    public int GetOrderInfoId(int type)
    {
        var ids = m_InvestRechargeIds[type];
        for (int i = 0; i < ids.Count; i++)
        {
            OrderInfoConfig config;
            if (vipModel.TryGetOrderInfo(ids[i], out config))
            {
                return config.id;
            }
        }
        return 0;
    }
 
    //底层 windowjump调用
    public void SetDefaultJumpType(int id)
    {
        jumpType = id;
    }
 
    //优先指定跳转 后红点
    public int GetSelectType()
    {
        if (jumpType != 0 && investTypes.Contains(jumpType))
        {
            var type = jumpType;
            jumpType = 0;
            return type;
        }
        else
        {
            var keyList = m_Redpoints.Keys.ToList();
            for (int i = 0; i < keyList.Count; i++)
            {
                if (m_Redpoints[keyList[i]].state == RedPointState.Simple)
                {
                    if (keyList[i] == foreverCardType)
                        continue;
                    return keyList[i];
                }
            }
        }
        return investTypes[0];
    }
 
    public bool hasInvestType(int type)
    {
        return investTypes.Contains(type);
    }
 
 
    public int GetInvestPassDays(int type)
    {
        return m_InvestInfos.ContainsKey(type) ? m_InvestInfos[type].days : 0;
    }
 
    //获得单投资的总收益
    public int GetTotalIncome(int type)
    {
        var income = 0;
        if (m_InvestItems.ContainsKey(type))
        {
            var keyList = m_InvestItems[type].Keys.ToList();
            for (int i = 0; i < keyList.Count; i++)
            {
                var items = m_InvestItems[type][keyList[i]];
                for (var j = 0; j < items.Count; j++)
                {
                    var item = items[j];
                    if (item.id == 20 || item.id == 30)
                        income += item.count;
                }
            }
        }
        return income;
    }
 
 
    //id 为表里的ID
    //0-未投资 1-未达成 2-可领取 3-已领取
    public int GetSingleInvestState(int type, int id)
    {
        if (IsInvested(type))
        {
            var day = GetInvestPassDays(type);
            if (m_InvestItems.ContainsKey(type)
                && m_InvestItems[type].ContainsKey(id))
            {
                if (IsRewardGot(type, id))
                {
                    return 3;
                }
                var config = InvestConfig.Get(id);
 
                if (!m_InvestSingleInfos.ContainsKey(type))
                {
                    return 0;
                }
 
                var index = id % 100;
                //每个数按位存31个激活索引
                var listIndex = index / 31;
                var bitIndex = index % 31;
 
                if (type == InvestType_Login)
                {
                    return m_InvestSingleInfos[type][2][0] < config.needDay ? 1 : 2;
                }
                else if (type == InvestType_Level)
                {
                    return PlayerDatas.Instance.baseData.LV < config.needLV ? 1 : 2;
                }
                else if (type == InvestType_Boss)
                {
                    return ((int)Math.Pow(2, bitIndex) & m_InvestSingleInfos[type][2][listIndex]) == 0 ? 1 : 2;
                }
                return day < config.needDay ? 1 : 2;
            }
        }
        return 0;
    }
 
 
 
    public bool TryGetItems(int type, int id, out List<ItemEx> items)
    {
        items = null;
        if (m_InvestItems.ContainsKey(type))
        {
            return m_InvestItems[type].TryGetValue(id, out items);
        }
        return false;
    }
 
    public List<int> GetIdsByType(int type)
    {
        if (m_InvestItems.ContainsKey(type))
        {
            return m_InvestItems[type].Keys.ToList();
        }
        return null;
    }
 
    //判断是否购买了投资
    public bool IsInvested(int type)
    {
        return m_InvestInfos.ContainsKey(type) && m_InvestInfos[type].money > 0;
    }
 
    //奖励是否已领取
    public bool IsRewardGot(int type, int id)
    {
        if (m_InvestSingleInfos.ContainsKey(type))
        {
            var index = id % 100;
            //每个数按位存31个激活索引
            var listIndex = index / 31;
            var bitIndex = index % 31;
            return ((int)Math.Pow(2, bitIndex) & m_InvestSingleInfos[type][1][listIndex]) != 0;
        }
        return false;
    }
 
 
    private void OnFuncStateChangeEvent(int id)
    {
        if (id == FuncID)
        {
            activity.StateUpdate(id);
            UpdateRedpoint();
        }
        //else if (id == 223)
        //{
        //    AutoOpenForeverCardWin(0);
        //}
    }
 
    //0 功能开启 1 非首日 自动打开
    private void AutoOpenForeverCardWin(int type)
    {
        if (!FuncOpen.Instance.IsFuncOpen(223))
            return;
        var ids = GetIdsByType(foreverCardType);
        var state = GetSingleInvestState(foreverCardType, ids[0]);
        if (state != 0)
            return;
 
        int openState = LocalSave.GetInt("ForeverCard" + PlayerDatas.Instance.baseData.PlayerID);
        if (type == 0)
        {
            if ((openState & 1) != 0)
                return;
        }
 
        else if (type == 1)
        {
            if ((openState & 2) != 0 || TimeUtility.CreateDays <= 1)
                return;
        }
 
        if (WindowCenter.Instance.IsOpen<MainInterfaceWin>() && !NewBieCenter.Instance.inGuiding
            && !WindowCenter.Instance.ExistAnyFullScreenOrMaskWin() && !StageLoad.Instance.isLoading
            && !ModelCenter.Instance.GetModel<TreasureModel>().newGotShowing)
        {
            //WindowCenter.Instance.Open<ForeverCardWin>();
            PopupWindowsProcessor.Instance.Add("ForeverCardWin");
            openState = openState | (int)Math.Pow(2, type);
            LocalSave.SetInt("ForeverCard" + PlayerDatas.Instance.baseData.PlayerID, openState);
        }
    }
 
 
    public void SendGetReward(int type, int id)
    {
        var pak = new CA541_tagCMGetInvestReward();
        pak.InvestType = (byte)type;
        pak.RewardIndex = (byte)(id % 100);
        GameNetSystem.Instance.SendInfo(pak);
    }
 
    public void SendInvest(int type)
    {
        var orderInfoId = GetOrderInfoId(type);
        var config = OrderInfoConfig.Get(orderInfoId);
        vipModel.CTG(config);
    }
 
    public void UpdateInvestInfo(HA338_tagMCInvestInfo package)
    {
        if (!investTypes.Contains(package.InvestType))
        {
            return;
        }
 
        m_InvestInfos[package.InvestType] = new InvestInfo()
        {
            days = (int)package.CurDay,
            money = package.CurDay >= 1 ? 1 : 0,
        };
 
        List<List<int>> singleInfos;
        if (!m_InvestSingleInfos.TryGetValue(package.InvestType, out singleInfos))
        {
            singleInfos = new List<List<int>>();
            m_InvestSingleInfos.Add(package.InvestType, singleInfos);
        }
        singleInfos.Clear();
        singleInfos.Add(new List<int>());
        singleInfos.Add(new List<int>());
        singleInfos.Add(new List<int>());
        singleInfos[0].Add((int)package.CurDay);
        for (int i = 0; i < package.ValueCount; i++)
        {
            singleInfos[1].Add((int)package.RewardValue[i]);
            singleInfos[2].Add((int)package.ProgressValue[i]);
        }
        UpdateRedpoint();
 
        if (onInvestUpdate != null)
        {
            onInvestUpdate();
        }
    }
 
    void UpdateRedpoint()
    {
        List<int> redpointTypes = new List<int>();
        if (IsOpen())
        {
            for (var i = 0; i < investTypes.Count; i++)
            {
                var type = investTypes[i];
                if (!IsInvested(type))
                {
                    continue;
                }
                var keyList = m_InvestItems[type].Keys.ToList();
                for (int j = 0; j < keyList.Count; j++)
                {
                    var id = keyList[j];
                    if (GetSingleInvestState(type, id) == 2)
                    {
                        redpointTypes.Add(type);
                        break;
                    }
                }
            }
        }
 
        var redList = m_Redpoints.Keys.ToList();
        for (int j = 0; j < redList.Count; j++)
        {
            var type = redList[j];
            m_Redpoints[type].state = redpointTypes.Contains(type) ? RedPointState.Simple : RedPointState.None;
        }
 
        if (m_Redpoints[foreverCardType].state != RedPointState.Simple)
        { 
            if (GetSingleInvestState(foreverCardType, GetIdsByType(foreverCardType)[0]) == 0 && vipModel.realRecharge >= rechargeSumDict[foreverCardType] || GetForeverCardDayAwardState() == 1)
            {
                m_Redpoints[foreverCardType].state = RedPointState.Simple;
            }
            else
            {
                m_Redpoints[foreverCardType].state = RedPointState.None;
            }
        }
 
    }
 
    public int GetBossAddMaxCnt(int type)
    {
        var ids = GetIdsByType(foreverCardType);
        var state = GetSingleInvestState(foreverCardType, ids[0]);
        if (state == 0)
            return 0;
        int value = 0;
        bossMaxCntDict.TryGetValue(type, out value);
        return value;
    }
 
    public int GetBossAddBuyCnt(int type)
    {
        var ids = GetIdsByType(foreverCardType);
        var state = GetSingleInvestState(foreverCardType, ids[0]);
        if (state == 0)
            return 0;
        int value = 0;
        bossBuyCntDict.TryGetValue(type, out value);
        return value;
    }
 
    public int GetFBAddMaxCnt(int mapID)
    {
        var ids = GetIdsByType(foreverCardType);
        var state = GetSingleInvestState(foreverCardType, ids[0]);
        if (state == 0)
            return 0;
        int value = 0;
        fbMaxCntDict.TryGetValue(mapID, out value);
        return value;
    }
 
    public int GetFBAddBuyCnt(int mapID)
    {
        var ids = GetIdsByType(foreverCardType);
        var state = GetSingleInvestState(foreverCardType, ids[0]);
        if (state == 0)
            return 0;
        int value = 0;
        fbBuyCntDict.TryGetValue(mapID, out value);
        return value;
    }
 
 
    public bool IsMissionQuickFinish()
    {
        var ids = GetIdsByType(foreverCardType);
        var state = GetSingleInvestState(foreverCardType, ids[0]);
        if (state == 0)
            return false;
        return missionQuickFinishType.Contains(foreverCardType);
    }
 
    public bool IsOnHookQuickBuyFree()
    {
        return IsActiveForeverCard();
    }
 
    public bool IsActiveForeverCard()
    {
        var ids = GetIdsByType(foreverCardType);
        var state = GetSingleInvestState(foreverCardType, ids[0]);
        if (state == 0)
            return false;
        return true;
    }
 
    //已经购买并领取所有物品
    public bool IsFinish()
    {
        for (int i = 0; i < investTypes.Count; i++)
        {
            int type = investTypes[i];
            //忽略登陆投资
            if (type== InvestType_Login)
                continue;
            //忽略永久卡
            if (type == foreverCardType)
                continue;
            var idsList = GetIdsByType(type);
            if (idsList.IsNullOrEmpty())
                continue;
            for (int j = 0; j < idsList.Count; j++)
            {
                int id = idsList[j];
                if (GetSingleInvestState(type, id) != 3)
                {
                    return false;
                }
            }
        }
        return true;
    }
 
    public struct InvestInfo
    {
        public int money;
        public int days;
    }
}