From 7179b984e7075525fd71400c09566b390b6dc373 Mon Sep 17 00:00:00 2001 From: Kirill Riman Date: Sat, 12 Oct 2024 10:09:49 +0300 Subject: [PATCH 01/15] added 3 fields into DTO of MatchmakerQueueMapPool --- .../faforever/commons/api/dto/MatchmakerQueueMapPool.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/faf-commons-api/src/main/java/com/faforever/commons/api/dto/MatchmakerQueueMapPool.java b/faf-commons-api/src/main/java/com/faforever/commons/api/dto/MatchmakerQueueMapPool.java index 776ceabc..c44cfe22 100644 --- a/faf-commons-api/src/main/java/com/faforever/commons/api/dto/MatchmakerQueueMapPool.java +++ b/faf-commons-api/src/main/java/com/faforever/commons/api/dto/MatchmakerQueueMapPool.java @@ -16,6 +16,12 @@ public class MatchmakerQueueMapPool extends AbstractEntity Date: Sun, 27 Oct 2024 15:36:00 +0300 Subject: [PATCH 02/15] server message --- .../main/kotlin/com/faforever/commons/lobby/FafLobbyApi.kt | 1 + .../kotlin/com/faforever/commons/lobby/MatchmakerApi.kt | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/FafLobbyApi.kt b/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/FafLobbyApi.kt index 4ba93bdb..5546d0b2 100644 --- a/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/FafLobbyApi.kt +++ b/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/FafLobbyApi.kt @@ -45,6 +45,7 @@ interface LobbyProtocolMessage { JsonSubTypes.Type(value = UnreadyPartyRequest::class, name = "unready_party"), JsonSubTypes.Type(value = SelectPartyFactionsRequest::class, name = "set_party_factions"), JsonSubTypes.Type(value = GameMatchmakingRequest::class, name = "game_matchmaking"), + JsonSubTypes.Type(value = SetPlayerVetoesRequest::class, name = "set_player_vetoes"), JsonSubTypes.Type(value = MatchmakerInfoRequest::class, name = "matchmaker_info"), JsonSubTypes.Type(value = AuthenticateRequest::class, name = "auth"), JsonSubTypes.Type(value = IsReadyResponse::class, name = "is_ready_response"), diff --git a/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt b/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt index b08236da..885040d6 100644 --- a/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt +++ b/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt @@ -2,6 +2,7 @@ package com.faforever.commons.lobby import com.fasterxml.jackson.annotation.JsonProperty import java.time.OffsetDateTime +import java.util.HashMap /** * API for all matchmaker related activities @@ -146,6 +147,11 @@ internal data class InviteToPartyRequest( val playerId: Int ) : ClientMessage +internal data class SetPlayerVetoesRequest( + @JsonProperty("vetoes") + val vetoes: HashMap +) : ClientMessage + internal data class AcceptInviteToPartyRequest( @JsonProperty("sender_id") val playerId: Int From 33016b74851b9296d02562bd97e5355e4b2fd926 Mon Sep 17 00:00:00 2001 From: Kirill Riman <55841348+K-ETFreeman@users.noreply.github.com> Date: Sun, 27 Oct 2024 16:06:52 +0300 Subject: [PATCH 03/15] message2 --- .../main/kotlin/com/faforever/commons/lobby/FafLobbyClient.kt | 2 ++ .../main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt | 2 ++ 2 files changed, 4 insertions(+) diff --git a/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/FafLobbyClient.kt b/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/FafLobbyClient.kt index e21b4681..530cb7b0 100644 --- a/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/FafLobbyClient.kt +++ b/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/FafLobbyClient.kt @@ -344,5 +344,7 @@ class FafLobbyClient( override fun setPartyFactions(factions: Set) = send(SelectPartyFactionsRequest(factions)) + override fun setPlayerVetoes(vetoes: HashMap) = send(SetPlayerVetoesRequest(vetoes)) + override fun sendGpgGameMessage(message: GpgGameOutboundMessage) = send(message) } diff --git a/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt b/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt index 885040d6..65a80e63 100644 --- a/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt +++ b/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt @@ -28,6 +28,8 @@ interface MatchmakerApi { fun setPartyFactions(factions: Set) + fun setPlayerVetoes(vetoes: HashMap) + fun sendReady(requestId: String) } From 0e4fe45ae3fbb930187bf1806c08ea156c747f2c Mon Sep 17 00:00:00 2001 From: Kirill Riman <55841348+K-ETFreeman@users.noreply.github.com> Date: Sun, 27 Oct 2024 17:17:34 +0300 Subject: [PATCH 04/15] Use the interface not an implementation --- .../main/kotlin/com/faforever/commons/lobby/FafLobbyClient.kt | 2 +- .../main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/FafLobbyClient.kt b/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/FafLobbyClient.kt index 530cb7b0..6ec2b78b 100644 --- a/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/FafLobbyClient.kt +++ b/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/FafLobbyClient.kt @@ -344,7 +344,7 @@ class FafLobbyClient( override fun setPartyFactions(factions: Set) = send(SelectPartyFactionsRequest(factions)) - override fun setPlayerVetoes(vetoes: HashMap) = send(SetPlayerVetoesRequest(vetoes)) + override fun setPlayerVetoes(vetoes: Map) = send(SetPlayerVetoesRequest(vetoes)) override fun sendGpgGameMessage(message: GpgGameOutboundMessage) = send(message) } diff --git a/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt b/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt index 65a80e63..86052261 100644 --- a/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt +++ b/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt @@ -28,7 +28,7 @@ interface MatchmakerApi { fun setPartyFactions(factions: Set) - fun setPlayerVetoes(vetoes: HashMap) + fun setPlayerVetoes(vetoes: Map) fun sendReady(requestId: String) @@ -151,7 +151,7 @@ internal data class InviteToPartyRequest( internal data class SetPlayerVetoesRequest( @JsonProperty("vetoes") - val vetoes: HashMap + val vetoes: Map ) : ClientMessage internal data class AcceptInviteToPartyRequest( From 94c9985f912b39f2f21bd7f558d5b4c087719fb4 Mon Sep 17 00:00:00 2001 From: Kirill Riman <55841348+K-ETFreeman@users.noreply.github.com> Date: Sun, 17 Nov 2024 12:44:51 +0300 Subject: [PATCH 05/15] field rename --- .../com/faforever/commons/api/dto/MatchmakerQueueMapPool.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/faf-commons-api/src/main/java/com/faforever/commons/api/dto/MatchmakerQueueMapPool.java b/faf-commons-api/src/main/java/com/faforever/commons/api/dto/MatchmakerQueueMapPool.java index c44cfe22..837045c1 100644 --- a/faf-commons-api/src/main/java/com/faforever/commons/api/dto/MatchmakerQueueMapPool.java +++ b/faf-commons-api/src/main/java/com/faforever/commons/api/dto/MatchmakerQueueMapPool.java @@ -21,7 +21,7 @@ public class MatchmakerQueueMapPool extends AbstractEntity Date: Sun, 17 Nov 2024 13:00:11 +0300 Subject: [PATCH 06/15] cleanup --- .../src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt b/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt index 86052261..84aa9aa7 100644 --- a/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt +++ b/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt @@ -2,7 +2,6 @@ package com.faforever.commons.lobby import com.fasterxml.jackson.annotation.JsonProperty import java.time.OffsetDateTime -import java.util.HashMap /** * API for all matchmaker related activities From 87d6a503af708ef01f8c628d339ba80209b02097 Mon Sep 17 00:00:00 2001 From: Kirill Riman <55841348+K-ETFreeman@users.noreply.github.com> Date: Sat, 23 Nov 2024 13:55:53 +0300 Subject: [PATCH 07/15] changed the structure of SetPlayerVetoesRequest --- .../com/faforever/commons/lobby/FafLobbyClient.kt | 2 +- .../com/faforever/commons/lobby/MatchmakerApi.kt | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/FafLobbyClient.kt b/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/FafLobbyClient.kt index 6ec2b78b..248ecd6f 100644 --- a/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/FafLobbyClient.kt +++ b/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/FafLobbyClient.kt @@ -344,7 +344,7 @@ class FafLobbyClient( override fun setPartyFactions(factions: Set) = send(SelectPartyFactionsRequest(factions)) - override fun setPlayerVetoes(vetoes: Map) = send(SetPlayerVetoesRequest(vetoes)) + override fun setPlayerVetoes(vetoes: List) = send(SetPlayerVetoesRequest(vetoes)) override fun sendGpgGameMessage(message: GpgGameOutboundMessage) = send(message) } diff --git a/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt b/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt index 84aa9aa7..017b6ebc 100644 --- a/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt +++ b/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt @@ -27,7 +27,7 @@ interface MatchmakerApi { fun setPartyFactions(factions: Set) - fun setPlayerVetoes(vetoes: Map) + fun setPlayerVetoes(vetoes: List) fun sendReady(requestId: String) @@ -42,6 +42,13 @@ enum class MatchmakerState { STOP } +data class VetoData( + @JsonProperty("map_pool_map_version_id") + val mapPoolMapVersionId: Int, + @JsonProperty("veto_tokens_applied") + val vetoTokensApplied: Int +) + // *********************** // *** SERVER MESSAGES *** @@ -150,7 +157,7 @@ internal data class InviteToPartyRequest( internal data class SetPlayerVetoesRequest( @JsonProperty("vetoes") - val vetoes: Map + val vetoes: List ) : ClientMessage internal data class AcceptInviteToPartyRequest( From dbc8742832ba476b7c36cd11c7d7d7d501baed18 Mon Sep 17 00:00:00 2001 From: Kirill Riman <55841348+K-ETFreeman@users.noreply.github.com> Date: Sun, 27 Oct 2024 15:36:00 +0300 Subject: [PATCH 08/15] Veto system fields --- .../commons/api/dto/MatchmakerQueueMapPool.java | 2 +- .../com/faforever/commons/lobby/FafLobbyApi.kt | 1 + .../com/faforever/commons/lobby/FafLobbyClient.kt | 2 ++ .../com/faforever/commons/lobby/MatchmakerApi.kt | 14 ++++++++++++++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/api/src/main/java/com/faforever/commons/api/dto/MatchmakerQueueMapPool.java b/api/src/main/java/com/faforever/commons/api/dto/MatchmakerQueueMapPool.java index c44cfe22..837045c1 100644 --- a/api/src/main/java/com/faforever/commons/api/dto/MatchmakerQueueMapPool.java +++ b/api/src/main/java/com/faforever/commons/api/dto/MatchmakerQueueMapPool.java @@ -21,7 +21,7 @@ public class MatchmakerQueueMapPool extends AbstractEntity) = send(SelectPartyFactionsRequest(factions)) + override fun setPlayerVetoes(vetoes: List) = send(SetPlayerVetoesRequest(vetoes)) + override fun sendGpgGameMessage(message: GpgGameOutboundMessage) = send(message) } diff --git a/lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt b/lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt index b08236da..017b6ebc 100644 --- a/lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt +++ b/lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt @@ -27,6 +27,8 @@ interface MatchmakerApi { fun setPartyFactions(factions: Set) + fun setPlayerVetoes(vetoes: List) + fun sendReady(requestId: String) } @@ -40,6 +42,13 @@ enum class MatchmakerState { STOP } +data class VetoData( + @JsonProperty("map_pool_map_version_id") + val mapPoolMapVersionId: Int, + @JsonProperty("veto_tokens_applied") + val vetoTokensApplied: Int +) + // *********************** // *** SERVER MESSAGES *** @@ -146,6 +155,11 @@ internal data class InviteToPartyRequest( val playerId: Int ) : ClientMessage +internal data class SetPlayerVetoesRequest( + @JsonProperty("vetoes") + val vetoes: List +) : ClientMessage + internal data class AcceptInviteToPartyRequest( @JsonProperty("sender_id") val playerId: Int From f02bf68c9a44f21ebb6283a5ad7d2f0a1323d394 Mon Sep 17 00:00:00 2001 From: Kirill Riman <55841348+K-ETFreeman@users.noreply.github.com> Date: Sun, 8 Dec 2024 17:30:58 +0300 Subject: [PATCH 09/15] vetoes_changed --- .../kotlin/com/faforever/commons/lobby/ConnectionApi.kt | 8 ++++++++ .../kotlin/com/faforever/commons/lobby/FafLobbyApi.kt | 1 + 2 files changed, 9 insertions(+) diff --git a/lobby/src/main/kotlin/com/faforever/commons/lobby/ConnectionApi.kt b/lobby/src/main/kotlin/com/faforever/commons/lobby/ConnectionApi.kt index f0852a15..e4005787 100644 --- a/lobby/src/main/kotlin/com/faforever/commons/lobby/ConnectionApi.kt +++ b/lobby/src/main/kotlin/com/faforever/commons/lobby/ConnectionApi.kt @@ -54,6 +54,14 @@ data class NoticeInfo( val text: String?, ) : ServerMessage +/** + * A message from the server (automated) to update vetoes of the user. + */ +data class VetoesChangedInfo( + val bracketsIds: List , + val vetoesData: List +) : ServerMessage + /** * The server assigns us a session id, onto which we will authorize. diff --git a/lobby/src/main/kotlin/com/faforever/commons/lobby/FafLobbyApi.kt b/lobby/src/main/kotlin/com/faforever/commons/lobby/FafLobbyApi.kt index 5546d0b2..4bcaf36b 100644 --- a/lobby/src/main/kotlin/com/faforever/commons/lobby/FafLobbyApi.kt +++ b/lobby/src/main/kotlin/com/faforever/commons/lobby/FafLobbyApi.kt @@ -67,6 +67,7 @@ interface ClientMessage : LobbyProtocolMessage JsonSubTypes.Type(value = SocialInfo::class, name = "social"), JsonSubTypes.Type(value = LoginFailedResponse::class, name = "authentication_failed"), JsonSubTypes.Type(value = NoticeInfo::class, name = "notice"), + JsonSubTypes.Type(value = VetoesChangedInfo::class, name = "vetoes_changed"), JsonSubTypes.Type(value = IceServerListResponse::class, name = "ice_servers"), JsonSubTypes.Type(value = AvatarListInfo::class, name = "avatar"), JsonSubTypes.Type(value = PartyInfo::class, name = "update_party"), From 3b1a47fb0cf1d8444351d53feb4f25aae77a6737 Mon Sep 17 00:00:00 2001 From: Kirill Riman <55841348+K-ETFreeman@users.noreply.github.com> Date: Tue, 24 Dec 2024 17:18:45 +0300 Subject: [PATCH 10/15] without bracked ids --- .../src/main/kotlin/com/faforever/commons/lobby/ConnectionApi.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/lobby/src/main/kotlin/com/faforever/commons/lobby/ConnectionApi.kt b/lobby/src/main/kotlin/com/faforever/commons/lobby/ConnectionApi.kt index e4005787..487a9ce4 100644 --- a/lobby/src/main/kotlin/com/faforever/commons/lobby/ConnectionApi.kt +++ b/lobby/src/main/kotlin/com/faforever/commons/lobby/ConnectionApi.kt @@ -58,7 +58,6 @@ data class NoticeInfo( * A message from the server (automated) to update vetoes of the user. */ data class VetoesChangedInfo( - val bracketsIds: List , val vetoesData: List ) : ServerMessage From b8ef94460a1b91b69f1ae1238a97bbeedc32724a Mon Sep 17 00:00:00 2001 From: Kirill Riman <55841348+K-ETFreeman@users.noreply.github.com> Date: Sat, 28 Dec 2024 14:34:53 +0300 Subject: [PATCH 11/15] added teamSize to dto --- .../java/com/faforever/commons/api/dto/MatchmakerQueue.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/src/main/java/com/faforever/commons/api/dto/MatchmakerQueue.java b/api/src/main/java/com/faforever/commons/api/dto/MatchmakerQueue.java index 55cb5bb1..0210ac9f 100644 --- a/api/src/main/java/com/faforever/commons/api/dto/MatchmakerQueue.java +++ b/api/src/main/java/com/faforever/commons/api/dto/MatchmakerQueue.java @@ -15,6 +15,8 @@ public class MatchmakerQueue extends AbstractEntity { private String technicalName; @ToString.Include private String nameKey; + @ToString.Include + private Integer teamSize; @Relationship("featuredMod") private FeaturedMod featuredMod; From 5a55c5993ed6f7e7f238163e76d238adfcafa5c7 Mon Sep 17 00:00:00 2001 From: Kirill Riman <55841348+K-ETFreeman@users.noreply.github.com> Date: Wed, 5 Feb 2025 17:42:48 +0300 Subject: [PATCH 12/15] bracket id in VetoData --- .../faforever/commons/lobby/FafLobbyApi.kt~ | 152 ++++++++++++++++++ .../faforever/commons/lobby/MatchmakerApi.kt | 4 +- 2 files changed, 155 insertions(+), 1 deletion(-) create mode 100644 faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/FafLobbyApi.kt~ diff --git a/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/FafLobbyApi.kt~ b/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/FafLobbyApi.kt~ new file mode 100644 index 00000000..4ba93bdb --- /dev/null +++ b/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/FafLobbyApi.kt~ @@ -0,0 +1,152 @@ +package com.faforever.commons.lobby + +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonSubTypes +import com.fasterxml.jackson.annotation.JsonTypeInfo +import com.fasterxml.jackson.annotation.JsonValue +import reactor.core.publisher.Flux + + +/** + * Marker interface to identify messages on the Lobby protocol + */ +interface LobbyProtocolMessage { + companion object { + const val CONFIDENTIAL_MASK = "**********" + } + + fun stringsToMask(): List = listOf() +} + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "command") +@JsonSubTypes( + //FAF Client Messages + JsonSubTypes.Type(value = HostGameRequest::class, name = "game_host"), + JsonSubTypes.Type(value = JoinGameRequest::class, name = "game_join"), + JsonSubTypes.Type(value = SessionRequest::class, name = "ask_session"), + JsonSubTypes.Type(value = AddFriendRequest::class, name = "social_add"), + JsonSubTypes.Type(value = AddFoeRequest::class, name = "social_add"), + JsonSubTypes.Type(value = RemoveFriendRequest::class, name = "social_remove"), + JsonSubTypes.Type(value = RemoveFoeRequest::class, name = "social_remove"), + JsonSubTypes.Type(value = AvatarListRequest::class, name = "avatar"), + JsonSubTypes.Type(value = SelectAvatarRequest::class, name = "avatar"), + JsonSubTypes.Type(value = IceServerListRequest::class, name = "ice_servers"), + JsonSubTypes.Type(value = RestoreGameSessionRequest::class, name = "restore_game_session"), + JsonSubTypes.Type(value = ClientPingMessage::class, name = "ping"), + JsonSubTypes.Type(value = ClientPongMessage::class, name = "pong"), + JsonSubTypes.Type(value = ClosePlayerGameRequest::class, name = "admin"), + JsonSubTypes.Type(value = ClosePlayerLobbyRequest::class, name = "admin"), + JsonSubTypes.Type(value = BroadcastRequest::class, name = "admin"), + JsonSubTypes.Type(value = InviteToPartyRequest::class, name = "invite_to_party"), + JsonSubTypes.Type(value = AcceptInviteToPartyRequest::class, name = "accept_party_invite"), + JsonSubTypes.Type(value = KickPlayerFromPartyRequest::class, name = "kick_player_from_party"), + JsonSubTypes.Type(value = LeavePartyRequest::class, name = "leave_party"), + JsonSubTypes.Type(value = UnreadyPartyRequest::class, name = "unready_party"), + JsonSubTypes.Type(value = SelectPartyFactionsRequest::class, name = "set_party_factions"), + JsonSubTypes.Type(value = GameMatchmakingRequest::class, name = "game_matchmaking"), + JsonSubTypes.Type(value = MatchmakerInfoRequest::class, name = "matchmaker_info"), + JsonSubTypes.Type(value = AuthenticateRequest::class, name = "auth"), + JsonSubTypes.Type(value = IsReadyResponse::class, name = "is_ready_response"), + // GPG Client Messages not directly instantiated they are only forwarded from the game so are serialized directly +) +interface ClientMessage : LobbyProtocolMessage + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "command") +@JsonSubTypes( + //FAF Server Messages + JsonSubTypes.Type(value = LoginSuccessResponse::class, name = "welcome"), + JsonSubTypes.Type(value = SessionResponse::class, name = "session"), + JsonSubTypes.Type(value = GameInfo::class, name = "game_info"), + JsonSubTypes.Type(value = PlayerInfo::class, name = "player_info"), + JsonSubTypes.Type(value = GameLaunchResponse::class, name = "game_launch"), + JsonSubTypes.Type(value = MatchmakerInfo::class, name = "matchmaker_info"), + JsonSubTypes.Type(value = MatchmakerMatchFoundResponse::class, name = "match_found"), + JsonSubTypes.Type(value = MatchmakerMatchCancelledResponse::class, name = "match_cancelled"), + JsonSubTypes.Type(value = SocialInfo::class, name = "social"), + JsonSubTypes.Type(value = LoginFailedResponse::class, name = "authentication_failed"), + JsonSubTypes.Type(value = NoticeInfo::class, name = "notice"), + JsonSubTypes.Type(value = IceServerListResponse::class, name = "ice_servers"), + JsonSubTypes.Type(value = AvatarListInfo::class, name = "avatar"), + JsonSubTypes.Type(value = PartyInfo::class, name = "update_party"), + JsonSubTypes.Type(value = PartyInvite::class, name = "party_invite"), + JsonSubTypes.Type(value = PartyKick::class, name = "kicked_from_party"), + JsonSubTypes.Type(value = SearchInfo::class, name = "search_info"), + JsonSubTypes.Type(value = IrcPasswordInfo::class, name = "irc_password"), + JsonSubTypes.Type(value = ServerPingMessage::class, name = "ping"), + JsonSubTypes.Type(value = ServerPongMessage::class, name = "pong"), + JsonSubTypes.Type(value = InvalidResponse::class, name = "invalid"), + //GPG Server Messages + JsonSubTypes.Type(value = HostGameGpgCommand::class, name = "HostGame"), + JsonSubTypes.Type(value = JoinGameGpgCommand::class, name = "JoinGame"), + JsonSubTypes.Type(value = ConnectToPeerGpgCommand::class, name = "ConnectToPeer"), + JsonSubTypes.Type(value = IceMsgGpgCommand::class, name = "IceMsg"), + JsonSubTypes.Type(value = DisconnectFromPeerGpgCommand::class, name = "DisconnectFromPeer"), + JsonSubTypes.Type(value = IsReadyRequest::class, name = "is_ready"), +) +interface ServerMessage : LobbyProtocolMessage + + +/** + * API for interacting with the FAF Lobby server + */ +interface FafLobbyApi : + ConnectionApi, + GameApi, + AdminApi, + SocialApi, + MatchmakerApi { + + /** + * All "public" server events can be subscribed here. + * Internal events such as Ping or LoginResponse are filtered out. + */ + val events: Flux + + /** + * Emits whenever the tcp connection status changes + */ + val connectionStatus: Flux +} + +/// **************** +/// * SHARED ENUMS * +/// **************** + +enum class Faction( + @JsonValue + val faString: String, + val faIndex: Int +) { + UEF("uef", 1), + + AEON("aeon", 2), + + CYBRAN("cybran", 3), + + SERAPHIM("seraphim", 4), + + RANDOM("random", 5), + + CIVILIAN("civilian", 6); + + companion object { + private val fromFAString: Map = values().asList().associateBy { it.faString } + private val fromFAIndex: Map = values().asList().associateBy { it.faIndex } + + @JvmStatic + @JsonCreator + fun fromObject(value: Any?): Faction? { + return when (value) { + is Int -> fromFAIndex[value] + is String -> fromFAString[value] + else -> null + } + } + } +} + +enum class MessageTarget { + @JsonProperty("game") + GAME +} diff --git a/lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt b/lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt index 017b6ebc..41511d2c 100644 --- a/lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt +++ b/lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt @@ -46,7 +46,9 @@ data class VetoData( @JsonProperty("map_pool_map_version_id") val mapPoolMapVersionId: Int, @JsonProperty("veto_tokens_applied") - val vetoTokensApplied: Int + val vetoTokensApplied: Int, + @JsonProperty("matchmaker_queue_map_pool") + val matchmakerQueueMapPool: Int? = null ) From 2b818ed2eed9d7429a00dfac1bb978e4b8650616 Mon Sep 17 00:00:00 2001 From: Kirill Riman <55841348+K-ETFreeman@users.noreply.github.com> Date: Wed, 5 Feb 2025 18:29:41 +0300 Subject: [PATCH 13/15] actually its not optional param --- .../main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt b/lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt index 41511d2c..bbc85f76 100644 --- a/lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt +++ b/lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt @@ -48,7 +48,7 @@ data class VetoData( @JsonProperty("veto_tokens_applied") val vetoTokensApplied: Int, @JsonProperty("matchmaker_queue_map_pool") - val matchmakerQueueMapPool: Int? = null + val matchmakerQueueMapPool: Int ) From 493e50c22fb0a445c34781921905028f044d06eb Mon Sep 17 00:00:00 2001 From: Kirill Riman <55841348+K-ETFreeman@users.noreply.github.com> Date: Wed, 5 Feb 2025 19:19:12 +0300 Subject: [PATCH 14/15] id --- .../main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt b/lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt index bbc85f76..965d0b4e 100644 --- a/lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt +++ b/lobby/src/main/kotlin/com/faforever/commons/lobby/MatchmakerApi.kt @@ -47,8 +47,8 @@ data class VetoData( val mapPoolMapVersionId: Int, @JsonProperty("veto_tokens_applied") val vetoTokensApplied: Int, - @JsonProperty("matchmaker_queue_map_pool") - val matchmakerQueueMapPool: Int + @JsonProperty("matchmaker_queue_map_pool_id") + val matchmakerQueueMapPoolId: Int ) From 773305642c309ebea6a70bdbb1407ac211775dba Mon Sep 17 00:00:00 2001 From: Kirill Riman <55841348+K-ETFreeman@users.noreply.github.com> Date: Sun, 23 Mar 2025 16:19:50 +0300 Subject: [PATCH 15/15] garbage removed --- .../faforever/commons/lobby/FafLobbyApi.kt~ | 152 ------------------ 1 file changed, 152 deletions(-) delete mode 100644 faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/FafLobbyApi.kt~ diff --git a/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/FafLobbyApi.kt~ b/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/FafLobbyApi.kt~ deleted file mode 100644 index 4ba93bdb..00000000 --- a/faf-commons-lobby/src/main/kotlin/com/faforever/commons/lobby/FafLobbyApi.kt~ +++ /dev/null @@ -1,152 +0,0 @@ -package com.faforever.commons.lobby - -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.annotation.JsonSubTypes -import com.fasterxml.jackson.annotation.JsonTypeInfo -import com.fasterxml.jackson.annotation.JsonValue -import reactor.core.publisher.Flux - - -/** - * Marker interface to identify messages on the Lobby protocol - */ -interface LobbyProtocolMessage { - companion object { - const val CONFIDENTIAL_MASK = "**********" - } - - fun stringsToMask(): List = listOf() -} - -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "command") -@JsonSubTypes( - //FAF Client Messages - JsonSubTypes.Type(value = HostGameRequest::class, name = "game_host"), - JsonSubTypes.Type(value = JoinGameRequest::class, name = "game_join"), - JsonSubTypes.Type(value = SessionRequest::class, name = "ask_session"), - JsonSubTypes.Type(value = AddFriendRequest::class, name = "social_add"), - JsonSubTypes.Type(value = AddFoeRequest::class, name = "social_add"), - JsonSubTypes.Type(value = RemoveFriendRequest::class, name = "social_remove"), - JsonSubTypes.Type(value = RemoveFoeRequest::class, name = "social_remove"), - JsonSubTypes.Type(value = AvatarListRequest::class, name = "avatar"), - JsonSubTypes.Type(value = SelectAvatarRequest::class, name = "avatar"), - JsonSubTypes.Type(value = IceServerListRequest::class, name = "ice_servers"), - JsonSubTypes.Type(value = RestoreGameSessionRequest::class, name = "restore_game_session"), - JsonSubTypes.Type(value = ClientPingMessage::class, name = "ping"), - JsonSubTypes.Type(value = ClientPongMessage::class, name = "pong"), - JsonSubTypes.Type(value = ClosePlayerGameRequest::class, name = "admin"), - JsonSubTypes.Type(value = ClosePlayerLobbyRequest::class, name = "admin"), - JsonSubTypes.Type(value = BroadcastRequest::class, name = "admin"), - JsonSubTypes.Type(value = InviteToPartyRequest::class, name = "invite_to_party"), - JsonSubTypes.Type(value = AcceptInviteToPartyRequest::class, name = "accept_party_invite"), - JsonSubTypes.Type(value = KickPlayerFromPartyRequest::class, name = "kick_player_from_party"), - JsonSubTypes.Type(value = LeavePartyRequest::class, name = "leave_party"), - JsonSubTypes.Type(value = UnreadyPartyRequest::class, name = "unready_party"), - JsonSubTypes.Type(value = SelectPartyFactionsRequest::class, name = "set_party_factions"), - JsonSubTypes.Type(value = GameMatchmakingRequest::class, name = "game_matchmaking"), - JsonSubTypes.Type(value = MatchmakerInfoRequest::class, name = "matchmaker_info"), - JsonSubTypes.Type(value = AuthenticateRequest::class, name = "auth"), - JsonSubTypes.Type(value = IsReadyResponse::class, name = "is_ready_response"), - // GPG Client Messages not directly instantiated they are only forwarded from the game so are serialized directly -) -interface ClientMessage : LobbyProtocolMessage - -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "command") -@JsonSubTypes( - //FAF Server Messages - JsonSubTypes.Type(value = LoginSuccessResponse::class, name = "welcome"), - JsonSubTypes.Type(value = SessionResponse::class, name = "session"), - JsonSubTypes.Type(value = GameInfo::class, name = "game_info"), - JsonSubTypes.Type(value = PlayerInfo::class, name = "player_info"), - JsonSubTypes.Type(value = GameLaunchResponse::class, name = "game_launch"), - JsonSubTypes.Type(value = MatchmakerInfo::class, name = "matchmaker_info"), - JsonSubTypes.Type(value = MatchmakerMatchFoundResponse::class, name = "match_found"), - JsonSubTypes.Type(value = MatchmakerMatchCancelledResponse::class, name = "match_cancelled"), - JsonSubTypes.Type(value = SocialInfo::class, name = "social"), - JsonSubTypes.Type(value = LoginFailedResponse::class, name = "authentication_failed"), - JsonSubTypes.Type(value = NoticeInfo::class, name = "notice"), - JsonSubTypes.Type(value = IceServerListResponse::class, name = "ice_servers"), - JsonSubTypes.Type(value = AvatarListInfo::class, name = "avatar"), - JsonSubTypes.Type(value = PartyInfo::class, name = "update_party"), - JsonSubTypes.Type(value = PartyInvite::class, name = "party_invite"), - JsonSubTypes.Type(value = PartyKick::class, name = "kicked_from_party"), - JsonSubTypes.Type(value = SearchInfo::class, name = "search_info"), - JsonSubTypes.Type(value = IrcPasswordInfo::class, name = "irc_password"), - JsonSubTypes.Type(value = ServerPingMessage::class, name = "ping"), - JsonSubTypes.Type(value = ServerPongMessage::class, name = "pong"), - JsonSubTypes.Type(value = InvalidResponse::class, name = "invalid"), - //GPG Server Messages - JsonSubTypes.Type(value = HostGameGpgCommand::class, name = "HostGame"), - JsonSubTypes.Type(value = JoinGameGpgCommand::class, name = "JoinGame"), - JsonSubTypes.Type(value = ConnectToPeerGpgCommand::class, name = "ConnectToPeer"), - JsonSubTypes.Type(value = IceMsgGpgCommand::class, name = "IceMsg"), - JsonSubTypes.Type(value = DisconnectFromPeerGpgCommand::class, name = "DisconnectFromPeer"), - JsonSubTypes.Type(value = IsReadyRequest::class, name = "is_ready"), -) -interface ServerMessage : LobbyProtocolMessage - - -/** - * API for interacting with the FAF Lobby server - */ -interface FafLobbyApi : - ConnectionApi, - GameApi, - AdminApi, - SocialApi, - MatchmakerApi { - - /** - * All "public" server events can be subscribed here. - * Internal events such as Ping or LoginResponse are filtered out. - */ - val events: Flux - - /** - * Emits whenever the tcp connection status changes - */ - val connectionStatus: Flux -} - -/// **************** -/// * SHARED ENUMS * -/// **************** - -enum class Faction( - @JsonValue - val faString: String, - val faIndex: Int -) { - UEF("uef", 1), - - AEON("aeon", 2), - - CYBRAN("cybran", 3), - - SERAPHIM("seraphim", 4), - - RANDOM("random", 5), - - CIVILIAN("civilian", 6); - - companion object { - private val fromFAString: Map = values().asList().associateBy { it.faString } - private val fromFAIndex: Map = values().asList().associateBy { it.faIndex } - - @JvmStatic - @JsonCreator - fun fromObject(value: Any?): Faction? { - return when (value) { - is Int -> fromFAIndex[value] - is String -> fromFAString[value] - else -> null - } - } - } -} - -enum class MessageTarget { - @JsonProperty("game") - GAME -}