Загрузка данных
#include <windows.h>
#include <d3d11.h>
#include <dxgi.h>
#include <vector>
#include <string>
#include <cmath>
#include <cstdint>
#include <cstdio>
#pragma comment(lib, "d3d11.lib")
#pragma comment(lib, "dxgi.lib")
#include "imgui/imgui.h"
#include "imgui/backends/imgui_impl_dx11.h"
#include "imgui/backends/imgui_impl_win32.h"
#include "minhook/include/MinHook.h"
// ============================================================
// Math & Structs
// ============================================================
struct Vec2 { float x, y; };
struct Vec3 {
float x, y, z;
Vec3 operator-(const Vec3& o) const { return { x - o.x, y - o.y, z - o.z }; }
float Length() const { return std::sqrt(x * x + y * y + z * z); }
};
struct Matrix4x4 { float m[4][4]; };
static bool WorldToScreen(const Vec3& w, Vec2& out, const Matrix4x4& vm, int sw, int sh) {
float ww = vm.m[3][0] * w.x + vm.m[3][1] * w.y + vm.m[3][2] * w.z + vm.m[3][3];
if (ww < 0.01f) return false;
float xx = vm.m[0][0] * w.x + vm.m[0][1] * w.y + vm.m[0][2] * w.z + vm.m[0][3];
float yy = vm.m[1][0] * w.x + vm.m[1][1] * w.y + vm.m[1][2] * w.z + vm.m[1][3];
out.x = (sw * 0.5f) + (xx / ww) * (sw * 0.5f);
out.y = (sh * 0.5f) - (yy / ww) * (sh * 0.5f);
return true;
}
// ============================================================
// Memory Utils
// ============================================================
namespace mem {
inline uintptr_t Base(const char* n) { return (uintptr_t)GetModuleHandleA(n); }
template<typename T> inline T Read(uintptr_t a) {
if (!a) return T{};
__try { return *(T*)a; }
__except (EXCEPTION_EXECUTE_HANDLER) { return T{}; }
}
}
// ============================================================
// Offsets (Актуальные)
// ============================================================
namespace offs {
inline uintptr_t dwEntityList = 0;
inline uintptr_t dwLocalPlayerController = 0;
inline uintptr_t dwViewMatrix = 0;
inline void Init() {
auto c = mem::Base("client.dll");
if (!c) return;
// Если игра обновится, эти статические оффсеты нужно будет обновить
dwEntityList = c + 0x2717828;
dwLocalPlayerController = c + 0x253A068;
dwViewMatrix = c + 0x2567FA0;
}
}
// ============================================================
// Entity System
// ============================================================
static uintptr_t GetEntityFromHandle(uint32_t handle) {
if (!handle || handle == 0xFFFFFFFF) return 0;
uint32_t index = handle & 0x7FFF;
uintptr_t entityList = mem::Read<uintptr_t>(offs::dwEntityList);
if (!entityList) return 0;
uintptr_t chunk = mem::Read<uintptr_t>(entityList + 0x10 + 8 * (index >> 9));
if (!chunk) chunk = mem::Read<uintptr_t>(entityList + 0x8 + 8 * (index >> 9));
if (!chunk) return 0;
return mem::Read<uintptr_t>(chunk + 8 * (index & 0x1FF));
}
struct Pawn {
uintptr_t ptr = 0;
bool ok() const { return ptr != 0; }
int hp() const { return mem::Read<int>(ptr + 0x344); }
int team() const { return mem::Read<int>(ptr + 0x3E3); }
bool alive() const { return hp() > 0 && hp() <= 100; }
int crosshairId() const { return mem::Read<int>(ptr + 0x1E90); } // m_iIDEntIndex
Vec3 origin() const {
uintptr_t sn = mem::Read<uintptr_t>(ptr + 0x330);
return mem::Read<Vec3>(sn + 0xC8);
}
Vec3 bone(int i) const {
uintptr_t sn = mem::Read<uintptr_t>(ptr + 0x330);
uintptr_t b = mem::Read<uintptr_t>(sn + 0x1E0);
if (!b) return Vec3(0, 0, 0);
struct B { float x, y, z, w; };
B v = mem::Read<B>(b + i * 32);
return Vec3(v.x, v.y, v.z);
}
};
struct Controller {
uintptr_t ptr = 0;
bool ok() const { return ptr != 0; }
uint32_t pawnHandle() const {
static const uintptr_t candidates[] = { 0x7D8, 0x7C0, 0x6E0, 0x824 };
for (auto off : candidates) {
uint32_t h = mem::Read<uint32_t>(ptr + off);
if (h && h != 0xFFFFFFFF && h < 0xFFFF) {
if (GetEntityFromHandle(h)) return h;
}
}
return 0;
}
Pawn pawn() const {
uint32_t h = pawnHandle();
return h ? Pawn{ GetEntityFromHandle(h) } : Pawn{ 0 };
}
};
static Pawn GetLocalPawn() {
uintptr_t ctrl = mem::Read<uintptr_t>(offs::dwLocalPlayerController);
if (ctrl) {
Controller c{ ctrl };
Pawn p = c.pawn();
if (p.ok()) return p;
}
return Pawn{ 0 };
}
static Controller GetPlayer(int i) { return Controller{ GetEntityFromHandle(i) }; }
// ============================================================
// Config
// ============================================================
struct Config {
bool espEn = true;
bool box = true;
bool skel = false;
bool hp = true;
float col[4] = { 0.15f, 0.85f, 1.f, 1.f };
bool triggerEn = false;
int triggerDelay = 45; // ms
bool menu = false;
} cfg;
// ============================================================
// ESP
// ============================================================
static void DrawESP() {
if (!cfg.espEn) return;
Matrix4x4 vm = mem::Read<Matrix4x4>(offs::dwViewMatrix);
ImGuiIO& io = ImGui::GetIO();
ImDrawList* dl = ImGui::GetBackgroundDrawList();
Pawn me = GetLocalPawn();
if (!me.ok()) return;
for (int i = 1; i <= 64; ++i) {
Controller ctrl = GetPlayer(i);
if (!ctrl.ok()) continue;
Pawn p = ctrl.pawn();
if (!p.ok() || !p.alive() || p.team() == me.team()) continue;
Vec3 o = p.origin();
Vec3 h = p.bone(6); // Head
if (h.x == 0 && h.y == 0 && h.z == 0) continue;
Vec2 so, shh;
if (!WorldToScreen(o, so, vm, (int)io.DisplaySize.x, (int)io.DisplaySize.y)) continue;
if (!WorldToScreen(h, shh, vm, (int)io.DisplaySize.x, (int)io.DisplaySize.y)) continue;
float bh = so.y - shh.y;
float bw = bh * 0.5f;
float bx = shh.x - bw * 0.5f;
float by = shh.y;
ImU32 c = ImGui::GetColorU32(ImVec4(cfg.col[0], cfg.col[1], cfg.col[2], cfg.col[3]));
if (cfg.box) dl->AddRect(ImVec2(bx, by), ImVec2(bx + bw, by + bh), c, 0, 0, 1.5f);
if (cfg.hp) {
float f = p.hp() / 100.f;
dl->AddRectFilled(ImVec2(bx - 5, by + bh * (1 - f)), ImVec2(bx - 2, by + bh), ImGui::GetColorU32(ImVec4(1 - f, f, 0.1f, 1)));
}
if (cfg.skel) {
static const int b[][2] = { {6,5},{5,4},{4,3},{5,7},{7,8},{8,9}, {5,11},{11,12},{12,13},{4,14},{14,15},{15,16}, {4,17},{17,18},{18,19} };
for (int j = 0; j < 15; ++j) {
Vec2 a, c2;
if (WorldToScreen(p.bone(b[j][0]), a, vm, (int)io.DisplaySize.x, (int)io.DisplaySize.y) &&
WorldToScreen(p.bone(b[j][1]), c2, vm, (int)io.DisplaySize.x, (int)io.DisplaySize.y)) {
dl->AddLine(ImVec2(a.x, a.y), ImVec2(c2.x, c2.y), c, 1.5f);
}
}
}
}
}
// ============================================================
// Triggerbot
// ============================================================
static void RunTriggerbot() {
if (!cfg.triggerEn) return;
Pawn me = GetLocalPawn();
if (!me.ok() || !me.alive()) return;
int crossId = me.crosshairId();
if (crossId > 0 && crossId <= 64) {
Controller target = GetPlayer(crossId);
if (target.ok()) {
Pawn p = target.pawn();
if (p.ok() && p.alive() && p.team() != me.team()) {
INPUT in{};
in.type = INPUT_MOUSE;
in.mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
SendInput(1, &in, sizeof(INPUT));
Sleep(cfg.triggerDelay);
in.mi.dwFlags = MOUSEEVENTF_LEFTUP;
SendInput(1, &in, sizeof(INPUT));
}
}
}
}
// ============================================================
// Menu
// ============================================================
static void DrawMenu() {
if (!cfg.menu) return;
ImGui::SetNextWindowSize({ 400, 250 }, ImGuiCond_FirstUseEver);
ImGui::Begin("Worm Shadow", nullptr, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse);
ImGui::TextColored(ImVec4(0.6f, 0.2f, 1.0f, 1.0f), "VISUALS");
ImGui::Separator();
ImGui::Checkbox("Enable ESP", &cfg.espEn);
ImGui::Checkbox("Bounding Box", &cfg.box);
ImGui::Checkbox("Health Bar", &cfg.hp);
ImGui::Checkbox("Skeleton", &cfg.skel);
ImGui::ColorEdit4("Color", cfg.col);
ImGui::Spacing(); ImGui::Spacing();
ImGui::TextColored(ImVec4(0.6f, 0.2f, 1.0f, 1.0f), "TRIGGERBOT");
ImGui::Separator();
ImGui::Checkbox("Enable Triggerbot", &cfg.triggerEn);
ImGui::SliderInt("Delay (ms)", &cfg.triggerDelay, 10, 200);
ImGui::End();
}
// ============================================================
// Hooks & Init
// ============================================================
using PresentFn = HRESULT(__stdcall*)(IDXGISwapChain*, UINT, UINT);
using CreateMoveFn = void(__fastcall*)(void*, void*, void*);
static PresentFn oPresent = nullptr;
static CreateMoveFn oCreateMove = nullptr;
static WNDPROC oWndProc = nullptr;
static HWND g_hwnd = nullptr;
static ID3D11Device* g_dev = nullptr;
static ID3D11DeviceContext* g_ctx = nullptr;
static ID3D11RenderTargetView* g_rtv = nullptr;
extern LRESULT ImGui_ImplWin32_WndProcHandler(HWND, UINT, WPARAM, LPARAM);
static LRESULT CALLBACK WndProc(HWND h, UINT m, WPARAM w, LPARAM l) {
if (m == WM_KEYDOWN && w == VK_INSERT) cfg.menu = !cfg.menu;
if (cfg.menu) {
ImGui_ImplWin32_WndProcHandler(h, m, w, l);
if (m == WM_INPUT) return true;
if ((m >= WM_MOUSEFIRST && m <= WM_MOUSELAST) || (m >= WM_KEYFIRST && m <= WM_KEYLAST)) return true;
}
return CallWindowProc(oWndProc, h, m, w, l);
}
static HRESULT __stdcall Present(IDXGISwapChain* sc, UINT s, UINT f) {
if (!g_dev) {
sc->GetDevice(__uuidof(ID3D11Device), (void**)&g_dev);
g_dev->GetImmediateContext(&g_ctx);
DXGI_SWAP_CHAIN_DESC d; sc->GetDesc(&d);
g_hwnd = d.OutputWindow;
ID3D11Texture2D* bb = nullptr;
sc->GetBuffer(0, __uuidof(ID3D11Texture2D), (void**)&bb);
g_dev->CreateRenderTargetView(bb, nullptr, &g_rtv);
bb->Release();
ImGui::CreateContext();
ImGui::StyleColorsDark();
ImGui_ImplWin32_Init(g_hwnd);
ImGui_ImplDX11_Init(g_dev, g_ctx);
oWndProc = (WNDPROC)SetWindowLongPtr(g_hwnd, GWLP_WNDPROC, (LONG_PTR)WndProc);
}
if (!g_rtv) {
ID3D11Texture2D* bb = nullptr;
sc->GetBuffer(0, __uuidof(ID3D11Texture2D), (void**)&bb);
if (bb) { g_dev->CreateRenderTargetView(bb, nullptr, &g_rtv); bb->Release(); }
}
ImGui_ImplDX11_NewFrame();
ImGui_ImplWin32_NewFrame();
ImGui::NewFrame();
DrawESP();
DrawMenu();
ImGui::Render();
g_ctx->OMSetRenderTargets(1, &g_rtv, nullptr);
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
return oPresent(sc, s, f);
}
static void __fastcall CreateMove(void* in, void* cmd, void* mover) {
oCreateMove(in, cmd, mover);
RunTriggerbot();
}
static DWORD WINAPI Main(LPVOID) {
while (!GetModuleHandleA("client.dll")) Sleep(100);
Sleep(1000);
offs::Init();
MH_Initialize();
// Хук Present
WNDCLASSEXA wc{ sizeof(wc) };
wc.lpfnWndProc = DefWindowProcA;
wc.hInstance = GetModuleHandleA(nullptr);
wc.lpszClassName = "wsc";
RegisterClassExA(&wc);
HWND dummy = CreateWindowA("wsc", "", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, nullptr, nullptr, wc.hInstance, nullptr);
DXGI_SWAP_CHAIN_DESC sd{};
sd.BufferCount = 1;
sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
sd.OutputWindow = dummy;
sd.SampleDesc.Count = 1;
sd.Windowed = TRUE;
sd.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
IDXGISwapChain* sc = nullptr; ID3D11Device* dv = nullptr; ID3D11DeviceContext* cx = nullptr;
D3D11CreateDeviceAndSwapChain(nullptr, D3D_DRIVER_TYPE_HARDWARE, nullptr, 0, nullptr, 0, D3D11_SDK_VERSION, &sd, &sc, &dv, nullptr, &cx);
void** vt = *(void***)sc;
MH_CreateHook(vt[8], &Present, (void**)&oPresent);
MH_EnableHook(vt[8]);
sc->Release(); dv->Release(); cx->Release();
DestroyWindow(dummy); UnregisterClassA("wsc", wc.hInstance);
// Хук CreateMove (для триггера)
auto c = mem::Base("client.dll");
uintptr_t fnCreateMove = 0;
// Сканер сигнатур для CreateMove (85 D2 0F 85)
std::vector<int> sig = { 0x85, 0xD2, 0x0F, 0x85, -1, -1 };
for (size_t i = 0; i < 0xFFFFFF; ++i) {
bool match = true;
for (size_t j = 0; j < sig.size(); ++j) {
if (sig[j] != -1 && *(uint8_t*)(c + i + j) != sig[j]) { match = false; break; }
}
if (match) { fnCreateMove = c + i; break; }
}
if (fnCreateMove) {
MH_CreateHook((void*)fnCreateMove, &CreateMove, (void**)&oCreateMove);
MH_EnableHook((void*)fnCreateMove);
}
return 0;
}
BOOL APIENTRY DllMain(HMODULE hMod, DWORD r, LPVOID) {
if (r == DLL_PROCESS_ATTACH) {
DisableThreadLibraryCalls(hMod);
CreateThread(nullptr, 0, Main, nullptr, 0, nullptr);
}
return TRUE;
}