private void ClickAndGetResources(Bot.Location location)
        {
            var t = new Touch(new NoOpLogger());
            CommerceResourceReader reader = new CommerceResourceReader(new NoOpLogger(), t);

            var palleteReader = new TwoColourPallette();

            pictureBox1.Image  = null;
            pictureBox2.Image  = null;
            pictureBox3.Image  = null;
            this.textBox1.Text = string.Empty;
            this.textBox2.Text = string.Empty;
            this.textBox3.Text = string.Empty;

            var images = reader.GetResourceImages(location, resourceLocations);

            pictureBox1.Image = images[0];
            var required = palleteReader.GetClosest2Colours(images[0]).Contains("Red");

            this.textBox1.Text = required ? "Required" : "Ok";

            if (images.Count > 1)
            {
                pictureBox2.Image  = images[1];
                required           = palleteReader.GetClosest2Colours(images[1]).Contains("Red");
                this.textBox2.Text = required ? "Required" : "Ok";
            }

            if (images.Count > 2)
            {
                pictureBox3.Image  = images[2];
                required           = palleteReader.GetClosest2Colours(images[2]).Contains("Red");
                this.textBox3.Text = required ? "Required" : "Ok";
            }
        }
Beispiel #2
0
 public TestForm()
 {
     InitializeComponent();
     log                = new LogToText(this.txtLog, this);
     touch              = new Touch(log);
     buildingSelector   = new BuildingSelector(log, touch);
     captureScreen      = new CaptureScreen(log);
     tradeWindow        = new TradeWindow(captureScreen, log);
     navigateToBuilding = new NavigateToBuilding(log, touch, buildingSelector, tradeWindow);
     resourceReader     = new CommerceResourceReader(log, touch);
     buildItemList      = CommerceItemBuild.CreateResourceList();
 }
Beispiel #3
0
        public BuyForm()
        {
            InitializeComponent();

            log = new NoOpLogger();


            touch              = new Touch(log);
            captureScreen      = new CaptureScreen(new NoOpLogger(), touch);
            resourceReader     = new CommerceResourceReader(log, touch);
            buildingSelector   = new BuildingSelector(log, touch);
            tradeWindow        = new TradeWindow(captureScreen, log);
            tradePanelCapture  = new TradePanelCapture(tradeWindow);
            navigateToBuilding = new NavigateToBuilding(log, touch, buildingSelector, tradeWindow);
            buildItemList      = CommerceItemBuild.CreateResourceList();

            tradeWindow.PictureBox = this.pictureBox1;

            var pictureBoxes = new List <PictureBox>();
            var textBoxes    = new List <TextBox>();

            pictureBoxes.Add(this.pb1);
            pictureBoxes.Add(this.pb2);
            pictureBoxes.Add(this.pb3);
            pictureBoxes.Add(this.pb4);
            pictureBoxes.Add(this.pb5);
            pictureBoxes.Add(this.pb6);
            pictureBoxes.Add(this.pb7);
            pictureBoxes.Add(this.pb8);

            textBoxes.Add(this.tb1);
            textBoxes.Add(this.tb2);
            textBoxes.Add(this.tb3);
            textBoxes.Add(this.tb4);
            textBoxes.Add(this.tb5);
            textBoxes.Add(this.tb6);
            textBoxes.Add(this.tb7);
            textBoxes.Add(this.tb8);

            itemHashes = new ItemHashes(pictureBoxes, textBoxes);

            LoadShoppingLists();

            salesman  = new Salesman(touch, tradeWindow, tradePanelCapture, itemHashes, navigateToBuilding, log);
            craftsman = new Craftsman(log, buildingSelector, navigateToBuilding, touch, resourceReader, buildItemList);
        }
Beispiel #4
0
        public BotForm()
        {
            InitializeComponent();
            log              = new LogToText(this.txtLog, this);
            touch            = new Touch(log);
            buildingSelector = new BuildingSelector(log, touch);

            captureScreen = new CaptureScreen(log);
            tradeWindow   = new TradeWindow(captureScreen, log);

            navigateToBuilding = new NavigateToBuilding(log, touch, buildingSelector, tradeWindow);
            resourceReader     = new CommerceResourceReader(log, touch);
            buildItemList      = CommerceItemBuild.CreateResourceList();
            tradePanelCapture  = new TradePanelCapture(tradeWindow);

            itemHashes = new ItemHashes(new List <PictureBox>(), new List <TextBox>());
            itemHashes.ReadHashes();
            salesman = new Salesman(touch, tradeWindow, tradePanelCapture, itemHashes, navigateToBuilding, log);

            craftsman = new Craftsman(log, buildingSelector, navigateToBuilding, touch, resourceReader, buildItemList);
        }
Beispiel #5
0
        private void btnAroundPosition_Click(object sender, EventArgs e)
        {
            var t = new Touch(new NoOpLogger());
            CommerceResourceReader reader = new CommerceResourceReader(new NoOpLogger(), t);


            //pallete1.Entries.ToList().ForEach(s => textBox1.Text += GetClosestColor(colors, s) + ", ");

            var palleteReader = new TwoColourPallette();

            pictureBox1.Image  = null;
            pictureBox2.Image  = null;
            pictureBox3.Image  = null;
            this.textBox1.Text = string.Empty;
            this.textBox2.Text = string.Empty;
            this.textBox3.Text = string.Empty;

            var images = reader.GetResourceImages(Bot.Location.ButtonLeftInner1, resourceLocations);

            pictureBox1.Image = images[0];
            var required = palleteReader.GetClosest2Colours(images[0]).Contains("Red");

            this.textBox1.Text = required ? "Required" : "Ok";

            if (images.Count > 1)
            {
                pictureBox2.Image  = images[1];
                required           = palleteReader.GetClosest2Colours(images[1]).Contains("Red");
                this.textBox2.Text = required ? "Required" : "Ok";
            }

            if (images.Count > 2)
            {
                pictureBox3.Image  = images[2];
                required           = palleteReader.GetClosest2Colours(images[2]).Contains("Red");
                this.textBox3.Text = required ? "Required" : "Ok";
            }
        }