From b141997531c7e2bfc58fd8906be56df48d5ba2ef Mon Sep 17 00:00:00 2001 From: hjpalpha <75081997+hjpalpha@users.noreply.github.com> Date: Mon, 16 Oct 2023 10:18:30 +0200 Subject: [PATCH] Save manually input player team to page var if `syncPlayer` is enabled (#3383) * Save manually input player team to page var if `syncPlayer` is enabled * starcraft * break line * break line * warcraft --- components/opponent/commons/opponent.lua | 8 ++++---- .../commons/starcraft_starcraft2/opponent_starcraft.lua | 8 ++++---- components/opponent/wikis/warcraft/opponent_custom.lua | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/components/opponent/commons/opponent.lua b/components/opponent/commons/opponent.lua index 32336432c0c..a21f344e453 100644 --- a/components/opponent/commons/opponent.lua +++ b/components/opponent/commons/opponent.lua @@ -304,10 +304,10 @@ function Opponent.resolve(opponent, date, options) elseif Opponent.typeIsParty(opponent.type) then for _, player in ipairs(opponent.players) do if options.syncPlayer then - PlayerExt.syncPlayer(player, {savePageVar = not Opponent.playerIsTbd(player)}) - if not player.team then - player.team = PlayerExt.syncTeam(player.pageName:gsub(' ', '_'), nil, {date = date}) - end + local savePageVar = not Opponent.playerIsTbd(player) + PlayerExt.syncPlayer(player, {savePageVar = savePageVar}) + player.team = + PlayerExt.syncTeam(player.pageName:gsub(' ', '_'), player.team, {date = date, savePageVar = savePageVar}) else PlayerExt.populatePageName(player) end diff --git a/components/opponent/commons/starcraft_starcraft2/opponent_starcraft.lua b/components/opponent/commons/starcraft_starcraft2/opponent_starcraft.lua index d6329f4907d..996018b8ed6 100644 --- a/components/opponent/commons/starcraft_starcraft2/opponent_starcraft.lua +++ b/components/opponent/commons/starcraft_starcraft2/opponent_starcraft.lua @@ -160,10 +160,10 @@ function StarcraftOpponent.resolve(opponent, date, options) for _, player in ipairs(opponent.players) do if options.syncPlayer then local hasRace = String.isNotEmpty(player.race) - StarcraftPlayerExt.syncPlayer(player, {savePageVar = not Opponent.playerIsTbd(player --[[@as standardPlayer]])}) - if not player.team then - player.team = PlayerExt.syncTeam(player.pageName:gsub(' ', '_'), nil, {date = date}) - end + local savePageVar = not Opponent.playerIsTbd(player --[[@as standardPlayer]]) + StarcraftPlayerExt.syncPlayer(player, {savePageVar = savePageVar}) + player.team = + PlayerExt.syncTeam(player.pageName:gsub(' ', '_'), player.team, {date = date, savePageVar = savePageVar}) player.race = (hasRace or player.race ~= Faction.defaultFaction) and player.race or nil else PlayerExt.populatePageName(player) diff --git a/components/opponent/wikis/warcraft/opponent_custom.lua b/components/opponent/wikis/warcraft/opponent_custom.lua index 6cf04f5c005..05b9ce32c28 100644 --- a/components/opponent/wikis/warcraft/opponent_custom.lua +++ b/components/opponent/wikis/warcraft/opponent_custom.lua @@ -126,10 +126,10 @@ function CustomOpponent.resolve(opponent, date, options) for _, player in ipairs(opponent.players) do if options.syncPlayer then local hasRace = String.isNotEmpty(player.race) - PlayerExt.syncPlayer(player, {savePageVar = not Opponent.playerIsTbd(player)}) - if not player.team then - player.team = PlayerExt.syncTeam(player.pageName, nil, {date = date}) - end + local savePageVar = not Opponent.playerIsTbd(player) + PlayerExt.syncPlayer(player, {savePageVar = savePageVar}) + player.team = + PlayerExt.syncTeam(player.pageName:gsub(' ', '_'), player.team, {date = date, savePageVar = savePageVar}) player.race = (hasRace or player.race ~= Faction.defaultFaction) and player.race or nil else PlayerExt.populatePageName(player)