Peoplemon  0.1.0
Peoplemon 3 game source documentation
MoveDB.hpp
Go to the documentation of this file.
1 #ifndef CORE_FILE_MOVEDB_HPP
2 #define CORE_FILE_MOVEDB_HPP
3 
4 #include <BLIB/Resources.hpp>
5 #include <BLIB/Serialization.hpp>
6 #include <BLIB/Util/NonCopyable.hpp>
10 #include <cstdint>
11 
12 namespace core
13 {
14 namespace file
15 {
22 struct MoveDB : private bl::util::NonCopyable {
28  bool load();
29 
36  bool loadDev(std::istream& input);
37 
44  bool loadProd(bl::serial::binary::InputStream& input);
45 
51  bool save() const;
52 
60  bool saveBundle(bl::serial::binary::OutputStream& output,
61  bl::resource::bundle::FileHandlerContext& ctx) const;
62 
63  std::unordered_map<pplmn::MoveId, std::string> names;
64  std::unordered_map<pplmn::MoveId, std::string> descriptions;
65  std::unordered_map<pplmn::MoveId, pplmn::Type> types;
66  std::unordered_map<pplmn::MoveId, std::int32_t> damages;
67  std::unordered_map<pplmn::MoveId, std::int32_t> accuracies;
68  std::unordered_map<pplmn::MoveId, std::int32_t> priorities;
69  std::unordered_map<pplmn::MoveId, std::uint32_t> pps;
70  std::unordered_map<pplmn::MoveId, bool> contactors;
71  std::unordered_map<pplmn::MoveId, bool> specials;
72  std::unordered_map<pplmn::MoveId, pplmn::MoveEffect> effects;
73  std::unordered_map<pplmn::MoveId, std::int32_t> effectChances;
74  std::unordered_map<pplmn::MoveId, std::int32_t> effectIntensities;
75  std::unordered_map<pplmn::MoveId, bool> effectSelves;
76 };
77 
78 } // namespace file
79 } // namespace core
80 
81 namespace bl
82 {
83 namespace serial
84 {
85 template<>
86 struct SerializableObject<core::file::MoveDB> : public SerializableObjectBase {
89 
90  SerializableField<1, DB, std::unordered_map<Id, std::string>> names;
91  SerializableField<2, DB, std::unordered_map<Id, std::string>> descriptions;
92  SerializableField<4, DB, std::unordered_map<Id, core::pplmn::Type>> types;
93  SerializableField<5, DB, std::unordered_map<Id, std::int32_t>> damages;
94  SerializableField<6, DB, std::unordered_map<Id, std::int32_t>> accuracies;
95  SerializableField<7, DB, std::unordered_map<Id, std::int32_t>> priorities;
96  SerializableField<8, DB, std::unordered_map<Id, std::uint32_t>> pps;
97  SerializableField<9, DB, std::unordered_map<Id, bool>> contactors;
98  SerializableField<10, DB, std::unordered_map<Id, bool>> specials;
99  SerializableField<11, DB, std::unordered_map<Id, core::pplmn::MoveEffect>> effects;
100  SerializableField<12, DB, std::unordered_map<Id, std::int32_t>> effectChances;
101  SerializableField<13, DB, std::unordered_map<Id, std::int32_t>> effectIntensities;
102  SerializableField<14, DB, std::unordered_map<Id, bool>> effectSelves;
103 
105  : SerializableObjectBase("MoveDB")
106  , names("names", *this, &DB::names, SerializableFieldBase::Required{})
107  , descriptions("descriptions", *this, &DB::descriptions, SerializableFieldBase::Required{})
108  , types("types", *this, &DB::types, SerializableFieldBase::Required{})
109  , damages("damages", *this, &DB::damages, SerializableFieldBase::Required{})
110  , accuracies("accs", *this, &DB::accuracies, SerializableFieldBase::Required{})
111  , priorities("prioties", *this, &DB::priorities, SerializableFieldBase::Required{})
112  , pps("pps", *this, &DB::pps, SerializableFieldBase::Required{})
113  , contactors("contactors", *this, &DB::contactors, SerializableFieldBase::Required{})
114  , specials("specials", *this, &DB::specials, SerializableFieldBase::Required{})
115  , effects("effects", *this, &DB::effects, SerializableFieldBase::Required{})
116  , effectChances("effectChances", *this, &DB::effectChances, SerializableFieldBase::Required{})
117  , effectIntensities("effectIntensities", *this, &DB::effectIntensities,
118  SerializableFieldBase::Required{})
119  , effectSelves("effectSelves", *this, &DB::effectSelves, SerializableFieldBase::Required{}) {}
120 };
121 
122 } // namespace serial
123 } // namespace bl
124 
125 #endif
MoveId
The id of a move.
Definition: MoveId.hpp:16
Core classes and functionality for both the editor and game.
Stores the metadata of all peoplemon moves.
Definition: MoveDB.hpp:22
std::unordered_map< pplmn::MoveId, bool > specials
Definition: MoveDB.hpp:71
std::unordered_map< pplmn::MoveId, bool > contactors
Definition: MoveDB.hpp:70
bool loadProd(bl::serial::binary::InputStream &input)
Loads the database from its json format.
Definition: MoveDB.cpp:18
std::unordered_map< pplmn::MoveId, std::int32_t > damages
Definition: MoveDB.hpp:66
std::unordered_map< pplmn::MoveId, std::uint32_t > pps
Definition: MoveDB.hpp:69
std::unordered_map< pplmn::MoveId, std::int32_t > accuracies
Definition: MoveDB.hpp:67
std::unordered_map< pplmn::MoveId, std::string > descriptions
Definition: MoveDB.hpp:64
std::unordered_map< pplmn::MoveId, std::int32_t > effectChances
Definition: MoveDB.hpp:73
std::unordered_map< pplmn::MoveId, std::int32_t > priorities
Definition: MoveDB.hpp:68
std::unordered_map< pplmn::MoveId, pplmn::MoveEffect > effects
Definition: MoveDB.hpp:72
bool load()
Loads the moves from the data file.
Definition: MoveDB.cpp:12
std::unordered_map< pplmn::MoveId, std::int32_t > effectIntensities
Definition: MoveDB.hpp:74
bool loadDev(std::istream &input)
Loads the database from its json format.
Definition: MoveDB.cpp:14
bool save() const
Saves the moves to the data file.
Definition: MoveDB.cpp:22
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.
Definition: MoveDB.cpp:27
std::unordered_map< pplmn::MoveId, std::string > names
Definition: MoveDB.hpp:63
std::unordered_map< pplmn::MoveId, pplmn::Type > types
Definition: MoveDB.hpp:65
std::unordered_map< pplmn::MoveId, bool > effectSelves
Definition: MoveDB.hpp:75
SerializableField< 6, DB, std::unordered_map< Id, std::int32_t > > accuracies
Definition: MoveDB.hpp:94
SerializableField< 2, DB, std::unordered_map< Id, std::string > > descriptions
Definition: MoveDB.hpp:91
SerializableField< 1, DB, std::unordered_map< Id, std::string > > names
Definition: MoveDB.hpp:90
SerializableField< 12, DB, std::unordered_map< Id, std::int32_t > > effectChances
Definition: MoveDB.hpp:100
SerializableField< 5, DB, std::unordered_map< Id, std::int32_t > > damages
Definition: MoveDB.hpp:93
SerializableField< 11, DB, std::unordered_map< Id, core::pplmn::MoveEffect > > effects
Definition: MoveDB.hpp:99
SerializableField< 8, DB, std::unordered_map< Id, std::uint32_t > > pps
Definition: MoveDB.hpp:96
SerializableField< 4, DB, std::unordered_map< Id, core::pplmn::Type > > types
Definition: MoveDB.hpp:92
SerializableField< 14, DB, std::unordered_map< Id, bool > > effectSelves
Definition: MoveDB.hpp:102
SerializableField< 7, DB, std::unordered_map< Id, std::int32_t > > priorities
Definition: MoveDB.hpp:95
SerializableField< 10, DB, std::unordered_map< Id, bool > > specials
Definition: MoveDB.hpp:98
SerializableField< 13, DB, std::unordered_map< Id, std::int32_t > > effectIntensities
Definition: MoveDB.hpp:101
SerializableField< 9, DB, std::unordered_map< Id, bool > > contactors
Definition: MoveDB.hpp:97