Disallow warping to players using the MSS

This commit is contained in:
dongresource 2020-12-28 16:13:38 +01:00
parent 868dc8485e
commit 81d0964971

View File

@ -505,6 +505,7 @@ void BuddyManager::reqBuddyDelete(CNSocket* sock, CNPacketData* data) {
void BuddyManager::reqBuddyWarp(CNSocket* sock, CNPacketData* data) { void BuddyManager::reqBuddyWarp(CNSocket* sock, CNPacketData* data) {
if (data->size != sizeof(sP_CL2FE_REQ_PC_BUDDY_WARP)) if (data->size != sizeof(sP_CL2FE_REQ_PC_BUDDY_WARP))
return; // malformed packet return; // malformed packet
Player *plr = PlayerManager::getPlayer(sock);
sP_CL2FE_REQ_PC_BUDDY_WARP* pkt = (sP_CL2FE_REQ_PC_BUDDY_WARP*)data->buf; sP_CL2FE_REQ_PC_BUDDY_WARP* pkt = (sP_CL2FE_REQ_PC_BUDDY_WARP*)data->buf;
@ -515,27 +516,27 @@ void BuddyManager::reqBuddyWarp(CNSocket* sock, CNPacketData* data) {
if (otherPlr == nullptr) if (otherPlr == nullptr)
return; // buddy offline return; // buddy offline
if (otherPlr->instanceID != INSTANCE_OVERWORLD) { // if the player is instanced; no warp allowed
// player is instanced; no warp allowed if (otherPlr->instanceID != INSTANCE_OVERWORLD)
INITSTRUCT(sP_FE2CL_REP_PC_BUDDY_WARP_FAIL, resp); goto fail;
resp.iBuddyPCUID = pkt->iBuddyPCUID;
resp.iErrorCode = 0;
sock->sendPacket((void*)&resp, P_FE2CL_REP_PC_BUDDY_WARP_FAIL, sizeof(sP_FE2CL_REP_PC_BUDDY_WARP_FAIL));
return;
}
Player *plr = PlayerManager::getPlayer(sock); // check if the players are at the same point in time (or in the training area or not)
if (otherPlr->PCStyle2.iPayzoneFlag != plr->PCStyle2.iPayzoneFlag) { if (otherPlr->PCStyle2.iPayzoneFlag != plr->PCStyle2.iPayzoneFlag)
// players are not at the same point in time goto fail;
INITSTRUCT(sP_FE2CL_REP_PC_BUDDY_WARP_FAIL, resp);
resp.iBuddyPCUID = pkt->iBuddyPCUID; // do not warp to players on monkeys
resp.iErrorCode = 0; if (otherPlr->onMonkey)
sock->sendPacket((void*)&resp, P_FE2CL_REP_PC_BUDDY_WARP_FAIL, sizeof(sP_FE2CL_REP_PC_BUDDY_WARP_FAIL)); goto fail;
return;
}
// otherPlr->instanceID should always be INSTANCE_OVERWORLD at this point // otherPlr->instanceID should always be INSTANCE_OVERWORLD at this point
PlayerManager::sendPlayerTo(sock, otherPlr->x, otherPlr->y, otherPlr->z, otherPlr->instanceID); PlayerManager::sendPlayerTo(sock, otherPlr->x, otherPlr->y, otherPlr->z, otherPlr->instanceID);
return;
fail:
INITSTRUCT(sP_FE2CL_REP_PC_BUDDY_WARP_FAIL, resp);
resp.iBuddyPCUID = pkt->iBuddyPCUID;
resp.iErrorCode = 0;
sock->sendPacket((void*)&resp, P_FE2CL_REP_PC_BUDDY_WARP_FAIL, sizeof(sP_FE2CL_REP_PC_BUDDY_WARP_FAIL));
} }
void BuddyManager::emailUpdateCheck(CNSocket* sock, CNPacketData* data) { void BuddyManager::emailUpdateCheck(CNSocket* sock, CNPacketData* data) {