Add files via upload
This commit is contained in:
parent
0c2e611bff
commit
a46d3bff97
144
main.cpp
144
main.cpp
|
@ -6,6 +6,25 @@
|
|||
|
||||
UINT_PTR base;
|
||||
|
||||
class Color{
|
||||
public:
|
||||
float red, green, blue, alpha;
|
||||
Color(float r, float g, float b, float a){
|
||||
red = r;
|
||||
green = g;
|
||||
blue = b;
|
||||
alpha = a;
|
||||
}
|
||||
|
||||
};
|
||||
Color defaultColor = Color(1.0, 1.0, 1.0, 1.0);
|
||||
DWORD defaultColorPtr = (DWORD)&defaultColor;
|
||||
|
||||
wchar_t defaultMessage[255];
|
||||
DWORD defaultMessagePtr = (DWORD)&defaultMessage;
|
||||
|
||||
char msgObject[255];
|
||||
DWORD msgObjectPtr = (DWORD)&msgObject;
|
||||
|
||||
_declspec(naked) void DLL_EXPORT ASMHandleMessage(){
|
||||
|
||||
|
@ -18,42 +37,6 @@ _declspec(naked) void DLL_EXPORT ASMHandleMessage(){
|
|||
asm("je 0f");
|
||||
|
||||
asm("1:");
|
||||
asm("push eax");
|
||||
asm("lea ecx, [ebp - 0x68]");
|
||||
|
||||
asm("mov eax, [_base]");
|
||||
asm("add eax, 0xEB60");
|
||||
asm("call eax");
|
||||
|
||||
asm("mov ecx, [edi+0x800A14]");
|
||||
asm("lea eax, [ebp - 0x38]");
|
||||
asm("push eax");
|
||||
asm("lea eax, [ebp - 0x68]");
|
||||
asm("push eax");
|
||||
|
||||
asm("mov byte ptr [ebp - 0x4], 0x8");
|
||||
asm("mov dword ptr [ebp - 0x38], 0x3F800000");
|
||||
asm("mov dword ptr [ebp - 0x34], 0x3F25A1CB");
|
||||
asm("mov dword ptr [ebp - 0x30], 0x3F800000");
|
||||
asm("mov dword ptr [ebp - 0x2C], 0x3F800000");
|
||||
|
||||
asm("mov eax, [_base]");
|
||||
asm("add eax, 0x3AB30");
|
||||
asm("call eax");
|
||||
|
||||
asm("lea ecx, [ebp - 0x68]");
|
||||
|
||||
asm("mov eax, [_base]");
|
||||
asm("add eax, 0x193E50");
|
||||
asm("call eax");
|
||||
|
||||
asm("lea ecx, [ebp - 0x28]");
|
||||
asm("mov byte ptr [ebp - 0x4], 0x4");
|
||||
|
||||
asm("mov eax, [_base]");
|
||||
asm("add eax, 0x193E50");
|
||||
asm("call eax");
|
||||
|
||||
asm("mov ecx, [_base]"); //jump to end
|
||||
asm("add ecx, 0x7E6BF");
|
||||
asm("jmp ecx");
|
||||
|
@ -66,7 +49,61 @@ _declspec(naked) void DLL_EXPORT ASMHandleMessage(){
|
|||
asm("jmp eax");
|
||||
}
|
||||
|
||||
wchar_t* DLL_EXPORT HandleMessage(wchar_t msg[]){
|
||||
void DLL_EXPORT ASMPrintMessage(){
|
||||
|
||||
asm("push [_defaultMessagePtr]");
|
||||
asm("mov ecx, [_msgObjectPtr]");
|
||||
|
||||
asm("mov eax, [_base]");
|
||||
asm("add eax, 0x0EB60");
|
||||
asm("call eax"); //call some message constructing function
|
||||
|
||||
asm("mov ecx, [_base]");
|
||||
asm("add ecx, 0x36B1C8");
|
||||
asm("mov ecx, [ecx]"); //ecx points to gamecontroller
|
||||
asm("mov ecx, [ecx + 0x800A14]"); //ecx points to chatwidget
|
||||
|
||||
asm("push [_defaultColorPtr]");
|
||||
asm("push [_msgObjectPtr]");
|
||||
asm("mov edx, [_base]");
|
||||
asm("add edx, 0x3AB30");
|
||||
asm("call edx"); //prints message
|
||||
|
||||
|
||||
asm("mov ecx, [_msgObjectPtr]");
|
||||
|
||||
asm("mov eax, [_base]");
|
||||
asm("add eax, 0x193E50");
|
||||
asm("call eax"); //destructor for that message object
|
||||
|
||||
}
|
||||
|
||||
void DLL_EXPORT PrintMessage(wchar_t message[]){
|
||||
|
||||
wcsncpy(defaultMessage, message, 255);
|
||||
defaultColor.red = 1.0;
|
||||
defaultColor.blue = 1.0;
|
||||
defaultColor.green = 1.0;
|
||||
defaultColor.alpha = 1.0;
|
||||
ASMPrintMessage();
|
||||
}
|
||||
void DLL_EXPORT PrintMessage(wchar_t message[], int r, int g, int b){
|
||||
wcsncpy(defaultMessage, message, 255);
|
||||
defaultColor.red = r / 255.0;
|
||||
defaultColor.green = g / 255.0;
|
||||
defaultColor.blue = b / 255.0;
|
||||
ASMPrintMessage();
|
||||
}
|
||||
|
||||
|
||||
void CommandsModMessage(wchar_t message[]){
|
||||
PrintMessage(L"[");
|
||||
PrintMessage(L"CommandsMod", 255, 140, 0);
|
||||
PrintMessage(L"] ");
|
||||
PrintMessage(message);
|
||||
}
|
||||
|
||||
bool DLL_EXPORT HandleMessage(wchar_t msg[]){
|
||||
wchar_t response[255];
|
||||
DWORD entityaddr = (DWORD)(base + 0x36b1c8);
|
||||
entityaddr = *(DWORD*)entityaddr;
|
||||
|
@ -77,38 +114,55 @@ wchar_t* DLL_EXPORT HandleMessage(wchar_t msg[]){
|
|||
long long unsigned int* y = (long long unsigned int*)(entityaddr+0x18);
|
||||
long long unsigned int* z = (long long unsigned int*)(entityaddr+0x20);
|
||||
|
||||
if(!wcscmp(msg, L"/coords")){
|
||||
swprintf(response, L"X: %llu\nY: %llu\nZ: %llu\n", *x, *y, *z);
|
||||
return response;
|
||||
//Display commands
|
||||
if (!wcscmp(msg, L"/help")){
|
||||
CommandsModMessage(L"List of commands:\n");
|
||||
PrintMessage(L"/help - displays this\n");
|
||||
PrintMessage(L"/coords - displays your absolute coordinates\n");
|
||||
PrintMessage(L"/chunks - displays your coordinates in terms of chunks\n");
|
||||
PrintMessage(L"/tp <x> <y> <z> - teleports you in terms of absolute coordinates\n");
|
||||
PrintMessage(L"/tpch <chunk x> <chunk y> - teleports you in terms of chunks\n");
|
||||
return true;
|
||||
}
|
||||
else if(!wcscmp(msg, L"/coords")){
|
||||
swprintf(response, L"World coordinates:\nX: %llu\nY: %llu\nZ: %llu\n", *x, *y, *z);
|
||||
CommandsModMessage(response);
|
||||
return true;
|
||||
}
|
||||
|
||||
else if(!wcscmp(msg, L"/chunks")){
|
||||
unsigned int chunkx = *x / 0x1000000;
|
||||
unsigned int chunky = *y / 0x1000000;
|
||||
swprintf(response, L"X: Chunk %u\nY: Chunk %u\nZ: %llu\n", chunkx, chunky, *z);
|
||||
return response;
|
||||
swprintf(response, L"Chunk coordinates:\nX: Chunk %u\nY: Chunk %u\nZ: %llu\n", chunkx, chunky, *z);
|
||||
CommandsModMessage(response);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
//Argument commands
|
||||
else{
|
||||
long long unsigned int targetx, targety, targetz;
|
||||
|
||||
if ( swscanf(msg, L"/tp %llu %llu %llu", &targetx, &targety, &targetz) == 3){
|
||||
*x = targetx;
|
||||
*y = targety;
|
||||
*z = targetz;
|
||||
swprintf(response, L"Teleporting.\n");
|
||||
return response;
|
||||
CommandsModMessage(response);
|
||||
return true;
|
||||
}
|
||||
|
||||
else if ( swscanf(msg, L"/tpch %llu %llu", &targetx, &targety) == 2){
|
||||
*x = targetx * 0x1000000;
|
||||
*y = targety * 0x1000000;
|
||||
swprintf(response, L"Teleporting.\n");
|
||||
return response;
|
||||
CommandsModMessage(response);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return false;
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue