Core/Units: Added possibility to send emotes to single players (#27054)

This commit is contained in:
ModoX
2021-10-13 15:01:10 +02:00
committed by GitHub
parent 49eb3cf8fe
commit 4a6308f5f0
3 changed files with 7 additions and 4 deletions

View File

@@ -1484,7 +1484,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss)
}
}
void Unit::HandleEmoteCommand(uint32 anim_id, Trinity::IteratorPair<int32 const*> spellVisualKitIds /*= {}*/)
void Unit::HandleEmoteCommand(uint32 anim_id, Player* target /*=nullptr*/, Trinity::IteratorPair<int32 const*> spellVisualKitIds /*= {}*/)
{
WorldPackets::Chat::Emote packet;
packet.Guid = GetGUID();
@@ -1494,7 +1494,10 @@ void Unit::HandleEmoteCommand(uint32 anim_id, Trinity::IteratorPair<int32 const*
if (emotesEntry->AnimID == ANIM_MOUNT_SPECIAL || emotesEntry->AnimID == ANIM_MOUNT_SELF_SPECIAL)
std::copy(spellVisualKitIds.begin(), spellVisualKitIds.end(), std::back_inserter(packet.SpellVisualKitIDs));
SendMessageToSet(packet.Write(), true);
if (target)
target->SendDirectMessage(packet.Write());
else
SendMessageToSet(packet.Write(), true);
}
/*static*/ bool Unit::IsDamageReducedByArmor(SpellSchoolMask schoolMask, SpellInfo const* spellInfo /*= nullptr*/)

View File

@@ -1018,7 +1018,7 @@ class TC_GAME_API Unit : public WorldObject
DamageInfo* damageInfo, HealInfo* healInfo);
void TriggerAurasProcOnEvent(ProcEventInfo& eventInfo, AuraApplicationProcContainer& procAuras);
void HandleEmoteCommand(uint32 anim_id, Trinity::IteratorPair<int32 const*> spellVisualKitIds = {});
void HandleEmoteCommand(uint32 anim_id, Player* target = nullptr, Trinity::IteratorPair<int32 const*> spellVisualKitIds = {});
void AttackerStateUpdate (Unit* victim, WeaponAttackType attType = BASE_ATTACK, bool extra = false);
void FakeAttackerStateUpdate(Unit* victim, WeaponAttackType attType = BASE_ATTACK);

View File

@@ -615,7 +615,7 @@ void WorldSession::HandleTextEmoteOpcode(WorldPackets::Chat::CTextEmote& packet)
// Only allow text-emotes for "dead" entities (feign death included)
if (_player->HasUnitState(UNIT_STATE_DIED))
break;
_player->HandleEmoteCommand(emoteAnim, { packet.SpellVisualKitIDs.data(), packet.SpellVisualKitIDs.data() + packet.SpellVisualKitIDs.size() });
_player->HandleEmoteCommand(emoteAnim, nullptr, { packet.SpellVisualKitIDs.data(), packet.SpellVisualKitIDs.data() + packet.SpellVisualKitIDs.size() });
break;
}