Пример #1
0
        public DronesContoller(IMemoryMeasurement memoryMeasurement)
        {
            var droneListView = memoryMeasurement?.WindowDroneView?.FirstOrDefault()?.ListView;

            var droneGroupWithNameMatchingPattern = new Func <string, DroneViewEntryGroup>(namePattern =>
                                                                                           droneListView?.Entry?.OfType <DroneViewEntryGroup>()?.FirstOrDefault(group =>
                                                                                                                                                                group?.LabelTextLargest()?.Text?.RegexMatchSuccessIgnoreCase(namePattern) ?? false));

            var droneGroupInBay        = droneGroupWithNameMatchingPattern("bay");
            var droneGroupInLocalSpace = droneGroupWithNameMatchingPattern("local space");

            droneInBayCount        = droneGroupInBay?.Caption?.Text?.CountFromDroneGroupCaption() ?? 0;
            droneInLocalSpaceCount = droneGroupInLocalSpace?.Caption?.Text?.CountFromDroneGroupCaption() ?? 0;

            //	assuming that local space is bottommost group.
            var setDroneInLocalSpace =
                droneListView?.Entry?.OfType <DroneViewEntryItem>()
                ?.Where(drone => droneGroupInLocalSpace?.RegionCenter()?.B < drone?.RegionCenter()?.B)
                ?.ToArray();

            droneInLocalSpaceSetStatus =
                setDroneInLocalSpace
                ?.Select(drone => drone?.LabelText?.Select(label => label?.Text?.StatusStringFromDroneEntryText()))
                ?.ConcatNullable()?.WhereNotDefault()?.Distinct()?.ToArray();
        }
Пример #2
0
        static public BotEngine.EveOnline.Interface.MemoryStruct.UtilmenuMission AsOldUtilmenuMission(
            this IContainer container,
            Sanderling.Parse.IMemoryMeasurement measurement)
        {
            if (container == null)
            {
                return(null);
            }

            var buttonReadDetails       = container?.LabelText?.FirstOrDefault(c => c?.Text?.RegexMatchSuccessIgnoreCase("read details") ?? false);
            var buttonStartConversation = container?.LabelText?.FirstOrDefault(c => c?.Text?.RegexMatchSuccessIgnoreCase("start conversation") ?? false);

            if (buttonReadDetails == null && buttonStartConversation == null)
            {
                return(null);                   //	assume it is not a mission utilmenu
            }
            var labelTopmost = container?.LabelText?.OrderByCenterVerticalDown()?.FirstOrDefault();

            //	header is not contained in container, take the label which was most likely clicked to open the menu.
            //	search for this label by distance to UIElement contained in menu while assuming that the menu is opened under the clicked label.
            var listUIElementTextWithDistance =
                measurement?.EnumerateReferencedUIElementTransitive()?.OfType <IUIElementText>()?.Select(c =>
            {
                var leftDist   = c.Region.Min0 - labelTopmost.Region.Min0;
                var heightDist = c.Region.Max1 - labelTopmost.Region.Min1;

                return(new
                {
                    uiElement = c,
                    dist = new[] { leftDist, heightDist }.Select(dist => Math.Abs(dist)).Max(),
                });
            })
                ?.OrderBy(c => c.dist)
                ?.Take(4)
                ?.ToArray();

            var header = listUIElementTextWithDistance?.FirstOrDefault(c => c.dist <= 4)?.uiElement;

            var listLocationBottom =
                new[] { buttonReadDetails, buttonStartConversation }.WhereNotDefault().Select(elem => elem.Region.Min1).Min();

            var listLocationListUIElement =
                new[]
            {
                (IEnumerable <IUIElement>)container?.LabelText,
                container?.ButtonText,
                container?.Sprite,
            }
            .ConcatNullable().WhereNotDefault()
            .Where(elem => elem.Region.Max1 <= listLocationBottom)
            .OrderByCenterVerticalDown()
            .ToArray();

            var listLocation = new List <BotEngine.EveOnline.Interface.MemoryStruct.UtilmenuMissionLocationInfo>();

            var inLocationListElement = new List <IUIElement>();

            var locationConstruct = new Action(() =>
            {
                if (inLocationListElement.Count < 1)
                {
                    return;
                }

                var labelMatching = new Func <string, IUIElementText>(pattern =>
                                                                      inLocationListElement.OfType <IUIElementText>().FirstOrDefault(elem => elem.Text?.RegexMatchSuccessIgnoreCase(pattern) ?? false));

                var buttonLocation = inLocationListElement.OfType <IUIElementText>()?.FirstOrDefault(c => c?.Text?.RegexMatchSuccessIgnoreCase(@"url=showinfo:\d") ?? false);

                listLocation.Add(new BotEngine.EveOnline.Interface.MemoryStruct.UtilmenuMissionLocationInfo
                {
                    ButtonApproach       = labelMatching("approach").AsOldUIElementLabelString(),
                    ButtonDock           = labelMatching("dock").AsOldUIElementLabelString(),
                    ButtonSetDestination = labelMatching("set destination").AsOldUIElementLabelString(),
                    ButtonWarpTo         = labelMatching("warp to").AsOldUIElementLabelString(),

                    HeaderLabel    = inLocationListElement.OfType <IUIElementText>()?.FirstOrDefault().Text,
                    ButtonLocation = buttonLocation?.WithText(UtilmenuMission_AusAstLocationTextLocationName(buttonLocation?.Text)?.Trim()).AsOldUIElementLabelString(),
                });

                inLocationListElement.Clear();
            });

            //	group UIElements into locations.
            foreach (var elem in listLocationListUIElement)
            {
                if ((elem as IUIElementText)?.Text?.RegexMatchSuccessIgnoreCase(@"(objective|encounter)") ?? false)
                {
                    locationConstruct();
                }

                inLocationListElement.Add(elem);
            }

            locationConstruct();

            return(new BotEngine.EveOnline.Interface.MemoryStruct.UtilmenuMission(container.AsOldUIElement())
            {
                ButtonReadDetails = buttonReadDetails?.AsOldUIElementLabelString(),
                ButtonStartConversation = buttonStartConversation?.AsOldUIElementLabelString(),
                Header = header.AsOldUIElementLabelString(),
                Location = listLocation?.ToArray(),
            });
        }
Пример #3
0
 public static bool ManeuverStartPossible(this Sanderling.Parse.IMemoryMeasurement memoryMeasurement) =>
     !(memoryMeasurement?.IsDocked ?? false) &&
     !new[] { ShipManeuverTypeEnum.Warp, ShipManeuverTypeEnum.Jump, ShipManeuverTypeEnum.Docked }.Contains(
         memoryMeasurement?.ShipUi?.Indication?.ManeuverType ?? ShipManeuverTypeEnum.None);