void OnFogResult(object sender, ImageProcessorEventArgs <GameMapProcessorResult <MapDirectionMoveInfo> > e) { time += NativeApiWrapper.StandartDelay; var calcRes = e.ImageProcessorResult.VectorizationResult.ToList(); var itemsToRemove = calcRes.Where(a => a.Angle >= MaxAngle || a.Angle <= MinAngle).ToList(); foreach (var item in itemsToRemove) { calcRes.Remove(item); } AddToFogHistory(new HistoryElement <MapDirectionMoveInfo>() { MoveInfos = calcRes }); if (!mapHistory.Any()) { return; } if (lockObserver.Locked) { return; } if (time > MaxAreaTime) { OnAreaEnded(); return; } var mainAngle = MainAreaOrientation; IEnumerable <MapDirectionMoveInfo> vectorizationResult = null;; if (!calcRes.Any()) { var lastSuccessResult = fogHistory.OrderByDescending(a => a.ID).Where(a => a.MoveInfos.Any()); if (lastSuccessResult.Any()) { vectorizationResult = lastSuccessResult.OrderBy(a => a.ID).Last().MoveInfos; } } else { vectorizationResult = calcRes; } if (vectorizationResult == null) { OnAreaEnded(); return; } var nextMarker = ProcessNextMarker(vectorizationResult); mainAngle = nextMarker.CenterAngle; AttackPusher.CenterAngle = nextMarker.CenterAngle; var point = NativeApiWrapper.GetScreenRotatedPoint((int)mainAngle); AvailableInput.MouseMove(point); AvailableInput.Input(Settings.MoveKey); }
private void OnLootResult(object sender, ImageProcessorEventArgs <GameMapProcessorResult <LootMoveResult> > e) { var res = e.ImageProcessorResult.VectorizationResult; if (!res.Any()) { return; } var point = res.OrderBy(a => a.Vector.Length()).FirstOrDefault().LootCord; AvailableInput.MouseMove(point); AvailableInput.Input(InputCodes.LButton); }
public AttackPusher() { PusherInfo pusherInfo = new PusherInfo(); pusherInfo.BeforePush = () => { if (CenterAngle == -1) { return; } var point = NativeApiWrapper.GetScreenRotatedPoint((int)CenterAngle); AvailableInput.MouseMove(point); }; pusherInfo.Code = Settings.MainAttack; pusherInfo.Delay = Settings.AttackDelay; CreatePusher(pusherInfo); }
void TimerTick(object sender, EventArgs e) { var timer = sender as Timer; if (!script.ScriptParts.Any()) { Stop(timer); return; } var func = script.ScriptParts.Dequeue(); if (IsInput(func)) { var scriptAction = (Func <InputCodes>)func; var input = scriptAction(); AvailableInput.Input(input); timer.Stop(); TimerTick(sender, e); return; } if (IsModifiers(func)) { var scriptAction = (Func <KeyWithModifier>)func; var input = scriptAction(); AvailableInput.InputCombination(input.Modifier, input.Key); timer.Stop(); TimerTick(sender, e); return; } if (IsDelay(func)) { var scriptAction = (Func <double>)func; var delay = (int)(scriptAction() * STANDART_DELAY * Settings.GlobalScriptDelayModifier); timer.Interval = delay; timer.Start(); return; } if (IsScript(func)) { var scriptAction = (Func <InputScriptBase>)func; var script = scriptAction(); timer.Stop(); script.Completed = (s, args) => TimerTick(timer, null); script.Run(); return; } if (IsMouseMove(func)) { var scriptAction = (Func <Point>)func; var input = scriptAction(); AvailableInput.MouseMove(input); timer.Stop(); TimerTick(sender, e); return; } Stop(timer); }