Add officer portrait defaults
This commit is contained in:
@@ -101,6 +101,7 @@ $validSkillKinds = @("damage", "heal", "support")
|
||||
$validSkillTargets = @("enemy", "ally", "self", "any")
|
||||
$validSkillStats = @("atk", "def", "int", "agi")
|
||||
$validSkillEffectTypes = @("stat_bonus")
|
||||
$validPortraitPathPattern = '^res://.+\.(png|jpg|jpeg|webp)$'
|
||||
$knownFlagIds = New-Object System.Collections.Generic.HashSet[string]
|
||||
$knownFlagValueKinds = @{}
|
||||
$joinedOfficerIds = New-Object System.Collections.Generic.HashSet[string]
|
||||
@@ -1204,17 +1205,19 @@ function Check-Dialogue-Line($Line, [string]$Context) {
|
||||
Fail "$Context has an empty dialogue text."
|
||||
}
|
||||
if (Has-Prop $Line "portrait") {
|
||||
$portrait = Get-Prop $Line "portrait" ""
|
||||
if ($portrait -is [System.Array] -or $portrait -is [System.Management.Automation.PSCustomObject]) {
|
||||
Fail "$Context portrait must be a string resource path."
|
||||
}
|
||||
if ([string]::IsNullOrWhiteSpace([string]$portrait)) {
|
||||
Fail "$Context has an empty portrait path."
|
||||
}
|
||||
$portraitText = [string]$portrait
|
||||
if ($portraitText -notmatch '^res://.+\.(png|jpg|jpeg|webp)$') {
|
||||
Fail "$Context portrait must be a res:// image path."
|
||||
}
|
||||
Check-Portrait-Path (Get-Prop $Line "portrait" "") "$Context portrait"
|
||||
}
|
||||
}
|
||||
|
||||
function Check-Portrait-Path($Portrait, [string]$Context) {
|
||||
if ($Portrait -is [System.Array] -or $Portrait -is [System.Management.Automation.PSCustomObject]) {
|
||||
Fail "$Context must be a string resource path."
|
||||
}
|
||||
if ([string]::IsNullOrWhiteSpace([string]$Portrait)) {
|
||||
Fail "$Context must not be empty."
|
||||
}
|
||||
if ([string]$Portrait -notmatch $validPortraitPathPattern) {
|
||||
Fail "$Context must be a res:// image path."
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1269,9 +1272,21 @@ foreach ($classProp in $classes.PSObject.Properties) {
|
||||
Check-Skill-Refs (Get-Prop $classProp.Value "skills" @()) "Class $($classProp.Name)"
|
||||
}
|
||||
|
||||
$officerNames = New-Object System.Collections.Generic.HashSet[string]
|
||||
foreach ($officerProp in $officers.PSObject.Properties) {
|
||||
$officerName = [string](Get-Prop $officerProp.Value "name" "")
|
||||
if ([string]::IsNullOrWhiteSpace($officerName)) {
|
||||
Fail "Officer $($officerProp.Name) has empty name."
|
||||
}
|
||||
$normalizedOfficerName = $officerName.Trim().ToLowerInvariant()
|
||||
if (-not $officerNames.Add($normalizedOfficerName)) {
|
||||
Fail "Officer $($officerProp.Name) has duplicate name: $officerName"
|
||||
}
|
||||
Check-Skill-Refs (Get-Prop $officerProp.Value "skills" @()) "Officer $($officerProp.Name)"
|
||||
Check-Officer-Equipment $officerProp.Name $officerProp.Value
|
||||
if (Has-Prop $officerProp.Value "portrait") {
|
||||
Check-Portrait-Path (Get-Prop $officerProp.Value "portrait" "") "Officer $($officerProp.Name) portrait"
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($scenario in $campaign.scenarios) {
|
||||
@@ -1357,6 +1372,20 @@ foreach ($scenario in $campaign.scenarios) {
|
||||
Check-Deployment $deployment $scenarioId $width $height $rows $seenIds
|
||||
}
|
||||
}
|
||||
if ($actionType -eq "dialogue") {
|
||||
if (Has-Prop $action "lines") {
|
||||
$rawLines = Get-Prop $action "lines" $null
|
||||
$lines = @($rawLines)
|
||||
if ($null -eq $rawLines -or $lines.Count -le 0) {
|
||||
Fail "Scenario $scenarioId event $eventId dialogue action has malformed lines."
|
||||
}
|
||||
foreach ($line in $lines) {
|
||||
Check-Dialogue-Line $line "Scenario $scenarioId event $eventId dialogue"
|
||||
}
|
||||
} else {
|
||||
Check-Dialogue-Line $action "Scenario $scenarioId event $eventId dialogue"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user