From faf8bd23a60b9c5f6a1ab9fbc051c2dcbb050b45 Mon Sep 17 00:00:00 2001 From: mbergen Date: Mon, 19 Aug 2024 13:48:16 +0200 Subject: [PATCH] fix(match2): AoE: Do not use default timestamp to resolve team templates (#4568) * fix(match2) AoE: Do not use default timestamp to resolve team templates * Update match_group_input_custom.lua --- .../wikis/ageofempires/match_group_input_custom.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/components/match2/wikis/ageofempires/match_group_input_custom.lua b/components/match2/wikis/ageofempires/match_group_input_custom.lua index 0438cc9a5b1..5fa70712dfe 100644 --- a/components/match2/wikis/ageofempires/match_group_input_custom.lua +++ b/components/match2/wikis/ageofempires/match_group_input_custom.lua @@ -295,7 +295,16 @@ function CustomMatchGroupInput.processOpponent(record, timestamp) opponent = {type = Opponent.literal, name = 'BYE'} end - Opponent.resolve(opponent, timestamp, {syncPlayer = true}) + ---@type number|string + local teamTemplateDate = timestamp + -- If date is default date, resolve using tournament dates instead + -- default date indicates that the match is missing a date + -- In order to get correct child team template, we will use an approximately date and not the default date + if teamTemplateDate == DateExt.defaultTimestamp then + teamTemplateDate = DateExt.getContextualDateOrNow() + end + + Opponent.resolve(opponent, teamTemplateDate, {syncPlayer = true}) MatchGroupInput.mergeRecordWithOpponent(record, opponent) end