mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-03-05 13:10:20 +00:00
Merge branch 'master' into minor-updates
This commit is contained in:
commit
f87edd7057
23 changed files with 1474 additions and 42 deletions
30
common/src/test/scala/game/DelayedPathMountMsgTest.scala
Normal file
30
common/src/test/scala/game/DelayedPathMountMsgTest.scala
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
// Copyright (c) 2017 PSForever
|
||||
package game
|
||||
|
||||
import org.specs2.mutable._
|
||||
import net.psforever.packet._
|
||||
import net.psforever.packet.game._
|
||||
import scodec.bits._
|
||||
|
||||
class DelayedPathMountMsgTest extends Specification {
|
||||
val string = hex"5a f50583044680"
|
||||
|
||||
"decode" in {
|
||||
PacketCoding.DecodePacket(string).require match {
|
||||
case DelayedPathMountMsg(player_guid, vehicle_guid,u3,u4) =>
|
||||
player_guid mustEqual PlanetSideGUID(1525)
|
||||
vehicle_guid mustEqual PlanetSideGUID(1155)
|
||||
u3 mustEqual 70
|
||||
u4 mustEqual true
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
}
|
||||
|
||||
"encode" in {
|
||||
val msg = DelayedPathMountMsg(PlanetSideGUID(1525), PlanetSideGUID(1155),70,true)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string
|
||||
}
|
||||
}
|
||||
30
common/src/test/scala/game/DisplayedAwardMessageTest.scala
Normal file
30
common/src/test/scala/game/DisplayedAwardMessageTest.scala
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
// Copyright (c) 2017 PSForever
|
||||
package game
|
||||
|
||||
import net.psforever.types.MeritCommendation
|
||||
import org.specs2.mutable._
|
||||
import net.psforever.packet._
|
||||
import net.psforever.packet.game._
|
||||
import scodec.bits._
|
||||
|
||||
class DisplayedAwardMessageTest extends Specification {
|
||||
val string = hex"D1 9F06 A6010000 3 0"
|
||||
|
||||
"decode" in {
|
||||
PacketCoding.DecodePacket(string).require match {
|
||||
case DisplayedAwardMessage(player_guid, ribbon, bar) =>
|
||||
player_guid mustEqual PlanetSideGUID(1695)
|
||||
ribbon mustEqual MeritCommendation.TwoYearTR
|
||||
bar mustEqual RibbonBarsSlot.TermOfService
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
}
|
||||
|
||||
"encode" in {
|
||||
val msg = DisplayedAwardMessage(PlanetSideGUID(1695), MeritCommendation.TwoYearTR, RibbonBarsSlot.TermOfService)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string
|
||||
}
|
||||
}
|
||||
55
common/src/test/scala/game/FireHintMessageTest.scala
Normal file
55
common/src/test/scala/game/FireHintMessageTest.scala
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
// Copyright (c) 2017 PSForever
|
||||
package game
|
||||
|
||||
import org.specs2.mutable._
|
||||
import net.psforever.packet._
|
||||
import net.psforever.packet.game._
|
||||
import net.psforever.types.Vector3
|
||||
import scodec.bits._
|
||||
|
||||
class FireHintMessageTest extends Specification {
|
||||
val string = hex"a1 0117 23cd63f1d7480d 000077ff9d1d00"
|
||||
val string2 = hex"a1 080e 65af5705074411 0000cffee0fc7b08899f5580"
|
||||
|
||||
"decode" in {
|
||||
PacketCoding.DecodePacket(string).require match {
|
||||
case FireHintMessage(weapon_guid, pos, u1, u2, u3, u4, u5) =>
|
||||
weapon_guid mustEqual PlanetSideGUID(5889)
|
||||
pos mustEqual Vector3(3482.2734f,3642.4922f,53.125f)
|
||||
u1 mustEqual 0
|
||||
u2 mustEqual 65399
|
||||
u3 mustEqual 7581
|
||||
u4 mustEqual 0
|
||||
u5 mustEqual None
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
}
|
||||
"decode string2" in {
|
||||
PacketCoding.DecodePacket(string2).require match {
|
||||
case FireHintMessage(weapon_guid, pos, u1, u2, u3, u4, u5) =>
|
||||
weapon_guid mustEqual PlanetSideGUID(3592)
|
||||
pos mustEqual Vector3(2910.789f,3744.875f,69.0625f)
|
||||
u1 mustEqual 0
|
||||
u2 mustEqual 65231
|
||||
u3 mustEqual 64736
|
||||
u4 mustEqual 3
|
||||
u5 mustEqual Some(Vector3(21.5f,-6.8125f,2.65625f))
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
}
|
||||
|
||||
"encode" in {
|
||||
val msg = FireHintMessage(PlanetSideGUID(5889), Vector3(3482.2734f,3642.4922f,53.125f), 0, 65399, 7581, 0)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string
|
||||
}
|
||||
"encode string2" in {
|
||||
val msg = FireHintMessage(PlanetSideGUID(3592), Vector3(2910.789f,3744.875f,69.0625f), 0, 65231, 64736, 3, Some(Vector3(21.5f,-6.8125f,2.65625f)))
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string2
|
||||
}
|
||||
}
|
||||
|
|
@ -201,10 +201,10 @@ class ObjectCreateDetailedMessageTest extends Specification {
|
|||
char.appearance.is_cloaking mustEqual false
|
||||
char.appearance.charging_pose mustEqual false
|
||||
char.appearance.on_zipline mustEqual false
|
||||
char.appearance.ribbons.upper mustEqual 0xFFFFFFFFL //none
|
||||
char.appearance.ribbons.middle mustEqual 0xFFFFFFFFL //none
|
||||
char.appearance.ribbons.lower mustEqual 0xFFFFFFFFL //none
|
||||
char.appearance.ribbons.tos mustEqual 0xFFFFFFFFL //none
|
||||
char.appearance.ribbons.upper mustEqual MeritCommendation.None
|
||||
char.appearance.ribbons.middle mustEqual MeritCommendation.None
|
||||
char.appearance.ribbons.lower mustEqual MeritCommendation.None
|
||||
char.appearance.ribbons.tos mustEqual MeritCommendation.None
|
||||
char.healthMax mustEqual 100
|
||||
char.health mustEqual 100
|
||||
char.armor mustEqual 50 //standard exosuit value
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ package game
|
|||
import net.psforever.packet._
|
||||
import net.psforever.packet.game._
|
||||
import net.psforever.packet.game.objectcreate._
|
||||
import net.psforever.types.{CharacterGender, ExoSuitType, GrenadeState, PlanetSideEmpire, Vector3}
|
||||
import net.psforever.types._
|
||||
import org.specs2.mutable._
|
||||
import scodec.bits._
|
||||
|
||||
|
|
@ -684,10 +684,10 @@ class ObjectCreateMessageTest extends Specification {
|
|||
pc.appearance.is_cloaking mustEqual false
|
||||
pc.appearance.charging_pose mustEqual false
|
||||
pc.appearance.on_zipline mustEqual false
|
||||
pc.appearance.ribbons.upper mustEqual 276L
|
||||
pc.appearance.ribbons.middle mustEqual 239L
|
||||
pc.appearance.ribbons.lower mustEqual 397L
|
||||
pc.appearance.ribbons.tos mustEqual 360L
|
||||
pc.appearance.ribbons.upper mustEqual MeritCommendation.Loser4
|
||||
pc.appearance.ribbons.middle mustEqual MeritCommendation.HeavyInfantry3
|
||||
pc.appearance.ribbons.lower mustEqual MeritCommendation.TankBuster6
|
||||
pc.appearance.ribbons.tos mustEqual MeritCommendation.SixYearNC
|
||||
pc.health mustEqual 255
|
||||
pc.armor mustEqual 253
|
||||
pc.uniform_upgrade mustEqual UniformStyle.ThirdUpgrade
|
||||
|
|
@ -780,10 +780,10 @@ class ObjectCreateMessageTest extends Specification {
|
|||
pc.appearance.is_cloaking mustEqual false
|
||||
pc.appearance.charging_pose mustEqual false
|
||||
pc.appearance.on_zipline mustEqual false
|
||||
pc.appearance.ribbons.upper mustEqual 244L
|
||||
pc.appearance.ribbons.middle mustEqual 353L
|
||||
pc.appearance.ribbons.lower mustEqual 33L
|
||||
pc.appearance.ribbons.tos mustEqual 361L
|
||||
pc.appearance.ribbons.upper mustEqual MeritCommendation.Jacking
|
||||
pc.appearance.ribbons.middle mustEqual MeritCommendation.ScavengerTR6
|
||||
pc.appearance.ribbons.lower mustEqual MeritCommendation.AMSSupport4
|
||||
pc.appearance.ribbons.tos mustEqual MeritCommendation.SixYearTR
|
||||
pc.health mustEqual 0
|
||||
pc.armor mustEqual 0
|
||||
pc.uniform_upgrade mustEqual UniformStyle.ThirdUpgrade
|
||||
|
|
@ -1107,7 +1107,12 @@ class ObjectCreateMessageTest extends Specification {
|
|||
false,
|
||||
GrenadeState.None,
|
||||
false, false, false,
|
||||
RibbonBars(276L, 239L, 397L, 360L)
|
||||
RibbonBars(
|
||||
MeritCommendation.Loser4,
|
||||
MeritCommendation.HeavyInfantry3,
|
||||
MeritCommendation.TankBuster6,
|
||||
MeritCommendation.SixYearNC
|
||||
)
|
||||
),
|
||||
255, 253,
|
||||
UniformStyle.ThirdUpgrade,
|
||||
|
|
@ -1159,7 +1164,12 @@ class ObjectCreateMessageTest extends Specification {
|
|||
false,
|
||||
GrenadeState.None,
|
||||
false, false, false,
|
||||
RibbonBars(244L, 353L, 33L, 361L)
|
||||
RibbonBars(
|
||||
MeritCommendation.Jacking,
|
||||
MeritCommendation.ScavengerTR6,
|
||||
MeritCommendation.AMSSupport4,
|
||||
MeritCommendation.SixYearTR
|
||||
)
|
||||
),
|
||||
0, 0,
|
||||
UniformStyle.ThirdUpgrade,
|
||||
|
|
|
|||
53
common/src/test/scala/game/OxygenStateMessageTest.scala
Normal file
53
common/src/test/scala/game/OxygenStateMessageTest.scala
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
// Copyright (c) 2017 PSForever
|
||||
package game
|
||||
|
||||
import org.specs2.mutable._
|
||||
import net.psforever.packet._
|
||||
import net.psforever.packet.game._
|
||||
import scodec.bits._
|
||||
|
||||
class OxygenStateMessageTest extends Specification {
|
||||
val string_self = hex"78 4b00f430"
|
||||
val string_vehicle = hex"78 4b00f4385037a180"
|
||||
|
||||
"decode (self)" in {
|
||||
PacketCoding.DecodePacket(string_self).require match {
|
||||
case OxygenStateMessage(guid, progress, active, veh_state) =>
|
||||
guid mustEqual PlanetSideGUID(75)
|
||||
progress mustEqual 50.0
|
||||
active mustEqual true
|
||||
veh_state.isDefined mustEqual false
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
}
|
||||
|
||||
"decode (vehicle)" in {
|
||||
PacketCoding.DecodePacket(string_vehicle).require match {
|
||||
case OxygenStateMessage(guid, progress, active, veh_state) =>
|
||||
guid mustEqual PlanetSideGUID(75)
|
||||
progress mustEqual 50.0f
|
||||
active mustEqual true
|
||||
veh_state.isDefined mustEqual true
|
||||
veh_state.get.vehicle_guid mustEqual PlanetSideGUID(1546)
|
||||
veh_state.get.progress mustEqual 50.0f
|
||||
veh_state.get.active mustEqual true
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
}
|
||||
|
||||
"encode (self)" in {
|
||||
val msg = OxygenStateMessage(PlanetSideGUID(75), 50.0f, true)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_self
|
||||
}
|
||||
|
||||
"encode (vehicle)" in {
|
||||
val msg = OxygenStateMessage(PlanetSideGUID(75), 50.0f, true, WaterloggedVehicleState(PlanetSideGUID(1546), 50.0f, true))
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_vehicle
|
||||
}
|
||||
}
|
||||
44
common/src/test/scala/game/ProjectileStateMessageTest.scala
Normal file
44
common/src/test/scala/game/ProjectileStateMessageTest.scala
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
// Copyright (c) 2017 PSForever
|
||||
package game
|
||||
|
||||
import org.specs2.mutable._
|
||||
import net.psforever.packet._
|
||||
import net.psforever.packet.game._
|
||||
import net.psforever.types.Vector3
|
||||
import scodec.bits._
|
||||
|
||||
class ProjectileStateMessageTest extends Specification {
|
||||
val string = hex"3f 259d c5019 30e4a 9514 c52c9541 d9ba05c2 c5973941 00 f8 ec 020000"
|
||||
|
||||
"decode" in {
|
||||
PacketCoding.DecodePacket(string).require match {
|
||||
case ProjectileStateMessage(projectile, pos, vel, unk1, unk2, unk3, unk4, time_alive) =>
|
||||
projectile mustEqual PlanetSideGUID(40229)
|
||||
pos.x mustEqual 4611.539f
|
||||
pos.y mustEqual 5576.375f
|
||||
pos.z mustEqual 82.328125f
|
||||
vel.x mustEqual 18.64686f
|
||||
vel.y mustEqual -33.43247f
|
||||
vel.z mustEqual 11.599553f
|
||||
unk1 mustEqual 0
|
||||
unk2 mustEqual 248
|
||||
unk3 mustEqual 236
|
||||
unk4 mustEqual false
|
||||
time_alive mustEqual 4
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
}
|
||||
|
||||
"encode" in {
|
||||
val msg = ProjectileStateMessage(
|
||||
PlanetSideGUID(40229),
|
||||
Vector3(4611.539f, 5576.375f, 82.328125f),
|
||||
Vector3(18.64686f, -33.43247f, 11.599553f),
|
||||
0, 248, 236, false, 4
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string
|
||||
}
|
||||
}
|
||||
116
common/src/test/scala/game/TargetingImplantRequestTest.scala
Normal file
116
common/src/test/scala/game/TargetingImplantRequestTest.scala
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
// Copyright (c) 2017 PSForever
|
||||
package game
|
||||
|
||||
import org.specs2.mutable._
|
||||
import net.psforever.packet._
|
||||
import net.psforever.packet.game._
|
||||
import scodec.bits._
|
||||
|
||||
class TargetingImplantRequestTest extends Specification {
|
||||
val string_single = hex"b5 061016"
|
||||
val string_long = hex"b5 41edeb12d4409f0144053f8010541ba91d03df376831b1e26000611041e1107c0209c0"//0510085013d9ffb6720d5b132900003770?
|
||||
|
||||
"decode (single)" in {
|
||||
PacketCoding.DecodePacket(string_single).require match {
|
||||
case TargetingImplantRequest(target_list) =>
|
||||
target_list.length mustEqual 1
|
||||
//0
|
||||
target_list.head.target_guid mustEqual PlanetSideGUID(1412)
|
||||
target_list.head.unk mustEqual true
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
}
|
||||
|
||||
"decode (long)" in {
|
||||
PacketCoding.DecodePacket(string_long).require match {
|
||||
case TargetingImplantRequest(target_list) =>
|
||||
target_list.length mustEqual 16
|
||||
//0
|
||||
target_list.head.target_guid mustEqual PlanetSideGUID(31355)
|
||||
target_list.head.unk mustEqual true
|
||||
//1
|
||||
target_list(1).target_guid mustEqual PlanetSideGUID(27273)
|
||||
target_list(1).unk mustEqual false
|
||||
//2
|
||||
target_list(2).target_guid mustEqual PlanetSideGUID(40768)
|
||||
target_list(2).unk mustEqual false
|
||||
//3
|
||||
target_list(3).target_guid mustEqual PlanetSideGUID(34818)
|
||||
target_list(3).unk mustEqual false
|
||||
//4
|
||||
target_list(4).target_guid mustEqual PlanetSideGUID(65044)
|
||||
target_list(4).unk mustEqual false
|
||||
//5
|
||||
target_list(5).target_guid mustEqual PlanetSideGUID(33280)
|
||||
target_list(5).unk mustEqual true
|
||||
//6
|
||||
target_list(6).target_guid mustEqual PlanetSideGUID(47681)
|
||||
target_list(6).unk mustEqual true
|
||||
//7
|
||||
target_list(7).target_guid mustEqual PlanetSideGUID(40995)
|
||||
target_list(7).unk mustEqual false
|
||||
//8
|
||||
target_list(8).target_guid mustEqual PlanetSideGUID(52727)
|
||||
target_list(8).unk mustEqual true
|
||||
//9
|
||||
target_list(9).target_guid mustEqual PlanetSideGUID(6324)
|
||||
target_list(9).unk mustEqual true
|
||||
//10
|
||||
target_list(10).target_guid mustEqual PlanetSideGUID(58033)
|
||||
target_list(10).unk mustEqual false
|
||||
//11
|
||||
target_list(11).target_guid mustEqual PlanetSideGUID(192)
|
||||
target_list(11).unk mustEqual true
|
||||
//12
|
||||
target_list(12).target_guid mustEqual PlanetSideGUID(16772)
|
||||
target_list(12).unk mustEqual false
|
||||
//13
|
||||
target_list(13).target_guid mustEqual PlanetSideGUID(2063)
|
||||
target_list(13).unk mustEqual true
|
||||
//14
|
||||
target_list(14).target_guid mustEqual PlanetSideGUID(49159)
|
||||
target_list(14).unk mustEqual false
|
||||
//15
|
||||
target_list(15).target_guid mustEqual PlanetSideGUID(14401)
|
||||
target_list(15).unk mustEqual false
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
}
|
||||
|
||||
"encode (single)" in {
|
||||
val msg = TargetingImplantRequest(
|
||||
TargetRequest(PlanetSideGUID(1412), true) ::
|
||||
Nil
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_single
|
||||
}
|
||||
|
||||
"encode (long)" in {
|
||||
val msg = TargetingImplantRequest(
|
||||
TargetRequest(PlanetSideGUID(31355), true) ::
|
||||
TargetRequest(PlanetSideGUID(27273), false) ::
|
||||
TargetRequest(PlanetSideGUID(40768), false) ::
|
||||
TargetRequest(PlanetSideGUID(34818), false) ::
|
||||
TargetRequest(PlanetSideGUID(65044), false) ::
|
||||
TargetRequest(PlanetSideGUID(33280), true) ::
|
||||
TargetRequest(PlanetSideGUID(47681), true) ::
|
||||
TargetRequest(PlanetSideGUID(40995), false) ::
|
||||
TargetRequest(PlanetSideGUID(52727), true) ::
|
||||
TargetRequest(PlanetSideGUID(6324), true) ::
|
||||
TargetRequest(PlanetSideGUID(58033), false) ::
|
||||
TargetRequest(PlanetSideGUID(192), true) ::
|
||||
TargetRequest(PlanetSideGUID(16772), false) ::
|
||||
TargetRequest(PlanetSideGUID(2063), true) ::
|
||||
TargetRequest(PlanetSideGUID(49159), false) ::
|
||||
TargetRequest(PlanetSideGUID(14401), false) ::
|
||||
Nil
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_long
|
||||
}
|
||||
}
|
||||
73
common/src/test/scala/game/TriggerEffectMessageTest.scala
Normal file
73
common/src/test/scala/game/TriggerEffectMessageTest.scala
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
// Copyright (c) 2017 PSForever
|
||||
package game
|
||||
|
||||
import org.specs2.mutable._
|
||||
import net.psforever.packet._
|
||||
import net.psforever.packet.game._
|
||||
import net.psforever.types.Vector3
|
||||
import scodec.bits._
|
||||
|
||||
class TriggerEffectMessageTest extends Specification {
|
||||
val string_motionalarmsensor = hex"51 970B 82 6F6E FA00C00000"
|
||||
val string_boomer = hex"51 0000 93 737061776E5F6F626A6563745F656666656374 417BB2CB3B4F8E00000000"
|
||||
|
||||
"decode (motion alarm sensor)" in {
|
||||
PacketCoding.DecodePacket(string_motionalarmsensor).require match {
|
||||
case TriggerEffectMessage(guid, effect, unk, location) =>
|
||||
guid mustEqual PlanetSideGUID(2967)
|
||||
effect mustEqual "on"
|
||||
unk.isDefined mustEqual true
|
||||
unk.get.unk1 mustEqual true
|
||||
unk.get.unk2 mustEqual 1000L
|
||||
location.isDefined mustEqual false
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
}
|
||||
|
||||
"decode (boomer)" in {
|
||||
PacketCoding.DecodePacket(string_boomer).require match {
|
||||
case TriggerEffectMessage(guid, effect, unk, location) =>
|
||||
guid mustEqual PlanetSideGUID(0)
|
||||
effect mustEqual "spawn_object_effect"
|
||||
unk.isDefined mustEqual false
|
||||
location.isDefined mustEqual true
|
||||
location.get.pos.x mustEqual 3567.0156f
|
||||
location.get.pos.y mustEqual 3278.6953f
|
||||
location.get.pos.z mustEqual 114.484375f
|
||||
location.get.roll mustEqual 0
|
||||
location.get.pitch mustEqual 0
|
||||
location.get.yaw mustEqual 0
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
}
|
||||
|
||||
"encode (motion alarm sensor)" in {
|
||||
val msg = TriggerEffectMessage(
|
||||
PlanetSideGUID(2967),
|
||||
"on",
|
||||
Some(TriggeredEffect(true, 1000L)),
|
||||
None
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_motionalarmsensor
|
||||
}
|
||||
|
||||
"encode (boomer)" in {
|
||||
val msg = TriggerEffectMessage(
|
||||
PlanetSideGUID(0),
|
||||
"spawn_object_effect",
|
||||
None,
|
||||
Some(TriggeredEffectLocation(
|
||||
Vector3(3567.0156f, 3278.6953f, 114.484375f),
|
||||
0, 0, 0
|
||||
))
|
||||
)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string_boomer
|
||||
}
|
||||
}
|
||||
|
||||
28
common/src/test/scala/game/UnuseItemMessageTest.scala
Normal file
28
common/src/test/scala/game/UnuseItemMessageTest.scala
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
// Copyright (c) 2017 PSForever
|
||||
package game
|
||||
|
||||
import org.specs2.mutable._
|
||||
import net.psforever.packet._
|
||||
import net.psforever.packet.game._
|
||||
import scodec.bits._
|
||||
|
||||
class UnuseItemMessageTest extends Specification {
|
||||
val string = hex"26 4B00 340D"
|
||||
|
||||
"decode" in {
|
||||
PacketCoding.DecodePacket(string).require match {
|
||||
case UnuseItemMessage(player, item) =>
|
||||
player mustEqual PlanetSideGUID(75)
|
||||
item mustEqual PlanetSideGUID(3380)
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
}
|
||||
|
||||
"encode" in {
|
||||
val msg = UnuseItemMessage(PlanetSideGUID(75), PlanetSideGUID(3380))
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
|
||||
pkt mustEqual string
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue