feat(Core/PacketIO): restrict CMSG_EMOTE/CMSG_STANDSTATECHANGE to only allow emotes/stand states that client can send by itself (#2412)
Co-authored-by: Shauren <shauren.trinity@gmail.com>
This commit is contained in:
@@ -642,6 +642,11 @@ void WorldSession::HandleEmoteOpcode(WorldPacket & recvData)
|
|||||||
|
|
||||||
uint32 emote;
|
uint32 emote;
|
||||||
recvData >> emote;
|
recvData >> emote;
|
||||||
|
|
||||||
|
// restrict to the only emotes hardcoded in client
|
||||||
|
if (emote != EMOTE_ONESHOT_NONE && emote != EMOTE_ONESHOT_WAVE)
|
||||||
|
return;
|
||||||
|
|
||||||
sScriptMgr->OnPlayerEmote(GetPlayer(), emote);
|
sScriptMgr->OnPlayerEmote(GetPlayer(), emote);
|
||||||
GetPlayer()->HandleEmoteCommand(emote);
|
GetPlayer()->HandleEmoteCommand(emote);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -549,13 +549,20 @@ void WorldSession::HandleSetSelectionOpcode(WorldPacket & recv_data)
|
|||||||
|
|
||||||
void WorldSession::HandleStandStateChangeOpcode(WorldPacket & recv_data)
|
void WorldSession::HandleStandStateChangeOpcode(WorldPacket & recv_data)
|
||||||
{
|
{
|
||||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
|
||||||
// too many spam in log at lags/debug stop
|
|
||||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_STANDSTATECHANGE");
|
|
||||||
#endif
|
|
||||||
uint32 animstate;
|
uint32 animstate;
|
||||||
recv_data >> animstate;
|
recv_data >> animstate;
|
||||||
|
|
||||||
|
switch (animstate)
|
||||||
|
{
|
||||||
|
case UNIT_STAND_STATE_STAND:
|
||||||
|
case UNIT_STAND_STATE_SIT:
|
||||||
|
case UNIT_STAND_STATE_SLEEP:
|
||||||
|
case UNIT_STAND_STATE_KNEEL:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_player->SetStandState(animstate);
|
_player->SetStandState(animstate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user