Skip to content

Commit

Permalink
Remove 'faction' parameter from game_matchmaking command
Browse files Browse the repository at this point in the history
  • Loading branch information
Askaholic committed Oct 28, 2021
1 parent dfad5dd commit 273021f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 24 deletions.
7 changes: 0 additions & 7 deletions server/lobbyconnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -929,13 +929,6 @@ async def command_game_matchmaking(self, message):
recoverable=True
)

# TODO: Remove this legacy behavior, use party instead
if "faction" in message:
party.set_factions(
self.player,
[Faction.from_value(message["faction"])]
)

self.ladder_service.start_search(
players,
queue_name=queue_name,
Expand Down
25 changes: 11 additions & 14 deletions tests/integration_tests/test_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,13 @@ async def open_fa(proto):
async def queue_player_for_matchmaking(user, lobby_server, queue_name):
_, _, proto = await connect_and_sign_in(user, lobby_server)
await read_until_command(proto, "game_info")
await proto.send_message({
"command": "set_party_factions",
"factions": ["uef"]
})
await proto.send_message({
"command": "game_matchmaking",
"state": "start",
"faction": "uef",
"queue_name": queue_name
})
await read_until_command(
Expand All @@ -93,27 +96,21 @@ async def queue_player_for_matchmaking(user, lobby_server, queue_name):
return proto


async def queue_players_for_matchmaking(lobby_server, queue_name: str = "ladder1v1"):
async def queue_players_for_matchmaking(
lobby_server,
queue_name: str = "ladder1v1"
):
proto1 = await queue_player_for_matchmaking(
("ladder1", "ladder1"),
lobby_server,
queue_name
)
_, _, proto2 = await connect_and_sign_in(
proto2 = await queue_player_for_matchmaking(
("ladder2", "ladder2"),
lobby_server
lobby_server,
queue_name
)

await read_until_command(proto2, "game_info")

await proto2.send_message({
"command": "game_matchmaking",
"state": "start",
"faction": 1, # Python client sends factions as numbers
"queue_name": queue_name
})
await read_until_command(proto2, "search_info", state="start")

# If the players did not match, this will fail due to a timeout error
await read_until_command(proto1, "match_found", timeout=30)
await read_until_command(proto2, "match_found")
Expand Down
21 changes: 18 additions & 3 deletions tests/integration_tests/test_teammatchmaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,17 @@ async def queue_players_for_matchmaking(lobby_server):
read_until_command(proto, "game_info") for proto in protos
])

await asyncio.gather(*[
proto.send_message({
"command": "set_party_factions",
"factions": ["uef"]
})
for proto in protos
])
await asyncio.gather(*[
proto.send_message({
"command": "game_matchmaking",
"state": "start",
"faction": "uef",
"queue_name": "tmm2v2"
})
for proto in protos
Expand Down Expand Up @@ -114,18 +120,27 @@ async def test_game_matchmaking_multiqueue(lobby_server):
read_until_command(proto, "game_info") for proto in protos
])

await protos[0].send_message({
"command": "set_party_factions",
"factions": ["uef"]
})
await protos[0].send_message({
"command": "game_matchmaking",
"state": "start",
"faction": "uef",
"queue_name": "ladder1v1"
})
await read_until_command(protos[0], "search_info", state="start")
await asyncio.gather(*[
proto.send_message({
"command": "set_party_factions",
"factions": ["aeon"]
})
for proto in protos
])
await asyncio.gather(*[
proto.send_message({
"command": "game_matchmaking",
"state": "start",
"faction": "aeon",
"queue_name": "tmm2v2"
})
for proto in protos
Expand Down

0 comments on commit 273021f

Please sign in to comment.