mirror of
https://github.com/wolfswolke/DeathGarden_API_Rebirth.git
synced 2026-03-21 17:54:09 -05:00
Removed epoch that was not used and added game_mode so Custom games can set their own and also Dev versions.
This commit is contained in:
parent
8f4cd1901b
commit
fb8f0fb72a
|
|
@ -85,7 +85,6 @@ def queue():
|
|||
region = sanitize_input(request.json.get("region"))
|
||||
count_a = request.json.get("countA")
|
||||
count_b = request.json.get("countB")
|
||||
epoch = datetime.now().timestamp()
|
||||
if additional_user_ids:
|
||||
logger.graylog_logger(level="info",
|
||||
handler="logging_queue",
|
||||
|
|
@ -116,7 +115,7 @@ def queue():
|
|||
return jsonify(response_data)
|
||||
|
||||
else:
|
||||
response_data = matchmaking_queue.getQueueStatus(side, userid, region)
|
||||
response_data = matchmaking_queue.getQueueStatus(side, userid, region, game_mode=game_mode)
|
||||
return jsonify(response_data)
|
||||
|
||||
except Exception as e:
|
||||
|
|
@ -256,7 +255,38 @@ def match_register(match_id_unsanitized):
|
|||
game_mode = "4 Needles"
|
||||
else:
|
||||
game_mode = "Default"
|
||||
|
||||
# "KeysToMetaData": {
|
||||
# "Map_WashingtonRuins_Name": "FIRST STRIKE",
|
||||
# "Map_DesertMayan_Name": "DUST & BLOOD",
|
||||
# "Map_WashingtonRivers_Name": "SALT CREEK",
|
||||
# "Map_ArcticBlastFurnace_Name": "FIRE IN THE SKY",
|
||||
# "Map_ArcticExpedition_Name": "DESPERATE EXPEDITION",
|
||||
# "Map_WashingtonCemetary_Name": "TOMBSTONE",
|
||||
# "Map_DesertGoldRush_Name": "GOLD RUSH",
|
||||
# "Map_DesertOilField_Name": "BLOWOUT",
|
||||
# "Map_WashingtonFortress_Name": "FOREST CITADEL",
|
||||
# "Map_DesertFortress_Name": "LEGIONS REST",
|
||||
# "Map_DesertCity_Name": "BARREN CITY",
|
||||
# "Map_ArcticScrapYard_Name": "ARC SCRAPYARD",
|
||||
# "Map_SlumsDownTown_Map": "CURFEW",
|
||||
# "Map_ArcticBlastFurnace_2Hunters_Name": "FIRE IN THE SKY - 2 Hunters",
|
||||
# "Map_ArcticExpedition_2Hunters_Name": "DESPERATE EXPEDITION - 2 Hunters",
|
||||
# "Map_ArcticScrapYard_2Hunters_Name": "ARC SCRAPYARD - 2 Hunters",
|
||||
# "Map_DesertCity_2Hunters_Name": "BARREN CITY - 2 Hunters",
|
||||
# "Map_DesertFortress_2Hunters_Name": "LEGIONS REST - 2 Hunters",
|
||||
# "Map_DesertGoldRush_2Hunters_Name": "GOLD RUSH - 2 Hunters",
|
||||
# "Map_DesertMayan_2Hunters_Name": "DUST & BLOOD - 2 Hunters",
|
||||
# "Map_DesertOilField_2Hunters_Name": "BLOWOUT - 2 Hunters",
|
||||
# "Map_SlumsDownTown_2Hunters_Name": "CURFEW - 2 Hunters",
|
||||
# "Map_WashingtonCemetary_2Hunters_Name": "TOMBSTONE - 2 Hunters",
|
||||
# "Map_WashingtonFortress_2Hunters_Name": "FOREST CITADEL - 2 Hunters",
|
||||
# "Map_WashingtonRivers_2Hunters_Name": "SALT CREEK - 2 Hunters",
|
||||
# "Map_WashingtonRuins_2Hunters_Name": "FIRST STRIKE - 2 Hunters",
|
||||
# "Map_DesertMayan_2v10_5Needles_Name": "DUST & BLOOD - 2 Hunters",
|
||||
# "Map_DesertMayan_2v10_4Needles_Name": "DUST & BLOOD - 2 Hunters",
|
||||
# "Map_DesertMayan_2v8_5Needles_Name": "DUST & BLOOD - 2 Hunters",
|
||||
# "Map_DesertMayan_2v8_4Needles_Name": "DUST & BLOOD - 2 Hunters"
|
||||
# }
|
||||
match_configuration = response["props"]["MatchConfiguration"]
|
||||
if match_configuration == "/Game/Configuration/MatchConfig/MatchConfig_Demo_HarvestYourExit_1v5.MatchConfig_Demo_HarvestYourExit_1v5":
|
||||
match_configuration = "Harvest Your Exit 1v5"
|
||||
|
|
@ -380,7 +410,9 @@ def close_lobby(match_id_unsanitized):
|
|||
|
||||
@app.route("/api/v1/match/create", methods=["POST"])
|
||||
def match_create():
|
||||
# {'category': 'Steam-te-18f25613-36778-ue4-374f864b', 'region': 'US', 'playersA': [],
|
||||
# {'category': 'Steam-te-18f25613-36778-ue4-374f864b',
|
||||
# 'region': 'US',
|
||||
# 'playersA': [],
|
||||
# 'playersB': ['00658d11-2dfd-41e8-b6d2-2462e8f3aa47', '95041085-e7e4-4759-be3d-e72c69167578',
|
||||
# '0385496c-f0ae-44d3-a777-26092750f39c'],
|
||||
# 'props': {'MatchConfiguration': '/Game/Configuration/MatchConfig/MatchConfig_Demo.MatchConfig_Demo'},
|
||||
|
|
@ -454,6 +486,39 @@ def match_create():
|
|||
"status": "CREATED"
|
||||
}
|
||||
}
|
||||
# Test new data
|
||||
# MatchId FString
|
||||
# Category FString
|
||||
# Rank FString
|
||||
# CreationDateTime double
|
||||
# ExcludeFriends bool
|
||||
# ExcludeClanMembers bool
|
||||
# Status FString
|
||||
# Reason FString
|
||||
# Creator FString
|
||||
# Players TARRAY FString
|
||||
# SideA TARRAY FString
|
||||
# SideB TARRAY FString
|
||||
# CustomData TARRAY Json
|
||||
# Props TARRAY Json
|
||||
# Schema double
|
||||
data = {
|
||||
"MatchId": matchid,
|
||||
"Category": category,
|
||||
"Rank": 1,
|
||||
"CreationDateTime": epoch,
|
||||
"ExcludeFriends": False,
|
||||
"ExcludeClanMembers": False,
|
||||
"Status": "OPEN",
|
||||
"Reason": "FString",
|
||||
"Creator": userid,
|
||||
"Players": player_list,
|
||||
"SideA": players_a,
|
||||
"SideB": players_b,
|
||||
"CustomData": {},
|
||||
"Props": props,
|
||||
"Schema": 1
|
||||
}
|
||||
return jsonify(data)
|
||||
|
||||
|
||||
|
|
@ -1184,7 +1249,7 @@ def metrics_matchmaking_event():
|
|||
matchmaking_queue.removePlayerFromQueue(userid)
|
||||
return jsonify({"status": "success"})
|
||||
|
||||
return jsonify({"status": "success"})
|
||||
return "", 204
|
||||
except TimeoutError:
|
||||
return jsonify({"status": "error"})
|
||||
except Exception as e:
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ max_b_count_dev = 1
|
|||
max_b_count_prod = 5
|
||||
|
||||
|
||||
def random_game_mode(match_config=None):
|
||||
def random_game_mode(match_config=None, hash_of_map=None):
|
||||
if match_config:
|
||||
md5 = hashlib.md5(match_config.encode('utf-8')).hexdigest()
|
||||
return {'gameMode': f'{md5}-Default',
|
||||
|
|
@ -102,6 +102,25 @@ def random_game_mode(match_config=None):
|
|||
MatchConfig_WA_Rivers_2Hunters = {'gameMode': 'feac811fdef1d1a2f2fc26b3c99205fd-Default',
|
||||
'MatchConfiguration': '/Game/Configuration/MatchConfig/MatchConfig_WA_Rivers_2Hunters.MatchConfig_WA_Rivers_2Hunters'}
|
||||
|
||||
all_maps = [MatchConfig_SLU_DownTown, MatchConfig_Demo_HarvestYourExit_1v5, MatchConfig_Demo,
|
||||
MatchConfig_ARC_Fortress, MatchConfig_ARC_BlastFurnace, MatchConfig_ARC_BlastFurnace_2Hunters,
|
||||
MatchConfig_ARC_Expedition, MatchConfig_ARC_Expedition_2Hunters, MatchConfig_ARC_ScrapYard,
|
||||
MatchConfig_ARC_ScrapYard_2Hunters, MatchConfig_CAV_All, MatchConfig_CAV_All_2Hunters,
|
||||
MatchConfig_Custom, MatchConfig_CustomMatch, MatchConfig_Demo_2v10_4Needles,
|
||||
MatchConfig_Demo_2v10_5Needles, MatchConfig_Demo_2v8_4Needles, MatchConfig_Demo_2v8_5Needles,
|
||||
MatchConfig_Demo_HarvestYourExit, MatchConfig_DES_City, MatchConfig_DES_City_2Hunters,
|
||||
MatchConfig_DES_Fortress, MatchConfig_DES_Fortress_2Hunters, MatchConfig_DES_GoldRush,
|
||||
MatchConfig_DES_GoldRush_2v10_5Needles, MatchConfig_DES_Mayan, MatchConfig_DES_Mayan_2v10_5Needles,
|
||||
MatchConfig_DES_Oilfield, MatchConfig_DES_Oilfield_2Hunters, MatchConfig_JUN_Fortress,
|
||||
MatchConfig_JUN_Fortress_2Hunters, MatchConfig_NewMaps, MatchConfig_PRM_Special,
|
||||
MatchConfig_RUI_All, MatchConfig_RUI_All_2Hunters, MatchConfig_WA_Cemetery,
|
||||
MatchConfig_WA_Cemetery_2Hunters, MatchConfig_WA_Rivers, MatchConfig_WA_Rivers_2Hunters]
|
||||
|
||||
if hash_of_map != "Default":
|
||||
for MatchConfig in all_maps:
|
||||
if MatchConfig['gameMode'] == hash_of_map:
|
||||
return MatchConfig
|
||||
|
||||
high_probability = [MatchConfig_DES_GoldRush, MatchConfig_WA_Rivers, MatchConfig_ARC_BlastFurnace] * 3
|
||||
normal_probability = [MatchConfig_WA_Cemetery, MatchConfig_ARC_Expedition, MatchConfig_JUN_Fortress] * 2
|
||||
low_probability = [MatchConfig_DES_Fortress, MatchConfig_DES_Mayan]
|
||||
|
|
@ -203,7 +222,7 @@ class MatchmakingQueue:
|
|||
logger.graylog_logger(level="error", handler="matchmaking_getQueuedPlayer", message=e)
|
||||
return None
|
||||
|
||||
def getQueueStatus(self, side, userId, region, additional_user_ids=None):
|
||||
def getQueueStatus(self, side, userId, region, additional_user_ids=None, game_mode=None):
|
||||
with self.matchmaking_lock:
|
||||
try:
|
||||
eta_data = {
|
||||
|
|
@ -390,7 +409,10 @@ class MatchmakingQueue:
|
|||
logger.graylog_logger(level="info", handler="matchmaking_getQueueStatus",
|
||||
message="Killed broken lobby")
|
||||
matchId = self.genMatchUUID()
|
||||
Match_Config = random_game_mode()
|
||||
if game_mode:
|
||||
Match_Config = random_game_mode(hash_of_map=game_mode)
|
||||
else:
|
||||
Match_Config = random_game_mode()
|
||||
current_time = get_time()[0]
|
||||
lobby = Lobby(isReady=False, host=queuedPlayer, nonHosts=[], id=matchId, isPrepared=False,
|
||||
hasStarted=False, status="OPENED", MatchConfig=Match_Config,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user