bool CNWNXTweaks::OnCreate(gline *config, const char *LogDir) { char log[128]; sprintf(log, "%s/nwnx_tweaks.txt", LogDir); /* call the base class create function */ if (!CNWNXBase::OnCreate(config, log)) return false; /* find hook signatures */ TweaksSearchSignatures(); /* add the possibility of additional caster classes */ if (CNWSCreature__SendFeedbackMessage != NULL) { uintptr_t p = (uintptr_t)CNWSCreature__SendFeedbackMessage; extern volatile uintptr_t Hook_FSFM_Return; Hook_FSFM_Return = p + 31; nx_hook_function((void *)(p + 25), (void *)Hook_FixSendFeedbackMessage, 5, NX_HOOK_DIRECT); } return true; }
bool CNWNXCombat::OnCreate(gline *config, const char *LogDir) { char log[128]; sprintf(log, "%s/nwnx_combat.txt", LogDir); if(!CNWNXBase::OnCreate(config, log)) return false; nx_hook_function((void *) 0x080E1D50, (void *) Hook_CalculateOffHandAttacks, 5, NX_HOOK_DIRECT); return true; }
int InitHooks() { *(unsigned long*)&CNWMessage__WriteSHORT = 0x80c3ddc; *(unsigned long*)&CNWSMessage__WriteOBJECTIDServer = 0x8052434; *(unsigned long*)&CNWSPlayer__GetGameObject = 0x0805e8b8; *(unsigned long*)&C2DA__GetINTEntry = 0x082bd77c; *(unsigned long*)&C2DA__GetCExoStringEntry = 0x082bedbc; *(unsigned long*)&CNWSItem__GetPropertyByTypeExists = 0x081a2a6c; if (extend.GetConfInteger("examine_cr_npc_only")) { /* EXAMINE CR ON NPC ONLY */ nx_hook_function((void *)0x08073d15, (void *)hook_ExamineCR_NPC_Only, 8, NX_HOOK_DIRECT); extend.Log(0, "Examine CR on NPC Only : ENABLED\n"); } else { extend.Log(0, "Examine CR on NPC Only : DISABLED\n"); } /* Party Display */ if (extend.GetConfInteger("party_percentage_hp")) { nx_hook_function((void *)0x080731d3, (void *)Hook_WriteGameObjUpdate_PercentPartyHP, 6, NX_HOOK_DIRECT); extend.Log(0, "Party Precentage HP : ENABLED\n"); } else { extend.Log(0, "Party Precentage HP : DISABLED\n"); } if (extend.GetConfInteger("party_hide_areas")) { nx_hook_function((void *)0x080730f0, (void *)Hook_WriteGameObjUpdate_HideArea, 6, NX_HOOK_DIRECT); extend.Log(0, "Party Hide Area : ENABLED\n"); } else { extend.Log(0, "Party Hide Area : DISABLED\n"); } if ((confMaxDexterityBonus_ip = extend.GetConfInteger("maxdexbonus_ip")) > 0) { nx_hook_function((void *)0x081518e9, (void *)Hook_GetDEXMod_ipMaxDexBonusMod_0x081518e9, 5, NX_HOOK_DIRECT); extend.Log(0, "Max Dexterity Bonus ItemProperty : ENABLED (Property: %d)\n", confMaxDexterityBonus_ip); } else { extend.Log(0, "Max Dexterity Bonus ItemProperty : DISABLED\n"); } if ((confIneffectiveUMD_ip = extend.GetConfInteger("ineffective_umd_ip")) > 0) { nx_hook_function((void *)0x0811172c, (void *)Hook_CheckUseMagicDeviceSkill, 5, NX_HOOK_DIRECT); extend.Log(0, "Ineffective Use Magical Device ItemProperty : ENABLED (Property: %d)\n", confIneffectiveUMD_ip); } else { extend.Log(0, "Ineffective Use Magical Device ItemProperty : DISABLED\n"); } if ((extend.GetConfInteger("equip_unidentified"))) { /* Allow to equip unidentified items */ nx_hook_function((void *)0x80ffa5a, (void *)0x80ffa8c, 6, NX_HOOK_DIRECT); extend.Log(0, "Allow to Equip Unidentified items : ENABLED\n"); } else { extend.Log(0, "Allow to Equip Unidentified items : DISABLED\n"); } /* GetMeetsPrestigeClassRequirements */ nx_hook_function((void *)0x081588c7, (void *)Hook_GetMeetsPrestigeClassRequirements, 8, NX_HOOK_DIRECT); return true; }