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; }
public bool IsMatch(CachedBitmapPixels image, Point offset, double threshold) { return(Match(image, offset, threshold, true) > threshold); }
public ChampionSelectSession(CachedBitmapPixels bitmap, Patterns patterns) { OurPickPosition = new Lazy <int>(() => patterns.DetectOurPickPosition(bitmap), false); }
public double Match(CachedBitmapPixels image, Point offset) => Match(image, offset, 0, false);
public abstract double Match(CachedBitmapPixels image, Point offset, double threshold, bool breakEarly);
public bool IsChampionSelect(CachedBitmapPixels screenshot) => ChampionSelect.ScreenSample.Value.IsMatch(screenshot, Point.Empty, BaseTreshold);
public bool IsAcceptMatchButton(CachedBitmapPixels screenshot) => AcceptMatchButtonSample.Value.IsMatch(screenshot, Point.Empty, BaseTreshold) || AcceptMatchButtonHoverSample.Value.IsMatch(screenshot, Point.Empty, BaseTreshold);
public int DetectOurPickPosition(CachedBitmapPixels screenshot) => ChampionSelect.SummonerNameRects.Select(rectangle => ChampionSelect.DetectPickPositionSample.Value.Match(screenshot, rectangle.Location)) .Select((x, i) => (x, i))
public bool IsLockButton(CachedBitmapPixels screenshot) => ChampionSelect.LockButtonSample.Value.IsMatch(screenshot, Point.Empty, BaseTreshold) || ChampionSelect.LockButtonHoverSample.Value.IsMatch(screenshot, Point.Empty, BaseTreshold);
public bool HasBanLockButtonDisabled(CachedBitmapPixels screenshot) => ChampionSelect.BanLockButtonDisabledSample.Value.IsMatch(screenshot, Point.Empty, BaseTreshold);