Beispiel #1
0
        /// <summary>
        ///     Attaches the specified the menu initializing the library.
        /// </summary>
        /// <param name="parent">The root menu.</param>
        /// <param name="menuDisplayName">Display name of the attached menu.</param>
        public static void Attach(Menu parent, string menuDisplayName = "ZLib")
        {
            GetHeroesInGame();
            GetTurretsInGame();
            GetSpellsInGame(new Gamedata());
            GetAurasInGame(new Auradata());
            GetGameTroysInGame(new Troydata());

            Helpers.CreateLogPath();

            Menu = new Menu("zlib", menuDisplayName);
            var hpmenu = new Menu("dhp", "Debug Health Prediction");

            var itest = new MenuBool("testdamage", "Trigger Damage Event", false);

            hpmenu.Add(itest).OnValueChanged += (sender, eventArgs) =>
            {
                if (eventArgs.GetNewValue <MenuBool>().Value)
                {
                    var caster = ObjectManager.GetLocalPlayer();

                    var target = AllUnits.First(x =>
                                                ((Obj_AI_Hero)x.Instance).ChampionName.ToLower() ==
                                                Menu["dhp"]["testdamagetarget"]
                                                .As <MenuList>().SelectedItem.ToLower());

                    var type = (EventType)Enum.Parse(typeof(EventType),
                                                     Menu["dhp"]["testdamagetype"].As <MenuList>().SelectedItem);

                    Projections.EmulateDamage(caster, target, new Gamedata {
                        SpellName = "test" + Environment.TickCount
                    }, type,
                                              "debug.Test");
                    DelayAction.Queue(100, () => itest.Value = false);
                }
            };

            hpmenu.Add(new MenuList("testdamagetype", "EventType",
                                    Enum.GetValues(typeof(EventType)).Cast <EventType>().Select(v => v.ToString()).ToArray(), 0));
            hpmenu.Add(new MenuList("testdamagetarget", "Target",
                                    AllUnits.Select(x => ((Obj_AI_Hero)x.Instance).ChampionName).ToArray(), AllUnits.Count - 1));

            Menu.Add(hpmenu);
            Menu.Add(new MenuBool("acdebug", "Debug Income Damage", false));
            Menu.Add(new MenuBool("dumpdata", "Debug & Dump Spell Data", false));
            Menu.Add(new MenuBool("logerror", "Debug Errors in Console"));

            Menu.Add(new MenuList("hprior", "Hero Priority:", new[] { "Low HP", "Most AD/AP", "Most HP" }, 1));
            Menu.Add(
                new MenuSlider("weightdmg", "Weight Income Damage (%)", 130, 100, 150).SetToolTip(
                    "Make it think you are taking more damage than calulated."));
            Menu.Add(
                new MenuSlider("lagtolerance", "Lag Tolerance (%)", 50).SetToolTip(
                    "Make it think you are taking damage longer than intended"));
            var WhiteList = new Menu("whitelist", "Whitelist");

            {
                foreach (var target in GameObjects.AllyHeroes)
                {
                    if (target.IsMe)
                    {
                        WhiteList.Add(new MenuBool(target.ChampionName.ToLower(), "Enable: " + target.ChampionName));
                    }
                }
            }
            Menu.Add(WhiteList);
            parent.Add(Menu);

            Projections.Initizialize();
            Drawings.Initialize();
            Buffs.Initialize();
            Gametroys.Initialize();

            Console.WriteLine("ZLib: Loaded!");
        }