Example #1
0
        void ReadConfig(CQGroupMessageEventArgs e)
        {
            string path = $@"{cq.CQApi.AppDirectory}Config.ini";

            order_KC1          = INIhelper.IniRead("Order", "KC1", "#扩充单抽", path);
            order_KC10         = INIhelper.IniRead("Order", "KC10", "#扩充十连", path);
            order_JZ1          = INIhelper.IniRead("Order", "JZ1", "#精准单抽", path);
            order_JZ10         = INIhelper.IniRead("Order", "JZ10", "#精准十连", path);
            order_register     = INIhelper.IniRead("Order", "Register", "#抽卡注册", path);
            order_sign         = INIhelper.IniRead("Order", "Sign", "#打扫甲板", path);
            order_signreset    = INIhelper.IniRead("Order", "SignReset", "#甲板积灰", path);
            order_querydiamond = INIhelper.IniRead("Order", "QueryDiamond", "#我的水晶", path);
            order_help         = INIhelper.IniRead("Order", "Help", "#抽卡帮助", path);
            order_getpool      = INIhelper.IniRead("Order", "GetPool", "#获取池子", path);

            KC1          = INIhelper.IniRead("Answer", "KC1", "少女祈祷中……", path);
            KC10         = INIhelper.IniRead("Answer", "KC10", "少女祈祷中……", path);
            JZ1          = INIhelper.IniRead("Answer", "JZ1", "少女祈祷中……", path);
            JZ10         = INIhelper.IniRead("Answer", "JZ10", "少女祈祷中……", path);
            register     = INIhelper.IniRead("Answer", "Register", "<@>欢迎上舰,这是你的初始资源(<#>)水晶", path);
            mutiRegister = INIhelper.IniRead("Answer", "MutiRegister", "重复注册是不行的哦", path);
            sign1        = INIhelper.IniRead("Answer", "Sign1", "大姐你回来了,天气这么好一起多逛逛吧", path);
            sign2        = INIhelper.IniRead("Answer", "Sign2", "<@>这是你今天清扫甲板的报酬,拿好(<#>水晶)", path);
            mutiSign     = INIhelper.IniRead("Answer", "MutiSign", "今天的甲板挺亮的,擦一遍就行了", path);
            noReg        = INIhelper.IniRead("Answer", "NoReg", "<@>不是清洁工吧?来输入#抽卡注册 来上舰", path);
            lowDiamond   = INIhelper.IniRead("Answer", "LowDiamond", "<@>水晶不足,无法进行抽卡,你还剩余<#>水晶", path);
            queryDiamond = INIhelper.IniRead("Answer", "QueryDiamond", "<@>你手头还有<#>水晶", path);
            IniObject iObject = IniObject.Load(path, Encoding.Default);     // 从指定的文件中读取 Ini 配置项, 参数1: 文件路径, 参数2: 编码格式 [默认: ANSI]

            try
            {
                IniValue value1 = iObject["Answer"]["Help"];
                help = value1.ToString().Replace("\\", @"\");
            }
            catch
            {
                help = "";
            }
            if (help == "")
            {
                help = "水银抽卡人 给你抽卡的自信(~ ̄▽ ̄)~ \n合成图片以及发送图片需要一些时间,请耐心等待\n单抽是没有保底的\n#抽卡注册\n#我的水晶\n#打扫甲板(签到)\n#甲板积灰(重置签到,管理员限定)\n\n#精准单抽\n#扩充单抽\n#精准十连\n#扩充十连";
            }
            reset1 = INIhelper.IniRead("Answer", "Reset1", "贝贝龙来甲板找女王♂van,把甲板弄脏了,大家又得打扫一遍", path);
            reset2 = INIhelper.IniRead("Answer", "Reset2", "草履虫非要给鸭子做饭,厨房爆炸了,黑紫色的东西撒了一甲板,把甲板弄脏了,大家又得打扫一遍", path);
            reset3 = INIhelper.IniRead("Answer", "Reset3", "你和女武神们被从深渊扔了回来,来自深渊的炉灰把甲板弄脏了,大家又得打扫一遍", path);
            reset4 = INIhelper.IniRead("Answer", "Reset4", "由于神秘东方村庄的诅咒,你抽卡的泪水把甲板弄脏了,大家又得打扫一遍", path);
            reset5 = INIhelper.IniRead("Answer", "Reset5", "理律疯狂在甲板上逮虾户,把甲板弄脏了,大家又得打扫一遍", path);
            reset6 = INIhelper.IniRead("Answer", "Reset6", "希儿到处找不到鸭子,里人格暴走,把甲板弄脏了,大家又得打扫一遍", path);

            registermin = Convert.ToInt32(INIhelper.IniRead("GetDiamond", "RegisterMin", "0", path));
            registermax = Convert.ToInt32(INIhelper.IniRead("GetDiamond", "RegisterMax", "14000", path));
            signmin     = Convert.ToInt32(INIhelper.IniRead("GetDiamond", "SignMin", "0", path));
            signmax     = Convert.ToInt32(INIhelper.IniRead("GetDiamond", "SignMax", "14000", path));
        }
Example #2
0
        bool GroupInini()
        {
            int count = Convert.ToInt32(INIhelper.IniRead("群控", "Count", "0", cq.CQApi.AppDirectory + "\\Config.ini"));

            for (int i = 0; i < count; i++)
            {
                if (cq.FromGroup.Id == Convert.ToInt64(INIhelper.IniRead("群控", $"Item{i}", "0", cq.CQApi.AppDirectory + "\\Config.ini")))
                {
                    return(true);
                }
            }
            return(false);
        }
Example #3
0
        void ReadConfig()
        {
            string path = $@"{cq.CQApi.AppDirectory}Config.ini";

            order_KC1          = INIhelper.IniRead("Order", "KC1", "#扩充单抽", path);
            order_KC10         = INIhelper.IniRead("Order", "KC10", "#扩充十连", path);
            order_JZ1          = INIhelper.IniRead("Order", "JZ1", "#精准单抽", path);
            order_JZ10         = INIhelper.IniRead("Order", "JZ10", "#精准十连", path);
            order_register     = INIhelper.IniRead("Order", "Register", "#抽卡注册", path);
            order_sign         = INIhelper.IniRead("Order", "Sign", "#打扫甲板", path);
            order_signreset    = INIhelper.IniRead("Order", "SignReset", "#甲板积灰", path);
            order_querydiamond = INIhelper.IniRead("Order", "QueryDiamond", "#我的水晶", path);
            order_help         = INIhelper.IniRead("Order", "Help", "#抽卡帮助", path);
            order_getpool      = INIhelper.IniRead("Order", "GetPool", "#获取池子", path);

            KC1          = INIhelper.IniRead("Answer", "KC1", "少女祈祷中……", path);
            KC10         = INIhelper.IniRead("Answer", "KC10", "少女祈祷中……", path);
            JZ1          = INIhelper.IniRead("Answer", "JZ1", "少女祈祷中……", path);
            JZ10         = INIhelper.IniRead("Answer", "JZ10", "少女祈祷中……", path);
            register     = INIhelper.IniRead("Answer", "Register", "<@>欢迎上舰,这是你的初始资源(<#>)水晶", path);
            sign1        = INIhelper.IniRead("Answer", "Sign1", "大姐你回来了,天气这么好一起多逛逛吧", path);
            sign2        = INIhelper.IniRead("Answer", "Sign2", "<@>这是你今天清扫甲板的报酬,拿好(<#>水晶)", path);
            querydiamond = INIhelper.IniRead("Answer", "QueryDiamond", "<@>你手头还有<#>水晶", path);
            IniObject iObject = IniObject.Load(path, Encoding.Default);         // 从指定的文件中读取 Ini 配置项, 参数1: 文件路径, 参数2: 编码格式 [默认: ANSI]
            IniValue  value1  = iObject["Answer"]["Help"];

            help   = value1.ToString();
            reset1 = INIhelper.IniRead("Answer", "Reset1", "贝贝龙来甲板找女王♂van,把甲板弄脏了,大家又得打扫一遍", path);
            reset2 = INIhelper.IniRead("Answer", "Reset2", "草履虫非要给鸭子做饭,厨房爆炸了,黑紫色的东西撒了一甲板,把甲板弄脏了,大家又得打扫一遍", path);
            reset3 = INIhelper.IniRead("Answer", "Reset3", "你和女武神们被从深渊扔了回来,来自深渊的炉灰把甲板弄脏了,大家又得打扫一遍", path);
            reset4 = INIhelper.IniRead("Answer", "Reset4", "由于神秘东方村庄的诅咒,你抽卡的泪水把甲板弄脏了,大家又得打扫一遍", path);
            reset5 = INIhelper.IniRead("Answer", "Reset5", "理律疯狂在甲板上逮虾户,把甲板弄脏了,大家又得打扫一遍", path);
            reset6 = INIhelper.IniRead("Answer", "Reset6", "希儿到处找不到鸭子,里人格暴走,把甲板弄脏了,大家又得打扫一遍", path);

            registermin = Convert.ToInt32(INIhelper.IniRead("GetDiamond", "RegisterMin", "0", path));
            registermax = Convert.ToInt32(INIhelper.IniRead("GetDiamond", "RegisterMax", "14000", path));
            signmin     = Convert.ToInt32(INIhelper.IniRead("GetDiamond", "SignMin", "0", path));
            signmax     = Convert.ToInt32(INIhelper.IniRead("GetDiamond", "SignMax", "14000", path));
        }
Example #4
0
        public void PrivateMessage(object sender, CQPrivateMessageEventArgs e)
        {
            cq = e;
            CQSave.cq_private = e;
            if (INIhelper.IniRead("接口", "Private", "0", $"{e.CQApi.AppDirectory}Config.ini") == "0")
            {
                return;
            }
            bool exist = IDExist(e.FromQQ.Id);

            ReadConfig();
            UI.Gacha gc = new UI.Gacha();
            long     controlgroup = Convert.ToInt64(INIhelper.IniRead("后台群", "Id", "0", e.CQApi.AppDirectory + "\\Config.ini"));
            string   str = "", INIPath = CQSave.AppDirectory + "Config.ini";

            if (e.Message.Text.Replace(" ", "").Replace("#", "#") == order_KC1)
            {
                e.Handler = true;
                if (INIhelper.IniRead("ExrtaConfig", "SwitchKC1", "1", INIPath) == "0")
                {
                    return;
                }
                if (!exist)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, noReg.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                    return;
                }
                diamond = GetDiamond(e.FromQQ.Id);
                if (diamond < 280)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, lowDiamond.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                    return;
                }
                e.CQApi.SendPrivateMessage(e.FromQQ, KC1);
                gc.Read_Kuochong();
                List <UI.Gacha.GachaResult> ls = new List <UI.Gacha.GachaResult>
                {
                    gc.KC_Gacha(),
                                            gc.KC_GachaSub()
                };
                var tasksql = new Task(() =>
                {
                    AddItem2Repositories(ls, e);
                });
                tasksql.Start();
                CombinePng cp = new CombinePng();
                SubDiamond(cq.FromQQ.Id, 280);
                string path = $@"{cq.CQApi.AppDirectory}\概率\扩充概率.txt";
                if (INIhelper.IniRead("ExtraConfig", "TextGacha", "0", e.CQApi.AppDirectory + "\\Config.ini") == "1")
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, TextGacha(ls));
                }
                else
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, $"[CQ:image,file={cp.Gacha(ls, 0, 0, 1, diamond - 280)}]");
                }
                cp = null;
                GC.Collect();
                str = $"QQ:{e.FromQQ.Id} 申请了一个扩充单抽";
            }
            else if (e.Message.Text.Replace(" ", "").Replace("#", "#") == order_KC10)
            {
                e.Handler = true;
                if (INIhelper.IniRead("ExrtaConfig", "SwitchKC10", "1", INIPath) == "0")
                {
                    return;
                }

                if (!exist)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, noReg.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                    return;
                }
                diamond = GetDiamond(e.FromQQ.Id);
                if (diamond < 2800)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, lowDiamond.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                    return;
                }
                e.CQApi.SendPrivateMessage(e.FromQQ, KC10.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                gc.Read_Kuochong();
                List <UI.Gacha.GachaResult> ls = new List <UI.Gacha.GachaResult>();
                for (int i = 0; i < 10; i++)
                {
                    ls.Add(gc.KC_Gacha());
                    ls.Add(gc.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 != UI.Gacha.TypeS.Character.ToString())
                        {
                            ls[i].count += ls[j].count;
                            ls.RemoveAt(j);
                            i--; j--;
                            if (i == -1)
                            {
                                i = 0;
                            }
                        }
                    }
                }
                var tasksql = new Task(() =>
                {
                    AddItem2Repositories(ls, e);
                });
                tasksql.Start();
                CombinePng cp = new CombinePng();
                SubDiamond(cq.FromQQ.Id, 2800);
                string path = $@"{cq.CQApi.AppDirectory}\概率\扩充概率.txt";
                if (INIhelper.IniRead("ExtraConfig", "TextGacha", "0", e.CQApi.AppDirectory + "\\Config.ini") == "1")
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, TextGacha(ls));
                }
                else
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, $"[CQ:image,file={cp.Gacha(ls, 0, 0, 10, diamond - 2800)}]");
                }
                cp = null;
                GC.Collect();
                str = $"QQ:{e.FromQQ.Id} 申请了一个扩充十连";
            }
            else if (e.Message.Text.Replace(" ", "").Replace("#", "#").ToUpper() == order_JZA1)
            {
                e.Handler = true;
                if (INIhelper.IniRead("ExrtaConfig", "SwitchJZA1", "1", INIPath) == "0")
                {
                    return;
                }

                if (!exist)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, noReg.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                    return;
                }

                diamond = GetDiamond(e.FromQQ.Id);
                if (diamond < 280)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, lowDiamond.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                    return;
                }
                e.CQApi.SendPrivateMessage(e.FromQQ, JZA1.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                gc.Read_Jingzhun(1);
                List <UI.Gacha.GachaResult> ls = new List <UI.Gacha.GachaResult>
                {
                    gc.JZ_GachaMain(),
                                            gc.JZ_GachaMaterial()
                };
                var tasksql = new Task(() =>
                {
                    AddItem2Repositories(ls, e);
                });
                tasksql.Start();
                CombinePng cp = new CombinePng();
                SubDiamond(cq.FromQQ.Id, 280);
                string path = $@"{cq.CQApi.AppDirectory}\概率\精准概率.txt";
                if (INIhelper.IniRead("ExtraConfig", "TextGacha", "0", e.CQApi.AppDirectory + "\\Config.ini") == "1")
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, TextGacha(ls));
                }
                else
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, $"[CQ:image,file={cp.Gacha(ls, 1, 1, 1, diamond - 280)}]");
                }
                cp = null;
                GC.Collect();
                str = $"QQ:{e.FromQQ.Id} 申请了一个精准单抽";
            }
            else if (e.Message.Text.Replace(" ", "").Replace("#", "#").ToUpper() == order_JZA10)
            {
                e.Handler = true;
                if (INIhelper.IniRead("ExrtaConfig", "SwitchJZA10", "1", INIPath) == "0")
                {
                    return;
                }

                if (!exist)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, noReg.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                    return;
                }

                diamond = GetDiamond(e.FromQQ.Id);
                if (diamond < 2800)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, lowDiamond.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                    return;
                }
                e.CQApi.SendPrivateMessage(e.FromQQ, JZA10.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                gc.Read_Jingzhun(1);
                List <UI.Gacha.GachaResult> ls = new List <UI.Gacha.GachaResult>();
                for (int i = 0; i < 10; i++)
                {
                    ls.Add(gc.JZ_GachaMain());
                    ls.Add(gc.JZ_GachaMaterial());
                }
                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 != UI.Gacha.TypeS.Stigmata.ToString() && ls[i].type != UI.Gacha.TypeS.Weapon.ToString())
                        {
                            ls[i].count += ls[j].count;
                            ls.RemoveAt(j);
                            i--; j--;
                            if (i == -1)
                            {
                                i = 0;
                            }
                        }
                    }
                }
                var tasksql = new Task(() =>
                {
                    AddItem2Repositories(ls, e);
                });
                tasksql.Start();
                CombinePng cp = new CombinePng();
                SubDiamond(cq.FromQQ.Id, 2800);
                string path = $@"{cq.CQApi.AppDirectory}\概率\精准概率.txt";
                if (INIhelper.IniRead("ExtraConfig", "TextGacha", "0", e.CQApi.AppDirectory + "\\Config.ini") == "1")
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, TextGacha(ls));
                }
                else
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, $"[CQ:image,file={cp.Gacha(ls, 1, 1, 10, diamond - 2800)}]");
                }
                cp = null;
                GC.Collect();
                str = $"QQ:{e.FromQQ.Id} 申请了一个精准十连";
            }
            else if (e.Message.Text.Replace(" ", "").Replace("#", "#").ToUpper() == order_JZB1)
            {
                e.Handler = true;
                if (INIhelper.IniRead("ExrtaConfig", "SwitchJZB1", "1", INIPath) == "0")
                {
                    return;
                }

                if (!exist)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, noReg.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                    return;
                }

                diamond = GetDiamond(e.FromQQ.Id);
                if (diamond < 280)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, lowDiamond.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                    return;
                }
                e.CQApi.SendPrivateMessage(e.FromQQ, JZB1.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                gc.Read_Jingzhun(2);
                List <UI.Gacha.GachaResult> ls = new List <UI.Gacha.GachaResult>
                {
                    gc.JZ_GachaMain(),
                                            gc.JZ_GachaMaterial()
                };
                var tasksql = new Task(() =>
                {
                    AddItem2Repositories(ls, e);
                });
                tasksql.Start();
                CombinePng cp = new CombinePng();
                SubDiamond(cq.FromQQ.Id, 280);
                string path = $@"{cq.CQApi.AppDirectory}\概率\精准概率.txt";
                if (INIhelper.IniRead("ExtraConfig", "TextGacha", "0", e.CQApi.AppDirectory + "\\Config.ini") == "1")
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, TextGacha(ls));
                }
                else
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, $"[CQ:image,file={cp.Gacha(ls, 1, 2, 1, diamond - 280)}]");
                }
                cp = null;
                GC.Collect();
                str = $"QQ:{e.FromQQ.Id} 申请了一个精准单抽";
            }
            else if (e.Message.Text.Replace(" ", "").Replace("#", "#").ToUpper() == order_JZB10)
            {
                e.Handler = true;
                if (INIhelper.IniRead("ExrtaConfig", "SwitchJZB10", "1", INIPath) == "0")
                {
                    return;
                }

                if (!exist)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, noReg.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                    return;
                }

                diamond = GetDiamond(e.FromQQ.Id);
                if (diamond < 2800)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, lowDiamond.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                    return;
                }
                e.CQApi.SendPrivateMessage(e.FromQQ, JZB10.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                gc.Read_Jingzhun(2);
                List <UI.Gacha.GachaResult> ls = new List <UI.Gacha.GachaResult>();
                for (int i = 0; i < 10; i++)
                {
                    ls.Add(gc.JZ_GachaMain());
                    ls.Add(gc.JZ_GachaMaterial());
                }
                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 != UI.Gacha.TypeS.Stigmata.ToString() && ls[i].type != UI.Gacha.TypeS.Weapon.ToString())
                        {
                            ls[i].count += ls[j].count;
                            ls.RemoveAt(j);
                            i--; j--;
                            if (i == -1)
                            {
                                i = 0;
                            }
                        }
                    }
                }
                var tasksql = new Task(() =>
                {
                    AddItem2Repositories(ls, e);
                });
                tasksql.Start();
                CombinePng cp = new CombinePng();
                SubDiamond(cq.FromQQ.Id, 2800);
                string path = $@"{cq.CQApi.AppDirectory}\概率\精准概率.txt";
                if (INIhelper.IniRead("ExtraConfig", "TextGacha", "0", e.CQApi.AppDirectory + "\\Config.ini") == "1")
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, TextGacha(ls));
                }
                else
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, $"[CQ:image,file={cp.Gacha(ls, 1, 2, 10, diamond - 2800)}]");
                }
                cp = null;
                GC.Collect();
                str = $"QQ:{e.FromQQ.Id} 申请了一个精准十连";
            }
            else if (e.Message.Text.Replace(" ", "").Replace("#", "#") == order_BP10)
            {
                e.Handler = true;
                if (INIhelper.IniRead("ExrtaConfig", "SwitchBP10", "1", INIPath) == "0")
                {
                    return;
                }

                if (!exist)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, noReg.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                    return;
                }
                diamond = GetDiamond(e.FromQQ.Id);
                if (diamond < 2800)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, lowDiamond.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                    return;
                }
                e.CQApi.SendPrivateMessage(e.FromQQ, BP10.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                gc.Read_BP();
                List <UI.Gacha.GachaResult> ls = new List <UI.Gacha.GachaResult>();
                for (int i = 0; i < 10; i++)
                {
                    ls.Add(gc.BP_GachaMain());
                    ls.Add(gc.BP_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 != UI.Gacha.TypeS.Character.ToString())
                        {
                            ls[i].count += ls[j].count;
                            ls.RemoveAt(j);
                            i--; j--;
                            if (i == -1)
                            {
                                i = 0;
                            }
                        }
                    }
                }
                var tasksql = new Task(() =>
                {
                    AddItem2Repositories(ls, e);
                });
                tasksql.Start();
                CombinePng cp = new CombinePng();
                SubDiamond(cq.FromQQ.Id, 2800);
                string path = $@"{cq.CQApi.AppDirectory}\概率\标配概率.txt";
                if (INIhelper.IniRead("ExtraConfig", "TextGacha", "0", e.CQApi.AppDirectory + "\\Config.ini") == "1")
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, TextGacha(ls));
                }
                else
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, $"[CQ:image,file={cp.Gacha(ls, 2, 0, 10, diamond - 2800)}]");
                }
                cp = null;
                GC.Collect();
                str = $"QQ:{e.FromQQ.Id} 申请了一个标配十连";
            }
            else if (e.Message.Text.Replace(" ", "").Replace("#", "#") == order_BP1)
            {
                e.Handler = true;
                if (INIhelper.IniRead("ExrtaConfig", "SwitchBP1", "1", INIPath) == "0")
                {
                    return;
                }

                if (!exist)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, noReg.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                    return;
                }
                diamond = GetDiamond(e.FromQQ.Id);
                if (diamond < 280)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, lowDiamond.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                    return;
                }
                e.CQApi.SendPrivateMessage(e.FromQQ, BP1);
                gc.Read_BP();
                List <UI.Gacha.GachaResult> ls = new List <UI.Gacha.GachaResult>
                {
                    gc.BP_GachaMain(),
                                            gc.BP_GachaSub()
                };
                var tasksql = new Task(() =>
                {
                    AddItem2Repositories(ls, e);
                });
                tasksql.Start();
                CombinePng cp = new CombinePng();
                SubDiamond(cq.FromQQ.Id, 280);
                string path = $@"{cq.CQApi.AppDirectory}\概率\标配概率.txt";
                if (INIhelper.IniRead("ExtraConfig", "TextGacha", "0", e.CQApi.AppDirectory + "\\Config.ini") == "1")
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, TextGacha(ls));
                }
                else
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, $"[CQ:image,file={cp.Gacha(ls, 2, 0, 1, diamond - 280)}]");
                }
                cp = null;
                GC.Collect();
                str = $"QQ:{e.FromQQ.Id} 申请了一个标配单抽";
            }
            else if (e.Message.Text.Replace(" ", "").Replace("#", "#") == order_sign)
            {
                e.Handler = true;
                if (!exist)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, noReg.Replace("<@>", "").Replace("<#>", diamond.ToString()));
                    return;
                }
                diamond = Sign(e.FromQQ.Id);
                if (diamond >= 0)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, sign1.Replace("<@>", "").Replace("<#>", diamond.ToString()));
                    e.CQApi.SendPrivateMessage(e.FromQQ, sign2.Replace("<@>", "").Replace("<#>", diamond.ToString()));
                    str = $"QQ:{e.FromQQ.Id} 进行了签到";
                }
                else
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, mutiSign.Replace("<@>", "").Replace("<#>", diamond.ToString()));
                    return;
                }
            }
            else if (e.Message.Text.Replace(" ", "").Replace("#", "#") == order_register)
            {
                e.Handler = true;
                if (!exist)
                {
                    Register(e.FromQQ.Id);
                    Random rd = new Random();
                    diamond = GetDiamond(e.FromQQ.Id);
                    e.CQApi.SendPrivateMessage(e.FromQQ, register.Replace("<@>", "").Replace("<#>", diamond.ToString()));
                    str = $"QQ:{e.FromQQ.Id} 注册了抽卡";
                }
                else
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, mutiRegister.Replace("<@>", "").Replace("<#>", diamond.ToString()));
                    return;
                }
            }
            else if (e.Message.Text.Replace(" ", "").Replace("#", "#") == order_querydiamond)
            {
                e.Handler = true;
                if (INIhelper.IniRead("ExrtaConfig", "SwitchQueDiamond", "1", INIPath) == "0")
                {
                    return;
                }

                if (!exist)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, noReg.Replace("<@>", "").Replace("<#>", diamond.ToString()));
                    return;
                }
                diamond = GetDiamond(e.FromQQ.Id);
                e.CQApi.SendPrivateMessage(e.FromQQ, queryDiamond.Replace("<@>", "").Replace("<#>", diamond.ToString()));
            }
            else if (e.Message.Text.Replace(" ", "").Replace("#", "#") == order_help)
            {
                e.Handler = true;
                if (INIhelper.IniRead("ExrtaConfig", "SwitchGetHelp", "1", INIPath) == "0")
                {
                    return;
                }

                str = help;
            }
            else if (e.Message.Text.Replace(" ", "").Replace("#", "#") == order_getpool)
            {
                e.Handler = true;
                if (INIhelper.IniRead("ExrtaConfig", "SwitchGetPool", "1", INIPath) == "0")
                {
                    return;
                }

                string UPS, UPA, UPWeapon, UPStigmata;
                UPS        = INIhelper.IniRead("详情", "UpS", "S角色", e.CQApi.AppDirectory + "\\概率\\扩充概率.txt");
                UPA        = INIhelper.IniRead("详情", "UpA", "A角色", e.CQApi.AppDirectory + "\\概率\\扩充概率.txt");
                UPWeapon   = INIhelper.IniRead("详情", "UpWeapon", "四星武器", e.CQApi.AppDirectory + "\\概率\\精准概率.txt");
                UPStigmata = INIhelper.IniRead("详情", "UpStigmata", "四星圣痕", e.CQApi.AppDirectory + "\\概率\\精准概率.txt");
                e.CQApi.SendPrivateMessage(e.FromQQ, $"当前扩充池为 {UPS} {UPA}\n当前精准池为 {UPWeapon} {UPStigmata}");
                return;
            }
            else if (e.Message.Text.Replace("#", "#").StartsWith("#氪金"))
            {
                e.Handler = true;
                if (INIhelper.IniRead("ExrtaConfig", "SwitchKaKin", "1", INIPath) == "0")
                {
                    return;
                }

                string   path = $@"{cq.CQApi.AppDirectory}\Config.ini";
                string[] temp = e.Message.Text.Split(' ');
                if (temp.Length != 3)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, $"输入的格式不正确!请按照 #氪金 目标QQ号或者at目标 数量 的格式填写");
                    return;
                }
                else
                {
                    try
                    {
                        long targetId = Convert.ToInt64(temp[1].Replace("[CQ:at,qq=", "").Replace("]", ""));
                        int  countdia = Convert.ToInt32(temp[2]);
                        try
                        {
                            if (!IDExist(targetId))
                            {
                                e.CQApi.SendPrivateMessage(e.FromQQ, "操作对象不存在");
                                return;
                            }
                            path = $@"{cq.CQApi.AppDirectory}data.db";
                            SQLiteConnection cn = new SQLiteConnection("data source=" + path);
                            cn.Open();
                            SQLiteCommand cmd = new SQLiteCommand($"UPDATE UserData SET diamond=@diamond WHERE Fromgroup='-1' and qq='{targetId}'", cn);
                            cmd.Parameters.Add("diamond", DbType.Int32).Value = GetDiamond(targetId) + countdia;
                            cmd.ExecuteNonQuery();
                            e.CQApi.SendPrivateMessage(e.FromQQ, $"操作成功,为[CQ:at,qq={targetId}]充值{countdia}水晶,剩余{GetDiamond(targetId)}水晶");
                            return;
                        }
                        catch
                        {
                            e.CQApi.SendPrivateMessage(e.FromQQ, str = "操作失败了……");
                            return;
                        }
                    }
                    catch
                    {
                        e.CQApi.SendPrivateMessage(e.FromQQ, $"输入的格式不正确!请按照格式输入纯数字");
                        return;
                    }
                }
            }
            else
            {
                return;
            }
            if (controlgroup == 0)
            {
                return;
            }
            e.CQApi.SendGroupMessage(controlgroup, str);
        }
Example #5
0
        public void GroupMessage(object sender, CQGroupMessageEventArgs e)
        {
            cq = e;
            CQSave.cq_group = e;
            if (!GroupInini())
            {
                return;
            }
            bool   exist        = IDExist(e.FromQQ.Id);
            long   controlgroup = Convert.ToInt64(INIhelper.IniRead("后台群", "Id", "0", e.CQApi.AppDirectory + "\\Config.ini"));
            string str          = "";

            UI.Gacha gc = new UI.Gacha();
            if (e.Message.Text.Replace(" ", "") == order_KC1)
            {
                if (!exist)
                {
                    e.CQApi.SendGroupMessage(e.FromGroup, $"[CQ:at,qq={e.FromQQ.Id}] 不是清洁工吧?来输入#抽卡注册 来上舰");
                    return;
                }
                int diamond = GetDiamond(e.FromQQ.Id);
                if (diamond < 280)
                {
                    e.CQApi.SendGroupMessage(e.FromGroup, $@"[CQ:at,qq={e.FromQQ.Id}] 水晶不足,无法进行抽卡,你还剩余{diamond}水晶");
                    return;
                }
                e.CQApi.SendGroupMessage(e.FromGroup, KC1);
                gc.Read_Kuochong();
                List <UI.Gacha.GachaResult> ls = new List <UI.Gacha.GachaResult>
                {
                    gc.KC_Gacha(),
                                            gc.KC_GachaSub()
                };
                CombinePng cp = new CombinePng();
                SubDiamond(cq.FromQQ.Id, 280);
                e.CQApi.SendGroupMessage(e.FromGroup, $"[CQ:image,file={cp.Gacha(ls, 1, 1,diamond-280)}]");
                cp = null;
                GC.Collect();
                str = $"群号:{e.FromGroup.Id} QQ:{e.FromQQ.Id} 申请了一个扩充单抽";
            }
            else if (e.Message.Text.Replace(" ", "") == order_KC10)
            {
                if (!exist)
                {
                    e.CQApi.SendGroupMessage(e.FromGroup, $"[CQ:at,qq={e.FromQQ.Id}] 不是清洁工吧?来输入#抽卡注册 来上舰");
                    return;
                }
                int diamond = GetDiamond(e.FromQQ.Id);
                if (diamond < 2800)
                {
                    e.CQApi.SendGroupMessage(e.FromGroup, $@"[CQ:at,qq={e.FromQQ.Id}] 水晶不足,无法进行抽卡,你还剩余{diamond}水晶");
                    return;
                }
                e.CQApi.SendGroupMessage(e.FromGroup, KC10);
                gc.Read_Kuochong();
                List <UI.Gacha.GachaResult> ls = new List <UI.Gacha.GachaResult>();
                for (int i = 0; i < 10; i++)
                {
                    ls.Add(gc.KC_Gacha());
                    ls.Add(gc.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 != UI.Gacha.TypeS.Chararcter.ToString())
                        {
                            ls[i].count += ls[j].count;
                            ls.RemoveAt(j);
                            i--; j--;
                            if (i == -1)
                            {
                                i = 0;
                            }
                        }
                    }
                }
                CombinePng cp = new CombinePng();
                SubDiamond(cq.FromQQ.Id, 2800);

                e.CQApi.SendGroupMessage(e.FromGroup, $"[CQ:image,file={cp.Gacha(ls, 0, 10, diamond - 2800)}]");
                cp = null;
                GC.Collect();
                str = $"群号:{e.FromGroup.Id} QQ:{e.FromQQ.Id} 申请了一个扩充十连";
            }
            else if (e.Message.Text.Replace(" ", "") == order_JZ1)
            {
                if (!exist)
                {
                    e.CQApi.SendGroupMessage(e.FromGroup, $"[CQ:at,qq={e.FromQQ.Id}] 不是清洁工吧?来输入#抽卡注册 来上舰");
                    return;
                }

                int diamond = GetDiamond(e.FromQQ.Id);
                if (diamond < 280)
                {
                    e.CQApi.SendGroupMessage(e.FromGroup, $@"[CQ:at,qq={e.FromQQ.Id}] 水晶不足,无法进行抽卡,你还剩余{diamond}水晶");
                    return;
                }
                e.CQApi.SendGroupMessage(e.FromGroup, JZ1);
                gc.Read_Jingzhun();
                List <UI.Gacha.GachaResult> ls = new List <UI.Gacha.GachaResult>
                {
                    gc.JZ_GachaMain(),
                                            gc.JZ_GachaMaterial()
                };
                CombinePng cp = new CombinePng();
                SubDiamond(cq.FromQQ.Id, 280);

                e.CQApi.SendGroupMessage(e.FromGroup, $"[CQ:image,file={cp.Gacha(ls, 1, 1, diamond - 280)}]");
                cp = null;
                GC.Collect();
                str = $"群号:{e.FromGroup.Id} QQ:{e.FromQQ.Id} 申请了一个精准单抽";
            }
            else if (e.Message.Text.Replace(" ", "") == order_JZ10)
            {
                if (!exist)
                {
                    e.CQApi.SendGroupMessage(e.FromGroup, $"[CQ:at,qq={e.FromQQ.Id}] 不是清洁工吧?来输入#抽卡注册 来上舰");
                    return;
                }

                int diamond = GetDiamond(e.FromQQ.Id);
                if (diamond < 2800)
                {
                    e.CQApi.SendGroupMessage(e.FromGroup, $@"[CQ:at,qq={e.FromQQ.Id}] 水晶不足,无法进行抽卡,你还剩余{diamond}水晶");
                    return;
                }
                e.CQApi.SendGroupMessage(e.FromGroup, JZ10);
                gc.Read_Jingzhun();
                List <UI.Gacha.GachaResult> ls = new List <UI.Gacha.GachaResult>();
                for (int i = 0; i < 10; i++)
                {
                    ls.Add(gc.JZ_GachaMain());
                    ls.Add(gc.JZ_GachaMaterial());
                }
                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 != UI.Gacha.TypeS.Stigmata.ToString() && ls[i].type != UI.Gacha.TypeS.Weapon.ToString())
                        {
                            ls[i].count += ls[j].count;
                            ls.RemoveAt(j);
                            i--; j--;
                            if (i == -1)
                            {
                                i = 0;
                            }
                        }
                    }
                }
                CombinePng cp = new CombinePng();
                SubDiamond(cq.FromQQ.Id, 2800);
                e.CQApi.SendGroupMessage(e.FromGroup, $"[CQ:image,file={cp.Gacha(ls, 1, 10, diamond - 2800)}]");
                cp = null;
                GC.Collect();
                str = $"群号:{e.FromGroup.Id} QQ:{e.FromQQ.Id} 申请了一个精准十连";
            }
            else if (e.Message.Text.Replace(" ", "") == order_sign)
            {
                if (!exist)
                {
                    e.CQApi.SendGroupMessage(e.FromGroup, $"[CQ:at,qq={e.FromQQ.Id}] 不是清洁工吧?来输入#抽卡注册 来上舰");
                    return;
                }
                int staus = Sign(e.FromQQ.Id);
                if (staus >= 0)
                {
                    e.CQApi.SendGroupMessage(e.FromGroup, sign1);
                    e.CQApi.SendGroupMessage(e.FromGroup, $"[CQ:at,qq={e.FromQQ.Id}] 这是你今天清扫甲板的报酬,拿好 ({staus}水晶)");
                    str = $"群号:{e.FromGroup.Id} QQ:{e.FromQQ.Id} 进行了签到";
                }
                else
                {
                    e.CQApi.SendGroupMessage(e.FromGroup, "今天的甲板挺亮的,擦一遍就行了");
                    return;
                }
            }
            else if (e.Message.Text.Replace(" ", "") == order_register)
            {
                if (!exist)
                {
                    Register(e.FromQQ.Id);
                    Random rd = new Random();
                    e.CQApi.SendGroupMessage(e.FromGroup, $"[CQ:at,qq={e.FromQQ.Id}] 欢迎上舰,这是你的初始资源 {GetDiamond(e.FromQQ.Id)}水晶");
                    str = $"群号:{e.FromGroup.Id} QQ:{e.FromQQ.Id} 注册了抽卡";
                }
                else
                {
                    e.CQApi.SendGroupMessage(e.FromGroup, "重复注册是不行的哦");
                    return;
                }
            }
            else if (e.Message.Text.Replace(" ", "") == order_querydiamond)
            {
                if (!exist)
                {
                    e.CQApi.SendGroupMessage(e.FromGroup, $"[CQ:at,qq={e.FromQQ.Id}] 不是清洁工吧?来输入#抽卡注册 来上舰");
                    return;
                }
                e.CQApi.SendGroupMessage(e.FromGroup, $"[CQ:at,qq={e.FromQQ.Id}] 你手头还有{GetDiamond(e.FromQQ.Id)}水晶");
            }
            else if (e.Message.Text.Replace(" ", "") == order_signreset)
            {
                GroupMemberInfo gmi = e.CQApi.GetGroupMemberInfo(e.FromGroup, e.FromQQ, false);
                if (gmi.MemberType == Native.Csharp.Sdk.Cqp.Enum.QQGroupMemberType.Manage || gmi.MemberType == Native.Csharp.Sdk.Cqp.Enum.QQGroupMemberType.Creator)
                {
                    SignReset();
                    Random rd = new Random();
                    switch (rd.Next(0, 6))
                    {
                    case 0:
                        e.CQApi.SendGroupMessage(e.FromGroup, "贝贝龙来甲板找女王♂van,把甲板弄脏了,大家又得打扫一遍");
                        break;

                    case 1:
                        e.CQApi.SendGroupMessage(e.FromGroup, "草履虫非要给鸭子做饭,厨房爆炸了,黑紫色的东西撒了一甲板,把甲板弄脏了,大家又得打扫一遍");
                        break;

                    case 2:
                        e.CQApi.SendGroupMessage(e.FromGroup, "你和女武神们被从深渊扔了回来,来自深渊的炉灰把甲板弄脏了,大家又得打扫一遍");
                        break;

                    case 3:
                        e.CQApi.SendGroupMessage(e.FromGroup, "由于神秘东方村庄的诅咒,你抽卡的泪水把甲板弄脏了,大家又得打扫一遍");
                        break;

                    case 4:
                        e.CQApi.SendGroupMessage(e.FromGroup, "理律疯狂在甲板上逮虾户,把甲板弄脏了,大家又得打扫一遍");
                        break;

                    case 5:
                        e.CQApi.SendGroupMessage(e.FromGroup, "希儿到处找不到鸭子,里人格暴走,把甲板弄脏了,大家又得打扫一遍");
                        break;
                    }
                    str = $"群号:{e.FromGroup.Id} QQ:{e.FromQQ.Id} 重置了签到";
                }
                else
                {
                    e.CQApi.SendGroupMessage(e.FromGroup, "只有管♂理员才能这么做");
                    return;
                }
            }
            else if (e.Message.Text.Replace(" ", "") == order_help)
            {
                str = "水银抽卡人 给你抽卡的自信(~ ̄▽ ̄)~ \n合成图片以及发送图片需要一些时间,请耐心等待\n单抽是没有保底的\n#抽卡注册\n#我的水晶\n#打扫甲板(签到)\n#甲板积灰(重置签到,管理员限定)\n\r#精准单抽\n#扩充单抽\n#精准十连\n#扩充十连";
            }
            else
            {
                return;
            }
            if (controlgroup == 0)
            {
                return;
            }
            e.CQApi.SendGroupMessage(controlgroup, str);
        }
        public void PrivateMessage(object sender, CQPrivateMessageEventArgs e)
        {
            cq = e;
            bool exist = IDExist(e.FromQQ.Id);

            UI.Gacha gc           = new UI.Gacha();
            long     controlgroup = Convert.ToInt64(INIhelper.IniRead("后台群", "Id", "0", e.CQApi.AppDirectory + "\\Config.ini"));
            string   str          = "";

            if (e.Message.Text.Replace(" ", "") == "#扩充单抽")
            {
                if (!exist)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, $"不是清洁工吧?来输入#抽卡注册 来上舰");
                    return;
                }
                int diamond = GetDiamond(e.FromQQ.Id);
                if (diamond < 280)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, $@"水晶不足,无法进行抽卡,你还剩余{diamond}水晶");
                    return;
                }
                e.CQApi.SendPrivateMessage(e.FromQQ, "少女祈祷中……");
                gc.Read_Kuochong();
                List <UI.Gacha.GachaResult> ls = new List <UI.Gacha.GachaResult>
                {
                    gc.KC_Gacha(),
                                            gc.KC_GachaSub()
                };
                CombinePng cp = new CombinePng();
                SubDiamond(cq.FromQQ.Id, 280);
                e.CQApi.SendPrivateMessage(e.FromQQ, $"[CQ:image,file={cp.Gacha(ls, 1, 1, diamond - 280)}]");
                cp = null;
                GC.Collect();
                str = $"QQ:{e.FromQQ.Id} 申请了一个扩充单抽";
            }
            else if (e.Message.Text.Replace(" ", "") == "#扩充十连")
            {
                if (!exist)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, $"不是清洁工吧?来输入#抽卡注册 来上舰");
                    return;
                }
                int diamond = GetDiamond(e.FromQQ.Id);
                if (diamond < 2800)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, $@"水晶不足,无法进行抽卡,你还剩余{diamond}水晶");
                    return;
                }
                e.CQApi.SendPrivateMessage(e.FromQQ, "少女祈祷中……");
                gc.Read_Kuochong();
                List <UI.Gacha.GachaResult> ls = new List <UI.Gacha.GachaResult>();
                for (int i = 0; i < 10; i++)
                {
                    ls.Add(gc.KC_Gacha());
                    ls.Add(gc.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 != UI.Gacha.TypeS.Chararcter.ToString())
                        {
                            ls[i].count += ls[j].count;
                            ls.RemoveAt(j);
                            i--; j--;
                            if (i == -1)
                            {
                                i = 0;
                            }
                        }
                    }
                }
                CombinePng cp = new CombinePng();
                SubDiamond(cq.FromQQ.Id, 2800);

                e.CQApi.SendPrivateMessage(e.FromQQ, $"[CQ:image,file={cp.Gacha(ls, 0, 10, diamond - 2800)}]");
                cp = null;
                GC.Collect();
                str = $"QQ:{e.FromQQ.Id} 申请了一个扩充十连";
            }
            else if (e.Message.Text.Replace(" ", "") == "#精准单抽")
            {
                if (!exist)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, $"不是清洁工吧?来输入#抽卡注册 来上舰");
                    return;
                }

                int diamond = GetDiamond(e.FromQQ.Id);
                if (diamond < 280)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, $@"水晶不足,无法进行抽卡,你还剩余{diamond}水晶");
                    return;
                }
                e.CQApi.SendPrivateMessage(e.FromQQ, "少女祈祷中……");
                gc.Read_Jingzhun();
                List <UI.Gacha.GachaResult> ls = new List <UI.Gacha.GachaResult>
                {
                    gc.JZ_GachaMain(),
                                            gc.JZ_GachaMaterial()
                };
                CombinePng cp = new CombinePng();
                SubDiamond(cq.FromQQ.Id, 280);

                e.CQApi.SendPrivateMessage(e.FromQQ, $"[CQ:image,file={cp.Gacha(ls, 1, 1, diamond - 280)}]");
                cp = null;
                GC.Collect();
                str = $"QQ:{e.FromQQ.Id} 申请了一个精准单抽";
            }
            else if (e.Message.Text.Replace(" ", "") == "#精准十连")
            {
                if (!exist)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, $"不是清洁工吧?来输入#抽卡注册 来上舰");
                    return;
                }

                int diamond = GetDiamond(e.FromQQ.Id);
                if (diamond < 2800)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, $@"水晶不足,无法进行抽卡,你还剩余{diamond}水晶");
                    return;
                }
                e.CQApi.SendPrivateMessage(e.FromQQ, "少女祈祷中……");
                gc.Read_Jingzhun();
                List <UI.Gacha.GachaResult> ls = new List <UI.Gacha.GachaResult>();
                for (int i = 0; i < 10; i++)
                {
                    ls.Add(gc.JZ_GachaMain());
                    ls.Add(gc.JZ_GachaMaterial());
                }
                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 != UI.Gacha.TypeS.Stigmata.ToString() && ls[i].type != UI.Gacha.TypeS.Weapon.ToString())
                        {
                            ls[i].count += ls[j].count;
                            ls.RemoveAt(j);
                            i--; j--;
                            if (i == -1)
                            {
                                i = 0;
                            }
                        }
                    }
                }
                CombinePng cp = new CombinePng();
                SubDiamond(cq.FromQQ.Id, 2800);
                e.CQApi.SendPrivateMessage(e.FromQQ, $"[CQ:image,file={cp.Gacha(ls, 1, 10, diamond - 2800)}]");
                cp = null;
                GC.Collect();
                str = $"QQ:{e.FromQQ.Id} 申请了一个精准十连";
            }
            else if (e.Message.Text.Replace(" ", "") == "#打扫甲板")
            {
                if (!exist)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, $"不是清洁工吧?来输入#抽卡注册 来上舰");
                    return;
                }
                int staus = Sign(e.FromQQ.Id);
                if (staus >= 0)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, "大姐你回来了,天气这么好一起多逛逛吧");
                    e.CQApi.SendPrivateMessage(e.FromQQ, $"这是你今天清扫甲板的报酬,拿好 ({staus}水晶)");
                    str = $"QQ:{e.FromQQ.Id} 进行了签到";
                }
                else
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, "今天的甲板挺亮的,擦一遍就行了");
                    return;
                }
            }
            else if (e.Message.Text.Replace(" ", "") == "#抽卡注册")
            {
                if (!exist)
                {
                    Register(e.FromQQ.Id);
                    Random rd = new Random();
                    e.CQApi.SendPrivateMessage(e.FromQQ, $"欢迎上舰,这是你的初始资源 {GetDiamond(e.FromQQ.Id)}水晶");
                    str = $"QQ:{e.FromQQ.Id} 注册了抽卡";
                }
                else
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, "重复注册是不行的哦");
                    return;
                }
            }
            else if (e.Message.Text.Replace(" ", "") == "#我的水晶")
            {
                if (!exist)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, $"不是清洁工吧?来输入#抽卡注册 来上舰");
                    return;
                }
                e.CQApi.SendPrivateMessage(e.FromQQ, $"你手头还有{GetDiamond(e.FromQQ.Id)}水晶");
            }
            else if (e.Message.Text.Replace(" ", "") == "#抽卡帮助")
            {
                str = "水银抽卡人 给你抽卡的自信(~ ̄▽ ̄)~ \n合成图片以及发送图片需要一些时间,请耐心等待\n单抽是没有保底的\n#抽卡注册\n#我的水晶\n#打扫甲板(签到)\n#甲板积灰(重置签到,管理员限定)\n\r#精准单抽\n#扩充单抽\n#精准十连\n#扩充十连";
            }
            else
            {
                return;
            }
            if (controlgroup == 0)
            {
                return;
            }
            e.CQApi.SendGroupMessage(controlgroup, str);
        }
Example #7
0
        public void PrivateMessage(object sender, CQPrivateMessageEventArgs e)
        {
            cq = e;
            CQSave.cq_private = e;
            if (INIhelper.IniRead("接口", "Private", "0", $"{e.CQApi.AppDirectory}Config.ini") == "0")
            {
                return;
            }
            bool exist = IDExist(e.FromQQ.Id);

            ReadConfig();
            UI.Gacha gc           = new UI.Gacha();
            long     controlgroup = Convert.ToInt64(INIhelper.IniRead("后台群", "Id", "0", e.CQApi.AppDirectory + "\\Config.ini"));
            string   str          = "";

            if (e.Message.Text.Replace(" ", "").Replace("#", "#") == order_KC1)
            {
                e.Handler = true;
                if (!exist)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, noReg.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                    return;
                }
                diamond = GetDiamond(e.FromQQ.Id);
                if (diamond < 280)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, lowDiamond.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                    return;
                }
                e.CQApi.SendPrivateMessage(e.FromQQ, KC1);
                gc.Read_Kuochong();
                List <UI.Gacha.GachaResult> ls = new List <UI.Gacha.GachaResult>
                {
                    gc.KC_Gacha(),
                                            gc.KC_GachaSub()
                };
                CombinePng cp = new CombinePng();
                SubDiamond(cq.FromQQ.Id, 280);
                string path = $@"{cq.CQApi.AppDirectory}\概率\扩充概率.txt";
                if (INIhelper.IniRead("ExtraConfig", "TextGacha", "0", e.CQApi.AppDirectory + "\\Config.ini") == "1")
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, TextGacha(ls));
                }
                else
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, $"[CQ:image,file={cp.Gacha(ls, 0, 0, 1, diamond - 280)}]");
                }
                cp = null;
                GC.Collect();
                str = $"QQ:{e.FromQQ.Id} 申请了一个扩充单抽";
            }
            else if (e.Message.Text.Replace(" ", "").Replace("#", "#") == order_KC10)
            {
                e.Handler = true;
                if (!exist)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, noReg.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                    return;
                }
                diamond = GetDiamond(e.FromQQ.Id);
                if (diamond < 2800)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, lowDiamond.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                    return;
                }
                e.CQApi.SendPrivateMessage(e.FromQQ, KC10.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                gc.Read_Kuochong();
                List <UI.Gacha.GachaResult> ls = new List <UI.Gacha.GachaResult>();
                for (int i = 0; i < 10; i++)
                {
                    ls.Add(gc.KC_Gacha());
                    ls.Add(gc.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 != UI.Gacha.TypeS.Character.ToString())
                        {
                            ls[i].count += ls[j].count;
                            ls.RemoveAt(j);
                            i--; j--;
                            if (i == -1)
                            {
                                i = 0;
                            }
                        }
                    }
                }
                CombinePng cp = new CombinePng();
                SubDiamond(cq.FromQQ.Id, 2800);
                string path = $@"{cq.CQApi.AppDirectory}\概率\扩充概率.txt";
                if (INIhelper.IniRead("ExtraConfig", "TextGacha", "0", e.CQApi.AppDirectory + "\\Config.ini") == "1")
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, TextGacha(ls));
                }
                else
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, $"[CQ:image,file={cp.Gacha(ls, 0, 0, 10, diamond - 2800)}]");
                }
                cp = null;
                GC.Collect();
                str = $"QQ:{e.FromQQ.Id} 申请了一个扩充十连";
            }
            else if (e.Message.Text.Replace(" ", "").Replace("#", "#").ToUpper() == order_JZA1)
            {
                e.Handler = true;
                if (!exist)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, noReg.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                    return;
                }

                diamond = GetDiamond(e.FromQQ.Id);
                if (diamond < 280)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, lowDiamond.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                    return;
                }
                e.CQApi.SendPrivateMessage(e.FromQQ, JZA1.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                gc.Read_Jingzhun(1);
                List <UI.Gacha.GachaResult> ls = new List <UI.Gacha.GachaResult>
                {
                    gc.JZ_GachaMain(),
                                            gc.JZ_GachaMaterial()
                };
                CombinePng cp = new CombinePng();
                SubDiamond(cq.FromQQ.Id, 280);
                string path = $@"{cq.CQApi.AppDirectory}\概率\精准概率.txt";
                if (INIhelper.IniRead("ExtraConfig", "TextGacha", "0", e.CQApi.AppDirectory + "\\Config.ini") == "1")
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, TextGacha(ls));
                }
                else
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, $"[CQ:image,file={cp.Gacha(ls, 1, 1, 1, diamond - 280)}]");
                }
                cp = null;
                GC.Collect();
                str = $"QQ:{e.FromQQ.Id} 申请了一个精准单抽";
            }
            else if (e.Message.Text.Replace(" ", "").Replace("#", "#").ToUpper() == order_JZA10)
            {
                e.Handler = true;
                if (!exist)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, noReg.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                    return;
                }

                diamond = GetDiamond(e.FromQQ.Id);
                if (diamond < 2800)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, lowDiamond.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                    return;
                }
                e.CQApi.SendPrivateMessage(e.FromQQ, JZA10.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                gc.Read_Jingzhun(1);
                List <UI.Gacha.GachaResult> ls = new List <UI.Gacha.GachaResult>();
                for (int i = 0; i < 10; i++)
                {
                    ls.Add(gc.JZ_GachaMain());
                    ls.Add(gc.JZ_GachaMaterial());
                }
                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 != UI.Gacha.TypeS.Stigmata.ToString() && ls[i].type != UI.Gacha.TypeS.Weapon.ToString())
                        {
                            ls[i].count += ls[j].count;
                            ls.RemoveAt(j);
                            i--; j--;
                            if (i == -1)
                            {
                                i = 0;
                            }
                        }
                    }
                }
                CombinePng cp = new CombinePng();
                SubDiamond(cq.FromQQ.Id, 2800);
                string path = $@"{cq.CQApi.AppDirectory}\概率\精准概率.txt";
                if (INIhelper.IniRead("ExtraConfig", "TextGacha", "0", e.CQApi.AppDirectory + "\\Config.ini") == "1")
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, TextGacha(ls));
                }
                else
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, $"[CQ:image,file={cp.Gacha(ls, 1, 1, 10, diamond - 2800)}]");
                }
                cp = null;
                GC.Collect();
                str = $"QQ:{e.FromQQ.Id} 申请了一个精准十连";
            }
            else if (e.Message.Text.Replace(" ", "").Replace("#", "#").ToUpper() == order_JZB1)
            {
                e.Handler = true;
                if (!exist)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, noReg.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                    return;
                }

                diamond = GetDiamond(e.FromQQ.Id);
                if (diamond < 280)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, lowDiamond.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                    return;
                }
                e.CQApi.SendPrivateMessage(e.FromQQ, JZB1.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                gc.Read_Jingzhun(2);
                List <UI.Gacha.GachaResult> ls = new List <UI.Gacha.GachaResult>
                {
                    gc.JZ_GachaMain(),
                                            gc.JZ_GachaMaterial()
                };
                CombinePng cp = new CombinePng();
                SubDiamond(cq.FromQQ.Id, 280);
                string path = $@"{cq.CQApi.AppDirectory}\概率\精准概率.txt";
                if (INIhelper.IniRead("ExtraConfig", "TextGacha", "0", e.CQApi.AppDirectory + "\\Config.ini") == "1")
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, TextGacha(ls));
                }
                else
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, $"[CQ:image,file={cp.Gacha(ls, 1, 2, 1, diamond - 280)}]");
                }
                cp = null;
                GC.Collect();
                str = $"QQ:{e.FromQQ.Id} 申请了一个精准单抽";
            }
            else if (e.Message.Text.Replace(" ", "").Replace("#", "#").ToUpper() == order_JZB10)
            {
                e.Handler = true;
                if (!exist)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, noReg.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                    return;
                }

                diamond = GetDiamond(e.FromQQ.Id);
                if (diamond < 2800)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, lowDiamond.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                    return;
                }
                e.CQApi.SendPrivateMessage(e.FromQQ, JZB10.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                gc.Read_Jingzhun(2);
                List <UI.Gacha.GachaResult> ls = new List <UI.Gacha.GachaResult>();
                for (int i = 0; i < 10; i++)
                {
                    ls.Add(gc.JZ_GachaMain());
                    ls.Add(gc.JZ_GachaMaterial());
                }
                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 != UI.Gacha.TypeS.Stigmata.ToString() && ls[i].type != UI.Gacha.TypeS.Weapon.ToString())
                        {
                            ls[i].count += ls[j].count;
                            ls.RemoveAt(j);
                            i--; j--;
                            if (i == -1)
                            {
                                i = 0;
                            }
                        }
                    }
                }
                CombinePng cp = new CombinePng();
                SubDiamond(cq.FromQQ.Id, 2800);
                string path = $@"{cq.CQApi.AppDirectory}\概率\精准概率.txt";
                if (INIhelper.IniRead("ExtraConfig", "TextGacha", "0", e.CQApi.AppDirectory + "\\Config.ini") == "1")
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, TextGacha(ls));
                }
                else
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, $"[CQ:image,file={cp.Gacha(ls, 1, 2, 10, diamond - 2800)}]");
                }
                cp = null;
                GC.Collect();
                str = $"QQ:{e.FromQQ.Id} 申请了一个精准十连";
            }
            else if (e.Message.Text.Replace(" ", "").Replace("#", "#") == order_BP10)
            {
                e.Handler = true;
                if (!exist)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, noReg.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                    return;
                }
                diamond = GetDiamond(e.FromQQ.Id);
                if (diamond < 2800)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, lowDiamond.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                    return;
                }
                e.CQApi.SendPrivateMessage(e.FromQQ, BP10.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                gc.Read_BP();
                List <UI.Gacha.GachaResult> ls = new List <UI.Gacha.GachaResult>();
                for (int i = 0; i < 10; i++)
                {
                    ls.Add(gc.BP_GachaMain());
                    ls.Add(gc.BP_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 != UI.Gacha.TypeS.Character.ToString())
                        {
                            ls[i].count += ls[j].count;
                            ls.RemoveAt(j);
                            i--; j--;
                            if (i == -1)
                            {
                                i = 0;
                            }
                        }
                    }
                }
                CombinePng cp = new CombinePng();
                SubDiamond(cq.FromQQ.Id, 2800);
                string path = $@"{cq.CQApi.AppDirectory}\概率\标配概率.txt";
                if (INIhelper.IniRead("ExtraConfig", "TextGacha", "0", e.CQApi.AppDirectory + "\\Config.ini") == "1")
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, TextGacha(ls));
                }
                else
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, $"[CQ:image,file={cp.Gacha(ls, 2, 0, 10, diamond - 2800)}]");
                }
                cp = null;
                GC.Collect();
                str = $"QQ:{e.FromQQ.Id} 申请了一个标配十连";
            }
            else if (e.Message.Text.Replace(" ", "").Replace("#", "#") == order_BP1)
            {
                e.Handler = true;
                if (!exist)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, noReg.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                    return;
                }
                diamond = GetDiamond(e.FromQQ.Id);
                if (diamond < 280)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, lowDiamond.Replace("<@>", $"").Replace("<#>", diamond.ToString()));
                    return;
                }
                e.CQApi.SendPrivateMessage(e.FromQQ, BP1);
                gc.Read_BP();
                List <UI.Gacha.GachaResult> ls = new List <UI.Gacha.GachaResult>
                {
                    gc.BP_GachaMain(),
                                            gc.BP_GachaSub()
                };
                CombinePng cp = new CombinePng();
                SubDiamond(cq.FromQQ.Id, 280);
                string path = $@"{cq.CQApi.AppDirectory}\概率\标配概率.txt";
                if (INIhelper.IniRead("ExtraConfig", "TextGacha", "0", e.CQApi.AppDirectory + "\\Config.ini") == "1")
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, TextGacha(ls));
                }
                else
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, $"[CQ:image,file={cp.Gacha(ls, 2, 0, 1, diamond - 280)}]");
                }
                cp = null;
                GC.Collect();
                str = $"QQ:{e.FromQQ.Id} 申请了一个标配单抽";
            }
            else if (e.Message.Text.Replace(" ", "").Replace("#", "#") == order_sign)
            {
                e.Handler = true;
                if (!exist)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, noReg.Replace("<@>", "").Replace("<#>", diamond.ToString()));
                    return;
                }
                diamond = Sign(e.FromQQ.Id);
                if (diamond >= 0)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, sign1.Replace("<@>", "").Replace("<#>", diamond.ToString()));
                    e.CQApi.SendPrivateMessage(e.FromQQ, sign2.Replace("<@>", "").Replace("<#>", diamond.ToString()));
                    str = $"QQ:{e.FromQQ.Id} 进行了签到";
                }
                else
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, mutiSign.Replace("<@>", "").Replace("<#>", diamond.ToString()));
                    return;
                }
            }
            else if (e.Message.Text.Replace(" ", "").Replace("#", "#") == order_register)
            {
                e.Handler = true;
                if (!exist)
                {
                    Register(e.FromQQ.Id);
                    Random rd = new Random();
                    diamond = GetDiamond(e.FromQQ.Id);
                    e.CQApi.SendPrivateMessage(e.FromQQ, register.Replace("<@>", "").Replace("<#>", diamond.ToString()));
                    str = $"QQ:{e.FromQQ.Id} 注册了抽卡";
                }
                else
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, mutiRegister.Replace("<@>", "").Replace("<#>", diamond.ToString()));
                    return;
                }
            }
            else if (e.Message.Text.Replace(" ", "").Replace("#", "#") == order_querydiamond)
            {
                e.Handler = true;
                if (!exist)
                {
                    e.CQApi.SendPrivateMessage(e.FromQQ, noReg.Replace("<@>", "").Replace("<#>", diamond.ToString()));
                    return;
                }
                diamond = GetDiamond(e.FromQQ.Id);
                e.CQApi.SendPrivateMessage(e.FromQQ, queryDiamond.Replace("<@>", "").Replace("<#>", diamond.ToString()));
            }
            else if (e.Message.Text.Replace(" ", "").Replace("#", "#") == order_help)
            {
                e.Handler = true;
                str       = help;
            }
            else if (e.Message.Text.Replace(" ", "").Replace("#", "#") == order_getpool)
            {
                e.Handler = true;
                string UPS, UPA, UPWeapon, UPStigmata;
                UPS        = INIhelper.IniRead("详情", "UpS", "S角色", e.CQApi.AppDirectory + "\\概率\\扩充概率.txt");
                UPA        = INIhelper.IniRead("详情", "UpA", "A角色", e.CQApi.AppDirectory + "\\概率\\扩充概率.txt");
                UPWeapon   = INIhelper.IniRead("详情", "UpWeapon", "四星武器", e.CQApi.AppDirectory + "\\概率\\精准概率.txt");
                UPStigmata = INIhelper.IniRead("详情", "UpStigmata", "四星圣痕", e.CQApi.AppDirectory + "\\概率\\精准概率.txt");
                e.CQApi.SendPrivateMessage(e.FromQQ, $"当前扩充池为 {UPS} {UPA}\n当前精准池为 {UPWeapon} {UPStigmata}");
                return;
            }
            else
            {
                return;
            }
            if (controlgroup == 0)
            {
                return;
            }
            e.CQApi.SendGroupMessage(controlgroup, str);
        }
Example #8
0
        public void GroupMessage(object sender, CQGroupMessageEventArgs e)
        {
            cq = e;
            CQSave.cq_group = e;
            if (INIhelper.IniRead("接口", "Group", "0", $"{e.CQApi.AppDirectory}Config.ini") == "0")
            {
                return;
            }
            if (!GroupInini())
            {
                return;
            }
            ReadConfig(e);
            bool   exist        = IDExist(e.FromQQ.Id);
            long   controlgroup = Convert.ToInt64(INIhelper.IniRead("后台群", "Id", "0", e.CQApi.AppDirectory + "\\Config.ini"));
            string str          = "";

            UI.Gacha gc = new UI.Gacha();
            if (e.Message.Text.Replace(" ", "") == order_KC1)
            {
                if (!exist)
                {
                    e.CQApi.SendGroupMessage(e.FromGroup, noReg.Replace("<@>", $"[CQ:at,qq={e.FromQQ.Id}]").Replace("<#>", diamond.ToString()));
                    return;
                }
                diamond = GetDiamond(e.FromQQ.Id);
                if (diamond < 280)
                {
                    e.CQApi.SendGroupMessage(e.FromGroup, lowDiamond.Replace("<@>", $"[CQ:at,qq={e.FromQQ.Id}]").Replace("<#>", diamond.ToString()));
                    return;
                }
                e.CQApi.SendGroupMessage(e.FromGroup, KC1);
                gc.Read_Kuochong();
                List <UI.Gacha.GachaResult> ls = new List <UI.Gacha.GachaResult>
                {
                    gc.KC_Gacha(),
                                            gc.KC_GachaSub()
                };
                CombinePng cp = new CombinePng();
                SubDiamond(cq.FromQQ.Id, 280);
                e.CQApi.SendGroupMessage(e.FromGroup, $"[CQ:image,file={cp.Gacha(ls, 0, 1,diamond-280)}]");
                cp = null;
                GC.Collect();
                str = $"群号:{e.FromGroup.Id} QQ:{e.FromQQ.Id} 申请了一个扩充单抽";
            }
            else if (e.Message.Text.Replace(" ", "") == order_KC10)
            {
                if (!exist)
                {
                    e.CQApi.SendGroupMessage(e.FromGroup, noReg.Replace("<@>", $"[CQ:at,qq={e.FromQQ.Id}]").Replace("<#>", diamond.ToString()));
                    return;
                }
                diamond = GetDiamond(e.FromQQ.Id);
                if (diamond < 2800)
                {
                    e.CQApi.SendGroupMessage(e.FromGroup, lowDiamond.Replace("<@>", $"[CQ:at,qq={e.FromQQ.Id}]").Replace("<#>", diamond.ToString()));
                    return;
                }
                e.CQApi.SendGroupMessage(e.FromGroup, KC10.Replace("<@>", $"[CQ:at,qq={e.FromQQ.Id}]").Replace("<#>", diamond.ToString()));
                gc.Read_Kuochong();
                List <UI.Gacha.GachaResult> ls = new List <UI.Gacha.GachaResult>();
                for (int i = 0; i < 10; i++)
                {
                    ls.Add(gc.KC_Gacha());
                    ls.Add(gc.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 != UI.Gacha.TypeS.Chararcter.ToString())
                        {
                            ls[i].count += ls[j].count;
                            ls.RemoveAt(j);
                            i--; j--;
                            if (i == -1)
                            {
                                i = 0;
                            }
                        }
                    }
                }
                CombinePng cp = new CombinePng();
                SubDiamond(cq.FromQQ.Id, 2800);

                e.CQApi.SendGroupMessage(e.FromGroup, $"[CQ:image,file={cp.Gacha(ls, 0, 10, diamond - 2800)}]");
                cp = null;
                GC.Collect();
                str = $"群号:{e.FromGroup.Id} QQ:{e.FromQQ.Id} 申请了一个扩充十连";
            }
            else if (e.Message.Text.Replace(" ", "") == order_JZ1)
            {
                if (!exist)
                {
                    e.CQApi.SendGroupMessage(e.FromGroup, noReg.Replace("<@>", $"[CQ:at,qq={e.FromQQ.Id}]").Replace("<#>", diamond.ToString()));
                    return;
                }

                diamond = GetDiamond(e.FromQQ.Id);
                if (diamond < 280)
                {
                    e.CQApi.SendGroupMessage(e.FromGroup, lowDiamond.Replace("<@>", $"[CQ:at,qq={e.FromQQ.Id}]").Replace("<#>", diamond.ToString()));
                    return;
                }
                e.CQApi.SendGroupMessage(e.FromGroup, JZ1.Replace("<@>", $"[CQ:at,qq={e.FromQQ.Id}]").Replace("<#>", diamond.ToString()));
                gc.Read_Jingzhun();
                List <UI.Gacha.GachaResult> ls = new List <UI.Gacha.GachaResult>
                {
                    gc.JZ_GachaMain(),
                                            gc.JZ_GachaMaterial()
                };
                CombinePng cp = new CombinePng();
                SubDiamond(cq.FromQQ.Id, 280);

                e.CQApi.SendGroupMessage(e.FromGroup, $"[CQ:image,file={cp.Gacha(ls, 1, 1, diamond - 280)}]");
                cp = null;
                GC.Collect();
                str = $"群号:{e.FromGroup.Id} QQ:{e.FromQQ.Id} 申请了一个精准单抽";
            }
            else if (e.Message.Text.Replace(" ", "") == order_JZ10)
            {
                if (!exist)
                {
                    e.CQApi.SendGroupMessage(e.FromGroup, noReg.Replace("<@>", $"[CQ:at,qq={e.FromQQ.Id}]").Replace("<#>", diamond.ToString()));
                    return;
                }

                diamond = GetDiamond(e.FromQQ.Id);
                if (diamond < 2800)
                {
                    e.CQApi.SendGroupMessage(e.FromGroup, lowDiamond.Replace("<@>", $"[CQ:at,qq={e.FromQQ.Id}]").Replace("<#>", diamond.ToString()));
                    return;
                }
                e.CQApi.SendGroupMessage(e.FromGroup, JZ10.Replace("<@>", $"[CQ:at,qq={e.FromQQ.Id}]").Replace("<#>", diamond.ToString()));
                gc.Read_Jingzhun();
                List <UI.Gacha.GachaResult> ls = new List <UI.Gacha.GachaResult>();
                for (int i = 0; i < 10; i++)
                {
                    ls.Add(gc.JZ_GachaMain());
                    ls.Add(gc.JZ_GachaMaterial());
                }
                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 != UI.Gacha.TypeS.Stigmata.ToString() && ls[i].type != UI.Gacha.TypeS.Weapon.ToString())
                        {
                            ls[i].count += ls[j].count;
                            ls.RemoveAt(j);
                            i--; j--;
                            if (i == -1)
                            {
                                i = 0;
                            }
                        }
                    }
                }
                CombinePng cp = new CombinePng();
                SubDiamond(cq.FromQQ.Id, 2800);
                e.CQApi.SendGroupMessage(e.FromGroup, $"[CQ:image,file={cp.Gacha(ls, 1, 10, diamond - 2800)}]");
                cp = null;
                GC.Collect();
                str = $"群号:{e.FromGroup.Id} QQ:{e.FromQQ.Id} 申请了一个精准十连";
            }
            else if (e.Message.Text.Replace(" ", "") == order_sign)
            {
                if (!exist)
                {
                    e.CQApi.SendGroupMessage(e.FromGroup, noReg.Replace("<@>", $"[CQ:at,qq={e.FromQQ.Id}]").Replace("<#>", diamond.ToString()));
                    return;
                }
                diamond = Sign(e.FromQQ.Id);
                if (diamond >= 0)
                {
                    e.CQApi.SendGroupMessage(e.FromGroup, sign1.Replace("<@>", $"[CQ:at,qq={e.FromQQ.Id}]").Replace("<#>", diamond.ToString()));
                    e.CQApi.SendGroupMessage(e.FromGroup, sign2.Replace("<@>", $"[CQ:at,qq={e.FromQQ.Id}]").Replace("<#>", diamond.ToString()));
                    str = $"群号:{e.FromGroup.Id} QQ:{e.FromQQ.Id} 进行了签到";
                }
                else
                {
                    e.CQApi.SendGroupMessage(e.FromGroup, mutiSign.Replace("<@>", $"[CQ:at,qq={e.FromQQ.Id}]").Replace("<#>", diamond.ToString()));
                    return;
                }
            }
            else if (e.Message.Text.Replace(" ", "") == order_register)
            {
                if (!exist)
                {
                    Register(e.FromQQ.Id);
                    Random rd = new Random();
                    diamond = GetDiamond(e.FromQQ.Id);
                    e.CQApi.SendGroupMessage(e.FromGroup, register.Replace("<@>", $"[CQ:at,qq={e.FromQQ.Id}]").Replace("<#>", diamond.ToString()));
                    str = $"群号:{e.FromGroup.Id} QQ:{e.FromQQ.Id} 注册了抽卡";
                }
                else
                {
                    e.CQApi.SendGroupMessage(e.FromGroup, mutiRegister.Replace("<@>", $"[CQ:at,qq={e.FromQQ.Id}]").Replace("<#>", diamond.ToString()));
                    return;
                }
            }
            else if (e.Message.Text.Replace(" ", "") == order_querydiamond)
            {
                if (!exist)
                {
                    e.CQApi.SendGroupMessage(e.FromGroup, noReg.Replace("<@>", $"[CQ:at,qq={e.FromQQ.Id}]").Replace("<#>", diamond.ToString()));
                    return;
                }
                diamond = GetDiamond(e.FromQQ.Id);
                e.CQApi.SendGroupMessage(e.FromGroup, queryDiamond.Replace("<@>", $"[CQ:at,qq={e.FromQQ.Id}]").Replace("<#>", diamond.ToString()));
            }
            else if (e.Message.Text.Replace(" ", "") == order_signreset)
            {
                GroupMemberInfo gmi = e.CQApi.GetGroupMemberInfo(e.FromGroup, e.FromQQ, false);
                if (gmi.MemberType == Native.Csharp.Sdk.Cqp.Enum.QQGroupMemberType.Manage || gmi.MemberType == Native.Csharp.Sdk.Cqp.Enum.QQGroupMemberType.Creator)
                {
                    SignReset();
                    Random rd = new Random();
                    switch (rd.Next(0, 6))
                    {
                    case 0:
                        e.CQApi.SendGroupMessage(e.FromGroup, reset1.Replace("<@>", $"[CQ:at,qq={e.FromQQ.Id}]").Replace("<#>", diamond.ToString()));
                        break;

                    case 1:
                        e.CQApi.SendGroupMessage(e.FromGroup, reset2.Replace("<@>", $"[CQ:at,qq={e.FromQQ.Id}]").Replace("<#>", diamond.ToString()));
                        break;

                    case 2:
                        e.CQApi.SendGroupMessage(e.FromGroup, reset3.Replace("<@>", $"[CQ:at,qq={e.FromQQ.Id}]").Replace("<#>", diamond.ToString()));
                        break;

                    case 3:
                        e.CQApi.SendGroupMessage(e.FromGroup, reset4.Replace("<@>", $"[CQ:at,qq={e.FromQQ.Id}]").Replace("<#>", diamond.ToString()));
                        break;

                    case 4:
                        e.CQApi.SendGroupMessage(e.FromGroup, reset5.Replace("<@>", $"[CQ:at,qq={e.FromQQ.Id}]").Replace("<#>", diamond.ToString()));
                        break;

                    case 5:
                        e.CQApi.SendGroupMessage(e.FromGroup, reset6.Replace("<@>", $"[CQ:at,qq={e.FromQQ.Id}]").Replace("<#>", diamond.ToString()));
                        break;
                    }
                    str = $"群号:{e.FromGroup.Id} QQ:{e.FromQQ.Id} 重置了签到";
                }
                else
                {
                    e.CQApi.SendGroupMessage(e.FromGroup, "只有管♂理员才能这么做");
                    return;
                }
            }
            else if (e.Message.Text.Replace(" ", "") == order_help)
            {
                str = help.Replace(@"\n", "\n");
                e.CQApi.SendGroupMessage(e.FromGroup, str);
                return;
            }
            else if (e.Message.Text.Replace(" ", "") == order_getpool)
            {
                string UPS, UPA, UPWeapon, UPStigmata;
                UPS        = INIhelper.IniRead("详情", "UpS", "S角色", e.CQApi.AppDirectory + "\\概率\\扩充概率.txt");
                UPA        = INIhelper.IniRead("详情", "UpA", "A角色", e.CQApi.AppDirectory + "\\概率\\扩充概率.txt");
                UPWeapon   = INIhelper.IniRead("详情", "UpWeapon", "四星武器", e.CQApi.AppDirectory + "\\概率\\精准概率.txt");
                UPStigmata = INIhelper.IniRead("详情", "UpStigmata", "四星圣痕", e.CQApi.AppDirectory + "\\概率\\精准概率.txt");
                e.CQApi.SendGroupMessage(e.FromGroup, $"当前扩充池为 {UPS} {UPA}\n当前精准池为 {UPWeapon} {UPStigmata}");
                return;
            }
            else
            {
                return;
            }
            if (controlgroup == 0)
            {
                return;
            }
            e.CQApi.SendGroupMessage(controlgroup, str);
        }