importing ItemTransactionResultMessage and tests from alt repo

This commit is contained in:
FateJH 2017-03-05 16:29:21 -05:00
parent aece1e1aab
commit c8c23314d6
4 changed files with 82 additions and 1 deletions

View file

@ -400,7 +400,7 @@ object GamePacketOpcode extends Enumeration {
case 0x42 => noDecoder(CargoMountPointStatusMessage)
case 0x43 => noDecoder(BeginZoningMessage)
case 0x44 => game.ItemTransactionMessage.decode
case 0x45 => noDecoder(ItemTransactionResultMessage)
case 0x45 => game.ItemTransactionResultMessage.decode
case 0x46 => game.ChangeFireModeMessage.decode
case 0x47 => game.ChangeAmmoMessage.decode
// 0x48

View file

@ -0,0 +1,35 @@
// Copyright (c) 2016 PSForever.net to present
package net.psforever.packet.game
import net.psforever.packet.{GamePacketOpcode, Marshallable, PlanetSideGamePacket}
import net.psforever.types.TransactionType
import scodec.Codec
import scodec.codecs._
/**
* Dispatch to the client in response to an `ItemRequestMessage`, roughly after the request has been fulfilled.
* This TCP-like "after" behavior is typically supported by pushing this packet at the end of the `MultiPacket` that fulfills the request.
* @param terminal_guid the terminal used
* @param transaction_type the type of transaction
* @param success whether the transaction was a success
* @param error an error code, if applicable;
* no error by default
*/
final case class ItemTransactionResultMessage(terminal_guid : PlanetSideGUID,
transaction_type : TransactionType.Value,
success : Boolean,
error : Int = 0)
extends PlanetSideGamePacket {
type Packet = ItemTransactionResultMessage
def opcode = GamePacketOpcode.ItemTransactionResultMessage
def encode = ItemTransactionResultMessage.encode(this)
}
object ItemTransactionResultMessage extends Marshallable[ItemTransactionResultMessage] {
implicit val codec : Codec[ItemTransactionResultMessage] = (
("terminal_guid" | PlanetSideGUID.codec) ::
("transaction_type" | TransactionType.codec) ::
("success" | bool) ::
("error" | uint8L)
).as[ItemTransactionResultMessage]
}