private void BuildFactoryItemIfNeeded(FactoryResource resource, IEnumerable <FactoryResource> factoryList) { var alwaysBuildItem = !new List <FactoryResource> { FactoryResource.Plastic, FactoryResource.Metal, FactoryResource.Wood, FactoryResource.Seeds } .Contains(resource); if (factoryList.Contains(resource)) { log.Info("Picking up items"); PickUpItems(); } else { log.Info("Don't need to build " + resource.ToString()); } if (alwaysBuildItem || factoryList.Contains(resource)) { BuildingMatch buildingMatch = buildingSelector.SelectABuilding(", Trying to build " + resource.ToString()); if (buildingMatch != null && buildingMatch.BuildingType == BuildingType.Factory) { var button = GetResourceLocation(resource); touch.Swipe(button, Bot.Location.FactoryQueuePositionStart, Bot.Location.FactoryQueuePositionend, 10, false); } } }
private Bot.Location GetResourceLocation(FactoryResource resource) { switch (resource) { case FactoryResource.Metal: return(Bot.Location.ButtonLeftInner1); case FactoryResource.Wood: return(Bot.Location.ButtonLeftInner2); case FactoryResource.Plastic: return(Bot.Location.ButtonLeftInner3); case FactoryResource.Textiles: return(Bot.Location.ButtonLeftOuter1); case FactoryResource.SugarAndSpices: return(Bot.Location.ButtonLeftOuter2); case FactoryResource.Glass: return(Bot.Location.ButtonLeftOuter3); case FactoryResource.Seeds: return(Bot.Location.ButtonRightInner1); case FactoryResource.Minerals: return(Bot.Location.ButtonRightInner2); case FactoryResource.Chemicals: return(Bot.Location.ButtonRightInner3); } throw new Exception("Unknown factory resource location for " + resource.ToString()); }