diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-20 14:33:09 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-20 14:33:09 +1000 |
commit | 6352e8e3196f78388b6c771073f9e03eaa612673 (patch) | |
tree | e23772f79a7fbc41bc9108951e9e136857484bf4 /source/game/StarCollectionDatabase.hpp | |
parent | 6741a057e5639280d85d0f88ba26f000baa58f61 (diff) |
everything everywhere
all at once
Diffstat (limited to 'source/game/StarCollectionDatabase.hpp')
-rw-r--r-- | source/game/StarCollectionDatabase.hpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/source/game/StarCollectionDatabase.hpp b/source/game/StarCollectionDatabase.hpp new file mode 100644 index 0000000..23d241c --- /dev/null +++ b/source/game/StarCollectionDatabase.hpp @@ -0,0 +1,62 @@ +#ifndef STAR_COLLECTION_DATABASE_HPP +#define STAR_COLLECTION_DATABASE_HPP + +#include "StarGameTypes.hpp" +#include "StarJson.hpp" + +namespace Star { + +STAR_EXCEPTION(CollectionDatabaseException, StarException); + +STAR_CLASS(CollectionDatabase); + +enum class CollectionType : uint16_t { + Generic, + Item, + Monster +}; +extern EnumMap<CollectionType> const CollectionTypeNames; + +struct Collectable { + Collectable(); + Collectable(String const& name, int order, String const& title, String const& description, String const& icon); + + String name; + int order; + String title; + String description; + String icon; +}; + +struct Collection { + Collection(); + Collection(String const& name, CollectionType type, String const& icon); + + String name; + String title; + CollectionType type; +}; + +class CollectionDatabase { +public: + CollectionDatabase(); + + List<Collection> collections() const; + Collection collection(String const& collectionName) const; + List<Collectable> collectables(String const& collectionName) const; + Collectable collectable(String const& collectionName, String const& collectableName) const; + + bool hasCollectable(String const& collectionName, String const& collectableName) const; + +private: + Collectable parseGenericCollectable(String const& name, Json const& config) const; + Collectable parseMonsterCollectable(String const& name, Json const& config) const; + Collectable parseItemCollectable(String const& name, Json const& config) const; + + StringMap<Collection> m_collections; + StringMap<StringMap<Collectable>> m_collectables; +}; + + +} +#endif
\ No newline at end of file |