add unit field access as well as spell modifiers

This commit is contained in:
avitasia
2025-12-02 13:27:59 -08:00
parent 2ed95bc439
commit 2c81677cfa
11 changed files with 806 additions and 26 deletions
+19 -4
View File
@@ -93,6 +93,7 @@ namespace Nampower {
std::unique_ptr<hadesmem::PatchDetour<CancelSpellT>> gCancelSpellDetour;
std::unique_ptr<hadesmem::PatchDetour<SignalEventT>> gSignalEventDetour;
std::unique_ptr<hadesmem::PatchDetour<Spell_C_SpellFailedT>> gSpellFailedDetour;
std::unique_ptr<hadesmem::PatchDetour<Spell_C_GetSpellModifiersT>> gSpell_C_GetSpellModifiersDetour;
std::unique_ptr<hadesmem::PatchRaw> gCastbarPatch;
std::unique_ptr<hadesmem::PatchDetour<ISceneEndT>> gIEndSceneDetour;
std::unique_ptr<hadesmem::PatchDetour<Spell_C_GetAutoRepeatingSpellT>> gSpell_C_GetAutoRepeatingSpellDetour;
@@ -539,6 +540,13 @@ namespace Nampower {
// remove original call to allow registering lua functions at any address range
}
void
Spell_C_GetSpellModifiersHook(hadesmem::PatchDetourBase *detour, const game::SpellRec *spellRec, int *returnVal,
game::SpellModOp modOp) {
auto const getSpellModifiers = detour->GetTrampolineT<Spell_C_GetSpellModifiersT>();
getSpellModifiers(spellRec, returnVal, modOp);
}
void updateFromCvar(const char *cvar, const char *value) {
if (strcmp(cvar, "NP_QueueCastTimeSpells") == 0) {
gUserSettings.queueCastTimeSpells = atoi(value) != 0;
@@ -1120,9 +1128,6 @@ namespace Nampower {
gGetSpellSlotFromLuaDetour = createHook<GetSpellSlotFromLuaT>(process, Offsets::GetSpellSlotFromLua,
&GetSpellSlotFromLuaHook);
// gCGPlayer_C_OnAttackIconPressedDetour = createHook<CGPlayer_C_OnAttackIconPressedT>(process,
// Offsets::CGPlayer_C_OnAttackIconPressed,
// &CGPlayer_C_OnAttackIconPressedHook);
}
void SpellVisualsInitializeHook(hadesmem::PatchDetourBase *detour) {
@@ -1176,7 +1181,8 @@ namespace Nampower {
RegisterLuaFunction(getSpellSlotTypeIdForName, reinterpret_cast<uintptr_t *>(Script_GetSpellSlotTypeIdForName));
char channelStopCastingNextTick[] = "ChannelStopCastingNextTick";
RegisterLuaFunction(channelStopCastingNextTick, reinterpret_cast<uintptr_t *>(Script_ChannelStopCastingNextTick));
RegisterLuaFunction(channelStopCastingNextTick,
reinterpret_cast<uintptr_t *>(Script_ChannelStopCastingNextTick));
char getNampowerVersion[] = "GetNampowerVersion";
RegisterLuaFunction(getNampowerVersion, reinterpret_cast<uintptr_t *>(Script_GetNampowerVersion));
@@ -1195,6 +1201,15 @@ namespace Nampower {
char getSpellRecField[] = "GetSpellRecField";
RegisterLuaFunction(getSpellRecField, reinterpret_cast<uintptr_t *>(Script_GetSpellRecField));
char getUnitData[] = "GetUnitData";
RegisterLuaFunction(getUnitData, reinterpret_cast<uintptr_t *>(Script_GetUnitData));
char getUnitField[] = "GetUnitField";
RegisterLuaFunction(getUnitField, reinterpret_cast<uintptr_t *>(Script_GetUnitField));
char getSpellModifiers[] = "GetSpellModifiers";
RegisterLuaFunction(getSpellModifiers, reinterpret_cast<uintptr_t *>(Script_GetSpellModifiers));
}
std::once_flag loadFlag;