Udalo sie skonczyc bota do metka ;)
- wallhack (ignorowanie kolizji z otoczeniem)
- speedhack (na chodzenie)
- autoattack (przydante gdy chcemy zostawic postac na expowisku i odejsc od kompa)
- target damage (wysyla pakiety ataku na konkretny obiekt, co sprawia, ze hity sa kilkukrotnie mnozone wiec zabijanie bosow to sekundy)
Wrzucam pod review, czy kod jest w miare czytelny i czy ew cos poprawic pod katem "dobrych nawykow" w C.
#include <vector>
#include <windows.h>
#include "pch.h"
namespace H{
struct clicks {
bool wallhack_clicked = FALSE;
bool autoAttack_clicked = FALSE;
bool speedhack_clicked = FALSE;
int normal_speed = 0;
}click;
class find_adress {
protected:
uintptr_t FinalAddress(uintptr_t ptr, std::vector<DWORD> offsets)
{
uintptr_t addr = ptr;
for (unsigned int i = 0; i < offsets.size(); ++i)
{
addr = *(uintptr_t*)addr;
addr += offsets[i];
}
return addr; // returns the main pointer from needed assets
}
};
class hacks: public find_adress {
private:
uintptr_t module;
void main_func(int value, uintptr_t adress, std::vector<DWORD> offsets) {
uintptr_t adres = FinalAddress(adress, offsets);
int* main_value = (int*)adres;
*main_value = value;
}
bool SendAttack(int vid) {
DWORD netPointer = *(DWORD*)0x06733F8;
DWORD battleCall = 0x04B53A0;
_asm {
mov ecx, netPointer
push vid
push 0
call battleCall
}
}
public:
hacks(uintptr_t mod) : module(mod) {};
void wallHack(int value);
void speedhack(int value);
void attack(int value);
void target();
};
}
#include "pch.h"
#include <iostream>
#include "hacks.h"
using namespace H;
void hacks::wallHack(int value) {
main_func(value, module + 0x267D94, { 0xC, 0x66C });
}
void hacks::speedhack(int value) {
main_func(value, module + 0x267D94, { 0xC, 0x5a9 + 1 });
}
void hacks::attack(int value) {
main_func(value, 0x0667D90, { 0x64 });
}
void hacks::target() {
while (true) {
if (GetAsyncKeyState(VK_F3) & 1) {
break;
}
DWORD getTargetId = (*(DWORD*)(*(DWORD*)0x0667D90 + 0x0010FC4));
SendAttack(getTargetId);
Sleep(160);
}
}
DWORD WINAPI HackThread(HMODULE hModule)
{
AllocConsole();
FILE* f;
freopen_s(&f, "CONOUT$", "w", stdout);
std::cout << "Cheats injected\n" << std::endl;
uintptr_t moduleBase = (uintptr_t)GetModuleHandle(L"Soria2.pl.exe");
hacks Hack(moduleBase);
while (true)
{
if (GetAsyncKeyState(VK_F1) & 1)
{
if (click.wallhack_clicked) {
click.wallhack_clicked = FALSE;
Hack.wallHack(0);
}
else {
click.wallhack_clicked = TRUE;
Hack.wallHack(1);
}
}
if (GetAsyncKeyState(VK_F2) & 1)
{
if (click.autoAttack_clicked) {
click.autoAttack_clicked = FALSE;
Hack.attack(0);
}
else {
click.autoAttack_clicked = TRUE;
Hack.attack(1);
}
}
if (GetAsyncKeyState(VK_F3) & 1) {
Hack.target();
}
if (GetAsyncKeyState(VK_F4) & 1) {
if (click.speedhack_clicked) {
click.speedhack_clicked = FALSE;
Hack.speedhack(click.normal_speed);
}
else {
click.speedhack_clicked = TRUE;
Hack.speedhack(16500);
}
}
Sleep(10);
}
fclose(f);
FreeConsole();
FreeLibraryAndExitThread(hModule, 0);
return 0;
}
BOOL APIENTRY DllMain(HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
{
CloseHandle(CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)HackThread, hModule, 0, nullptr));
}
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}