Ejemplo n.º 1
0
        } // @ private static void Clear()

        internal static Color BrightenColor(FFACE.ChatTools.ChatLine chatLine)
        {
            Color brighterColor = new Color();
            //how many steps away can the colors be away from each other to be close enough to grayscale
            //this variable's value is subjective, and chosen by the programmer
            int steps = 3;
            //tolerance = 256 colors / 64 in-game 'step' choices * steps
            int tolerance     = 256 / 64 * steps;
            int closeEnoughRG = Math.Abs(chatLine.Color.R - chatLine.Color.G);
            int closeEnoughGB = Math.Abs(chatLine.Color.G - chatLine.Color.B);
            int closeEnoughRB = Math.Abs(chatLine.Color.R - chatLine.Color.B);

            if ((closeEnoughRG <= tolerance) && (closeEnoughGB <= tolerance) && (closeEnoughRB <= tolerance))
            {
                //greatly brighten white and gray text
                brighterColor = RGBHSL.ModifyBrightness(chatLine.Color, 1.85);
            }
            else
            {
                //only slighty brighten color text
                brighterColor = RGBHSL.ModifyBrightness(chatLine.Color, 1.25);
            }

            return(brighterColor);
        } // @ internal static Color BrightenColor(FFACE.ChatTools.ChatLine chatLine)
Ejemplo n.º 2
0
        public Paragraph ProcessLine(FFACE.ChatTools.ChatLine chatline, Paragraph para)
        {
            if (para == null)
            {
                throw new ArgumentNullException("para");
            }

            if (!_filters.Contains(chatline.Type) && _filters.Count != 0)
            {
                return(null);
            }

            para = new Paragraph();
            var range = new TextRange(para.ContentStart, para.ContentEnd);

            range.Text += "(" + ((int)chatline.Type).ToString("X2") + ")";
            range.Text += chatline.Now;

            range.ApplyPropertyValue(TextElement.ForegroundProperty, Brushes.SteelBlue);
            range.ApplyPropertyValue(TextElement.FontWeightProperty, System.Windows.FontWeights.Bold);
            var endOfPrefix = range.End;

            para.Inlines.Add(chatline.Text);
            range = new TextRange(endOfPrefix, para.ContentEnd);
            range.ApplyPropertyValue(TextElement.ForegroundProperty, ChatColorConverter(chatline.Color));
            range.ApplyPropertyValue(TextElement.FontWeightProperty, System.Windows.FontWeights.Bold);
            para.LineHeight = 0.5;
            return(para);
        }
Ejemplo n.º 3
0
        private void AddLine(FFACE.ChatTools.ChatLine line)
        {
            var para = new Paragraph();

            para = ProcessLine(line, para);
            if (para != null)
            {
                ChatLog.Blocks.Add(para);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 取得したヒントをBoxクラスへセットする
        /// </summary>
        /// <param name="iBox"></param>
        private void setChatToBox(Box iBox)
        {
            FFACE.ChatTools.ChatLine cl = new FFACE.ChatTools.ChatLine();
            ArrayList al = new ArrayList();

            cl = _FFACE.Chat.GetNextLine(LineSettings.CleanAll);
            while (cl != null)
            {
                al.Add(cl.Text);
                cl = _FFACE.Chat.GetNextLine(LineSettings.CleanAll);
            }
            iBox.SetHints(al);
        }
Ejemplo n.º 5
0
        public ChatLine(FFACE.ChatTools.ChatLine line)
        {
            if (line == null)
            {
                IsEmptyOrNull = true;
                return;
            }
            this.Line = line;

            var argb = System.Windows.Media.Color.FromArgb(line.Color.A, line.Color.R, line.Color.G, line.Color.B);

            this.Color = new SolidColorBrush(argb);

            this.Text = line.Text;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// キーナンバー99 箱空け処理
        /// </summary>
        /// <returns></returns>
        private Constant.MumStartRet StartMum()
        {
            FFACE.ChatTools.ChatLine cl = new FFACE.ChatTools.ChatLine();
            Constant.MumGameInfo     gi = _Constant.GetMumGameInfo(_Settings.MumGameId);
            Box box           = new Box(gi.Id);
            int boxOpenRemain = _Settings.MumTryCount;

            SetMessage("MUM箱空け実行中");
            while (Running)
            {
                //どうする?
                if (_FFACE.Menu.IsOpen && MiscTools.IsRegexString(_FFACE.Menu.DialogText.Question, Constant.DialogStringMum1))
                {
                    box = new Box(gi.Id);
                    SetTextboxText(txtTargets, box.EnableNoLine);
                    switch (gi.Type)
                    {
                    case Constant.MumGameType.BAYLD:
                        if (!SetDialogOptionIndex(1, true))
                        {
                            return(Constant.MumStartRet.異常終了);
                        }
                        break;

                    case Constant.MumGameType.GIL:
                        if (!SetDialogOptionIndex(2, true))
                        {
                            return(Constant.MumStartRet.異常終了);
                        }
                        break;
                    }
                    if (!WaitOpenDialog(Constant.DialogStringMum2, false))
                    {
                        return(Constant.MumStartRet.異常終了);
                    }
                }
                //難易度を選択してください((.*):([0-9]*))
                if (_FFACE.Menu.IsOpen && MiscTools.IsRegexString(_FFACE.Menu.DialogText.Question, Constant.DialogStringMum2))
                {
                    if (!SetDialogOptionIndex(gi.MenuIndex, true))
                    {
                        return(Constant.MumStartRet.異常終了);
                    }
                    if (!WaitOpenDialog(Constant.DialogStringMum3, false))
                    {
                        return(Constant.MumStartRet.異常終了);
                    }
                    box = new Box(gi.Id);
                }
                //どうする?(残り([0-9]*)回)
                if (_FFACE.Menu.IsOpen && MiscTools.IsRegexString(_FFACE.Menu.DialogText.Question, Constant.DialogStringMum3))
                {
                    //残り回数取得
                    if (MiscTools.IsRegexString(_FFACE.Menu.DialogText.Question, Constant.DialogStringMum3))
                    {
                        ArrayList al = MiscTools.GetRegexString(_FFACE.Menu.DialogText.Question, Constant.DialogStringMum3);
                        box.TryRemainCnt = int.Parse(al[0].ToString());
                    }
                    //string[] r = getMatchDialogQuestionValue(Constant.DialogStringMum3);
                    //box.TryRemainCnt = int.Parse(r[1]);
                    //チャットバッファクリア
                    cl = _FFACE.Chat.GetNextLine(LineSettings.CleanAll);
                    //次の操作取得
                    BoxOperation bo = box.GetNextOperation();
                    if (bo.Operation == BoxOperationKind.INPUTNO)
                    {
                        SetMessage("箱操作:" + bo.InputNo.ToString() + "を入力");
                        if (!SetDialogOptionIndex(0, true))
                        {
                            return(Constant.MumStartRet.異常終了);                               //数字を入力するを選択
                        }
                        if (!_Settings.UseEnternity)
                        {
                            System.Threading.Thread.Sleep(_Settings.BaseWait);
                            _FFACE.Windower.SendKeyPress(KeyCode.EnterKey);
                        }
                        if (!InputNumber(bo.InputNo.ToString(), true))
                        {
                            return(Constant.MumStartRet.異常終了);                                          //数字を入力する
                        }
                    }
                    else if (bo.Operation == BoxOperationKind.GETHINTS)
                    {
                        SetMessage("箱操作:カギを調べる");
                        if (!SetDialogOptionIndex(1, true))
                        {
                            return(Constant.MumStartRet.異常終了);                               //カギを調べるを選択
                        }
                    }
                    //else if (bo.Operation == BoxOperationKind.FINISHED)
                    //{
                    //    return Constant.MumStartRet.正常終了;
                    //}
                    System.Threading.Thread.Sleep(_Settings.NumberInputWait);
                    setChatToBox(box);
                    SetTextboxText(txtTargets, box.EnableNoLine);

                    //箱空け完了かの判断
                    bo = box.GetNextOperation();
                    if (bo.Operation == BoxOperationKind.OPENSUCCESS ||
                        bo.Operation == BoxOperationKind.OPENFAILED)
                    {
                        //残り回数の判定
                        boxOpenRemain--;
                        if (_Settings.MumTryCount != 0)
                        {
                            if (boxOpenRemain > 0)
                            {
                                if (bo.Operation == BoxOperationKind.OPENSUCCESS)
                                {
                                    SetMessage("箱空け成功 残り回数:" + boxOpenRemain);
                                }
                                else
                                {
                                    SetMessage("箱空け失敗 残り回数:" + boxOpenRemain);
                                }
                            }
                        }
                    }
                }
                //もう1度やりますか?
                if (_FFACE.Menu.IsOpen && MiscTools.IsRegexString(_FFACE.Menu.DialogText.Question, Constant.DialogStringMum4))
                {
                    //規定回数開けてたら終了
                    if (_Settings.MumTryCount != 0 &&
                        boxOpenRemain <= 0)
                    {
                        SetMessage("規定回数に達したので停止しました");
                        if (!SetDialogOptionIndex(0, true))
                        {
                            return(Constant.MumStartRet.異常終了);
                        }
                        return(Constant.MumStartRet.指定回数実行);
                    }
                    box = new Box(gi.Id);
                    SetTextboxText(txtTargets, box.EnableNoLine);
                    switch (gi.Type)
                    {
                    case Constant.MumGameType.BAYLD:
                        if (!SetDialogOptionIndex(1, true))
                        {
                            return(Constant.MumStartRet.異常終了);
                        }
                        break;

                    case Constant.MumGameType.GIL:
                        if (!SetDialogOptionIndex(2, true))
                        {
                            return(Constant.MumStartRet.異常終了);
                        }
                        break;
                    }
                    if (!WaitOpenDialog(Constant.DialogStringMum3, false))
                    {
                        return(Constant.MumStartRet.異常終了);
                    }
                }

                System.Threading.Thread.Sleep(_Settings.BaseWait);
            }
            return(Constant.MumStartRet.正常終了);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// フィールド箱空け処理
        /// </summary>
        /// <returns>True:正常終了 False:異常終了</returns>
        private Boolean StartField()
        {
            FFACE.ChatTools.ChatLine cl = new FFACE.ChatTools.ChatLine();
            Constant.MumGameInfo     gi = _Constant.GetMumGameInfo(_Settings.MumGameId);
            Box box           = new Box(BoxTypeKind.Field);
            int boxOpenRemain = _Settings.MumTryCount;
            int targetId      = _FFACE.Target.ID;

            SetMessage("FOV・GOV箱空け実行中");
            while (Running)
            {
                //どうする?
                if (_FFACE.Menu.IsOpen && MiscTools.IsRegexString(_FFACE.Menu.DialogText.Question, Constant.DialogStringField1))
                {
                    //開錠するを選択
                    if (!SetDialogOptionIndex(1, true))
                    {
                        return(false);
                    }
                    if (!WaitOpenDialog(Constant.DialogStringField2, false))
                    {
                        return(false);
                    }
                }
                //どうする?(残り([0-9]*)回)
                if (_FFACE.Menu.IsOpen && MiscTools.IsRegexString(_FFACE.Menu.DialogText.Question, Constant.DialogStringField2))
                {
                    //残り回数取得
                    if (MiscTools.IsRegexString(_FFACE.Menu.DialogText.Question, Constant.DialogStringField2))
                    {
                        ArrayList al = MiscTools.GetRegexString(_FFACE.Menu.DialogText.Question, Constant.DialogStringField2);
                        box.TryRemainCnt = int.Parse(al[0].ToString());
                    }
                    //string[] r = getMatchDialogQuestionValue(Constant.DialogStringMum3);
                    //box.TryRemainCnt = int.Parse(r[1]);
                    //チャットバッファクリア
                    cl = _FFACE.Chat.GetNextLine(LineSettings.CleanAll);
                    //次の操作取得
                    BoxOperation bo = box.GetNextOperation();
                    if (bo.Operation == BoxOperationKind.INPUTNO)
                    {
                        SetMessage("箱操作:" + bo.InputNo.ToString() + "を入力");
                        if (!SetDialogOptionIndex(1, true))
                        {
                            return(false);                               //数字を入力するを選択
                        }
                        if (!_Settings.UseEnternity)
                        {
                            System.Threading.Thread.Sleep(_Settings.BaseWait);
                            _FFACE.Windower.SendKeyPress(KeyCode.EnterKey);
                        }
                        if (!InputNumber(bo.InputNo.ToString(), true))
                        {
                            return(false);                                          //数字を入力する
                        }
                    }
                    else if (bo.Operation == BoxOperationKind.GETHINTS)
                    {
                        SetMessage("箱操作:カギを調べる");
                        if (!SetDialogOptionIndex(2, true))
                        {
                            return(false);                               //カギを調べるを選択
                        }
                    }
                    System.Threading.Thread.Sleep(_Settings.NumberInputWait);
                    setChatToBox(box);
                    SetTextboxText(txtTargets, box.EnableNoLine);

                    //箱空け完了かの判断
                    bo = box.GetNextOperation();
                    if (bo.Operation == BoxOperationKind.OPENSUCCESS)
                    {
                        SetMessage("箱開けに成功しました");
                        return(true);
                    }
                    else if (bo.Operation == BoxOperationKind.OPENFAILED)
                    {
                        SetMessage("箱開けに失敗しました");
                        return(true);
                    }
                    else
                    {
                        //箱をターゲットする
                        if (!SetTargetFromId(targetId))
                        {
                            return(false);
                        }
                        _FFACE.Windower.SendKeyPress(KeyCode.EnterKey);//ENTER
                        if (!WaitOpenDialog(Constant.DialogStringField1, true))
                        {
                            return(false);
                        }
                    }
                }
                System.Threading.Thread.Sleep(_Settings.BaseWait);
            }
            return(true);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Grab all new chat lines and put them in the appropriate List<>s,
        /// Increase line added counters as chat lines are added to a List<>,
        /// Keep the List<>s to a maximum size
        /// </summary>
        /// <returns>
        /// How many lines were added at the beginning of the chatLog
        /// so we know how many to parse through for the logs
        /// </returns>
        internal static int NewChat()
        {
            currentLine = FishingForm._FFACE.Chat.GetNextLine();

            while (currentLine != null)
            //while (!string.IsNullOrEmpty(currentLine.Text))
            {
                if (ChatMode.Error != currentLine.Type)
                {
                    chatLog.Insert(0, currentLine);
                    chatLogAdded++;

                    switch (currentLine.Type)
                    {
                    case ChatMode.FishObtained:
                    case ChatMode.FishResult:
                        fishLog.Insert(0, currentLine);
                        fishLogAdded++;
                        break;

                    case ChatMode.SentParty:
                    case ChatMode.RcvdParty:
                        partyLog.Insert(0, currentLine);
                        partyLogAdded++;
                        break;

                    case ChatMode.SentSay:
                    case ChatMode.RcvdSay:
                        sayLog.Insert(0, currentLine);
                        sayLogAdded++;
                        break;

                    case ChatMode.SentLinkShell:
                    case ChatMode.RcvdLinkShell:
                        shellLog.Insert(0, currentLine);
                        shellLogAdded++;
                        break;

                    case ChatMode.SentTell:
                    case ChatMode.RcvdTell:
                        tellLog.Insert(0, currentLine);
                        tellLogAdded++;
                        break;

                    default:
                        break;
                    }

                    currentLine = FishingForm._FFACE.Chat.GetNextLine();
                }
                else
                {
                    return(-1);  //ChatMode.Error - try to recover
                }
            }

            //only need to trim the logs if something was added
            if (0 < chatLogAdded)
            {
                TrimLogs();
            }

            return(chatLogAdded);
        } // @ internal static int NewChat()
Ejemplo n.º 9
0
        } // @ private static void Clear()

        /// <summary>
        /// Brighten a color from a chat log color
        /// </summary>
        /// <param name="chatLine">Chat line to extract a brightened color from</param>
        /// <returns>Brightened color</returns>
        internal static Color BrightenColor(FFACE.ChatTools.ChatLine chatLine)
        {
            return(BrightenColor(chatLine.Color));
        }
Ejemplo n.º 10
0
 public bool ParseLine(FFACE.ChatTools.ChatLine line)
 {
     Result = Condition.Match(line.Text);
     return(Completed = Condition.IsMatch(line.Text));
 }