protected override RunStatus Run(object context) { var gameState = (CurrentGameState)context; if (!ScreenReader.AreTalentsOpen()) { ControlInput.MouseClick(ControlInput.MouseClickButton.Left, 95, 942); } Thread.Sleep(700); //ScreenReader.UpdateCurrentTalentLevel(gameState); MainWindow.Log("Leveling talents for level " + gameState.Me.CharacterLevel); foreach (var talent in gameState.Me.HeroData.Talents) { if (gameState.Me.CharacterLevel < talent.TalentLevel) { continue; } if (!talent.IsLeveled) { ControlInput.ChooseTalent(talent.TalentLevel, talent.TalentIndex); talent.IsLeveled = true; talent.HeroChanges(gameState.Me.HeroData); MainWindow.Log("Leveling " + talent.TalentName + "(" + talent.TalentLevel + ")"); Thread.Sleep(200); } } Thread.Sleep(400); if (ScreenReader.AreTalentsOpen()) { ControlInput.MouseClick(ControlInput.MouseClickButton.Left, 95, 942); } return(RunStatus.Failure); }
protected override RunStatus Run(object context) { var gameState = (CurrentGameState)context; foreach (var skill in gameState.Me.HeroData.Skills) { if (!skill.ShouldCastOnCreeps) { continue; } if (DateTime.Now < skill.OnCooldownUntil) { continue; } if (skill.Properties.Contains(Skill.SkillProperty.Buff)) { if (gameState.FriendlyCreepsNearby.Any(o => o.Distance2D(gameState.Me.HeroScreenPosition) < 500)) { ControlInput.SendKey(skill.Key); ControlInput.MouseClick(ControlInput.MouseClickButton.Left, gameState.FriendlyCreepsNearby.First()); skill.OnCooldownUntil = DateTime.Now.AddSeconds(skill.Cooldown); MainWindow.Log(MainWindow.LogType.Combat, string.Format("Using '{0}' (range - {1})", skill.Name, skill.Range)); return(RunStatus.Success); } } if (!gameState.EnemyCreepsNearby.Any()) { return(RunStatus.Failure); } var unit = gameState.EnemyCreepsNearby.OrderBy( o => o.Distance2D(gameState.Me.HeroScreenPosition)).First(); //TODO: ADD SMART AOE. THIS JUST SUCKS. var dist = unit.Distance2D(gameState.Me.HeroScreenPosition); if (dist < skill.Range) { var center = new Point( gameState.EnemyCreepsNearby.Sum(o => o.X) / gameState.EnemyCreepsNearby.Length, gameState.EnemyCreepsNearby.Sum(o => o.Y) / gameState.EnemyCreepsNearby.Length); ControlInput.SendKey(skill.Key); ControlInput.MouseClick(ControlInput.MouseClickButton.Left, unit); skill.OnCooldownUntil = DateTime.Now.AddSeconds(skill.Cooldown); MainWindow.Log(MainWindow.LogType.Combat, string.Format("Using '{0}' ({1} -> {2})", skill.Name, skill.Range, dist)); return(RunStatus.Success); } } return(RunStatus.Failure); }
protected override RunStatus Run(object context) { var gameState = (CurrentGameState)context; foreach (var skill in gameState.Me.HeroData.Skills) { if ((skill.Properties.Contains(Skill.SkillProperty.SoloHeal) || skill.Properties.Contains(Skill.SkillProperty.AOEHeal)) && skill.IsCastable) { if (skill.Cooldown < gameState.Me.HeroHP / 3) { ControlInput.SendKey(skill.Key); ControlInput.MouseClick(ControlInput.MouseClickButton.Left, gameState.Me.HeroScreenPosition); return(RunStatus.Success); } } } return(RunStatus.Failure); }