// 合成
 public void Hecheng(Chat chat)
 {
     if (ConfigData.BlackList != "")
     {
         foreach (var Black in BlackList)
         {
             if (Black.Contains("Name:"))
             {
                 var black = Black.Replace("Name:", "");
                 if (chat.user.Name == black)
                 {
                     return;
                 }
             }
             else if (Black.Contains("Name:"))
             {
                 var black = Black.Replace("Name:", "");
                 if (chat.user.Name == black.Trim())
                 {
                     return;
                 }
             }
         }
     }
     //经过多次测试发现弹幕中部分emoji不能被语音合成程序处理而导致主线程阻塞引发程序崩溃
     //即使未引发崩溃也会导致程序不能继续正常工作出现假死状态
     Hecheng(DelEmoji.delEmoji(chat.content), true);
 }
示例#2
0
        public void Roll(Colors userColor)
        {
            pictureBox1.Image.RotateFlip(RotateFlipType.Rotate270FlipNone);
            pictureBox1.Refresh();

            Colors cl   = Colors.Green;
            Random rnd  = new Random();
            int    roll = rnd.Next(0, 36);

            label2.Text = roll.ToString();

            if (Black.Contains(roll))
            {
                panel2.BackColor = Color.Black;
                cl = Colors.Black;
            }
            else if (Rad.Contains(roll))
            {
                panel2.BackColor = Color.Red;
                cl = Colors.Red;
            }
            else if (roll == 0)
            {
                panel2.BackColor = Color.Green;
                cl = Colors.Green;
            }
            StopRoll++;

            if (StopRoll == 50)
            {
                StopRoll       = 0;
                timer1.Enabled = false;
                int coef = 0;
                if (string.IsNullOrWhiteSpace(textBox2.Text) && cl == userColor)
                {
                    coef = 2;
                }
                else if (cl == userColor && roll == Convert.ToInt32(textBox2.Text))
                {
                    coef = cl == Colors.Green ? 12 : 4;
                }
                else
                {
                    MessageBox.Show("Вы проиграли!");
                    SetBoolean(true);
                    return;
                }

                balance += Convert.ToInt32(textBox1.Text) * coef;
                MessageBox.Show("Поздравляем с победой!");
                SetBalance();
                SetBoolean(true);
            }
        }
示例#3
0
文件: Combat.cs 项目: xathei/flipper
        /// <summary>
        /// Finds the best target to engage based on the passed criteria.
        /// </summary>
        /// <param name="monsterName">An array of monster names that we're looking to engage</param>
        /// <returns></returns>
        public static int FindTarget(double maxDistance = 50.0, params string[] monsterName)
        {
            int    bestTarget   = 0;
            double bestDistance = maxDistance;

            for (short i = 0; i < 768; i++)
            {
                if (Black.Contains(i))
                {
                    continue;
                }

                if (!IsRendered(i))
                {
                    continue;
                }

                if (fface.NPC.IsClaimed(i) && !PartyHasHate(i))
                {
                    continue;
                }

                if (fface.NPC.Distance(i) < 10 &&
                    fface.NPC.Status(i) == Status.Fighting &&
                    (!fface.NPC.IsClaimed(i) || PartyHasHate(i)) &&
                    IsFacingMe(i, 15.0))
                {
                    WriteLog($"[AGGRO>>] {fface.NPC.Name(i)}");
                    return(i);
                }

                if (fface.NPC.HPPCurrent(i) == 100 && monsterName.Contains(fface.NPC.Name(i)))
                {
                    if (fface.NPC.Distance(i) < bestDistance)
                    {
                        bestDistance = fface.NPC.Distance(i);
                        bestTarget   = i;
                    }
                }
            }

            return(bestTarget);
        }
 public void Hecheng(string wenzi, bool isChat = false)
 {
     if (wenzi == "")
     {
         return;
     }
     if (ConfigData.DanMu)
     {
         if (isChat)
         {
             if (wenzi.Length > ConfigData.maxSize)
             {
                 return;
             }
             if (ConfigData.BlackList != "")
             {
                 foreach (var Black in BlackList)
                 {
                     if (Black.Contains("Name:") || Black.Contains("Name:"))
                     {
                         continue;
                     }
                     var black = Black.Trim();
                     try
                     {
                         if (Regex.IsMatch(wenzi, black))
                         {
                             return;
                         }
                     }
                     catch (Exception err)
                     {
                         logging(err.ToString(), "debug");
                     }
                 }
             }
         }
         lock (YuYin.DanmuHecheng)
             YuYin.DanmuHecheng.Enqueue(wenzi);
     }
 }