Horizon Official Technical Documentation
StatusEffectDB.hpp
Go to the documentation of this file.
1 /***************************************************
2 * _ _ _ *
3 * | | | | (_) *
4 * | |_| | ___ _ __ _ _______ _ __ *
5 * | _ |/ _ \| '__| |_ / _ \| '_ \ *
6 * | | | | (_) | | | |/ / (_) | | | | *
7 * \_| |_/\___/|_| |_/___\___/|_| |_| *
8 ***************************************************
9 * This file is part of Horizon (c).
10 *
11 * Copyright (c) 2019 Sagun K. (sagunxp@gmail.com).
12 * Copyright (c) 2019 Horizon Dev Team.
13 *
14 * Base Author - Sagun K. (sagunxp@gmail.com)
15 *
16 * This library is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation, either version 3 of the License, or
19 * (at your option) any later version.
20 *
21 * This library is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this library. If not, see <http://www.gnu.org/licenses/>.
28 **************************************************/
29
30#ifndef HORIZON_ZONE_STATICDB_STATUSEFFECTDB_HPP
31#define HORIZON_ZONE_STATICDB_STATUSEFFECTDB_HPP
32
34#include <cinttypes>
35#include <string>
36#include <sol/sol.hpp>
37
38namespace Horizon
39{
40namespace Zone
41{
43{
44 int32_t status_id{0};
45 std::string name{""};
46 int32_t behavior{0};
47 std::string icon{""};
48 bool visible{true};
50};
52{
53public:
56
58 {
59 static StatusEffectDatabase instance;
60 return &instance;
61 }
62
63 bool load();
64
65protected:
66 bool load_internal(sol::object const &key, sol::object const &value);
67
68public:
69 std::shared_ptr<const status_effect_config_data> get_status_effect_by_id(int32_t id) { return _status_effect_db.at(id); }
70
71private:
73};
74}
75}
76
77#define StatusEffectDB Horizon::Zone::StatusEffectDatabase::get_instance()
78
79#endif /* HORIZON_ZONE_STATICDB_STATUSEFFECTDB_HPP */
Definition: StatusEffectDB.hpp:52
StatusEffectDatabase()
Definition: StatusEffectDB.cpp:37
LockedLookupTable< uint32_t, std::shared_ptr< const status_effect_config_data > > _status_effect_db
Definition: StatusEffectDB.hpp:72
std::shared_ptr< const status_effect_config_data > get_status_effect_by_id(int32_t id)
Definition: StatusEffectDB.hpp:69
bool load()
Definition: StatusEffectDB.cpp:47
~StatusEffectDatabase()
Definition: StatusEffectDB.cpp:42
static StatusEffectDatabase * get_instance()
Definition: StatusEffectDB.hpp:57
bool load_internal(sol::object const &key, sol::object const &value)
Definition: StatusEffectDB.cpp:80
Definition: LockedLookupTable.hpp:44
Definition: Element.hpp:7
Definition: StatusEffectDB.hpp:43
std::string on_start_script
Definition: StatusEffectDB.hpp:49
int32_t behavior
Definition: StatusEffectDB.hpp:46
bool visible
Definition: StatusEffectDB.hpp:48
std::string icon
Definition: StatusEffectDB.hpp:47
std::string on_end_script
Definition: StatusEffectDB.hpp:49
std::string name
Definition: StatusEffectDB.hpp:45
int32_t status_id
Definition: StatusEffectDB.hpp:44
std::string per_second_script
Definition: StatusEffectDB.hpp:49