forked from dredknight/H5_DLL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModElementalResistance.cpp
77 lines (66 loc) · 2.5 KB
/
ModElementalResistance.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include "pch.h"
// EDIT ELEMENTAL RESISTANCE ARTIFACTS
// (9) Iceberg Shield : from +50% to +33% to fire resistance
// (20) Magnetic Ring : from +50% to +33% to lightning resistance
// (43) Dragon Flame Tongue : from +50% to +20% to ice resistance
// (62) Cloak of Sylanna : from +50% to +33% to earth resistance
// (84) Frozen Heart : from +25% to +33% to ice resistance
// (85) Dwarven Smithy Hummer : from +25% to +20% to fire resistance
// (124) Elrath Divine Shield : +40% to all element resistance
void ElemProofFork();
void FireProofAbilityFork();
int ElemProof_fork = 0x0097B0C5;
int ElemProof_return = 0x0097B0CB;
int ElemProof_end = 0x0097B23F;
int FireProofAbility_fork = 0x0097B172;
int FireProofAbility_return = 0x0097B23B;
float elemproof = 0.67f;
void ElemProof_init(pugi::xml_document& doc) {
assembly_patches.push_back({ PATCH_FLOAT_PTR, 0x0097B0FF, 4, nullptr, 0, elemproof, 0, 0 });
assembly_patches.push_back({ PATCH_FLOAT_PTR, 0x0097B237, 4, nullptr, 0, elemproof, 0, 0 });
assembly_patches.push_back({ PATCH_FLOAT_PTR, 0x0097B1D3, 4, nullptr, 0, constf_0_8, 0, 0 });
assembly_patches.push_back({ PATCH_FLOAT_PTR, 0x0097B204, 4, nullptr, 0, elemproof, 0, 0 });
assembly_patches.push_back({ PATCH_FLOAT_PTR, 0x0097B130, 4, nullptr, 0, constf_0_8, 0, 0 });
assembly_patches.push_back({ PATCH_HOOK, ElemProof_fork, 6, ElemProofFork, 0, 0, 0 });
assembly_patches.push_back({ PATCH_HOOK, FireProofAbility_fork, 5, FireProofAbilityFork, 0, 0, 0 });
}
__declspec(naked) void ElemProofFork() {
__asm
{
ja JUMPTABLE_DEFAULT_CASE
test ebx, ebx
je JUMPTABLE_DEFAULT_CASE
mov edx, [ebx]
mov ecx, ebx
call dword ptr [edx + 0x74]
push 0x7C
mov ecx, eax
call[count_equipped_artifact]
test eax, eax
je JUMPTABLE_ENTRYPOINT
push 0x0
push 0x0
push 0x7C
xor dl, dl
mov ecx, esi
call[notify_artifact_buff]
fld dword ptr [esp + 0x48]
fmul dword ptr [constf_0_6]
fstp dword ptr [esp + 0x48]
JUMPTABLE_ENTRYPOINT:
mov ecx, ebp
call[get_spell_element]
add eax, 0x0FFFFFFFF
jmp[ElemProof_return]
JUMPTABLE_DEFAULT_CASE:
jmp[ElemProof_end]
}
}
__declspec(naked) void FireProofAbilityFork() {
__asm
{
fld dword ptr [esp + 0x48]
fmul dword ptr [constf_0_5]
jmp[FireProofAbility_return]
}
}