Skip to content

Commit

Permalink
Save manually input player team to page var if syncPlayer is enabled (
Browse files Browse the repository at this point in the history
#3383)

* Save manually input player team to page var if `syncPlayer` is enabled

* starcraft

* break line

* break line

* warcraft
  • Loading branch information
hjpalpha authored Oct 16, 2023
1 parent 27da3a8 commit b141997
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions components/opponent/commons/opponent.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions components/opponent/wikis/warcraft/opponent_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b141997

Please sign in to comment.