fix(Core/Misc): Consider /dance as an emote state. (#14275)

This commit is contained in:
UltraNix
2022-12-22 07:38:09 +01:00
committed by GitHub
parent 20c9e80d4a
commit 962cefdcd8
3 changed files with 15 additions and 0 deletions

View File

@@ -14464,6 +14464,9 @@ void Unit::setDeathState(DeathState s, bool despawn)
SetHealth(0);
SetPower(getPowerType(), 0);
// Stop emote on death
SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
// players in instance don't have ZoneScript, but they have InstanceScript
if (ZoneScript* zoneScript = GetZoneScript() ? GetZoneScript() : (ZoneScript*)GetInstanceScript())
zoneScript->OnUnitDeath(this);

View File

@@ -755,6 +755,9 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket& recvData)
case EMOTE_STATE_KNEEL:
case EMOTE_ONESHOT_NONE:
break;
case EMOTE_STATE_DANCE:
GetPlayer()->SetUInt32Value(UNIT_NPC_EMOTESTATE, emote_anim);
break;
default:
// Only allow text-emotes for "dead" entities (feign death included)
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))

View File

@@ -370,6 +370,15 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
movementInfo.guid = guid;
ReadMovementInfo(recvData, &movementInfo);
// Stop emote on move
if (Player* plrMover = mover->ToPlayer())
{
if (plrMover->GetUInt32Value(UNIT_NPC_EMOTESTATE) != EMOTE_ONESHOT_NONE)
{
plrMover->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE);
}
}
if (!movementInfo.pos.IsPositionValid())
{
if (plrMover)