Horizon Official Technical Documentation
Horizon::Zone::SkillDatabase Class Reference

#include <SkillDB.hpp>

+ Collaboration diagram for Horizon::Zone::SkillDatabase:

Public Member Functions

 SkillDatabase ()
 
 ~SkillDatabase ()
 
bool load ()
 
std::shared_ptr< const skill_config_dataget_skill_by_id (int32_t id)
 
std::shared_ptr< const skill_config_dataget_skill_by_name (std::string name)
 
std::vector< std::shared_ptr< const skill_tree_config > > get_skill_tree_by_job_id (job_class_type job_id)
 
std::shared_ptr< const skill_tree_configget_skill_tree_skill_id_by_job_id (job_class_type job_id, int16_t skill_id)
 

Static Public Member Functions

static SkillDatabaseget_instance ()
 

Protected Member Functions

bool load_internal_skill_db (sol::object const &key, sol::object const &value)
 
bool load_internal_skill_tree (sol::object const &key, sol::object const &value)
 
bool parse_range (sol::table const &table, skill_config_data &data)
 
bool parse_hit (sol::table const &table, skill_config_data &data)
 
bool parse_skill_type (sol::table const &table, skill_config_data &data)
 
bool parse_skill_info (sol::table const &table, skill_config_data &data)
 
bool parse_attack_type (sol::table const &table, skill_config_data &data)
 
bool parse_element (sol::table const &table, skill_config_data &data)
 
bool parse_damage_type (sol::table const &table, skill_config_data &data)
 
bool parse_splash_range (sol::table const &table, skill_config_data &data)
 
bool parse_number_of_hits (sol::table const &table, skill_config_data &data)
 
bool parse_interrupt_cast (sol::table const &table, skill_config_data &data)
 
bool parse_cast_defense_rate (sol::table const &table, skill_config_data &data)
 
bool parse_max_skill_instances (sol::table const &table, skill_config_data &data)
 
bool parse_knock_back_tiles (sol::table const &table, skill_config_data &data)
 
bool parse_cast_time (sol::table const &table, skill_config_data &data)
 
bool parse_after_cast_act_delay (sol::table const &table, skill_config_data &data)
 
bool parse_after_cast_walk_delay (sol::table const &table, skill_config_data &data)
 
bool parse_skill_data1 (sol::table const &table, skill_config_data &data)
 
bool parse_skill_data2 (sol::table const &table, skill_config_data &data)
 
bool parse_cooldown (sol::table const &table, skill_config_data &data)
 
bool parse_fixed_cast_time (sol::table const &table, skill_config_data &data)
 
bool parse_cast_time_options (sol::table const &table, skill_config_data &data)
 
bool parse_skill_delay_options (sol::table const &table, skill_config_data &data)
 
bool parse_requirements (sol::table const &table, skill_config_data &data)
 
bool parse_req_hp_cost (sol::table const &table, skill_config_data &data)
 
bool parse_req_sp_cost (sol::table const &table, skill_config_data &data)
 
bool parse_req_hp_rate_cost (sol::table const &table, skill_config_data &data)
 
bool parse_req_sp_rate_cost (sol::table const &table, skill_config_data &data)
 
bool parse_req_max_hp_trigger (sol::table const &table, skill_config_data &data)
 
bool parse_req_max_sp_trigger (sol::table const &table, skill_config_data &data)
 
bool parse_req_zeny_cost (sol::table const &table, skill_config_data &data)
 
bool parse_req_weapon_types (sol::table const &table, skill_config_data &data)
 
bool parse_req_ammunition_type (sol::table const &table, skill_config_data &data)
 
bool parse_req_ammunition_cost (sol::table const &table, skill_config_data &data)
 
bool parse_req_state (sol::table const &table, skill_config_data &data)
 
bool parse_req_spirit_sphere_cost (sol::table const &table, skill_config_data &data)
 
bool parse_req_items (sol::table const &table, skill_config_data &data, bool equips)
 
bool parse_placement (sol::table const &table, skill_config_data &data)
 
bool parse_placement_id (sol::table const &table, skill_config_data &data)
 
bool parse_placement_layout (sol::table const &table, skill_config_data &data)
 
bool parse_placement_range (sol::table const &table, skill_config_data &data)
 
bool parse_placement_interval (sol::table const &table, skill_config_data &data)
 
bool parse_placement_target (sol::table const &table, skill_config_data &data)
 
bool parse_placement_flag (sol::table const &table, skill_config_data &data)
 
template<typename T >
void fill_lvl_range (T *setting, T value)
 

Private Attributes

LockedLookupTable< uint32_t, std::shared_ptr< const skill_config_data > > _skill_db
 
LockedLookupTable< std::string, std::shared_ptr< const skill_config_data > > _skill_str_db
 
LockedLookupTable< job_class_type, std::vector< std::shared_ptr< const skill_tree_config > > > _skill_tree_db
 

Constructor & Destructor Documentation

◆ SkillDatabase()

SkillDatabase::SkillDatabase ( )
44{
45 //
46}

◆ ~SkillDatabase()

SkillDatabase::~SkillDatabase ( )
49{
50 //
51}

Member Function Documentation

◆ fill_lvl_range()

◆ get_instance()

static SkillDatabase * Horizon::Zone::SkillDatabase::get_instance ( )
inlinestatic
51 {
52 static SkillDatabase instance;
53 return &instance;
54 }
SkillDatabase()
Definition: SkillDB.cpp:43

◆ get_skill_by_id()

std::shared_ptr< const skill_config_data > Horizon::Zone::SkillDatabase::get_skill_by_id ( int32_t  id)
inline
112{ return _skill_db.at(id); }
LockedLookupTable< uint32_t, std::shared_ptr< const skill_config_data > > _skill_db
Definition: SkillDB.hpp:131
Value at(Key const &key, Value const &default_value=Value()) const
Definition: LockedLookupTable.hpp:63

References _skill_db, and LockedLookupTable< Key, Value, Hash >::at().

Referenced by load_internal_skill_tree().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_skill_by_name()

std::shared_ptr< const skill_config_data > Horizon::Zone::SkillDatabase::get_skill_by_name ( std::string  name)
inline
113{ return _skill_str_db.at(name); }
LockedLookupTable< std::string, std::shared_ptr< const skill_config_data > > _skill_str_db
Definition: SkillDB.hpp:132

References _skill_str_db, and LockedLookupTable< Key, Value, Hash >::at().

Referenced by load_internal_skill_tree().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_skill_tree_by_job_id()

std::vector< std::shared_ptr< const skill_tree_config > > Horizon::Zone::SkillDatabase::get_skill_tree_by_job_id ( job_class_type  job_id)
inline
116 {
117 return _skill_tree_db.at(job_id, std::vector<std::shared_ptr<const skill_tree_config>>());
118 }
LockedLookupTable< job_class_type, std::vector< std::shared_ptr< const skill_tree_config > > > _skill_tree_db
Definition: SkillDB.hpp:133

References _skill_tree_db, and LockedLookupTable< Key, Value, Hash >::at().

Referenced by get_skill_tree_skill_id_by_job_id().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_skill_tree_skill_id_by_job_id()

std::shared_ptr< const skill_tree_config > Horizon::Zone::SkillDatabase::get_skill_tree_skill_id_by_job_id ( job_class_type  job_id,
int16_t  skill_id 
)
inline
121 {
122 for (auto stc : get_skill_tree_by_job_id(job_id)) {
123 if (stc->skill_id == skill_id)
124 return stc;
125 }
126
127 return nullptr;
128 }
std::vector< std::shared_ptr< const skill_tree_config > > get_skill_tree_by_job_id(job_class_type job_id)
Definition: SkillDB.hpp:115

References get_skill_tree_by_job_id().

+ Here is the call graph for this function:

◆ load()

bool SkillDatabase::load ( )

Skill DB

Skill Tree DB

54{
55 std::shared_ptr<sol::state> lua = std::make_shared<sol::state>();
56
57 lua->open_libraries(sol::lib::base);
58 lua->open_libraries(sol::lib::package);
59
60 std::shared_ptr<CombatComponent> combat_component = std::make_shared<CombatComponent>();
61 std::shared_ptr<ItemComponent> item_component = std::make_shared<ItemComponent>();
62 std::shared_ptr<SkillComponent> skill_component = std::make_shared<SkillComponent>();
63 std::shared_ptr<UnitComponent> unit_component = std::make_shared<UnitComponent>();
64
65 combat_component->sync_definitions(lua);
66 combat_component->sync_data_types(lua);
67 combat_component->sync_functions(lua);
68
69 item_component->sync_definitions(lua);
70 item_component->sync_data_types(lua);
71 item_component->sync_functions(lua);
72
73 skill_component->sync_definitions(lua);
74 skill_component->sync_data_types(lua);
75 skill_component->sync_functions(lua);
76
77 unit_component->sync_definitions(lua);
78 unit_component->sync_data_types(lua);
79 unit_component->sync_functions(lua);
80
84 try {
85 int total_entries = 0;
86 std::string file_path = sZone->config().get_static_db_path().string() + "skill_db.lua";
87 sol::load_result fx = lua->load_file(file_path);
88 sol::table status_tbl = fx();
89 status_tbl.for_each([this, &total_entries] (sol::object const &key, sol::object const &value) {
90 total_entries += load_internal_skill_db(key, value) ? 1 : 0;
91 });
92 HLog(info) << "Loaded " << total_entries << " entries from '" << file_path << "'.";
93 } catch (sol::error &e) {
94 HLog(error) << "SkillDB::load: " << e.what();
95 return false;
96 }
97
101 try {
102 int total_entries = 0;
103 std::string file_path = sZone->config().get_static_db_path().string() + "skill_tree_db.lua";
104 sol::load_result fx = lua->load_file(file_path);
105 sol::table skill_tree_tbl = fx();
106 skill_tree_tbl.for_each([this, &total_entries] (sol::object const &key, sol::object const &value) {
107 total_entries += load_internal_skill_tree(key, value) ? 1 : 0;
108 });
109 HLog(info) << "Loaded " << total_entries << " entries from '" << file_path << "'.";
110 } catch(const std::exception &e) {
111 HLog(error) << "SkillDB::load: error loading skill_tree_db: " << e.what();
112 return false;
113 }
114
115 return true;
116}
#define HLog(type)
Definition: Logger.hpp:122
#define sZone
Definition: Zone.hpp:247
bool load_internal_skill_db(sol::object const &key, sol::object const &value)
Definition: SkillDB.cpp:118
bool load_internal_skill_tree(sol::object const &key, sol::object const &value)
Definition: SkillDB.cpp:2093

References HLog, load_internal_skill_db(), load_internal_skill_tree(), and sZone.

+ Here is the call graph for this function:

◆ load_internal_skill_db()

bool SkillDatabase::load_internal_skill_db ( sol::object const &  key,
sol::object const &  value 
)
protected
119{
121
122 sol::table stbl = tvalue.as<sol::table>();
123
124 // ------------------------------ Mandatory Fields ----------------------------
125 data.name = key.as<std::string>();
126 data.skill_id = stbl.get_or<uint16_t>("Id", 0);
127
128 if (data.skill_id == 0) {
129 HLog(warning) << "Skill ID for '" << data.name << "' was 0... skipping...";
130 return false;
131 }
132
133 if (data.skill_id > MAX_SKILL_ID) {
134 HLog(warning) << "Skill ID for '" << data.name << "' exceeds maximum " << MAX_SKILL_ID << "... skipping.";
135 return false;
136 }
137
138 data.max_level = stbl.get_or("MaxLevel", 0);
139
140 if (data.max_level == 0) {
141 HLog(warning) << "Max Level for '" << data.name << "' was 0... skipping...";
142 return false;
143 }
144
145 // ------------------------------ Optional Fields -----------------------------
146
147 data.desc = stbl.get_or<std::string>("Description", "");
148
149 if (parse_range(stbl, data) == false)
150 return false;
151
152 if (parse_hit(stbl, data) == false)
153 return false;
154
155 if (parse_skill_type(stbl, data) == false)
156 return false;
157
158 if (parse_skill_info(stbl, data) == false)
159 return false;
160
161 if (parse_attack_type(stbl, data) == false)
162 return false;
163
164 if (parse_element(stbl, data) == false)
165 return false;
166
167 if (parse_damage_type(stbl, data) == false)
168 return false;
169
170 if (parse_splash_range(stbl, data) == false)
171 return false;
172
173 if (parse_number_of_hits(stbl, data) == false)
174 return false;
175
176 if (parse_interrupt_cast(stbl, data) == false)
177 return false;
178
179 if (parse_cast_defense_rate(stbl, data) == false)
180 return false;
181
182 if (parse_max_skill_instances(stbl, data) == false)
183 return false;
184
185 if (parse_knock_back_tiles(stbl, data) == false)
186 return false;
187
188 if (parse_cast_time(stbl, data) == false)
189 return false;
190
191 if (parse_after_cast_act_delay(stbl, data) == false)
192 return false;
193
194 if (parse_after_cast_walk_delay(stbl, data) == false)
195 return false;
196
197 if (parse_skill_data1(stbl, data) == false)
198 return false;
199
200 if (parse_skill_data2(stbl, data) == false)
201 return false;
202
203 if (parse_cooldown(stbl, data) == false)
204 return false;
205
206 if (parse_fixed_cast_time(stbl, data) == false)
207 return false;
208
209 if (parse_cast_time_options(stbl, data) == false)
210 return false;
211
212 if (parse_skill_delay_options(stbl, data) == false)
213 return false;
214
215 if (parse_requirements(stbl, data) == false)
216 return false;
217
218 if (parse_placement(stbl, data) == false)
219 return false;
220
221 _skill_db.insert(data.skill_id, std::make_shared<skill_config_data>(data));
222 _skill_str_db.insert(data.name, std::make_shared<skill_config_data>(data));
223
224 return true;
225}
#define MAX_SKILL_ID
Max used Skill ID.
Definition: SkillDefinitions.hpp:52
bool parse_interrupt_cast(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:607
bool parse_cast_time(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:771
bool parse_max_skill_instances(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:689
bool parse_skill_data2(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:935
bool parse_cast_time_options(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:1058
bool parse_skill_info(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:369
bool parse_element(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:441
bool parse_skill_delay_options(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:1106
bool parse_after_cast_walk_delay(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:853
bool parse_after_cast_act_delay(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:812
bool parse_requirements(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:1154
bool parse_placement(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:1814
bool parse_cast_defense_rate(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:648
bool parse_fixed_cast_time(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:1017
bool parse_range(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:227
bool parse_hit(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:270
bool parse_number_of_hits(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:566
bool parse_skill_type(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:340
bool parse_attack_type(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:398
bool parse_cooldown(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:976
bool parse_skill_data1(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:894
bool parse_splash_range(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:525
bool parse_damage_type(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:483
bool parse_knock_back_tiles(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:730
void insert(const Key &key, const Value &value)
Definition: LockedLookupTable.hpp:68
Definition: SkillDefinitions.hpp:279
std::string name
Definition: SkillDefinitions.hpp:281
int max_level
Definition: SkillDefinitions.hpp:282
std::string desc
Definition: SkillDefinitions.hpp:281
uint16_t skill_id
Definition: SkillDefinitions.hpp:280

References _skill_db, _skill_str_db, skill_config_data::desc, HLog, LockedLookupTable< Key, Value, Hash >::insert(), skill_config_data::max_level, MAX_SKILL_ID, skill_config_data::name, parse_after_cast_act_delay(), parse_after_cast_walk_delay(), parse_attack_type(), parse_cast_defense_rate(), parse_cast_time(), parse_cast_time_options(), parse_cooldown(), parse_damage_type(), parse_element(), parse_fixed_cast_time(), parse_hit(), parse_interrupt_cast(), parse_knock_back_tiles(), parse_max_skill_instances(), parse_number_of_hits(), parse_placement(), parse_range(), parse_requirements(), parse_skill_data1(), parse_skill_data2(), parse_skill_delay_options(), parse_skill_info(), parse_skill_type(), parse_splash_range(), and skill_config_data::skill_id.

Referenced by load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_internal_skill_tree()

bool SkillDatabase::load_internal_skill_tree ( sol::object const &  key,
sol::object const &  value 
)
protected
2094{
2095 try {
2096 std::vector<std::shared_ptr<const skill_tree_config>> final_tree_vector;
2097 std::shared_ptr<const job_config_data> job = nullptr;
2098
2099 if (value.get_type() != sol::type::table) {
2100 HLog(error) << "Value for Job " << job->id << " was not a table... skipping.";
2101 return false;
2102 }
2103
2104 sol::table jsk = value.as<sol::table>();
2105
2106 std::string job_name = jsk.get<std::string>("Name");
2107
2108 job_class_type job_id = JobDB->get_job_class_by_name(job_name);
2109 if (job_id == JOB_INVALID) {
2110 HLog(error) << "Invalid job name '" << job_name << "' provided in skill_tree, job wasn't found.";
2111 return false;
2112 }
2113 job = JobDB->get_job_by_id((int) job_id);
2114 if (job == nullptr) {
2115 HLog(error) << "Job '" << job_name << "' with ID " << job_id << " wasn't found.";
2116 return false;
2117 }
2118
2119 sol::optional<sol::table> maybe_inherit = jsk.get<sol::optional<sol::table>>("Inherit");
2120
2121 if (maybe_inherit) {
2122 sol::table i_tbl = maybe_inherit.value();
2123
2124 for(auto const &ih : i_tbl) {
2125 sol::object const &v = ih.second;
2126 job_class_type jclass;
2127 std::vector<std::shared_ptr<const skill_tree_config>> c;
2128
2129 if (v.get_type() == sol::type::string) {
2130 std::string job_name = v.as<std::string>();
2131 jclass = JobDB->get_job_class_by_name(job_name);
2132 c = SkillDB->get_skill_tree_by_job_id(jclass);
2133
2134 if (c.size() == 0) {
2135 HLog(error) << "Non-existent job '" << job_name << "' couldn't be inherited for job '" << job->name << "'.";
2136 continue;
2137 }
2138 } else if (v.get_type() == sol::type::number) {
2139 jclass = (job_class_type) v.as<int>();
2140 c = SkillDB->get_skill_tree_by_job_id(jclass);
2141
2142 if (c.size() == 0) {
2143 HLog(error) << "Non-existent job " << (int) jclass << " couldn't be inherited for job '" << job->name << "'.";
2144 continue;
2145 }
2146 }
2147
2148 for (auto it = c.begin(); it != c.end(); it++) {
2149 std::shared_ptr<skill_tree_config> ihdata = std::const_pointer_cast<skill_tree_config>(*it);
2150 ihdata->inherited_from = jclass;
2151 final_tree_vector.push_back(std::const_pointer_cast<const skill_tree_config>(ihdata));
2152 }
2153 }
2154 }
2155
2156 sol::optional<sol::table> maybe_tbl = jsk.get<sol::optional<sol::table>>("Skills");
2157 if (maybe_tbl) {
2158 sol::table s_tbl = maybe_tbl.value();
2159 for (auto const &sk : s_tbl) {
2160 sol::object const &k = sk.first;
2161 sol::object const &v = sk.second;
2162 skill_tree_config tskill;
2163 std::shared_ptr<const skill_config_data> skill = nullptr;
2164
2165 if (k.is<std::string>()) {
2166 std::string skill_name = k.as<std::string>();
2167 skill = get_skill_by_name(skill_name);
2168 if (skill == nullptr) {
2169 HLog(error) << "Skill '" << skill_name << "' for job '" << job->name << "' doesn't exist in the skill database... skipping.";
2170 continue;
2171 }
2172 } else if (k.is<int>()) {
2173 int skill_id = k.as<int>();
2174 skill = get_skill_by_id(skill_id);
2175 if (skill == nullptr) {
2176 HLog(error) << "Skill by id (" << skill_id << ") for job '" << job->name << "' doesn't exist in the skill database... skipping.";
2177 continue;
2178 }
2179 } else {
2180 HLog(error) << "A Key in skills of job '" << job->name << "' was of unexpected type... skipping.";
2181 continue;
2182 }
2183
2184 tskill.skill_id = skill->skill_id;
2185 tskill.inherited_from = JOB_INVALID;
2186
2187 if (v.get_type() == sol::type::table) {
2188 sol::table n_tbl = v.as<sol::table>();
2189
2190 for (auto const &n : n_tbl) {
2191 sol::object const &nk = n.first;
2192 sol::object const &nv = n.second;
2193 std::shared_ptr<const skill_config_data> pre_skill = nullptr;
2194
2195 if (nk.is<std::string>()) {
2196 std::string setting_name = nk.as<std::string>();
2197
2198 if (setting_name.compare("MaxLevel") == 0) {
2199 if (nv.get_type() != sol::type::number) {
2200 HLog(error) << "MaxLevel for skill " << skill->name << " of job " << job->id << " was of non-numeric type... skipping;";
2201 continue;
2202 }
2203
2204 tskill.max_level = nv.as<int>();
2205 continue;
2206 } else if (setting_name.compare("MinJobLevel") == 0) {
2207 if (nv.get_type() != sol::type::number) {
2208 HLog(error) << "MinJobLevel for skill " << skill->name << " of job " << job->id << " was of non-numeric type... skipping;";
2209 continue;
2210 }
2211
2212 tskill.job_level = nv.as<int>();
2213 continue;
2214 }
2215
2216 pre_skill = get_skill_by_name(setting_name);
2217 if (pre_skill == nullptr) {
2218 HLog(error) << "Pre-requisite skill '" << setting_name << "' doesn't exist in the skill database... skipping.";
2219 continue;
2220 }
2221 } else if (nk.is<int>()) {
2222 int skill_id = nk.as<int>();
2223 pre_skill = get_skill_by_id(skill_id);
2224 if (pre_skill == nullptr) {
2225 HLog(error) << "Pre-requisite skill by id (" << skill_id << ") doesn't exist in the skill database... skipping.";
2226 continue;
2227 }
2228 } else {
2229 HLog(error) << "Unknown key type provided for pre-requisite skill of job " << job->id << " in skill database... skipping.";
2230 continue;
2231 }
2232
2233 if (nv.get_type() != sol::type::number) {
2234 HLog(error) << "Unknown value type for pre-requisite skill " << pre_skill->name << " of job " << job->id << "... skipping.";
2235 continue;
2236 }
2238 req.skill_id = pre_skill->skill_id;
2239 req.level = nv.as<int>();
2240 tskill.requirements.push_back(req);
2241 }
2242 } else if (v.get_type() == sol::type::number) {
2243 tskill.max_level = v.as<int>();
2244 } else {
2245 HLog(error) << "Invalid value type for skill " << skill->skill_id << ", expected number or table. (Job: '" << job->name << "')";
2246 continue;
2247 }
2248
2249 final_tree_vector.push_back(std::make_shared<const skill_tree_config>(tskill));
2250 }
2251 }
2252
2253 _skill_tree_db.insert((job_class_type) job->id, final_tree_vector);
2254
2255 } catch (sol::error &err) {
2256 HLog(error) << "SkillDatabase::load_internal_skill_tree:" << err.what();
2257 return false;
2258 }
2259
2260 return true;
2261}
#define JobDB
Definition: JobDB.hpp:87
#define SkillDB
Definition: SkillDB.hpp:145
job_class_type
Definition: UnitDefinitions.hpp:474
@ JOB_INVALID
Definition: UnitDefinitions.hpp:616
std::shared_ptr< const skill_config_data > get_skill_by_id(int32_t id)
Definition: SkillDB.hpp:112
std::shared_ptr< const skill_config_data > get_skill_by_name(std::string name)
Definition: SkillDB.hpp:113
Definition: SkillDefinitions.hpp:331
unsigned char level
Definition: SkillDefinitions.hpp:333
int skill_id
Definition: SkillDefinitions.hpp:332
Definition: SkillDefinitions.hpp:330
std::vector< struct requirement > requirements
Definition: SkillDefinitions.hpp:340
int skill_id
Definition: SkillDefinitions.hpp:336
unsigned char max_level
Definition: SkillDefinitions.hpp:337
job_class_type inherited_from
Definition: SkillDefinitions.hpp:339
unsigned char job_level
Definition: SkillDefinitions.hpp:338

References _skill_tree_db, get_skill_by_id(), get_skill_by_name(), HLog, skill_tree_config::inherited_from, LockedLookupTable< Key, Value, Hash >::insert(), JOB_INVALID, skill_tree_config::job_level, JobDB, skill_tree_config::requirement::level, skill_tree_config::max_level, skill_tree_config::requirements, skill_tree_config::requirement::skill_id, skill_tree_config::skill_id, and SkillDB.

Referenced by load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_after_cast_act_delay()

bool SkillDatabase::parse_after_cast_act_delay ( sol::table const &  table,
skill_config_data data 
)
protected
813{
814 try {
815 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("AfterCastActDelay");
816 if (maybe_tbl) {
817 sol::table tbl = maybe_tbl.value();
818
819 if (tbl.size() > MAX_SKILL_LEVEL || tbl.size() < 1)
820 HLog(warning) << "Level table of AfterCastActDelay for skill " << data.name << " should be of size " << MAX_SKILL_LEVEL << ", but a table of size " << tbl.size() << " was provided.";
821
822 for (const auto &tp : tbl) {
823 sol::object const &k = tp.first;
824 sol::object const &v = tp.second;
825
826 if (k.is<std::string>()) {
827 HLog(warning) << "Key for AfterCastActDelay of skill '" << data.name << "' was string, expected int.";
828 return false;
829 }
830
831 int lvl = k.as<int>();
832
833 if (lvl > MAX_SKILL_LEVEL || lvl < 0) {
834 HLog(warning) << "Key for AfterCastActDelay of skill '" << data.name << "' was greater than " << MAX_SKILL_LEVEL << ".";
835 return false;
836 }
837
838 data.after_cast_actor_delay[lvl - 1] = v.as<int>();
839 }
840 }
841
842 sol::optional<int> maybe_val = table.get<sol::optional<int>>("AfterCastActDelay");
843 if (maybe_val) {
844 fill_lvl_range(data.after_cast_actor_delay, maybe_val.value());
845 }
846 } catch (sol::error &error) {
847 HLog(error) << "Error parsing AfterCastActDelay for skill '" << data.name << "' - " << error.what() << ".";
848 }
849
850 return true;
851}
void fill_lvl_range(T *setting, T value)
Definition: SkillDB.hpp:139
int after_cast_actor_delay[MAX_SKILL_LEVEL]
delay
Definition: SkillDefinitions.hpp:297

References skill_config_data::after_cast_actor_delay, fill_lvl_range(), HLog, MAX_SKILL_LEVEL, and skill_config_data::name.

Referenced by load_internal_skill_db().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_after_cast_walk_delay()

bool SkillDatabase::parse_after_cast_walk_delay ( sol::table const &  table,
skill_config_data data 
)
protected
854{
855 try {
856 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("AfterCastWalkDelay");
857 if (maybe_tbl) {
858 sol::table tbl = maybe_tbl.value();
859
860 if (tbl.size() > MAX_SKILL_LEVEL || tbl.size() < 1)
861 HLog(warning) << "Level table of AfterCastWalkDelay for skill " << data.name << " should be of size " << MAX_SKILL_LEVEL << ", but a table of size " << tbl.size() << " was provided.";
862
863 for (const auto &tp : tbl) {
864 sol::object const &k = tp.first;
865 sol::object const &v = tp.second;
866
867 if (k.is<std::string>()) {
868 HLog(warning) << "Key for AfterCastWalkDelay of skill '" << data.name << "' was string, expected int.";
869 return false;
870 }
871
872 int lvl = k.as<int>();
873
874 if (lvl > MAX_SKILL_LEVEL || lvl < 0) {
875 HLog(warning) << "Key for AfterCastWalkDelay of skill '" << data.name << "' was greater than " << MAX_SKILL_LEVEL << ".";
876 return false;
877 }
878
879 data.after_cast_walk_delay[lvl - 1] = v.as<int>();
880 }
881 }
882
883 sol::optional<int> maybe_val = table.get<sol::optional<int>>("AfterCastWalkDelay");
884 if (maybe_val) {
885 fill_lvl_range(data.after_cast_walk_delay, maybe_val.value());
886 }
887 } catch (sol::error &error) {
888 HLog(error) << "Error parsing AfterCastWalkDelay for skill '" << data.name << "' - " << error.what() << ".";
889 }
890
891 return true;
892}
int after_cast_walk_delay[MAX_SKILL_LEVEL]
Definition: SkillDefinitions.hpp:298

References skill_config_data::after_cast_walk_delay, fill_lvl_range(), HLog, MAX_SKILL_LEVEL, and skill_config_data::name.

Referenced by load_internal_skill_db().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_attack_type()

bool SkillDatabase::parse_attack_type ( sol::table const &  table,
skill_config_data data 
)
protected
399{
400 try {
401 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("AttackType");
402 if (maybe_tbl) {
403 sol::table tbl = maybe_tbl.value();
404
405 if (tbl.size() > MAX_SKILL_LEVEL || tbl.size() < 1)
406 HLog(warning) << "Level table of AttackType for skill " << data.name << " should be of size " << MAX_SKILL_LEVEL << ", but a table of size " << tbl.size() << " was provided.";
407
408 for (const auto &tp : tbl) {
409 sol::object const &k = tp.first;
410 sol::object const &v = tp.second;
411
412 if (k.is<std::string>()) {
413 HLog(warning) << "Key for AttackType of skill '" << data.name << "' was string, expected int.";
414 return false;
415 }
416
417 int lvl = k.as<int>();
418
419 if (lvl > MAX_SKILL_LEVEL || lvl < 0) {
420 HLog(warning) << "Key for AttackType of skill '" << data.name << "' was greater than " << MAX_SKILL_LEVEL << ".";
421 return false;
422 }
423
424 data.attack_type[lvl - 1] = (battle_attack_type) v.as<int>();
425 }
426 }
427
428 sol::optional<int> maybe_intval = table.get<sol::optional<int>>("AttackType");
429 if (maybe_intval) {
430 battle_attack_type bat = (battle_attack_type) maybe_intval.value();
431 fill_lvl_range(data.attack_type, bat);
432 }
433 } catch (sol::error &error) {
434 HLog(error) << "Error parsing AttackType for skill '" << data.name << "' - " << error.what() << ".";
435 }
436
437 return true;
438}
battle_attack_type
Definition: BattleDefinitions.hpp:50
battle_attack_type attack_type[MAX_SKILL_LEVEL]
Definition: SkillDefinitions.hpp:287

References skill_config_data::attack_type, fill_lvl_range(), HLog, MAX_SKILL_LEVEL, and skill_config_data::name.

Referenced by load_internal_skill_db().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_cast_defense_rate()

bool SkillDatabase::parse_cast_defense_rate ( sol::table const &  table,
skill_config_data data 
)
protected
649{
650 try {
651 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("CastDefRate");
652 if (maybe_tbl) {
653 sol::table tbl = maybe_tbl.value();
654
655 if (tbl.size() > MAX_SKILL_LEVEL || tbl.size() < 1)
656 HLog(warning) << "Level table of CastDefRate for skill " << data.name << " should be of size " << MAX_SKILL_LEVEL << ", but a table of size " << tbl.size() << " was provided.";
657
658 for (const auto &tp : tbl) {
659 sol::object const &k = tp.first;
660 sol::object const &v = tp.second;
661
662 if (k.is<std::string>()) {
663 HLog(warning) << "Key for CastDefRate of skill '" << data.name << "' was string, expected int.";
664 return false;
665 }
666
667 int lvl = k.as<int>();
668
669 if (lvl > MAX_SKILL_LEVEL || lvl < 0) {
670 HLog(warning) << "Key for CastDefRate of skill '" << data.name << "' was greater than " << MAX_SKILL_LEVEL << ".";
671 return false;
672 }
673
674 data.cast_defense_rate[lvl - 1] = v.as<int>();
675 }
676 }
677
678 sol::optional<int> maybe_val = table.get<sol::optional<int>>("CastDefRate");
679 if (maybe_val) {
680 fill_lvl_range(data.cast_defense_rate, maybe_val.value());
681 }
682 } catch (sol::error &error) {
683 HLog(error) << "Error parsing CastDefRate for skill '" << data.name << "' - " << error.what() << ".";
684 }
685
686 return true;
687}
int cast_defense_rate[MAX_SKILL_LEVEL]
Definition: SkillDefinitions.hpp:293

References skill_config_data::cast_defense_rate, fill_lvl_range(), HLog, MAX_SKILL_LEVEL, and skill_config_data::name.

Referenced by load_internal_skill_db().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_cast_time()

bool SkillDatabase::parse_cast_time ( sol::table const &  table,
skill_config_data data 
)
protected
772{
773 try {
774 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("CastTime");
775 if (maybe_tbl) {
776 sol::table tbl = maybe_tbl.value();
777
778 if (tbl.size() > MAX_SKILL_LEVEL || tbl.size() < 1)
779 HLog(warning) << "Level table of CastTime for skill " << data.name << " should be of size " << MAX_SKILL_LEVEL << ", but a table of size " << tbl.size() << " was provided.";
780
781 for (const auto &tp : tbl) {
782 sol::object const &k = tp.first;
783 sol::object const &v = tp.second;
784
785 if (k.is<std::string>()) {
786 HLog(warning) << "Key for CastTime of skill '" << data.name << "' was string, expected int.";
787 return false;
788 }
789
790 int lvl = k.as<int>();
791
792 if (lvl > MAX_SKILL_LEVEL || lvl < 0) {
793 HLog(warning) << "Key for CastTime of skill '" << data.name << "' was greater than " << MAX_SKILL_LEVEL << ".";
794 return false;
795 }
796
797 data.cast_time[lvl - 1] = v.as<int>();
798 }
799 }
800
801 sol::optional<int> maybe_val = table.get<sol::optional<int>>("CastTime");
802 if (maybe_val) {
803 fill_lvl_range(data.cast_time, maybe_val.value());
804 }
805 } catch (sol::error &error) {
806 HLog(error) << "Error parsing CastTime for skill '" << data.name << "' - " << error.what() << ".";
807 }
808
809 return true;
810}
int cast_time[MAX_SKILL_LEVEL]
cast
Definition: SkillDefinitions.hpp:296

References skill_config_data::cast_time, fill_lvl_range(), HLog, MAX_SKILL_LEVEL, and skill_config_data::name.

Referenced by load_internal_skill_db().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_cast_time_options()

bool SkillDatabase::parse_cast_time_options ( sol::table const &  table,
skill_config_data data 
)
protected
1059{
1060 try {
1061 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("CastTimeOptions");
1062 if (maybe_tbl) {
1063 sol::table tbl = maybe_tbl.value();
1064 int options = 0;
1065
1066 for (const auto &tp : tbl) {
1067 sol::object const &v = tp.second;
1068
1069 if (v.get_type() == sol::type::string) {
1070 std::string option = v.as<std::string>();
1071 if (option.compare("IgnoreDex") == 0)
1072 options |= 1;
1073 else if (option.compare("IgnoreStatusEffect") == 0)
1074 options |= 2;
1075 else if (option.compare("IgnoreItemBonus") == 0)
1076 options |= 4;
1077 } else {
1078 HLog(warning) << "Invalid type provided for CastTimeOptions of skill '" << data.name << "'.";
1079 continue;
1080 }
1081 }
1082 data.cast_time_options = options;
1083 }
1084
1085 sol::optional<std::string> maybe_val = table.get<sol::optional<std::string>>("CastTimeOptions");
1086 if (maybe_val) {
1087 std::string option = maybe_val.value();
1088 int options = 0;
1089
1090 if (option.compare("IgnoreDex") == 0)
1091 options |= 1;
1092 else if (option.compare("IgnoreStatusEffect") == 0)
1093 options |= 2;
1094 else if (option.compare("IgnoreItemBonus") == 0)
1095 options |= 4;
1096
1097 data.cast_time_options = options;
1098 }
1099 } catch (sol::error &error) {
1100 HLog(error) << "Error parsing CastTimeOptions for skill '" << data.name << "' - " << error.what() << ".";
1101 }
1102
1103 return true;
1104}
int cast_time_options
Definition: SkillDefinitions.hpp:303

References skill_config_data::cast_time_options, HLog, and skill_config_data::name.

Referenced by load_internal_skill_db().

+ Here is the caller graph for this function:

◆ parse_cooldown()

bool SkillDatabase::parse_cooldown ( sol::table const &  table,
skill_config_data data 
)
protected
977{
978 try {
979 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("Cooldown");
980 if (maybe_tbl) {
981 sol::table tbl = maybe_tbl.value();
982
983 if (tbl.size() > MAX_SKILL_LEVEL || tbl.size() < 1)
984 HLog(warning) << "Level table of Cooldown for skill " << data.name << " should be of size " << MAX_SKILL_LEVEL << ", but a table of size " << tbl.size() << " was provided.";
985
986 for (const auto &tp : tbl) {
987 sol::object const &k = tp.first;
988 sol::object const &v = tp.second;
989
990 if (k.is<std::string>()) {
991 HLog(warning) << "Key for Cooldown of skill '" << data.name << "' was string, expected int.";
992 return false;
993 }
994
995 int lvl = k.as<int>();
996
997 if (lvl > MAX_SKILL_LEVEL || lvl < 0) {
998 HLog(warning) << "Key for Cooldown of skill '" << data.name << "' was greater than " << MAX_SKILL_LEVEL << ".";
999 return false;
1000 }
1001
1002 data.cooldown[lvl - 1] = v.as<int>();
1003 }
1004 }
1005
1006 sol::optional<int> maybe_val = table.get<sol::optional<int>>("Cooldown");
1007 if (maybe_val) {
1008 fill_lvl_range(data.cooldown, maybe_val.value());
1009 }
1010 } catch (sol::error &error) {
1011 HLog(error) << "Error parsing Cooldown for skill '" << data.name << "' - " << error.what() << ".";
1012 }
1013
1014 return true;
1015}
int cooldown[MAX_SKILL_LEVEL]
Definition: SkillDefinitions.hpp:301

References skill_config_data::cooldown, fill_lvl_range(), HLog, MAX_SKILL_LEVEL, and skill_config_data::name.

Referenced by load_internal_skill_db().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_damage_type()

bool SkillDatabase::parse_damage_type ( sol::table const &  table,
skill_config_data data 
)
protected
484{
485 try {
486 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("DamageType");
487 if (maybe_tbl) {
488 sol::table tbl = maybe_tbl.value();
489
490 if (tbl.size() > MAX_SKILL_LEVEL || tbl.size() < 1)
491 HLog(warning) << "Level table of DamageType for skill " << data.name << " should be of size " << MAX_SKILL_LEVEL << ", but a table of size " << tbl.size() << " was provided.";
492
493 for (const auto &tp : tbl) {
494 sol::object const &k = tp.first;
495 sol::object const &v = tp.second;
496
497 if (k.is<std::string>()) {
498 HLog(warning) << "Key for DamageType of skill '" << data.name << "' was string, expected int.";
499 return false;
500 }
501
502 int lvl = k.as<int>();
503
504 if (lvl > MAX_SKILL_LEVEL || lvl < 0) {
505 HLog(warning) << "Key for DamageType of skill '" << data.name << "' was greater than " << MAX_SKILL_LEVEL << ".";
506 return false;
507 }
508
509 data.damage_type[lvl - 1] = (battle_damage_type) v.as<int>();
510 }
511 }
512
513 sol::optional<int> maybe_intval = table.get<sol::optional<int>>("DamageType");
514 if (maybe_intval) {
515 fill_lvl_range(data.damage_type, (battle_damage_type) maybe_intval.value());
516 }
517 } catch (sol::error &error) {
518 HLog(error) << "Error parsing DamageType for skill '" << data.name << "' - " << error.what() << ".";
519 }
520
521 return true;
522}
battle_damage_type
Definition: BattleDefinitions.hpp:77
battle_damage_type damage_type[MAX_SKILL_LEVEL]
Definition: SkillDefinitions.hpp:284

References skill_config_data::damage_type, fill_lvl_range(), HLog, MAX_SKILL_LEVEL, and skill_config_data::name.

Referenced by load_internal_skill_db().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_element()

bool SkillDatabase::parse_element ( sol::table const &  table,
skill_config_data data 
)
protected
442{
443 try {
444 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("Element");
445 if (maybe_tbl) {
446 sol::table tbl = maybe_tbl.value();
447
448 if (tbl.size() > MAX_SKILL_LEVEL || tbl.size() < 1)
449 HLog(warning) << "Level table of Element for skill " << data.name << " should be of size " << MAX_SKILL_LEVEL << ", but a table of size " << tbl.size() << " was provided.";
450
451 for (const auto &tp : tbl) {
452 sol::object const &k = tp.first;
453 sol::object const &v = tp.second;
454
455 if (k.is<std::string>()) {
456 HLog(warning) << "Key for Element of skill '" << data.name << "' was string, expected int.";
457 return false;
458 }
459
460 int lvl = k.as<int>();
461
462 if (lvl > MAX_SKILL_LEVEL || lvl < 0) {
463 HLog(warning) << "Key for Element of skill '" << data.name << "' was greater than " << MAX_SKILL_LEVEL << ".";
464 return false;
465 }
466
467 data.element[lvl - 1] = (element_type) v.as<int>();
468 }
469 }
470
471 sol::optional<int> maybe_intval = table.get<sol::optional<int>>("Element");
472 if (maybe_intval) {
473 element_type e = (element_type) maybe_intval.value();
474 fill_lvl_range(data.element, e);
475 }
476 } catch (sol::error &error) {
477 HLog(error) << "Error parsing Element for skill '" << data.name << "' - " << error.what() << ".";
478 }
479
480 return true;
481}
element_type
Definition: UnitDefinitions.hpp:970
element_type element[MAX_SKILL_LEVEL]
Definition: SkillDefinitions.hpp:288

References skill_config_data::element, fill_lvl_range(), HLog, MAX_SKILL_LEVEL, and skill_config_data::name.

Referenced by load_internal_skill_db().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_fixed_cast_time()

bool SkillDatabase::parse_fixed_cast_time ( sol::table const &  table,
skill_config_data data 
)
protected
1018{
1019 try {
1020 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("FixedCastTime");
1021 if (maybe_tbl) {
1022 sol::table tbl = maybe_tbl.value();
1023
1024 if (tbl.size() > MAX_SKILL_LEVEL || tbl.size() < 1)
1025 HLog(warning) << "Level table of FixedCastTime for skill " << data.name << " should be of size " << MAX_SKILL_LEVEL << ", but a table of size " << tbl.size() << " was provided.";
1026
1027 for (const auto &tp : tbl) {
1028 sol::object const &k = tp.first;
1029 sol::object const &v = tp.second;
1030
1031 if (k.is<std::string>()) {
1032 HLog(warning) << "Key for FixedCastTime of skill '" << data.name << "' was string, expected int.";
1033 return false;
1034 }
1035
1036 int lvl = k.as<int>();
1037
1038 if (lvl > MAX_SKILL_LEVEL || lvl < 0) {
1039 HLog(warning) << "Key for FixedCastTime of skill '" << data.name << "' was greater than " << MAX_SKILL_LEVEL << ".";
1040 return false;
1041 }
1042
1043 data.fixed_cast_time[lvl - 1] = v.as<int>();
1044 }
1045 }
1046
1047 sol::optional<int> maybe_val = table.get<sol::optional<int>>("FixedCastTime");
1048 if (maybe_val) {
1049 fill_lvl_range(data.fixed_cast_time, maybe_val.value());
1050 }
1051 } catch (sol::error &error) {
1052 HLog(error) << "Error parsing FixedCastTime for skill '" << data.name << "' - " << error.what() << ".";
1053 }
1054
1055 return true;
1056}
int fixed_cast_time[MAX_SKILL_LEVEL]
Definition: SkillDefinitions.hpp:302

References fill_lvl_range(), skill_config_data::fixed_cast_time, HLog, MAX_SKILL_LEVEL, and skill_config_data::name.

Referenced by load_internal_skill_db().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_hit()

bool SkillDatabase::parse_hit ( sol::table const &  table,
skill_config_data data 
)
protected
271{
272 try {
273 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("Hit");
274 if (maybe_tbl) {
275 sol::table tbl = maybe_tbl.value();
276
277 if (tbl.size() > MAX_SKILL_LEVEL)
278 HLog(warning) << "Level table of Hit for skill " << data.name << " should be of size " << MAX_SKILL_LEVEL << ", but a table of size " << tbl.size() << " was provided.";
279
280 for (const auto &tp : tbl) {
281 sol::object const &key = tp.first;
282 sol::object const &svalue = tp.second;
283
284 if (key.is<std::string>()) {
285 HLog(warning) << "Key for Hit of skill '" << data.name << "' was string, expected int.";
286 return false;
287 }
288
289 int lvl = key.as<int>();
290
291 if (lvl > MAX_SKILL_LEVEL || lvl < 0) {
292 HLog(warning) << "Key for Hit of skill '" << data.name << "' was greater than " << MAX_SKILL_LEVEL << ".";
293 return false;
294 }
295
296 std::string hit = svalue.as<std::string>();
298
299 if (hit.compare("BDT_SKILL") == 0) {
300 bdt = BDT_SKILL;
301 } else if (hit.compare("BDT_MULTIHIT") == 0) {
302 bdt = BDT_MULTIHIT;
303 } else if (hit.compare("BDT_NORMAL") == 0) {
304 bdt = BDT_NORMAL;
305 } else {
306 HLog(warning) << "Value for Hit of skill '" << data.name << "' is unknown: " << hit << "... skipping.";
307 return false;
308 }
309
310 data.damage_type[lvl - 1] = bdt;
311 }
312 }
313
314 sol::optional<std::string> maybe_strval = table.get<sol::optional<std::string>>("Hit");
315 if (maybe_strval) {
316 std::string hit = maybe_strval.value();
318
319 if (hit.compare("BDT_SKILL") == 0) {
320 bdt = BDT_SKILL;
321 } else if (hit.compare("BDT_MULTIHIT") == 0) {
322 bdt = BDT_MULTIHIT;
323 } else if (hit.compare("BDT_NORMAL") == 0) {
324 bdt = BDT_NORMAL;
325 } else {
326 HLog(warning) << "Value for Hit of skill '" << data.name << "' is unknown: " << hit << "... skipping.";
327 return false;
328 }
329
330 fill_lvl_range(data.damage_type, bdt);
331 }
332 } catch (sol::error &error) {
333 HLog(error) << "Error parsing Hit for skill '" << data.name << "' - " << error.what() << ".";
334 }
335
336 return true;
337}
@ BDT_SKILL
Definition: BattleDefinitions.hpp:84
@ BDT_NORMAL
Definition: BattleDefinitions.hpp:78
@ BDT_MULTIHIT
Definition: BattleDefinitions.hpp:86

References BDT_MULTIHIT, BDT_NORMAL, BDT_SKILL, skill_config_data::damage_type, fill_lvl_range(), HLog, MAX_SKILL_LEVEL, and skill_config_data::name.

Referenced by load_internal_skill_db().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_interrupt_cast()

bool SkillDatabase::parse_interrupt_cast ( sol::table const &  table,
skill_config_data data 
)
protected
608{
609 try {
610 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("InterruptCast");
611 if (maybe_tbl) {
612 sol::table tbl = maybe_tbl.value();
613
614 if (tbl.size() > MAX_SKILL_LEVEL || tbl.size() < 1)
615 HLog(warning) << "Level table of InterruptCast for skill " << data.name << " should be of size " << MAX_SKILL_LEVEL << ", but a table of size " << tbl.size() << " was provided.";
616
617 for (const auto &tp : tbl) {
618 sol::object const &k = tp.first;
619 sol::object const &v = tp.second;
620
621 if (k.is<std::string>()) {
622 HLog(warning) << "Key for InterruptCast of skill '" << data.name << "' was string, expected int.";
623 return false;
624 }
625
626 int lvl = k.as<int>();
627
628 if (lvl > MAX_SKILL_LEVEL || lvl < 0) {
629 HLog(warning) << "Key for InterruptCast of skill '" << data.name << "' was greater than " << MAX_SKILL_LEVEL << ".";
630 return false;
631 }
632
633 data.interrupt_cast[lvl - 1] = v.as<bool>();
634 }
635 }
636
637 sol::optional<bool> maybe_val = table.get<sol::optional<bool>>("InterruptCast");
638 if (maybe_val) {
639 fill_lvl_range(data.interrupt_cast, maybe_val.value());
640 }
641 } catch (sol::error &error) {
642 HLog(error) << "Error parsing InterruptCast for skill '" << data.name << "' - " << error.what() << ".";
643 }
644
645 return true;
646}
bool interrupt_cast[MAX_SKILL_LEVEL]
Definition: SkillDefinitions.hpp:292

References fill_lvl_range(), HLog, skill_config_data::interrupt_cast, MAX_SKILL_LEVEL, and skill_config_data::name.

Referenced by load_internal_skill_db().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_knock_back_tiles()

bool SkillDatabase::parse_knock_back_tiles ( sol::table const &  table,
skill_config_data data 
)
protected
731{
732 try {
733 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("KnockBackTiles");
734 if (maybe_tbl) {
735 sol::table tbl = maybe_tbl.value();
736
737 if (tbl.size() > MAX_SKILL_LEVEL || tbl.size() < 1)
738 HLog(warning) << "Level table of KnockBackTiles for skill " << data.name << " should be of size " << MAX_SKILL_LEVEL << ", but a table of size " << tbl.size() << " was provided.";
739
740 for (const auto &tp : tbl) {
741 sol::object const &k = tp.first;
742 sol::object const &v = tp.second;
743
744 if (k.is<std::string>()) {
745 HLog(warning) << "Key for KnockBackTiles of skill '" << data.name << "' was string, expected int.";
746 return false;
747 }
748
749 int lvl = k.as<int>();
750
751 if (lvl > MAX_SKILL_LEVEL || lvl < 0) {
752 HLog(warning) << "Key for KnockBackTiles of skill '" << data.name << "' was greater than " << MAX_SKILL_LEVEL << ".";
753 return false;
754 }
755
756 data.knock_back_tiles[lvl - 1] = v.as<int>();
757 }
758 }
759
760 sol::optional<int> maybe_val = table.get<sol::optional<int>>("KnockBackTiles");
761 if (maybe_val) {
762 fill_lvl_range(data.knock_back_tiles, maybe_val.value());
763 }
764 } catch (sol::error &error) {
765 HLog(error) << "Error parsing KnockBackTiles for skill '" << data.name << "' - " << error.what() << ".";
766 }
767
768 return true;
769}
int knock_back_tiles[MAX_SKILL_LEVEL]
Definition: SkillDefinitions.hpp:295

References fill_lvl_range(), HLog, skill_config_data::knock_back_tiles, MAX_SKILL_LEVEL, and skill_config_data::name.

Referenced by load_internal_skill_db().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_max_skill_instances()

bool SkillDatabase::parse_max_skill_instances ( sol::table const &  table,
skill_config_data data 
)
protected
690{
691 try {
692 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("MaxSkillInstances");
693 if (maybe_tbl) {
694 sol::table tbl = maybe_tbl.value();
695
696 if (tbl.size() > MAX_SKILL_LEVEL || tbl.size() < 1)
697 HLog(warning) << "Level table of MaxSkillInstances for skill " << data.name << " should be of size " << MAX_SKILL_LEVEL << ", but a table of size " << tbl.size() << " was provided.";
698
699 for (const auto &tp : tbl) {
700 sol::object const &k = tp.first;
701 sol::object const &v = tp.second;
702
703 if (k.is<std::string>()) {
704 HLog(warning) << "Key for MaxSkillInstances of skill '" << data.name << "' was string, expected int.";
705 return false;
706 }
707
708 int lvl = k.as<int>();
709
710 if (lvl > MAX_SKILL_LEVEL || lvl < 0) {
711 HLog(warning) << "Key for MaxSkillInstances of skill '" << data.name << "' was greater than " << MAX_SKILL_LEVEL << ".";
712 return false;
713 }
714
715 data.max_skill_instances[lvl - 1] = v.as<int>();
716 }
717 }
718
719 sol::optional<int> maybe_val = table.get<sol::optional<int>>("MaxSkillInstances");
720 if (maybe_val) {
721 fill_lvl_range(data.max_skill_instances, maybe_val.value());
722 }
723 } catch (sol::error &error) {
724 HLog(error) << "Error parsing MaxSkillInstances for skill '" << data.name << "' - " << error.what() << ".";
725 }
726
727 return true;
728}
int max_skill_instances[MAX_SKILL_LEVEL]
Definition: SkillDefinitions.hpp:294

References fill_lvl_range(), HLog, skill_config_data::max_skill_instances, MAX_SKILL_LEVEL, and skill_config_data::name.

Referenced by load_internal_skill_db().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_number_of_hits()

bool SkillDatabase::parse_number_of_hits ( sol::table const &  table,
skill_config_data data 
)
protected
567{
568 try {
569 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("NumberOfHits");
570 if (maybe_tbl) {
571 sol::table tbl = maybe_tbl.value();
572
573 if (tbl.size() > MAX_SKILL_LEVEL || tbl.size() < 1)
574 HLog(warning) << "Level table of NumberOfHits for skill " << data.name << " should be of size " << MAX_SKILL_LEVEL << ", but a table of size " << tbl.size() << " was provided.";
575
576 for (const auto &tp : tbl) {
577 sol::object const &k = tp.first;
578 sol::object const &v = tp.second;
579
580 if (k.is<std::string>()) {
581 HLog(warning) << "Key for NumberOfHits of skill '" << data.name << "' was string, expected int.";
582 return false;
583 }
584
585 int lvl = k.as<int>();
586
587 if (lvl > MAX_SKILL_LEVEL || lvl < 0) {
588 HLog(warning) << "Key for NumberOfHits of skill '" << data.name << "' was greater than " << MAX_SKILL_LEVEL << ".";
589 return false;
590 }
591
592 data.number_of_hits[lvl - 1] = v.as<int>();
593 }
594 }
595
596 sol::optional<int> maybe_intval = table.get<sol::optional<int>>("NumberOfHits");
597 if (maybe_intval) {
598 fill_lvl_range(data.number_of_hits, maybe_intval.value());
599 }
600 } catch (sol::error &error) {
601 HLog(error) << "Error parsing NumberOfHits for skill '" << data.name << "' - " << error.what() << ".";
602 }
603
604 return true;
605}
int number_of_hits[MAX_SKILL_LEVEL]
num
Definition: SkillDefinitions.hpp:291

References fill_lvl_range(), HLog, MAX_SKILL_LEVEL, skill_config_data::name, and skill_config_data::number_of_hits.

Referenced by load_internal_skill_db().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_placement()

bool SkillDatabase::parse_placement ( sol::table const &  table,
skill_config_data data 
)
protected
1815{
1816 try {
1817 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("Placement");
1818 if (maybe_tbl) {
1819 sol::table p_tbl = maybe_tbl.value();
1820
1821 if (parse_placement_id(p_tbl, data) == false)
1822 return false;
1823
1824 if (parse_placement_layout(p_tbl, data) == false)
1825 return false;
1826
1827 if (parse_placement_range(p_tbl, data) == false)
1828 return false;
1829
1830 if (parse_placement_interval(p_tbl, data) == false)
1831 return false;
1832
1833 if (parse_placement_interval(p_tbl, data) == false)
1834 return false;
1835
1836 if (parse_placement_target(p_tbl, data) == false)
1837 return false;
1838
1839 if (parse_placement_flag(p_tbl, data) == false)
1840 return false;
1841 }
1842 } catch (sol::error &error) {
1843 HLog(error) << "Error parsing Placement for skill '" << data.name << "' : " << error.what() << ".";
1844 return false;
1845 }
1846
1847 return true;
1848}
bool parse_placement_target(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:2039
bool parse_placement_interval(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:1998
bool parse_placement_range(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:1957
bool parse_placement_id(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:1850
bool parse_placement_layout(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:1916
bool parse_placement_flag(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:2080

References HLog, skill_config_data::name, parse_placement_flag(), parse_placement_id(), parse_placement_interval(), parse_placement_layout(), parse_placement_range(), and parse_placement_target().

Referenced by load_internal_skill_db().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_placement_flag()

bool SkillDatabase::parse_placement_flag ( sol::table const &  table,
skill_config_data data 
)
protected
2081{
2082 try {
2083 sol::optional<int> maybe_val = table.get<sol::optional<int>>("Flag");
2084 if (maybe_val)
2085 data.placement_flag = maybe_val.value();
2086 } catch (sol::error &error) {
2087 HLog(error) << "Error parsing Placement > Flag for skill '" << data.name << "' - " << error.what() << ".";
2088 }
2089
2090 return true;
2091}
int placement_flag
Definition: SkillDefinitions.hpp:326

References HLog, skill_config_data::name, and skill_config_data::placement_flag.

Referenced by parse_placement().

+ Here is the caller graph for this function:

◆ parse_placement_id()

bool SkillDatabase::parse_placement_id ( sol::table const &  table,
skill_config_data data 
)
protected
1851{
1852 try {
1853 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("Id");
1854 if (maybe_tbl) {
1855 sol::table p_tbl = maybe_tbl.value();
1856
1857 if (p_tbl.size() == 2) {
1858 if (p_tbl[1].get_type() != sol::type::number || p_tbl[2].get_type() != sol::type::number) {
1859 HLog(warning) << "Value for Placement > Id of skill '" << data.name << "' is of an invalid type, excepted number.";
1860 return false;
1861 }
1862
1863 for(int i = 0; i < MAX_SKILL_LEVEL; i++) {
1864 data.placement_id[i][0] = p_tbl[1];
1865 data.placement_id[i][1] = p_tbl[2];
1866 }
1867 } else if (p_tbl.size() > 2) {
1868 if (p_tbl.size() > MAX_SKILL_LEVEL || p_tbl.size() < 1)
1869 HLog(warning) << "Level table of Placement > Id for skill " << data.name << " should be of size " << MAX_SKILL_LEVEL << ", but a table of size " << p_tbl.size() << " was provided.";
1870
1871 for (auto const &c : p_tbl) {
1872 sol::object ck = c.first;
1873 sol::object cv = c.second;
1874
1875 if (ck.is<std::string>()) {
1876 HLog(warning) << "Key for Placement > Id of skill '" << data.name << "' was string, expected int.";
1877 return false;
1878 }
1879
1880 int lvl = ck.as<int>();
1881
1882 if (cv.get_type() == sol::type::table) {
1883 sol::table cvt = cv.as<sol::table>();
1884 if (cvt[1].get_type() != sol::type::number || cvt[2].get_type() != sol::type::number) {
1885 HLog(warning) << "Value for Placement > Id of skill '" << data.name << "' is of an invalid type, excepted number.";
1886 return false;
1887 }
1888 data.placement_id[lvl - 1][0] = cvt[1];
1889 data.placement_id[lvl - 1][1] = cvt[2];
1890 } else if (cv.get_type() == sol::type::number) {
1891 data.placement_id[lvl - 1][0] = cv.as<int>();;
1892 } else {
1893 HLog(warning) << "Value for Placement > Id of skill '" << data.name << "' is of an invalid type, excepted number.";
1894 return false;
1895 }
1896 }
1897 }
1898 }
1899
1900 sol::optional<int> maybe_val = table.get<sol::optional<int>>("Id");
1901 if (maybe_val) {
1902 int value = maybe_val.value();
1903
1904 for(int i = 0; i < MAX_SKILL_LEVEL; i++) {
1905 data.placement_id[i][0] = value;
1906 data.placement_id[i][1] = 0;
1907 }
1908 }
1909 } catch (sol::error &error) {
1910 HLog(error) << "Error parsing Unit > Id for skill '" << data.name << "' - " << error.what() << ".";
1911 }
1912
1913 return true;
1914}
int placement_id[MAX_SKILL_LEVEL][2]
Definition: SkillDefinitions.hpp:321

References HLog, MAX_SKILL_LEVEL, skill_config_data::name, and skill_config_data::placement_id.

Referenced by parse_placement().

+ Here is the caller graph for this function:

◆ parse_placement_interval()

bool SkillDatabase::parse_placement_interval ( sol::table const &  table,
skill_config_data data 
)
protected
1999{
2000 try {
2001 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("Interval");
2002 if (maybe_tbl) {
2003 sol::table tbl = maybe_tbl.value();
2004
2005 if (tbl.size() > MAX_SKILL_LEVEL || tbl.size() < 1)
2006 HLog(warning) << "Level table of Placement > Interval for skill " << data.name << " should be of size " << MAX_SKILL_LEVEL << ", but a table of size " << tbl.size() << " was provided.";
2007
2008 for (const auto &tp : tbl) {
2009 sol::object const &k = tp.first;
2010 sol::object const &v = tp.second;
2011
2012 if (k.is<std::string>()) {
2013 HLog(warning) << "Key for Placement > Interval of skill '" << data.name << "' was string, expected int.";
2014 return false;
2015 }
2016
2017 int lvl = k.as<int>();
2018
2019 if (lvl > MAX_SKILL_LEVEL || lvl < 0) {
2020 HLog(warning) << "Key for Placement > Interval of skill '" << data.name << "' was greater than " << MAX_SKILL_LEVEL << ".";
2021 return false;
2022 }
2023
2024 data.placement_interval[lvl - 1] = v.as<int>();
2025 }
2026 }
2027
2028 sol::optional<int> maybe_val = table.get<sol::optional<int>>("Interval");
2029 if (maybe_val) {
2030 fill_lvl_range(data.placement_interval, maybe_val.value());
2031 }
2032 } catch (sol::error &error) {
2033 HLog(error) << "Error parsing Placement > Interval for skill '" << data.name << "' - " << error.what() << ".";
2034 }
2035
2036 return true;
2037}
int placement_interval[MAX_SKILL_LEVEL]
Definition: SkillDefinitions.hpp:324

References fill_lvl_range(), HLog, MAX_SKILL_LEVEL, skill_config_data::name, and skill_config_data::placement_interval.

Referenced by parse_placement().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_placement_layout()

bool SkillDatabase::parse_placement_layout ( sol::table const &  table,
skill_config_data data 
)
protected
1917{
1918 try {
1919 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("Layout");
1920 if (maybe_tbl) {
1921 sol::table tbl = maybe_tbl.value();
1922
1923 if (tbl.size() > MAX_SKILL_LEVEL || tbl.size() < 1)
1924 HLog(warning) << "Level table of Placement > Layout for skill " << data.name << " should be of size " << MAX_SKILL_LEVEL << ", but a table of size " << tbl.size() << " was provided.";
1925
1926 for (const auto &tp : tbl) {
1927 sol::object const &k = tp.first;
1928 sol::object const &v = tp.second;
1929
1930 if (k.is<std::string>()) {
1931 HLog(warning) << "Key for Placement > Layout of skill '" << data.name << "' was string, expected int.";
1932 return false;
1933 }
1934
1935 int lvl = k.as<int>();
1936
1937 if (lvl > MAX_SKILL_LEVEL || lvl < 0) {
1938 HLog(warning) << "Key for Placement > Layout of skill '" << data.name << "' was greater than " << MAX_SKILL_LEVEL << ".";
1939 return false;
1940 }
1941
1942 data.placement_layout_type[lvl - 1] = v.as<int>();
1943 }
1944 }
1945
1946 sol::optional<int> maybe_val = table.get<sol::optional<int>>("Layout");
1947 if (maybe_val) {
1948 fill_lvl_range(data.placement_layout_type, maybe_val.value());
1949 }
1950 } catch (sol::error &error) {
1951 HLog(error) << "Error parsing Placement > Layout for skill '" << data.name << "' - " << error.what() << ".";
1952 }
1953
1954 return true;
1955}
int placement_layout_type[MAX_SKILL_LEVEL]
Definition: SkillDefinitions.hpp:322

References fill_lvl_range(), HLog, MAX_SKILL_LEVEL, skill_config_data::name, and skill_config_data::placement_layout_type.

Referenced by parse_placement().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_placement_range()

bool SkillDatabase::parse_placement_range ( sol::table const &  table,
skill_config_data data 
)
protected
1958{
1959 try {
1960 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("Range");
1961 if (maybe_tbl) {
1962 sol::table tbl = maybe_tbl.value();
1963
1964 if (tbl.size() > MAX_SKILL_LEVEL || tbl.size() < 1)
1965 HLog(warning) << "Level table of Placement > Range for skill " << data.name << " should be of size " << MAX_SKILL_LEVEL << ", but a table of size " << tbl.size() << " was provided.";
1966
1967 for (const auto &tp : tbl) {
1968 sol::object const &k = tp.first;
1969 sol::object const &v = tp.second;
1970
1971 if (k.is<std::string>()) {
1972 HLog(warning) << "Key for Placement > Range of skill '" << data.name << "' was string, expected int.";
1973 return false;
1974 }
1975
1976 int lvl = k.as<int>();
1977
1978 if (lvl > MAX_SKILL_LEVEL || lvl < 0) {
1979 HLog(warning) << "Key for Placement > Range of skill '" << data.name << "' was greater than " << MAX_SKILL_LEVEL << ".";
1980 return false;
1981 }
1982
1983 data.placement_range[lvl - 1] = v.as<int>();
1984 }
1985 }
1986
1987 sol::optional<int> maybe_val = table.get<sol::optional<int>>("Range");
1988 if (maybe_val) {
1989 fill_lvl_range(data.placement_range, maybe_val.value());
1990 }
1991 } catch (sol::error &error) {
1992 HLog(error) << "Error parsing Placement > Range for skill '" << data.name << "' - " << error.what() << ".";
1993 }
1994
1995 return true;
1996}
int placement_range[MAX_SKILL_LEVEL]
Definition: SkillDefinitions.hpp:323

References fill_lvl_range(), HLog, MAX_SKILL_LEVEL, skill_config_data::name, and skill_config_data::placement_range.

Referenced by parse_placement().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_placement_target()

bool SkillDatabase::parse_placement_target ( sol::table const &  table,
skill_config_data data 
)
protected
2040{
2041 try {
2042 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("Target");
2043 if (maybe_tbl) {
2044 sol::table tbl = maybe_tbl.value();
2045
2046 if (tbl.size() > MAX_SKILL_LEVEL || tbl.size() < 1)
2047 HLog(warning) << "Level table of Placement > Target for skill " << data.name << " should be of size " << MAX_SKILL_LEVEL << ", but a table of size " << tbl.size() << " was provided.";
2048
2049 for (const auto &tp : tbl) {
2050 sol::object const &k = tp.first;
2051 sol::object const &v = tp.second;
2052
2053 if (k.is<std::string>()) {
2054 HLog(warning) << "Key for Placement > Target of skill '" << data.name << "' was string, expected int.";
2055 return false;
2056 }
2057
2058 int lvl = k.as<int>();
2059
2060 if (lvl > MAX_SKILL_LEVEL || lvl < 0) {
2061 HLog(warning) << "Key for Placement > Target of skill '" << data.name << "' was greater than " << MAX_SKILL_LEVEL << ".";
2062 return false;
2063 }
2064
2065 data.placement_target[lvl - 1] = v.as<int>();
2066 }
2067 }
2068
2069 sol::optional<int> maybe_val = table.get<sol::optional<int>>("Target");
2070 if (maybe_val) {
2071 fill_lvl_range(data.placement_target, maybe_val.value());
2072 }
2073 } catch (sol::error &error) {
2074 HLog(error) << "Error parsing Placement > Target for skill '" << data.name << "' - " << error.what() << ".";
2075 }
2076
2077 return true;
2078}
int placement_target[MAX_SKILL_LEVEL]
Definition: SkillDefinitions.hpp:325

References fill_lvl_range(), HLog, MAX_SKILL_LEVEL, skill_config_data::name, and skill_config_data::placement_target.

Referenced by parse_placement().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_range()

bool SkillDatabase::parse_range ( sol::table const &  table,
skill_config_data data 
)
protected
228{
229 try {
230 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("Range");
231 if (maybe_tbl) {
232 sol::table tbl = maybe_tbl.value();
233
234 if (tbl.size() > MAX_SKILL_LEVEL)
235 HLog(warning) << "Level table of Ranges for skill " << data.name << " should be of size " << MAX_SKILL_LEVEL << ", but a table of size " << tbl.size() << " was provided.";
236
237 for (const auto &tp : tbl) {
238 sol::object const &key = tp.first;
239 sol::object const &svalue = tp.second;
240
241 if (key.is<std::string>()) {
242 HLog(warning) << "Key for Range of skill '" << data.name << "' was string, expected int.";
243 return false;
244 }
245
246 int lvl = key.as<int>();
247
248 if (lvl > MAX_SKILL_LEVEL || lvl < 0) {
249 HLog(warning) << "Key for Range of skill '" << data.name << "' was greater than " << MAX_SKILL_LEVEL << ".";
250 return false;
251 }
252
253 data.use_range[lvl - 1] = svalue.as<int>();
254 }
255 }
256
257 sol::optional<int> maybe_intval = table.get<sol::optional<int>>("Range");
258 if (maybe_intval) {
259 int range = maybe_intval.value();
260 fill_lvl_range(data.use_range, range);
261 }
262
263 } catch (sol::error &error) {
264 HLog(error) << "Error parsing Range for skill '" << data.name << "' - " << error.what() << ".";
265 }
266
267 return true;
268}
int use_range[MAX_SKILL_LEVEL]
Definition: SkillDefinitions.hpp:283

References fill_lvl_range(), HLog, MAX_SKILL_LEVEL, skill_config_data::name, and skill_config_data::use_range.

Referenced by load_internal_skill_db().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_req_ammunition_cost()

bool SkillDatabase::parse_req_ammunition_cost ( sol::table const &  table,
skill_config_data data 
)
protected
1553{
1554 try {
1555 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("AmmoAmount");
1556 if (maybe_tbl) {
1557 sol::table tbl = maybe_tbl.value();
1558
1559 if (tbl.size() > MAX_SKILL_LEVEL || tbl.size() < 1)
1560 HLog(warning) << "Level table of AmmoAmount for skill " << data.name << " should be of size " << MAX_SKILL_LEVEL << ", but a table of size " << tbl.size() << " was provided.";
1561
1562 for (const auto &tp : tbl) {
1563 sol::object const &k = tp.first;
1564 sol::object const &v = tp.second;
1565
1566 if (k.is<std::string>()) {
1567 HLog(warning) << "Key for AmmoAmount of skill '" << data.name << "' was string, expected int.";
1568 return false;
1569 }
1570
1571 int lvl = k.as<int>();
1572
1573 if (lvl > MAX_SKILL_LEVEL || lvl < 0) {
1574 HLog(warning) << "Key for AmmoAmount of skill '" << data.name << "' was greater than " << MAX_SKILL_LEVEL << ".";
1575 return false;
1576 }
1577
1578 data.ammunition_cost[lvl - 1] = v.as<int>();
1579 }
1580 }
1581
1582 sol::optional<int> maybe_val = table.get<sol::optional<int>>("AmmoAmount");
1583 if (maybe_val) {
1584 fill_lvl_range(data.ammunition_cost, maybe_val.value());
1585 }
1586 } catch (sol::error &error) {
1587 HLog(error) << "Error parsing AmmoAmount for skill '" << data.name << "' - " << error.what() << ".";
1588 }
1589
1590 return true;
1591}
int ammunition_cost[MAX_SKILL_LEVEL]
Definition: SkillDefinitions.hpp:314

References skill_config_data::ammunition_cost, fill_lvl_range(), HLog, MAX_SKILL_LEVEL, and skill_config_data::name.

Referenced by parse_requirements().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_req_ammunition_type()

bool SkillDatabase::parse_req_ammunition_type ( sol::table const &  table,
skill_config_data data 
)
protected
1524{
1525 try {
1526 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("AmmoTypes");
1527 if (maybe_tbl) {
1528 sol::table tbl = maybe_tbl.value();
1529 for (auto const &t : tbl) {
1530 sol::object const &k = t.first;
1531 sol::object const &v = t.second;
1532
1533 int type = v.as<int>();
1534
1535 if (type < IT_AT_NONE || type > IT_AT_MAX) {
1536 HLog(error) << "In config for skill '" << data.name << "' AmmoTypes is out of range.";
1537 continue;
1538 }
1539
1540 data.ammunition_type |= type;
1541 }
1542 } else {
1544 }
1545 } catch (sol::error &error) {
1546 HLog(error) << "Error parsing AmmoTypes for skill '" << data.name << "' - " << error.what() << ".";
1547 }
1548
1549 return true;
1550}
@ IT_AT_NONE
Definition: ItemDefinitions.hpp:272
@ IT_AT_MAX
Definition: ItemDefinitions.hpp:282
int ammunition_type
Definition: SkillDefinitions.hpp:313

References skill_config_data::ammunition_type, HLog, IT_AT_MAX, IT_AT_NONE, and skill_config_data::name.

Referenced by parse_requirements().

+ Here is the caller graph for this function:

◆ parse_req_hp_cost()

bool SkillDatabase::parse_req_hp_cost ( sol::table const &  table,
skill_config_data data 
)
protected
1208{
1209 try {
1210 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("HPCost");
1211 if (maybe_tbl) {
1212 sol::table tbl = maybe_tbl.value();
1213
1214 if (tbl.size() > MAX_SKILL_LEVEL || tbl.size() < 1)
1215 HLog(warning) << "Level table of HPCost for skill " << data.name << " should be of size " << MAX_SKILL_LEVEL << ", but a table of size " << tbl.size() << " was provided.";
1216
1217 for (const auto &tp : tbl) {
1218 sol::object const &k = tp.first;
1219 sol::object const &v = tp.second;
1220
1221 if (k.is<std::string>()) {
1222 HLog(warning) << "Key for HPCost of skill '" << data.name << "' was string, expected int.";
1223 return false;
1224 }
1225
1226 int lvl = k.as<int>();
1227
1228 if (lvl > MAX_SKILL_LEVEL || lvl < 0) {
1229 HLog(warning) << "Key for HPCost of skill '" << data.name << "' was greater than " << MAX_SKILL_LEVEL << ".";
1230 return false;
1231 }
1232
1233 data.hp_cost[lvl - 1] = v.as<int>();
1234 }
1235 }
1236
1237 sol::optional<int> maybe_val = table.get<sol::optional<int>>("HPCost");
1238 if (maybe_val) {
1239 fill_lvl_range(data.hp_cost, maybe_val.value());
1240 }
1241 } catch (sol::error &error) {
1242 HLog(error) << "Error parsing HPCost for skill '" << data.name << "' - " << error.what() << ".";
1243 }
1244
1245 return true;
1246}
int hp_cost[MAX_SKILL_LEVEL]
Definition: SkillDefinitions.hpp:305

References fill_lvl_range(), HLog, skill_config_data::hp_cost, MAX_SKILL_LEVEL, and skill_config_data::name.

Referenced by parse_requirements().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_req_hp_rate_cost()

bool SkillDatabase::parse_req_hp_rate_cost ( sol::table const &  table,
skill_config_data data 
)
protected
1290{
1291 try {
1292 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("HPRateCost");
1293 if (maybe_tbl) {
1294 sol::table tbl = maybe_tbl.value();
1295
1296 if (tbl.size() > MAX_SKILL_LEVEL || tbl.size() < 1)
1297 HLog(warning) << "Level table of HPRateCost for skill " << data.name << " should be of size " << MAX_SKILL_LEVEL << ", but a table of size " << tbl.size() << " was provided.";
1298
1299 for (const auto &tp : tbl) {
1300 sol::object const &k = tp.first;
1301 sol::object const &v = tp.second;
1302
1303 if (k.is<std::string>()) {
1304 HLog(warning) << "Key for HPRateCost of skill '" << data.name << "' was string, expected int.";
1305 return false;
1306 }
1307
1308 int lvl = k.as<int>();
1309
1310 if (lvl > MAX_SKILL_LEVEL || lvl < 0) {
1311 HLog(warning) << "Key for HPRateCost of skill '" << data.name << "' was greater than " << MAX_SKILL_LEVEL << ".";
1312 return false;
1313 }
1314
1315 data.hp_percent_cost[lvl - 1] = v.as<int>();
1316 }
1317 }
1318
1319 sol::optional<int> maybe_val = table.get<sol::optional<int>>("HPRateCost");
1320 if (maybe_val) {
1321 fill_lvl_range(data.hp_percent_cost, maybe_val.value());
1322 }
1323 } catch (sol::error &error) {
1324 HLog(error) << "Error parsing HPRateCost for skill '" << data.name << "' - " << error.what() << ".";
1325 }
1326
1327 return true;
1328}
int hp_percent_cost[MAX_SKILL_LEVEL]
Definition: SkillDefinitions.hpp:307

References fill_lvl_range(), HLog, skill_config_data::hp_percent_cost, MAX_SKILL_LEVEL, and skill_config_data::name.

Referenced by parse_requirements().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_req_items()

bool SkillDatabase::parse_req_items ( sol::table const &  table,
skill_config_data data,
bool  equips 
)
protected
1696{
1697 try {
1698 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>(equips ? "Equips" : "Items");
1699 if (maybe_tbl) {
1700 sol::table tbl = maybe_tbl.value();
1701 skill_required_item_data &rdata = equips ? data.req_equip : data.req_items;
1702
1703 int i = 0;
1704 for (const auto &tp : tbl) {
1705 sol::object const &k = tp.first;
1706 sol::object const &v = tp.second;
1707 std::shared_ptr<const item_config_data> i_data = nullptr;
1708
1709 if (i >= MAX_SKILL_ITEM_REQUIRE) {
1710 HLog(warning) << "Size of list of required items is greater than allowed " << MAX_SKILL_ITEM_REQUIRE << " for skill '" << data.name << "'... skipping.";
1711 break;
1712 }
1713
1714 if (k.is<std::string>()) {
1715 std::string item_name = k.as<std::string>();
1716
1717 if (item_name.compare("Any") == 0) {
1718 if (v.get_type() == sol::type::number) {
1719 bool any = v.as<bool>();
1720 fill_lvl_range(rdata.any, any);
1721 } else if (v.get_type() == sol::type::table) {
1722 sol::table lvls = v.as<sol::table>();
1723
1724 for (auto const &l : lvls) {
1725 sol::object const &lk = l.first;
1726 sol::object const &lv = l.second;
1727
1728 if (lk.is<std::string>()) {
1729 HLog(warning) << "Key of any-flag for skill '" << data.name << "' was string, expected int.";
1730 continue;
1731 }
1732
1733 int lvl = lk.as<int>();
1734
1735 if (lvl > MAX_SKILL_LEVEL || lvl < 0) {
1736 HLog(warning) << "Level of any-flag for skill '" << data.name << "' was greater than " << MAX_SKILL_LEVEL << ".";
1737 continue;
1738 }
1739
1740 if (lv.get_type() != sol::type::boolean) {
1741 HLog(warning) << "Level of any-flag for skill '" << data.name << "' is not of boolean type.";
1742 continue;
1743 }
1744
1745 rdata.any[lvl - 1] = lv.as<bool>();
1746 }
1747 } else {
1748 HLog(warning) << "Invalid type provided at as amount of 'Items' for skill '" << data.name << "'... skipping.";
1749 continue;
1750 }
1751 }
1752
1753 i_data = ItemDB->get_item_by_key_name(item_name);
1754 if (i_data == nullptr) {
1755 HLog(warning) << "Item with Name " << item_name << " couldn't be found in 'Requirements > Items' for skill '" << data.name << "'... skipping.";
1756 continue;
1757 }
1758 } else if (k.is<int>()) {
1759 int id = k.as<int>();
1760 i_data = ItemDB->get_item_by_id(id);
1761
1762 if (i_data == nullptr) {
1763 HLog(warning) << "Item with ID " << id << " couldn't be found in 'Requirements > Items' for skill '" << data.name << "'... skipping.";
1764 continue;
1765 }
1766 } else {
1767 HLog(warning) << "Invalid type provided at 'Requirements > Items' for skill '" << data.name << "'... skipping.";
1768 continue;
1769 }
1770
1771 if (v.get_type() == sol::type::number) {
1772 int amount = v.as<int>();
1773 fill_lvl_range(rdata.item[i].amount, amount);
1774 } else if (v.get_type() == sol::type::table) {
1775 sol::table lvls = v.as<sol::table>();
1776
1777 for (auto const &l : lvls) {
1778 sol::object const &lk = l.first;
1779 sol::object const &lv = l.second;
1780
1781 if (lk.is<std::string>()) {
1782 HLog(warning) << "Key of 'Level' for skill '" << data.name << "' was string, expected int.";
1783 continue;
1784 }
1785
1786 int lvl = lk.as<int>();
1787
1788 if (lvl > MAX_SKILL_LEVEL || lvl < 0) {
1789 HLog(warning) << "Key of 'Amount' for skill '" << data.name << "' was greater than " << MAX_SKILL_LEVEL << ".";
1790 continue;
1791 }
1792
1793 rdata.item[i].amount[lvl - 1] = lv.as<int>();
1794 }
1795 } else {
1796 HLog(warning) << "Invalid type provided at as amount of 'Items' for skill '" << data.name << "'... skipping.";
1797 continue;
1798 }
1799 i++;
1800 }
1801
1802 if (equips)
1803 data.req_equip = rdata;
1804 else
1805 data.req_items = rdata;
1806 }
1807 } catch (sol::error &error) {
1808 HLog(error) << "Error parsing SpiritSphereCost for skill '" << data.name << "' - " << error.what() << ".";
1809 }
1810
1811 return true;
1812}
#define ItemDB
Definition: ItemDB.hpp:119
#define MAX_SKILL_ITEM_REQUIRE
Definition: SkillDefinitions.hpp:49
struct skill_required_item_data req_items
Definition: SkillDefinitions.hpp:318
struct skill_required_item_data req_equip
Definition: SkillDefinitions.hpp:319
Definition: SkillDefinitions.hpp:270
int amount[MAX_SKILL_LEVEL]
Definition: SkillDefinitions.hpp:273
bool any[MAX_SKILL_LEVEL]
Definition: SkillDefinitions.hpp:275
struct skill_required_item_data::@133 item[MAX_SKILL_ITEM_REQUIRE]

References skill_required_item_data::amount, skill_required_item_data::any, fill_lvl_range(), HLog, skill_required_item_data::item, ItemDB, MAX_SKILL_ITEM_REQUIRE, MAX_SKILL_LEVEL, skill_config_data::name, skill_config_data::req_equip, and skill_config_data::req_items.

Referenced by parse_requirements().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_req_max_hp_trigger()

bool SkillDatabase::parse_req_max_hp_trigger ( sol::table const &  table,
skill_config_data data 
)
protected
1372{
1373 try {
1374 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("MaxHPTrigger");
1375 if (maybe_tbl) {
1376 sol::table tbl = maybe_tbl.value();
1377
1378 if (tbl.size() > MAX_SKILL_LEVEL || tbl.size() < 1)
1379 HLog(warning) << "Level table of MaxHPTrigger for skill " << data.name << " should be of size " << MAX_SKILL_LEVEL << ", but a table of size " << tbl.size() << " was provided.";
1380
1381 for (const auto &tp : tbl) {
1382 sol::object const &k = tp.first;
1383 sol::object const &v = tp.second;
1384
1385 if (k.is<std::string>()) {
1386 HLog(warning) << "Key for MaxHPTrigger of skill '" << data.name << "' was string, expected int.";
1387 return false;
1388 }
1389
1390 int lvl = k.as<int>();
1391
1392 if (lvl > MAX_SKILL_LEVEL || lvl < 0) {
1393 HLog(warning) << "Key for MaxHPTrigger of skill '" << data.name << "' was greater than " << MAX_SKILL_LEVEL << ".";
1394 return false;
1395 }
1396
1397 data.max_hp_trigger[lvl - 1] = v.as<int>();
1398 }
1399 }
1400
1401 sol::optional<int> maybe_val = table.get<sol::optional<int>>("MaxHPTrigger");
1402 if (maybe_val) {
1403 fill_lvl_range(data.max_hp_trigger, maybe_val.value());
1404 }
1405 } catch (sol::error &error) {
1406 HLog(error) << "Error parsing MaxHPTrigger for skill '" << data.name << "' - " << error.what() << ".";
1407 }
1408
1409 return true;
1410}
int max_hp_trigger[MAX_SKILL_LEVEL]
Definition: SkillDefinitions.hpp:309

References fill_lvl_range(), HLog, skill_config_data::max_hp_trigger, MAX_SKILL_LEVEL, and skill_config_data::name.

Referenced by parse_requirements().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_req_max_sp_trigger()

bool SkillDatabase::parse_req_max_sp_trigger ( sol::table const &  table,
skill_config_data data 
)
protected
1413{
1414 try {
1415 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("MaxSPTrigger");
1416 if (maybe_tbl) {
1417 sol::table tbl = maybe_tbl.value();
1418
1419 if (tbl.size() > MAX_SKILL_LEVEL || tbl.size() < 1)
1420 HLog(warning) << "Level table of MaxSPTrigger for skill " << data.name << " should be of size " << MAX_SKILL_LEVEL << ", but a table of size " << tbl.size() << " was provided.";
1421
1422 for (const auto &tp : tbl) {
1423 sol::object const &k = tp.first;
1424 sol::object const &v = tp.second;
1425
1426 if (k.is<std::string>()) {
1427 HLog(warning) << "Key for MaxSPTrigger of skill '" << data.name << "' was string, expected int.";
1428 return false;
1429 }
1430
1431 int lvl = k.as<int>();
1432
1433 if (lvl > MAX_SKILL_LEVEL || lvl < 0) {
1434 HLog(warning) << "Key for MaxSPTrigger of skill '" << data.name << "' was greater than " << MAX_SKILL_LEVEL << ".";
1435 return false;
1436 }
1437
1438 data.max_sp_trigger[lvl - 1] = v.as<int>();
1439 }
1440 }
1441
1442 sol::optional<int> maybe_val = table.get<sol::optional<int>>("MaxSPTrigger");
1443 if (maybe_val) {
1444 fill_lvl_range(data.max_sp_trigger, maybe_val.value());
1445 }
1446 } catch (sol::error &error) {
1447 HLog(error) << "Error parsing MaxSPTrigger for skill '" << data.name << "' - " << error.what() << ".";
1448 }
1449
1450 return true;
1451}
int max_sp_trigger[MAX_SKILL_LEVEL]
Definition: SkillDefinitions.hpp:310

References fill_lvl_range(), HLog, MAX_SKILL_LEVEL, skill_config_data::max_sp_trigger, and skill_config_data::name.

Referenced by parse_requirements().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_req_sp_cost()

bool SkillDatabase::parse_req_sp_cost ( sol::table const &  table,
skill_config_data data 
)
protected
1249{
1250 try {
1251 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("SPCost");
1252 if (maybe_tbl) {
1253 sol::table tbl = maybe_tbl.value();
1254
1255 if (tbl.size() > MAX_SKILL_LEVEL || tbl.size() < 1)
1256 HLog(warning) << "Level table of SPCost for skill " << data.name << " should be of size " << MAX_SKILL_LEVEL << ", but a table of size " << tbl.size() << " was provided.";
1257
1258 for (const auto &tp : tbl) {
1259 sol::object const &k = tp.first;
1260 sol::object const &v = tp.second;
1261
1262 if (k.is<std::string>()) {
1263 HLog(warning) << "Key for SPCost of skill '" << data.name << "' was string, expected int.";
1264 return false;
1265 }
1266
1267 int lvl = k.as<int>();
1268
1269 if (lvl > MAX_SKILL_LEVEL || lvl < 0) {
1270 HLog(warning) << "Key for SPCost of skill '" << data.name << "' was greater than " << MAX_SKILL_LEVEL << ".";
1271 return false;
1272 }
1273
1274 data.sp_cost[lvl - 1] = v.as<int>();
1275 }
1276 }
1277
1278 sol::optional<int> maybe_val = table.get<sol::optional<int>>("SPCost");
1279 if (maybe_val) {
1280 fill_lvl_range(data.sp_cost, maybe_val.value());
1281 }
1282 } catch (sol::error &error) {
1283 HLog(error) << "Error parsing SPCost for skill '" << data.name << "' - " << error.what() << ".";
1284 }
1285
1286 return true;
1287}
int sp_cost[MAX_SKILL_LEVEL]
Definition: SkillDefinitions.hpp:306

References fill_lvl_range(), HLog, MAX_SKILL_LEVEL, skill_config_data::name, and skill_config_data::sp_cost.

Referenced by parse_requirements().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_req_sp_rate_cost()

bool SkillDatabase::parse_req_sp_rate_cost ( sol::table const &  table,
skill_config_data data 
)
protected
1331{
1332 try {
1333 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("SPRateCost");
1334 if (maybe_tbl) {
1335 sol::table tbl = maybe_tbl.value();
1336
1337 if (tbl.size() > MAX_SKILL_LEVEL || tbl.size() < 1)
1338 HLog(warning) << "Level table of SPRateCost for skill " << data.name << " should be of size " << MAX_SKILL_LEVEL << ", but a table of size " << tbl.size() << " was provided.";
1339
1340 for (const auto &tp : tbl) {
1341 sol::object const &k = tp.first;
1342 sol::object const &v = tp.second;
1343
1344 if (k.is<std::string>()) {
1345 HLog(warning) << "Key for SPRateCost of skill '" << data.name << "' was string, expected int.";
1346 return false;
1347 }
1348
1349 int lvl = k.as<int>();
1350
1351 if (lvl > MAX_SKILL_LEVEL || lvl < 0) {
1352 HLog(warning) << "Key for SPRateCost of skill '" << data.name << "' was greater than " << MAX_SKILL_LEVEL << ".";
1353 return false;
1354 }
1355
1356 data.sp_percent_cost[lvl - 1] = v.as<int>();
1357 }
1358 }
1359
1360 sol::optional<int> maybe_val = table.get<sol::optional<int>>("SPRateCost");
1361 if (maybe_val) {
1362 fill_lvl_range(data.sp_percent_cost, maybe_val.value());
1363 }
1364 } catch (sol::error &error) {
1365 HLog(error) << "Error parsing SPRateCost for skill '" << data.name << "' - " << error.what() << ".";
1366 }
1367
1368 return true;
1369}
int sp_percent_cost[MAX_SKILL_LEVEL]
Definition: SkillDefinitions.hpp:308

References fill_lvl_range(), HLog, MAX_SKILL_LEVEL, skill_config_data::name, and skill_config_data::sp_percent_cost.

Referenced by parse_requirements().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_req_spirit_sphere_cost()

bool SkillDatabase::parse_req_spirit_sphere_cost ( sol::table const &  table,
skill_config_data data 
)
protected
1655{
1656 try {
1657 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("SpiritSphereCost");
1658 if (maybe_tbl) {
1659 sol::table tbl = maybe_tbl.value();
1660
1661 if (tbl.size() > MAX_SKILL_LEVEL || tbl.size() < 1)
1662 HLog(warning) << "Level table of SpiritSphereCost for skill " << data.name << " should be of size " << MAX_SKILL_LEVEL << ", but a table of size " << tbl.size() << " was provided.";
1663
1664 for (const auto &tp : tbl) {
1665 sol::object const &k = tp.first;
1666 sol::object const &v = tp.second;
1667
1668 if (k.is<std::string>()) {
1669 HLog(warning) << "Key for SpiritSphereCost of skill '" << data.name << "' was string, expected int.";
1670 return false;
1671 }
1672
1673 int lvl = k.as<int>();
1674
1675 if (lvl > MAX_SKILL_LEVEL || lvl < 0) {
1676 HLog(warning) << "Key for SpiritSphereCost of skill '" << data.name << "' was greater than " << MAX_SKILL_LEVEL << ".";
1677 return false;
1678 }
1679
1680 data.spirit_sphere_cost[lvl - 1] = v.as<int>();
1681 }
1682 }
1683
1684 sol::optional<int> maybe_val = table.get<sol::optional<int>>("SpiritSphereCost");
1685 if (maybe_val) {
1686 fill_lvl_range(data.spirit_sphere_cost, maybe_val.value());
1687 }
1688 } catch (sol::error &error) {
1689 HLog(error) << "Error parsing SpiritSphereCost for skill '" << data.name << "' - " << error.what() << ".";
1690 }
1691
1692 return true;
1693}
int spirit_sphere_cost[MAX_SKILL_LEVEL]
Definition: SkillDefinitions.hpp:316

References fill_lvl_range(), HLog, MAX_SKILL_LEVEL, skill_config_data::name, and skill_config_data::spirit_sphere_cost.

Referenced by parse_requirements().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_req_state()

bool SkillDatabase::parse_req_state ( sol::table const &  table,
skill_config_data data 
)
protected
1594{
1595 try {
1596 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("State");
1597 if (maybe_tbl) {
1598 sol::table tbl = maybe_tbl.value();
1599 for (auto const &t : tbl) {
1600 sol::object const &k = t.first;
1601 sol::object const &v = t.second;
1602
1603 int lvl = k.as<int>();
1604
1605 if (tbl.size() > MAX_SKILL_LEVEL || tbl.size() < 1) {
1606 HLog(warning) << "Level table of State for skill " << data.name << " should be of size " << MAX_SKILL_LEVEL << ", but a table of size " << tbl.size() << " was provided.";
1607 return false;
1608 }
1609
1610 if (lvl > MAX_SKILL_LEVEL || lvl < 0) {
1611 HLog(warning) << "Level for State of skill '" << data.name << "' was out of range.";
1612 return false;
1613 }
1614
1615 if (v.get_type() == sol::type::table) {
1616 int states = 0;
1617 for (auto const &x : v.as<sol::table>()) {
1618 sol::object const &y = x.second;
1619 int state = y.as<int>();
1620
1621 if (state < SRS_NONE || state > SRS_MAX) {
1622 HLog(error) << "In config for skill '" << data.name << "' State is out of range for level " << lvl << ".";
1623 continue;
1624 }
1625
1626 states |= state;
1627 }
1628
1629 data.required_state[lvl - 1] = states;
1630 } else if (v.get_type() == sol::type::number) {
1631 int state = v.as<int>();
1632
1633 if (state < SRS_NONE || state > SRS_MAX) {
1634 HLog(error) << "In config for skill '" << data.name << "' State is out of range for level " << lvl << ".";
1635 continue;
1636 }
1637
1638 data.required_state[lvl - 1] |= state;
1639 }
1640 }
1641 }
1642
1643 sol::optional<int> maybe_val = table.get<sol::optional<int>>("State");
1644 if (maybe_val) {
1645 fill_lvl_range(data.required_state, maybe_val.value());
1646 }
1647 } catch (sol::error &error) {
1648 HLog(error) << "Error parsing State for skill '" << data.name << "' - " << error.what() << ".";
1649 }
1650
1651 return true;
1652}
@ SRS_MAX
Definition: SkillDefinitions.hpp:100
int required_state[MAX_SKILL_LEVEL]
Definition: SkillDefinitions.hpp:315

References fill_lvl_range(), HLog, MAX_SKILL_LEVEL, skill_config_data::name, skill_config_data::required_state, and SRS_MAX.

Referenced by parse_requirements().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_req_weapon_types()

bool SkillDatabase::parse_req_weapon_types ( sol::table const &  table,
skill_config_data data 
)
protected
1495{
1496 try {
1497 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("WeaponTypes");
1498 if (maybe_tbl) {
1499 sol::table tbl = maybe_tbl.value();
1500 for (auto const &t : tbl) {
1501 sol::object const &k = t.first;
1502 sol::object const &v = t.second;
1503
1504 int type = v.as<int>();
1505
1506 if (type < IT_WT_FIST || type > IT_WT_MAX_WEAPON_TYPE) {
1507 HLog(error) << "In config for skill '" << data.name << "' WeaponTypes is out of range.";
1508 continue;
1509 }
1510
1511 data.weapon_type |= type;
1512 }
1513 } else {
1514 data.weapon_type = IT_WT_FIST;
1515 }
1516 } catch (sol::error &error) {
1517 HLog(error) << "Error parsing WeaponTypes for skill '" << data.name << "' - " << error.what() << ".";
1518 }
1519
1520 return true;
1521}
@ IT_WT_FIST
Bare hands.
Definition: ItemDefinitions.hpp:100
@ IT_WT_MAX_WEAPON_TYPE
Definition: ItemDefinitions.hpp:133
int weapon_type
Definition: SkillDefinitions.hpp:312

References HLog, IT_WT_FIST, IT_WT_MAX_WEAPON_TYPE, skill_config_data::name, and skill_config_data::weapon_type.

Referenced by parse_requirements().

+ Here is the caller graph for this function:

◆ parse_req_zeny_cost()

bool SkillDatabase::parse_req_zeny_cost ( sol::table const &  table,
skill_config_data data 
)
protected
1454{
1455 try {
1456 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("ZenyCost");
1457 if (maybe_tbl) {
1458 sol::table tbl = maybe_tbl.value();
1459
1460 if (tbl.size() > MAX_SKILL_LEVEL || tbl.size() < 1)
1461 HLog(warning) << "Level table of ZenyCost for skill " << data.name << " should be of size " << MAX_SKILL_LEVEL << ", but a table of size " << tbl.size() << " was provided.";
1462
1463 for (const auto &tp : tbl) {
1464 sol::object const &k = tp.first;
1465 sol::object const &v = tp.second;
1466
1467 if (k.is<std::string>()) {
1468 HLog(warning) << "Key for ZenyCost of skill '" << data.name << "' was string, expected int.";
1469 return false;
1470 }
1471
1472 int lvl = k.as<int>();
1473
1474 if (lvl > MAX_SKILL_LEVEL || lvl < 0) {
1475 HLog(warning) << "Key for ZenyCost of skill '" << data.name << "' was greater than " << MAX_SKILL_LEVEL << ".";
1476 return false;
1477 }
1478
1479 data.zeny_cost[lvl - 1] = v.as<int>();
1480 }
1481 }
1482
1483 sol::optional<int> maybe_val = table.get<sol::optional<int>>("ZenyCost");
1484 if (maybe_val) {
1485 fill_lvl_range(data.zeny_cost, maybe_val.value());
1486 }
1487 } catch (sol::error &error) {
1488 HLog(error) << "Error parsing ZenyCost for skill '" << data.name << "' - " << error.what() << ".";
1489 }
1490
1491 return true;
1492}
int zeny_cost[MAX_SKILL_LEVEL]
Definition: SkillDefinitions.hpp:311

References fill_lvl_range(), HLog, MAX_SKILL_LEVEL, skill_config_data::name, and skill_config_data::zeny_cost.

Referenced by parse_requirements().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_requirements()

bool SkillDatabase::parse_requirements ( sol::table const &  table,
skill_config_data data 
)
protected
1155{
1156 sol::optional<sol::table> maybe_requirements = table.get<sol::optional<sol::table>>("Requirements");
1157
1158 if (maybe_requirements) {
1159 sol::table req_tbl = maybe_requirements.value();
1160
1161 if (parse_req_hp_cost(req_tbl, data) == false)
1162 return false;
1163
1164 if (parse_req_sp_cost(req_tbl, data) == false)
1165 return false;
1166
1167 if (parse_req_hp_rate_cost(req_tbl, data) == false)
1168 return false;
1169
1170 if (parse_req_sp_rate_cost(req_tbl, data) == false)
1171 return false;
1172
1173 if (parse_req_max_hp_trigger(req_tbl, data) == false)
1174 return false;
1175
1176 if (parse_req_max_sp_trigger(req_tbl, data) == false)
1177 return false;
1178
1179 if (parse_req_zeny_cost(req_tbl, data) == false)
1180 return false;
1181
1182 if (parse_req_weapon_types(req_tbl, data) == false)
1183 return false;
1184
1185 if (parse_req_ammunition_type(req_tbl, data) == false)
1186 return false;
1187
1188 if (parse_req_ammunition_cost(req_tbl, data) == false)
1189 return false;
1190
1191 if (parse_req_state(req_tbl, data) == false)
1192 return false;
1193
1194 if (parse_req_spirit_sphere_cost(req_tbl, data) == false)
1195 return false;
1196
1197 if (parse_req_items(req_tbl, data, false) == false)
1198 return false;
1199
1200 if (parse_req_items(req_tbl, data, true) == false)
1201 return false;
1202 }
1203
1204 return true;
1205}
bool parse_req_hp_rate_cost(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:1289
bool parse_req_hp_cost(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:1207
bool parse_req_sp_cost(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:1248
bool parse_req_items(sol::table const &table, skill_config_data &data, bool equips)
Definition: SkillDB.cpp:1695
bool parse_req_state(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:1593
bool parse_req_ammunition_type(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:1523
bool parse_req_spirit_sphere_cost(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:1654
bool parse_req_weapon_types(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:1494
bool parse_req_ammunition_cost(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:1552
bool parse_req_max_sp_trigger(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:1412
bool parse_req_zeny_cost(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:1453
bool parse_req_sp_rate_cost(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:1330
bool parse_req_max_hp_trigger(sol::table const &table, skill_config_data &data)
Definition: SkillDB.cpp:1371

References parse_req_ammunition_cost(), parse_req_ammunition_type(), parse_req_hp_cost(), parse_req_hp_rate_cost(), parse_req_items(), parse_req_max_hp_trigger(), parse_req_max_sp_trigger(), parse_req_sp_cost(), parse_req_sp_rate_cost(), parse_req_spirit_sphere_cost(), parse_req_state(), parse_req_weapon_types(), and parse_req_zeny_cost().

Referenced by load_internal_skill_db().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_skill_data1()

bool SkillDatabase::parse_skill_data1 ( sol::table const &  table,
skill_config_data data 
)
protected
895{
896 try {
897 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("SkillData1");
898 if (maybe_tbl) {
899 sol::table tbl = maybe_tbl.value();
900
901 if (tbl.size() > MAX_SKILL_LEVEL || tbl.size() < 1)
902 HLog(warning) << "Level table of SkillData1 for skill " << data.name << " should be of size " << MAX_SKILL_LEVEL << ", but a table of size " << tbl.size() << " was provided.";
903
904 for (const auto &tp : tbl) {
905 sol::object const &k = tp.first;
906 sol::object const &v = tp.second;
907
908 if (k.is<std::string>()) {
909 HLog(warning) << "Key for SkillData1 of skill '" << data.name << "' was string, expected int.";
910 return false;
911 }
912
913 int lvl = k.as<int>();
914
915 if (lvl > MAX_SKILL_LEVEL || lvl < 0) {
916 HLog(warning) << "Key for SkillData1 of skill '" << data.name << "' was greater than " << MAX_SKILL_LEVEL << ".";
917 return false;
918 }
919
920 data.upkeep_time[lvl - 1] = v.as<int>();
921 }
922 }
923
924 sol::optional<int> maybe_val = table.get<sol::optional<int>>("SkillData1");
925 if (maybe_val) {
926 fill_lvl_range(data.upkeep_time, maybe_val.value());
927 }
928 } catch (sol::error &error) {
929 HLog(error) << "Error parsing SkillData1 for skill '" << data.name << "' - " << error.what() << ".";
930 }
931
932 return true;
933}
int upkeep_time[MAX_SKILL_LEVEL]
Definition: SkillDefinitions.hpp:299

References fill_lvl_range(), HLog, MAX_SKILL_LEVEL, skill_config_data::name, and skill_config_data::upkeep_time.

Referenced by load_internal_skill_db().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_skill_data2()

bool SkillDatabase::parse_skill_data2 ( sol::table const &  table,
skill_config_data data 
)
protected
936{
937 try {
938 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("SkillData2");
939 if (maybe_tbl) {
940 sol::table tbl = maybe_tbl.value();
941
942 if (tbl.size() > MAX_SKILL_LEVEL || tbl.size() < 1)
943 HLog(warning) << "Level table of SkillData2 for skill " << data.name << " should be of size " << MAX_SKILL_LEVEL << ", but a table of size " << tbl.size() << " was provided.";
944
945 for (const auto &tp : tbl) {
946 sol::object const &k = tp.first;
947 sol::object const &v = tp.second;
948
949 if (k.is<std::string>()) {
950 HLog(warning) << "Key for SkillData2 of skill '" << data.name << "' was string, expected int.";
951 return false;
952 }
953
954 int lvl = k.as<int>();
955
956 if (lvl > MAX_SKILL_LEVEL || lvl < 0) {
957 HLog(warning) << "Key for SkillData2 of skill '" << data.name << "' was greater than " << MAX_SKILL_LEVEL << ".";
958 return false;
959 }
960
961 data.upkeep_time2[lvl - 1] = v.as<int>();
962 }
963 }
964
965 sol::optional<int> maybe_val = table.get<sol::optional<int>>("SkillData2");
966 if (maybe_val) {
967 fill_lvl_range(data.upkeep_time2, maybe_val.value());
968 }
969 } catch (sol::error &error) {
970 HLog(error) << "Error parsing SkillData2 for skill '" << data.name << "' - " << error.what() << ".";
971 }
972
973 return true;
974}
int upkeep_time2[MAX_SKILL_LEVEL]
Definition: SkillDefinitions.hpp:300

References fill_lvl_range(), HLog, MAX_SKILL_LEVEL, skill_config_data::name, and skill_config_data::upkeep_time2.

Referenced by load_internal_skill_db().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_skill_delay_options()

bool SkillDatabase::parse_skill_delay_options ( sol::table const &  table,
skill_config_data data 
)
protected
1107{
1108 try {
1109 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("SkillDelayOptions");
1110 if (maybe_tbl) {
1111 sol::table tbl = maybe_tbl.value();
1112 int options = 0;
1113
1114 for (const auto &tp : tbl) {
1115 sol::object const &v = tp.second;
1116
1117 if (v.get_type() == sol::type::string) {
1118 std::string option = v.as<std::string>();
1119 if (option.compare("IgnoreDex") == 0)
1120 options |= 1;
1121 else if (option.compare("IgnoreStatusEffect") == 0)
1122 options |= 2;
1123 else if (option.compare("IgnoreItemBonus") == 0)
1124 options |= 4;
1125 } else {
1126 HLog(warning) << "Invalid type provided for SkillDelayOptions of skill '" << data.name << "'.";
1127 continue;
1128 }
1129 }
1130 data.skill_delay_options = options;
1131 }
1132
1133 sol::optional<std::string> maybe_val = table.get<sol::optional<std::string>>("SkillDelayOptions");
1134 if (maybe_val) {
1135 std::string option = maybe_val.value();
1136 int options = 0;
1137
1138 if (option.compare("IgnoreDex") == 0)
1139 options |= 1;
1140 else if (option.compare("IgnoreStatusEffect") == 0)
1141 options |= 2;
1142 else if (option.compare("IgnoreItemBonus") == 0)
1143 options |= 4;
1144
1145 data.skill_delay_options = options;
1146 }
1147 } catch (sol::error &error) {
1148 HLog(error) << "Error parsing SkillDelayOptions for skill '" << data.name << "' - " << error.what() << ".";
1149 }
1150
1151 return true;
1152}
int skill_delay_options
Definition: SkillDefinitions.hpp:304

References HLog, skill_config_data::name, and skill_config_data::skill_delay_options.

Referenced by load_internal_skill_db().

+ Here is the caller graph for this function:

◆ parse_skill_info()

bool SkillDatabase::parse_skill_info ( sol::table const &  table,
skill_config_data data 
)
protected
370{
371 try {
372 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("SkillInfo");
373 if (maybe_tbl) {
374 sol::table tbl = maybe_tbl.value();
375 for (auto const &t : tbl) {
376 sol::object const &k = t.first;
377 sol::object const &v = t.second;
378
379 int type = v.as<int>();
380
381 if (type < SK_SUBTYPE_NONE || type > SK_SUBTYPE_IS_COMBO_SKILL) {
382 HLog(error) << "In config for skill '" << data.name << "' SkillInfo is out of range.";
383 continue;
384 }
385
386 data.secondary_type |= type;
387 }
388 } else {
390 }
391 } catch (sol::error &error) {
392 HLog(error) << "Error parsing SkillInfo for skill '" << data.name << "' - " << error.what() << ".";
393 }
394
395 return true;
396}
@ SK_SUBTYPE_NONE
Definition: SkillDefinitions.hpp:114
@ SK_SUBTYPE_IS_COMBO_SKILL
Definition: SkillDefinitions.hpp:135
int secondary_type
Definition: SkillDefinitions.hpp:286

References HLog, skill_config_data::name, skill_config_data::secondary_type, SK_SUBTYPE_IS_COMBO_SKILL, and SK_SUBTYPE_NONE.

Referenced by load_internal_skill_db().

+ Here is the caller graph for this function:

◆ parse_skill_type()

bool SkillDatabase::parse_skill_type ( sol::table const &  table,
skill_config_data data 
)
protected
341{
342 try {
343 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("SkillType");
344 if (maybe_tbl) {
345 sol::table tbl = maybe_tbl.value();
346 for (auto const &t : tbl) {
347 sol::object const &k = t.first;
348 sol::object const &v = t.second;
349
350 int type = v.as<int>();
351
352 if (type < SK_TYPE_PASSIVE || type > SK_TYPE_TRAP) {
353 HLog(error) << "In config for skill '" << data.name << "' SkillType is out of range.";
354 continue;
355 }
356
357 data.primary_type |= type;
358 }
359 } else {
361 }
362 } catch (sol::error &error) {
363 HLog(error) << "Error parsing SkillType for skill '" << data.name << "' - " << error.what() << ".";
364 }
365
366 return true;
367}
@ SK_TYPE_PASSIVE
Definition: SkillDefinitions.hpp:104
@ SK_TYPE_TRAP
Definition: SkillDefinitions.hpp:110
int primary_type
Definition: SkillDefinitions.hpp:285

References HLog, skill_config_data::name, skill_config_data::primary_type, SK_TYPE_PASSIVE, and SK_TYPE_TRAP.

Referenced by load_internal_skill_db().

+ Here is the caller graph for this function:

◆ parse_splash_range()

bool SkillDatabase::parse_splash_range ( sol::table const &  table,
skill_config_data data 
)
protected
526{
527 try {
528 sol::optional<sol::table> maybe_tbl = table.get<sol::optional<sol::table>>("SplashRange");
529 if (maybe_tbl) {
530 sol::table tbl = maybe_tbl.value();
531
532 if (tbl.size() > MAX_SKILL_LEVEL || tbl.size() < 1)
533 HLog(warning) << "Level table of SplashRange for skill " << data.name << " should be of size " << MAX_SKILL_LEVEL << ", but a table of size " << tbl.size() << " was provided.";
534
535 for (const auto &tp : tbl) {
536 sol::object const &k = tp.first;
537 sol::object const &v = tp.second;
538
539 if (k.is<std::string>()) {
540 HLog(warning) << "Key for SplashRange of skill '" << data.name << "' was string, expected int.";
541 return false;
542 }
543
544 int lvl = k.as<int>();
545
546 if (lvl > MAX_SKILL_LEVEL || lvl < 0) {
547 HLog(warning) << "Key for SplashRange of skill '" << data.name << "' was greater than " << MAX_SKILL_LEVEL << ".";
548 return false;
549 }
550
551 data.splash_range[lvl - 1] = v.as<int>();
552 }
553 }
554
555 sol::optional<int> maybe_intval = table.get<sol::optional<int>>("SplashRange");
556 if (maybe_intval) {
557 fill_lvl_range(data.splash_range, maybe_intval.value());
558 }
559 } catch (sol::error &error) {
560 HLog(error) << "Error parsing SplashRange for skill '" << data.name << "' - " << error.what() << ".";
561 }
562
563 return true;
564}
int splash_range[MAX_SKILL_LEVEL]
Definition: SkillDefinitions.hpp:290

References fill_lvl_range(), HLog, MAX_SKILL_LEVEL, skill_config_data::name, and skill_config_data::splash_range.

Referenced by load_internal_skill_db().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ _skill_db

LockedLookupTable<uint32_t, std::shared_ptr<const skill_config_data> > Horizon::Zone::SkillDatabase::_skill_db
private

◆ _skill_str_db

LockedLookupTable<std::string, std::shared_ptr<const skill_config_data> > Horizon::Zone::SkillDatabase::_skill_str_db
private

◆ _skill_tree_db

LockedLookupTable<job_class_type, std::vector<std::shared_ptr<const skill_tree_config> > > Horizon::Zone::SkillDatabase::_skill_tree_db
private

The documentation for this class was generated from the following files: