/// <summary> /// The game_ on wnd proc. /// </summary> /// <param name="args"> /// The args. /// </param> private static void Game_OnWndProc(WndEventArgs args) { if (!Game.IsInGame) { return; } var mousePos = Game.MouseScreenPosition; if (args.Msg == (ulong)Utils.WindowsMessages.WM_LBUTTONDOWN && Utils.IsUnderRectangle( mousePos, Menu.MenuPanel.Position.X, Menu.MenuPanel.Position.Y, Menu.MenuPanel.Size.X, Menu.MenuPanel.Size.Y)) { mouseDifference = mousePos - BasePosition; dragging = true; return; } if (dragging && args.Msg == (ulong)Utils.WindowsMessages.WM_LBUTTONUP) { dragging = false; Menu.Root.Item("positionX").SetValue(new Slider((int)BasePosition.X, 10, Drawing.Height / 3)); Menu.Root.Item("positionY") .SetValue(new Slider((int)BasePosition.Y, (int)(HUDInfo.ScreenSizeY() * 0.08), Drawing.Width / 4)); return; } if (args.Msg == (ulong)Utils.WindowsMessages.WM_MOUSEMOVE && dragging) { BasePosition = new Vector2( Math.Max(Math.Min(mousePos.X - mouseDifference.X, Drawing.Height / 3), 10), Math.Max( Math.Min(mousePos.Y - mouseDifference.Y, Drawing.Width / 4), (int)(HUDInfo.ScreenSizeY() * 0.08))); Menu.Root.Item("positionX").SetValue(new Slider((int)BasePosition.X, 10, Drawing.Height / 3)); Menu.Root.Item("positionY") .SetValue(new Slider((int)BasePosition.Y, (int)(HUDInfo.ScreenSizeY() * 0.08), Drawing.Width / 4)); } if (Game.IsChatOpen) { return; } if ((args.Msg == (uint)Utils.WindowsMessages.WM_KEYUP || args.Msg == (uint)Utils.WindowsMessages.WM_KEYDOWN) && args.WParam == Menu.Root.Item("pressKey").GetValue <KeyBind>().Key) { DrawMenu = args.Msg == (uint)Utils.WindowsMessages.WM_KEYDOWN; } if (args.Msg == (uint)Utils.WindowsMessages.WM_KEYUP && args.WParam == Menu.Root.Item("toggleKey").GetValue <KeyBind>().Key) { DrawMenu = !DrawMenu; } }
/// <summary> /// The events_ on load. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> private void Events_OnLoad(object sender, EventArgs e) { var currentX = this.Item("positionX").GetValue <Slider>().Value; var currentY = this.Item("positionY").GetValue <Slider>().Value; this.Item("positionX") .SetValue(new Slider(Math.Max(Math.Min(currentX, Drawing.Height / 3), 10), 10, Drawing.Height / 3)); this.Item("positionY") .SetValue( new Slider( Math.Max(Math.Min(currentY, Drawing.Width / 4), (int)(HUDInfo.ScreenSizeY() * 0.08)), (int)(HUDInfo.ScreenSizeY() * 0.08), Drawing.Width / 4)); var console = this.newMessageType.SelectedIndex == 2; if (this.Item("showMessage").GetValue <bool>() && !console) { var msg = "<font face='Verdana' color='#ff7700'>[</font>Menu Hotkeys<font face='Verdana' color='#ff7700'>]</font> Press: <font face='Verdana' color='#ff7700'>" + Utils.KeyToText(this.Item("toggleKey").GetValue <KeyBind>().Key) + "</font> Hold: <font face='Verdana' color='#ff7700'>" + Utils.KeyToText(this.Item("pressKey").GetValue <KeyBind>().Key) + "</font>"; Game.PrintMessage( msg); } else if (console && this.Item("showMessage").GetValue <bool>()) { var msg = @"[Menu Hotkeys] Press: " + Utils.KeyToText(this.Item("toggleKey").GetValue <KeyBind>().Key) + @" Hold: " + Utils.KeyToText(this.Item("pressKey").GetValue <KeyBind>().Key); Console.WriteLine(msg); } }
public void Activate() { var menu = this.mainMenu.OverlaySettingsMenu; this.itemsToSave = menu.Item("Items to save", new Slider(100, 5, 500)); this.linesToShow = menu.Item("Lines to show", new Slider(30, 10, 50)); this.linesToShow.PropertyChanged += this.LinesToShowOnPropertyChanged; this.textSize = menu.Item("Text size", new Slider(20, 10, 30)); this.textSize.PropertyChanged += this.TextSizeOnPropertyChanged; this.screenSizeX = HUDInfo.ScreenSizeX(); this.positionX = menu.Item("Position x", new Slider((int)(this.screenSizeX * 0.75), 0, (int)this.screenSizeX)); this.positionY = menu.Item("Position y", new Slider(100, 0, (int)HUDInfo.ScreenSizeY())); this.positionY.PropertyChanged += this.PositionYOnPropertyChanged; this.overlayButton = new ToggleButton( "Hide", "Show", new Vector2(this.screenSizeX - 100, this.positionY - 50), new Vector2(100, 30)); this.pauseButton = new ToggleButton( "Pause", "Continue", new Vector2(this.screenSizeX - 200, this.positionY - 50), new Vector2(100, 30)); this.clearButton = new Button("Clear", new Vector2(this.screenSizeX - 300, this.positionY - 50), new Vector2(100, 30)); this.jumpTopButton = new Button("^", new Vector2(this.screenSizeX - 400, this.positionY - 50), new Vector2(100, 30)); this.TextSizeOnPropertyChanged(null, null); Drawing.OnDraw += this.DrawingOnDraw; Game.OnWndProc += this.GameOnWndProc; }
private static void Game_OnFireEvent(FireEventEventArgs args) { if (inGame || args.GameEvent.Name != "hero_picker_shown") { return; } if (selectedLane != 0) { var team = ObjectManager.LocalPlayer.Team == Team.Radiant ? 0 : LaneList.Length - 1; var xy = CoordinateMultiplayers[selectedLane - 1 + team]; SetCursorPos((int)(HUDInfo.ScreenSizeX() * xy[0]), (int)(HUDInfo.ScreenSizeY() * xy[1])); mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); var sayTextIndex = Menu.Item(LaneList[selectedLane] + "Text").GetValue <StringList>().SelectedIndex; if (sayTextIndex != 0) { Game.ExecuteCommand("say_team " + SayText[selectedLane - 1][sayTextIndex]); } } if (currentPair.Value != "None" && locked) { Game.ExecuteCommand("dota_select_hero " + currentPair.Value); } inGame = true; }
/// <summary> /// The execute. /// </summary> /// <param name="hero"> /// The hero. /// </param> /// <returns> /// The <see cref="bool" />. /// </returns> public bool Execute(Hero hero) { if ((Variables.Instance.Techies.EnabledHeroes.ContainsKey(hero.ClassID) && !Variables.Instance.Techies.EnabledHeroes[hero.ClassID]) || hero.IsInvul() || hero.IsMagicImmune() || hero.HasModifiers( new[] { "modifier_juggernaut_blade_fury", "modifier_ember_spirit_sleight_of_fist_caster_invulnerability" }, false) || !hero.CanDie()) { return(false); } if (!Utils.SleepCheck(hero.ClassID + "Techies.AutoDetonate")) { return(false); } var tempDamage = hero.GetStackDamage(); if (!(tempDamage.Item1 >= hero.Health)) { return(false); } if (tempDamage.Item3 != null && tempDamage.Item3.AutoDetonate) { Detonate(tempDamage.Item2); Utils.Sleep(500, hero.ClassID + "Techies.AutoDetonate"); return(true); } if (tempDamage.Item3 == null || tempDamage.Item3.AutoDetonate || !Variables.Menu.DrawingsMenu.Item("Techies.ShowNotification").GetValue <bool>()) { return(false); } if (!Utils.SleepCheck("Techies.Notification." + hero.StoredName())) { return(false); } Utils.Sleep(15000, "Techies.Notification." + hero.StoredName()); if (this.notification == null) { this.notification = new Notification( 5000, new Vector2(HUDInfo.ScreenSizeX(), (float)(HUDInfo.ScreenSizeY() / 2.3)), new Vector2(HUDInfo.ScreenSizeX() / 8, HUDInfo.ScreenSizeX() / 30)); } this.notification.RemoteMines = tempDamage.Item2; this.notification.PopUp(hero); return(false); }
/// <summary> /// The settings. /// </summary> private void Settings() { this.settings = new Menu("MenuSettings", "Common.menuSettings"); this.settings.AddItem( new MenuItem("pressKey", "Menu hold key").SetValue(new KeyBind(16, KeyBindType.Press))); this.settings.AddItem( new MenuItem("toggleKey", "Menu toggle key").SetValue(new KeyBind(118, KeyBindType.Toggle))); this.settings.AddItem(new MenuItem("showMessage", "Show OnLoad message: ").SetValue(true)) .SetTooltip("Show message with menu hotkeys on game load"); this.message = this.settings.AddItem( new MenuItem("messageType", "Show the message in: ").SetValue( new StringList(new[] { "SideLog", "Chat", "Console" }))); this.settings.AddItem( new MenuItem("EnsageSharp.Common.IncreaseSize", "Size increase: ").SetValue(new Slider(0, 0, 250))) .SetTooltip("Increases size of the menu, it can take up to 20 sec before the menu gets fully resized") .ValueChanged += (sender, args) => { DelayAction.Add(250, () => IncreaseMenuSize = args.GetNewValue <Slider>().Value); }; IncreaseMenuSize = this.settings.Item("EnsageSharp.Common.IncreaseSize").GetValue <Slider>().Value; this.xPos = this.settings.AddItem( new MenuItem("positionX", "Position X").SetValue( new Slider((int)MenuSettings.BasePosition.X, 10, Drawing.Height / 3))) .SetTooltip("Change position by dragging the 'EnsageSharp Menu' top panel") .SetFontColor(Color.GreenYellow); this.yPos = this.settings.AddItem( new MenuItem("positionY", "Position Y").SetValue( new Slider( (int)MenuSettings.BasePosition.Y, (int)(HUDInfo.ScreenSizeY() * 0.08), Drawing.Width / 4))) .SetTooltip("Change position by dragging the 'EnsageSharp Menu' top panel") .SetFontColor(Color.GreenYellow); this.AddSubMenu(this.settings); var currentX = this.xPos.GetValue <Slider>().Value; var currentY = this.yPos.GetValue <Slider>().Value; this.xPos.SetValue(new Slider(Math.Max(Math.Min(currentX, Drawing.Height / 3), 10), 10, Drawing.Height / 3)); this.yPos.SetValue( new Slider( Math.Max(Math.Min(currentY, Drawing.Width / 4), (int)(HUDInfo.ScreenSizeY() * 0.08)), (int)(HUDInfo.ScreenSizeY() * 0.08), Drawing.Width / 4)); MenuSettings.BasePosition = new Vector2( this.xPos.GetValue <Slider>().Value, this.yPos.GetValue <Slider>().Value); this.settings.AddItem( new MenuItem("allowCustomTextures", "Allow custom textures in menu")).SetValue(true); this.settings.AddItem( new MenuItem("allowCustomColors", "Allow custom font colors in menu")).SetValue(true); this.settings.AddItem( new MenuItem("allowCustomFonts", "Allow custom font styles in menu")).SetValue(true); }
static Vector2 HeroPositionOnScreen(Hero x) { float scaleX = HUDInfo.ScreenSizeX(); float scaleY = HUDInfo.ScreenSizeY(); Vector2 PicPosition; Drawing.WorldToScreen(x.Position, out PicPosition); PicPosition = new Vector2((float)(PicPosition.X + (scaleX * -0.035)), (float)((PicPosition.Y) + (scaleY * -0.10))); return(PicPosition); }
/// <summary> /// The on load. /// </summary> public void OnLoad() { this.LocalTeam = new AbilityTeam(GlobalVariables.Team); var enemyTeam = new AbilityTeam(GlobalVariables.EnemyTeam) { OtherTeams = new List <IAbilityTeam> { this.LocalTeam } }; this.LocalTeam.OtherTeams.Add(enemyTeam); this.Teams = new List <IAbilityTeam> { this.LocalTeam, enemyTeam }; // foreach (var unit in ObjectManager.GetEntities<Unit>()) // { // if (!(unit is Hero) || unit.Team == GlobalVariables.EnemyTeam && !(unit is Hero) // || unit.ClassId == ClassId.CDOTA_BaseNPC_Creep_Lane // || unit.ClassId == ClassId.CDOTA_BaseNPC_Creep_Siege || unit.IsIllusion) // { // continue; // } // this.AddUnit(unit); // } // var delay = Game.GameTime < 0 ? 3000 : 500; // DelayAction.Add( // delay, // () => // { // }); foreach (var hero in Heroes.All) { this.AddUnit(hero); } var size = new Vector2((float)(HUDInfo.ScreenSizeX() / 2.3), HUDInfo.ScreenSizeY() / 2); this.ui = new AbilityManagerUserInterface( new Vector2(HUDInfo.ScreenSizeX() - size.X - 10, (float)(HUDInfo.ScreenSizeY() / 2 - size.Y / 1.5)), size, this); this.TeamAdd.Next(this.LocalTeam); this.TeamAdd.Next(enemyTeam); ObjectManager.OnAddEntity += this.OnAddEntity; ObjectManager.OnRemoveEntity += this.OnRemoveEntity; // Game.OnUpdate += this.Game_OnUpdate; // Drawing.OnDraw += this.Drawing_OnDraw; }
private static void Drawing_OnEndScene(EventArgs args) { if (inGame || SelectedLane == 0 || Drawing.Direct3DDevice9 == null) { return; } textFont.DrawText(null, LaneList[SelectedLane], (int)(HUDInfo.ScreenSizeX() * 0.01), (int)(HUDInfo.ScreenSizeY() * 0.06), Color.Yellow); }
/// <summary>Initializes a new instance of the <see cref="UnitIconDrawerMenu" /> class.</summary> internal UnitIconDrawerMenu() { this.Menu = new Menu("IconDrawer", Constants.AssemblyName + "UnitIconDrawer"); var reso = "(" + HUDInfo.ScreenSizeX() + "x" + HUDInfo.ScreenSizeY() + ")"; this.sizeMenuItem = this.Menu.AddItem( new MenuItem( this.Menu.Name + nameof(this.sizeMenuItem) + HUDInfo.ScreenSizeY() + HUDInfo.ScreenSizeX(), "Minimap icon size " + reso).SetValue( new Slider((int)(HUDInfo.GetHpBarSizeY() * 1.5), (int)(HUDInfo.GetHpBarSizeY() * 1.5), 64)) .SetTooltip("Set minimap icon size for resolution " + reso)); }
/// <summary> /// Initializes a new instance of the <see cref="ChargeOfDarkness" /> class. /// </summary> /// <param name="ability"> /// The ability. /// </param> public ChargeOfDarkness(Ability ability) { this.ability = ability; this.speed = ability.GetProjectileSpeed(); this.sleeper = new Sleeper(); this.lastLevel = ability.Level; this.abilityIcon = Drawing.GetTexture("materials/ensage_ui/spellicons/spirit_breaker_charge_of_darkness"); this.iconSize = new Vector2(HUDInfo.GetHpBarSizeY() * 2); this.CastPoint = this.ability.FindCastPoint(); this.notification = new Notification( 5000, new Vector2(HUDInfo.ScreenSizeX(), (float)(HUDInfo.ScreenSizeY() / 2.3)), new Vector2(HUDInfo.ScreenSizeX() / 11, HUDInfo.ScreenSizeX() / 30)); }
/// <summary> /// The events_ on load. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> private void Events_OnLoad(object sender, EventArgs e) { var currentX = this.Item("positionX").GetValue <Slider>().Value; var currentY = this.Item("positionY").GetValue <Slider>().Value; this.Item("positionX") .SetValue(new Slider(Math.Max(Math.Min(currentX, Drawing.Height / 3), 10), 10, Drawing.Height / 3)); this.Item("positionY") .SetValue( new Slider( Math.Max(Math.Min(currentY, Drawing.Width / 4), (int)(HUDInfo.ScreenSizeY() * 0.08)), (int)(HUDInfo.ScreenSizeY() * 0.08), Drawing.Width / 4)); }
protected PanelBase(IAbilityUnit unit) { this.Unit = unit; this.sizeIncreaseObserver = new DataObserver <Slider>( slider => { this.SizeIncrease = (float)(slider.Value * (1080 / HUDInfo.ScreenSizeY()) / 20); }); this.enableObserver = new DataObserver <bool>(this.EnabledAction()); this.positionObserver = new DataObserver <StringList>( list => { this.HealthBarPositionAction().Invoke(list); this.ChangePosition((PanelDirection)list.SelectedIndex); this.Panel?.UpdateSize(); }); }
private static void SetScreenVariables() { mScreenSize = new Vector2(HUDInfo.ScreenSizeX(), HUDInfo.ScreenSizeY()); mMenuPosition = mScreenSize.X; mButtonHeight = mScreenSize.Y / 30; // Open - Close Menu Button mMenuButtonSize = new Vector2(mScreenSize.X / 60, mScreenSize.Y / 12); mMenuButtonPos = new Vector2(mScreenSize.X - mMenuButtonSize.X, (float)((mScreenSize.Y - (mScreenSize.Y / 5.5)) / 2 - (mMenuButtonSize.Y / 2))); // Menu Background mMenuSize = new Vector2(mScreenSize.X / 12, (float)(mScreenSize.Y / 1.56)); mMenuPos = new Vector2(mScreenSize.X - mMenuSize.X, (float)((mScreenSize.Y - (mScreenSize.Y / 5.5)) / 2 - (mMenuSize.Y / 2))); mScreenVariablesSet = true; }
/// <summary> /// The settings. /// </summary> private void Settings() { this.settings = new Menu("MenuSettings", "Common.menuSettings"); this.settings.AddItem( new MenuItem("EnsageSharp.Common.IncreaseSize", "Size increase: ").SetValue(new Slider(0, -50, 250))) .SetTooltip("Increases size of the menu, it can take up to 20 sec before the menu gets fully resized") .ValueChanged += (sender, args) => { DelayAction.Add(250, () => IncreaseMenuSize = args.GetNewValue <Slider>().Value); }; IncreaseMenuSize = this.settings.Item("EnsageSharp.Common.IncreaseSize").GetValue <Slider>().Value; this.xPos = this.settings.AddItem( new MenuItem("positionX", "Position X").SetValue( new Slider((int)MenuSettings.BasePosition.X, 10, Drawing.Height / 3))) .SetTooltip("Change position by dragging the 'EnsageSharp Menu' top panel") .SetFontColor(Color.GreenYellow); this.yPos = this.settings.AddItem( new MenuItem("positionY", "Position Y").SetValue( new Slider( (int)MenuSettings.BasePosition.Y, (int)(HUDInfo.ScreenSizeY() * 0.08), Drawing.Width / 4))) .SetTooltip("Change position by dragging the 'EnsageSharp Menu' top panel") .SetFontColor(Color.GreenYellow); this.AddSubMenu(this.settings); var currentX = this.xPos.GetValue <Slider>().Value; var currentY = this.yPos.GetValue <Slider>().Value; this.xPos.SetValue(new Slider(Math.Max(Math.Min(currentX, Drawing.Height / 3), 10), 10, Drawing.Height / 3)); this.yPos.SetValue( new Slider( Math.Max(Math.Min(currentY, Drawing.Width / 4), (int)(HUDInfo.ScreenSizeY() * 0.08)), (int)(HUDInfo.ScreenSizeY() * 0.08), Drawing.Width / 4)); MenuSettings.BasePosition = new Vector2( this.xPos.GetValue <Slider>().Value, this.yPos.GetValue <Slider>().Value); this.settings.AddItem( new MenuItem("allowCustomTextures", "Allow custom textures in menu")).SetValue(true); this.settings.AddItem( new MenuItem("allowCustomColors", "Allow custom font colors in menu")).SetValue(true); this.settings.AddItem( new MenuItem("allowCustomFonts", "Allow custom font styles in menu")).SetValue(true); }
private static void Drawing_OnEndScene(EventArgs args) { if (Drawing.Direct3DDevice9 == null) { return; } textFont.DrawText( null, "Lane: " + LaneList[selectedLane], (int)(HUDInfo.ScreenSizeX() * 0.01), (int)(HUDInfo.ScreenSizeY() * 0.06), Color.Yellow); var heroText = currentPair.Key; if (heroText.Contains(",")) { heroText = currentPair.Key.Substring(0, currentPair.Key.IndexOf(",", StringComparison.Ordinal)); } if (locked) { heroText += " (locked)"; } textFont.DrawText( null, "Hero: " + heroText, (int)(HUDInfo.ScreenSizeX() * 0.01), (int)(HUDInfo.ScreenSizeY() * 0.09), Color.Yellow); if (displayTempName && tempName.Any()) { textFont.DrawText( null, tempName, (int)(HUDInfo.ScreenSizeX() * 0.01), (int)(HUDInfo.ScreenSizeY() * 0.12), Color.Orange); } }
private static void Main() { menu = new Menu("Harass Helper", "harassHelper", true); menu.AddItem( enabledHarras = new MenuItem("enabled", "Enabled").SetValue(new KeyBind('Z', KeyBindType.Toggle))); menu.AddItem(showText = new MenuItem("showText", "Show active text").SetValue(true)); menu.AddItem( textX = new MenuItem("textX", "Text position X").SetValue(new Slider(10, 0, (int)HUDInfo.ScreenSizeX()))); menu.AddItem( textY = new MenuItem("textY", "Text position Y").SetValue( new Slider((int)(HUDInfo.ScreenSizeY() * 0.70), 0, (int)HUDInfo.ScreenSizeY()))); menu.AddItem(aggro = new MenuItem("aggro", "Aggro key").SetValue(new KeyBind(107, KeyBindType.Press))); menu.AddItem(unaggro = new MenuItem("unaggro", "Unaggro key").SetValue(new KeyBind(109, KeyBindType.Press))); menu.AddItem( aggroMove = new MenuItem("aggroMove", "Aggro move").SetValue(false) .SetTooltip("Move to mouse position when using aggro")); menu.AddItem( unaggroMove = new MenuItem("unaggroMove", "Unaggro move").SetValue(false) .SetTooltip("Move to mouse position when using unaggro")); menu.AddItem( enabledTowerUnnagro = new MenuItem("enabledTowerUnnagro", "Auto tower unnagro").SetValue( new KeyBind('X', KeyBindType.Toggle))); menu.AddItem( towerUnnagroHp = new MenuItem("towerUnnagro", "Auto tower unnagro when hp lower than").SetValue( new Slider(600, 0, 2000))); menu.AddToMainMenu(); Events.OnLoad += OnLoad; Events.OnClose += OnClose; }
private static void Pick() { if (selectedLane != 0) { var teamAdjustment = ObjectManager.LocalPlayer.Team == Team.Radiant ? 0 : LaneList.Length - 1; var xMult = CoordinateMultiplayers[selectedLane - 1 + teamAdjustment, ratioAdjustment, 0]; var yMult = CoordinateMultiplayers[selectedLane - 1 + teamAdjustment, ratioAdjustment, 1]; SetCursorPos((int)(HUDInfo.ScreenSizeX() * xMult), (int)(HUDInfo.ScreenSizeY() * yMult)); mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); var sayTextIndex = Menu.Item(LaneList[selectedLane] + "Text").GetValue <StringList>().SelectedIndex; if (sayTextIndex != 0) { Game.ExecuteCommand("say_team " + SayText[selectedLane - 1][sayTextIndex]); } } if (currentPair.Value != "None" && locked) { Game.ExecuteCommand("dota_select_hero " + currentPair.Value); } }
private static void DragButton(Vector2 loc, float w, float h) { var isIn = Utils.IsUnderRectangle(Game.MouseScreenPosition, loc.X, loc.Y, w, h); if (leftMouseIsHold && Utils.SleepCheck("HoldButtonCd") && isIn && !hold) { hold = true; diff = Game.MouseScreenPosition - startloc; Utils.Sleep(250, "HoldButtonCd"); } else if (!leftMouseIsHold) { hold = false; } if (hold) { startloc = Game.MouseScreenPosition - diff; Menu.Item("xposition").SetValue(new Slider((int)startloc.X, 1, (int)HUDInfo.ScreenSizeX())); Menu.Item("yposition").SetValue(new Slider((int)startloc.Y, 1, (int)HUDInfo.ScreenSizeY())); } Drawing.DrawRect(loc, new Vector2(w, h), new Color(0, 0, 0, 150)); Drawing.DrawText(" Emoticons", loc + new Vector2(103, 2), Color.Blue, FontFlags.AntiAlias | FontFlags.DropShadow); }
public void OnDraw() { if (!menuManager.IsOpen || !menuManager.ShowAutoBuild) { return; } var build = abilityBuilder.GetBestBuild().ToList(); var uniqueAbilities = build.GroupBy(x => x) .Select(x => x.First()) .OrderBy(x => x.AbilitySlot) .Select(x => x.StoredName()) .ToList(); var ratio = HUDInfo.RatioPercentage(); var xStart = HUDInfo.ScreenSizeX() * 0.35f; var yStart = HUDInfo.ScreenSizeY() * 0.55f; var text = "Auto build preview (Win rate: " + abilityBuilder.BestBuildWinRate + ")"; Drawing.DrawRect( new Vector2(xStart - 2, yStart - (35 * ratio)), new Vector2(Drawing.MeasureText(text, "Arial", new Vector2(35 * ratio), FontFlags.None).X + 2, 35 * ratio), new Color(75, 75, 75, 175), false); Drawing.DrawRect( new Vector2(xStart - 2, yStart), new Vector2(((build.Count + 1) * 48 * ratio) + 2, uniqueAbilities.Count * 40 * ratio), new Color(75, 75, 75, 175), false); Drawing.DrawText( text, "Arial", new Vector2(xStart, yStart - (35 * ratio)), new Vector2(35 * ratio), Color.Orange, FontFlags.None); var positions = new Dictionary <string, float>(); for (var i = 0; i < uniqueAbilities.Count; i++) { var texture = uniqueAbilities[i].Contains("special_") ? Drawing.GetTexture("materials/ensage_ui/other/chat_wheel/arrow_1") : Drawing.GetTexture("materials/ensage_ui/spellicons/" + uniqueAbilities[i]); Drawing.DrawRect(new Vector2(xStart, yStart + (i * 40 * ratio)), new Vector2(45 * ratio, 40 * ratio), texture); positions.Add(uniqueAbilities[i], yStart + (i * 40 * ratio)); Drawing.DrawRect( new Vector2(xStart - 2, (yStart - 2) + (i * 40 * ratio)), new Vector2((build.Count + 1) * 48 * ratio, 2), Color.Silver); } Drawing.DrawRect( new Vector2(xStart - 2, (yStart - 2) + (uniqueAbilities.Count * 40 * ratio)), new Vector2((build.Count + 1) * 48 * ratio, 2), Color.Silver); for (var i = 0; i < build.Count; i++) { var number = i + 1; if (number >= 10) { //skip level 10 (talent) number++; } if (number >= 15) { //skip level 15 (talent) number++; } if (number >= 17) { //skip level 17 (empty) number++; } var size = Drawing.MeasureText(number.ToString(), "Arial", new Vector2(35 * ratio), FontFlags.None); Drawing.DrawText( number.ToString(), "Arial", new Vector2(xStart + (45 * ratio) + (i * 48 * ratio) + (((48 * ratio) - size.X) / 2), positions[build[i].StoredName()]), new Vector2(35 * ratio), Color.White, FontFlags.None); Drawing.DrawRect( new Vector2((xStart - 2) + (i * 48 * ratio), yStart - 2), new Vector2(2, uniqueAbilities.Count * 40 * ratio), Color.Silver); } Drawing.DrawRect( new Vector2((xStart - 2) + (build.Count * 48 * ratio), yStart - 2), new Vector2(2, uniqueAbilities.Count * 40 * ratio), Color.Silver); Drawing.DrawRect( new Vector2((xStart - 2) + ((build.Count + 1) * 48 * ratio), yStart - 2), new Vector2(2, (uniqueAbilities.Count * 40 * ratio) + 2), Color.Silver); }
public static void Drawing_OnDraw(EventArgs args) { if (!Game.IsInGame || !allies.Any() || !enemies.Any() || !IncomingDamages.Any() || AbilityMain.Me == null || !AbilityMain.Me.IsValid || !MainMenu.GankDamageMenu.Item("enableGankDamage").GetValue <bool>()) { return; } if (MainMenu.GankDamageMenu.Item("enableGankDamageAllies").GetValue <bool>()) { foreach (var ally in allies.Where(x => x != null && IncomingDamages.ContainsKey(NameManager.Name(x)))) { var health = ally.Health; var maxHealth = ally.MaximumHealth; var allyName = NameManager.Name(ally); var hpleft = Math.Max(health - IncomingDamages[allyName], 0); var hpperc = hpleft / maxHealth; var dmgperc = Math.Min(IncomingDamages[allyName], health) / maxHealth; Vector2 hbarpos; HpBar.HpBarPositionDictionary.TryGetValue(allyName, out hbarpos); if (hbarpos.X + 20 > HUDInfo.ScreenSizeX() || hbarpos.X - 20 < 0 || hbarpos.Y + 100 > HUDInfo.ScreenSizeY() || hbarpos.Y - 30 < 0) { continue; } var hpvarx = HpBar.SizeX; var hpbary = HpBar.SizeY; var position = hbarpos + new Vector2(hpvarx * hpperc, 0); Drawing.DrawRect( position, new Vector2(hpvarx * dmgperc, (float)(hpbary * 0.4)), (hpleft > 0) ? new Color(190, 150, 130, 100) : new Color(225, 70, 70, 200)); Drawing.DrawRect(position, new Vector2(hpvarx * dmgperc, (float)(hpbary * 0.4)), Color.Black, true); } } if (!MainMenu.GankDamageMenu.Item("enableGankDamageEnemies").GetValue <bool>()) { return; } foreach (var enemy in enemies.Where(x => x != null && IncomingDamages.ContainsKey(NameManager.Name(x)))) { var health = enemy.Health; var maxHealth = enemy.MaximumHealth; var enemyName = NameManager.Name(enemy); var hpleft = Math.Max(health - IncomingDamages[enemyName], 0); var hpperc = hpleft / maxHealth; var dmgperc = Math.Min(IncomingDamages[enemyName], health) / maxHealth; Vector2 hbarpos; HpBar.HpBarPositionDictionary.TryGetValue(enemyName, out hbarpos); if (hbarpos.X + 20 > HUDInfo.ScreenSizeX() || hbarpos.X - 20 < 0 || hbarpos.Y + 100 > HUDInfo.ScreenSizeY() || hbarpos.Y - 30 < 0) { continue; } var hpvarx = HpBar.SizeX; var hpbary = HpBar.SizeY; var position = hbarpos + new Vector2(hpvarx * hpperc, 0); Drawing.DrawRect( position, new Vector2(hpvarx * dmgperc, (float)(hpbary * 0.4)), (hpleft > 0) ? new Color(150, 225, 150, 80) : new Color(70, 225, 150, 225)); Drawing.DrawRect(position, new Vector2(hpvarx * dmgperc, (float)(hpbary * 0.4)), Color.Black, true); } }
/// <summary>The update.</summary> public void Check() { if (this.CheckMinimap()) { return; } float difference; float ydifference; if (this.Position.X < 0) { difference = -this.Position.X; // Console.WriteLine("1 " + Game.RawGameTime); this.IsOffScreen = true; if ((ydifference = this.Position.Y + this.Size.Y - HUDInfo.ScreenSizeY()) >= 0) { if (!this.CalculateEdgePosition) { this.IsVisible = this.Position.X > -this.Size.X && ydifference < this.Size.Y; return; } this.EdgePosition = new Vector2(0, HUDInfo.ScreenSizeY() - this.Size.Y); // var x = Math.Min(this.Position.X + ydifference, HUDInfo.ScreenSizeX() - this.Size.X); // var y = Math.Max(this.Position.Y - difference, 0); // this.EdgePosition = new Vector2(Math.Max(0, x), Math.Min(y, HUDInfo.ScreenSizeY() - this.Size.Y)); } else { if (!this.CalculateEdgePosition) { this.IsVisible = this.Position.X > -this.Size.X && this.Position.Y > -this.Size.Y; return; } this.EdgePosition = this.Position.Y < 0 ? Vector2.Zero : new Vector2(0, this.Position.Y); // var x = Math.Min(this.Position.X + ydifference, HUDInfo.ScreenSizeX() - this.Size.X); // var y = Math.Min(this.Position.Y + difference, HUDInfo.ScreenSizeY() - this.Size.Y); // this.EdgePosition = new Vector2(Math.Max(0, x), Math.Max(y, 0)); } // this.DistanceFromScreenEdge = this.Position.Distance(this.EdgePosition); } else if (this.Position.Y < 0) { ydifference = -this.Position.Y; // Console.WriteLine("2 " + Game.RawGameTime); this.IsOffScreen = true; if ((difference = this.Position.X + this.Size.X - HUDInfo.ScreenSizeX()) >= 0) { if (!this.CalculateEdgePosition) { this.IsVisible = difference <this.Size.X && this.Position.Y> -this.Size.Y; return; } this.EdgePosition = new Vector2(HUDInfo.ScreenSizeX() - this.Size.X, 0); // var x = Math.Max(this.Position.X - ydifference, 0); // var y = Math.Min(this.Position.Y + difference, HUDInfo.ScreenSizeY() - this.Size.Y); // this.EdgePosition = new Vector2(Math.Min(HUDInfo.ScreenSizeX() - this.Size.X, x), Math.Max(y, 0)); } else { if (!this.CalculateEdgePosition) { this.IsVisible = this.Position.X > -this.Size.X && this.Position.Y > -this.Size.Y; return; } this.EdgePosition = this.Position.X < 0 ? Vector2.Zero : new Vector2(this.Position.X, 0); // var x = Math.Min(this.Position.X + ydifference, HUDInfo.ScreenSizeX() - this.Size.X); // var y = Math.Min(this.Position.Y + difference, HUDInfo.ScreenSizeY() - this.Size.Y); // this.EdgePosition = new Vector2(Math.Max(0, x), Math.Max(y, 0)); } // this.DistanceFromScreenEdge = this.Position.Distance(this.EdgePosition); } else if ((difference = this.Position.X + this.Size.X - HUDInfo.ScreenSizeX()) >= 0) { // Console.WriteLine("3 " + Game.RawGameTime); this.IsOffScreen = true; if ((ydifference = this.Position.Y + this.Size.Y - HUDInfo.ScreenSizeY()) >= 0) { if (!this.CalculateEdgePosition) { this.IsVisible = difference < this.Size.X && ydifference < this.Size.Y; return; } this.EdgePosition = new Vector2( HUDInfo.ScreenSizeX() - this.Size.X, HUDInfo.ScreenSizeY() - this.Size.Y); // var x = Math.Max(this.Position.X - ydifference, 0); // var y = Math.Max(this.Position.Y - difference, 0); // this.EdgePosition = new Vector2( // Math.Min(HUDInfo.ScreenSizeX() - this.Size.X, x), // Math.Min(y, HUDInfo.ScreenSizeY() - this.Size.Y)); } else { if (!this.CalculateEdgePosition) { this.IsVisible = difference < this.Size.X; return; } this.EdgePosition = new Vector2(HUDInfo.ScreenSizeX() - this.Size.X, this.Position.Y); // var x = Math.Max(this.Position.X - ydifference, 0); // var y = Math.Min(this.Position.Y + difference, HUDInfo.ScreenSizeY() - this.Size.Y); // this.EdgePosition = new Vector2(Math.Min(HUDInfo.ScreenSizeX() - this.Size.X, x), Math.Max(y, 0)); } // this.DistanceFromScreenEdge = // new Vector2(this.Position.X + this.Size.X, this.Position.Y).Distance(this.EdgePosition); } else if ((ydifference = this.Position.Y + this.Size.Y - HUDInfo.ScreenSizeY()) >= 0) { // Console.WriteLine("4 " + Game.RawGameTime); this.IsOffScreen = true; if ((difference = this.Position.X + this.Size.X - HUDInfo.ScreenSizeX()) >= 0) { if (!this.CalculateEdgePosition) { this.IsVisible = difference < this.Size.X && ydifference < this.Size.Y; return; } this.EdgePosition = new Vector2( HUDInfo.ScreenSizeX() - this.Size.X, HUDInfo.ScreenSizeY() - this.Size.Y); // var x = Math.Max(this.Position.X - ydifference, 0); // var y = Math.Max(this.Position.Y - difference, 0); // this.EdgePosition = new Vector2( // Math.Min(HUDInfo.ScreenSizeX() - this.Size.X, x), // Math.Min(y, HUDInfo.ScreenSizeY() - this.Size.Y)); } else { if (!this.CalculateEdgePosition) { this.IsVisible = ydifference < this.Size.Y; return; } // var x = Math.Min(this.Position.X + ydifference, HUDInfo.ScreenSizeX() - this.Size.X); // var y = Math.Max(this.Position.Y - difference, 0); // this.EdgePosition = new Vector2(Math.Max(0, x), Math.Min(y, HUDInfo.ScreenSizeY() - this.Size.Y)); this.EdgePosition = new Vector2(this.Position.X, HUDInfo.ScreenSizeY() - this.Size.Y); } // this.DistanceFromScreenEdge = // new Vector2(this.Position.X + this.Size.X, this.Position.Y).Distance(this.EdgePosition); } else { this.IsOffScreen = false; } }
private bool CheckMinimap() { if (HUDInfo.MinimapIsOnRight) { var minimapPos = new Vector2( HUDInfo.ScreenSizeX() - HUDInfo.Minimap.Position.X - HUDInfo.Minimap.Size.X, HUDInfo.ScreenSizeY() - HUDInfo.Minimap.Position.Y - HUDInfo.Minimap.Size.Y); var difference = this.Position.X + this.Size.X - minimapPos.X; if (difference >= 0) { var ydifference = this.Position.Y + this.Size.Y - minimapPos.Y; if (ydifference >= 0) { // Console.WriteLine("1 " + ydifference + " " + difference); this.IsOffScreen = true; if (!this.CalculateEdgePosition) { this.IsVisible = (difference > this.Size.X && ydifference < this.Size.Y || difference < this.Size.X && (ydifference <this.Size.Y || ydifference> this.Size.Y)) && this.Position.X < HUDInfo.ScreenSizeX() && this.Position.Y < HUDInfo.ScreenSizeY(); return(true); } var y = Math.Max(this.Position.Y - difference, minimapPos.Y - this.Size.Y); var x = Math.Max(this.Position.X - ydifference, minimapPos.X - this.Size.X); this.EdgePosition = new Vector2( Math.Min(x, HUDInfo.ScreenSizeX() - this.Size.X), Math.Min(y, HUDInfo.ScreenSizeY() - this.Size.Y)); // this.DistanceFromScreenEdge = this.Position.Distance(this.EdgePosition); return(true); } return(false); } } else { var minimapPos = new Vector2( HUDInfo.Minimap.Position.X + HUDInfo.Minimap.Size.X, HUDInfo.ScreenSizeY() - HUDInfo.Minimap.Position.Y - HUDInfo.Minimap.Size.Y); var difference = minimapPos.X - this.Position.X; if (difference >= 0) { var ydifference = this.Position.Y + this.Size.Y - minimapPos.Y; if (ydifference >= 0) { // Console.WriteLine("1 " + ydifference + " " + difference); this.IsOffScreen = true; if (!this.CalculateEdgePosition) { this.IsVisible = (difference > this.Size.X && ydifference < this.Size.Y || difference < this.Size.X && (ydifference <this.Size.Y || ydifference> this.Size.Y)) && this.Position.X + this.Size.X > 0 && this.Position.Y < HUDInfo.ScreenSizeY(); return(true); } var y = Math.Max(this.Position.Y - difference, minimapPos.Y - this.Size.Y); var x = Math.Min(this.Position.X + ydifference, minimapPos.X); this.EdgePosition = new Vector2( Math.Max(x, 0), Math.Min(y, HUDInfo.ScreenSizeY() - this.Size.Y)); // this.DistanceFromScreenEdge = this.Position.Distance(this.EdgePosition); return(true); } return(false); } } // return false; return(false); }
private static void Main() { RecoveryMenu.AddItem(new MenuItem("hotkey", "Change hotkey").SetValue(new KeyBind('T', KeyBindType.Press))); var forcePick = new Menu("Force item picking", "forcePick"); forcePick.AddItem(new MenuItem("forcePickMoved", "When hero moved").SetValue(true)); forcePick.AddItem(new MenuItem("forcePickEnemyNearDistance", "When enemy in range").SetValue(new Slider(500, 0, 700)).SetTooltip("If enemy is closer then pick items")); RecoveryMenu.AddSubMenu(forcePick); PTMenu.AddItem(new MenuItem("enabledPT", "Enabled").SetValue(true)); PTMenu.AddItem(new MenuItem("enabledPTAbilities", "Enabled for").SetValue(new AbilityToggler(AbilitiesPT))) .DontSave(); PTMenu.AddItem(new MenuItem("switchPTonMove", "Switch when moving").SetValue( new StringList(new[] { "Don't switch", "Main attribute", "Strength", "Intelligence", "Agility" }))) .SetTooltip("Switch PT to selected attribute when moving"); PTMenu.AddItem(new MenuItem("switchPTonAttack", "Swtich when attacking").SetValue( new StringList(new[] { "Don't switch", "Main attribute", "Strength", "Intelligence", "Agility" }))) .SetTooltip("Switch PT to selected attribute when attacking"); PTMenu.AddItem(new MenuItem("switchPTHeal", "Swtich when healing").SetValue(true)) .SetTooltip("Bottle, flask, clarity and other hero spells"); PTMenu.AddItem(new MenuItem("manaPTThreshold", "Mana cost threshold").SetValue(new Slider(15, 0, 50)) .SetTooltip("Don't switch PT if spell/item costs less mana")); PTMenu.AddItem(new MenuItem("switchbackPTdelay", "Switch back delay").SetValue(new Slider(500, 100, 1000)) .SetTooltip("Make delay bigger if you have issues with PT when casting more than 1 spell in a row")); PTMenu.AddItem(new MenuItem("autoPTdisable", "Auto disable PT switcher").SetValue(new Slider(0, 0, 60)) .SetTooltip("Auto disable PT switching after X min (always enabled: 0)")); SoulRingMenu.AddItem(new MenuItem("enabledSR", "Enabled").SetValue(true)); SoulRingMenu.AddItem( new MenuItem("enabledSRAbilities", "Enabled for").SetValue(new AbilityToggler(AbilitiesSR))) .DontSave(); SoulRingMenu.AddItem(new MenuItem("soulringHPThreshold", "HP threshold").SetValue(new Slider(30)) .SetTooltip("Don't use soul ring if HP % less than X")); ManaCheckMenu.AddItem(new MenuItem("enabledMC", "Enabled").SetValue(false)); ManaCheckMenu.AddItem( new MenuItem("enabledMCAbilities", "Enabled for").SetValue(new AbilityToggler(AbilitiesMC))) .DontSave(); ManaCheckMenu.AddItem(new MenuItem("mcManaInfo", "Show mana info").SetValue(true) .SetTooltip("Will show how much mana left/needed after/before casting combo")); ManaCheckMenu.AddItem(new MenuItem("mcPTcalculations", "Include PT switcher calculations").SetValue(true) .SetTooltip("Will include in calculations mana gained from PT switching")); ManaCheckMenu.AddItem(new MenuItem("mcSize", "Size").SetValue(new Slider(8, 1, 10))) .SetTooltip("Reload assembly to apply new size"); ManaCheckMenu.AddItem( new MenuItem("mcX", "Position X").SetValue(new Slider(0, 0, (int)HUDInfo.ScreenSizeX()))); ManaCheckMenu.AddItem( new MenuItem("mcY", "Position Y").SetValue(new Slider(0, 0, (int)HUDInfo.ScreenSizeY()))); Menu.AddSubMenu(PTMenu); Menu.AddSubMenu(RecoveryMenu); Menu.AddSubMenu(SoulRingMenu); Menu.AddSubMenu(ManaCheckMenu); Menu.AddItem(new MenuItem("checkPTdelay", "PT check delay").SetValue(new Slider(250, 200, 500)) .SetTooltip("Make delay bigger if PT constantly switching when using bottle for example")); Menu.AddToMainMenu(); manaCheckText = new Font( Drawing.Direct3DDevice9, new FontDescription { FaceName = "Tahoma", Height = 13 * (ManaCheckMenu.Item("mcSize").GetValue <Slider>().Value / 2), OutputPrecision = FontPrecision.Raster, Quality = FontQuality.ClearTypeNatural, CharacterSet = FontCharacterSet.Hangul, MipLevels = 3, PitchAndFamily = FontPitchAndFamily.Modern, Weight = FontWeight.Heavy, Width = 5 * (ManaCheckMenu.Item("mcSize").GetValue <Slider>().Value / 2) }); Game.OnUpdate += Game_OnUpdate; Game.OnWndProc += Game_OnWndProc; Player.OnExecuteOrder += Player_OnExecuteAction; Drawing.OnPreReset += Drawing_OnPreReset; Drawing.OnPostReset += Drawing_OnPostReset; Drawing.OnEndScene += Drawing_OnEndScene; }
/// <summary> /// The on load. /// </summary> public void OnLoad() { this.LocalTeam = new AbilityTeam(GlobalVariables.Team); var enemyTeam = new AbilityTeam(GlobalVariables.EnemyTeam) { OtherTeams = new List <IAbilityTeam> { this.LocalTeam } }; this.LocalTeam.OtherTeams.Add(enemyTeam); this.Teams = new List <IAbilityTeam> { this.LocalTeam, enemyTeam }; // foreach (var unit in ObjectManager.GetEntities<Unit>()) // { // if (!(unit is Hero) || unit.Team == GlobalVariables.EnemyTeam && !(unit is Hero) // || unit.ClassId == ClassID.CDOTA_BaseNPC_Creep_Lane // || unit.ClassId == ClassID.CDOTA_BaseNPC_Creep_Siege || unit.IsIllusion) // { // continue; // } // this.AddUnit(unit); // } // var delay = Game.GameTime < 0 ? 3000 : 500; // DelayAction.Add( // delay, // () => // { // }); var heroes = ObjectManager.GetEntities <Player>() .Where(x => x.Hero != null && x.Hero.IsValid) .Select(x => x.Hero) .ToList(); foreach (var hero in ObjectManager.GetEntities <Hero>() .Where(hero => !hero.IsIllusion && heroes.All(x => x.Handle != hero.Handle))) { heroes.Add(hero); } foreach (var hero in heroes) { this.AddUnit(hero); } foreach (var keyValuePair in this.Units) { foreach (var sourceUnitModifier in keyValuePair.Value.SourceUnit.Modifiers) { keyValuePair.Value.Modifiers.AddModifier(sourceUnitModifier); } } // foreach (var hero in heroes) // { // foreach (var heroModifier in hero.Modifiers) // { // this.Unit_OnModifierAdded(hero, new ModifierChangedEventArgs(heroModifier)); // } // } foreach (var entity in ObjectManager.GetEntities <Unit>()) { if (entity.IsValid && !(entity is Hero) && !(entity is Courier) && entity.Team == this.LocalTeam.Name && entity.IsControllable) { // if (entity.Name == "npc_dota_lone_druid_bear1") // { // Console.WriteLine(entity.GetType()); // } // Console.WriteLine(entity.Name); this.AddUnit(entity); } } var size = new Vector2((float)(HUDInfo.ScreenSizeX() / 2.3), HUDInfo.ScreenSizeY() / 2); this.ui = new AbilityManagerUserInterface( new Vector2(HUDInfo.ScreenSizeX() - size.X - 10, (float)(HUDInfo.ScreenSizeY() / 2 - size.Y / 1.5)), size, this); this.TeamAdd.Next(this.LocalTeam); this.TeamAdd.Next(enemyTeam); ObjectManager.OnAddEntity += this.OnAddEntity; ObjectManager.OnRemoveEntity += this.OnRemoveEntity; Unit.OnModifierAdded += this.Unit_OnModifierAdded; Unit.OnModifierRemoved += this.Unit_OnModifierRemoved; // Game.OnUpdate += this.Game_OnUpdate; // Drawing.OnDraw += this.Drawing_OnDraw; }
static void markedfordeath(EventArgs args) { if (!Game.IsInGame || Game.IsWatchingGame) { return; } me = ObjectMgr.LocalHero; if (me == null) { return; } if (me.ClassID != ClassID.CDOTA_Unit_Hero_Legion_Commander) { return; } target = me.ClosestToMouseTarget(50000); if (target != null) { Vector2 target_health_bar = HeroPositionOnScreen(target); Drawing.DrawText("Marked for Death", target_health_bar, new Vector2(15, 200), me.Distance2D(target) < 1200 ? Color.Red : Color.Azure, FontFlags.AntiAlias | FontFlags.Additive | FontFlags.DropShadow); } if (!Utils.SleepCheck("BKBTOGGLE")) { Drawing.DrawText(Menu.Item("Duel Items3").GetValue <AbilityToggler>().IsEnabled("item_black_king_bar") == true ? "ON" : "OFF", new Vector2(HUDInfo.ScreenSizeX() / 2, HUDInfo.ScreenSizeY() / 2), new Vector2(30, 200), Menu.Item("Duel Items3").GetValue <AbilityToggler>().IsEnabled("item_black_king_bar") == true ? Color.LimeGreen : Color.Red, FontFlags.AntiAlias | FontFlags.Additive | FontFlags.DropShadow); } }
public SnatcherMenu(Menu mainMenu) { var menu = new Menu("Snatcher", "snatcher"); var notificationMenu = new Menu("Notification", "snatcherNotification"); var notificationEnabled = new MenuItem("snatcherNotificationEnabled", "Enabled").SetValue(false); notificationEnabled.SetTooltip("Show notification when snatched is enabled"); notificationMenu.AddItem(notificationEnabled); notificationEnabled.ValueChanged += (sender, args) => { IsNotificationEnabled = args.GetNewValue <bool>(); OnNotificationEnabledChange?.Invoke(null, new BoolEventArgs(IsNotificationEnabled)); }; IsNotificationEnabled = notificationEnabled.IsActive(); var notificationHoldKey = new MenuItem("snatcherNotificationHoldKey", "Enabled for hold key").SetValue(false); notificationMenu.AddItem(notificationHoldKey); notificationHoldKey.ValueChanged += (sender, args) => { NotificationHold = args.GetNewValue <bool>(); }; NotificationHold = notificationHoldKey.IsActive(); var notificationToggleKey = new MenuItem("snatcherNotificationToggleKey", "Enabled for toggle key").SetValue(true); notificationMenu.AddItem(notificationToggleKey); notificationToggleKey.ValueChanged += (sender, args) => { NotificationToggle = args.GetNewValue <bool>(); }; NotificationToggle = notificationToggleKey.IsActive(); var notificationSize = new MenuItem("snatcherNotificationSize", "Size").SetValue(new Slider(22, 15, 30)); notificationMenu.AddItem(notificationSize); notificationSize.ValueChanged += (sender, args) => { NotificationSize = args.GetNewValue <Slider>().Value; }; NotificationSize = notificationSize.GetValue <Slider>().Value; var notificationX = new MenuItem("snatcherNotificationX", "Coordinates X").SetValue( new Slider(15, 0, (int)HUDInfo.ScreenSizeX())); notificationMenu.AddItem(notificationX); notificationX.ValueChanged += (sender, args) => { NotificationX = args.GetNewValue <Slider>().Value; }; NotificationX = notificationX.GetValue <Slider>().Value; var notificationY = new MenuItem("snatcherNotificationY", "Coordinates Y").SetValue( new Slider(50, 0, (int)HUDInfo.ScreenSizeY())); notificationMenu.AddItem(notificationY); notificationY.ValueChanged += (sender, args) => { NotificationY = args.GetNewValue <Slider>().Value; }; NotificationY = notificationY.GetValue <Slider>().Value; var enabled = new MenuItem("snatcherEnabled", "Enabled").SetValue(true); menu.AddItem(enabled); enabled.ValueChanged += (sender, args) => { IsEnabled = args.GetNewValue <bool>(); OnEnabledChange?.Invoke(null, new BoolEventArgs(IsEnabled)); }; IsEnabled = enabled.IsActive(); var holdKey = new MenuItem("holdSnatchKey", "Hold key").SetValue(new KeyBind('O', KeyBindType.Press)); menu.AddItem(holdKey); holdKey.ValueChanged += (sender, args) => HoldKey = args.GetNewValue <KeyBind>().Active; HoldKey = holdKey.IsActive(); var holdItems = new MenuItem("enabledStealHold", "Hold steal:").SetValue( new AbilityToggler(items.ToDictionary(x => x.Key, x => true))); menu.AddItem(holdItems); holdItems.ValueChanged += (sender, args) => { SetEnabledItems(args.GetNewValue <AbilityToggler>().Dictionary, EnabledHoldItems); }; var toggleKey = new MenuItem("pressSnatchKey", "Toggle key").SetValue(new KeyBind('P', KeyBindType.Toggle)); menu.AddItem(toggleKey); toggleKey.ValueChanged += (sender, args) => ToggleKey = args.GetNewValue <KeyBind>().Active; ToggleKey = toggleKey.IsActive(); var toggleItems = new MenuItem("enabledStealToggle", "Toggle steal:").SetValue( new AbilityToggler(items.ToDictionary(x => x.Key, x => true))); menu.AddItem(toggleItems); toggleItems.ValueChanged += (sender, args) => SetEnabledItems( args.GetNewValue <AbilityToggler>().Dictionary, EnabledToggleItems); var otherUnits = new MenuItem("snatcherOtherUnits", "Use other units").SetValue(false) .SetTooltip("Like Spirit Bear, Meepo clones"); menu.AddItem(otherUnits); otherUnits.ValueChanged += (sender, args) => { UseOtherUnits = args.GetNewValue <bool>(); OnUseOtherUnitsChange?.Invoke(null, new BoolEventArgs(UseOtherUnits)); }; UseOtherUnits = otherUnits.IsActive(); var itemMoveCostThreshold = new MenuItem("snatcherMoveItemCost", "Move item cost threshold").SetValue(new Slider(1000, 0, 5000)); itemMoveCostThreshold.SetTooltip( "It will move item from inventory (when full) to backpack which costs less gold to pick up aegis/rapier/gem (disabled: 0)"); menu.AddItem(itemMoveCostThreshold); itemMoveCostThreshold.ValueChanged += (sender, args) => ItemMoveCostThreshold = args.GetNewValue <Slider>().Value; ItemMoveCostThreshold = itemMoveCostThreshold.GetValue <Slider>().Value; var updateRate = new MenuItem("snatcherUpdateRate", "Update rate").SetValue(new Slider(1, 1, 500)); updateRate.SetTooltip("Lower value => faster reaction, but requires more resources"); menu.AddItem(updateRate); updateRate.ValueChanged += (sender, args) => { UpdateRate = args.GetNewValue <Slider>().Value; OnUpdateRateChange?.Invoke(null, new IntEventArgs(UpdateRate)); }; UpdateRate = updateRate.GetValue <Slider>().Value; var debug = new MenuItem("snatcherDebug", "Debug info").SetValue(false); menu.AddItem(debug); debug.ValueChanged += (sender, args) => OnDebug?.Invoke(null, EventArgs.Empty); SetEnabledItems(holdItems.GetValue <AbilityToggler>().Dictionary, EnabledHoldItems); SetEnabledItems(toggleItems.GetValue <AbilityToggler>().Dictionary, EnabledToggleItems); menu.AddSubMenu(notificationMenu); mainMenu.AddSubMenu(menu); }
public static void Drawing_OnDraw(EventArgs args) { if (!Game.IsInGame || AbilityMain.Me == null || !AbilityMain.Me.IsValid || EnemyHeroes.Heroes == null) { return; } var enumerable = EnemyHeroes.UsableHeroes; if (!enumerable.Any()) { return; } foreach (var hero in enumerable) { float dmg; if (!Dictionaries.InDamageDictionary.TryGetValue(hero.Handle, out dmg)) { dmg = 0; } float outdmg; if (!Dictionaries.OutDamageDictionary.TryGetValue(hero.Handle, out outdmg)) { outdmg = 0; } var hp = Math.Max(hero.Health - dmg, 0); var lhp = Math.Max(hp - outdmg, 0); var hpperc = hp / hero.MaximumHealth; var dmgperc = Math.Min(dmg, hero.Health) / hero.MaximumHealth; Vector2 hbarpos; HpBar.HpBarPositionDictionary.TryGetValue(NameManager.Name(hero), out hbarpos); if (hbarpos.X + 20 > HUDInfo.ScreenSizeX() || hbarpos.X - 20 < 0 || hbarpos.Y + 100 > HUDInfo.ScreenSizeY() || hbarpos.Y - 30 < 0) { continue; } var hpvarx = HpBar.SizeX; var hpbary = HpBar.SizeY; var position = hbarpos + new Vector2(hpvarx * hpperc, (float)(hpbary * 0.4)); if (MainMenu.DamageIndicatorMenu.Item("abilityDamageIndicatorDrawDamage").GetValue <bool>()) { if (dmg > 0) { Drawing.DrawRect( position, new Vector2(hpvarx * dmgperc, (float)(hpbary / 1.6)), (lhp > 0) ? new Color(225, 200, 150, 95) : new Color(70, 225, 70, 105)); Drawing.DrawRect( position, new Vector2(hpvarx * dmgperc, (float)(hpbary / 1.6)), Color.Black, true); } if (outdmg > 0) { var outdmgperc = Math.Min(outdmg, hp) / hero.MaximumHealth; var pos = position + new Vector2(-hpvarx * outdmgperc, 0); Drawing.DrawRect( pos, new Vector2(hpvarx * outdmgperc, (float)(hpbary / 1.6)), (lhp > 0) ? new Color(100, 0, 0, 200) : new Color(0, 120, 0, 200)); Drawing.DrawRect( pos, new Vector2(hpvarx * outdmgperc, (float)(hpbary / 1.6)), Color.Black, true); } } if (MainMenu.DamageIndicatorMenu.Item("abilityDamageIndicatorDrawHits").GetValue <bool>()) { double hits; if (!Dictionaries.HitsDictionary.TryGetValue(hero.Handle.ToString(), out hits)) { continue; } var textt = hits.ToString(CultureInfo.InvariantCulture) + ((hits > 1) ? " hits" : " hit"); var hpbarpositionX = HUDInfo.GetHPbarPosition(hero).X; var s = ((hits > 0) ? textt : "KILL"); var h = "(" + Math.Floor(hero.Health - dmg - outdmg) + ")"; var isi = MainMenu.DamageIndicatorMenu.Item("abilityDamageIndicatorTextSize").GetValue <Slider>().Value; var textSize = Drawing.MeasureText( s, "Arial", new Vector2(hpbary + 4 + isi, 1), FontFlags.AntiAlias); var textPos = new Vector2( (int) (hpbarpositionX + 4 + (HpBar.SizeX * ((float)hero.Health * 1000 / hero.MaximumHealth)) / 1000), (int)(HUDInfo.GetHPbarPosition(hero).Y - 2)); Drawing.DrawText( s, textPos, new Vector2(hpbary + 4 + isi, 1), (hits > 0) ? Color.White : new Color(100, 225, 110), FontFlags.AntiAlias); Drawing.DrawText( h, textPos + new Vector2(textSize.X + 2, 1), new Vector2(hpbary + 2 + isi, 1), (hits > 0) ? Color.LightGoldenrodYellow : Color.YellowGreen, FontFlags.AntiAlias); } } }
public static void Drawing_OnDraw(EventArgs args) { if (!Game.IsInGame || AbilityMain.Me == null || !AbilityMain.Me.IsValid || EnemyHeroes.Heroes == null) { return; } if (Utils.SleepCheck("AbilityOverlay.Update")) { boxSizeX = HpBar.SizeX / 6 + MainMenu.AbilityOverlayMenu.Item("sizeSliderSpell").GetValue <Slider>().Value; boxSizeY = boxSizeX + 1; boxExtraPosX = MainMenu.AbilityOverlayMenu.Item("ExtraPosSliderSpellX").GetValue <Slider>().Value *(float)0.5; boxExtraPosY = MainMenu.AbilityOverlayMenu.Item("ExtraPosSliderSpellY").GetValue <Slider>().Value *(float)0.5; itemBoxSizeX = HpBar.SizeX / 6 + MainMenu.AbilityOverlayMenu.Item("sizeSliderItem").GetValue <Slider>().Value; itemBoxSizeY = (float)(itemBoxSizeX / 1.24); itemboxExtraPosX = MainMenu.AbilityOverlayMenu.Item("ExtraPosSliderItemX").GetValue <Slider>().Value *(float)0.5; itemboxExtraPosY = MainMenu.AbilityOverlayMenu.Item("ExtraPosSliderItemY").GetValue <Slider>().Value *(float)0.5; Utils.Sleep(100, "AbilityOverlay.Update"); } var size = new Vector2(HpBar.SizeX, (float)(HpBar.SizeY / 2.8)); var spellOverlayEnabledEnemy = MainMenu.AbilityOverlayMenu.Item("enableSpellOverlayEnemy").GetValue <bool>(); var enableManaBar = MainMenu.ManaBarMenu.Item("enableManaBar").GetValue <bool>(); try { foreach (var hero in EnemyHeroes.UsableHeroes) { var heroName = NameManager.Name(hero); var mana = hero.Mana; var maxMana = hero.MaximumMana; var hpbarpos = HpBar.HpBarPositionDictionary[heroName]; if (hpbarpos.X + 20 > HUDInfo.ScreenSizeX() || hpbarpos.X - 20 < 0 || hpbarpos.Y + 100 > HUDInfo.ScreenSizeY() || hpbarpos.Y - 30 < 0) { continue; } if (enableManaBar) { var start = hpbarpos + new Vector2(0, HpBar.SizeY + 1); var manaperc = mana / maxMana; Drawing.DrawRect(start, size + new Vector2(1, 1), new Color(0, 0, 50, 150)); Drawing.DrawRect(start, new Vector2(size.X * manaperc, size.Y), new Color(70, 120, 220)); Drawing.DrawRect(start + new Vector2(-1, -1), size + new Vector2(3, 3), Color.Black, true); } if (EnemyHeroes.AbilityDictionary.ContainsKey(heroName) && spellOverlayEnabledEnemy) { var abilities = EnemyHeroes.AbilityDictionary[heroName].Where( x => (int)x.AbilitySlot >= 0 && (int)x.AbilitySlot <= 5) .OrderBy(x => (int)x.AbilitySlot); var defaultPos = hpbarpos + new Vector2( HpBar.SizeX / 2 - Math.Max((abilities.Count() / 2) * boxSizeX, HpBar.SizeX / 2), HpBar.SizeY + size.Y + 3); var position = defaultPos + new Vector2(boxExtraPosX, boxExtraPosY); foreach (var ability in abilities) { DrawAbilityOverlay(ability, position, heroName, mana); position += new Vector2(boxSizeX, 0); } } if (MainMenu.AbilityOverlayMenu.Item("enableItemOverlayEnemy").GetValue <bool>()) { if (!EnemyHeroes.ItemDictionary.ContainsKey(heroName)) { continue; } var items = EnemyHeroes.ItemDictionary[heroName].Where(ability => ability.IsValid).ToList(); var itemPos = hpbarpos - new Vector2( -HpBar.SizeX / 2 + Math.Max((items.Count / 2) * itemBoxSizeX, HpBar.SizeX / 2), itemBoxSizeY); var ItemPosExtra = itemPos + new Vector2(itemboxExtraPosX, itemboxExtraPosY); foreach (var ability in items) { DrawItemOverlay(ability, ItemPosExtra, mana); ItemPosExtra += new Vector2(itemBoxSizeX, 0); } } } } catch (EntityNotFoundException e) { EnemyHeroes.UpdateHeroes(); Console.WriteLine(e.ToString()); } var spellOverlayEnabledAlly = MainMenu.AbilityOverlayMenu.Item("enableSpellOverlayAlly").GetValue <bool>(); try { foreach (var hero in AllyHeroes.UsableHeroes) { var heroName = NameManager.Name(hero); var mana = hero.Mana; var hpbarpos = HpBar.HpBarPositionDictionary[heroName]; if (hpbarpos.X + 20 > HUDInfo.ScreenSizeX() || hpbarpos.X - 20 < 0 || hpbarpos.Y + 100 > HUDInfo.ScreenSizeY() || hpbarpos.Y - 30 < 0) { continue; } if (spellOverlayEnabledAlly && AllyHeroes.AbilityDictionary.ContainsKey(heroName)) { var abilities = AllyHeroes.AbilityDictionary[heroName].Where( x => (int)x.AbilitySlot >= 0 && (int)x.AbilitySlot <= 5) .OrderBy(x => (int)x.AbilitySlot); var defaultPos = hpbarpos + new Vector2( HpBar.SizeX / 2 - Math.Max((abilities.Count() / 2) * boxSizeX, HpBar.SizeX / 2), HpBar.SizeY + size.Y + 3); if (hero.Equals(AbilityMain.Me)) { defaultPos += new Vector2(-3, 3); } var position = defaultPos + new Vector2(boxExtraPosX, boxExtraPosY); foreach (var ability in abilities) { DrawAbilityOverlay(ability, position, heroName, mana); position += new Vector2(boxSizeX, 0); } } if (MainMenu.AbilityOverlayMenu.Item("enableItemOverlayAlly").GetValue <bool>()) { if (!AllyHeroes.ItemDictionary.ContainsKey(heroName)) { continue; } var items = AllyHeroes.ItemDictionary[heroName].Where(ability => ability.IsValid).ToList(); var itemPos = hpbarpos - new Vector2( -HpBar.SizeX / 2 + Math.Max((items.Count / 2) * itemBoxSizeX, HpBar.SizeX / 2), itemBoxSizeY); var ItemPosExtra = itemPos + new Vector2(itemboxExtraPosX, itemboxExtraPosY); if (hero.Equals(AbilityMain.Me)) { ItemPosExtra += new Vector2(-3, 1); } foreach (var ability in items) { DrawItemOverlay(ability, ItemPosExtra, mana); ItemPosExtra += new Vector2(itemBoxSizeX, 0); } } } } catch (EntityNotFoundException e) { AllyHeroes.UpdateHeroes(); Console.WriteLine(e.ToString()); } }
static void Main(string[] args) { Menu Position = new Menu("Position", "position"); Position.AddItem(new MenuItem("xposition", "X Position").SetValue(new Slider(450, 1, (int)HUDInfo.ScreenSizeX()))); Position.AddItem(new MenuItem("yposition", "Y Position").SetValue(new Slider(110, 1, (int)HUDInfo.ScreenSizeY()))); Menu.AddSubMenu(Position); Menu.AddToMainMenu(); Game.OnWndProc += Game_OnWndProc; Drawing.OnDraw += Drawing_OnDraw; }