mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-01-19 18:44:45 +00:00
Packet: DismountBuildingMsg (#77)
* added DismountBuildingMsg packet and tests; comments are skimpy * rebased DismountBuildingMsg
This commit is contained in:
parent
0f50c8b15f
commit
6ada7c9a92
|
|
@ -465,7 +465,7 @@ object GamePacketOpcode extends Enumeration {
|
||||||
case 0x79 => noDecoder(TradeMessage)
|
case 0x79 => noDecoder(TradeMessage)
|
||||||
case 0x7a => noDecoder(UnknownMessage122)
|
case 0x7a => noDecoder(UnknownMessage122)
|
||||||
case 0x7b => noDecoder(DamageFeedbackMessage)
|
case 0x7b => noDecoder(DamageFeedbackMessage)
|
||||||
case 0x7c => noDecoder(DismountBuildingMsg)
|
case 0x7c => game.DismountBuildingMsg.decode
|
||||||
case 0x7d => noDecoder(UnknownMessage125)
|
case 0x7d => noDecoder(UnknownMessage125)
|
||||||
case 0x7e => noDecoder(UnknownMessage126)
|
case 0x7e => noDecoder(UnknownMessage126)
|
||||||
case 0x7f => noDecoder(AvatarStatisticsMessage)
|
case 0x7f => noDecoder(AvatarStatisticsMessage)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
// Copyright (c) 2016 PSForever.net to present
|
||||||
|
package net.psforever.packet.game
|
||||||
|
|
||||||
|
import net.psforever.packet.{GamePacketOpcode, Marshallable, PlanetSideGamePacket}
|
||||||
|
import scodec.Codec
|
||||||
|
import scodec.codecs._
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Alert that the player is "dismounting" a building.<br>
|
||||||
|
* <br>
|
||||||
|
* Paragraph in which "'dismounting' a building" is explained.
|
||||||
|
* @param player_guid the player
|
||||||
|
* @param building_guid the building
|
||||||
|
*/
|
||||||
|
final case class DismountBuildingMsg(player_guid : PlanetSideGUID,
|
||||||
|
building_guid : PlanetSideGUID)
|
||||||
|
extends PlanetSideGamePacket {
|
||||||
|
type Packet = DismountBuildingMsg
|
||||||
|
def opcode = GamePacketOpcode.DismountBuildingMsg
|
||||||
|
def encode = DismountBuildingMsg.encode(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
object DismountBuildingMsg extends Marshallable[DismountBuildingMsg] {
|
||||||
|
implicit val codec : Codec[DismountBuildingMsg] = (
|
||||||
|
("player_guid" | PlanetSideGUID.codec) ::
|
||||||
|
("building_guid" | PlanetSideGUID.codec)
|
||||||
|
).as[DismountBuildingMsg]
|
||||||
|
}
|
||||||
|
|
@ -1 +1,2 @@
|
||||||
// Copyright (c) 2016 PSForever.net to present
|
// Copyright (c) 2016 PSForever.net to present
|
||||||
|
|
||||||
|
|
|
||||||
28
common/src/test/scala/game/DismountBuildingMsgTest.scala
Normal file
28
common/src/test/scala/game/DismountBuildingMsgTest.scala
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
// Copyright (c) 2016 PSForever.net to present
|
||||||
|
package game
|
||||||
|
|
||||||
|
import org.specs2.mutable._
|
||||||
|
import net.psforever.packet._
|
||||||
|
import net.psforever.packet.game._
|
||||||
|
import scodec.bits._
|
||||||
|
|
||||||
|
class DismountBuildingMsgTest extends Specification {
|
||||||
|
val string = hex"7C 4B00 2E00"
|
||||||
|
|
||||||
|
"decode" in {
|
||||||
|
PacketCoding.DecodePacket(string).require match {
|
||||||
|
case DismountBuildingMsg(player_guid, building_guid) =>
|
||||||
|
player_guid mustEqual PlanetSideGUID(75)
|
||||||
|
building_guid mustEqual PlanetSideGUID(46)
|
||||||
|
case _ =>
|
||||||
|
ko
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
"encode" in {
|
||||||
|
val msg = DismountBuildingMsg(PlanetSideGUID(75), PlanetSideGUID(46))
|
||||||
|
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||||
|
|
||||||
|
pkt mustEqual string
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue