Add selectable camp conversations

This commit is contained in:
2026-06-18 17:10:27 +09:00
parent d723d34a32
commit 26741b97dd
9 changed files with 315 additions and 21 deletions

View File

@@ -105,6 +105,7 @@ $validStatusStats = @("atk", "def", "int", "agi", "move")
$validSkillEffectTypes = @("stat_bonus", "damage_over_time", "action_lock")
$validSkillAreaShapes = @("single", "diamond")
$validDialogueSides = @("left", "right")
$validCampConversationGroups = @("officer", "topic")
$validPortraitPathPattern = '^res://.+\.(png|jpg|jpeg|webp)$'
$minimumPortraitDimension = 512
$portraitImageInspectorReady = $false
@@ -1698,6 +1699,7 @@ function Check-Briefing($Briefing, [string]$ScenarioId) {
foreach ($line in @((Get-Prop $Briefing "camp_dialogue" @()))) {
Check-Dialogue-Line $line "Scenario $ScenarioId briefing camp_dialogue"
}
Check-Camp-Conversations (Get-Prop $Briefing "camp_conversations" $null) $ScenarioId
$conditionalLines = Get-Prop $Briefing "conditional_lines" @()
foreach ($block in @($conditionalLines)) {
@@ -1721,6 +1723,55 @@ function Check-Briefing($Briefing, [string]$ScenarioId) {
}
}
function Check-Camp-Conversations($Conversations, [string]$ScenarioId) {
if ($null -eq $Conversations) {
return
}
if (-not ($Conversations -is [System.Array])) {
Fail "Scenario $ScenarioId briefing camp_conversations must be an array."
}
$seenConversationIds = New-Object System.Collections.Generic.HashSet[string]
foreach ($conversation in @($Conversations)) {
if ($conversation -is [string] -or $conversation -is [System.Array]) {
Fail "Scenario $ScenarioId briefing camp_conversations has malformed entry."
}
$conversationId = [string](Get-Prop $conversation "id" "")
if ([string]::IsNullOrWhiteSpace($conversationId)) {
Fail "Scenario $ScenarioId briefing camp_conversations has an empty id."
}
if (-not ($conversationId -match '^[a-z0-9_]+$')) {
Fail "Scenario $ScenarioId briefing camp_conversations has unstable id: $conversationId"
}
if (-not $seenConversationIds.Add($conversationId)) {
Fail "Scenario $ScenarioId briefing camp_conversations has duplicate id: $conversationId"
}
$label = [string](Get-Prop $conversation "label" "")
if ([string]::IsNullOrWhiteSpace($label)) {
Fail "Scenario $ScenarioId briefing camp_conversations $conversationId has an empty label."
}
$group = ([string](Get-Prop $conversation "group" "topic")).Trim().ToLowerInvariant()
if (-not $validCampConversationGroups.Contains($group)) {
Fail "Scenario $ScenarioId briefing camp_conversations $conversationId has unknown group: $group"
}
$officerId = [string](Get-Prop $conversation "officer_id" "")
if ($group -eq "officer") {
if ([string]::IsNullOrWhiteSpace($officerId)) {
Fail "Scenario $ScenarioId briefing camp_conversations $conversationId needs officer_id."
}
if (-not $officerIds.Contains($officerId)) {
Fail "Scenario $ScenarioId briefing camp_conversations $conversationId references unknown officer: $officerId"
}
}
$conversationLines = Get-Prop $conversation "lines" $null
if ($null -eq $conversationLines -or -not ($conversationLines -is [System.Array]) -or @($conversationLines).Count -le 0) {
Fail "Scenario $ScenarioId briefing camp_conversations $conversationId must have non-empty lines."
}
foreach ($conversationLine in @($conversationLines)) {
Check-Dialogue-Line $conversationLine "Scenario $ScenarioId briefing camp_conversations $conversationId"
}
}
}
function Check-Dialogue-Line($Line, [string]$Context) {
if ($Line -is [string]) {
if ([string]::IsNullOrWhiteSpace([string]$Line)) {