Ejemplo n.º 1
0
        static public bool ChatIsClean(Bot bot, WindowChatChannel chatWindow)
        {
            if (null == chatWindow)
            {
                return(false);
            }

            if (chatWindow?.ParticipantView?.Scroll?.IsScrollable() ?? true)
            {
                return(false);
            }

            var listParticipantNeutralOrEnemy =
                chatWindow?.ParticipantView?.Entry
                ?.Where(participant => !(bot.ConfigSerialAndStruct.Value?.CloakyCampers?.Contains(participant?.NameLabel?.Text) ?? false))
                ?.Where(participant => participant.IsNeutralOrEnemy())
                ?.ToArray();

            // Report intel if number of enemies in local is 4+
            var numNeutralOrEnemy = listParticipantNeutralOrEnemy?.Length ?? 0;

            if (numNeutralOrEnemy >= 5)
            {
                var gangCooldownMinutes = bot?.ConfigSerialAndStruct.Value?.GangCooldownMinutes ?? 20;
                var cooldownUntil       = DateTime.UtcNow.AddMinutes(gangCooldownMinutes);
                if (cooldownUntil > bot.saveShipCooldown.AddMinutes(1))
                {
                    bot.saveShipCooldown = cooldownUntil;
                    bot.cooldownReason   = $"{numNeutralOrEnemy - 1} man gang detected! Dock up.☢";
                }
            }

            //	we expect own char to show up there as well so there has to be one participant with neutral or enemy flag.
            return(numNeutralOrEnemy == 1);
        }
Ejemplo n.º 2
0
        public static bool ChatIsClean(WindowChatChannel chatWindow)
        {
            if (null == chatWindow)
            {
                return(false);
            }

            if (chatWindow?.ParticipantView?.Scroll?.IsScrollable() ?? true)
            {
                return(false);
            }

            var listParticipantNeutralOrEnemy =
                chatWindow?.ParticipantView?.Entry?.Where(participant => participant.IsNeutralOrEnemy())?.ToArray();

            //	we expect own char to show up there as well so there has to be one participant with neutral or enemy flag.
            return(1 == listParticipantNeutralOrEnemy?.Length);
        }
        override public void Berecne()
        {
            base.Berecne();

            var AstMainContainer = base.AstMainContainer;

            if (null == AstMainContainer)
            {
                return;
            }

            if (!(true == AstMainContainer.VisibleIncludingInheritance))
            {
                return;
            }

            var mainContainerCenter = AstMainContainer.AsUIElementIfVisible().RegionCenter();

            var scrollNodesWithRegionCenter =
                AstMainContainer.MatchingNodesFromSubtreeBreadthFirst(node => node.PyObjTypNameIsScroll())
                ?.Select(node => (node, regionCenter: node.AsUIElementIfVisible().RegionCenter()))
                ?.ToList();

            //	Assume we find the container of the messages on the left from the center of the window.
            var ViewportSetMessageAst =
                scrollNodesWithRegionCenter
                ?.FirstOrDefault(nodeWithCenter => nodeWithCenter.regionCenter?.A < mainContainerCenter?.A).node;

            //	Assume we find the container of the participants on the right from the center of the window.
            var ViewportSetParticipantAst =
                scrollNodesWithRegionCenter
                ?.FirstOrDefault(nodeWithCenter => mainContainerCenter?.A < nodeWithCenter.regionCenter?.A).node;

            var FunkIsOther = new Func <IObjectIdInMemory, bool>(obj =>
                                                                 !(ViewportSetMessageAst?.EnthaltAstMitHerkunftAdrese(obj.Id) ?? false) &&
                                                                 !(ViewportSetParticipantAst?.EnthaltAstMitHerkunftAdrese(obj.Id) ?? false));

            var LabelOther =
                AstMainContainer.ExtraktMengeLabelString()
                ?.Where(label => FunkIsOther(label))
                ?.OrdnungLabel()
                ?.ToArray();

            if (null != ViewportSetMessageAst)
            {
                ViewportMessageAuswert = new SictAuswertGbsListViewport <IListEntry>(ViewportSetMessageAst, SictAuswertGbsListViewport <IListEntry> .ListEntryKonstruktSctandard);
                ViewportMessageAuswert.Read();
            }

            if (null != ViewportSetParticipantAst)
            {
                ViewportParticipantAuswert = new SictAuswertGbsListViewport <IChatParticipantEntry>(ViewportSetParticipantAst, ListEntryParticipantConstruct);
                ViewportParticipantAuswert.Read();
            }

            var MessageInputAst =
                AstMainContainer
                ?.MatchingNodesFromSubtreeBreadthFirst(node => node?.PyObjTypNameMatchesRegexPattern("EditPlainText") ?? false)
                ?.OrderByDescending(node => node.Grööse?.BetraagQuadriirt ?? -1)
                ?.FirstOrDefault();

            ErgeebnisScpezChatChannel = new WindowChatChannel(
                base.Ergeebnis)
            {
                MessageView     = ViewportMessageAuswert?.Result,
                ParticipantView = ViewportParticipantAuswert?.Result,
                MessageInput    = MessageInputAst?.AsUIElementInputText(),
            };
        }
Ejemplo n.º 4
0
 static public BotEngine.EveOnline.Interface.MemoryStruct.WindowChatChannel AsOld(this WindowChatChannel window) =>
 window == null ? null :
 new BotEngine.EveOnline.Interface.MemoryStruct.WindowChatChannel(window.AsOldWindowBase())
 {
     //	at the moment I guess the bot does not use those anyway.
 };
Ejemplo n.º 5
0
        override public void Berecne()
        {
            base.Berecne();

            var AstMainContainer = base.AstMainContainer;

            if (null == AstMainContainer)
            {
                return;
            }

            if (!(true == AstMainContainer.VisibleIncludingInheritance))
            {
                return;
            }

            var SetScrollAst =
                AstMainContainer.MatchingNodesFromSubtreeBreadthFirst(ast => ast.PyObjTypNameIsScroll())
                ?.ToArray();

            var ViewportSetMessageAst =
                SetScrollAst
                ?.Where(ast => ast?.LaageInParentA < AstMainContainer?.LaageInParentA)
                ?.LargestNodeInSubtree();

            //	userlist isc auf recte saite.
            var ViewportSetParticipantAst =
                SetScrollAst
                ?.Where(ast => AstMainContainer?.LaageInParentA < ast?.LaageInParentA)
                ?.LargestNodeInSubtree();

            var FunkIsOther = new Func <IObjectIdInMemory, bool>(obj =>
                                                                 !(ViewportSetMessageAst?.EnthaltAstMitHerkunftAdrese(obj.Id) ?? false) &&
                                                                 !(ViewportSetParticipantAst?.EnthaltAstMitHerkunftAdrese(obj.Id) ?? false));

            var LabelOther =
                AstMainContainer.ExtraktMengeLabelString()
                ?.Where(label => FunkIsOther(label))
                ?.OrdnungLabel()
                ?.ToArray();

            if (null != ViewportSetMessageAst)
            {
                ViewportMessageAuswert = new SictAuswertGbsListViewport <IListEntry>(ViewportSetMessageAst, SictAuswertGbsListViewport <IListEntry> .ListEntryKonstruktSctandard);
                ViewportMessageAuswert.Read();
            }

            if (null != ViewportSetParticipantAst)
            {
                ViewportParticipantAuswert = new SictAuswertGbsListViewport <IChatParticipantEntry>(ViewportSetParticipantAst, ListEntryParticipantConstruct);
                ViewportParticipantAuswert.Read();
            }

            var MessageInputAst =
                AstMainContainer
                ?.MatchingNodesFromSubtreeBreadthFirst(node => node?.PyObjTypNameMatchesRegexPattern("EditPlainText") ?? false)
                ?.OrderByDescending(node => node.Grööse?.BetraagQuadriirt ?? -1)
                ?.FirstOrDefault();

            ErgeebnisScpezChatChannel = new WindowChatChannel(
                base.Ergeebnis)
            {
                MessageView     = ViewportMessageAuswert?.Result,
                ParticipantView = ViewportParticipantAuswert?.Result,
                MessageInput    = MessageInputAst?.AsUIElementInputText(),
            };
        }