1 #ifndef CORE_FILES_TRAINER_HPP
2 #define CORE_FILES_TRAINER_HPP
4 #include <BLIB/Resources.hpp>
5 #include <BLIB/Serialization.hpp>
34 bool save(
const std::string& file)
const;
43 bool saveBundle(bl::serial::binary::OutputStream& output,
44 bl::resource::bundle::FileHandlerContext& ctx)
const;
53 bool load(
const std::string& file, bl::tmap::Direction spawnDir = bl::tmap::Direction::Down);
61 bool loadDev(std::istream& input);
69 bool loadProd(bl::serial::binary::InputStream& input);
94 struct SerializableObject<
core::file::Trainer> :
public SerializableObjectBase {
98 SerializableField<1, T, std::string>
name;
99 SerializableField<2, T, std::string>
anim;
103 SerializableField<6, T, std::uint8_t>
range;
104 SerializableField<7, T, core::file::Behavior>
behavior;
106 SerializableField<9, T, std::vector<core::item::Id>>
items;
107 SerializableField<10, T, std::uint8_t>
payout;
110 : SerializableObjectBase(
"Trainer")
111 , name(
"name", *this, &
T::name, SerializableFieldBase::Required{})
112 , anim(
"anim", *this, &
T::animation, SerializableFieldBase::Required{})
113 , preBattle(
"preBattle", *this, &
T::prebattleConversation, SerializableFieldBase::Required{})
114 , postBattle(
"postBattle", *this, &
T::postBattleConversation, SerializableFieldBase::Required{})
115 , loseBattleLine(
"loseLine", *this, &
T::lostBattleLine, SerializableFieldBase::Required{})
116 , range(
"range", *this, &
T::visionRange, SerializableFieldBase::Required{})
117 , behavior(
"behavior", *this, &
T::behavior, SerializableFieldBase::Required{})
118 , peoplemon(
"peoplemon", *this, &
T::peoplemon, SerializableFieldBase::Required{})
119 , items(
"items", *this, &
T::items, SerializableFieldBase::Required{})
120 , payout(
"payout", *this, &
T::payout, SerializableFieldBase::Optional{}) {
121 payout.setDefault(40);
Core classes and functionality for both the editor and game.
Set of behaviors for NPCs and trainers.
Static data for trainers in the world.
std::string lostBattleLine
std::vector< pplmn::OwnedPeoplemon > peoplemon
bool loadDev(std::istream &input)
Loads the trainer from the json stream.
std::string postBattleConversation
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.
std::vector< item::Id > items
bool save(const std::string &file) const
Saves the trainer data to the given file.
bool loadProd(bl::serial::binary::InputStream &input)
Loads the trainer from it's binary format.
bool load(const std::string &file, bl::tmap::Direction spawnDir=bl::tmap::Direction::Down)
Loads the trainer data from the given file.
Trainer()
Gives sane defaults.
std::string prebattleConversation
SerializableField< 9, T, std::vector< core::item::Id > > items
SerializableField< 6, T, std::uint8_t > range
SerializableField< 10, T, std::uint8_t > payout
SerializableField< 1, T, std::string > name
SerializableField< 3, T, std::string > preBattle
SerializableField< 8, T, std::vector< Ppl > > peoplemon
SerializableField< 4, T, std::string > postBattle
SerializableField< 7, T, core::file::Behavior > behavior
SerializableField< 2, T, std::string > anim
SerializableField< 5, T, std::string > loseBattleLine
Represents an instance of a peoplemon. Can be a wild peoplemon, trainer, or player peoplemon....