English:
[C + +] Metin2 class
HeyHo,
I've been here once one to now is still very short, but still very useful Metin2 class for C + +.
With this class you can simply use items "means attract such a sword or drink a potion. In addition, you can simply leave items covered and the pressure of the space bar to simulate such to hit or throw the hook in or out incur.
More features will follow.
Metin2.h:
Spoiler:
Code:
# include <windows.h>
# pragma once
Metin2 class
(
public:
Metin2 (void);
~ Metin2 (void);
void useit (int slot);
DWORD dwUseItemAddr1;
DWORD dwUseItemAddr2;
DWORD dwUseItemAddr3;
void DropItem (int slot, int count);
DWORD dwDropItemAddr1;
DWORD dwDropItemAddr2;
DWORD dwDropItemAddr3;
void DropYang (int Yang);
DWORD dwDropYangAddr1;
DWORD dwDropYangAddr2;
DWORD dwDropYangAddr3;
void AttackKeyPressed (int ispressed);
DWORD dwAttackKeyPressedAddr1;
DWORD dwAttackKeyPressedAddr2;
DWORD dwAttackKeyPressedAddr3;
void PickUp (void);
DWORD dwPickUpAddr1;
DWORD dwPickUpAddr2;
void QuickSlot (int slot);
DWORD dwQuickSlotAddr1;
DWORD dwQuickSlotAddr2;
DWORD dwQuickSlotAddr3;
void SendChat (char * text, int Chattyp);
DWORD dwSendChatAddr1;
DWORD dwSendChatAddr2;
DWORD dwSendChatAddr3;
);
Metin2.cpp:
Spoiler:
Code:
# include "Metin2.h"
Metin2: Metin2 (void)
: DwUseItemAddr1 (0)
, DwUseItemAddr2 (0)
, DwUseItemAddr3 (0)
, DwDropItemAddr1 (0)
, DwDropItemAddr2 (0)
, DwDropItemAddr3 (0)
, DwAttackKeyPressedAddr1 (0)
, DwAttackKeyPressedAddr2 (0)
, DwAttackKeyPressedAddr3 (0)
, DwPickUpAddr1 (0)
, DwPickUpAddr2 (0)
, DwDropYangAddr1 (0)
, DwDropYangAddr2 (0)
, DwDropYangAddr3 (0)
, DwQuickSlotAddr1 (0)
, DwQuickSlotAddr2 (0)
, DwQuickSlotAddr3 (0)
, DwSendChatAddr1 (0)
, DwSendChatAddr2 (0)
, DwSendChatAddr3 (0)
(
)
Metin2:: ~ Metin2 (void)
(
)
void Metin2:: useit (int slot)
(
DWORD Addr1 = this-> dwUseItemAddr1;
DWORD Addr2 = this-> dwUseItemAddr2;
DWORD Addr3 = this-> dwUseItemAddr3;
__asm
(
MOV EAX, Addr3
MOV ECX, DWORD PTR DS: [EAX]
PUSH slot
CALL Addr1
CALL Addr2
)
)
void Metin2:: DropItem (int slot, int count)
(
DWORD Addr1 = this-> dwDropItemAddr1;
DWORD Addr2 = this-> dwDropItemAddr2;
DWORD Addr3 = this-> dwDropItemAddr3;
__asm
(
MOV EAX, Addr3
MOV ECX, DWORD PTR DS: [EAX]
PUSH Number
Push 0
PUSH slot
CALL Addr1
CALL Addr2
)
)
void Metin2:: int DropYang (Yang)
(
DWORD Addr1 = this-> dwDropYangAddr1;
DWORD Addr2 = this-> dwDropYangAddr2;
DWORD Addr3 = this-> dwDropYangAddr3;
__asm
(
MOV EAX, Addr3
MOV ECX, DWORD PTR DS: [EAX]
PUSH Yang
Push 0
CALL Addr1
CALL Addr2
)
)
void Metin2:: AttackKeyPressed (int ispressed)
(
DWORD Addr1 = this-> dwAttackKeyPressedAddr1;
DWORD Addr2 = this-> dwAttackKeyPressedAddr2;
DWORD Addr3 = this-> dwAttackKeyPressedAddr3;
__asm
(
MOV EAX, Addr3
MOV ECX, DWORD PTR DS: [EAX]
Setnes DL
PUSH ispressed
CALL Addr1
CALL Addr2
)
)
void Metin2:: PickUp (void)
(
DWORD Addr1 = this-> dwPickUpAddr1;
DWORD Addr2 = this-> dwPickUpAddr2;
__asm
(
MOV EAX, Addr2
MOV ECX, DWORD PTR DS: [EAX]
CALL Addr1
)
)
void Metin2:: QuickSlot (int slot)
(
DWORD Addr1 = this-> dwQuickSlotAddr1;
DWORD Addr2 = this-> dwQuickSlotAddr2;
DWORD Addr3 = this-> dwQuickSlotAddr3;
__asm
(
MOV EAX, Addr3
MOV ECX, DWORD PTR DS: [EAX]
PUSH slot
CALL Addr1
CALL Addr2
)
)
void Metin2:: SendChat (char * text, int Chattyp)
(
DWORD Addr1 = this-> dwSendChatAddr1;
DWORD Addr2 = this-> dwSendChatAddr2;
DWORD Addr3 = this-> dwSendChatAddr3;
__asm
(
MOV EAX, Addr3
MOV ECX, DWORD PTR DS: [EAX]
PUSH Chattyp
PUSH Text
CALL Addr1
CALL Addr2
)
)
And here is a small sample (main.cpp):
Spoiler:
Code:
# include <windows.h>
# include "Metin2.h"
DWORD APIENTRY OnInjection ()
(
Metin2 M2 / / Create a class instance
/ / Set the function addresses (Release 27 Feb 2010)
M2.dwUseItemAddr1 = 0x0041ED60;
M2.dwUseItemAddr2 = 0x0053FCE0;
M2.dwUseItemAddr3 = 0x005F4FC8;
M2.dwDropItemAddr1 = 0x0041DFC0;
M2.dwDropItemAddr2 = 0x0053FCE0;
M2.dwDropItemAddr3 = 0x005F4FC8;
M2.dwAttackKeyPressedAddr1 = 0x0043D530;
M2.dwAttackKeyPressedAddr2 = 0x0053FCE0;
M2.dwAttackKeyPressedAddr3 = 0x005F29B8;
M2.dwPickUpAddr1 = 0x0043C970;
M2.dwPickUpAddr2 = 0x005F29B8;
M2.dwDropYangAddr1 = 0x0041DFC0;
M2.dwDropYangAddr2 = 0x0053FCE0;
M2.dwDropYangAddr3 = 0x005F4FC8;
M2.dwQuickSlotAddr1 = 0x00439D20;
M2.dwQuickSlotAddr2 = 0x0053FCE0;
M2.dwQuickSlotAddr3 = 0x005F29B8;
M2.dwSendChatAddr1 = 0x0041A640;
M2.dwSendChatAddr2 = 0x0053FCE0;
M2.dwSendChatAddr3 = 0x005F4FC8;
M2.UseItem (0) / / Item in Slot 0 (In the game of 1.) use
M2.DropItem (1.1); fall / / Item in Slot 1 (In the game of 2.) to (number 1)
M2.AttackKeyPressed (1); / / The AttackKey (Space) is pressed for 1 second)
Sleep (1000);
M2.AttackKeyPressed (0);
M2.PickUp () / / cancel item
M2.DropYang (3), / / 3 Yang dropped
M2.QuickSlot (0) / / Quickslot 0 (1) use
M2.SendChat ( "test", 0), / / "test" in normal chat
return 0;
)
BOOL APIENTRY DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
(
if (dwReason == DLL_PROCESS_ATTACH)
(
CreateThread (NULL, 0, (LPTHREAD_START_ROUTINE) OnInjection, NULL, 0, NULL);
)
return true;
)
Created and tested with Visual Studio 2008.
Project: Project Win32 / DLL
Should go well with VC + + Express. For other compilers you have to rewrite some stuff maybe.
The DLL must be injected into the Metin2 process (eg with Winject, PerX, OSI)
If you have questions which can gladly post here
Have fun
PS: To find the addresses (for other versions or newer), a look at my video tutorial (click!)
EDIT: New features added
__________________