修复进服和下服事件

This commit is contained in:
Qiuzhizhe 2022-10-01 19:43:57 -07:00
parent 07a6011101
commit 5ecd9e710d

View File

@ -322,33 +322,32 @@ TClasslessInstanceHook(void, "?sendLoginMessageLocal@ServerNetworkHandler@@QEAAX
/////////////////// PlayerJoin /////////////////// /////////////////// PlayerJoin ///////////////////
//没有这个符号 //没有这个符号
// TInstanceHook(bool, "?setLocalPlayerAsInitialized@ServerPlayer@@QEAAXXZ", TInstanceHook(bool, "?onReady_ClientGeneration@ServerNetworkHandler@@QEAAXAEAVPlayer@@AEBVNetworkIdentifier@@@Z",
// ServerPlayer) { ServerNetworkHandler,Player* player,NetworkIdentifier *net) {
// IF_LISTENED(PlayerJoinEvent) { IF_LISTENED(PlayerJoinEvent) {
// PlayerJoinEvent ev{}; PlayerJoinEvent ev{};
// ev.mPlayer = this; ev.mPlayer = player;
// if (!ev.call()) if (!ev.call())
// return false; return false;
// } }
// IF_LISTENED_END(PlayerJoinEvent) IF_LISTENED_END(PlayerJoinEvent)
// return original(this); return original(this,player,net);
// } }
/////////////////// PlayerLeft /////////////////// /////////////////// PlayerLeft ///////////////////
//符号没有 THook(void, "?_onPlayerLeft@ServerNetworkHandler@@AEAAXPEAVServerPlayer@@_N@Z",
// THook(void, "?disconnect@ServerPlayer@@QEAAXXZ", ServerNetworkHandler *_this,ServerPlayer* sp,char a3) {
// ServerPlayer* sp) { IF_LISTENED(PlayerLeftEvent) {
// IF_LISTENED(PlayerLeftEvent) { PlayerLeftEvent ev{};
// PlayerLeftEvent ev{}; ev.mPlayer = sp;
// ev.mPlayer = sp; ev.mXUID = sp->getXuid();
// ev.mXUID = sp->getXuid(); ev.call();
// ev.call(); }
// } IF_LISTENED_END(PlayerLeftEvent)
// IF_LISTENED_END(PlayerLeftEvent) return original(_this,sp,a3);
// return original(sp); }
// }
/////////////////// PlayerRespawn /////////////////// /////////////////// PlayerRespawn ///////////////////
TClasslessInstanceHook(void, "?handle@?$PacketHandlerDispatcherInstance@VPlayerActionPacket@@$0A@@@UEBAXAEBVNetworkIdentifier@@AEAVNetEventCallback@@AEAV?$shared_ptr@VPacket@@@std@@@Z", TClasslessInstanceHook(void, "?handle@?$PacketHandlerDispatcherInstance@VPlayerActionPacket@@$0A@@@UEBAXAEBVNetworkIdentifier@@AEAVNetEventCallback@@AEAV?$shared_ptr@VPacket@@@std@@@Z",
@ -376,11 +375,11 @@ TInstanceHook(void, "?handle@ServerNetworkHandler@@UEAAXAEBVNetworkIdentifier@@A
if (!ev.mPlayer) if (!ev.mPlayer)
return; return;
ev.mMessage = std::string(*(std::string*)((uintptr_t)text + 88)); ev.mMessage = std::string(*(std::string*)((uintptr_t)text + 80));
if (!ev.call()) if (!ev.call())
return; return;
*(std::string*)((uintptr_t)text + 88) = ev.mMessage; *(std::string*)((uintptr_t)text + 80) = ev.mMessage;
} }
IF_LISTENED_END(PlayerChatEvent); IF_LISTENED_END(PlayerChatEvent);
return original(this, id, text); return original(this, id, text);