This commit is contained in:
parent
2f5692afc7
commit
2a01a429ef
@ -218,6 +218,8 @@ typedef void (*Entity_load_t)(unsigned char *entity, unsigned char *tag);
|
|||||||
typedef void (*Entity_moveTo_t)(unsigned char *entity, float param_1, float param_2, float param_3, float param_4, float param_5);
|
typedef void (*Entity_moveTo_t)(unsigned char *entity, float param_1, float param_2, float param_3, float param_4, float param_5);
|
||||||
static Entity_moveTo_t Entity_moveTo = (Entity_moveTo_t) 0x7a834;
|
static Entity_moveTo_t Entity_moveTo = (Entity_moveTo_t) 0x7a834;
|
||||||
|
|
||||||
|
typedef void (*Entity_die_t)(unsigned char *entity, unsigned char *cause);
|
||||||
|
|
||||||
// ServerPlayer
|
// ServerPlayer
|
||||||
|
|
||||||
static void *ServerPlayer_moveTo_vtable_addr = (void *) 0x109e54;
|
static void *ServerPlayer_moveTo_vtable_addr = (void *) 0x109e54;
|
||||||
|
@ -168,7 +168,7 @@ static void ServerPlayer_moveTo_injection(unsigned char *player, float param_1,
|
|||||||
(*Entity_moveTo)(player, param_1, param_2, param_3, param_4, param_5);
|
(*Entity_moveTo)(player, param_1, param_2, param_3, param_4, param_5);
|
||||||
|
|
||||||
// Check If Player Is Spawned
|
// Check If Player Is Spawned
|
||||||
unsigned char *minecraft = *(unsigned char **) (player + 0xc8c);
|
unsigned char *minecraft = server_internal_get_minecraft(player);
|
||||||
unsigned char *level = server_internal_get_level(minecraft);
|
unsigned char *level = server_internal_get_level(minecraft);
|
||||||
std::vector<unsigned char *> players = server_internal_get_players(level);
|
std::vector<unsigned char *> players = server_internal_get_players(level);
|
||||||
bool spawned = false;
|
bool spawned = false;
|
||||||
@ -182,7 +182,7 @@ static void ServerPlayer_moveTo_injection(unsigned char *player, float param_1,
|
|||||||
|
|
||||||
// Load Data
|
// Load Data
|
||||||
if (!spawned) {
|
if (!spawned) {
|
||||||
load_player_callback(server_internal_get_player_username(player), player);
|
load_player_callback(server_internal_get_server_player_username(player), player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ void playerdata_save(unsigned char *level) {
|
|||||||
for (std::size_t i = 0; i < players.size(); i++) {
|
for (std::size_t i = 0; i < players.size(); i++) {
|
||||||
// Iterate Players
|
// Iterate Players
|
||||||
unsigned char *player = players[i];
|
unsigned char *player = players[i];
|
||||||
std::string username = server_internal_get_player_username(player);
|
std::string username = server_internal_get_server_player_username(player);
|
||||||
save_player_callback(username, player);
|
save_player_callback(username, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -201,7 +201,7 @@ static void ServerSideNetworkHandler_onDisconnect_injection(unsigned char *serve
|
|||||||
// Save Player Data
|
// Save Player Data
|
||||||
unsigned char *player = (*ServerSideNetworkHandler_getPlayer)(server_side_network_handler, guid);
|
unsigned char *player = (*ServerSideNetworkHandler_getPlayer)(server_side_network_handler, guid);
|
||||||
if (player != NULL) {
|
if (player != NULL) {
|
||||||
std::string username = server_internal_get_player_username(player);
|
std::string username = server_internal_get_server_player_username(player);
|
||||||
save_player_callback(username, player);
|
save_player_callback(username, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,13 +147,17 @@ std::vector<unsigned char *> server_internal_get_players(unsigned char *level) {
|
|||||||
return *(std::vector<unsigned char *> *) (level + 0x60);
|
return *(std::vector<unsigned char *> *) (level + 0x60);
|
||||||
}
|
}
|
||||||
// Get Player's Username
|
// Get Player's Username
|
||||||
std::string server_internal_get_player_username(unsigned char *player) {
|
std::string server_internal_get_server_player_username(unsigned char *player) {
|
||||||
return *(char **) (player + 0xbf4);
|
return *(char **) (player + 0xbf4);
|
||||||
}
|
}
|
||||||
// Get Level From Minecraft
|
// Get Level From Minecraft
|
||||||
unsigned char *server_internal_get_level(unsigned char *minecraft) {
|
unsigned char *server_internal_get_level(unsigned char *minecraft) {
|
||||||
return *(unsigned char **) (minecraft + 0x188);
|
return *(unsigned char **) (minecraft + 0x188);
|
||||||
}
|
}
|
||||||
|
// Get minecraft from ServerPlayer
|
||||||
|
unsigned char *server_internal_get_minecraft(unsigned char *player) {
|
||||||
|
return *(unsigned char **) (player + 0xc8c);
|
||||||
|
}
|
||||||
|
|
||||||
// Find Players With Username And Run Callback
|
// Find Players With Username And Run Callback
|
||||||
static void find_players(unsigned char *minecraft, std::string target_username, player_callback_t callback, bool all_players) {
|
static void find_players(unsigned char *minecraft, std::string target_username, player_callback_t callback, bool all_players) {
|
||||||
@ -163,7 +167,7 @@ static void find_players(unsigned char *minecraft, std::string target_username,
|
|||||||
for (std::size_t i = 0; i < players.size(); i++) {
|
for (std::size_t i = 0; i < players.size(); i++) {
|
||||||
// Iterate Players
|
// Iterate Players
|
||||||
unsigned char *player = players[i];
|
unsigned char *player = players[i];
|
||||||
std::string username = server_internal_get_player_username(player);
|
std::string username = server_internal_get_server_player_username(player);
|
||||||
if (all_players || username == target_username) {
|
if (all_players || username == target_username) {
|
||||||
// Run Callback
|
// Run Callback
|
||||||
(*callback)(minecraft, username, player);
|
(*callback)(minecraft, username, player);
|
||||||
@ -218,7 +222,6 @@ static void ban_callback(unsigned char *minecraft, std::string username, unsigne
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Kill Player
|
// Kill Player
|
||||||
typedef void (*Entity_die_t)(unsigned char *entity, unsigned char *cause);
|
|
||||||
static void kill_callback(__attribute__((unused)) unsigned char *minecraft, __attribute__((unused)) std::string username, unsigned char *player) {
|
static void kill_callback(__attribute__((unused)) unsigned char *minecraft, __attribute__((unused)) std::string username, unsigned char *player) {
|
||||||
unsigned char *player_vtable = *(unsigned char **) player;
|
unsigned char *player_vtable = *(unsigned char **) player;
|
||||||
Entity_die_t Entity_die = *(Entity_die_t *) (player_vtable + 0x130);
|
Entity_die_t Entity_die = *(Entity_die_t *) (player_vtable + 0x130);
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
std::string server_internal_get_world_name();
|
std::string server_internal_get_world_name();
|
||||||
unsigned char *server_internal_get_level(unsigned char *minecraft);
|
unsigned char *server_internal_get_level(unsigned char *minecraft);
|
||||||
std::vector<unsigned char *> server_internal_get_players(unsigned char *level);
|
std::vector<unsigned char *> server_internal_get_players(unsigned char *level);
|
||||||
std::string server_internal_get_player_username(unsigned char *player);
|
std::string server_internal_get_server_player_username(unsigned char *player);
|
||||||
|
unsigned char *server_internal_get_minecraft(unsigned char *player);
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in New Issue
Block a user