Horizon Official Technical Documentation
MonsterDB.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_MONSTERDB_HPP
31#define HORIZON_ZONE_STATICDB_MONSTERDB_HPP
33 // Linux
36#include <sol/sol.hpp>
37
38namespace Horizon
39{
40namespace Zone
41{
43{
44public:
47
49 {
50 static MonsterDatabase instance;
51 return &instance;
52 }
53
54 bool load();
55
56protected:
57 bool load_internal(sol::object const &key, sol::object const &value);
58
59 bool parse_level(sol::table const &table, monster_config_data &data);
60 bool parse_hp(sol::table const &table, monster_config_data &data);
61 bool parse_sp(sol::table const &table, monster_config_data &data);
62 bool parse_reward_base_exp(sol::table const &table, monster_config_data &data);
63 bool parse_reward_job_exp(sol::table const &table, monster_config_data &data);
64 bool parse_attack_range(sol::table const &table, monster_config_data &data);
65 bool parse_attack(sol::table const &table, monster_config_data &data);
66 bool parse_defense(sol::table const &table, monster_config_data &data);
67 bool parse_magic_defense(sol::table const &table, monster_config_data &data);
68 bool parse_view_range(sol::table const &table, monster_config_data &data);
69 bool parse_chase_range(sol::table const &table, monster_config_data &data);
70 bool parse_size(sol::table const &table, monster_config_data &data);
71 bool parse_race(sol::table const &table, monster_config_data &data);
72 bool parse_element(sol::table const &table, monster_config_data &data);
73 bool parse_mode(sol::table const &table, monster_config_data &data);
74 bool parse_move_speed(sol::table const &table, monster_config_data &data);
75 bool parse_attack_delay(sol::table const &table, monster_config_data &data);
76 bool parse_attack_motion(sol::table const &table, monster_config_data &data);
77 bool parse_damage_motion(sol::table const &table, monster_config_data &data);
78 bool parse_mvp_exp(sol::table const &table, monster_config_data &data);
79 bool parse_damage_taken_rate(sol::table const &table, monster_config_data &data);
80
81 bool parse_stats(sol::table const &table, monster_config_data &data);
82 bool parse_drops(sol::table const &table, monster_config_data &data, bool mvp);
83 bool parse_view(sol::table const &table, monster_config_data &data);
84
85
86 bool load_skill_internal(sol::object const &key, sol::object const &value);
87
88public:
89 std::shared_ptr<const monster_config_data> get_monster_by_id(uint32_t id) { return _monster_db.at(id, nullptr); }
90 std::shared_ptr<const monster_config_data> get_monster_by_name(std::string name) { return _monster_str_db.at(name); }
91
92 std::shared_ptr<std::vector<std::shared_ptr<const monster_skill_config_data>>> get_monster_skill_by_id(uint32_t monster_id) { return _monster_skill_db.at(monster_id); }
93private:
97};
98}
99}
100
101#define MonsterDB Horizon::Zone::MonsterDatabase::get_instance()
102
103#endif /* HORIZON_ZONE_STATICDB_MONSTERDB_HPP */
Definition: MonsterDB.hpp:43
bool parse_chase_range(sol::table const &table, monster_config_data &data)
Definition: MonsterDB.cpp:380
bool parse_reward_job_exp(sol::table const &table, monster_config_data &data)
Definition: MonsterDB.cpp:282
bool load_skill_internal(sol::object const &key, sol::object const &value)
Definition: MonsterDB.cpp:779
bool parse_reward_base_exp(sol::table const &table, monster_config_data &data)
Definition: MonsterDB.cpp:267
LockedLookupTable< std::string, std::shared_ptr< const monster_config_data > > _monster_str_db
Definition: MonsterDB.hpp:95
bool parse_mvp_exp(sol::table const &table, monster_config_data &data)
Definition: MonsterDB.cpp:528
std::shared_ptr< const monster_config_data > get_monster_by_id(uint32_t id)
Definition: MonsterDB.hpp:89
bool load()
Definition: MonsterDB.cpp:52
std::shared_ptr< std::vector< std::shared_ptr< const monster_skill_config_data > > > get_monster_skill_by_id(uint32_t monster_id)
Definition: MonsterDB.hpp:92
static MonsterDatabase * get_instance()
Definition: MonsterDB.hpp:48
bool parse_damage_taken_rate(sol::table const &table, monster_config_data &data)
Definition: MonsterDB.cpp:543
bool parse_move_speed(sol::table const &table, monster_config_data &data)
Definition: MonsterDB.cpp:468
bool parse_defense(sol::table const &table, monster_config_data &data)
Definition: MonsterDB.cpp:335
bool parse_hp(sol::table const &table, monster_config_data &data)
Definition: MonsterDB.cpp:237
bool parse_damage_motion(sol::table const &table, monster_config_data &data)
Definition: MonsterDB.cpp:513
LockedLookupTable< uint32_t, std::shared_ptr< const monster_config_data > > _monster_db
Definition: MonsterDB.hpp:94
bool parse_attack_delay(sol::table const &table, monster_config_data &data)
Definition: MonsterDB.cpp:483
bool parse_size(sol::table const &table, monster_config_data &data)
Definition: MonsterDB.cpp:395
bool parse_stats(sol::table const &table, monster_config_data &data)
Definition: MonsterDB.cpp:558
bool parse_element(sol::table const &table, monster_config_data &data)
Definition: MonsterDB.cpp:425
bool parse_attack_motion(sol::table const &table, monster_config_data &data)
Definition: MonsterDB.cpp:498
bool parse_race(sol::table const &table, monster_config_data &data)
Definition: MonsterDB.cpp:410
bool load_internal(sol::object const &key, sol::object const &value)
Definition: MonsterDB.cpp:106
bool parse_sp(sol::table const &table, monster_config_data &data)
Definition: MonsterDB.cpp:252
bool parse_view_range(sol::table const &table, monster_config_data &data)
Definition: MonsterDB.cpp:365
~MonsterDatabase()
Definition: MonsterDB.cpp:47
bool parse_level(sol::table const &table, monster_config_data &data)
Definition: MonsterDB.cpp:222
bool parse_view(sol::table const &table, monster_config_data &data)
Definition: MonsterDB.cpp:680
bool parse_drops(sol::table const &table, monster_config_data &data, bool mvp)
Definition: MonsterDB.cpp:615
bool parse_magic_defense(sol::table const &table, monster_config_data &data)
Definition: MonsterDB.cpp:350
bool parse_mode(sol::table const &table, monster_config_data &data)
Definition: MonsterDB.cpp:448
LockedLookupTable< uint32_t, std::shared_ptr< std::vector< std::shared_ptr< const monster_skill_config_data > > > > _monster_skill_db
Definition: MonsterDB.hpp:96
bool parse_attack(sol::table const &table, monster_config_data &data)
Definition: MonsterDB.cpp:312
bool parse_attack_range(sol::table const &table, monster_config_data &data)
Definition: MonsterDB.cpp:297
std::shared_ptr< const monster_config_data > get_monster_by_name(std::string name)
Definition: MonsterDB.hpp:90
MonsterDatabase()
Definition: MonsterDB.cpp:42
Definition: LockedLookupTable.hpp:44
Value at(Key const &key, Value const &default_value=Value()) const
Definition: LockedLookupTable.hpp:63
Definition: Element.hpp:7
Definition: MonsterDefinitions.hpp:203