diff --git a/common/src/main/scala/net/psforever/packet/game/EmoteMsg.scala b/common/src/main/scala/net/psforever/packet/game/EmoteMsg.scala index 4b457c08..bca9ca1c 100644 --- a/common/src/main/scala/net/psforever/packet/game/EmoteMsg.scala +++ b/common/src/main/scala/net/psforever/packet/game/EmoteMsg.scala @@ -2,11 +2,12 @@ package net.psforever.packet.game import net.psforever.packet.{GamePacketOpcode, Marshallable, PacketHelpers, PlanetSideGamePacket} +import net.psforever.types.EmoteType import scodec.Codec import scodec.codecs._ final case class EmoteMsg(avatar_guid : PlanetSideGUID, - emote_id : Int) + emote : EmoteType.Value) extends PlanetSideGamePacket { type Packet = EmoteMsg def opcode = GamePacketOpcode.EmoteMsg @@ -16,6 +17,6 @@ final case class EmoteMsg(avatar_guid : PlanetSideGUID, object EmoteMsg extends Marshallable[EmoteMsg] { implicit val codec : Codec[EmoteMsg] = ( ("avatar_guid" | PlanetSideGUID.codec) :: - ("emote_id" | uint8L) + ("emote" | EmoteType.codec) ).as[EmoteMsg] } diff --git a/common/src/main/scala/net/psforever/types/EmoteType.scala b/common/src/main/scala/net/psforever/types/EmoteType.scala new file mode 100644 index 00000000..08e4cc83 --- /dev/null +++ b/common/src/main/scala/net/psforever/types/EmoteType.scala @@ -0,0 +1,34 @@ +// Copyright (c) 2016 PSForever.net to present +package net.psforever.types + +import net.psforever.packet.PacketHelpers +import scodec.codecs._ + +object EmoteType extends Enumeration { + type Type = Value + val Charge, + Halt, + Nod, + Stinky, + Wave, + Bow, + CabbagePatch, + Cheer, + ChestThump, + Choking, + Dunno, + Fistup, + Followme, + Help, + Laugh, + Move, + No, // TODO: Double check this one, doesn't seem to have an associated slash command + Roundup, + Salute, + Sorry, + Spreadout, + Thumbsdown + = Value + + implicit val codec = PacketHelpers.createEnumerationCodec(this, uint8L) +} diff --git a/common/src/test/scala/GamePacketTest.scala b/common/src/test/scala/GamePacketTest.scala index f8dd850d..4549ffa3 100644 --- a/common/src/test/scala/GamePacketTest.scala +++ b/common/src/test/scala/GamePacketTest.scala @@ -266,20 +266,20 @@ class GamePacketTest extends Specification { } "EmoteMsg" should { - val string = hex"25 4B0004" + val string = hex"25 4B00 15" "decode" in { PacketCoding.DecodePacket(string).require match { - case EmoteMsg(avatar_guid, emote_id) => + case EmoteMsg(avatar_guid, emote) => avatar_guid mustEqual PlanetSideGUID(75) - emote_id mustEqual 4 + emote mustEqual EmoteType.Thumbsdown case default => ko } } "encode" in { - val msg = EmoteMsg(PlanetSideGUID(75), 4) + val msg = EmoteMsg(PlanetSideGUID(75), EmoteType.Thumbsdown) val pkt = PacketCoding.EncodePacket(msg).require.toByteVector pkt mustEqual string diff --git a/pslogin/src/main/scala/WorldSessionActor.scala b/pslogin/src/main/scala/WorldSessionActor.scala index 88efaa42..e5daab5a 100644 --- a/pslogin/src/main/scala/WorldSessionActor.scala +++ b/pslogin/src/main/scala/WorldSessionActor.scala @@ -163,9 +163,9 @@ class WorldSessionActor extends Actor with MDCContextAware { case msg @ ChangeFireStateMessage_Stop(item_guid) => log.info("ChangeFireState_Stop: " + msg) - case msg @ EmoteMsg(avatar_guid, emote_id) => + case msg @ EmoteMsg(avatar_guid, emote) => log.info("Emote: " + msg) - sendResponse(PacketCoding.CreateGamePacket(0, EmoteMsg(avatar_guid, emote_id))) + sendResponse(PacketCoding.CreateGamePacket(0, EmoteMsg(avatar_guid, emote))) case msg @ DropItemMessage(item_guid) => log.info("DropItem: " + msg)