mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-15 18:10:26 +00:00
fix(Core/Movement): Add safeguards against root freezes (#23117)
This commit is contained in:
@@ -92,24 +92,18 @@ public:
|
||||
if (!target)
|
||||
target = handler->GetSession()->GetPlayer();
|
||||
|
||||
WorldPacket data(12);
|
||||
|
||||
bool canFly = false;
|
||||
if (enable.has_value())
|
||||
{
|
||||
data.SetOpcode(*enable ? SMSG_MOVE_SET_CAN_FLY : SMSG_MOVE_UNSET_CAN_FLY);
|
||||
canFly = *enable;
|
||||
target->SetCanFly(canFly);
|
||||
}
|
||||
else
|
||||
{
|
||||
canFly = handler->GetSession()->GetPlayer()->CanFly();
|
||||
data.SetOpcode(canFly ? SMSG_MOVE_UNSET_CAN_FLY : SMSG_MOVE_SET_CAN_FLY);
|
||||
canFly = !canFly;
|
||||
target->SetCanFly(!canFly);
|
||||
}
|
||||
|
||||
data << target->GetPackGUID();
|
||||
data << uint32(0); // unknown
|
||||
target->SendMessageToSet(&data, true);
|
||||
handler->PSendSysMessage(LANG_COMMAND_FLYMODE_STATUS, handler->GetNameLink(target), canFly ? "on" : "off");
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user