mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-01-19 18:44:45 +00:00
Packet: EmoteMsg
Still need an Enum for emote messages. * Add EmoteMsg packet * Add EmoteMsg test * Add EmoteMsg handler stub
This commit is contained in:
parent
4c4f1341be
commit
3e980bbe15
|
|
@ -362,7 +362,7 @@ object GamePacketOpcode extends Enumeration {
|
|||
case ActionCancelMessage => noDecoder(opcode)
|
||||
case ActionCancelAcknowledgeMessage => noDecoder(opcode)
|
||||
case SetEmpireMessage => noDecoder(opcode)
|
||||
case EmoteMsg => noDecoder(opcode)
|
||||
case EmoteMsg => game.EmoteMsg.decode
|
||||
case UnuseItemMessage => noDecoder(opcode)
|
||||
case ObjectDetachMessage => noDecoder(opcode)
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (c) 2016 PSForever.net to present
|
||||
package net.psforever.packet.game
|
||||
|
||||
import net.psforever.packet.{GamePacketOpcode, Marshallable, PacketHelpers, PlanetSideGamePacket}
|
||||
import scodec.Codec
|
||||
import scodec.codecs._
|
||||
|
||||
final case class EmoteMsg(avatar_guid : PlanetSideGUID,
|
||||
emote_id : Int)
|
||||
extends PlanetSideGamePacket {
|
||||
type Packet = EmoteMsg
|
||||
def opcode = GamePacketOpcode.EmoteMsg
|
||||
def encode = EmoteMsg.encode(this)
|
||||
}
|
||||
|
||||
object EmoteMsg extends Marshallable[EmoteMsg] {
|
||||
implicit val codec : Codec[EmoteMsg] = (
|
||||
("avatar_guid" | PlanetSideGUID.codec) ::
|
||||
("emote_id" | uint8L)
|
||||
).as[EmoteMsg]
|
||||
}
|
||||
|
|
@ -264,5 +264,26 @@ class GamePacketTest extends Specification {
|
|||
pkt mustEqual string
|
||||
}
|
||||
}
|
||||
|
||||
"EmoteMsg" should {
|
||||
val string = hex"25 4B0004"
|
||||
|
||||
"decode" in {
|
||||
PacketCoding.DecodePacket(string).require match {
|
||||
case EmoteMsg(avatar_guid, emote_id) =>
|
||||
avatar_guid mustEqual PlanetSideGUID(75)
|
||||
emote_id mustEqual 4
|
||||
case default =>
|
||||
ko
|
||||
}
|
||||
}
|
||||
|
||||
"encode" in {
|
||||
val msg = EmoteMsg(PlanetSideGUID(75), 4)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -163,6 +163,10 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
|||
case msg @ ChangeFireStateMessage_Stop(item_guid) =>
|
||||
log.info("ChangeFireState_Stop: " + msg)
|
||||
|
||||
case msg @ EmoteMsg(avatar_guid, emote_id) =>
|
||||
log.info("Emote: " + msg)
|
||||
sendResponse(PacketCoding.CreateGamePacket(0, EmoteMsg(avatar_guid, emote_id)))
|
||||
|
||||
case default => log.debug(s"Unhandled GamePacket ${pkt}")
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue