Commands_Go_to_Battleground
unknown
c_cpp
2 years ago
2.9 kB
25
Indexable
#include "pch.h"
auto digit_format = "%d";
auto tp_cmd = "!tp";
auto tp_message_format = "You will be teleported to %s";
char tp_message[128];
char primary_scanned_cmd_digit[4];
int get_player_level() {
int player_level = 0;
__asm {
mov eax, 0x90D1E4
mov ax, [eax] // Since it's a short, use ax instead of eax
mov player_level, eax
}
return player_level;
}
const char* map_name(int map_id, int player_level) {
if (player_level == 30) {
switch (map_id) {
case 1: return "Auction House";
case 2: return "Capital";
case 3: return "Proelium";
case 4: return "Cantabillian";
case 5: return "Deep Desert-1";
default: return "This map is not enabled for level 30.";
}
}
// Default map names (unchanged)
switch (map_id) {
case 1: return "Auction House";
case 2: return "Capital";
case 3: return "D-Water Borderland";
case 4: return "Oblivion Insula";
case 5: return "Kimuraku Room";
case 6: return "Deep Desert-1";
case 7: return "Deep Desert-2";
case 8: return "Stable Erde";
case 9: return "Kanos Illium";
default: return "This map is not enabled.";
}
}
DWORD add_commands_retn = 0x4867A6;
DWORD add_commands_exit = 0x487532;
_declspec(naked) void add_commands() {
_asm {
push 03
push tp_cmd
push edi
call compare_string
add esp, 12
test eax, eax
je command_1
push 0x13D4
jmp add_commands_retn
command_1:
pushad
cmp word ptr ds:[0x90E2E0], 41
je command_1_exit
// Obtain the player level
push ecx
call get_player_level
pop ecx
// Debug output for player level
push ecx
push offset tp_message
call sprintf
add esp, 8
push ecx // Pass the player level to map_name
push offset primary_scanned_cmd_digit
push digit_format
add edi, 04
push edi
call digit_scanner
add esp, 12
pop ecx
// Debug output for scanned digit
push ecx
push offset tp_message
call sprintf
add esp, 8
push primary_scanned_cmd_digit
push ecx // Pass the player level to map_name
call map_name
add esp, 8
push ecx // Pass the player level
push tp_message_format
push offset tp_message
call sprintf
add esp, 12
push offset tp_message
push 0
call write_client_chat_text
lea ebx, [tp_packet]
mov esi, offset primary_scanned_cmd_digit
mov esi, [esi]
mov [ebx + 3], esi
push 04
push ebx
call send_packet
add esp, 8
command_1_exit:
popad
jmp add_commands_exit
}
}
void COMMANDS() {
Hook((LPVOID)0x4867A1, add_commands, 5);
}
Editor is loading...