mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-03-24 22:39:07 +00:00
added initial HotSpotUpdateMessage packet and tests for the clear condition (size=0)
This commit is contained in:
parent
daa22c572e
commit
6786d9934d
3 changed files with 72 additions and 1 deletions
|
|
@ -506,7 +506,7 @@ object GamePacketOpcode extends Enumeration {
|
|||
case 0x9c => noDecoder(DebugDrawMessage)
|
||||
case 0x9d => noDecoder(SoulMarkMessage)
|
||||
case 0x9e => noDecoder(UplinkPositionEvent)
|
||||
case 0x9f => noDecoder(HotSpotUpdateMessage)
|
||||
case 0x9f => game.HotSpotUpdateMessage.decode
|
||||
|
||||
// OPCODES 0xa0-af
|
||||
case 0xa0 => game.BuildingInfoUpdateMessage.decode
|
||||
|
|
|
|||
|
|
@ -0,0 +1,50 @@
|
|||
// 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._
|
||||
|
||||
/**
|
||||
* na
|
||||
* @param unk na
|
||||
* @param x the x-coord of the center of the hotspot
|
||||
* @param y the y-coord of the center of the hotspot
|
||||
* @param scale the scaling of the hotspot graphic
|
||||
*/
|
||||
final case class HotSpotInfo(unk : Int,
|
||||
x : Int,
|
||||
y : Int,
|
||||
scale : Int)
|
||||
|
||||
/**
|
||||
* na
|
||||
* @param continent_guid the zone (continent)
|
||||
* @param unk na
|
||||
* @param spots a list of HotSpotInfo, or Nil if empty
|
||||
*/
|
||||
// TODO test for size > 0 (e.g., > hex'00')
|
||||
// TODO test for size > 15 (e.g., > hex'F0')
|
||||
final case class HotSpotUpdateMessage(continent_guid : PlanetSideGUID,
|
||||
unk : Int,
|
||||
spots : List[HotSpotInfo] = Nil)
|
||||
extends PlanetSideGamePacket {
|
||||
type Packet = HotSpotUpdateMessage
|
||||
def opcode = GamePacketOpcode.HotSpotUpdateMessage
|
||||
def encode = HotSpotUpdateMessage.encode(this)
|
||||
}
|
||||
|
||||
object HotSpotUpdateMessage extends Marshallable[HotSpotUpdateMessage] {
|
||||
implicit val hotspot_codec : Codec[HotSpotInfo] = {
|
||||
("unk" | uint8L) ::
|
||||
("x" | uint16L) ::
|
||||
("y" | uint16L) ::
|
||||
("scale" | uintL(20))
|
||||
}.as[HotSpotInfo]
|
||||
|
||||
implicit val codec : Codec[HotSpotUpdateMessage] = (
|
||||
("continent_guid" | PlanetSideGUID.codec) ::
|
||||
("unk" | uint8L) ::
|
||||
("spots" | listOfN(uint8L, hotspot_codec))
|
||||
).as[HotSpotUpdateMessage]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue