Beispiel #1
0
        public bool MySegment(MsgInformationEx MsgDTO, object[] param)
        {
            var record = SegmentRecord.Get(MsgDTO.FromQQ);

            if (string.IsNullOrEmpty(record.Segment))
            {
                MsgSender.PushMsg(MsgDTO, "你尚未持有任何宝藏碎片!", true);
                return(false);
            }
            var segment = SegmentSvc.FindSegmentByName(record.Segment);

            if (segment == null)
            {
                MsgSender.PushMsg(MsgDTO, "未找到指定的宝藏碎片");
                return(false);
            }

            var treasure = SegmentSvc.FindTreasureBySegment(record.Segment);
            var session  = new MsgSession(MsgDTO);

            session.Add(segment.ToString());
            session.Add($"可开启宝藏:{treasure.Name}");

            if (record.IsRare)
            {
                session.Add("【稀有】:拼接后将得到双倍奖励!");
            }

            session.Send();
            return(true);
        }
Beispiel #2
0
        public bool MyTreasureRecord(MsgInformationEx MsgDTO, object[] param)
        {
            var record = SegmentRecord.Get(MsgDTO.FromQQ);

            if (record.TreasureRecord.IsNullOrEmpty())
            {
                MsgSender.PushMsg(MsgDTO, "你还没有开启过任何宝藏!");
                return(false);
            }

            var session = new MsgSession(MsgDTO);

            session.Add(record.TreasureRecord.Select(p => $"{p.Key}:{p.Value}次").ToList());
            session.Add($"总计:{record.TreasureRecord.Sum(p => p.Value)}次");

            var finalMsg = $"终极宝藏:{record.FinalTreasureCount}次";

            if (record.CanOpenFinalTreasure)
            {
                finalMsg += $"(还可开启{record.TreasureRecord.Values.Min() - record.FinalTreasureCount}次)";
            }
            session.Add(finalMsg);

            session.Send();
            return(true);
        }
Beispiel #3
0
        public static SegmentRecord Get(long QQNum)
        {
            var record = MongoService <SegmentRecord> .GetOnly(p => p.QQNum == QQNum);

            if (record != null)
            {
                return(record);
            }

            record = new SegmentRecord()
            {
                QQNum = QQNum
            };
            MongoService <SegmentRecord> .Insert(record);

            return(record);
        }
Beispiel #4
0
        public bool TakeSegment(MsgInformationEx MsgDTO, object[] param)
        {
            var segment = SegmentSvc.RandSegment();
            var record  = SegmentRecord.Get(MsgDTO.FromQQ);

            record.Segment = segment.Name;
            record.IsRare  = Rander.RandInt(100) > 90;
            record.Update();

            var session = new MsgSession(MsgDTO);

            session.Add("你领取到了新的宝藏碎片!");
            session.Add(segment.ToString());

            var treasure = SegmentSvc.FindTreasureBySegment(record.Segment);

            session.Add($"可开启宝藏:【{treasure.Name}】");
            if (record.IsRare)
            {
                session.Add($"{Emoji.礼物}恭喜你领取到了稀有碎片,拼接后将得到双倍奖励!");
            }
            session.Send();
            return(true);
        }
Beispiel #5
0
        public bool AttachSegment(MsgInformationEx MsgDTO, object[] param)
        {
            var aimQQ = (long)param[0];

            if (aimQQ == MsgDTO.FromQQ)
            {
                MsgSender.PushMsg(MsgDTO, "你无法和自己进行拼接!", true);
                return(false);
            }

            if (BindAiSvc.AllAiNums.Contains(aimQQ))
            {
                MsgSender.PushMsg(MsgDTO, "Stupid Human!", true);
                return(false);
            }

            var selfRecord = SegmentRecord.Get(MsgDTO.FromQQ);

            if (string.IsNullOrEmpty(selfRecord.Segment))
            {
                MsgSender.PushMsg(MsgDTO, "你当前没有任何碎片!", true);
                return(false);
            }

            var aimRecord = SegmentRecord.Get(aimQQ);

            if (string.IsNullOrEmpty(aimRecord.Segment))
            {
                MsgSender.PushMsg(MsgDTO, "对方当前没有任何碎片!", true);
                return(false);
            }

            var treasure = SegmentSvc.FindTreasureBySegment(selfRecord.Segment);

            if (!treasure.IsMatch(selfRecord.Segment, aimRecord.Segment))
            {
                MsgSender.PushMsg(MsgDTO, $"拼接失败,碎片不匹配!({selfRecord.Segment}×{aimRecord.Segment})");
                return(false);
            }

            selfRecord.AddTreasureRecord(treasure.Name);
            aimRecord.AddTreasureRecord(treasure.Name);

            var selfBonusItems = HonorSvc.RandItems(3);
            var aimBonusItems  = HonorSvc.RandItems(3);

            var selfIcRecord = ItemCollectionRecord.Get(MsgDTO.FromQQ);
            var aimIcRecord  = ItemCollectionRecord.Get(aimQQ);

            var selfRate = selfRecord.IsRare ? 2 : 1;

            foreach (var item in selfBonusItems)
            {
                selfIcRecord.ItemIncome(item.Name, selfRate);
            }

            var aimRate = aimRecord.IsRare ? 2 : 1;

            foreach (var item in aimBonusItems)
            {
                aimIcRecord.ItemIncome(item.Name, aimRate);
            }

            MsgSender.PushMsg(MsgDTO, treasure.ToString());

            var msg = "拼接成功!\r\n" +
                      $"{CodeApi.Code_At(MsgDTO.FromQQ)} 获得了{selfBonusItems.Select(p => $"{p.Name}*{selfRate}").JoinToString(",")} !\r\n" +
                      $"{CodeApi.Code_At(aimQQ)} 获得了{aimBonusItems.Select(p => $"{p.Name}*{aimRate}").JoinToString(",")} !";

            MsgSender.PushMsg(MsgDTO, msg);

            selfRecord.ClearSegment();
            aimRecord.ClearSegment();
            selfRecord.Update();
            aimRecord.Update();

            return(true);
        }
Beispiel #6
0
        public bool OpenFinalTreasure(MsgInformationEx MsgDTO, object[] param)
        {
            var record = SegmentRecord.Get(MsgDTO.FromQQ);

            if (!record.CanOpenFinalTreasure)
            {
                MsgSender.PushMsg(MsgDTO, "很遗憾,你还不能开启终极宝藏,继续努力吧!(开启过所有其他宝藏才能开启终极宝藏!)", true);
                return(false);
            }

            var options     = new[] { "获取500金币", "随机获取商店售卖的一件商品*5", "宠物获取50点经验值", "捞瓶子机会*5(仅当日有效)" };
            var selectedIdx = WaiterSvc.WaitForOptions(MsgDTO.FromGroup, MsgDTO.FromQQ, "请选择你要开启的宝藏:", options, MsgDTO.BindAi);

            if (selectedIdx < 0)
            {
                MsgSender.PushMsg(MsgDTO, "你已经放弃了思考!");
                return(false);
            }

            switch (selectedIdx)
            {
            case 0:
            {
                var osPerson = OSPerson.GetPerson(MsgDTO.FromQQ);
                osPerson.Golds += 500;
                osPerson.Update();

                MsgSender.PushMsg(MsgDTO, $"恭喜你获得了 {500.CurencyFormat()}!");
                break;
            }

            case 1:
            {
                var items    = TransHelper.GetDailySellItems();
                var randItem = items.RandElement();

                MsgSender.PushMsg(MsgDTO, $"恭喜你获得了 {randItem.Name}*5!");

                var collo = ItemCollectionRecord.Get(MsgDTO.FromQQ);
                var msg   = collo.ItemIncome(randItem.Name, 5);
                if (!string.IsNullOrEmpty(msg))
                {
                    MsgSender.PushMsg(MsgDTO, msg);
                }
                break;
            }

            case 2:
            {
                var pet = PetRecord.Get(MsgDTO.FromQQ);
                var msg = pet.ExtGain(MsgDTO, 50);
                MsgSender.PushMsg(MsgDTO, msg);
                break;
            }

            case 3:
            {
                var dailyLimit = DailyLimitRecord.Get(MsgDTO.FromQQ, "DriftBottleAI_FishingBottle");
                dailyLimit.Decache(5);
                dailyLimit.Update();

                MsgSender.PushMsg(MsgDTO, "恭喜你获取 捞瓶子机会*5(仅当日有效) !");
                break;
            }
            }

            record.FinalTreasureCount++;
            record.Update();

            return(true);
        }