Skip to content

Commit

Permalink
Fix /division arg not being valid and division image filename format (
Browse files Browse the repository at this point in the history
  • Loading branch information
lL1l1 authored Dec 25, 2024
1 parent 508885d commit 9b7d1e9
Show file tree
Hide file tree
Showing 54 changed files with 44 additions and 7 deletions.
3 changes: 3 additions & 0 deletions changelog/snippets/fix.6581.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- (#6581) Fix divisions not being parsed by the matchmaker lobby.

- (#6581) Fix division image filenames not matching the division data in the scenario info.
24 changes: 22 additions & 2 deletions lua/ui/lobby/autolobby/AutolobbyController.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,33 @@ local AutolobbyEngineStrings = {
['LaunchRejected'] = "<LOC lob_0009>Some players are using an incompatible client version.",
}

-- associated textures are in `/textures/divisions/<division> <subdivision>.png`
-- Make note of the space, which isn't there for "grandmaster" and "unlisted" divisions

---@alias Division
---| "bronze"
---| "silver"
---| "gold"
---| "diamond"
---| "master"
---| "grandmaster"
---| "unlisted"

---@alias Subdivision
---| "I"
---| "II"
---| "III"
---| "IV"
---| "V"
---| "" # when Division is grandmaster or unlisted

---@class UIAutolobbyPlayer: UILobbyLaunchPlayerConfiguration
---@field StartSpot number
---@field DEV number # Related to rating/divisions
---@field MEAN number # Related to rating/divisions
---@field NG number # Related to rating/divisions
---@field DIV string # Related to rating/divisions
---@field SUBDIV string # Related to rating/divisions
---@field DIV Division # Related to rating/divisions
---@field SUBDIV Subdivision # Related to rating/divisions
---@field PL number # Related to rating/divisions
---@field PlayerClan string

Expand Down
2 changes: 1 addition & 1 deletion lua/ui/lobby/autolobby/components/AutolobbyArguments.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ AutolobbyArgumentsComponent = ClassSimple {
["/mean"] = true,

-- related to divisions
["division"] = true,
["/division"] = true,
["/subdivision"] = true,

-- related to game settings
Expand Down
22 changes: 18 additions & 4 deletions scripts/LaunchFAInstances.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,18 @@ if (Test-Path $debuggerExecutable) {
}

# Command-line arguments common for all instances
$baseArguments = '/init "init_dev.lua" /EnableDiskWatch /nomovie /RunWithTheWind /gameoptions CheatsEnabled:true GameSpeed:adjustable '
$baseArguments = '/init "init_dev.lua" /EnableDiskWatch /nomovie /RunWithTheWind /gameoptions CheatsEnabled:true GameSpeed:adjustable'

# Game-specific settings
$hostProtocol = "udp"
$hostPlayerName = "HostPlayer_1"
$gameName = "MyGame"

# Array of factions to choose from
# Array of player data to choose from
$factions = @("UEF", "Seraphim", "Cybran", "Aeon")
$clans = @("Yps", "Nom", "Cly", "Mad", "Gol", "Kur", "Row", "Jip", "Bal", "She")
$divisions = @("bronze", "silver", "gold", "diamond", "master", "grandmaster", "unlisted")
$subdivisions = @("I", "II", "III", "IV", "V")

# Get the screen resolution (for placing and resizing the windows)
Add-Type -AssemblyName System.Windows.Forms
Expand Down Expand Up @@ -84,6 +86,15 @@ function Get-TeamArgument {
return "/team $((($instanceNumber % $teams) + 1 + 1))"
}

function Get-DivisionArgText {
$division = $($divisions | Get-Random)
$argText = "/division $division"
if ($division -ne "unlisted" -and $division -ne "grandmaster") {
$argText += " /subdivision $($subdivisions | Get-Random)"
}
return $argText
}

# Prepare arguments and launch instances
if ($players -eq 1) {
$logFile = "dev.log"
Expand All @@ -92,7 +103,9 @@ if ($players -eq 1) {
$hostLogFile = "host_dev_1.log"
$hostFaction = $factions | Get-Random
$hostTeamArgument = Get-TeamArgument -instanceNumber 0
$hostArguments = "/log $hostLogFile /showlog /hostgame $hostProtocol $port $hostPlayerName $gameName $map /startspot 1 /players $players /$hostFaction $hostTeamArgument $baseArguments /division HostDivision /subdivision 1 /clan $($clans | Get-Random)"

$divisionArgText = Get-DivisionArgText
$hostArguments = "/log $hostLogFile /showlog /hostgame $hostProtocol $port $hostPlayerName $gameName $map /startspot 1 /players $players /$hostFaction $hostTeamArgument $baseArguments $divisionArgText /clan $($clans | Get-Random)"

# Launch host game instance
Launch-GameInstance -instanceNumber 1 -xPos 0 -yPos 0 -arguments $hostArguments
Expand All @@ -108,7 +121,8 @@ if ($players -eq 1) {
$clientPlayerName = "ClientPlayer_$($i + 1)"
$clientFaction = $factions | Get-Random
$clientTeamArgument = Get-TeamArgument -instanceNumber $i
$clientArguments = "/log $clientLogFile /joingame $hostProtocol localhost:$port $clientPlayerName /startspot $($i + 1) /players $players /$clientFaction $clientTeamArgument $baseArguments /division Diamond /subdivision $($i + 1) /clan $($clans | Get-Random)"
$divisionArgText = Get-DivisionArgText
$clientArguments = "/log $clientLogFile /joingame $hostProtocol localhost:$port $clientPlayerName /startspot $($i + 1) /players $players /$clientFaction $clientTeamArgument $baseArguments $divisionArgText /clan $($clans | Get-Random)"

Launch-GameInstance -instanceNumber ($i + 1) -xPos $xPos -yPos $yPos -arguments $clientArguments
}
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes

0 comments on commit 9b7d1e9

Please sign in to comment.