mud/content/dialogue/librarian.toml
Jared Miller 5d61008dc1
Add dialogue tree data model with tests
Implements a TOML-based dialogue tree system for NPCs with:
- DialogueChoice: player response options with optional conditions
- DialogueNode: NPC text with choices and optional actions
- DialogueTree: complete tree with root node and node graph
- Validation for root_node and next_node references
- load_dialogue() for single files, load_all_dialogues() for directories

Includes librarian dialogue example with nested conversation flow.
2026-02-14 14:31:39 -05:00

49 lines
1.4 KiB
TOML

npc_name = "librarian"
root_node = "greeting"
[nodes.greeting]
text = "Welcome to the library. How can I help you today?"
[[nodes.greeting.choices]]
text = "I'm looking for a book."
next_node = "book_search"
[[nodes.greeting.choices]]
text = "Tell me about this place."
next_node = "about_library"
[[nodes.greeting.choices]]
text = "Goodbye."
next_node = "farewell"
[nodes.book_search]
text = "We have quite the collection. Fairy tales, mostly. Browse the shelves — you might find something that catches your eye."
[[nodes.book_search.choices]]
text = "Any recommendations?"
next_node = "recommendations"
[[nodes.book_search.choices]]
text = "Thanks, I'll look around."
next_node = "farewell"
[nodes.recommendations]
text = "The Brothers Grimm collected some wonderful tales. 'The Golden Bird' is a personal favorite — a story about patience and trust."
[[nodes.recommendations.choices]]
text = "I'll keep an eye out for it."
next_node = "farewell"
[[nodes.recommendations.choices]]
text = "Tell me about this place instead."
next_node = "about_library"
[nodes.about_library]
text = "This library was built to preserve the old stories. Every book here was carefully transcribed. Take your time — the stories aren't going anywhere."
[[nodes.about_library.choices]]
text = "Thanks for the information."
next_node = "farewell"
[nodes.farewell]
text = "Happy reading. Come back anytime."