Example #1
0
        private async Task ProcessScreenshot(Patterns patterns, CachedBitmapPixels screenshot, Rectangle windowRect)
        {
            if ((contextMenu.AutoLock.Checked || autoPickForm != null) &&
                patterns.IsChampionSelect(screenshot))
            {
                if (autoPickForm != null && autoPickForm.Enabled)                 //TODO
                {
                    championSelectSession = championSelectSession ?? new ChampionSelectSession(screenshot, patterns);

                    if (patterns.HasBanLockButtonDisabled(screenshot) &&
                        patterns.IsChampionSearch(screenshot))
                    {
                        var isBanPhase = patterns.IsFirstSelectBan(screenshot);
                        var state      = isBanPhase ? championSelectSession.BanState
                                                        : championSelectSession.PickState;

                        switch (state.Phase)
                        {
                        case ChampionSelectSession.BanPickPhase.Initial:
                            LeftMouseClick(windowRect, 0.7203125, 0.1);
                            state = new ChampionSelectSession.BanPickState(
                                ChampionSelectSession.BanPickPhase.ClearSearchPressed, state.ChampionIndex);
                            break;

                        case ChampionSelectSession.BanPickPhase.ClearSearchPressed:

                            break;

                        case ChampionSelectSession.BanPickPhase.ChampionEntered:
                            break;

                        case ChampionSelectSession.BanPickPhase.ChampionSelected:
                            break;

                        default:
                            throw new ArgumentOutOfRangeException();
                        }

                        if (isBanPhase)
                        {
                            championSelectSession.BanState = state;
                        }
                        else
                        {
                            championSelectSession.PickState = state;
                        }
                    }
                    else if (patterns.IsBanButton(screenshot))
                    {
                    }
                    else if (patterns.IsLockButton(screenshot))
                    {
                    }
                }
                else if (patterns.IsLockButton(screenshot))
                {
                    LeftMouseClick(windowRect, 0.5, 0.81);
                    await ShowBallonTip("Auto locked!", ToolTipIcon.Info);
                }
                return;
            }
            else if (contextMenu.AutoAccept.Checked && patterns.IsAcceptMatchButton(screenshot))
            {
                LeftMouseClick(windowRect, 0.5, 0.775);
                await ShowBallonTip("Auto accepted!", ToolTipIcon.Info);
            }
            championSelectSession = null;
        }
Example #2
0
 public bool IsMatch(CachedBitmapPixels image, Point offset, double threshold)
 {
     return(Match(image, offset, threshold, true) > threshold);
 }
Example #3
0
 public ChampionSelectSession(CachedBitmapPixels bitmap, Patterns patterns)
 {
     OurPickPosition = new Lazy <int>(() => patterns.DetectOurPickPosition(bitmap), false);
 }
Example #4
0
 public double Match(CachedBitmapPixels image, Point offset)
 => Match(image, offset, 0, false);
Example #5
0
 public abstract double Match(CachedBitmapPixels image, Point offset, double threshold, bool breakEarly);
Example #6
0
 public bool IsChampionSelect(CachedBitmapPixels screenshot)
 => ChampionSelect.ScreenSample.Value.IsMatch(screenshot, Point.Empty, BaseTreshold);
Example #7
0
 public bool IsAcceptMatchButton(CachedBitmapPixels screenshot)
 => AcceptMatchButtonSample.Value.IsMatch(screenshot, Point.Empty, BaseTreshold) ||
 AcceptMatchButtonHoverSample.Value.IsMatch(screenshot, Point.Empty, BaseTreshold);
Example #8
0
 public int DetectOurPickPosition(CachedBitmapPixels screenshot) =>
 ChampionSelect.SummonerNameRects.Select(rectangle =>
                                         ChampionSelect.DetectPickPositionSample.Value.Match(screenshot, rectangle.Location))
 .Select((x, i) => (x, i))
Example #9
0
 public bool IsLockButton(CachedBitmapPixels screenshot)
 => ChampionSelect.LockButtonSample.Value.IsMatch(screenshot, Point.Empty, BaseTreshold) ||
 ChampionSelect.LockButtonHoverSample.Value.IsMatch(screenshot, Point.Empty, BaseTreshold);
Example #10
0
 public bool HasBanLockButtonDisabled(CachedBitmapPixels screenshot)
 => ChampionSelect.BanLockButtonDisabledSample.Value.IsMatch(screenshot, Point.Empty, BaseTreshold);