Posted by TG on 19:16
Achei essa Source na RZInter e fiquei com ela ate agora, mas ja que não vou usar ele vou postar...Primeiro post e merece fixo hem...
Como compilar? Se virem, nem tudo cai do ceu...
Se alguem de bom coração compilar poste ae..
Code:
Código:
/* Jacob - fattie source code c++ - Win32 */ #include #define uint32_t unsigned int #define uint16_t unsigned short struct D3DXVECTOR3 { float x; float y; float z; }; static uint32_t ZGetGameClientAddress = 0x004ABCC0; bool CompareByteArrays(BYTE* data1, BYTE* data2, int len){ if (data1==NULL && data2==NULL) return true; if (data1==NULL || data2==NULL) return false; for (int i=0; i < len; i++){ if (data1[i] != data2[i]) if(data2[i] != 0xEE) return false; } return true; } DWORD m_CodeBase = 0x00400000; DWORD m_CodeLength = 0x001C5000; DWORD SigSearch(BYTE* Signature, int SigLength) { BYTE* test = NULL; for(unsigned int i = 0; i < (m_CodeLength-SigLength); i++) { if(CompareByteArrays((BYTE*)((DWORD)m_CodeBase + i), Signature,SigLength)) { return (DWORD)m_CodeBase + i; } } return 0; } static BYTE MCommand2__AddParameterSignature[] = { 0x8B, 0x41, 0x20, 0x85, 0xC0, 0x53, 0x8D, 0x59, 0x1C, 0x56, 0x75, 0x04, 0x33, 0xF6, 0xEB, 0x08, 0x8B, 0x73, 0x08, 0x2B, 0xF0, 0xC1, 0xFE, 0x02, 0x8B, 0x51, 0x18, 0x57, 0x8B, 0xBA, 0x10, 0x02, 0x00, 0x00 }; static BYTE MCommand2__GetParameterSignature[] = { 0x55, 0x8B, 0x6C, 0x24, 0x08, 0x85, 0xED, 0x75, 0x06, 0x32, 0xC0, 0x5D, 0xC2, 0x10, 0x00, 0x56, 0x8B, 0x74, 0x24, 0x10, 0x85, 0xF6, 0x7C, 0x23, 0x8B, 0x51, 0x20, 0x85, 0xD2, 0x75, 0x04, 0x33, 0xC0, 0xEB, 0x08, 0x8B, 0x41, 0x24, 0x2B, 0xC2, 0xC1, 0xF8, 0x02, 0x3B, 0xF0 }; static BYTE MCommand2__GetParameter2Signature[] = { 0x56, 0x8B, 0x74, 0x24, 0x08, 0x85, 0xF6, 0x7C, 0x23, 0x8B, 0x51, 0x20, 0x85, 0xD2, 0x75, 0x04, 0x33, 0xC0, 0xEB, 0x08, 0x8B, 0x41, 0x24, 0x2B, 0xC2, 0xC1, 0xF8, 0x02, 0x3B, 0xF0 }; static BYTE MCommand2Desc__MCommand2DescSignature[] = { 0x8B, 0xC1, 0x8B, 0x4C, 0x24, 0x04, 0xC7, 0x00, 0xEE, 0xEE, 0xEE, 0xEE, 0x56, 0xC7, 0x80, 0x10, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC7, 0x80, 0x14, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC7, 0x80, 0x18, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x89, 0x48, 0x04, 0x8B, 0x4C, 0x24, 0x0C, 0x8D, 0x70, 0x08, 0x2B, 0xF1, 0x8A, 0x11, 0x88, 0x14, 0x0E, 0x41, 0x84, 0xD2, 0x75, 0xF6, 0x8B, 0x4C, 0x24, 0x10, 0x8D, 0xB0, 0x08, 0x01, 0x00, 0x00 }; static BYTE MCommand2ParameterDesc__MCommand2ParameterDescSignature[] = { 0x8B, 0xC1, 0x8B, 0x4C, 0x24, 0x04, 0xC7, 0x00, 0xEE, 0xEE, 0xEE, 0xEE, 0x56, 0xC7, 0x40, 0x4C, 0x00, 0x00, 0x00, 0x00, 0xC7, 0x40, 0x50, 0x00, 0x00, 0x00, 0x00, 0xC7, 0x40, 0x54, 0x00, 0x00, 0x00, 0x00, 0x89, 0x48, 0x04, 0x8B, 0x4C, 0x24, 0x0C, 0x8D, 0x70, 0x08, 0x2B, 0xF1 }; static BYTE MCommand2Manager__AddCommandDescSignature[] = { 0x83, 0xEC, 0x10, 0x8B, 0x44, 0x24, 0x14, 0x8B, 0x50, 0x04, 0x89, 0x44, 0x24, 0x04, 0x8D, 0x04, 0x24, 0x89, 0x14, 0x24, 0x50, 0x8D, 0x54, 0x24, 0x0C, 0x52, 0x83, 0xC1, 0x04 }; static BYTE MCommand2Desc__AddParameterDescSignature[] = { 0x81, 0xC1, 0x0C, 0x02, 0x00, 0x00, 0x56, 0x8B, 0x71, 0x04, 0x85, 0xF6, 0x75, 0x04, 0x33, 0xD2, 0xEB, 0x08, 0x8B, 0x51, 0x08, 0x2B, 0xD6, 0xC1, 0xFA, 0x02, 0x85, 0xF6, 0x74, 0x1F, 0x8B, 0x41, 0x0C, 0x2B, 0xC6, 0xC1, 0xF8, 0x02 }; static BYTE MCommand2ParameterInt__MCommand2ParameterIntSignature[] = { 0x8B, 0xC1, 0x33, 0xC9, 0x89, 0x48, 0x04, 0xC7, 0x00, 0xEE, 0xEE, 0xEE, 0xEE, 0x89, 0x48, 0x0C, 0xC3 }; static BYTE MCommand2ParameterUInt__MCommand2ParameterUIntSignature[] = { 0x8B, 0xC1, 0x8B, 0x4C, 0x24, 0x04, 0xC7, 0x40, 0x04, 0x01, 0x00, 0x00, 0x00, 0xC7, 0x00, 0xEE, 0xEE, 0xEE, 0xEE, 0x89, 0x48, 0x0C, 0xC2, 0x04, 0x00 }; static BYTE MCommand2ParameterString__MCommand2ParameterStringSignature[] = { 0x6A, 0xFF, 0x68, 0xEE, 0xEE, 0xEE, 0xEE, 0x64, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x50, 0x64, 0x89, 0x25, 0x00, 0x00, 0x00, 0x00, 0x51, 0x56, 0x8B, 0xF1, 0x57, 0x89, 0x74, 0x24, 0x08, 0xC7, 0x46, 0x04, 0x04, 0x00, 0x00, 0x00, 0x8B, 0x7C, 0x24, 0x1C }; static BYTE MCommand2ParameterFloat__MCommand2ParameterFloatSignature[] = { 0x8B, 0xC1, 0x8B, 0x4C, 0x24, 0x04, 0xC7, 0x40, 0x04, 0x02, 0x00, 0x00, 0x00, 0xC7, 0x00, 0xEE, 0xEE, 0xEE, 0xEE, 0x89, 0x48, 0x0C, 0xC2, 0x04, 0x00 }; static BYTE MCommand2ParameterMUID__MCommand2ParameterMUIDSignature[] = { 0x8B, 0xC1, 0x33, 0xC9, 0xC7, 0x40, 0x04, 0x09, 0x00, 0x00, 0x00, 0xC7, 0x00, 0xEE, 0xEE, 0xEE, 0xEE, 0x89, 0x48, 0x10, 0x89, 0x48, 0x0C, 0xC3 }; static BYTE MCommand2ParameterBlob__MCommand2ParameterBlobSignature[] = { 0x8B, 0xC1, 0x33, 0xC9, 0xC7, 0x40, 0x04, 0x0A, 0x00, 0x00, 0x00, 0xC7, 0x00, 0xEE, 0xEE, 0xEE, 0xEE, 0x89, 0x48, 0x08, 0x89, 0x48, 0x0C, 0xC3 }; //static DWORD MAddSharedCommandTableAddress = 0x0051D6D0; static DWORD ZNewCMDAddress = 0x004C3B60; static DWORD MCommand2__AddParameterAddress = 0x00507C00; static DWORD MCommand2__GetParameterAddress = 0x00507010; static DWORD MCommand2__GetParameter2Address = 0x00506FD0; static DWORD MCommand2Desc__MCommand2DescAddress = 0x005079B0; static DWORD MCommand2ParameterDesc__MCommand2ParameterDescAddress = 0x00506F20; static DWORD MCommand2Manager__AddCommandDescAddress = 0x00514FA0; static DWORD MCommand2Desc__AddParameterDescAddress = 0x005083A0; static DWORD MCommand2ParameterInt__MCommand2ParameterIntAddress = 0x00505B50; static DWORD MCommand2ParameterUInt__MCommand2ParameterUIntAddress = 0x00505C20; static DWORD MCommand2ParameterString__MCommand2ParameterStringAddress = 0x00505DD0; static DWORD MCommand2ParameterFloat__MCommand2ParameterFloatAddress = 0x00505CF0; static DWORD MCommand2ParameterMUID__MCommand2ParameterMUIDAddress = 0x00506970; static DWORD MCommand2ParameterBlob__MCommand2ParameterBlobAddress = 0x00506030; //static DWORD ZGameClient__OnCommandAddress = 0x004C7990; /* static DWORD MCommand2__AddParameterAddress = SigSearch(MCommand2__AddParameterSignature, sizeof(MCommand2__AddParameterSignature)); static DWORD MCommand2__GetParameterAddress = SigSearch(MCommand2__GetParameterSignature, sizeof(MCommand2__GetParameterSignature)); static DWORD MCommand2__GetParameter2Address = SigSearch(MCommand2__GetParameter2Signature, sizeof(MCommand2__GetParameter2Signature)); static DWORD MCommand2Desc__MCommand2DescAddress = SigSearch(MCommand2Desc__MCommand2DescSignature, sizeof(MCommand2Desc__MCommand2DescSignature)); static DWORD MCommand2ParameterDesc__MCommand2ParameterDescAddress = SigSearch(MCommand2ParameterDesc__MCommand2ParameterDescSignature, sizeof(MCommand2ParameterDesc__MCommand2ParameterDescSignature)); static DWORD MCommand2Desc__AddParameterDescAddress = SigSearch(MCommand2Desc__AddParameterDescSignature, sizeof(MCommand2Desc__AddParameterDescSignature)); static DWORD MCommand2Manager__AddCommandDescAddress = SigSearch(MCommand2Manager__AddCommandDescSignature, sizeof(MCommand2Manager__AddCommandDescSignature)); static DWORD MCommand2ParameterInt__MCommand2ParameterIntAddress = SigSearch(MCommand2ParameterInt__MCommand2ParameterIntSignature, sizeof(MCommand2ParameterInt__MCommand2ParameterIntSignature)); static DWORD MCommand2ParameterUInt__MCommand2ParameterUIntAddress = SigSearch(MCommand2ParameterUInt__MCommand2ParameterUIntSignature, sizeof(MCommand2ParameterUInt__MCommand2ParameterUIntSignature)); static DWORD MCommand2ParameterString__MCommand2ParameterStringAddress = SigSearch(MCommand2ParameterString__MCommand2ParameterStringSignature, sizeof(MCommand2ParameterString__MCommand2ParameterStringSignature)); static DWORD MCommand2ParameterFloat__MCommand2ParameterFloatAddress = SigSearch(MCommand2ParameterFloat__MCommand2ParameterFloatSignature, sizeof(MCommand2ParameterFloat__MCommand2ParameterFloatSignature)); static DWORD MCommand2ParameterMUID__MCommand2ParameterMUIDAddress = SigSearch(MCommand2ParameterMUID__MCommand2ParameterMUIDSignature, sizeof(MCommand2ParameterMUID__MCommand2ParameterMUIDSignature)); static DWORD MCommand2ParameterBlob__MCommand2ParameterBlobAddress = SigSearch(MCommand2ParameterBlob__MCommand2ParameterBlobSignature, sizeof(MCommand2ParameterBlob__MCommand2ParameterBlobSignature)); */ BYTE ZCharacter2__SetHPSignature[] = {0X8B,0X89,0X2C,0X03,0X00,0X00,0XE9,0XEE,0XEE,0XEE,0XEE,0XCC,0XCC,0XCC,0XCC,0XCC ,0X8B,0X89,0X2C,0X03,0X00,0X00,0XE9,0XEE,0XEE,0XEE,0XEE,0XCC,0XCC,0XCC,0XCC,0XCC ,0X8B,0X01,}; DWORD ZCharacter2__SetHPSigAddress = SigSearch(ZCharacter2__SetHPSignature, 34); struct MCommand2ParameterDesc; struct MCommand2ParameterInt; struct MCommand2ParameterUInt; struct MCommand2ParameterString; struct MCommand2ParameterFloat; struct MCommand2ParameterMUID; struct MCommand2ParameterBlob; typedef MCommand2ParameterDesc* (__thiscall* MCommand2ParameterDescTypedef)(MCommand2ParameterDesc*, uint32_t, const char*); typedef MCommand2ParameterInt* (__thiscall* MCommand2ParameterIntTypedef) (MCommand2ParameterInt*, int); typedef MCommand2ParameterUInt* (__thiscall* MCommand2ParameterUIntTypedef) (MCommand2ParameterUInt*, uint32_t); typedef MCommand2ParameterString* (__thiscall* MCommand2ParameterStringTypedef) (MCommand2ParameterString*, char*); typedef MCommand2ParameterFloat* (__thiscall* MCommand2ParameterFloatTypedef) (MCommand2ParameterFloat*, float); typedef MCommand2ParameterMUID* (__thiscall* MCommand2ParameterMUIDTypedef) (MCommand2ParameterMUID*, MUID*); typedef MCommand2ParameterBlob* (__thiscall* MCommand2ParameterBlobTypedef) (MCommand2ParameterBlob*, LPVOID, int); MCommand2ParameterDescTypedef MCommand2ParameterDescConstructor = reinterpret_cast(MCommand2ParameterDesc__MCommand2ParameterDescAddress); MCommand2ParameterIntTypedef MCommand2ParameterIntConstructor = reinterpret_cast(MCommand2ParameterInt__MCommand2ParameterIntAddress); MCommand2ParameterUIntTypedef MCommand2ParameterUIntConstructor = reinterpret_cast(MCommand2ParameterUInt__MCommand2ParameterUIntAddress); MCommand2ParameterStringTypedef MCommand2ParameterStringConstructor = reinterpret_cast(MCommand2ParameterString__MCommand2ParameterStringAddress); MCommand2ParameterFloatTypedef MCommand2ParameterFloatConstructor = reinterpret_cast(MCommand2ParameterFloat__MCommand2ParameterFloatAddress); MCommand2ParameterMUIDTypedef MCommand2ParameterMUIDConstructor = reinterpret_cast(MCommand2ParameterMUID__MCommand2ParameterMUIDAddress); MCommand2ParameterBlobTypedef MCommand2ParameterBlobConstructor = reinterpret_cast(MCommand2ParameterBlob__MCommand2ParameterBlobAddress); struct MCommand2ParameterDesc { LPVOID m_pPolymoprhism; uint32_t m_nParamType; char m_szDescription[64]; std::vector m_pParameterConditions; MCommand2ParameterDesc(uint32_t type, const char* desc) { //MCommand2ParameterDescConstructor(this, type, desc); ((void (__thiscall*)(LPVOID, uint32_t, const char*))MCommand2ParameterDesc__MCommand2ParameterDescAddress) (this, type, desc); } }; struct MCommand2Parameter { LPVOID m_pPolymoprhism; uint32_t m_nParamType; }; struct MCommand2ParameterInt : public MCommand2Parameter { int m_Value; MCommand2ParameterInt(int value) { //MCommand2ParameterIntConstructor (this, value); ((void (__thiscall*)(LPVOID, int))MCommand2ParameterInt__MCommand2ParameterIntAddress) (this, value); } }; struct MCommand2ParameterFloat : public MCommand2Parameter { float m_Value; MCommand2ParameterFloat(float value) { //MCommand2ParameterFloatConstructor (this, value); ((void (__thiscall*)(LPVOID, float))MCommand2ParameterFloat__MCommand2ParameterFloatAddress) (this, value); } }; struct MCommand2ParameterUInt : public MCommand2Parameter { uint32_t m_Value; MCommand2ParameterUInt(uint32_t value) { //MCommand2ParameterUIntConstructor (this, value); ((void (__thiscall*)(LPVOID, uint32_t))MCommand2ParameterUInt__MCommand2ParameterUIntAddress) (this, value); } }; struct MCommand2ParameterString : public MCommand2Parameter { char* m_Value; MCommand2ParameterString(char* value) { //MCommand2ParameterStringConstructor (this, value); ((void (__thiscall*)(LPVOID, char*))MCommand2ParameterString__MCommand2ParameterStringAddress) (this, value); } }; struct MCommand2ParameterMUID : public MCommand2Parameter { MUID m_Value; MCommand2ParameterMUID(MUID* value) { //MCommand2ParameterMUIDConstructor (this, value); ((void (__thiscall*)(LPVOID, MUID*))MCommand2ParameterMUID__MCommand2ParameterMUIDAddress) (this, value); } }; struct MCommand2ParameterBlob : public MCommand2Parameter { char* m_Value; int m_nSize; static void MakeBlobHeader(char* data, int elementCount, int elementSize) { int total = (elementCount * elementSize) + 8; data = new char[total+4]; memcpy(data, &total, 4); memcpy(data+4, &elementSize, 4); memcpy(data+8, &elementCount, 4); } static char* MMakeBlobArray(int nOneBlobSize, int nBlobCount) { char *result; result = new char[(nBlobCount * nOneBlobSize + 8)]; *((DWORD *)result + 1) = nBlobCount; *(DWORD *)result = nOneBlobSize; return result; } static char *MGetBlobArrayElement(char *pBlob, uint32_t i) { char *result; if (i < 0 || i >= *((DWORD *)pBlob + 1)) result = 0; else result = pBlob + (i * *(DWORD *)pBlob + 8); return result; } MCommand2ParameterBlob(LPVOID value, int size) { //MCommand2ParameterBlobConstructor (this, value, size); ((void (__thiscall*)(LPVOID, LPVOID, int))MCommand2ParameterBlob__MCommand2ParameterBlobAddress) (this, value, size); } }; struct MCommand2Desc; typedef MCommand2Desc* (__thiscall* MCommand2DescTypedef)(MCommand2Desc*, uint32_t, const char*, const char*, int); MCommand2DescTypedef MCommand2DescConstructor = reinterpret_cast(MCommand2Desc__MCommand2DescAddress); struct MCommand2Manager { void AddCommandDesc(MCommand2Desc* command) { ((void (__thiscall*)(LPVOID, MCommand2Desc*))MCommand2Manager__AddCommandDescAddress) (this, command); } }; struct MCommand2Desc { LPVOID m_pPolymoprhism; uint32_t m_nCommandId; char m_szName[256]; char m_szDescription[256]; uint32_t m_nFlag; std::vector m_pParameterDescs; MCommand2Desc(int commandId, const char* name, const char* description, int flag) { //MCommand2DescConstructor (this, commandId, name, description, flag); //Broken it seems ((void (__thiscall*)(LPVOID, int, const char*, const char*, int))MCommand2Desc__MCommand2DescAddress) (this, commandId, name, description, flag); } void AddParamDesc(MCommand2ParameterDesc* param) { ((void (__thiscall*)(LPVOID, MCommand2ParameterDesc*))MCommand2Desc__AddParameterDescAddress) (this, param); } }; struct MCommand2 { LPVOID CMemPool; MCommand2* m_pNextCommand; MUID m_uidSender; MUID m_uidReceiver; MCommand2Desc* m_pCommandDesc; std::vector m_pCommandParams; BYTE m_nSerialNumber; bool AddParameter(MCommand2Parameter* param) { return ((bool (__thiscall *)(LPVOID,MCommand2Parameter*))MCommand2__AddParameterAddress) (this, param); } bool GetParameter(void *pValue, int i, int type, int bufferSize) { return ((bool (__thiscall *)(LPVOID,LPVOID,int,int,int))MCommand2__GetParameterAddress) (this, pValue, i, type, bufferSize); } MCommand2Parameter* GetParameter(uint32_t i) { return ((MCommand2Parameter* (__thiscall*)(LPVOID, uint32_t))MCommand2__GetParameter2Address)(this, i); } static MCommand2* Create(uint32_t packetId) { return ((MCommand2* (__cdecl*)(uint32_t))0x004C3B60)(packetId); } static void Post(MCommand2* packet) { _asm { mov eax, 0x004ABCC0 call eax push packet mov edx, [eax] mov ecx,eax call [edx+0x30] } } }; enum MCommand2ParameterType { MPT_INT, MPT_UINT, MPT_FLOAT, MPT_BOOL, MPT_STRING, MPT_VECTOR, MPT_POS, MPT_DIR, MPT_COLOR, MPT_UID, MPT_BLOB, MPT_CHAR, MPT_UCHAR, MPT_SHORT, MPT_USHORT, MPT_INT64, MPT_UINT64, MPT_SVECTOR }; struct ZItem { struct class1{}; char unknown0[16]; unsigned long IsEquipped; //0010 char unknown1[12]; class1* Unknown2; //0020 char unknown3[8]; unsigned long AmmoRight; //002C unsigned long AmmoLeft; //0030 }; struct ZCharacter2 { public: struct class1 { char unknown0[12]; DWORD Base; //000C char unknown1[16]; __int32 Offset; //0020 }; DWORD ZCharacter2Marker; char unknown0[36]; MUID U; //0028 char unknown1[40]; D3DXVECTOR3 Direction; //90 class1* PositionFind; //0058 D3DXVECTOR3 Facing; //005C DWORD ZCharacter2ItemMarker; //006C char unknown2[4]; ZItem Head; //0070 ZItem Chest; //00A4 ZItem Hand; //00D8 ZItem Leg; //010C ZItem Foot; //0140 ZItem Ring1; //0174 ZItem Ring2; //01A8 ZItem Melee; //01DC ZItem Gun1; //0210 ZItem Gun2; //0244 ZItem Item1; //0278 ZItem Item2; //02AC __int32 CurrentWeapon; //02E0 char unknown3[20]; char LastMovementName[12]; //02F8 char unknown4[32]; ZCharacter2* LastAttacker; //0324 char unknown5[32]; char NameDirty[32]; //0348 char ClanNameDirty[16]; //0368 char unknown6[44]; __int32 Kills; //03A4 __int32 Deaths; //03A8 char unknown7[36]; char Name[32]; //03D0 char ClanName[16]; //03F0 D3DXVECTOR3& Position(){ return *(D3DXVECTOR3*)(*(DWORD*)(PositionFind->Base + PositionFind->Offset *0x4)); } bool IsTeam(ZCharacter2* pChar) { return ((bool (__thiscall*)(ZCharacter2*, ZCharacter2*))0x00473630) (this, pChar); } void SetHP(int a) { _asm { mov ecx,this push a call ZCharacter2__SetHPSigAddress } } void SetAP(int a) { _asm { mov ecx,this push a mov eax, 0x00473760 call eax } } int GetHP() { int r; _asm { mov ecx,this mov eax, 0x00473730 call eax mov r,eax } return(r); } int GetAP() { int r; _asm { mov ecx,this mov eax, 0x00473740 call eax mov r,eax } return(r); } }; struct ZCharacter2Manager { ZCharacter2* Find(MUID& uidPlayer) { /*unsigned long firstID = uidPlayer.firstID; unsigned long secondID = uidPlayer.secondID; ZCharacter2* pChar; _asm { mov ecx,this push secondID push firstID mov eax, 0x0047A660 // ZCharacter2Manager::Find call eax mov pChar,eax } return pChar;*/ return ((ZCharacter2* (__thiscall*)(LPVOID, MUID))0x0047A660) (this, uidPlayer); } static ZCharacter2Manager* GetInstance() { return ((ZCharacter2Manager* (__cdecl*)())0x0049E870) (); } }; #define Find(uidChar) ZCharacter2Manager::GetInstance()->Find(uidChar) struct ZGameClient { char unknown0[88]; char Unknown1[32]; char unknown2[288]; MUID ServerMUID; MUID MyMUID; MUID ChannelMUID; MUID StageMUID; char ServerName[64]; char ServerIP[32]; char unknown3[744]; char CurrentChannel[128]; char Unknown4[128]; char Unknown5[128]; char CurrentGame[128]; char CurrentChat[64]; unsigned int RoomNumber; int CurrentCursor; bool ClanWar; int ChannelType; char szKickText[128]; DWORD m_nPrevClockRequestAttribute; int BridgePeerCount; DWORD LastBridgePeer; int Countdown; DWORD LastCountdown; int RequestID; MUID uidRequestPlayer; static ZGameClient* GetInstance() { return ((ZGameClient* (__cdecl*)())0x004ABCC0)(); } }; #define GetMe() ZGameClient::GetInstance()->MyMUID #include "CDetour.h" void MuidManagerClearer(); DWORD MAddSharedCommandTableAddress = 0x0051D6D0; CDetour MAddSharedCommandTableDet; void __cdecl MAddSharedCommandTableHook (MCommand2Manager* pCommandManager, int nSharedType) { /* MUID Victim; float Position[3]; int DamageType; int WeaponType; float Damage; float PiercingRatio; int MeleeType; */ MCommand2Desc* shotPacket = new MCommand2Desc(0xD3D9, "Lead.Info", "anti-lead", 64); shotPacket->AddParamDesc(new MCommand2ParameterDesc(MPT_INT, "Victim")); shotPacket->AddParamDesc(new MCommand2ParameterDesc(MPT_FLOAT, "X")); shotPacket->AddParamDesc(new MCommand2ParameterDesc(MPT_FLOAT, "Y")); shotPacket->AddParamDesc(new MCommand2ParameterDesc(MPT_FLOAT, "Z")); shotPacket->AddParamDesc(new MCommand2ParameterDesc(MPT_INT, "DamageType")); shotPacket->AddParamDesc(new MCommand2ParameterDesc(MPT_INT, "WeaponType")); shotPacket->AddParamDesc(new MCommand2ParameterDesc(MPT_FLOAT, "Damage")); shotPacket->AddParamDesc(new MCommand2ParameterDesc(MPT_FLOAT, "PiercingRatio")); shotPacket->AddParamDesc(new MCommand2ParameterDesc(MPT_INT, "MeleeType")); pCommandManager->AddCommandDesc(shotPacket); CreateThread(0, 0, (LPTHREAD_START_ROUTINE)MuidManagerClearer,0,0,0); //printf("Added packet.\n"); } struct MSTAGE_SETTING_NODE { int x1; int x2; char mapName[32]; int x3; unsigned int type; unsigned int rounds; unsigned int minutes; unsigned int gap; char players; bool mode1; bool mode2; bool mode3; bool friendlyFire; bool mode4; bool lateJoin; bool teamBalance; }; MUID players[30]; MSTAGE_SETTING_NODE* pStageNode; int MaxPlayers; CDetour ZCharacter2__OnDamagedDetour; DWORD ZCharacter2__OnDamagedAddress = 0x00477BF0; void __stdcall ZCharacter2__OnDamagedHook(ZCharacter2* pAttacker,D3DXVECTOR3 srcPos,int ZDAMAGETYPE,int WeaponType,float fDamage,float fPiercingRation,int nMeleeType) { ZCharacter2* pVictim = (ZCharacter2*)ZCharacter2__OnDamagedDetour.GetThisPtr(); ZCharacter2__OnDamagedDetour.Ret(false); if (pAttacker == Find(GetMe()) && pVictim != Find(GetMe())) { //zCPrint("Player: %s attemtped to do %f damage(%f p.ratio) to %s using item: %i", pAttacker->Name, fDamage,fPiercingRation, pVictim->Name, WeaponType); MUID *uid = new MUID(); uid->firstID = 0; uid->secondID = 0; for (int i = 0; i < 31; ++i) { if (Find(players[i]) == pVictim) { uid->secondID = players[i].secondID; } } MCommand2* pCmd = MCommand2::Create(0xD3D9); pCmd->AddParameter(new MCommand2ParameterInt(uid->secondID)); pCmd->AddParameter(new MCommand2ParameterFloat(srcPos.x)); pCmd->AddParameter(new MCommand2ParameterFloat(srcPos.y)); pCmd->AddParameter(new MCommand2ParameterFloat(srcPos.z)); pCmd->AddParameter(new MCommand2ParameterInt(ZDAMAGETYPE)); pCmd->AddParameter(new MCommand2ParameterInt(WeaponType)); pCmd->AddParameter(new MCommand2ParameterFloat(fDamage)); pCmd->AddParameter(new MCommand2ParameterFloat(fPiercingRation)); pCmd->AddParameter(new MCommand2ParameterInt(nMeleeType)); MCommand2::Post(pCmd); } else ZCharacter2__OnDamagedDetour.Ret(true); if (ZDAMAGETYPE == 1) { ZCharacter2__OnDamagedDetour.Ret(true); fDamage = 0; } } struct MTD_CharInfo{ char szName[0x20]; char szClanName[0x10]; int nClanGrade; unsigned short nClanContPoint; char nCharNum; unsigned short nLevel; char nSex; char nHair; char nFace; unsigned long nXP; int nBP; float fBonusRate; unsigned short nPrize; unsigned short nHP; unsigned short nAP; unsigned short nMaxWeight; unsigned short nSafeFalls; unsigned short nFR; unsigned short nCR; unsigned short nER; unsigned short nWR; unsigned long nEquipedItemDesc[12]; int nUGradeID; unsigned int nClanCLID; }; struct MTD_ExtendInfo{ char nTeam;//this+0x0 unsigned char nPlayerFlags;//this+0x1 unsigned char nReserved1;//this+0x2 unsigned char nReserved2;//this+0x3 unsigned char nReserved3;//this+0x4 }; struct MTD_PeerListNode{ MUID uidChar;//this+0x0 char szIP[0x40];//this+0x8 unsigned int nPort;//this+0x48 MTD_CharInfo CharInfo;//this+0x4c MTD_ExtendInfo ExtendInfo;//this+0xde public: void MTD_PeerListNode_(); }; void* ZGame__OnAddPeerAddress = (void*)0x4A3C60; CDetour ZGame__OnAddPeerDetour; void __stdcall ZGame__OnAddPeerHook(MUID&a,unsigned long,int,MTD_PeerListNode* pNode){ for(int i = 0; i < 30; i++){ if(!players[i].secondID || players[i].secondID == 0){ //ZPrint("%d Added.",a.HighPart); players[i] = a; MaxPlayers++; break; } } } CDetour ZGameClient__OnCommandDetour; DWORD ZGameClient__OnCommandAddress = 0x004C7990; bool __stdcall ZGameClient__OnCommandHook(MCommand2* pCommand){ if (pCommand->m_pCommandDesc->m_nCommandId == 0xD3D9) { MUID uidPlayer; float x,y,z,damage,ratio; int ztype,wtype,mtype; uidPlayer.firstID = 0; if (!pCommand->GetParameter(&uidPlayer.secondID, 0, MPT_INT, -1)) { printf("Failed to get parameter MUID\n"); return true; } if (pCommand->m_uidSender.secondID != GetMe().secondID) { pCommand->GetParameter(&x, 1, MPT_FLOAT, -1); pCommand->GetParameter(&y, 2, MPT_FLOAT, -1); pCommand->GetParameter(&z, 3, MPT_FLOAT, -1); pCommand->GetParameter(&ztype, 4, MPT_INT, -1); pCommand->GetParameter(&wtype, 5, MPT_INT, -1); pCommand->GetParameter(&damage, 6, MPT_FLOAT, -1); pCommand->GetParameter(&ratio, 7, MPT_FLOAT, -1); pCommand->GetParameter(&mtype, 8, MPT_INT, -1); D3DXVECTOR3 pos; pos.x = x; pos.y = y; pos.z = z; //ZCharacter2__OnDamagedDetour.Remove(); if (uidPlayer.secondID == GetMe().secondID) { MSTAGE_SETTING_NODE* pNode; _asm { pushad call ZGetGameClientAddress LEA ECX,DWORD PTR DS:[ESI+0xCD4] //MMatchStageSetting LEA EDI,DWORD PTR DS:[ECX+4] //MSTAGE_SETTING_NODE mov pNode, EDI popad } if ((pNode->type == 0 || pNode->type == 2 || pNode->type == 6 || pNode->type == 5 || pNode->type == 10) || (Find(GetMe())->IsTeam(Find(pCommand->m_uidSender)) && pNode->friendlyFire) || !Find(GetMe())->IsTeam(Find(pCommand->m_uidSender))) { //zCPrint("Player: (%s) tried to attack %s for %f damage (%f ratio) with item: %i.", Find(pCommand->m_uidSender)->Name, Find(uidPlayer)->Name, damage, ratio, ztype); float damageAp = damage * ratio; float damageHp = damage - damageAp; int ap = Find(GetMe())->GetAP() - damageAp; int hp = Find(GetMe())->GetHP() - damageHp; Find(GetMe())->SetAP(ap); Find(GetMe())->SetHP(hp); DWORD* me = (DWORD*)Find(GetMe()); DWORD secondID = pCommand->m_uidSender.firstID; DWORD firstID = pCommand->m_uidSender.secondID; _asm { pushad mov eax, me MOV EAX,DWORD PTR DS:[EAX+0x32C] mov edx, secondID mov ebx, firstID mov DWORD PTR DS:[EAX+0x1C], edx mov DWORD PTR DS:[EAX+0x20], ebx popad } } } //ZCharacter2__OnDamagedDetour.Apply(); } } } void MuidManagerClearer() { while(true) { if(ZGameClient::GetInstance() != NULL) { if(ZGameClient::GetInstance()->StageMUID.secondID > 0) { for(int i = 0;i<30;i++) { if(!(ZGameClient::GetInstance()->StageMUID.secondID > 0)) break; if(players[i].secondID != 0) { if (ZCharacter2Manager::GetInstance() != NULL) { if(!Find(players[i])) { players[i].secondID = 0; MaxPlayers--; } } } } } } Sleep(500); } } void SetupNoLead() { ZGameClient__OnCommandDetour.Detour((PBYTE)ZGameClient__OnCommandAddress, (PBYTE)ZGameClient__OnCommandHook, true); ZGameClient__OnCommandDetour.Apply(); ZCharacter2__OnDamagedDetour.Detour((unsigned char*)ZCharacter2__OnDamagedAddress,(unsigned char*)ZCharacter2__OnDamagedHook,true); ZCharacter2__OnDamagedDetour.Apply(); ZGame__OnAddPeerDetour.Detour((unsigned char*)ZGame__OnAddPeerAddress, (unsigned char*)ZGame__OnAddPeerHook, true); ZGame__OnAddPeerDetour.Apply(); MAddSharedCommandTableDet.Detour((PBYTE)MAddSharedCommandTableAddress, (PBYTE)MAddSharedCommandTableHook, true); MAddSharedCommandTableDet.Apply(); }
0 comentários:
Postar um comentário