Exemple #1
0
 public ScriptingObject(CraftWindow craftWindow)
 {
     Craftwindow = craftWindow;
     CraftStep = 0;
 }
        public void DoWork()
        {
            List<Character> monsters = new List<Character>();
            List<Character> fate = new List<Character>();
            List<Character> players = new List<Character>();
            Character user = null;
            int craftAmount = 0;

            _status = StatusEnum.Initializing;

            MemoryFunctions.GetCharacters(monsters, fate, players, ref user);

            while (craftAmount < MaxCrafts)
            {
                user.Refresh();
                Debug.Print(user.Status.ToString() + "  -  " + user.Status.ToString("X"));

                if(Paused)
                    continue;

                if ((user.Status == CharacterStatus.Idle || user.Status == CharacterStatus.Crafting_Idle || user.Status == CharacterStatus.Crafting_Idle2) && user.IsCrafting == false)
                {
                    CraftWindow craftwindow = new CraftWindow();

                    while (craftwindow.RefreshPointers() == false)
                    {
                        Utilities.Keyboard.KeyBoardHelper.KeyPress(Keys.NumPad0);
                        Thread.Sleep(350);
                    }

                    Thread.Sleep(200);

                    if (ScriptMode)
                    {
                        CraftAi.Craftwindow = craftwindow;
                        CraftAi.Synth();
                    }
                    else
                    {
                        foreach (CraftingKey keyCondition in _keyConditions)
                        {

                            while(Paused){
                                Thread.Sleep(250);
                            }

                            if (craftwindow.RefreshPointers() == false)
                                break;

                            user.Refresh();
                            craftwindow.Refresh();

                            if (craftwindow.CurrProgress == craftwindow.MaxProgress)
                                break;

                            if (keyCondition.CPCondition)
                            {
                                if (user.CurrentCP < keyCondition.CP)
                                    continue;
                            }

                            if (keyCondition.DurabilityCondition)
                            {
                                if (craftwindow.CurrDurability <= keyCondition.Durability)
                                    continue;
                            }

                            if (keyCondition.ProgressCondition)
                            {
                                if (craftwindow.CurrProgress > keyCondition.Progress)
                                    continue;
                            }

                            if (keyCondition.ConditionCondition)
                            {
                                if (craftwindow.Condition.Trim().ToLower() == keyCondition.Condition.Trim().ToLower())
                                    continue;
                            }

                            // Utilities.Keyboard.KeyBoardHelper.KeyPress(keyCondition.Key);
                            WaitForAbility(user, keyCondition.Key, keyCondition.ControlKey);

                        }
                    }

                    while (craftwindow.RefreshPointers())
                    {
                        Thread.Sleep(250);
                    }

                    craftAmount++;

                }

                Thread.Sleep(500);
            }
        }