From 1d9f57a385e96957b1313b0abaa7b73ce8c8d23e Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 15 Jun 2017 00:19:18 -0400 Subject: [PATCH] Cleaned up the emotes code. --- FFXIVClassic Map Server/actors/chara/player/Player.cs | 4 ++-- .../packets/send/Actor/ActorDoEmotePacket.cs | 10 ++++++---- data/scripts/commands/EmoteStandardCommand.lua | 11 ++++++----- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/FFXIVClassic Map Server/actors/chara/player/Player.cs b/FFXIVClassic Map Server/actors/chara/player/Player.cs index 06b7246a..3bc937ec 100644 --- a/FFXIVClassic Map Server/actors/chara/player/Player.cs +++ b/FFXIVClassic Map Server/actors/chara/player/Player.cs @@ -771,9 +771,9 @@ namespace FFXIVClassic_Map_Server.Actors return mountState; } - public void DoEmote(uint animId, uint descId) + public void DoEmote(uint targettedActor, uint animId, uint descId) { - BroadcastPacket(ActorDoEmotePacket.BuildPacket(actorId, actorId, currentTarget, animId, descId), true); + BroadcastPacket(ActorDoEmotePacket.BuildPacket(actorId, actorId, targettedActor, animId, descId), true); } public void SendGameMessage(Actor sourceActor, Actor textIdOwner, ushort textId, byte log, params object[] msgParams) diff --git a/FFXIVClassic Map Server/packets/send/Actor/ActorDoEmotePacket.cs b/FFXIVClassic Map Server/packets/send/Actor/ActorDoEmotePacket.cs index 0fb155f9..17767f3d 100644 --- a/FFXIVClassic Map Server/packets/send/Actor/ActorDoEmotePacket.cs +++ b/FFXIVClassic Map Server/packets/send/Actor/ActorDoEmotePacket.cs @@ -14,16 +14,18 @@ namespace FFXIVClassic_Map_Server.packets.send.actor { byte[] data = new byte[PACKET_SIZE - 0x20]; - if (targettedActorId == 0xC0000000) + if (targettedActorId == 0) + { targettedActorId = sourceActorId; + if (descriptionId != 10105) + descriptionId++; + } using (MemoryStream mem = new MemoryStream(data)) { using (BinaryWriter binWriter = new BinaryWriter(mem)) { - uint realAnimID = 0x5000000 | (animationId << 12); - if (descriptionId != 10105 && targettedActorId == sourceActorId) - descriptionId++; + uint realAnimID = 0x5000000 | (animationId << 12); binWriter.Write((UInt32)realAnimID); binWriter.Write((UInt32)targettedActorId); binWriter.Write((UInt32)descriptionId); diff --git a/data/scripts/commands/EmoteStandardCommand.lua b/data/scripts/commands/EmoteStandardCommand.lua index 18806e2a..b971598b 100644 --- a/data/scripts/commands/EmoteStandardCommand.lua +++ b/data/scripts/commands/EmoteStandardCommand.lua @@ -63,12 +63,16 @@ emoteTable = { }; -function onEventStarted(player, actor, triggerName, emoteId) +function onEventStarted(player, actor, triggerName, emoteId, unknownArg1, arg2, arg3, targetId) + + if (targetId == nil) then + targetId = 0; + end if (player:GetState() == 0) then emote = emoteTable[emoteId]; if (emote ~= nil) then - player:doEmote(emote.animId, emote.descId); + player:doEmote(targetId, emote.animId, emote.descId); else player:SendMessage(0x20, "", string.format("Not implemented; EmoteId: %d", emoteId)); end @@ -77,6 +81,3 @@ function onEventStarted(player, actor, triggerName, emoteId) player:EndEvent(); end - -function onEventUpdate(player, npc) -end \ No newline at end of file