![]() |
Peoplemon
0.1.0
Peoplemon 3 game source documentation
|
Building block of conversations. A conversation is a tree of nodes and each node is an action that happens in the conversation. More...
#include <Conversation.hpp>
Classes | |
struct | Item |
Public Types | |
enum | Type : std::uint8_t { Talk = 0 , Prompt = 1 , GiveItem = 2 , TakeItem = 3 , GiveMoney = 4 , TakeMoney = 5 , RunScript = 6 , CheckSaveFlag = 7 , SetSaveFlag = 8 , CheckInteracted = 9 , _LEGACY_Label , _LEGACY_Jump } |
Represents the different effects that nodes can have. More... | |
Public Member Functions | |
Node () | |
Creates an empty talk node. More... | |
Node (Type type) | |
Construct an empty Node of the given type. More... | |
void | setType (Type type) |
Clears node data and updates to a new type. More... | |
Type | getType () const |
Returns the type of this node. More... | |
std::string & | message () |
Returns the message or prompt for this node. More... | |
std::string & | script () |
Returns the script file of this node. More... | |
std::string & | saveFlag () |
Returns the save flag of this node. More... | |
std::vector< std::pair< std::string, std::uint32_t > > & | choices () |
Returns the choices if this is a prompt node. Undefined behavior if not. More... | |
std::uint32_t & | money () |
Returns the money requested or given, undefined behavior if not a money node. More... | |
Item & | item () |
Returns the item to give or take. Undefined behavior if not an item node. More... | |
std::uint32_t & | next () |
Returns the index of the next node in the case of a Talk, Give, and Script nodes. More... | |
std::uint32_t & | nextOnPass () |
Returns the next node if a check passes (ie take item or money) More... | |
std::uint32_t & | nextOnReject () |
Returns the next node if a check is rejected (ie not taking money or item) More... | |
const std::string & | message () const |
Returns the message or prompt for this node. More... | |
const std::string & | script () const |
Returns the script file of this node. More... | |
const std::string & | saveFlag () const |
Returns the save flag of this node. More... | |
bool & | runConcurrently () |
Returns whether or not the launched script should be executed concurrently. More... | |
bool | runConcurrently () const |
Returns whether or not the launched script should be executed concurrently. More... | |
const std::vector< std::pair< std::string, std::uint32_t > > & | choices () const |
Returns the choices if this is a prompt node. Undefined behavior if not. More... | |
unsigned int | money () const |
Returns the money requested or given, undefined behavior if not a money node. More... | |
const Item & | item () const |
Returns the item to give or take. Undefined behavior if not an item node. More... | |
std::uint32_t | next () const |
Returns the index of the next node in the case of a Talk, Give, and Script nodes. More... | |
std::uint32_t | nextOnPass () const |
Returns the next node if a check passes (ie take item or money) More... | |
std::uint32_t | nextOnReject () const |
Returns the next node if a check is rejected (ie not taking money or item) More... | |
Static Public Member Functions | |
static std::string | typeToString (Type type) |
Converts a node type to a human readable string. More... | |
Friends | |
struct | bl::serial::SerializableObject< Node > |
struct | bl::serial::SerializableObject< core::file::Conversation::Node::Item > |
Building block of conversations. A conversation is a tree of nodes and each node is an action that happens in the conversation.
Definition at line 29 of file Conversation.hpp.
enum core::file::Conversation::Node::Type : std::uint8_t |
Represents the different effects that nodes can have.
Enumerator | |
---|---|
Talk | This just outputs a message. |
Prompt | This will output a message then prompt the player for a choice. |
GiveItem | This unconditionally gives the player an item. |
TakeItem | This will ask the player for an item. They may refuse or not have it. |
GiveMoney | This will unconditionally give money to the player. |
TakeMoney | This will ask the player for money. They may refuse or not have enough. |
RunScript | This will run a script. Must be a file. |
CheckSaveFlag | This will check if a flag exists and jump to the next node accordingly. |
SetSaveFlag | This will check if a flag exists and jump to the next node accordingly. |
CheckInteracted | This will check if interacted with the talking NPC and jump accordingly. |
_LEGACY_Label | |
_LEGACY_Jump |
Definition at line 35 of file Conversation.hpp.
core::file::Conversation::Node::Node | ( | ) |
Creates an empty talk node.
Definition at line 100 of file Conversation.cpp.
core::file::Conversation::Node::Node | ( | Type | type | ) |
Construct an empty Node of the given type.
type | The type to be |
Definition at line 102 of file Conversation.cpp.
std::vector< std::pair< std::string, std::uint32_t > > & core::file::Conversation::Node::choices | ( | ) |
Returns the choices if this is a prompt node. Undefined behavior if not.
Definition at line 156 of file Conversation.cpp.
const std::vector< std::pair< std::string, std::uint32_t > > & core::file::Conversation::Node::choices | ( | ) | const |
Returns the choices if this is a prompt node. Undefined behavior if not.
Definition at line 192 of file Conversation.cpp.
Conversation::Node::Type core::file::Conversation::Node::getType | ( | ) | const |
Returns the type of this node.
Definition at line 133 of file Conversation.cpp.
Conversation::Node::Item & core::file::Conversation::Node::item | ( | ) |
Returns the item to give or take. Undefined behavior if not an item node.
Definition at line 172 of file Conversation.cpp.
const Conversation::Node::Item & core::file::Conversation::Node::item | ( | ) | const |
Returns the item to give or take. Undefined behavior if not an item node.
Definition at line 208 of file Conversation.cpp.
std::string & core::file::Conversation::Node::message | ( | ) |
Returns the message or prompt for this node.
Definition at line 135 of file Conversation.cpp.
const std::string & core::file::Conversation::Node::message | ( | ) | const |
Returns the message or prompt for this node.
Definition at line 186 of file Conversation.cpp.
std::uint32_t & core::file::Conversation::Node::money | ( | ) |
Returns the money requested or given, undefined behavior if not a money node.
Definition at line 164 of file Conversation.cpp.
unsigned int core::file::Conversation::Node::money | ( | ) | const |
Returns the money requested or given, undefined behavior if not a money node.
Definition at line 200 of file Conversation.cpp.
std::uint32_t & core::file::Conversation::Node::next | ( | ) |
Returns the index of the next node in the case of a Talk, Give, and Script nodes.
Definition at line 180 of file Conversation.cpp.
std::uint32_t core::file::Conversation::Node::next | ( | ) | const |
Returns the index of the next node in the case of a Talk, Give, and Script nodes.
Definition at line 216 of file Conversation.cpp.
std::uint32_t & core::file::Conversation::Node::nextOnPass | ( | ) |
Returns the next node if a check passes (ie take item or money)
Definition at line 182 of file Conversation.cpp.
std::uint32_t core::file::Conversation::Node::nextOnPass | ( | ) | const |
Returns the next node if a check passes (ie take item or money)
Definition at line 218 of file Conversation.cpp.
std::uint32_t & core::file::Conversation::Node::nextOnReject | ( | ) |
Returns the next node if a check is rejected (ie not taking money or item)
Definition at line 184 of file Conversation.cpp.
std::uint32_t core::file::Conversation::Node::nextOnReject | ( | ) | const |
Returns the next node if a check is rejected (ie not taking money or item)
Definition at line 220 of file Conversation.cpp.
bool & core::file::Conversation::Node::runConcurrently | ( | ) |
Returns whether or not the launched script should be executed concurrently.
Definition at line 141 of file Conversation.cpp.
bool core::file::Conversation::Node::runConcurrently | ( | ) | const |
Returns whether or not the launched script should be executed concurrently.
Definition at line 149 of file Conversation.cpp.
std::string & core::file::Conversation::Node::saveFlag | ( | ) |
Returns the save flag of this node.
Definition at line 139 of file Conversation.cpp.
const std::string & core::file::Conversation::Node::saveFlag | ( | ) | const |
Returns the save flag of this node.
Definition at line 190 of file Conversation.cpp.
std::string & core::file::Conversation::Node::script | ( | ) |
Returns the script file of this node.
Definition at line 137 of file Conversation.cpp.
const std::string & core::file::Conversation::Node::script | ( | ) | const |
Returns the script file of this node.
Definition at line 188 of file Conversation.cpp.
void core::file::Conversation::Node::setType | ( | Type | type | ) |
Clears node data and updates to a new type.
type | The type to be |
Definition at line 104 of file Conversation.cpp.
|
static |
Converts a node type to a human readable string.
type | The type to convert |
Definition at line 236 of file Conversation.cpp.
|
friend |
Definition at line 242 of file Conversation.hpp.
|
friend |
Definition at line 242 of file Conversation.hpp.