Пример #1
0
        public FunctionResult Progress(QMGroupMessageEventArgs e)
        {
            FunctionResult result = new FunctionResult
            {
                result   = QMEventHandlerTypes.Intercept,
                SendFlag = true
            };
            SendText sendText = new SendText();

            sendText.SendID = e.FromGroup.Id; result.SendObject.Add(sendText);

            if (Save.AppConfig.Object["ExtraConfig"]["ExecuteSql"].GetValueOrDefault("0") == "0")
            {
                sendText.MsgToSend.Add($"[@{e.FromQQ.Id}]此功能未在控制台开启,拒绝操作");
                return(result);
            }
            int count = Convert.ToInt32(Save.AppConfig.Object[e.FromGroup.Id.ToString()]["Count"]
                                        .GetValueOrDefault("0"));

            if (!Helper.CheckAdmin(e))
            {
                sendText.MsgToSend.Add($"[@{e.FromQQ.Id}]权限不足,拒绝操作");
                return(result);
            }
            try
            {
                int countSql = SQLHelper.ExecuteSQL(e.Message.Text.Substring(4));
                sendText.MsgToSend.Add($"操作成功,{countSql}行受影响");
            }
            catch (Exception err)
            {
                sendText.MsgToSend.Add($"[@{e.FromQQ.Id}]执行失败:\n{err.Message}");
            }
            return(result);
        }
Пример #2
0
        public FunctionResult Progress(QMGroupMessageEventArgs e)
        {
            FunctionResult result = new FunctionResult
            {
                result   = QMEventHandlerTypes.Intercept,
                SendFlag = true
            };
            SendText sendText = new SendText();

            sendText.SendID = e.FromGroup.Id;
            result.SendObject.Add(sendText);

            bool exist = SQLHelper.IDExist(e);

            if (!exist)
            {
                SQLHelper.Register(e);
                Random rd      = new Random();
                int    diamond = SQLHelper.GetDiamond(e);
                sendText.MsgToSend.Add(PublicArgs.register.Replace("<@>", $"[@{e.FromQQ.Id}]")
                                       .Replace("<#>", diamond.ToString()));
            }
            else
            {
                sendText.MsgToSend.Add(PublicArgs.mutiRegister.Replace("<@>", $"[@{e.FromQQ.Id}]"));
            }
            return(result);
        }
Пример #3
0
 public QQMessage(QMGroupMessageEventArgs e)
 {
     QQ          = e.FromQQ.Id;
     Group       = e.FromGroup.Id;
     MessageID   = e.Message.Id;
     MessageText = e.Message.Text;
     RobotQQ     = e.RobotQQ.Id;
 }
Пример #4
0
        public FunctionResult Progress(QMGroupMessageEventArgs e)
        {
            FunctionResult result = new FunctionResult
            {
                result   = QMEventHandlerTypes.Intercept,
                SendFlag = true
            };
            SendText sendText = new SendText();

            sendText.SendID = e.FromGroup.Id; result.SendObject.Add(sendText);

            int count = Convert.ToInt32(Save.AppConfig.Object[e.FromGroup.Id.ToString()]["Count"]
                                        .GetValueOrDefault("0"));

            if (!Helper.CheckAdmin(e))
            {
                sendText.MsgToSend.Add("氪金的权利掌握在管理员手里[Face178.gif]");
                return(result);
            }
            string[] temp = e.Message.Text.Split(' ');
            if (temp.Length != 3)
            {
                sendText.MsgToSend.Add($"[@{e.FromQQ.Id}] 输入的格式不正确!" +
                                       $"请按照 #氪金 目标QQ号或者at目标 数量 的格式填写");
                return(result);
            }
            else
            {
                try
                {
                    long targetId = Convert.ToInt64(temp[1].Replace("[@", "").Replace("]", ""));
                    int  countdia = Convert.ToInt32(temp[2]);
                    try
                    {
                        if (!SQLHelper.IDExist(e.FromGroup.Id, targetId))
                        {
                            sendText.MsgToSend.Add("操作对象不存在");
                            return(result);
                        }
                        SQLHelper.AddDiamond(e.FromGroup.Id, targetId, countdia);
                        sendText.MsgToSend.Add($"操作成功,为[@{targetId}]充值{countdia}水晶" +
                                               $",剩余{SQLHelper.GetDiamond(e.FromGroup.Id, targetId)}水晶");
                        return(result);
                    }
                    catch
                    {
                        sendText.MsgToSend.Add("操作失败了……");
                        return(result);
                    }
                }
                catch
                {
                    sendText.MsgToSend.Add($"[@{e.FromQQ.Id}] 输入的格式不正确!" +
                                           $"请按照格式输入纯数字");
                    return(result);
                }
            }
        }
Пример #5
0
        public FunctionResult Progress(QMGroupMessageEventArgs e)
        {
            FunctionResult result = new FunctionResult
            {
                result   = QMEventHandlerTypes.Intercept,
                SendFlag = true
            };
            SendText sendText = new SendText();

            sendText.SendID = e.FromGroup.Id; result.SendObject.Add(sendText);

            int count = Convert.ToInt32(Save.AppConfig.Object[e.FromGroup.Id.ToString()]["Count"]
                                        .GetValueOrDefault("0"));

            if (Helper.CheckAdmin(e))
            {
                count = Convert.ToInt32(Save.AppConfig.Object["群控"]["Count"].GetValueOrDefault("0"));

                if (!Helper.GroupInConfig(e))
                {
                    sendText.MsgToSend.Add($"[@{e.FromQQ.Id}] 群:{e.FromGroup.Id}已经关闭了," +
                                           $"不需要重复关闭");
                    return(result);
                }
                else
                {
                    List <long> grouplist = new List <long>();
                    for (int i = 0; i < count; i++)
                    {
                        long groupid = Convert.ToInt64(Save.AppConfig.Object["群控"][$"Item{i}"]
                                                       .GetValueOrDefault("0"));
                        if (groupid == e.FromGroup.Id)
                        {
                            continue;
                        }
                        grouplist.Add(groupid);
                    }
                    Save.AppConfig.Object["群控"][$"Count"] = new IValue((count - 1).ToString());
                    for (int i = 0; i < grouplist.Count; i++)
                    {
                        Save.AppConfig.Object["群控"][$"Item{i}"] = new IValue(grouplist[i].ToString());
                    }
                    Save.AppConfig.Save();
                    sendText.MsgToSend.Add($"[@{e.FromQQ.Id}] 群:{e.FromGroup.Id}已关闭");
                }
            }
            else
            {
                sendText.MsgToSend.Add($"[@{e.FromQQ.Id}]权限不足,拒绝操作");
            }
            return(result);
        }
Пример #6
0
        public FunctionResult Progress(QMGroupMessageEventArgs e)
        {
            FunctionResult result = new FunctionResult
            {
                result   = QMEventHandlerTypes.Intercept,
                SendFlag = true
            };
            SendText sendText = new SendText();

            sendText.SendID = e.FromGroup.Id; result.SendObject.Add(sendText);
            sendText.MsgToSend.Add(PublicArgs.help.Replace("\\n", "\n"));
            return(result);
        }
Пример #7
0
        public FunctionResult Progress(QMGroupMessageEventArgs e)
        {
            FunctionResult result = new FunctionResult
            {
                result   = QMEventHandlerTypes.Intercept,
                SendFlag = true
            };
            SendText sendText = new SendText();

            sendText.SendID = e.FromGroup.Id; result.SendObject.Add(sendText);
            sendText.MsgToSend.Add(BH3rdGacha.Rank.WeekRank.GetWeekRank(e));
            return(result);
        }
Пример #8
0
        /// <summary>
        /// 查询群是否在配置中
        /// </summary>
        /// <param name="e"></param>
        /// <returns></returns>
        public static bool GroupInConfig(QMGroupMessageEventArgs e)
        {
            int count = Convert.ToInt32(Save.AppConfig.Object["群控"]["Count"].GetValueOrDefault("0"));

            for (int i = 0; i < count; i++)
            {
                if (e.FromGroup.Id == Save.AppConfig.Object["群控"][$"Item{i}"].GetValueOrDefault((long)0))
                {
                    return(true);
                }
            }
            return(false);
        }
Пример #9
0
        public FunctionResult Progress(QMGroupMessageEventArgs e)
        {
            FunctionResult result = new FunctionResult
            {
                result   = QMEventHandlerTypes.Intercept,
                SendFlag = true
            };
            SendText sendText = new SendText();

            sendText.SendID = e.FromGroup.Id; result.SendObject.Add(sendText);

            bool exist = SQLHelper.IDExist(e);

            if (!exist)
            {
                sendText.MsgToSend.Add(PublicArgs.noReg.Replace("<@>", $"[@{e.FromQQ.Id}]"));
                return(result);
            }
            int diamond = SQLHelper.GetDiamond(e);

            if (diamond < 280)
            {
                sendText.MsgToSend.Add(PublicArgs.lowDiamond.Replace("<@>", $"[@{e.FromQQ.Id}]")
                                       .Replace("<#>", diamond.ToString()));
                return(result);
            }
            QMApi.CurrentApi.SendGroupMessage(e.RobotQQ, e.FromGroup, PublicArgs.JZA1
                                              .Replace("<@>", $"[@{e.FromQQ.Id}]").Replace("<#>", diamond.ToString()));
            List <GachaResult> ls = new List <GachaResult>
            {
                MainGacha.BP_GachaMain(),
                               MainGacha.BP_GachaSub()
            };

            SQLHelper.AddItem2Repositories(ls, e);
            CombinePng cp = new CombinePng();

            SQLHelper.SubDiamond(e, 280);
            SQLHelper.AddCount_Gacha(e, 1);

            IniConfig ini = new IniConfig($@"{MainSave.AppDirectory}概率\标配概率.txt");

            ini.Load();
            sendText.MsgToSend.Add(ini.Object["详情"]["ResultAt"].GetValueOrDefault("0") == "1"
                ? $"[@{e.FromQQ.Id}]" : ""
                                   + Save.AppConfig.Object["ExtraConfig"]["TextGacha"].GetValueOrDefault("0") == "1"
                ? Helper.TextGacha(ls) : $"[pic=" +
                                   $"{cp.MakePic(ls, PublicArgs.PoolName.标配, diamond - 280, e.FromQQ.Id, e.FromGroup.Id)}]");
            return(result);
        }
Пример #10
0
 public static string GetWeekRank(QMGroupMessageEventArgs e)
 {
     try
     {
         var cn = SqliteHelper.GetConnection();
         var sb = GetWeekRankText(cn, e);
         SqliteHelper.CloseConnection(cn);
         return(sb.ToString());
     }
     catch (Exception exc)
     {
         string str = "获取出错,错误信息见日志";
         QMLog.CurrentApi.Info($"抽卡周榜,获取出错,错误信息:{exc.Message} 在 {exc.StackTrace}");
         return(str);
     }
 }
Пример #11
0
        public FunctionResult Progress(QMGroupMessageEventArgs e)
        {
            FunctionResult result = new FunctionResult
            {
                result   = QMEventHandlerTypes.Intercept,
                SendFlag = true
            };
            SendText sendText = new SendText();

            sendText.SendID = e.FromGroup.Id; result.SendObject.Add(sendText);

            sendText.MsgToSend.Add($"当前扩充池为 {Texts.Text_UpS} {Texts.Text_UpA}\n" +
                                   $"当前精准A池为 {Texts.Text_UpAWeapon} {Texts.Text_UpAStigmata}\n" +
                                   $"当前精准B池为 {Texts.Text_UpBWeapon} {Texts.Text_UpBStigmata}");
            return(result);
        }
        /// <summary>
        /// 按照抽卡结果生成图片
        /// </summary>
        /// <param name="count">抽卡次数</param>
        /// <returns></returns>
        public static string GetPicPath(int count, PoolInfo poolInfo, QMGroupMessageEventArgs e)
        {
            List <PoolContent> ls = new List <PoolContent>();

            for (int i = 0; i < count; i++)
            {
                var item = poolInfo.PoolContents[RandomGacha(poolInfo)];
                ls = FoldItem(item, ls);
            }
            SQLHelper.SubDiamond(e, poolInfo.PerGachaConsumption * count);
            PicHelper combine = new PicHelper();

            ls = ls.OrderByDescending(x => x.Value).ToList();
            string CQAt = poolInfo.ResultAt ? $"[@{e.FromQQ.Id}]" : string.Empty;

            return(CQAt + combine.GeneratePic(poolInfo, ls, SQLHelper.GetDiamond(e)));
        }
Пример #13
0
 public static string GetRank(QMGroupMessageEventArgs e)
 {
     try
     {
         var           cn  = SqliteHelper.GetConnection();
         StringBuilder str = GetDiamondRank(cn, e);
         str.Append(GetGachaRank(cn, e));
         SqliteHelper.CloseConnection(cn);
         return(str.ToString());
     }
     catch (Exception exc)
     {
         string str = "获取出错,错误信息见日志";
         QMLog.CurrentApi.Info($"抽卡排行榜,获取出错,错误信息:{exc.Message} 在 {exc.StackTrace}");
         return(str);
     }
 }
Пример #14
0
        public FunctionResult Progress(QMGroupMessageEventArgs e)
        {
            FunctionResult result = new FunctionResult
            {
                result   = QMEventHandlerTypes.Intercept,
                SendFlag = true
            };
            SendText sendText = new SendText();

            sendText.SendID = e.FromGroup.Id; result.SendObject.Add(sendText);

            if (Helper.CheckAdmin(e))
            {
                sendText.MsgToSend.Add(DoChange());
            }
            else
            {
                sendText.MsgToSend.Add("权限不足,拒绝操作");
            }
            return(result);
        }
Пример #15
0
        /// <summary>
        /// 获取抽卡排行榜
        /// </summary>
        /// <param name="cn"></param>
        /// <param name="e"></param>
        /// <returns></returns>
        public static StringBuilder GetGachaRank(SQLiteConnection cn, QMGroupMessageEventArgs e)
        {
            long          groupid = e.FromGroup.Id;
            StringBuilder sb      = new StringBuilder();

            sb.AppendLine($"----出货率排行榜----");
            SQLiteCommand cmd = new SQLiteCommand($"select 1.0*purple_count/gacha_count,qq,gacha_count from UserData where fromgroup={groupid} and 1.0*purple_count/gacha_count is not null order by 1.0*purple_count/gacha_count desc", cn);

            using (SQLiteDataReader sr = cmd.ExecuteReader())
            {
                int count = 1;
                if (!sr.HasRows)
                {
                    return(sb);
                }
                while (sr.Read())
                {
                    string diamond = (sr.GetDouble(0) * 100).ToString("0.000");
                    //string cqcode = CQApi.CQCode_At(sr.GetInt64(1)).ToSendString();
                    try
                    {
                        //var temp = e.FromGroup.GetGroupMemberInfo(sr.GetInt64(1));
                        //string name = temp.Card == "" ? temp.Nick : temp.Card;
                        int gacha_count = sr.GetInt32(2);
                        sb.AppendLine($"{count}. {sr.GetInt64(1)} 共抽卡{gacha_count}次 综合出货率{diamond}%");
                    }
                    catch
                    {
                        int gacha_count = sr.GetInt32(2);
                        sb.AppendLine($"{count}. {sr.GetInt32(1)} 共抽卡{gacha_count}次 综合出货率{diamond}%");
                    }
                    if (count == 10)
                    {
                        break;
                    }
                    count++;
                }
            }
            return(sb);
        }
Пример #16
0
        public static FunctionResult GroupMessage(QMGroupMessageEventArgs e)
        {
            FunctionResult result = new FunctionResult()
            {
                SendFlag = false
            };

            try
            {
                foreach (var item in MainSave.Instances.Where(item => item.Judge(e.Message.Text)))
                {
                    return(item.Progress(e));
                }

                return(result);
            }
            catch (Exception exc)
            {
                QMLog.CurrentApi.Info(exc.Message + exc.StackTrace);
                return(result);
            }
        }
Пример #17
0
        /// <summary>
        /// 获取水晶相关排行榜
        /// </summary>
        /// <param name="cn"></param>
        /// <param name="e"></param>
        /// <returns></returns>
        public static StringBuilder GetDiamondRank(SQLiteConnection cn, QMGroupMessageEventArgs e)
        {
            long          groupid = e.FromGroup.Id;
            StringBuilder sb      = new StringBuilder();

            sb.AppendLine($"----水晶排行榜----");
            SQLiteCommand cmd = new SQLiteCommand($"SELECT diamond,qq,sign_count FROM UserData WHERE Fromgroup={groupid} order by diamond desc", cn);

            using (SQLiteDataReader sr = cmd.ExecuteReader())
            {
                int count = 1;
                if (!sr.HasRows)
                {
                    return(sb);
                }
                while (sr.Read())
                {
                    int diamond = sr.GetInt32(0);
                    try
                    {
                        //var temp = e.FromGroup.GetGroupMemberInfo(sr.GetInt64(1));
                        //string name = temp.Card ==""? temp.Nick:temp.Card;
                        int sign_count = sr.GetInt32(2);
                        sb.AppendLine($"{count}. {sr.GetInt64(1)}->{diamond}水 共计签到{sign_count}次");
                    }
                    catch
                    {
                        int sign_count = sr.GetInt32(2);
                        sb.AppendLine($"{count}. [@{sr.GetInt64(1)}]->{diamond}水 共计签到{sign_count}次");
                    }
                    if (count == 10)
                    {
                        break;
                    }
                    count++;
                }
            }
            return(sb);
        }
Пример #18
0
        public override QMEventHandlerTypes OnReceiveGroupMessage(QMGroupMessageEventArgs e)
        {
            if (!LastMessages.ContainsKey(e.FromGroup.Id))
            {
                LastMessages.Add(e.FromGroup.Id, new Tuple <long, string>(e.FromQQ.Id, e.Message.Text));
            }
            else
            {
                LastMessages[e.FromGroup.Id] = new Tuple <long, string>(e.FromQQ.Id, e.Message.Text);
            }

            if (!MessageSenders.ContainsKey(e.FromGroup.Id))
            {
                MessageSenders[e.FromGroup.Id] = new HashSet <long>();
            }

            MessageSenders[e.FromGroup.Id].Add(e.FromQQ.Id);

            if (!RepeatedMessages.ContainsKey(e.FromGroup.Id))
            {
                RepeatedMessages.Add(e.FromGroup.Id, null);
            }

            if (RepeatedMessages[e.FromGroup.Id] != null && e.Message.Text == RepeatedMessages[e.FromGroup.Id])
            {
                MessageSenders[e.FromGroup.Id].Clear();
                return(QMEventHandlerTypes.Continue);
            }

            if (MessageSenders[e.FromGroup.Id].Count >= 3)
            {
                QMApi.SendGroupMessage(e.RobotQQ, e.FromGroup, e.Message.Text);
                RepeatedMessages[e.FromGroup.Id] = e.Message.Text;
                MessageSenders[e.FromGroup.Id].Clear();
            }

            return(QMEventHandlerTypes.Continue);
        }
Пример #19
0
        public FunctionResult Progress(QMGroupMessageEventArgs e)
        {
            FunctionResult result = new FunctionResult
            {
                result   = QMEventHandlerTypes.Intercept,
                SendFlag = true
            };
            SendText sendText = new SendText();

            sendText.SendID = e.FromGroup.Id;
            result.SendObject.Add(sendText);
            if (!File.Exists(Path.Combine(MainSave.AppDirectory, "CustomPool", "pool.json")))
            {
                result.SendFlag = false;
                result.result   = QMEventHandlerTypes.Continue;
                return(result);
            }
            CustomPool.CustomPool pool = JsonConvert.DeserializeObject <CustomPool.CustomPool>
                                             (File.ReadAllText(Path.Combine(MainSave.AppDirectory, "CustomPool", "pool.json")));
            foreach (var item in pool.Infos)
            {
                if (e.Message.Text == item.OneOrder)
                {
                    if (CustomGachaHelper.CanGacha(e, item, 1))
                    {
                        sendText.MsgToSend.Add(CustomGachaHelper.GetPicPath(1, item, e));
                    }
                }
                else if (e.Message.Text == item.TenOrder)
                {
                    if (CustomGachaHelper.CanGacha(e, item, 10))
                    {
                        sendText.MsgToSend.Add(CustomGachaHelper.GetPicPath(10, item, e));
                    }
                }
            }
            return(result);
        }
Пример #20
0
        public override QMEventHandlerTypes OnReceiveGroupMessage(QMGroupMessageEventArgs e)
        {
            if (MainSave.AppConfig.Object["接口"]["Group"].GetValueOrDefault(0) is 0)
            {
                bool flag = false;
                for (int i = 0; i < MainSave.AppConfig.Object["群控"]["Count"].GetValueOrDefault(0); i++)
                {
                    if (e.FromGroup.Id == MainSave.AppConfig.Object["群控"][$"Item{i}"].GetValueOrDefault(0))
                    {
                        flag = true;
                        break;
                    }
                }
                if (flag is false)
                {
                    return(QMEventHandlerTypes.Continue);
                }
            }
            FunctionResult result = Event_GroupMessage.GroupMessage(e);

            if (result.SendFlag)
            {
                if (result.SendObject == null)
                {
                    return(QMEventHandlerTypes.Continue);
                }
                foreach (var item in result.SendObject)
                {
                    Group DestGroup = new Group(item.SendID);
                    foreach (var sendMsg in item.MsgToSend)
                    {
                        QMApi.SendGroupMessage(e.RobotQQ, DestGroup, sendMsg);
                    }
                }
            }
            return(result.result);
        }
Пример #21
0
        public FunctionResult Progress(QMGroupMessageEventArgs e)
        {
            FunctionResult result = new FunctionResult
            {
                result   = QMEventHandlerTypes.Intercept,
                SendFlag = true
            };
            SendText sendText = new SendText();

            sendText.SendID = e.FromGroup.Id; result.SendObject.Add(sendText);

            if (Helper.CheckAdmin(e))
            {
                string option = e.Message.Text.Substring("#更换池子".Length).Trim();
                if (option == "扩充" && Save.AppConfig.Object["OCR"]["app_id"].GetValueOrDefault("") == "")
                {
                    sendText.MsgToSend.Add("参数缺失,请按照日志提示补全参数");
                    QMLog.CurrentApi.Info($"参数缺失,请到插件数据 Config.ini 下OCR字段填写App_id与App_key。若没有可到插件论坛页面按照提示获取.");
                    return(result);
                }
                sendText.MsgToSend.Add("获取中……请耐心等待");
                string str = new PaChonger().GetPoolOnline(option);
                if (string.IsNullOrEmpty(str))
                {
                    str = "查无此池";
                }
                else
                {
                    str += "立刻更改请回复#now";
                }
            }
            else
            {
                sendText.MsgToSend.Add("权限不足,拒绝操作");
            }
            return(result);
        }
        /// <summary>
        /// 判断能否抽卡,并发送一定的自定义信息
        /// </summary>
        /// <param name="e"></param>
        /// <param name="poolInfo"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        public static bool CanGacha(QMGroupMessageEventArgs e, PoolInfo poolInfo, int count)
        {
            if (!Helper.GroupInConfig(e))
            {
                return(false);
            }
            if (!SQLHelper.IDExist(e))
            {
                QMApi.CurrentApi.SendGroupMessage(e.RobotQQ, e.FromGroup, PublicArgs.noReg.Replace
                                                      ("<@>", $"[@{e.FromQQ.Id}]"));
                return(false);
            }
            int diamond = SQLHelper.GetDiamond(e);

            if (diamond < count * poolInfo.PerGachaConsumption)
            {
                QMApi.CurrentApi.SendGroupMessage(e.RobotQQ, e.FromGroup, PublicArgs.lowDiamond.Replace
                                                      ("<@>", $"[@{e.FromQQ.Id}]").Replace("<#>", diamond.ToString()));
                return(false);
            }
            QMApi.CurrentApi.SendGroupMessage(e.RobotQQ, e.FromGroup, PublicArgs.BP10.Replace
                                                  ("<@>", $"[@{e.FromQQ.Id}]"));
            return(true);
        }
Пример #23
0
        public FunctionResult Progress(QMGroupMessageEventArgs e)
        {
            FunctionResult result = new FunctionResult
            {
                result   = QMEventHandlerTypes.Intercept,
                SendFlag = true
            };
            SendText sendText = new SendText();

            sendText.SendID = e.FromGroup.Id; result.SendObject.Add(sendText);

            bool exist = SQLHelper.IDExist(e);

            if (!exist)
            {
                sendText.MsgToSend.Add(PublicArgs.noReg.Replace("<@>", $"[@{e.FromQQ.Id}]"));
                return(result);
            }

            int diamond = SQLHelper.Sign(e);

            SQLHelper.AddCount_Sign(e, 1);
            if (diamond >= 0)
            {
                sendText.MsgToSend.Add(PublicArgs.sign1.Replace("<@>", $"[@{e.FromQQ.Id}]")
                                       .Replace("<#>", diamond.ToString()));
                sendText.MsgToSend.Add(PublicArgs.sign2.Replace("<@>", $"[@{e.FromQQ.Id}]")
                                       .Replace("<#>", diamond.ToString()));
            }
            else
            {
                sendText.MsgToSend.Add(PublicArgs.mutiSign.Replace("<@>", $"[@{e.FromQQ.Id}]")
                                       .Replace("<#>", diamond.ToString()));
            }
            return(result);
        }
Пример #24
0
        /// <summary>
        /// 群消息
        /// </summary>
        /// <param name="e"></param>
        /// <returns></returns>
        public override QMEventHandlerTypes OnReceiveGroupMessage(QMGroupMessageEventArgs e)
        {
            //QMApi.SendGroupMessage(e.RobotQQ, e.FromGroup, e.Message);

            return(QMEventHandlerTypes.Intercept);    // 返回继续执行时, 后续的插件将会接收到此消息
        }
Пример #25
0
 public static void SignReset(QMGroupMessageEventArgs e)
 {
     SignReset(e.FromGroup.Id);
 }
Пример #26
0
 public static void Register(QMGroupMessageEventArgs e)
 {
     Register(e.FromGroup, e.FromQQ);
 }
Пример #27
0
 public static bool CheckAdmin(QMGroupMessageEventArgs e)
 {
     return(CheckAdmin(e.FromGroup.Id, e.FromQQ.Id));
 }
Пример #28
0
        public FunctionResult Progress(QMGroupMessageEventArgs e)
        {
            FunctionResult result = new FunctionResult
            {
                SendFlag = true,
                result   = QMEventHandlerTypes.Intercept,
            };
            SendText sendText = new SendText();

            sendText.SendID = e.FromGroup.Id;
            result.SendObject.Add(sendText);
            bool exist = SQLHelper.IDExist(e);

            if (!exist)
            {
                sendText.MsgToSend.Add(PublicArgs.noReg.Replace("<@>", $"[@{e.FromQQ.Id}]"));
                return(result);
            }
            int diamond = SQLHelper.GetDiamond(e);

            if (diamond < 2800)
            {
                sendText.MsgToSend.Add(PublicArgs.lowDiamond.Replace("<@>", $"[@{e.FromQQ.Id}]")
                                       .Replace("<#>", diamond.ToString()));
                return(result);
            }
            QMApi.CurrentApi.SendGroupMessage(e.RobotQQ, e.FromGroup, PublicArgs.KC10
                                              .Replace("<@>", $"[@{e.FromQQ.Id}]").Replace("<#>", diamond.ToString()));

            List <GachaResult> ls = new List <GachaResult>();

            for (int i = 0; i < 10; i++)
            {
                ls.Add(MainGacha.KC_Gacha());
                ls.Add(MainGacha.KC_GachaSub());
            }
            ls = ls.OrderByDescending(x => x.value).ToList();

            for (int i = 0; i < ls.Count; i++)
            {
                for (int j = i + 1; j < ls.Count; j++)
                {
                    if (ls[i].name == ls[j].name && ls[i].type != PublicArgs.TypeS.Character.ToString())
                    {
                        ls[i].count += ls[j].count;
                        ls.RemoveAt(j);
                        i--; j--;
                        if (i == -1)
                        {
                            i = 0;
                        }
                    }
                }
            }
            SQLHelper.AddItem2Repositories(ls, e);
            CombinePng cp = new CombinePng();

            SQLHelper.SubDiamond(e, 2800);
            SQLHelper.AddCount_Gacha(e, 10);
            IniConfig ini = new IniConfig($@"{MainSave.AppDirectory}概率\扩充概率.txt");

            ini.Load();
            sendText.MsgToSend.Add(ini.Object["详情"]["ResultAt"].GetValueOrDefault("0") == "1"
                    ? $"[@{e.FromQQ.Id}]" : ""
                                   + Save.AppConfig.Object["ExtraConfig"]["TextGacha"].GetValueOrDefault("0") == "1"
                    ? Helper.TextGacha(ls) : $"[pic=" +
                                   $"{cp.MakePic(ls, PublicArgs.PoolName.扩充,  diamond - 2800, e.FromQQ.Id, e.FromGroup.Id)}]");
            return(result);
        }
Пример #29
0
 /// <summary>
 /// 当收到群组消息
 /// </summary>
 /// <param name="e"></param>
 /// <returns></returns>
 public override QMEventHandlerTypes OnReceiveGroupMessage(QMGroupMessageEventArgs e)
 {
     OnReceiveMessage(new QQMessage(e));
     return(QMEventHandlerTypes.Continue);
 }
Пример #30
0
        public FunctionResult Progress(QMGroupMessageEventArgs e)
        {
            FunctionResult result = new FunctionResult
            {
                result   = QMEventHandlerTypes.Intercept,
                SendFlag = true
            };
            SendText sendText = new SendText();

            sendText.SendID = e.FromGroup.Id; result.SendObject.Add(sendText);

            int count = Convert.ToInt32(Save.AppConfig.Object[e.FromGroup.Id.ToString()]["Count"]
                                        .GetValueOrDefault("0"));
            bool InGroup = false;

            for (int i = 0; i < count; i++)
            {
                if (Save.AppConfig.Object[e.FromGroup.Id.ToString()][$"Index{i}"].GetValueOrDefault("0")
                    == e.FromQQ.Id.ToString())
                {
                    InGroup = true;
                    break;
                }
            }
            if (InGroup)
            {
                SQLHelper.SignReset(e);
                Random rd = new Random();
                switch (rd.Next(0, 6))
                {
                case 0:
                    sendText.MsgToSend.Add(PublicArgs.reset1.Replace("<@>", $"[@{e.FromQQ.Id}]"));
                    break;

                case 1:
                    sendText.MsgToSend.Add(PublicArgs.reset2.Replace("<@>", $"[@{e.FromQQ.Id}]"));
                    break;

                case 2:
                    sendText.MsgToSend.Add(PublicArgs.reset3.Replace("<@>", $"[@{e.FromQQ.Id}]"));
                    break;

                case 3:
                    sendText.MsgToSend.Add(PublicArgs.reset4.Replace("<@>", $"[@{e.FromQQ.Id}]"));
                    break;

                case 4:
                    sendText.MsgToSend.Add(PublicArgs.reset5.Replace("<@>", $"[@{e.FromQQ.Id}]"));
                    break;

                case 5:
                    sendText.MsgToSend.Add(PublicArgs.reset6.Replace("<@>", $"[@{e.FromQQ.Id}]"));
                    break;
                }
            }
            else
            {
                sendText.MsgToSend.Add("只有管♂理员才能这么做");
            }
            return(result);
        }