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 ViewTreasure(MsgInformationEx MsgDTO, object[] param)
        {
            var name = param[0] as string;

            var treasure = SegmentSvc.FindTreasureByName(name);

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

            MsgSender.PushMsg(MsgDTO, treasure.ToString());
            return(true);
        }
Beispiel #3
0
        public bool ViewSegment(MsgInformationEx MsgDTO, object[] param)
        {
            var name    = param[0] as string;
            var segment = SegmentSvc.FindSegmentByName(name);

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

            var treasure = SegmentSvc.FindTreasureBySegment(name);
            var msg      = $"{segment}\r\n可开启宝藏:{treasure.Name}";

            MsgSender.PushMsg(MsgDTO, msg);
            return(true);
        }
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);
        }