mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-03-06 13:40:21 +00:00
changing continent id to normal data type in HotSpotUpdate; implementing token logic for HotSpotUpdate in WSA; updating tests
This commit is contained in:
parent
4973e8df29
commit
2526f15406
3 changed files with 49 additions and 32 deletions
|
|
@ -4,17 +4,19 @@ package game
|
|||
import org.specs2.mutable._
|
||||
import net.psforever.packet._
|
||||
import net.psforever.packet.game._
|
||||
import net.psforever.types.Vector3
|
||||
import scodec.bits._
|
||||
|
||||
class HotSpotUpdateMessageTest extends Specification {
|
||||
val stringClear = hex"9F 0500 1 00 0"
|
||||
val stringOne = hex"9F 0500 1 01 0 00 2E9 00 145 80000 0"
|
||||
val stringTwo = hex"9F 0500 5 02 0 00 D07 00 8CA 80000 00 BEA 00 4C4 80000"
|
||||
val stringClear = hex"9F 0500 1 000"
|
||||
val stringOne = hex"9F 0500 1 010 002E9 00145 80000 0"
|
||||
val stringTwo = hex"9F 0500 5 020 00D07 008CA 80000 00BEA 004C4 80000"
|
||||
val stringThree = hex"9F 0A00 4 030 00FC8 00F0A 80000 002E9 00BEA 80000 00FC8 00BEA 80000 0"
|
||||
|
||||
"decode (clear)" in {
|
||||
PacketCoding.DecodePacket(stringClear).require match {
|
||||
case HotSpotUpdateMessage(continent_guid, unk, spots) =>
|
||||
continent_guid mustEqual PlanetSideGUID(5)
|
||||
case HotSpotUpdateMessage(continent_id, unk, spots) =>
|
||||
continent_id mustEqual 5
|
||||
unk mustEqual 1
|
||||
spots.size mustEqual 0
|
||||
case _ =>
|
||||
|
|
@ -24,13 +26,11 @@ class HotSpotUpdateMessageTest extends Specification {
|
|||
|
||||
"decode (one)" in {
|
||||
PacketCoding.DecodePacket(stringOne).require match {
|
||||
case HotSpotUpdateMessage(continent_guid, unk, spots) =>
|
||||
continent_guid mustEqual PlanetSideGUID(5)
|
||||
case HotSpotUpdateMessage(continent_id, unk, spots) =>
|
||||
continent_id mustEqual 5
|
||||
unk mustEqual 1
|
||||
spots.size mustEqual 1
|
||||
spots.head.x mustEqual 4700.0f
|
||||
spots.head.y mustEqual 2600.0f
|
||||
spots.head.scale mustEqual 64.0f
|
||||
spots.head mustEqual HotSpotInfo(4700.0f, 2600.0f, 64.0f)
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
|
|
@ -38,36 +38,52 @@ class HotSpotUpdateMessageTest extends Specification {
|
|||
|
||||
"decode (two)" in {
|
||||
PacketCoding.DecodePacket(stringTwo).require match {
|
||||
case HotSpotUpdateMessage(continent_guid, unk, spots) =>
|
||||
continent_guid mustEqual PlanetSideGUID(5)
|
||||
case HotSpotUpdateMessage(continent_id, unk, spots) =>
|
||||
continent_id mustEqual 5
|
||||
unk mustEqual 5
|
||||
spots.size mustEqual 2
|
||||
spots.head.x mustEqual 4000.0f
|
||||
spots.head.y mustEqual 5400.0f
|
||||
spots.head.scale mustEqual 64.0f
|
||||
spots(1).x mustEqual 5500.0f
|
||||
spots(1).y mustEqual 2200.0f
|
||||
spots(1).scale mustEqual 64.0f
|
||||
spots.head mustEqual HotSpotInfo(4000.0f, 5400.0f, 64.0f)
|
||||
spots(1) mustEqual HotSpotInfo(5500.0f, 2200.0f, 64.0f)
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
}
|
||||
|
||||
"decode (three)" in {
|
||||
PacketCoding.DecodePacket(stringThree).require match {
|
||||
case HotSpotUpdateMessage(continent_id, unk, spots) =>
|
||||
continent_id mustEqual 10
|
||||
unk mustEqual 4
|
||||
spots.size mustEqual 3
|
||||
spots.head mustEqual HotSpotInfo(4600.0f, 5600.0f, 64.0f)
|
||||
spots(1) mustEqual HotSpotInfo(4700.0f, 5500.0f, 64.0f)
|
||||
spots(2) mustEqual HotSpotInfo(4600.0f, 5500.0f, 64.0f)
|
||||
case _ =>
|
||||
ko
|
||||
}
|
||||
}
|
||||
|
||||
"encode (clear)" in {
|
||||
val msg = HotSpotUpdateMessage(PlanetSideGUID(5),1)
|
||||
val msg = HotSpotUpdateMessage(5,1, Nil)
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual stringClear
|
||||
}
|
||||
|
||||
"encode (one)" in {
|
||||
val msg = HotSpotUpdateMessage(PlanetSideGUID(5),1, HotSpotInfo(4700.0f, 2600.0f, 64.0f)::Nil)
|
||||
val msg = HotSpotUpdateMessage(5,1, List(HotSpotInfo(4700.0f, 2600.0f, 64.0f)))
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual stringOne
|
||||
}
|
||||
|
||||
"encode (two)" in {
|
||||
val msg = HotSpotUpdateMessage(PlanetSideGUID(5),5, HotSpotInfo(4000.0f, 5400.0f, 64.0f)::HotSpotInfo(5500.0f, 2200.0f, 64.0f)::Nil)
|
||||
val msg = HotSpotUpdateMessage(5,5, List(HotSpotInfo(4000.0f, 5400.0f, 64.0f), HotSpotInfo(5500.0f, 2200.0f, 64.0f)))
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual stringTwo
|
||||
}
|
||||
|
||||
"encode (three)" in {
|
||||
val msg = HotSpotUpdateMessage(10,4, List(HotSpotInfo(4600.0f, 5600.0f, 64.0f), HotSpotInfo(4700.0f, 5500.0f, 64.0f), HotSpotInfo(4600.0f, 5500.0f, 64.0f)))
|
||||
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||
pkt mustEqual stringThree
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue