public EzGUI(float _x, float _y, string _title) { Main = new EzElement(ElementType.CATEGORY, "MAIN_CAT", true); x = _x; y = _y; title = _title; }
public static void MouseClick(EzElement e) { foreach (EzElement element in e.In) { bool mouseIn = MouseIn(element.Position); if (element.Type == ElementType.CATEGORY) { if (mouseIn) element.isOpen = !element.isOpen; if (element.isOpen) MouseClick(element); } else if (mouseIn) element.isActive = !element.isActive; } }
static void Game_OnUpdate(EventArgs args) { if (!Game.IsInGame) { loaded = false; return; } if (Game.GameState != GameState.Started) return; #region If assembly not loaded if (loaded == false) { gui = new EzGUI(Drawing.Width - 350, 50, "PRubick " + VERSION); enabled = new EzElement(ElementType.CHECKBOX, "Enabled / Активен", true); spcat = new EzElement(ElementType.CATEGORY, "Spell Steal / Кража скиллов", false); stealIfHave = new EzElement(ElementType.CHECKBOX, "Steal if no cd / Воровать если нет кд [CHECKED]", false); gui.AddMainElement(new EzElement(ElementType.TEXT, "Main / Главная", false)); gui.AddMainElement(enabled); gui.AddMainElement(stealIfHave); gui.AddMainElement(new EzElement(ElementType.TEXT, "Rubick", false)); gui.AddMainElement(spcat); myHero = ObjectMgr.LocalHero; spellSteal = myHero.Spellbook.SpellR; loaded = true; } #endregion if (myHero.ClassID != ClassID.CDOTA_Unit_Hero_Rubick) return; // if (enabled.isActive) { Hero[] enemies = ObjectMgr.GetEntities<Hero>().Where(x => x.Team != myHero.Team && !x.IsIllusion() && x.IsAlive && x.IsVisible ).ToArray(); #region GUI Checks if (Utils.SleepCheck("GUI_ABILITIES") && heroes != null) { foreach (EzElement element in heroes.In) { foreach (EzElement element2 in element.In) { if (element2.isActive && !includedAbilities.Contains(element2.Content)) includedAbilities.Add(element2.Content); if (!element2.isActive && includedAbilities.Contains(element2.Content)) includedAbilities.Remove(element2.Content); } } Utils.Sleep(1000, "GUI_ABILITIES"); } if (heroes == null) { heroes = new EzElement(ElementType.CATEGORY, "Heroes / Герои", false); for (int i = 0; i < 21; i++) { var player = ObjectMgr.GetPlayerById((uint)i); if (player != null && player != ObjectMgr.LocalPlayer && player.Team != myHero.Team && myHero.IsAlive && player.ConnectionState == ConnectionState.Connected && player.Hero != null && player.Handle != null) { var enemy = player.Hero; if (enemy == null || enemy.Spellbook == null || enemy.Spellbook.Spells == null) continue; var hero = new EzElement(ElementType.CATEGORY, enemy.Name.Replace("_", "").Replace("npcdotahero", ""), false); foreach (Ability ability in enemy.Spellbook.Spells) { if (ability.AbilityBehavior == AbilityBehavior.Passive) continue; if (ability.AbilityType == AbilityType.Attribute) continue; bool ac = false; if (ability.AbilityType == AbilityType.Ultimate) { ac = true; includedAbilities.Add(ability.Name); } EzElement abElement = new EzElement(ElementType.CHECKBOX, ability.Name, ac); hero.In.Add(abElement); } heroes.In.Add(hero); } } spcat.In.Add(heroes); } #endregion foreach (Hero enemy in enemies) { if (Utils.SleepCheck(enemy.ClassID.ToString())) { foreach (Ability ability in enemy.Spellbook.Spells) { if (includedAbilities.Contains(ability.Name) && ability.CooldownLength - ability.Cooldown < (float)0.7 + ( Game.Ping /1000 ) && !spellOnCooldown(ability.Name) && iCanSteal(enemy) && myHero.Spellbook.SpellD.Name != ability.Name && ability.CooldownLength != 0) { if (stealIfHave.isActive == false && myHero.Spellbook.SpellD.Cooldown == 0 && includedAbilities.Contains(myHero.Spellbook.SpellD.Name)) continue; if (spellSteal.CanBeCasted()) spellSteal.UseAbility(enemy); } } Utils.Sleep(125, enemy.ClassID.ToString()); } } } }
public void AddMainElement(EzElement en) { Main.In.Add(en); }
public void DrawElement(EzElement element, int i, int incat) { byte alpha = 140; if (element.isActive || element.isOpen) alpha = 255; int xoffset = 5 * incat; int yoffset = 20; ColorBGRA color = new ColorBGRA(32, 52, 123, alpha); element.Position = new float[4] { x + xoffset, x + xoffset + 15, y + yoffset * i, y + yoffset * i + 13 }; if (MouseIn(element.Position)) { color.R = 10; } switch (element.Type) { case ElementType.CATEGORY: _2DGeometry.DrawFilledBox(element.Position[0], element.Position[2], 15, 15, color); _2DGeometry.DrawShadowText("> "+element.Content, x + xoffset + 18, y + yoffset * i, new ColorBGRA(12, 0, 222, 255)); break; case ElementType.CHECKBOX: _2DGeometry.DrawFilledBox(element.Position[0], element.Position[2], 15, 15, color); _2DGeometry.DrawShadowText(element.Content, x + xoffset + 18, element.Position[2], new ColorBGRA(12, 0, 222, 255)); break; case ElementType.TEXT: _2DGeometry.DrawShadowText(element.Content, element.Position[0], element.Position[2], new ColorBGRA(12, 0, 222, 255)); break; } }
public void Count(EzElement elem, ref int i) { foreach (EzElement element in elem.In) { i++; if (element.Type == ElementType.CATEGORY && element.isOpen) Count(element, ref i); } }