diff --git a/common/src/main/scala/net/psforever/packet/game/FavoritesMessage.scala b/common/src/main/scala/net/psforever/packet/game/FavoritesMessage.scala index 989699a9..1969f637 100644 --- a/common/src/main/scala/net/psforever/packet/game/FavoritesMessage.scala +++ b/common/src/main/scala/net/psforever/packet/game/FavoritesMessage.scala @@ -4,24 +4,24 @@ package net.psforever.packet.game import net.psforever.packet.{GamePacketOpcode, Marshallable, PacketHelpers, PlanetSideGamePacket} import scodec.Codec import scodec.codecs._ +import shapeless.{::, HNil} /** * Load the designator for an entry in the player's favorites list.
*
- * This entry defines a loadout but does not directly associate itself with the configurations and contents of the loadout. - * It is just the user-defined name that appears on a "Favorites" tab list and can be selected. - * A subsequent server request - `ItemTransactionMessage` - must be made to retrieve the said configuration and content for loading. + * This entry defines a user-defined loadout label that appears on a "Favorites" tab list and can be selected. + * A subsequent server request - `ItemTransactionMessage` - must be made to retrieve the said loadout contents. * Multiple separated favorites lists are present in the game. - * All entries are prepended with their destination list, which determines what kind of terminal or menu allows them to be viewable.
+ * All entries are prepended with their destination list which indicates how from how that list is viewable. + * Different lists also have different numbers of available lines to store loadout entries.
*
* Infantry equipment favorites are appended with a code for the type of exo-suit that they will load on a player. - * This does not match the same two field numbering system as in `ArmorChangedMessage` packets. - * Subtypes are not considered separately.
+ * This does not match the same two field numbering system as in `ArmorChangedMessage` packets.
*
* Lists:
* ` * 0 - Equipment Terminal (infantry)
- * 1 - Repair/Rearm (standard vehicles)
+ * 1 - Repair/Rearm Silo (standard vehicles)
* ` *
* Armors:
@@ -34,19 +34,16 @@ import scodec.codecs._ * ` *
* Exploration 1:
- * The identifier for the list is two bits so four separated lists of Favorites are supportable. + * The identifier for the list is two bits so four separated lists of `Favorites` are supportable. * Two of the lists are common enough and we can assume one of the others is related to Battleframe Robotics. - * What, if anything, is the fourth indexed list?
+ * These lists also do not include `Squad Defintion...` presets. + * What are the unknown lists?
*
* Exploration 2:
- * There are three unaccounted exo-suit indices - '0', '3', and '7' - and two specific kinds of exo-suit that are not defined - Infiltration and Standard. + * There are three unaccounted exo-suit indices - 0, 3, and 7; + * and, there are two specific kinds of exo-suit that are not defined - Infiltration and Standard. * It is possible that one of the indices also defines the generic MAX (see `ArmorChangedMessage`). - * Which exo-suit is associated with which index?
- *
- * Exploration 3:
- * The `armor` parameter coincides with the type of exo-suit maintained by the loadout. - * Does this value help the client judge when a favorite can be selected by checking against certifications for exo-suit permission? - * (If so, why isn't it working?) + * Which exo-suit is associated with which index? * @param list the destination list * @param player_guid the player * @param line the zero-indexed line number of this entry in its list @@ -66,10 +63,20 @@ final case class FavoritesMessage(list : Int, object FavoritesMessage extends Marshallable[FavoritesMessage] { implicit val codec : Codec[FavoritesMessage] = ( - ("list" | uintL(2)) >>:~ { value => + ("list" | uint2L) >>:~ { value => ("player_guid" | PlanetSideGUID.codec) :: - ("line" | uintL(4)) :: + ("line" | uint4L) :: ("label" | PacketHelpers.encodedWideStringAligned(2)) :: conditional(value == 0, "armor" | uintL(3)) - }).as[FavoritesMessage] + }).xmap[FavoritesMessage] ( + { + case lst :: guid :: ln :: str :: arm :: HNil => + FavoritesMessage(lst, guid, ln, str, arm) + }, + { + case FavoritesMessage(lst, guid, ln, str, arm) => + val armset : Option[Int] = if(lst == 0 && arm.isEmpty) { Some(0) } else { arm } + lst :: guid :: ln :: str :: armset :: HNil + } + ) } diff --git a/common/src/main/scala/net/psforever/types/TransactionType.scala b/common/src/main/scala/net/psforever/types/TransactionType.scala index c1b640b7..e8ed96f3 100644 --- a/common/src/main/scala/net/psforever/types/TransactionType.scala +++ b/common/src/main/scala/net/psforever/types/TransactionType.scala @@ -12,7 +12,7 @@ object TransactionType extends Enumeration { Sell, Unk4, Unk5, - Unk6, + Infantry_Loadout, Unk7 = Value