2020-01-31 19:34:47 +01:00
|
|
|
/*
|
|
|
|
Copyright (c) 2019-2020 Péter Magyar
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in all
|
|
|
|
copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2020-04-14 16:55:21 +02:00
|
|
|
#ifndef ESS_H
|
|
|
|
#define ESS_H
|
2019-04-20 14:02:55 +02:00
|
|
|
|
2020-02-01 11:17:24 +01:00
|
|
|
#include "core/object.h"
|
|
|
|
|
2020-01-09 04:27:19 +01:00
|
|
|
#include "core/engine.h"
|
2019-04-20 14:02:55 +02:00
|
|
|
|
|
|
|
#include "core/resource.h"
|
|
|
|
#include "core/ustring.h"
|
|
|
|
#include "scene/main/node.h"
|
|
|
|
|
|
|
|
#include "core/bind/core_bind.h"
|
|
|
|
|
2020-04-14 16:46:24 +02:00
|
|
|
class ESSResourceDB;
|
2020-04-18 14:31:36 +02:00
|
|
|
class ESSEntitySpawner;
|
2020-02-02 02:44:37 +01:00
|
|
|
class EntityCreateInfo;
|
2019-04-20 14:02:55 +02:00
|
|
|
|
2020-04-14 16:55:21 +02:00
|
|
|
class ESS : public Object {
|
|
|
|
GDCLASS(ESS, Object);
|
2019-04-20 14:02:55 +02:00
|
|
|
|
|
|
|
public:
|
2020-04-14 16:55:21 +02:00
|
|
|
static ESS *get_instance();
|
2019-04-20 14:02:55 +02:00
|
|
|
|
2020-03-10 13:24:14 +01:00
|
|
|
bool get_use_spell_points() const;
|
|
|
|
void set_use_spell_points(const bool value);
|
2020-02-21 11:56:57 +01:00
|
|
|
|
2020-03-10 13:24:14 +01:00
|
|
|
bool get_scale_spells_by_default() const;
|
|
|
|
void set_scale_spells_by_default(const bool value);
|
2020-02-02 02:44:37 +01:00
|
|
|
|
2020-03-10 13:24:14 +01:00
|
|
|
bool get_automatic_load() const;
|
|
|
|
void set_automatic_load(const bool load);
|
|
|
|
|
2020-04-14 14:15:38 +02:00
|
|
|
bool get_load_folders() const;
|
|
|
|
void set_load_folders(const bool load);
|
|
|
|
|
2020-03-17 22:35:29 +01:00
|
|
|
bool get_use_class_xp() const;
|
|
|
|
void set_use_class_xp(const bool value);
|
|
|
|
|
|
|
|
bool get_automatic_class_levelups() const;
|
|
|
|
void set_automatic_class_levelups(const bool value);
|
|
|
|
|
|
|
|
bool get_use_global_class_level() const;
|
|
|
|
void set_use_global_class_level(const bool value);
|
|
|
|
|
2020-03-20 03:29:36 +01:00
|
|
|
bool get_allow_class_spell_learning() const;
|
|
|
|
void set_allow_class_spell_learning(const bool value);
|
|
|
|
|
|
|
|
bool get_allow_class_recipe_learning() const;
|
|
|
|
void set_allow_class_recipe_learning(const bool value);
|
|
|
|
|
2020-04-14 16:46:24 +02:00
|
|
|
Ref<ESSResourceDB> get_resource_db();
|
2020-04-18 14:31:36 +02:00
|
|
|
void set_resource_db(const Ref<ESSResourceDB> &resource_db);
|
|
|
|
|
|
|
|
Ref<ESSEntitySpawner> get_entity_spawner();
|
|
|
|
void set_entity_spawner(const Ref<ESSEntitySpawner> &spawner);
|
|
|
|
|
|
|
|
String get_resource_db_path();
|
|
|
|
void set_resource_db_path(const String &path);
|
|
|
|
|
|
|
|
String get_entity_spawner_path();
|
|
|
|
void set_entity_spawner_path(const String &path);
|
|
|
|
|
|
|
|
void request_entity_spawn(Ref<EntityCreateInfo> info);
|
|
|
|
void request_entity_spawn_deferred(Ref<EntityCreateInfo> info);
|
|
|
|
|
2020-04-14 16:46:24 +02:00
|
|
|
void load_resource_db();
|
2020-04-18 14:31:36 +02:00
|
|
|
void load_entity_spawner();
|
2020-04-14 14:15:38 +02:00
|
|
|
Ref<Resource> load_resource(const String &path, const String &type_hint = "");
|
|
|
|
|
2020-04-18 14:31:36 +02:00
|
|
|
void load_all();
|
|
|
|
|
|
|
|
void setup(const Ref<ESSResourceDB> &resource_db, const Ref<ESSEntitySpawner> &entity_spawner);
|
2019-04-20 14:02:55 +02:00
|
|
|
|
2020-04-25 14:38:52 +02:00
|
|
|
//Stats
|
|
|
|
String stat_get_string() const;
|
|
|
|
void stat_set_string(const String &stat_enum_string);
|
|
|
|
|
|
|
|
int stat_get_id(const StringName &name) const;
|
|
|
|
StringName stat_get_name(const int id) const;
|
2020-04-25 18:51:37 +02:00
|
|
|
|
|
|
|
int stat_get_property_id(const StringName &name) const;
|
|
|
|
StringName stat_get_property_name(const int id) const;
|
2020-04-25 19:02:17 +02:00
|
|
|
bool stat_is_property(const StringName &name) const;
|
2020-04-25 18:51:37 +02:00
|
|
|
|
2020-04-25 14:38:52 +02:00
|
|
|
int stat_get_count() const;
|
|
|
|
|
|
|
|
PoolStringArray stats_get() const;
|
|
|
|
void stats_set(const PoolStringArray &array);
|
|
|
|
|
|
|
|
int stat_get_main_stat_count() const;
|
|
|
|
void stat_set_main_stat_count(const int index);
|
|
|
|
|
2020-04-14 16:55:21 +02:00
|
|
|
ESS();
|
|
|
|
~ESS();
|
2019-04-20 14:02:55 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
private:
|
2020-04-14 16:46:24 +02:00
|
|
|
bool _automatic_load;
|
2020-04-18 14:31:36 +02:00
|
|
|
|
2020-04-14 16:46:24 +02:00
|
|
|
Ref<ESSResourceDB> _ess_resource_db;
|
2020-04-18 14:31:36 +02:00
|
|
|
Ref<ESSEntitySpawner> _ess_entity_spawner;
|
|
|
|
|
|
|
|
String _ess_resource_db_path;
|
|
|
|
String _ess_entity_spawner_path;
|
2019-10-13 15:21:28 +02:00
|
|
|
|
2020-04-14 16:55:21 +02:00
|
|
|
static ESS *instance;
|
2019-04-20 14:02:55 +02:00
|
|
|
|
2020-02-21 11:56:57 +01:00
|
|
|
bool _use_spell_points;
|
2020-03-10 13:24:14 +01:00
|
|
|
bool _scale_spells_by_default;
|
2020-03-17 22:35:29 +01:00
|
|
|
bool _automatic_class_levelups;
|
|
|
|
bool _use_global_class_level;
|
2020-04-14 16:46:24 +02:00
|
|
|
bool _use_class_xp;
|
2020-03-20 03:29:36 +01:00
|
|
|
bool _allow_class_spell_learning;
|
|
|
|
bool _allow_class_recipe_learning;
|
2020-04-25 14:38:52 +02:00
|
|
|
|
|
|
|
//Stats
|
|
|
|
Vector<StringName> _stat_id_to_name;
|
|
|
|
HashMap<StringName, int> _stat_name_to_id;
|
2020-04-25 18:51:37 +02:00
|
|
|
|
|
|
|
Vector<StringName> _stat_id_to_property;
|
|
|
|
HashMap<StringName, int> _stat_property_to_id;
|
|
|
|
|
2020-04-25 14:38:52 +02:00
|
|
|
String _stat_enum_string;
|
|
|
|
int _stat_main_stat_count;
|
2019-04-20 14:02:55 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|