Adopt registry-backed NPC occurrence artifacts

This commit is contained in:
2026-08-05 18:55:58 +00:00
parent 3f4a1f2647
commit 5e2ccffc0f
42 changed files with 676 additions and 528 deletions

View File

@@ -112,22 +112,22 @@ func appendItemEventLists(values []dnd.ItemEventList) (dnd.ItemEventList, error)
return combined, nil
}
func appendNPCInteractionLists(values []dnd.NPCInteractionList) (dnd.NPCInteractionList, error) {
func appendNPCInteractionLists(values []dnd.NPCOccurrenceList) (dnd.NPCOccurrenceList, error) {
count := 0
present := false
for _, value := range values {
if value.Interactions != nil {
if value.Occurrences != nil {
present = true
}
count += len(value.Interactions)
count += len(value.Occurrences)
}
if !present {
return dnd.NPCInteractionList{}, nil
return dnd.NPCOccurrenceList{}, nil
}
combined := dnd.NPCInteractionList{Interactions: make([]dnd.NPCInteraction, 0, count)}
combined := dnd.NPCOccurrenceList{Occurrences: make([]dnd.NPCOccurrence, 0, count)}
for _, value := range values {
for _, interaction := range value.Interactions {
combined.Interactions = append(combined.Interactions, cloneNPCInteraction(interaction))
for _, occurrence := range value.Occurrences {
combined.Occurrences = append(combined.Occurrences, cloneNPCOccurrence(occurrence))
}
}
return combined, nil
@@ -228,7 +228,7 @@ func cloneNPC(value dnd.NPC) dnd.NPC {
return clone
}
func cloneNPCInteraction(value dnd.NPCInteraction) dnd.NPCInteraction {
func cloneNPCOccurrence(value dnd.NPCOccurrence) dnd.NPCOccurrence {
clone := value
clone.SourceRefs = cloneSourceRefs(value.SourceRefs)
return clone