mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-02-12 19:31:04 +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
4 changed files with 47 additions and 1 deletions
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue