public bool StoryContribute(MsgInformationEx MsgDTO, object[] param) { var info = WaiterSvc.WaitForInformation(MsgDTO, "请上传图片!", information => information.FromGroup == MsgDTO.FromGroup && information.FromQQ == MsgDTO.FromQQ && !string.IsNullOrEmpty(Utility.ParsePicGuid(information.Msg)), 10); if (info == null) { MsgSender.PushMsg(MsgDTO, "操作取消!"); return(false); } var bindai = BindAiSvc[MsgDTO.BindAi]; var picGuid = Utility.ParsePicGuid(info.Msg); var imageCache = Utility.ReadImageCacheInfo(picGuid, bindai.ImagePath); if (imageCache == null) { MsgSender.PushMsg(MsgDTO, "文件缓存读取失败!"); return(false); } var fileName = $"MiniStory{DateTime.Now:yyyyMMddHHmmss}.{imageCache.type}"; if (!Utility.DownloadImage(imageCache.url, CachePath + fileName)) { MsgSender.PushMsg(MsgDTO, "图片下载失败,请稍后再试!"); return(false); } ArknightsMiniStoryRecord.Insert(fileName); MsgSender.PushMsg(MsgDTO, "保存成功!"); return(true); }
public bool Fight(MsgInformationEx MsgDTO, object[] param) { var aimNum = (long)param[0]; if (MsgDTO.FromQQ == aimNum) { MsgSender.PushMsg(MsgDTO, "你无法跟自己对决!"); return(false); } if (BindAiSvc.AllAiNums.Contains(aimNum)) { MsgSender.PushMsg(MsgDTO, "鱼唇的人类,你无法挑战ai的威严!"); return(false); } if (ChessSvc.IsGroupInPlaying(MsgDTO.FromGroup)) { MsgSender.PushMsg(MsgDTO, "本群正在进行一场对决,请稍后再试!"); return(false); } if (OSPersonBuff.CheckBuff(MsgDTO.FromQQ, "黄砂")) { MsgSender.PushMsg(MsgDTO, "你当前无法进行挑战!(黄砂)"); return(false); } if (!WaiterSvc.WaitForConfirm(MsgDTO.FromGroup, aimNum, $"{CodeApi.Code_At(MsgDTO.FromQQ)} 正在向你发起一场对决,是否接受?", MsgDTO.BindAi, 10)) { MsgSender.PushMsg(MsgDTO, "对决取消!"); return(false); } if (ChessSvc.IsQQInPlaying(MsgDTO.FromQQ)) { MsgSender.PushMsg(MsgDTO, "你正在进行一场对决,请稍后再试!"); return(false); } if (ChessSvc.IsQQInPlaying(aimNum)) { MsgSender.PushMsg(MsgDTO, "你的对手正在进行一场对决,请稍后再试!"); return(false); } ChessSvc.StartAGame(MsgDTO.FromGroup, MsgDTO.FromQQ, aimNum, (GroupNum, QQNum, Msg, judge) => { var msg = MsgDTO.Clone(); msg.FromQQ = QQNum; msg.FromGroup = GroupNum; var info = WaiterSvc.WaitForInformation(msg, Msg, information => information.FromGroup == GroupNum && information.FromQQ == QQNum && judge(information.Msg), 10, true); return(info == null ? string.Empty : info.Msg); }, MsgDTO.BindAi); return(true); }
public bool Reborn(MsgInformationEx MsgDTO, object[] param) { var itemColl = ItemCollectionRecord.Get(MsgDTO.FromQQ); if (itemColl.HonorCollections.IsNullOrEmpty()) { MsgSender.PushMsg(MsgDTO, "你尚未集齐所有非限定物品!", true); return(false); } var normalHonors = itemColl.HonorCollections.Where(h => h.Value.Type == HonorType.Normal).ToList(); var items = normalHonors.Select(p => p.Value).SelectMany(h => h.Items.Keys).ToList(); var allItems = HonorSvc.HonorList.Where(h => !(h is LimitHonorModel)).SelectMany(h => h.Items).Select(p => p.Name); if (items.Count != allItems.Count()) { MsgSender.PushMsg(MsgDTO, "你尚未集齐所有非限定物品!", true); return(false); } var response = WaiterSvc.WaitForInformation(MsgDTO, $"请输入想获取的荣誉称号名称(不能超过{RebornHonorLimit}个字)", info => info.FromQQ == MsgDTO.FromQQ && info.FromGroup == MsgDTO.FromGroup && info.Msg != null && info.Msg.Length <= RebornHonorLimit, 10); if (response == null) { MsgSender.PushMsg(MsgDTO, "操作取消!"); return(false); } var honorName = response.Msg; var osPerson = OSPerson.GetPerson(MsgDTO.FromQQ); if (osPerson.HonorNames.Contains(honorName)) { MsgSender.PushMsg(MsgDTO, "你已经获取了该荣誉称号,操作取消!"); return(false); } osPerson.Level++; osPerson.HonorNames.Add(honorName); foreach (var honor in normalHonors.Select(p => p.Key)) { TransHelper.SellHonorToShop(itemColl, honor, osPerson); } itemColl.Update(); osPerson.Update(); MsgSender.PushMsg(MsgDTO, $"恭喜【{honorName}】,转生成功!"); return(true); }
public bool Boom(MsgInformationEx MsgDTO, object[] param) { var backInfo = WaiterSvc.WaitForInformation( new MsgCommand { Command = CommandType.SendGroup, Msg = "请于5秒内输入指令码!", ToGroup = MsgDTO.FromGroup, BindAi = MsgDTO.BindAi }, info => info.Msg == BoomCode.ToString()); if (backInfo == null) { MsgSender.PushMsg(MsgDTO, "自爆失败!"); return(false); } if (CodeDate.AddMinutes(5) < DateTime.Now) { MsgSender.PushMsg(MsgDTO, "指令码已失效!"); return(false); } MsgSender.PushMsg(MsgDTO, "AI即将自爆!"); Thread.Sleep(1000); for (var i = 5; i > 0; i--) { MsgSender.PushMsg(MsgDTO, i.ToString()); Thread.Sleep(1000); } MsgSender.PushMsg(MsgDTO, CodeApi.Code_Image_Relational("images/boom.jpg")); BoomCode = Rander.RandInt(10000); Thread.Sleep(1000); return(true); }
public bool SetPetPic(MsgInformationEx MsgDTO, object[] param) { var osPerson = OSPerson.GetPerson(MsgDTO.FromQQ); if (osPerson.Golds < 300) { MsgSender.PushMsg(MsgDTO, $"你的金币余额不足({osPerson.Golds.CurencyFormat()}/{300.CurencyFormat()})"); return(false); } if (!WaiterSvc.WaitForConfirm_Gold(MsgDTO, 300)) { MsgSender.PushMsg(MsgDTO, "操作取消!"); return(false); } var info = WaiterSvc.WaitForInformation(MsgDTO, "请上传图片(不能超过300KB)!", information => information.FromGroup == MsgDTO.FromGroup && information.FromQQ == MsgDTO.FromQQ && !string.IsNullOrEmpty(Utility.ParsePicGuid(information.Msg)), 10); if (info == null) { MsgSender.PushMsg(MsgDTO, "操作取消!"); return(false); } var bindai = BindAiSvc[MsgDTO.BindAi]; var picGuid = Utility.ParsePicGuid(info.Msg); var imageCache = Utility.ReadImageCacheInfo(picGuid, bindai.ImagePath); if (imageCache == null) { MsgSender.PushMsg(MsgDTO, "未读取到图片!"); return(false); } var fileName = $"PetPic-{MsgDTO.FromQQ}.{imageCache.type}"; if (!Utility.DownloadImage(imageCache.url, CachePath + fileName)) { MsgSender.PushMsg(MsgDTO, "图片下载失败,请稍后再试!"); return(false); } var picFile = new FileInfo(CachePath + fileName); if (picFile.Length / 1024 > 300) { MsgSender.PushMsg(MsgDTO, "图片过大,请选择较小的图片重新上传!", true); picFile.Delete(); return(false); } osPerson.Golds -= 300; osPerson.Update(); MsgSender.PushMsg(MsgDTO, "上传成功!待审核通过后方可生效!"); var review = new PicReviewRecord() { GroupNum = MsgDTO.FromGroup, QQNum = MsgDTO.FromQQ, Usage = "宠物头像", PicName = picFile.Name }; PicReviewSvc.AddReview(review); return(true); }
public bool Upgrade(MsgInformationEx MsgDTO, object[] param) { var osPerson = OSPerson_Doremi.GetPerson(MsgDTO.FromQQ); var level = LevelSvc.GetByLevel(osPerson.Level); var exp = MsgCounterSvc.Get(MsgDTO.FromQQ); if (exp < level.Exp) { MsgSender.PushMsg(MsgDTO, "你没有足够的经验值升级!", true); return(false); } if (level.Level == LevelSvc.TopLevel) { MsgSender.PushMsg(MsgDTO, "你已满级,无需渡劫!", true); return(false); } MsgSender.PushMsg(MsgDTO, "渡劫开始!你需要回答对全部问题才能成功渡劫!"); var qas = DujieSvc.RandQAs(DujieQACount); int i; for (i = 0; i < DujieQACount; i++) { var randAs = qas[i].RandAs; var msg = $"题目({i + 1}/{DujieQACount}):\r\n" + $"{qas[i].Q}\r\n" + $"{string.Join("\r\n", randAs.Select((p, idx) => $"{idx + 1}:{p}"))}"; var i1 = i; var info = WaiterSvc.WaitForInformation(MsgDTO, msg, information => information.FromGroup == MsgDTO.FromGroup && information.FromQQ == MsgDTO.FromQQ && int.TryParse(information.Msg, out var idx) && idx > 0 && idx <= qas[i1].A.Length, 10); if (info == null) { MsgSender.PushMsg(MsgDTO, "回答超时!"); break; } var aidx = int.Parse(info.Msg) - 1; if (!qas[i].IsCorrect(randAs[aidx])) { MsgSender.PushMsg(MsgDTO, "回答错误!"); break; } MsgSender.PushMsg(MsgDTO, "回答正确!"); } MsgCounterSvc.Consume(MsgDTO.FromQQ, level.Exp); if (i != DujieQACount) { MsgSender.PushMsg(MsgDTO, "渡劫失败,请重新来过!", true); return(true); } osPerson.Level++; osPerson.Update(); MsgSender.PushMsg(MsgDTO, "升级成功!"); return(true); }