コード例 #1
0
ファイル: BotProgram.cs プロジェクト: RazorTag/runescape_bot
        /// <summary>
        /// Determines if the chat box is currently open
        /// </summary>
        /// <returns></returns>
        protected bool ChatBoxIsOpen(bool readWindow = false)
        {
            if (readWindow)
            {
                Screen.ReadWindow();
            }

            int left   = 11;
            int right  = left + 30;
            int top    = Screen.Height - 43;
            int bottom = top + 13;

            Color[,] chatName = Vision.ScreenPiece(left, right, top, bottom);
            double textMatch       = ImageProcessing.FractionalMatch(chatName, RGBHSBRangeFactory.Black());
            double backgroundMatch = ImageProcessing.FractionalMatch(chatName, RGBHSBRangeFactory.ChatBoxBackground());

            return(textMatch > 0.05 && backgroundMatch > 0.5);
        }