Exemplo n.º 1
0
        private void button_Gacha1_Click(object sender, EventArgs e)
        {
            List <GachaResult> ls = new List <GachaResult>();

            switch (tabControl1.SelectedIndex)
            {
            case 0:
                ls.Add(MainGacha.KC_Gacha());
                ls.Add(MainGacha.KC_GachaSub());
                break;

            case 1:
            case 2:
                ls.Add(MainGacha.JZ_GachaMain(tabControl1.SelectedIndex == 1
                            ? PoolName.精准A : PoolName.精准B));
                ls.Add(MainGacha.JZ_GachaMaterial());
                break;

            case 3:
                ls.Add(MainGacha.BP_GachaMain());
                ls.Add(MainGacha.BP_GachaSub());
                break;
            }
            listBox_Result.Items.Add(ls[ls.Count - 2].name);
            listBox_Result.Items.Add(ls[ls.Count - 1].name);
            listBox_Result.SelectedIndex = listBox_Result.Items.Count - 1;
        }
Exemplo n.º 2
0
        private void button_Gacha10_Click(object sender, EventArgs e)
        {
            List <GachaResult> ls = new List <GachaResult>();

            switch (tabControl1.SelectedIndex)
            {
            case 0:
                for (int i = 0; i < 10; i++)
                {
                    ls.Add(MainGacha.KC_Gacha());
                    ls.Add(MainGacha.KC_GachaSub());
                }
                break;

            case 1:
            case 2:
                for (int i = 0; i < 10; i++)
                {
                    ls.Add(MainGacha.JZ_GachaMain(tabControl1.SelectedIndex == 1
                            ? PoolName.精准A : PoolName.精准B));
                    ls.Add(MainGacha.JZ_GachaMaterial());
                }
                break;

            case 3:
                for (int i = 0; i < 10; i++)
                {
                    ls.Add(MainGacha.BP_GachaMain());
                    ls.Add(MainGacha.BP_GachaSub());
                }
                break;
            }
            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 != TypeS.Stigmata.ToString() &&
                        ls[i].type != TypeS.Weapon.ToString())
                    {
                        ls[i].count += ls[j].count;
                        ls.RemoveAt(j);
                        i--; j--;
                        if (i == -1)
                        {
                            i = 0;
                        }
                    }
                }
            }
            foreach (var item in ls)
            {
                listBox_Result.Items.Add(item.name + " x" + item.count);
            }
            listBox_Result.Items.Add("");
            listBox_Result.SelectedIndex = listBox_Result.Items.Count - 2;
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 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);

            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.JZA10
                                              .Replace("<@>", $"[@{e.FromQQ.Id}]").Replace("<#>", diamond.ToString()));
            List <GachaResult> ls = new List <GachaResult>();

            for (int i = 0; i < 10; i++)
            {
                ls.Add(MainGacha.BP_GachaSub());
                ls.Add(MainGacha.BP_GachaMain());
            }
            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.Stigmata.ToString() &&
                        ls[i].type != PublicArgs.TypeS.Weapon.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);
        }