示例#1
0
        public bool ValidateAction()
        {
            if (ProcessingObject == null)
            {
                return(false);
            }

            var actionProcessing = ActionProcessingObjectTypes == null
               ? new List <Type>()
               : new List <Type>(ActionProcessingObjectTypes);

            if ((FormComponents & FormComponents.Menu) == FormComponents.Menu)
            {
                actionProcessing.Add(typeof(ICustomBarManager));
            }
            if ((FormComponents & FormComponents.Components) == FormComponents.Components &&
                !(ProcessingObject is ICustomBarManager) && !(ProcessingObject is Window))
            {
                actionProcessing.Add(ProcessingObject.GetType());
            }
            if ((FormComponents & FormComponents.FormSize) == FormComponents.FormSize ||
                (FormComponents & FormComponents.FormPosition) == FormComponents.FormPosition)
            {
                actionProcessing.Add(typeof(Window));
            }

            var result = ValidateActionProcessing(actionProcessing);

            if (!result)
            {
                return(false);
            }

            var doNotActionProcessing = DoNotActionProcessingObjectTypes == null
                ? new List <Type>()
                : new List <Type>(DoNotActionProcessingObjectTypes);

            if ((FormComponents & FormComponents.Menu) != FormComponents.Menu)
            {
                doNotActionProcessing.Add(typeof(ICustomBarManager));
            }
            if ((FormComponents & FormComponents.Components) != FormComponents.Components &&
                !(ProcessingObject is ICustomBarManager) && !(ProcessingObject is Window))
            {
                doNotActionProcessing.Add(ProcessingObject.GetType());
            }
            if ((FormComponents & FormComponents.FormSize) != FormComponents.FormSize &&
                (FormComponents & FormComponents.FormPosition) != FormComponents.FormPosition)
            {
                doNotActionProcessing.Add(typeof(Window));
            }

            return(!doNotActionProcessing.Any() || !ValidateActionProcessing(doNotActionProcessing));
        }
示例#2
0
        private void doItemTransfer()
        {
            foreach (var item in Collection.Actors.Local.PlayerData.Inventory.Items)
            {
                if (CurrentProcessingItem.ResultItemIds.Contains((int)item.x0000_PTR_ItemData.ItemIndex))
                {
                    item.SendToWarehouse(item.x0008_ItemCount);
                }
            }

            CurrentProcessingItem = null;
            isProcessing          = false;
        }
示例#3
0
        private void doProcessing()
        {
            var warehouse = new CurrentWarehouse().Inventory.Items;

            foreach (var item in Items)
            {
                if (!item.Enabled)
                {
                    continue;
                }

                var wItem = warehouse.FirstOrDefault(x => x.x0008_PTR_ItemData.ItemIndex == item.ItemId);

                if (wItem != null)
                {
                    if (wItem.x0010_ItemCount < item.MinCount)
                    {
                        continue;
                    }

                    Log.Post("WarehouseItem found", LogModule.AutoProcessing);

                    CurrentProcessingItem = item;
                    SlotNo = wItem.SlotNO;
                    break;
                }
            }

            if (CurrentProcessingItem == null)
            {
                Log.Post("No WarehouseItem found", LogModule.AutoProcessing);
                return;
            }

            //while (!Panel_Manufacture.isVisible())
            //{
            //    Pipe.Call.DoString("openManufacture()");

            //    Thread.Sleep(1000);
            //}

            CurrentProcessingItem.InitProcessing(SlotNo, false);

            isProcessing = true;
        }
示例#4
0
        public void Run()
        {
            if (!Enabled)
            {
                return;
            }

            if (!canProcess())
            {
                return;
            }

            if (init && !isWarehouseInRange())
            {
                init                  = false;
                isProcessing          = false;
                CurrentProcessingItem = null;
                _nextRun              = DateTime.Now;
            }


            if (!clear && init)
            {
                clear = true;
            }

            if (DateTime.Now < _nextRun)
            {
                return;
            }

            if (!init && isWarehouseInRange())
            {
                if (Panel_Manufacture.isVisible())
                {
                    Log.Post("Init", LogModule.AutoProcessing);

                    Thread.Sleep(1000);

                    init  = true;
                    clear = false;

                    //Collection.Actors.Local.PlayerData.doAction("WAIT");
                    //Thread.Sleep(200);
                }
            }

            if (init)
            {
                if (DateTime.Now <= _lastCheck.AddSeconds(1))
                {
                    return;
                }

                _lastCheck = DateTime.Now;

                if (isIdleAnimation() && !isOverWeight() && CurrentProcessingItem == null && !isProcessing)
                {
                    if (isWarehouseInRange())
                    {
                        Log.Post("Start Processing", LogModule.AutoProcessing);
                        doProcessing();
                    }
                }

                else if (isIdleAnimation() && isOverWeight() && CurrentProcessingItem != null && isProcessing)
                {
                    if (isWarehouseInRange())
                    {
                        Log.Post("Start ItemTransfer - Overweight", LogModule.AutoProcessing);
                        doItemTransfer();
                        _nextRun = DateTime.Now.AddSeconds(Helpers.Timers.RandomTimes.GetRandomSeconds(120, 600));

                        Log.Post("Set new NextRun at " + _nextRun, LogModule.AutoProcessing);
                    }
                }

                else if (isIdleAnimation() && !isOverWeight() && CurrentProcessingItem != null && isProcessing)
                {
                    if (isWarehouseInRange())
                    {
                        Log.Post("Start ItemTransfer - Processing Done", LogModule.AutoProcessing);
                        doItemTransfer();
                        _nextRun = DateTime.Now.AddSeconds(Helpers.Timers.RandomTimes.GetRandomSeconds(120, 600));

                        Log.Post("Set new NextRun at " + _nextRun, LogModule.AutoProcessing);
                    }
                }
            }
        }