Peoplemon  0.1.0
Peoplemon 3 game source documentation
Public Member Functions | Public Attributes | List of all members
core::file::Trainer Struct Reference

Static data for trainers in the world. More...

#include <Trainer.hpp>

Public Member Functions

 Trainer ()
 Gives sane defaults. More...
 
bool save (const std::string &file) const
 Saves the trainer data to the given file. More...
 
bool saveBundle (bl::serial::binary::OutputStream &output, bl::resource::bundle::FileHandlerContext &ctx) const
 Saves the data from this object to the given bundle and registers depency files if any. More...
 
bool load (const std::string &file, bl::tmap::Direction spawnDir=bl::tmap::Direction::Down)
 Loads the trainer data from the given file. More...
 
bool loadDev (std::istream &input)
 Loads the trainer from the json stream. More...
 
bool loadProd (bl::serial::binary::InputStream &input)
 Loads the trainer from it's binary format. More...
 

Public Attributes

std::string name
 
std::string animation
 
std::string prebattleConversation
 
std::string postBattleConversation
 
std::string lostBattleLine
 
std::uint8_t visionRange
 
Behavior behavior
 
std::vector< pplmn::OwnedPeoplemonpeoplemon
 
std::vector< item::Iditems
 
std::uint8_t payout
 
std::string sourceFile
 

Detailed Description

Static data for trainers in the world.

Definition at line 20 of file Trainer.hpp.

Constructor & Destructor Documentation

◆ Trainer()

core::file::Trainer::Trainer ( )

Gives sane defaults.

Definition at line 11 of file Trainer.cpp.

Member Function Documentation

◆ load()

bool core::file::Trainer::load ( const std::string &  file,
bl::tmap::Direction  spawnDir = bl::tmap::Direction::Down 
)

Loads the trainer data from the given file.

Parameters
fileThe file to load from
spawnDirThe direction to put in the standing behavior on load
Returns
True on load, false on error

Definition at line 43 of file Trainer.cpp.

◆ loadDev()

bool core::file::Trainer::loadDev ( std::istream &  input)

Loads the trainer from the json stream.

Parameters
inputJSON input stream
Returns
True if the trainer could be loaded, false on error

Definition at line 56 of file Trainer.cpp.

◆ loadProd()

bool core::file::Trainer::loadProd ( bl::serial::binary::InputStream &  input)

Loads the trainer from it's binary format.

Parameters
inputThe input stream to load from
Returns
True if the trainer could be loaded, false otherwise

Definition at line 52 of file Trainer.cpp.

◆ save()

bool core::file::Trainer::save ( const std::string &  file) const

Saves the trainer data to the given file.

Parameters
fileThe file to save to
Returns
True on save, false on error

Definition at line 14 of file Trainer.cpp.

◆ saveBundle()

bool core::file::Trainer::saveBundle ( bl::serial::binary::OutputStream &  output,
bl::resource::bundle::FileHandlerContext &  ctx 
) const

Saves the data from this object to the given bundle and registers depency files if any.

Parameters
outputStream to output to
ctxContext to register dependencies with
Returns
True if serialization succeeded, false otherwise

Definition at line 19 of file Trainer.cpp.

Member Data Documentation

◆ animation

std::string core::file::Trainer::animation

Definition at line 72 of file Trainer.hpp.

◆ behavior

Behavior core::file::Trainer::behavior

Definition at line 77 of file Trainer.hpp.

◆ items

std::vector<item::Id> core::file::Trainer::items

Definition at line 79 of file Trainer.hpp.

◆ lostBattleLine

std::string core::file::Trainer::lostBattleLine

Definition at line 75 of file Trainer.hpp.

◆ name

std::string core::file::Trainer::name

Definition at line 71 of file Trainer.hpp.

◆ payout

std::uint8_t core::file::Trainer::payout

Definition at line 80 of file Trainer.hpp.

◆ peoplemon

std::vector<pplmn::OwnedPeoplemon> core::file::Trainer::peoplemon

Definition at line 78 of file Trainer.hpp.

◆ postBattleConversation

std::string core::file::Trainer::postBattleConversation

Definition at line 74 of file Trainer.hpp.

◆ prebattleConversation

std::string core::file::Trainer::prebattleConversation

Definition at line 73 of file Trainer.hpp.

◆ sourceFile

std::string core::file::Trainer::sourceFile

Definition at line 83 of file Trainer.hpp.

◆ visionRange

std::uint8_t core::file::Trainer::visionRange

Definition at line 76 of file Trainer.hpp.


The documentation for this struct was generated from the following files: