mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-02 15:53:51 +00:00
fix(movement): stop spoofing player position for area triggers
The area trigger system was temporarily moving the player to the trigger center and sending a heartbeat before firing CMSG_AREATRIGGER. This told the server the player was at a different location, causing unexpected teleports (e.g. Stormwind to Hillsbrad). Just send the area trigger packet directly — the player is already inside the trigger radius.
This commit is contained in:
parent
09c1469956
commit
19bfaaef97
1 changed files with 5 additions and 17 deletions
|
|
@ -2583,26 +2583,14 @@ void MovementHandler::checkAreaTriggers() {
|
||||||
// This prevents the exit portal from immediately sending us back.
|
// This prevents the exit portal from immediately sending us back.
|
||||||
LOG_WARNING("AreaTrigger suppressed (post-transfer): AT", at.id);
|
LOG_WARNING("AreaTrigger suppressed (post-transfer): AT", at.id);
|
||||||
} else {
|
} else {
|
||||||
// Temporarily move player to trigger center so the server's distance
|
// Send CMSG_AREATRIGGER — the player is already inside the
|
||||||
// check passes, then restore to actual position so the server doesn't
|
// trigger radius so the server's distance check should pass.
|
||||||
// persist the fake position on disconnect.
|
// Do NOT spoof position to the trigger center; that tells the
|
||||||
float savedX = movementInfo.x, savedY = movementInfo.y, savedZ = movementInfo.z;
|
// server we're somewhere we're not and can cause rogue teleports.
|
||||||
movementInfo.x = at.x;
|
|
||||||
movementInfo.y = at.y;
|
|
||||||
movementInfo.z = at.z;
|
|
||||||
sendMovement(Opcode::MSG_MOVE_HEARTBEAT);
|
|
||||||
|
|
||||||
network::Packet pkt(wireOpcode(Opcode::CMSG_AREATRIGGER));
|
network::Packet pkt(wireOpcode(Opcode::CMSG_AREATRIGGER));
|
||||||
pkt.writeUInt32(at.id);
|
pkt.writeUInt32(at.id);
|
||||||
owner_.socket->send(pkt);
|
owner_.socket->send(pkt);
|
||||||
LOG_WARNING("Fired CMSG_AREATRIGGER: id=", at.id,
|
LOG_DEBUG("Fired CMSG_AREATRIGGER: id=", at.id);
|
||||||
" at (", at.x, ", ", at.y, ", ", at.z, ")");
|
|
||||||
|
|
||||||
// Restore actual player position
|
|
||||||
movementInfo.x = savedX;
|
|
||||||
movementInfo.y = savedY;
|
|
||||||
movementInfo.z = savedZ;
|
|
||||||
sendMovement(Opcode::MSG_MOVE_HEARTBEAT);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue