forked from maikel233/xhook_wowclassic_TBC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Hacks.cpp
162 lines (134 loc) · 5.75 KB
/
Hacks.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#include "Hacks.h"
bool Settings::Hacks::Movement::JumpState = false;
bool Settings::Hacks::Movement::SuperSlowFall = false;
bool Settings::Hacks::Movement::JumpStatev2 = false;
bool Settings::Hacks::Movement::CTM = false;
int Settings::Hacks::Movement::SuperSlowSleepTime = 20;
namespace WoW
{
void Hacks::FreezeJump(WObject* localplayer)
{
if (!Settings::Hacks::Movement::JumpState)
return;
__try
{
float ZAxis = Globals::LocalPlayer->GetUnitPosition().z;
if (Settings::Hacks::Movement::SuperSlowFall) {
Sleep(Settings::Hacks::Movement::SuperSlowSleepTime); // Some users will dc on 20ms try a higher number but this will decrease your in air time. I should probably check in jump state + max jump alt?
localplayer->StopFall = 824;
return;
}
if (GetAsyncKeyState(VK_SPACE) & 0x8000) {
Sleep(50);
if (localplayer->GetUnitPosition().z == ZAxis)
return;
if (localplayer->GetUnitPosition().z != ZAxis) {
Sleep(600);
localplayer->StopFall = 824;
}
}
}
__except (Utils::filterException(GetExceptionCode(), GetExceptionInformation())) {
printf("[!] Freeze jump caused a error!\n");
}
}
void Hacks::ModifyJumpHeight(WObject* localplayer)
{
//Useless dc at jump...
if (!Settings::Hacks::Movement::JumpStatev2)
return;
/*if (GetAsyncKeyState(VK_SPACE) & 0x8000) {
localplayer->StartofJumpHeight = Settings::Hacks::Movement::jumpHeight;
}*/
}
void Hacks::CTMLP(WObject* OBJDestination)
{
/* if (!Utils::ValidCoord(OBJDestination))
return*/;
if ((OBJDestination->GetUnitPosition().x == 0 && OBJDestination->GetUnitPosition().y == 0 && OBJDestination->GetUnitPosition().z == 0) || Utils::GetDistance(OBJDestination->GetUnitPosition()) >= 100000)
return;
WObject* LocalPlayer = Globals::LocalPlayer;
GameMethods::ClickToMove(LocalPlayer->Ptr(), OBJDestination->GetUnitPosition());
WoWObjectManager::SetHardwareEvent();
}
void Hacks::CTM(Vector3 destination)
{
if ((destination.x == 0 && destination.y == 0 && destination.z == 0) || Utils::GetDistance(destination) >= 100000)
return;
WObject* LocalPlayer = Globals::LocalPlayer;
GameMethods::ClickToMove(LocalPlayer->Ptr(), destination);
WoWObjectManager::SetHardwareEvent();
}
static bool once;
void Hacks::GExecute_IGFunctions()
{
WObject* localplayer = (WObject*)Globals::LocalPlayer;
if (!localplayer) {
return;
}
Hacks::FreezeJump(localplayer);
Hacks::ModifyJumpHeight(localplayer);
if (!Settings::Hacks::Movement::TogglePlayerState)
return;
if (Settings::Hacks::Movement::TogglePlayerState) {
once = true;
if (Settings::Hacks::Movement::CurrentPlayerState == PlayerState::Ground)
localplayer->MovementFlags = MovementFlags::MOVEMENTFLAG_NONE;
else if (Settings::Hacks::Movement::CurrentPlayerState == PlayerState::Swimming)
localplayer->MovementFlags = MovementFlags::MOVEMENTFLAG_SWIMMING;
else if (Settings::Hacks::Movement::CurrentPlayerState == PlayerState::UnderWaterWalking)
localplayer->MovementFlags = MovementFlags::MOVEMENTFLAG_WALKING; //Yes
else if (Settings::Hacks::Movement::CurrentPlayerState == PlayerState::WaterWalking)
localplayer->MovementFlags = MovementFlags::MOVEMENTFLAG_WATERWALKING; //Below this one are useless used for testing.
else if (Settings::Hacks::Movement::CurrentPlayerState == PlayerState::FallingSlow)
localplayer->MovementFlags = MovementFlags::MOVEMENTFLAG_FALLING_FAR;
else if (Settings::Hacks::Movement::CurrentPlayerState == PlayerState::CanFly)
localplayer->MovementFlags = MovementFlags::MOVEMENTFLAG_FALLING_SLOW;
else if (Settings::Hacks::Movement::CurrentPlayerState == PlayerState::DisableCollision)
localplayer->MovementFlags = MovementFlags::MOVEMENTFLAG_HOVER;
else if (Settings::Hacks::Movement::CurrentPlayerState == PlayerState::Root)
localplayer->MovementFlags = MovementFlags::MOVEMENTFLAG_FLYING;
else if (Settings::Hacks::Movement::CurrentPlayerState == PlayerState::Loggedoff) // Antistun?
localplayer->MovementFlags = MovementFlags::MOVEMENTFLAG_PITCH_UP;
else if (Settings::Hacks::Movement::CurrentPlayerState == PlayerState::DisableGravity)
localplayer->MovementFlags = MovementFlags::MOVEMENTFLAG_ASCENDING;
}
else {
if (once) {
localplayer->MovementFlags = 0x3F8000003FEE38E4; // Walking state
once = false; // After any movement wow should change the value to its original.
}
}
}
int Hacks::GoToCorpse(int64_t luaState) {
//Kinda useless now because dc at tele...
if (!Globals::LocalPlayer)
return 1;
int corpseMapID = *reinterpret_cast<int*>(Offsets::CorpseMapID);
printf("Corpse located at: x %f y %f z %f MapID: %i \n", Globals::CorpsePos.x, Globals::CorpsePos.y, Globals::CorpsePos.z, corpseMapID);
if (Globals::CorpsePos.x != 0 && Globals::CorpsePos.y != 0 && Globals::CorpsePos.z != 0) {
Globals::LocalPlayer->GetUnitPositionModify.x = Globals::CorpsePos.x;
Globals::LocalPlayer->GetUnitPositionModify.y = Globals::CorpsePos.y;
Globals::LocalPlayer->GetUnitPositionModify.z = Globals::CorpsePos.z;
}
else {
printf("Corpse not found!!!\n");
}
return 1;
}
int Hacks::fakeTeleport(int64_t luastate) {
//Kinda useless now because dc at tele...
if (!Globals::LocalPlayer)
return 1;
if (Settings::Hacks::Movement::TeleportBack) {
Globals::LocalPlayer->GetUnitPosition() = Settings::Hacks::Movement::PrevPos; // For now
Settings::Hacks::Movement::TeleportBack = false;
return 1;
}
else {
Settings::Hacks::Movement::PrevPos = Globals::LocalPlayer->GetUnitPosition();
}
Globals::LocalPlayer->GetUnitPosition() = Settings::Hacks::Movement::NextPos; // For now
return 1;
}
};