예제 #1
0
        public bool MyArmer(MsgInformationEx MsgDTO, object[] param)
        {
            var record = VipArmerRecord.Get(MsgDTO.FromQQ);

            if (record.Armers.IsNullOrEmpty())
            {
                MsgSender.PushMsg(MsgDTO, "你尚未持有任何装备!");
                return(false);
            }

            var armerMsgs = record.Armers.Select(r => $"{r.Name}:{r.Description}{(r.ExpiryTime.HasValue ? $"({r.ExpiryTime})" : string.Empty)}");
            var msg       = $"你当前持有的装备有:\r\n{string.Join("\r\n", armerMsgs)}";

            MsgSender.PushMsg(MsgDTO, msg);
            return(true);
        }
예제 #2
0
        public static VipArmerRecord Get(long QQNum)
        {
            var rec = MongoService <VipArmerRecord> .GetOnly(p => p.QQNum == QQNum);

            if (rec == null)
            {
                rec = new VipArmerRecord()
                {
                    QQNum = QQNum
                };
                MongoService <VipArmerRecord> .Insert(rec);
            }

            rec.Armers.Remove(p => p.ExpiryTime != null && p.ExpiryTime < DateTime.Now);
            return(rec);
        }
예제 #3
0
        private static bool CheckMaxContains(MsgInformationEx MsgDTO, IVipArmer armer)
        {
            if (armer.MaxContains == 0)
            {
                return(true);
            }

            var armerRec = VipArmerRecord.Get(MsgDTO.FromQQ);

            if (!armerRec.CheckArmer(armer.Name, armer.MaxContains))
            {
                return(true);
            }

            MsgSender.PushMsg(MsgDTO, $"你已经有{armer.MaxContains}件这个装备了!");
            return(false);
        }