mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-07-12 06:55:10 +00:00
Create EmoteType enum for EmoteMsg
There is one field (number 16) that appears to be unknown.
This commit is contained in:
parent
2070f77443
commit
4a4f0b4466
4 changed files with 43 additions and 8 deletions
|
|
@ -2,11 +2,12 @@
|
||||||
package net.psforever.packet.game
|
package net.psforever.packet.game
|
||||||
|
|
||||||
import net.psforever.packet.{GamePacketOpcode, Marshallable, PacketHelpers, PlanetSideGamePacket}
|
import net.psforever.packet.{GamePacketOpcode, Marshallable, PacketHelpers, PlanetSideGamePacket}
|
||||||
|
import net.psforever.types.EmoteType
|
||||||
import scodec.Codec
|
import scodec.Codec
|
||||||
import scodec.codecs._
|
import scodec.codecs._
|
||||||
|
|
||||||
final case class EmoteMsg(avatar_guid : PlanetSideGUID,
|
final case class EmoteMsg(avatar_guid : PlanetSideGUID,
|
||||||
emote_id : Int)
|
emote : EmoteType.Value)
|
||||||
extends PlanetSideGamePacket {
|
extends PlanetSideGamePacket {
|
||||||
type Packet = EmoteMsg
|
type Packet = EmoteMsg
|
||||||
def opcode = GamePacketOpcode.EmoteMsg
|
def opcode = GamePacketOpcode.EmoteMsg
|
||||||
|
|
@ -16,6 +17,6 @@ final case class EmoteMsg(avatar_guid : PlanetSideGUID,
|
||||||
object EmoteMsg extends Marshallable[EmoteMsg] {
|
object EmoteMsg extends Marshallable[EmoteMsg] {
|
||||||
implicit val codec : Codec[EmoteMsg] = (
|
implicit val codec : Codec[EmoteMsg] = (
|
||||||
("avatar_guid" | PlanetSideGUID.codec) ::
|
("avatar_guid" | PlanetSideGUID.codec) ::
|
||||||
("emote_id" | uint8L)
|
("emote" | EmoteType.codec)
|
||||||
).as[EmoteMsg]
|
).as[EmoteMsg]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
34
common/src/main/scala/net/psforever/types/EmoteType.scala
Normal file
34
common/src/main/scala/net/psforever/types/EmoteType.scala
Normal file
|
|
@ -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)
|
||||||
|
}
|
||||||
|
|
@ -266,20 +266,20 @@ class GamePacketTest extends Specification {
|
||||||
}
|
}
|
||||||
|
|
||||||
"EmoteMsg" should {
|
"EmoteMsg" should {
|
||||||
val string = hex"25 4B0004"
|
val string = hex"25 4B00 15"
|
||||||
|
|
||||||
"decode" in {
|
"decode" in {
|
||||||
PacketCoding.DecodePacket(string).require match {
|
PacketCoding.DecodePacket(string).require match {
|
||||||
case EmoteMsg(avatar_guid, emote_id) =>
|
case EmoteMsg(avatar_guid, emote) =>
|
||||||
avatar_guid mustEqual PlanetSideGUID(75)
|
avatar_guid mustEqual PlanetSideGUID(75)
|
||||||
emote_id mustEqual 4
|
emote mustEqual EmoteType.Thumbsdown
|
||||||
case default =>
|
case default =>
|
||||||
ko
|
ko
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"encode" in {
|
"encode" in {
|
||||||
val msg = EmoteMsg(PlanetSideGUID(75), 4)
|
val msg = EmoteMsg(PlanetSideGUID(75), EmoteType.Thumbsdown)
|
||||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||||
|
|
||||||
pkt mustEqual string
|
pkt mustEqual string
|
||||||
|
|
|
||||||
|
|
@ -163,9 +163,9 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
case msg @ ChangeFireStateMessage_Stop(item_guid) =>
|
case msg @ ChangeFireStateMessage_Stop(item_guid) =>
|
||||||
log.info("ChangeFireState_Stop: " + msg)
|
log.info("ChangeFireState_Stop: " + msg)
|
||||||
|
|
||||||
case msg @ EmoteMsg(avatar_guid, emote_id) =>
|
case msg @ EmoteMsg(avatar_guid, emote) =>
|
||||||
log.info("Emote: " + msg)
|
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) =>
|
case msg @ DropItemMessage(item_guid) =>
|
||||||
log.info("DropItem: " + msg)
|
log.info("DropItem: " + msg)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue