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); }
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); }