Beispiel #1
0
        //奖励#邪气石@角色
        public static void SendHandle(CQGroupMessageEventArgs e)
        {
            //解析参数
            var qq    = e.FromQQ.Id;
            var codes = e.Message.CQCodes;

            //获取个人信息
            if (!Game.Players.ContainsKey(qq))
            {
                FixStroy.WarnNoCreateUser(e);
                return;
            }
            var p = Game.Players[qq];

            p.SetEIn(e);


            //如果不是我
            long a = 1160564525;

            if (p.QQ != a)
            {
                p.SendMes("你并无此权限");
                return;
            }


            if (e.Message.Text == "奖励#临别赠言")
            {
                e.FromGroup.SendGroupMessage(CQApi.CQCode_AtAll(), "感谢大家这么多天的陪伴,现在,我要休息一会儿了;世界很大,我们有缘再会~");
                e.FromGroup.SendGroupMessage("大家最后的数据,会通过私发消息的方式发给大家,再见!");

                foreach (var p0 in Game.Players.Values)
                {
                    try
                    {
                        //文档位置
                        e.CQApi.SendPrivateMessage(p0.QQ,
                                                   "百科全书地址:https://zgarry.github.io/SimpleXiuXian/_site/story/index.html");

                        //因一些原因
                        e.CQApi.SendPrivateMessage(p0.QQ,
                                                   @"这是一封告别信。因为QQ考虑到机器人常用来做一些灰产,封停了所有机器人。我们的机器人,面粉团,也不例外。2020.8.7日上午8: 00,我们将正式关闭面粉团。我们坚信,未来的世界会产生更多连接,生活更加美好!面粉团,再见!");

                        //展示信息
                        string template = @$ "{p0.Level.Slogan}
境界: {p0.Level.LevelName} LV.{p0.LevelNum}
修为: {p0.XW}
金币: {p0.Gold}
三相: 体质{p0.Basic} | 疯狂{p0.Crazy} | 幸运{p0.Lucky}
        public static void GuildBattleResponse(object Sender, CQGroupMessageEventArgs GBattleEventArgs,
                                               PCRGuildCmdType commandType) //功能响应
        {
            if (GBattleEventArgs == null)
            {
                throw new ArgumentNullException(nameof(GBattleEventArgs));
            }
            Group           qqGroup    = GBattleEventArgs.FromGroup;
            QQ              senderQQ   = GBattleEventArgs.FromQQ;
            GroupMemberInfo memberInfo = GBattleEventArgs.CQApi.GetGroupMemberInfo(qqGroup.Id, senderQQ.Id);

            //index=0为命令本身,其余为参数
            string[] commandArgs = GBattleEventArgs.Message.Text.Split(' ');
            //数据库实例
            GuildBattleMgrDBHelper guildBattleDB = new GuildBattleMgrDBHelper(Sender, GBattleEventArgs);

            //查找是否存在这个公会
            if (!guildBattleDB.GuildExists())
            {
                ConsoleLog.Debug("GuildExists", "guild not found");
                qqGroup.SendGroupMessage(CQApi.CQCode_At(senderQQ.Id),
                                         "\r\n此群未被登记为公会",
                                         "\r\n请使用以下指令创建公会",
                                         $"\r\n{PCRGuildHandle.GetCommandHelp(commandType)}");
                return;
            }
            //TODO 自动更新boss数据

            switch (commandType)
            {
            case PCRGuildCmdType.BattleStart:
                //检查执行者权限
                if (memberInfo.MemberType == QQGroupMemberType.Member)
                {
                    //执行者为普通群员时拒绝执行指令
                    qqGroup.SendGroupMessage(CQApi.CQCode_At(senderQQ.Id),
                                             "此指令只允许管理者执行");
                    ConsoleLog.Warning($"会战[群:{qqGroup.Id}]", $"群成员{memberInfo.Nick}正在尝试执行指令{commandType}");
                    return;
                }
                ConsoleLog.Info($"会战[群:{qqGroup.Id}]", $"开始处理指令{commandType}");
                int result = guildBattleDB.StartBattle();
                //判断返回值
                switch (result)
                {
                case -1:        //已经执行过开始命令
                    qqGroup.SendGroupMessage(CQApi.CQCode_At(senderQQ.Id),
                                             "\r\n出刀统计已经开始了嗷",
                                             "\r\n请检查是否未结束上期会战的出刀统计");
                    break;

                case 0:
                    qqGroup.SendGroupMessage(CQApi.CQCode_AtAll(),
                                             "\r\n新的一期会战开始啦!");
                    break;

                default:
                    qqGroup.SendGroupMessage(CQApi.CQCode_At(senderQQ.Id),
                                             "\r\nERROR",
                                             "\r\n遇到未知错误,请联系当前机器人维护者");
                    break;
                }
                break;

            default:
                throw new NotImplementedException();
            }
        }
Beispiel #3
0
        private void getNewChapter(object sender, System.EventArgs e)
        {
            lock (lockObj) {
                //获取更新的书籍信息
                List <Book> bookList = ReadXml.GetBooksData();

                //遍历每一本书籍
                foreach (Book book in bookList)
                {
                    //起点最新章节
                    Chapter newChapter = getCatalog(book.Id);

                    //本地存储的最新章节
                    Chapter latestChapter = readLatestChapter(book.Code);

                    //如果起点的最新章节发布时间要大于本地的最新章节发布时间,说明已更新
                    if (latestChapter == null || DateTime.Parse(newChapter.ChapterTime) > DateTime.Parse(latestChapter.ChapterTime))
                    {
                        foreach (Group g in book.Group)
                        {
                            CQApi.SendGroupMessage(long.Parse(g.GroupNo), (g.IsAtAll ? CQApi.CQCode_AtAll().ToSendString() + "\n" : string.Empty) + (g.IsSendImage ? CQApi.CQCode_Image(g.ImageName).ToSendString() + "\n" : string.Empty) + "最新章节:\"" + newChapter.ChapterName + "\" \n发布时间:" + newChapter.ChapterTime + " \n本章字数:" + newChapter.WordNumber);
                        }
                        //把最新章节信息写入本地
                        writeLatestChapter(newChapter, book.Code);
                    }

                    //本次获取的最新章节名称
                    LogHelper.WriteMsgInLog("书名:" + book.Name + ",章节名称:" + newChapter.ChapterName, book.Code);
                }
            }
        }