Example #1
0
        private static int FuncBody(IntPtr parLuaState)
        {
            if (Lua.ArgsCount(parLuaState) != 0)
            {
                return(0);
            }

            if (!enabled)
            {
                Lua.Print("Starting to loot all corpses in range");
                if (ObjectManager.EnumObjects())
                {
                    List <WoWUnit> mobs = ObjectManager.Mobs;
                    lootableUnits = mobs.OfType <WoWUnit>()
                                    .Where(i => i.CanBeLooted &&
                                           i.DistanceTo(ObjectManager.Player) < 4.20f)
                                    .OrderBy(i => i.DistanceTo(ObjectManager.Player))
                                    .ToList();
                    lootCounter = 0;
                    lootOpen    = false;
                    enabled     = true;
                    Wait.Remove("LootOpenBlacklist");
                    Wait.Remove("LootClickBlacklist");
                    AntiWarden.HookWardenMemScan.GetHack("LootPatch").Apply();
                    if (AutoLoot.enabled)
                    {
                        OnRightClickUnitHook.Remove();
                        OnRightClickObjectHook.Remove();
                    }
                    DirectX.RunInEndScene(EndScene);
                }
            }
            return(0);
        }
Example #2
0
        static void MainTwo()
        {
            // Setting culture for float etc (. instead of ,)
            CultureInfo.DefaultThreadCurrentCulture   = CultureInfo.InvariantCulture;
            CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            // ClassicFramework cant be run alone!
            if (Process.GetCurrentProcess().ProcessName.StartsWith("ClassicFramework"))
            {
                if (!Assembly.GetExecutingAssembly().Location.ToLower().Contains("internal"))
                {
                    MessageBox.Show("Your file structure is corrupt. Please redownload ClassicFramework");
                    Environment.Exit(-1);
                }
                // Do the settings exist?
                if (!File.Exists(".\\Settings.xml"))
                {
                    OpenFileDialog loc = new OpenFileDialog();
                    loc.CheckFileExists = true;
                    loc.CheckPathExists = true;
                    loc.Filter          = "executable (*.exe)|*.exe";
                    loc.FilterIndex     = 1;
                    loc.Title           = "Please locate your WoW.exe";
                    if (loc.ShowDialog() == DialogResult.OK)
                    {
                        OOP.Settings.Recreate(loc.FileName);
                    }
                }
                Launch.Run();
                Environment.Exit(0);
            }
            WinImports.LoadLibrary(
                Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\FastCallDll.dll"
                );
            //WinImports.AllocConsole();
            //Logger.Append("We are injected now!");

            string    path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            XDocument doc  = XDocument.Load(path + "\\Settings.xml");
            XElement  loot = doc.Element("Settings").Element("AutoLoot");

            LuaFunctions.CustomFuncs.AutoLoot.enabled = Convert.ToBoolean(loot.Value);
            Memory.Init();
            RegisterFunctionHook.Init();
            UnregisterFunctionHook.Init();
            if (LuaFunctions.CustomFuncs.AutoLoot.enabled)
            {
                OnRightClickUnitHook.Apply();
                OnRightClickObjectHook.Apply();
            }
            Singleton.Initialise();
            while (true)
            {
                Thread.Sleep(250);
            }
            // Run the GUI
            //Application.Run(new Main());
        }
Example #3
0
 private static void EndScene(ref int parFrameCount)
 {
     if (lootableUnits.Count == lootCounter)
     {
         enabled  = false;
         lootOpen = false;
         Wait.Remove("LootOpenBlacklist");
         Wait.Remove("LootClickBlacklist");
         DirectX.StopRunning();
         Lua.Print("We are done looting");
         if (AutoLoot.enabled)
         {
             OnRightClickUnitHook.Apply();
             OnRightClickObjectHook.Apply();
         }
         AntiWarden.HookWardenMemScan.GetHack("LootPatch").Remove();
     }
     else
     {
         if (Wait.For("LootUnit", 250))
         {
             if (!Functions.IsLooting(ObjectManager.Player.Pointer))
             {
                 if (lootOpen)
                 {
                     lootCounter++;
                     if (lootableUnits.Count == lootCounter)
                     {
                         return;
                     }
                 }
                 Wait.Remove("LootOpenBlacklist");
                 if (Wait.For("LootClickBlacklist", 5000))
                 {
                     lootCounter++;
                     Wait.Remove("LootClickBlacklist");
                     return;
                 }
                 Functions.OnRightClickUnit(lootableUnits[lootCounter].Pointer, 0);
                 lootOpen = false;
             }
             else
             {
                 lootOpen = true;
                 Wait.Remove("LootClickBlacklist");
                 Functions.LootAll();
                 if (Wait.For("LootOpenBlacklist", 5000))
                 {
                     lootCounter++;
                     Wait.Remove("LootOpenBlacklist");
                     Functions.DoString("LootCloseButton:Click()");
                     return;
                 }
             }
         }
     }
 }
Example #4
0
        private static int FuncBody(IntPtr parLuaState)
        {
            try
            {
                if (Lua.ArgsCount(parLuaState) != 0)
                {
                    return(0);
                }

                if (enabled)
                {
                    enabled = false;
                    OnRightClickUnitHook.Remove();
                    OnRightClickObjectHook.Remove();
                    Lua.Print("Autoloot disabled");
                }
                else
                {
                    enabled = true;
                    OnRightClickUnitHook.Apply();
                    OnRightClickObjectHook.Apply();
                    Lua.Print("Autoloot enabled");
                }

                string    path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                XDocument doc  = XDocument.Load(path + "\\Settings.xml");
                doc.Element("Settings").Element("AutoLoot").Value = enabled.ToString();
                doc.Save(path + ".\\Settings.xml");
            }
            catch
            {
                MessageBox.Show("Settings.xml is broken or non-existent. Please delete it and relaunch the hack!");
                Process.GetCurrentProcess().Kill();
            }

            return(0);
        }