Derive artifact catalogs from the selected party without changing configuration

This commit is contained in:
2026-11-20 04:33:02 +00:00
parent c3e6245416
commit 6900cad104
23 changed files with 446 additions and 315 deletions

View File

@@ -24,7 +24,12 @@ func resolvePartyInput(input ResolvedInputFile) (ResolvedParty, error) {
if err != nil {
return ResolvedParty{}, fmt.Errorf("parse party input %q: %w", path, err)
}
players, err := party.PlayersYAML()
if err != nil {
return ResolvedParty{}, err
}
return ResolvedParty{
Players: players,
Source: PartySource{
Path: path,
ConfigPath: configPath,
@@ -59,3 +64,19 @@ func resolveCampaignParty(campaignPath string, campaign *CampaignConfig) (Resolv
}
return resolvePartyInput(input)
}
// ResolveParty loads the exact explicit party file, or the campaign's configured
// default. Explicit paths are relative to the invocation directory.
func ResolveParty(campaignPath string, campaign *CampaignConfig, explicitFile *string) (ResolvedParty, error) {
if explicitFile == nil {
return resolveCampaignParty(campaignPath, campaign)
}
if *explicitFile == "" {
return ResolvedParty{}, fmt.Errorf("explicit party file path is required")
}
path, err := filepath.Abs(*explicitFile)
if err != nil {
return ResolvedParty{}, fmt.Errorf("resolve explicit party file: %w", err)
}
return resolvePartyInput(ResolvedInputFile{Path: path, ConfigPath: path, Source: "party_file"})
}