mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-04-28 23:35:23 +00:00
re-importing modified PlayerStateMessage packet from volatile branch
This commit is contained in:
parent
98c924a40a
commit
6af7b79c55
1 changed files with 43 additions and 13 deletions
|
|
@ -8,16 +8,46 @@ import scodec.Codec
|
||||||
import scodec.codecs._
|
import scodec.codecs._
|
||||||
import shapeless.{::, HNil}
|
import shapeless.{::, HNil}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* na
|
||||||
|
* @param guid the avatar's guid
|
||||||
|
* @param pos the position of the avatar in the world environment (in three coordinates)
|
||||||
|
* @param facingYaw the angle with respect to the horizon towards which the avatar is looking;
|
||||||
|
* every `0x01` is 5.625 degrees counter clockwise from North;
|
||||||
|
* every `0x10` is 90-degrees;
|
||||||
|
* it wraps to North every `0x40`
|
||||||
|
* @param facingPitch the angle with respect to the sky and the ground towards which the avatar is looking;
|
||||||
|
* every '0x01' is about 5.625 degrees;
|
||||||
|
* `0x00` to `0x10` are downwards-facing angles, with `0x00` as forwards-facing;
|
||||||
|
* nothing from `0x11` to `0x29`;
|
||||||
|
* `0x30` to `0x40` are upwards-facing angles, with `0x30` starting at full-up;
|
||||||
|
* starting at `0x40` == `0x00` this system repeats
|
||||||
|
* @param facingYawUpper the angle of the avatar's upper body with respect to its forward-facing direction;
|
||||||
|
* `0x00` to `0x10` are the avatar turning to its left, with `0x00` being forward-facing;
|
||||||
|
* nothing from `0x11` to `0x29`;
|
||||||
|
* `0x30` to `0x40` are the avatar turning to its right, with `0x40` being forward-facing;
|
||||||
|
* starting at `0x40` == `0x00` this system repeats
|
||||||
|
* @param unk4 na
|
||||||
|
* @param more activate parsing for the following four fields
|
||||||
|
* @param unk5 na
|
||||||
|
* @param isCrouching avatar is crouching;
|
||||||
|
* must remain flagged for crouch to maintain animation;
|
||||||
|
* turn off to stand up
|
||||||
|
* @param isJumping avatar is jumping;
|
||||||
|
* must remain flagged for jump to maintain animation;
|
||||||
|
* turn off when landed
|
||||||
|
* @param unk8 na
|
||||||
|
*/
|
||||||
final case class PlayerStateMessage(guid : PlanetSideGUID,
|
final case class PlayerStateMessage(guid : PlanetSideGUID,
|
||||||
pos : Vector3,
|
pos : Vector3,
|
||||||
unk1 : Int,
|
facingYaw : Int,
|
||||||
unk2 : Int,
|
facingPitch : Int,
|
||||||
unk3 : Int,
|
facingYawUpper : Int,
|
||||||
unk4 : Int,
|
unk4 : Int,
|
||||||
y : Boolean,
|
more : Boolean,
|
||||||
unk5 : Boolean = false,
|
unk5 : Boolean = false,
|
||||||
unk6 : Boolean = false,
|
isCrouching : Boolean = false,
|
||||||
unk7 : Boolean = false,
|
isJumping : Boolean = false,
|
||||||
unk8 : Boolean = false)
|
unk8 : Boolean = false)
|
||||||
extends PlanetSideGamePacket {
|
extends PlanetSideGamePacket {
|
||||||
type Packet = TimeOfDayMessage
|
type Packet = TimeOfDayMessage
|
||||||
|
|
@ -30,9 +60,9 @@ object PlayerStateMessage extends Marshallable[PlayerStateMessage] {
|
||||||
|
|
||||||
val booleanCodec : Codec[fourBoolPattern] = (
|
val booleanCodec : Codec[fourBoolPattern] = (
|
||||||
bool ::
|
bool ::
|
||||||
bool ::
|
bool ::
|
||||||
bool ::
|
bool ::
|
||||||
bool
|
bool
|
||||||
).as[fourBoolPattern]
|
).as[fourBoolPattern]
|
||||||
|
|
||||||
val defaultCodec : Codec[fourBoolPattern] = ignore(0).xmap[fourBoolPattern] (
|
val defaultCodec : Codec[fourBoolPattern] = ignore(0).xmap[fourBoolPattern] (
|
||||||
|
|
@ -49,11 +79,11 @@ object PlayerStateMessage extends Marshallable[PlayerStateMessage] {
|
||||||
implicit val codec : Codec[PlayerStateMessage] = (
|
implicit val codec : Codec[PlayerStateMessage] = (
|
||||||
("guid" | PlanetSideGUID.codec) ::
|
("guid" | PlanetSideGUID.codec) ::
|
||||||
("pos" | Vector3.codec_pos) ::
|
("pos" | Vector3.codec_pos) ::
|
||||||
("unk1" | uint8L) ::
|
("facingYaw" | uint8L) ::
|
||||||
("unk2" | uint8L) ::
|
("facingPitch" | uint8L) ::
|
||||||
("unk3" | uint8L) ::
|
("facingYawUpper" | uint8L) ::
|
||||||
("unk4" | uintL(10)) ::
|
("unk4" | uintL(10)) ::
|
||||||
("y" | bool >>:~ { test =>
|
("more" | bool >>:~ { test =>
|
||||||
ignore(0) ::
|
ignore(0) ::
|
||||||
newcodecs.binary_choice(test, booleanCodec, defaultCodec)
|
newcodecs.binary_choice(test, booleanCodec, defaultCodec)
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue