From 7179b984e7075525fd71400c09566b390b6dc373 Mon Sep 17 00:00:00 2001 From: Kirill Riman Date: Sat, 12 Oct 2024 10:09:49 +0300 Subject: [PATCH 01/11] 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/11] 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/11] 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/11] 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/11] 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/11] 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/11] 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/11] 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/11] 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/11] 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/11] 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;