inline std::string generate_rand() {
		std::mt19937 rng;
		rng.seed(std::random_device()());
		std::uniform_int_distribution<std::mt19937::result_type> dist6(1,6); // distribution in range [1, 6]
		return std::to_string(dist6(rng));
	}
Exemple #2
0
void CRole::RoleTeleport(int nKey, float fx, float fy, float fz) {
    int nRoleAddr = 0, nEbx = 0;
    if (martin->ReadPtrData(BASE_GAME, TEXT("解密对象 Key -- 1"), nEbx)) {
        if (martin->ReadPtrData(nEbx + OFFSET_NEARBY_OBJECT, TEXT("解密对象 Key -- 2"), nEbx)) {
            //::MessageBox(NULL, TEXT("111"), TEXT("111"), 0);
            try {
                _asm {
                    pushad;
                    pushfd;

                    mov ebx, nEbx; //[[BASE_GAME]+OFFSET_NEARBY_OBJECT]
                    mov eax, [ebx];
                    mov edx, nKey; //对象Key
                    push edx;
                    mov edx, [eax + 0x2C];
                    mov ecx, ebx;
                    call edx;
                    mov nRoleAddr, eax;

                    popfd;
                    popad;
                }
            } catch (...) {
                martin->Debug(TEXT("RoleTeleport -- 1 --> 异常"));
                return;
            }

            std::mt19937  rng;
            rng.seed(std::random_device()());
            std::uniform_int_distribution<std::mt19937::result_type> dist6(0, 314); // distribution in range [1, 6]
            float fTurn = dist6(rng) / 100.0f;
            
            int nTmep;
            if (martin->ReadPtrData(BASE_CAMERA, TEXT("获取当前人物面向 -- 1"), nTmep)) {
                if (martin->ReadPtrData(nTmep + OFFSET_CAREMA_1, TEXT("获取当前人物面向 -- 2"), nTmep)) {
                    if (martin->ReadPtrData(nTmep + OFFSET_CAREMA_2, TEXT("获取当前人物面向 -- 3"), nTmep)) {
                        *(float*)(nTmep + OFFSET_CAREMA_ANGLE) = fTurn;
                    }
                }
            }

            *(float*)(nRoleAddr + 0x38) = fx;//目的坐标X
            *(float*)(nRoleAddr + 0x38 + 0x4) = fy;//目的坐标Y
            *(float*)(nRoleAddr + 0x38 + 0x8) = fz;//目的坐标Z

            float EmptyStackPtr[0x10];
            RtlZeroMemory(EmptyStackPtr, sizeof(EmptyStackPtr));
            DWORD dwEmptyStackPtr = (DWORD)&EmptyStackPtr;

            try {
                _asm {
                    pushad;
                    pushfd;

                    mov ecx, nRoleAddr;
                    lea eax, [ecx + 0x38];
                    push eax;
                    lea eax, [ecx + 0x44];
                    push eax;
                    lea eax, [ecx + 0x54];
                    push eax;
                    mov ecx, dwEmptyStackPtr;  //0x10个成员的float数组,成员值全部设置为0即可。
                    mov eax, CALL_TELESPORT;
                    call eax;

                    popfd;
                    popad;
                }
            } catch (...) {
                martin->Debug(TEXT("RoleTeleport -- 2 --> 异常"));
                return;
            }
        }
    }
}