mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-03-28 00:09:13 +00:00
added DetailedLockerContainerData Codec; modified PacketConverter for LockerContainer; modified tests (2)
This commit is contained in:
parent
110dcdf675
commit
a73e2f129c
3 changed files with 21 additions and 2 deletions
|
|
@ -15,7 +15,8 @@ class LockerContainerConverter extends ObjectCreateConverter[LockerContainer]()
|
||||||
}
|
}
|
||||||
|
|
||||||
override def DetailedConstructorData(obj : LockerContainer) : Try[DetailedLockerContainerData] = {
|
override def DetailedConstructorData(obj : LockerContainer) : Try[DetailedLockerContainerData] = {
|
||||||
Success(DetailedLockerContainerData(8))
|
val contents : Option[List[InternalSlot]] = if(obj.Inventory.Size > 0) { Some(MakeInventory(obj.Inventory)) } else { None }
|
||||||
|
Success(DetailedLockerContainerData(8, contents))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import shapeless.{::, HNil}
|
||||||
* A representation for a game object that can contain items.<br>
|
* A representation for a game object that can contain items.<br>
|
||||||
* <br>
|
* <br>
|
||||||
* For whatever reason, these "lockers" are typically placed at the origin coordinates.
|
* For whatever reason, these "lockers" are typically placed at the origin coordinates.
|
||||||
* @param inventory the items inside his locker
|
* @param inventory the items inside this locker
|
||||||
*/
|
*/
|
||||||
final case class LockerContainerData(inventory : InventoryData) extends ConstructorData {
|
final case class LockerContainerData(inventory : InventoryData) extends ConstructorData {
|
||||||
override def bitsize : Long = 105L + inventory.bitsize //81u + 2u + 21u + 1u
|
override def bitsize : Long = 105L + inventory.bitsize //81u + 2u + 21u + 1u
|
||||||
|
|
|
||||||
|
|
@ -162,6 +162,24 @@ class ConverterTest extends Specification {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"LockerContainer" should {
|
||||||
|
"convert to packet" in {
|
||||||
|
val obj = LockerContainer()
|
||||||
|
obj.Definition.Packet.DetailedConstructorData(obj) match {
|
||||||
|
case Success(pkt) =>
|
||||||
|
pkt mustEqual DetailedLockerContainerData(8)
|
||||||
|
case _ =>
|
||||||
|
ko
|
||||||
|
}
|
||||||
|
obj.Definition.Packet.ConstructorData(obj) match {
|
||||||
|
case Success(pkt) =>
|
||||||
|
pkt mustEqual LockerContainerData(InventoryData(List.empty))
|
||||||
|
case _ =>
|
||||||
|
ko
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
"Vehicle" should {
|
"Vehicle" should {
|
||||||
"convert to packet" in {
|
"convert to packet" in {
|
||||||
val hellfire_ammo = AmmoBoxDefinition(Ammo.hellfire_ammo.id)
|
val hellfire_ammo = AmmoBoxDefinition(Ammo.hellfire_ammo.id)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue