mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-07-16 08:55:16 +00:00
wrote comments; re-named a parameter
This commit is contained in:
parent
baf83fdeae
commit
7a752a3279
2 changed files with 31 additions and 5 deletions
|
|
@ -5,7 +5,33 @@ import net.psforever.packet.{GamePacketOpcode, Marshallable, PacketHelpers, Plan
|
||||||
import scodec.Codec
|
import scodec.Codec
|
||||||
import scodec.codecs._
|
import scodec.codecs._
|
||||||
|
|
||||||
final case class FriendsRequest(unk : Int,
|
/**
|
||||||
|
* Manage the lists of other players whose names are retained by the given player.<br>
|
||||||
|
* <br>
|
||||||
|
* Players can be remembered by their names and added to a list of remembered names - the "friends list."
|
||||||
|
* They can also be dropped from the list.
|
||||||
|
* A list of "ignored" player names can also be retained.
|
||||||
|
* Ignored players will have their comments stifled in the given player's chat window.
|
||||||
|
* No name will be appended or removed from any list until the response to this packet is received.<br>
|
||||||
|
* <br>
|
||||||
|
* Actions that involve the "remove" functionality will locate the entered name in the local list before dispatching this packet.
|
||||||
|
* A complaint will be logged to the event window if the name is not found.<br>
|
||||||
|
* <br>
|
||||||
|
* Actions:<br>
|
||||||
|
* 0 - display friends list<br>
|
||||||
|
* 1 - add player to friends list<br>
|
||||||
|
* 2 - remove player from friends list<br>
|
||||||
|
* 4 - display ignored player list<br>
|
||||||
|
* 5 - add player to ignored player list<br>
|
||||||
|
* 6 - remove player from ignored player list<br>
|
||||||
|
* <br>
|
||||||
|
* Exploration:<br>
|
||||||
|
* Are action = 3 and action = 7 supposed to do anything?
|
||||||
|
* @param action the purpose of this packet
|
||||||
|
* @param friend the player name that was entered;
|
||||||
|
* blank in certain situations
|
||||||
|
*/
|
||||||
|
final case class FriendsRequest(action : Int,
|
||||||
friend : String)
|
friend : String)
|
||||||
extends PlanetSideGamePacket {
|
extends PlanetSideGamePacket {
|
||||||
type Packet = FriendsRequest
|
type Packet = FriendsRequest
|
||||||
|
|
@ -15,7 +41,7 @@ final case class FriendsRequest(unk : Int,
|
||||||
|
|
||||||
object FriendsRequest extends Marshallable[FriendsRequest] {
|
object FriendsRequest extends Marshallable[FriendsRequest] {
|
||||||
implicit val codec : Codec[FriendsRequest] = (
|
implicit val codec : Codec[FriendsRequest] = (
|
||||||
("unk" | uintL(3)) ::
|
("action" | uintL(3)) ::
|
||||||
("friend" | PacketHelpers.encodedWideStringAligned(5))
|
("friend" | PacketHelpers.encodedWideStringAligned(5))
|
||||||
).as[FriendsRequest]
|
).as[FriendsRequest]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -831,12 +831,12 @@ class GamePacketTest extends Specification {
|
||||||
}
|
}
|
||||||
|
|
||||||
"FriendsRequest" should {
|
"FriendsRequest" should {
|
||||||
val string = hex"72 3 0a0 46004a0048004e004300"
|
val string = hex"72 3 0A0 46004A0048004E004300"
|
||||||
|
|
||||||
"decode" in {
|
"decode" in {
|
||||||
PacketCoding.DecodePacket(string).require match {
|
PacketCoding.DecodePacket(string).require match {
|
||||||
case FriendsRequest(unk, friend) =>
|
case FriendsRequest(action, friend) =>
|
||||||
unk mustEqual 1
|
action mustEqual 1
|
||||||
friend.length mustEqual 5
|
friend.length mustEqual 5
|
||||||
friend mustEqual "FJHNC"
|
friend mustEqual "FJHNC"
|
||||||
case default =>
|
case default =>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue