mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-07-15 16:34:39 +00:00
Packet: ArmorChangedPacket (#66)
* added packet and opcode listing; working on known functional values * armor values in comments, and packet test * splitting armor parameter into two parameters
This commit is contained in:
parent
88b6974edc
commit
b417ef081f
3 changed files with 69 additions and 1 deletions
|
|
@ -391,7 +391,7 @@ object GamePacketOpcode extends Enumeration {
|
||||||
case 0x3b => noDecoder(UnknownMessage59)
|
case 0x3b => noDecoder(UnknownMessage59)
|
||||||
case 0x3c => noDecoder(GenericCollisionMsg)
|
case 0x3c => noDecoder(GenericCollisionMsg)
|
||||||
case 0x3d => game.QuantityUpdateMessage.decode
|
case 0x3d => game.QuantityUpdateMessage.decode
|
||||||
case 0x3e => noDecoder(ArmorChangedMessage)
|
case 0x3e => game.ArmorChangedMessage.decode
|
||||||
case 0x3f => noDecoder(ProjectileStateMessage)
|
case 0x3f => noDecoder(ProjectileStateMessage)
|
||||||
|
|
||||||
// OPCODES 0x40-4f
|
// OPCODES 0x40-4f
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
// Copyright (c) 2016 PSForever.net to present
|
||||||
|
package net.psforever.packet.game
|
||||||
|
|
||||||
|
import net.psforever.packet.{GamePacketOpcode, Marshallable, PlanetSideGamePacket}
|
||||||
|
import scodec.Codec
|
||||||
|
import scodec.codecs._
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Force a player model to change its exo-suit.
|
||||||
|
* Set all GUI elements and functional elements to be associated with that type of exo-suit.
|
||||||
|
* Inventory and holster contents are discarded.<br>
|
||||||
|
* <br>
|
||||||
|
* Due to the way armor is handled internally, a player of one faction may not spawn in the exo-suit of another faction.
|
||||||
|
* That style of exo-suit is never available through this packet.
|
||||||
|
* As MAX units do not get their weapon by default, all the MAX values produce the same faction-appropriate mechanized exo-suit body visually.
|
||||||
|
* (The MAX weapons are supplied in subsequent packets.)
|
||||||
|
* `
|
||||||
|
* 0, 0 - Agile<br>
|
||||||
|
* 1, 0 - Reinforced<br>
|
||||||
|
* 2, 0 - MAX<br>
|
||||||
|
* 2, 1 - AI MAX<br>
|
||||||
|
* 2, 2 - AV MAX<br>
|
||||||
|
* 2, 3 - AA MAX<br>
|
||||||
|
* 3, 0 - Infiltration<br>
|
||||||
|
* 4, 0 - Standard
|
||||||
|
* `
|
||||||
|
* @param player_guid the player
|
||||||
|
* @param armor the type of exo-suit
|
||||||
|
* @param subtype the exo-suit subtype, if any
|
||||||
|
*/
|
||||||
|
final case class ArmorChangedMessage(player_guid : PlanetSideGUID,
|
||||||
|
armor : Int,
|
||||||
|
subtype : Int)
|
||||||
|
extends PlanetSideGamePacket {
|
||||||
|
type Packet = ArmorChangedMessage
|
||||||
|
def opcode = GamePacketOpcode.ArmorChangedMessage
|
||||||
|
def encode = ArmorChangedMessage.encode(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
object ArmorChangedMessage extends Marshallable[ArmorChangedMessage] {
|
||||||
|
implicit val codec : Codec[ArmorChangedMessage] = (
|
||||||
|
("player_guid" | PlanetSideGUID.codec) ::
|
||||||
|
("armor" | uintL(3)) ::
|
||||||
|
("subtype" | uintL(3))
|
||||||
|
).as[ArmorChangedMessage]
|
||||||
|
}
|
||||||
|
|
@ -981,6 +981,28 @@ class GamePacketTest extends Specification {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"ArmorChangedMessage" should {
|
||||||
|
val string = hex"3E 11 01 4C"
|
||||||
|
|
||||||
|
"decode" in {
|
||||||
|
PacketCoding.DecodePacket(string).require match {
|
||||||
|
case ArmorChangedMessage(player_guid, armor, subtype) =>
|
||||||
|
player_guid mustEqual PlanetSideGUID(273)
|
||||||
|
armor mustEqual 2
|
||||||
|
subtype mustEqual 3
|
||||||
|
case default =>
|
||||||
|
ko
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
"encode" in {
|
||||||
|
val msg = ArmorChangedMessage(PlanetSideGUID(273), 2, 3)
|
||||||
|
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||||
|
|
||||||
|
pkt mustEqual string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
"QuantityDeltaUpdateMessage" should {
|
"QuantityDeltaUpdateMessage" should {
|
||||||
val string = hex"C4 5300 FBFFFFFF"
|
val string = hex"C4 5300 FBFFFFFF"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue