Bodyguardd 1
Bodyguardd
kralhakan2009 1
kralhakan2009
Vahsi Uzman 1
Vahsi Uzman
berzahx 1
berzahx
VictoryasHD 1
VictoryasHD
noisiv 1
noisiv
Manwe Work 1
Manwe Work
mavzermete 1
mavzermete
Reklam vermek için turkmmo@gmail.com

Metin2 Hile İstek Help - Metin2 WaitDamage

  • Konuyu başlatan Konuyu başlatan smku7777
  • Başlangıç tarihi Başlangıç tarihi
  • Cevaplar Cevaplar 3
  • Görüntüleme Görüntüleme 81

Türkiye'nin ilk Cross-Platform OldSchool MOBİL & PC 1-99 Sunucusu Lamira2 6 Kasım'da Açılıyor! Büyük Açılışı Kaçırma HEMEN TIKLA!

hey can someone tell me please whats wrong with this code wehen activate its not doing damage for monsters around me :
// language: C++, file: WaitDamage.cpp
// target: Metin2 32-bit internal DLL, MSVC

#include <Windows.h>
#include <vector>
#include <cmath>
#include <thread>
#include <atomic>
#include <string>
#include <cstdio>
#include <cstdarg>

// ============================================================
// Offsety (Dostosuj pod swoją wersję binarnego clienta)
// ============================================================
namespace Offsets
{
constexpr uintptr_t PLAYER_BASE_PTR = 0x54BBEC;
constexpr uintptr_t PLAYER_BASE_OFF = 0x10;
constexpr uintptr_t PLAYER_X = 0x6A8;
constexpr uintptr_t PLAYER_Y = 0x6AC;

constexpr uintptr_t MOB_LIST_PTR = 0x54C618;
constexpr uintptr_t MOB_VID = 0x79C;
constexpr uintptr_t MOB_X = 0x6A8;
constexpr uintptr_t MOB_Y = 0x6AC;
constexpr uintptr_t MOB_STRIDE = 0x4;
constexpr int MOB_MAX_SCAN = 256;

// SendAttackPacket RVA względem image base
constexpr uintptr_t SEND_ATTACK_RVA = 0x17F0F0;
constexpr uintptr_t NET_STREAM_PTR = 0x54C604; // CPythonNetworkStream*

constexpr uintptr_t MOB_IS_DEAD = 0x684; // 0 = żywy
constexpr uintptr_t MOB_TYPE = 0x63C; // 0 = mob, 2 = metin, 6 = inne
}

// ============================================================
// Konfiguracja
// ============================================================
struct WaitDamageConfig
{
std::atomic<bool> enabled{ false };
float attackRange = 800.0f;
float attackDelay = 0.08f;
int maxTargets = 12;
bool showMenu = true;
float minDist = 5.0f;

bool attackMobs = true;
bool attackMetins = true;
bool attackOther = false;
};
inline WaitDamageConfig g_cfg;

HWND g_hMenuWnd = nullptr;
HWND g_hGameWnd = nullptr;

// ============================================================
// Debug
// ============================================================
void DebugLog(const char* fmt, ...)
{
char buf[512];
va_list args;
va_start(args, fmt);
vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
printf("%s\n", buf);
}

// ============================================================
// Pamięć
// ============================================================
template <typename T>
T Read(uintptr_t addr)
{
if (!addr || IsBadReadPtr(reinterpret_cast<void*>(addr), sizeof(T)))
return T{};
return *reinterpret_cast<T*>(addr);
}

uintptr_t GetModuleBase()
{
return reinterpret_cast<uintptr_t>(GetModuleHandleA(nullptr));
}

// ============================================================
// Logika ataku
// ============================================================
// Poprawiona konwencja wywołania __thiscall dla funkcji SendAttack
using tSendAttack = bool(__thiscall*)(void* pThis, UINT type, DWORD vid);

struct MobInfo
{
DWORD vid;
float x, y;
int type;
};

bool GetPlayerPos(float& outX, float& outY)
{
const uintptr_t base = GetModuleBase();
const uintptr_t ptr1 = Read<uintptr_t>(base + Offsets::PLAYER_BASE_PTR);
if (!ptr1) return false;

const uintptr_t player = Read<uintptr_t>(ptr1 + Offsets::PLAYER_BASE_OFF);
if (!player) return false;

outX = Read<float>(player + Offsets::PLAYER_X);
outY = Read<float>(player + Offsets::PLAYER_Y);

if (outX == 0.0f && outY == 0.0f) return false;
return true;
}

std::vector<MobInfo> GetMobsInRange(float px, float py, float range, int maxCount, int* outTotalFound)
{
std::vector<MobInfo> result;
*outTotalFound = 0;

const uintptr_t base = GetModuleBase();
const uintptr_t listBase = Read<uintptr_t>(base + Offsets::MOB_LIST_PTR);
if (!listBase) return result;

for (int i = 0; i < Offsets::MOB_MAX_SCAN; ++i)
{
const uintptr_t mob = Read<uintptr_t>(listBase + i * Offsets::MOB_STRIDE);
if (!mob) continue;

const DWORD vid = Read<DWORD>(mob + Offsets::MOB_VID);
if (!vid) continue;

// Sprawdzenie czy mob żyje
const BYTE isDead = Read<BYTE>(mob + Offsets::MOB_IS_DEAD);
if (isDead != 0) continue;

// Filtr typów
const int type = Read<int>(mob + Offsets::MOB_TYPE);
bool allow = false;
if (type == 0 && g_cfg.attackMobs) allow = true;
if (type == 2 && g_cfg.attackMetins) allow = true;
if (type != 0 && type != 2 && g_cfg.attackOther) allow = true;

if (!allow) continue;

const float mx = Read<float>(mob + Offsets::MOB_X);
const float my = Read<float>(mob + Offsets::MOB_Y);
if (mx == 0.0f && my == 0.0f) continue;

(*outTotalFound)++;

const float dist = std::hypot(mx - px, my - py);
if (dist < g_cfg.minDist) continue;

if (dist <= range && (int)result.size() < maxCount)
{
result.push_back({ vid, mx, my, type });
}
}

return result;
}

void AttackVid(DWORD vid)
{
const uintptr_t base = GetModuleBase();
void* pNet = Read<void*>(base + Offsets::NET_STREAM_PTR);
if (!pNet) return;

auto fn = reinterpret_cast<tSendAttack>(base + Offsets::SEND_ATTACK_RVA);
if (fn)
{
// Wywołanie SendAttack (typ 0 zazwyczaj oznacza zwykły atak mieczem / zasięgowy)
fn(pNet, 0, vid);
}
}

void WaitDamageThread()
{
while (true)
{
if (!g_cfg.enabled.load())
{
Sleep(40);
continue;
}

float px = 0.f, py = 0.f;
if (!GetPlayerPos(px, py))
{
Sleep(200);
continue;
}

int totalFound = 0;
auto targets = GetMobsInRange(px, py, g_cfg.attackRange, g_cfg.maxTargets, &totalFound);

if (!targets.empty())
{
for (const auto& m : targets)
{
AttackVid(m.vid);
}
}

int ms = static_cast<int>(g_cfg.attackDelay * 1000.f);
Sleep(ms < 15 ? 15 : ms);
}
}

// ============================================================
// Win32 GUI
// ============================================================
#define IDC_#define 1001
#define IDC_#define 1002
#define IDC_#define 1003
#define IDC_#define 1004
#define IDC_#define 1005
#define IDC_#define 1006
#define IDC_#define 1101
#define IDC_#define 1102
#define IDC_#define 1103

void UpdateStatusText(HWND hStatus)
{
char buf[160];
sprintf_s(buf, "Status: %s | R:%.0f D:%.3f M:%d",
g_cfg.enabled.load() ? "ACTIVE" : "OFF",
g_cfg.attackRange, g_cfg.attackDelay, g_cfg.maxTargets);
SetWindowTextA(hStatus, buf);
}

LRESULT CALLBACK MenuWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
static HWND hEnable, hRange, hDelay, hTargets, hStatus;
static HWND hMobs, hMetins, hOther;

switch (msg)
{
case WM_CREATE:
{
CreateWindowA("STATIC", "WaitDamage Internal", WS_CHILD | WS_VISIBLE,
10, 8, 280, 18, hWnd, nullptr, nullptr, nullptr);

hEnable = CreateWindowA("BUTTON", "Enable WaitDamage",
WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
10, 32, 200, 22, hWnd, (HMENU)IDC_ENABLE, nullptr, nullptr);

CreateWindowA("STATIC", "Attack Range:", WS_CHILD | WS_VISIBLE,
10, 62, 100, 18, hWnd, nullptr, nullptr, nullptr);
hRange = CreateWindowA("EDIT", "800", WS_CHILD | WS_VISIBLE | WS_BORDER,
120, 60, 80, 22, hWnd, (HMENU)IDC_RANGE, nullptr, nullptr);

CreateWindowA("STATIC", "Attack Delay (s):", WS_CHILD | WS_VISIBLE,
10, 92, 110, 18, hWnd, nullptr, nullptr, nullptr);
hDelay = CreateWindowA("EDIT", "0.08", WS_CHILD | WS_VISIBLE | WS_BORDER,
120, 90, 80, 22, hWnd, (HMENU)IDC_DELAY, nullptr, nullptr);

CreateWindowA("STATIC", "Max Targets:", WS_CHILD | WS_VISIBLE,
10, 122, 100, 18, hWnd, nullptr, nullptr, nullptr);
hTargets = CreateWindowA("EDIT", "12", WS_CHILD | WS_VISIBLE | WS_BORDER,
120, 120, 80, 22, hWnd, (HMENU)IDC_TARGETS, nullptr, nullptr);

hMobs = CreateWindowA("BUTTON", "Mobs (0)",
WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
10, 152, 90, 20, hWnd, (HMENU)IDC_MOBS, nullptr, nullptr);
SendMessageA(hMobs, BM_SETCHECK, BST_CHECKED, 0);

hMetins = CreateWindowA("BUTTON", "Metins (2)",
WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
110, 152, 100, 20, hWnd, (HMENU)IDC_METINS, nullptr, nullptr);
SendMessageA(hMetins, BM_SETCHECK, BST_CHECKED, 0);

hOther = CreateWindowA("BUTTON", "Other (6+)",
WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
220, 152, 90, 20, hWnd, (HMENU)IDC_OTHER, nullptr, nullptr);

CreateWindowA("BUTTON", "Apply", WS_CHILD | WS_VISIBLE,
10, 185, 80, 26, hWnd, (HMENU)IDC_APPLY, nullptr, nullptr);

hStatus = CreateWindowA("STATIC", "Status: OFF", WS_CHILD | WS_VISIBLE,
10, 220, 310, 18, hWnd, (HMENU)IDC_STATUS, nullptr, nullptr);

SetTimer(hWnd, 1, 200, nullptr);
break;
}
case WM_COMMAND:
if (LOWORD(wParam) == IDC_ENABLE)
{
bool checked = (SendMessageA(hEnable, BM_GETCHECK, 0, 0) == BST_CHECKED);
g_cfg.enabled.store(checked);
UpdateStatusText(hStatus);
}
else if (LOWORD(wParam) == IDC_APPLY)
{
char buf[64];
GetWindowTextA(hRange, buf, 64);
g_cfg.attackRange = (float)atof(buf);
if (g_cfg.attackRange < 50.f) g_cfg.attackRange = 50.f;

GetWindowTextA(hDelay, buf, 64);
g_cfg.attackDelay = (float)atof(buf);
if (g_cfg.attackDelay < 0.02f) g_cfg.attackDelay = 0.02f;

GetWindowTextA(hTargets, buf, 64);
g_cfg.maxTargets = atoi(buf);
if (g_cfg.maxTargets < 1) g_cfg.maxTargets = 1;
if (g_cfg.maxTargets > 64) g_cfg.maxTargets = 64;

g_cfg.attackMobs = (SendMessageA(hMobs, BM_GETCHECK, 0, 0) == BST_CHECKED);
g_cfg.attackMetins = (SendMessageA(hMetins, BM_GETCHECK, 0, 0) == BST_CHECKED);
g_cfg.attackOther = (SendMessageA(hOther, BM_GETCHECK, 0, 0) == BST_CHECKED);

UpdateStatusText(hStatus);
}
break;
case WM_TIMER:
UpdateStatusText(hStatus);
break;
case WM_CLOSE:
ShowWindow(hWnd, SW_HIDE);
g_cfg.showMenu = false;
return 0;
case WM_DESTROY:
KillTimer(hWnd, 1);
break;
}
return DefWindowProcA(hWnd, msg, wParam, lParam);
}

void CreateMenuWindow()
{
WNDCLASSEXA wc = {};
wc.cbSize = sizeof(wc);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = MenuWndProc;
wc.hInstance = GetModuleHandleA(nullptr);
wc.hCursor = LoadCursor(nullptr, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wc.lpszClassName = "WaitDamageMenuClass";
RegisterClassExA(&wc);

g_hMenuWnd = CreateWindowExA(
WS_EX_TOPMOST | WS_EX_TOOLWINDOW,
"WaitDamageMenuClass",
"WaitDamage"
WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU,
100, 100, 340, 290,
nullptr, nullptr, wc.hInstance, nullptr);

ShowWindow(g_hMenuWnd, SW_SHOW);
UpdateWindow(g_hMenuWnd);
}

void MenuThread()
{
CreateMenuWindow();
MSG msg;
while (true)
{
if (GetAsyncKeyState(VK_INSERT) & 1)
{
g_cfg.showMenu = !g_cfg.showMenu;
ShowWindow(g_hMenuWnd, g_cfg.showMenu ? SW_SHOW : SW_HIDE);
if (g_cfg.showMenu) SetForegroundWindow(g_hMenuWnd);
}

while (PeekMessageA(&msg, nullptr, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessageA(&msg);
}
Sleep(15);
}
}

// ============================================================
// Entry
// ============================================================
DWORD WINAPI MainThread(LPVOID)
{
AllocConsole();
FILE* f = nullptr;
freopen_s(&f, "CONOUT$", "w", stdout);
freopen_s(&f, "CONOUT$", "w", stderr);

DebugLog("[+] WaitDamage DLL loaded successfully.");

std::thread(WaitDamageThread).detach();
std::thread(MenuThread).detach();

return 0;
}

BOOL APIENTRY DllMain(HMODULE hModule, DWORD reason, LPVOID)
{
if (reason == DLL_PROCESS_ATTACH)
{
DisableThreadLibraryCalls(hModule);
CreateThread(nullptr, 0, MainThread, nullptr, 0, nullptr);
}
return TRUE;
}
 

Şu an konuyu görüntüleyenler (Toplam : 0, Üye: 0, Misafir: 0)

Geri
Üst