mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-01-20 10:34:44 +00:00
added DetailedLockerContainerData Codec; modified PacketConverter for LockerContainer; modified tests (2)
This commit is contained in:
parent
110dcdf675
commit
a73e2f129c
|
|
@ -15,7 +15,8 @@ class LockerContainerConverter extends ObjectCreateConverter[LockerContainer]()
|
|||
}
|
||||
|
||||
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>
|
||||
* <br>
|
||||
* 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 {
|
||||
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 {
|
||||
"convert to packet" in {
|
||||
val hellfire_ammo = AmmoBoxDefinition(Ammo.hellfire_ammo.id)
|
||||
|
|
|
|||
Loading…
Reference in a new issue