Ejemplo n.º 1
0
        /// <inheritdoc/>
        public void InitMod()
        {
            ModEvents.ChatMessage.RegisterHandler((ClientInfo cInfo, EChatType chatType, int senderEntityId, string msg, string mainName, bool localizeMain, List <int> recipientEntityIds) => this.OnChatMessage(cInfo, chatType, msg, recipientEntityIds));
            ModEvents.GameAwake.RegisterHandler(this.OnGameAwake);
            ModEvents.GameShutdown.RegisterHandler(this.OnGameShutdown);
            ModEvents.GameStartDone.RegisterHandler(this.OnGameStartDone);
            ModEvents.PlayerDisconnected.RegisterHandler(this.OnPlayerDisconnected);
            ModEvents.PlayerLogin.RegisterHandler((ClientInfo cInfo, string compatibilityVersion, StringBuilder rejectReason) => this.OnPlayerLogin(cInfo, rejectReason));
            ModEvents.PlayerSpawnedInWorld.RegisterHandler(this.OnPlayerSpawnedInWorld);
            ModEvents.PlayerSpawning.RegisterHandler((ClientInfo cInfo, int chunkViewDim, PlayerProfile playerProfile) => this.OnPlayerSpawning(cInfo));
            ModEvents.SavePlayerData.RegisterHandler((ClientInfo cInfo, PlayerDataFile playerDataFile) => this.OnSavePlayerData(cInfo));

            Language.Init();
            ChatHelper.Init();
            ChatHook.Init();
            VoteManager.Init();

            ConVarManager.AutoExecConfig(null, true, "Core");

            PluginManager.Refresh();
        }
Ejemplo n.º 2
0
        internal static void Init()
        {
            if (Applied)
            {
                return;
            }
            // Init Warden Module32First/Next hook
            //MessageBox.Show("TEST");

            //var snapshot = WinImports.CreateToolhelp32Snapshot(0x00000010 | 0x00000008, (uint) Reader.Process.Id);
            //var basePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            //var entry = new WinImports.MODULEENTRY32() { dwSize = 548 };
            //if (WinImports.Module32First(snapshot, ref entry))
            //{
            //    entry = new WinImports.MODULEENTRY32() { dwSize = 548 };
            //    while (WinImports.Module32Next(snapshot, ref entry))
            //    {
            //        if (entry.szExePath.Contains(basePath))
            //            Reader.WriteBytes(entry.modBaseAddr, new byte[] {0, 0, 0, 0});
            //    }
            //}

            HookModule32.Init();

            Libs.Clear();
            Libs.InjectFastcall();
            Libs.ReloadNav();

            ErrorEnumHook.Init();
            ChatHook.Init();
            GlobalHooks.Init();
            //EnterWorldHook.Init();
            //EnterWorldCompleteHook.Init();
            WindowProcHook.Init();
            HookWardenMemScan.SetupDetour();

            // Init DirectX
            DirectX.Init();
            // Init the object manager
            ObjectManager.Init();

            // Apply no collision hack with trees
            var DisableCollision = new Hack(Hacks.DisableCollision, new byte[] { 0x0F, 0x85, 0x1B, 0x01, 0x00, 0x00 },
                                            "Collision");

            HookWardenMemScan.AddHack(DisableCollision);
            //DisableCollision.Apply();
            // Ctm Patch
            var CtmPatch = new Hack(Hacks.CtmPatch,
                                    new byte[] { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }, "Ctm");

            HookWardenMemScan.AddHack(CtmPatch);
            //CtmPatch.Apply();
            // wallclimb hack yay :)
            //float wc = 0.5f;
            //Hack Wallclimb = new Hack(Hacks.Wallclimb, BitConverter.GetBytes(wc), "Wallclimb");
            //HookWardenMemScan.AddHack(Wallclimb);
            //Wallclimb.Apply();

            var Collision3 = new Hack(Hacks.Collision3, new byte[] { 0xEB, 0x69 }, "Collision3");

            HookWardenMemScan.AddHack(Collision3);

            // Loot patch
            var LootPatch = new Hack(Hacks.LootPatch, new byte[] { 0xEB }, "LootPatch");

            HookWardenMemScan.AddHack(LootPatch);
            LootPatch.Apply();

            #region Ctm Hide
            var CtmHide = new Hack(Player.CtmState, new byte[] { 0x0, 0x0, 0x0, 0x0 }, new byte[] { 0x0C, 0x00, 0x00, 0x00 },
                                   "CtmHideHack")
            {
                DynamicHide = true
            };
            HookWardenMemScan.AddHack(CtmHide);

            var CtmHideX = new Hack(Player.CtmX, new byte[] { 0x0, 0x0, 0x0, 0x0 }, new byte[] { 0x00, 0x00, 0x00, 0x00 },
                                    "CtmHideHackX")
            {
                DynamicHide = true
            };
            HookWardenMemScan.AddHack(CtmHideX);

            var CtmHideY = new Hack(Player.CtmY, new byte[] { 0x0, 0x0, 0x0, 0x0 }, new byte[] { 0x00, 0x00, 0x00, 0x00 },
                                    "CtmHideHackY")
            {
                DynamicHide = true
            };
            HookWardenMemScan.AddHack(CtmHideY);

            var CtmHideZ = new Hack(Player.CtmZ, new byte[] { 0x0, 0x0, 0x0, 0x0 }, new byte[] { 0x00, 0x00, 0x00, 0x00 },
                                    "CtmHideHackZ")
            {
                DynamicHide = true
            };
            HookWardenMemScan.AddHack(CtmHideZ);
            #endregion


            // Lua Unlock
            var LuaUnlock = new Hack(Hacks.LuaUnlock, new byte[] { 0xB8, 0x01, 0x00, 0x00, 0x00, 0xc3 }, "LuaUnlock");
            HookWardenMemScan.AddHack(LuaUnlock);
            LuaUnlock.Apply();

#if !DEBUG
            Hack DisableErrorSpam = new Hack((IntPtr)0x00496810, new byte[] { 0xB9, 0x04, 0x00, 0x00, 0x00, 0x90 }, "ErrorSpamDisable");
            HookWardenMemScan.AddHack(DisableErrorSpam);
            DisableErrorSpam.Apply();
#endif
            Applied = true;
        }