bool CNWNXSystem::OnCreate(gline *config, const char *LogDir) { char log[128]; sprintf(log, "%s/nwnx_system.txt", LogDir); /* call the base class create function */ if (!CNWNXBase::OnCreate(config, log)) return false; /* find hook signatures */ SystemSearchSignatures(); if (Ref_TMILimit != NULL) nx_hook_enable_write(Ref_TMILimit, 16); return true; }
int HookFunctions() { unsigned char *sendto_call = (unsigned char *) 0x082C791B; nx_hook_enable_write(sendto_call, 5); *(uint32_t *)(sendto_call + 1) = (uint32_t)sendto_hook - (uint32_t)(sendto_call + 5); }
int FindFunctions() { *(dword*)&CNWSPlayer__GetPCObject = 0x0805ee30; *(dword*)&CNWSItem__RemoveFromArea = 0x081a669c; *(dword*)&CNWMessage__ReadDWORD = 0x080c36cc; *(dword*)&CNWMessage__MessageReadOverflow = 0x080c3a64; *(dword*)&CNWSMessage__ReadOBJECTIDServer = 0x08052d84; /* DM ACTIVITY HOOKS */ unsigned char *pDM = (unsigned char *)0x0818c7cb;// GiveLevel nx_hook_enable_write(pDM, 8); memset((void *)pDM, '\x90', 8); pDM[0] = '\xE9'; *((uint32_t *)(pDM + 1)) = (uint32_t)hook_DMActivity_GiveLevel - (uint32_t)(pDM + 5); pDM = (unsigned char *)0x0818c6eb; // GiveXP nx_hook_enable_write(pDM, 8); memset((void *)pDM, '\x90', 8); pDM[0] = '\xE9'; *((uint32_t *)(pDM + 1)) = (uint32_t)hook_DMActivity_GiveXP - (uint32_t)(pDM + 5); pDM = (unsigned char *)0x0818c8ce;// GiveGold nx_hook_enable_write(pDM, 6); memset((void *)pDM, '\x90', 8); pDM[0] = '\xE9'; *((uint32_t *)(pDM + 1)) = (uint32_t)hook_DMActivity_GiveGold - (uint32_t)(pDM + 5); pDM = (unsigned char *)0x0818a19f; // Create Item On Location nx_hook_enable_write(pDM, 9); memset((void *)pDM, '\x90', 9); pDM[0] = '\xE9'; *((uint32_t *)(pDM + 1)) = (uint32_t)hook_DMActivity_CreateItem_OnArea - (uint32_t)(pDM + 5); pDM = (unsigned char *)0x0818d22d; // Create Item On Creature nx_hook_enable_write(pDM, 37); memset((void *)pDM, '\x90', 37); pDM[0] = '\xE9'; *((uint32_t *)(pDM + 1)) = (uint32_t)hook_DMActivity_CreateItem_OnCreature - (uint32_t)(pDM + 5); pDM = (unsigned char *)0x0818d2fd; // Create Item On Placeable nx_hook_enable_write(pDM, 24); memset((void *)pDM, '\x90', 24); pDM[0] = '\xE9'; *((uint32_t *)(pDM + 1)) = (uint32_t)hook_DMActivity_CreateItem_OnPlaceable - (uint32_t)(pDM + 5); pDM = (unsigned char *)0x08188e77; // Heal Creature nx_hook_enable_write(pDM, 8); memset((void *)pDM, '\x90', 8); pDM[0] = '\xE9'; *((uint32_t *)(pDM + 1)) = (uint32_t)hook_DMActivity_Heal - (uint32_t)(pDM + 5); pDM = (unsigned char *)0x08188d6a; // Rest Creature nx_hook_enable_write(pDM, 5); memset((void *)pDM, '\x90', 5); pDM[0] = '\xE9'; *((uint32_t *)(pDM + 1)) = (uint32_t)hook_DMActivity_Rest - (uint32_t)(pDM + 5); pDM = (unsigned char *)0x081860c8; // Cheat - RunScript nx_hook_enable_write(pDM, 5); *((uint32_t *)(pDM + 1)) = (uint32_t)hook_DMActivity_RunScript - (uint32_t)(pDM + 5); pDM = (unsigned char *)0x0818bc60; // Create Placeable nx_hook_enable_write(pDM, 9); memset((void *)pDM, '\x90', 9); pDM[0] = '\xE9'; *((uint32_t *)(pDM + 1)) = (uint32_t)hook_DMActivity_CreatePlaceable - (uint32_t)(pDM + 5); pDM = (unsigned char *)0x08189ee1; // Spawn Creature nx_hook_enable_write(pDM, 9); memset((void *)pDM, '\x90', 9); pDM[0] = '\xE9'; *((uint32_t *)(pDM + 1)) = (uint32_t)hook_DMActivity_SpawnCreature - (uint32_t)(pDM + 5); pDM = (unsigned char *)0x08188af1; // Toggle Invulnerability nx_hook_enable_write(pDM, 9); memset((void *)pDM, '\x90', 9); pDM[0] = '\xE9'; *((uint32_t *)(pDM + 1)) = (uint32_t)hook_DMActivity_ToggleInvulnerability - (uint32_t)(pDM + 5); pDM = (unsigned char *)0x08188c29; // Toggle Immortality nx_hook_enable_write(pDM, 9); memset((void *)pDM, '\x90', 9); pDM[0] = '\xE9'; *((uint32_t *)(pDM + 1)) = (uint32_t)hook_DMActivity_ToggleImmortality - (uint32_t)(pDM + 5); pDM = (unsigned char *)0x081882e4; // HandlePlayerToServerDungeonMasterMessage nx_hook_enable_write(pDM, 5); memset((void *)pDM, '\x90', 5); pDM[0] = '\xE9'; *((uint32_t *)(pDM + 1)) = (uint32_t)hook_DMActivity_MessageAll - (uint32_t)(pDM + 5); return true; }