Exemplo n.º 1
0
        public bool Check_Produce_Formula(int User, ref Form1.uInfo.Action_Sequence _Action_Sequence, bool Use)
        {
            //檢查已初始化的配方
            for (int i = 0; i < Form1.UsingProcess[User]._Item.BookNum; i++)
            {
                //配方已初始化
                if (Form1.UsingProcess[User]._Item._BookInfo[i].Formula_Init)
                {
                    //檢查配方內容
                    for (int Formula_Index = 0; Formula_Index < Form1.UsingProcess[User]._Item._BookInfo[i]._FormulaInfo.Length; Formula_Index++)
                    {
                        if (Form1.UsingProcess[User]._Item._BookInfo[i]._FormulaInfo[Formula_Index].Formula_Name == _Action_Sequence.Formula_Name)
                        {
                            _Action_Sequence.Book_Name = Form1.UsingProcess[User]._Item._BookInfo[i].Name;

                            if (Use)
                            {
                                if (Form1.UsingProcess[User].TimeCount > 1)
                                {
                                    Call.UseItem(Form1.UsingProcess[User].hWnd, Form1.UsingProcess[User]._Item._BookInfo[i].Code);
                                    Form1.UsingProcess[User].TimeCount = 0;
                                }
                            }
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
Exemplo n.º 2
0
        private void timer2_Tick(object sender, EventArgs e)
        {
            for (int User = 0; User < 5; User++)
            {
                if (UserComboBox.Text == "﹝" + Form1.UsingProcess[User].ServerName + "﹞" + Form1.UsingProcess[User].Name)
                {
                    timer2.Stop();
                    bool Init = true;
                    //檢查未初始化的配方
                    for (int i = 0; i < Form1.UsingProcess[User]._Item.BookNum; i++)
                    {
                        //配方未初始化
                        if (!Form1.UsingProcess[User]._Item._BookInfo[i].Formula_Init)
                        {
                            Init = false;
                        }
                    }

                    if (!Init)
                    {
                        Form1.uInfo.Action_Sequence Produce_Sequence = new Form1.uInfo.Action_Sequence();
                        Produce_Sequence.Formula_Name = "初始化";
                        new CityCall().Produce(User, ref Produce_Sequence);
                        timer2.Start();
                    }
                    else
                    {
                        Init_Button.Text = "初始化完成";
                        for (int i = 0; i < Form1.UsingProcess[User]._Item.BookNum; i++)
                        {
                            //配方未初始化
                            if (Form1.UsingProcess[User]._Item._BookInfo[i].Formula_Init)
                            {
                                Console.WriteLine("[" + Form1.UsingProcess[User]._Item._BookInfo[i].Name + "]");
                                for (int j = 0; j < Form1.UsingProcess[User]._Item._BookInfo[i]._FormulaInfo.Length; j++)
                                {
                                    Console.WriteLine(Form1.UsingProcess[User]._Item._BookInfo[i]._FormulaInfo[j].ID + "=" + Form1.UsingProcess[User]._Item._BookInfo[i]._FormulaInfo[j].Formula_Name);
                                }
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        public bool Produce(int User, ref Form1.uInfo.Action_Sequence _Action_Sequence)
        {
            if (Call.GetBattleStatus(Form1.UsingProcess[User].hWnd) < 5)
            {
            }

            switch (Call.CheckWindows(Form1.UsingProcess[User].hWnd))
            {
            case null:
            case "物品欄":
                if (!Check_Produce_Formula(User, ref _Action_Sequence, true))
                {
                    //檢查未初始化的配方
                    for (int i = 0; i < Form1.UsingProcess[User]._Item.BookNum; i++)
                    {
                        //配方未初始化
                        if (!Form1.UsingProcess[User]._Item._BookInfo[i].Formula_Init)
                        {
                            if (Form1.UsingProcess[User].TimeCount > 2)
                            {
                                Call.UseItem(Form1.UsingProcess[User].hWnd, Form1.UsingProcess[User]._Item._BookInfo[i].Code);
                                Form1.UsingProcess[User].TimeCount = 0;
                            }
                        }
                    }
                }
                break;

            case "選擇配方":
                if (Call.GetFormula(Form1.UsingProcess[User].hWnd, ref Form1.UsingProcess[User]._Item))
                {
                    if (string.IsNullOrWhiteSpace(_Action_Sequence.Book_Name))
                    {
                        //讀取配方資料
                        if (!Check_Produce_Formula(User, ref _Action_Sequence, false))
                        {
                            Call.CloseWindows(Form1.UsingProcess[User].hWnd);
                        }
                    }
                    else
                    {
                        if (Call.GetBookName(Form1.UsingProcess[User].hWnd) != _Action_Sequence.Book_Name)
                        {
                            Call.CloseWindows(Form1.UsingProcess[User].hWnd);
                        }
                        else
                        {
                            for (int i = 0; i < Form1.UsingProcess[User]._Item.BookNum; i++)
                            {
                                if (Form1.UsingProcess[User]._Item._BookInfo[i].Name == _Action_Sequence.Book_Name && Form1.UsingProcess[User]._Item._BookInfo[i].Formula_Init)
                                {
                                    for (int j = 0; j < Form1.UsingProcess[User]._Item._BookInfo[i]._FormulaInfo.Length; j++)
                                    {
                                        if (Form1.UsingProcess[User]._Item._BookInfo[i]._FormulaInfo[j].Formula_Name == _Action_Sequence.Formula_Name)
                                        {
                                            Call.SelectFormula(Form1.UsingProcess[User].hWnd, j);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                break;

            case "生產":
                if (_Action_Sequence.Formula_Name != Call.GetFormulaName(Form1.UsingProcess[User].hWnd))
                {
                    Call.CloseWindows(Form1.UsingProcess[User].hWnd);
                }
                else
                {
                    if (!Call.GetProduceState(Form1.UsingProcess[User].hWnd))
                    {
                        Call.Produce_Continuous(Form1.UsingProcess[User].hWnd);
                        Form1.UsingProcess[User].TimeCount = 0;
                    }
                    else
                    {
                        if (Form1.UsingProcess[User].Power < 5)
                        {
                            _Action_Sequence.Recovery_Power = true;
                            Call.CloseWindows(Form1.UsingProcess[User].hWnd);
                        }
                        else if (Form1.UsingProcess[User].TimeCount > 3 && !Call.GetProduceBoxState(Form1.UsingProcess[User].hWnd))
                        {
                            return(true);
                        }
                    }
                }
                break;

            default:
                Call.CloseWindows(Form1.UsingProcess[User].hWnd);
                break;
            }
            return(false);
        }