mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-07-13 15:34:42 +00:00
prototype of weapon mold proof-of-concept in progress
This commit is contained in:
parent
87d2f256f1
commit
4bbf627770
1 changed files with 40 additions and 0 deletions
|
|
@ -6,6 +6,46 @@ import scodec.{Attempt, Codec, Err}
|
||||||
import scodec.codecs._
|
import scodec.codecs._
|
||||||
import shapeless._
|
import shapeless._
|
||||||
|
|
||||||
|
import scala.annotation.switch
|
||||||
|
|
||||||
|
case class Weapon(unk1 : Int,
|
||||||
|
magazine : Int,
|
||||||
|
unk2 : Int)
|
||||||
|
|
||||||
|
object Weapon extends Marshallable[Weapon] {
|
||||||
|
implicit val codec : Codec[Weapon] = (
|
||||||
|
("unk1" | uintL(23)) ::
|
||||||
|
("magazine" | uint8L) ::
|
||||||
|
("unk2" | uintL(13))
|
||||||
|
).as[Weapon]
|
||||||
|
}
|
||||||
|
|
||||||
|
case class Mold(objectClass : Int,
|
||||||
|
dataPortion : BitVector) {
|
||||||
|
|
||||||
|
private var obj : Option[Any] = Mold.selectMold(objectClass, dataPortion)
|
||||||
|
}
|
||||||
|
|
||||||
|
object Mold extends Marshallable[Mold] {
|
||||||
|
def apply(objectClass : Int,
|
||||||
|
obj : T forSome { type T }) : Mold =
|
||||||
|
new Mold(objectClass, bin"")
|
||||||
|
|
||||||
|
def selectMold(objClass : Int, data : BitVector) : Option[Any] = {
|
||||||
|
(objClass : @switch) match {
|
||||||
|
case 0x4D3 =>
|
||||||
|
Weapon.codec.decode(data).toOption
|
||||||
|
case _ =>
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
implicit val codec : Codec[Mold] = (
|
||||||
|
("objectClass" | uintL(11)) ::
|
||||||
|
("dataPortion" | bits)
|
||||||
|
).as[Mold]
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The parent information of a created object.<br>
|
* The parent information of a created object.<br>
|
||||||
* <br>
|
* <br>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue