From dbc7bde24bb048a665a068da3dc9e78b04c4c726 Mon Sep 17 00:00:00 2001 From: Relintai Date: Fri, 10 Jul 2020 15:24:14 +0200 Subject: [PATCH] Now Entity only has one level property instead of separate class and character levels. Updated notifications accordingly. --- data/auras/aura.cpp | 37 ++-- data/auras/aura.h | 6 +- entities/ai/entity_ai.cpp | 30 +--- entities/ai/entity_ai.h | 6 +- entities/entity.cpp | 297 ++++++++++----------------------- entities/entity.h | 55 ++---- utility/entity_create_info.cpp | 68 +++----- utility/entity_create_info.h | 20 +-- 8 files changed, 156 insertions(+), 363 deletions(-) diff --git a/data/auras/aura.cpp b/data/auras/aura.cpp index f8e4e75..281872a 100644 --- a/data/auras/aura.cpp +++ b/data/auras/aura.cpp @@ -686,19 +686,13 @@ void Aura::notification_sxp_gained(Ref data, int value) { call("_notification_sxp_gained", data, value); } -void Aura::notification_sclass_level_up(Ref data, int value) { +void Aura::notification_slevel_up(Ref data, int value) { ERR_FAIL_COND(!data.is_valid()); - if (has_method("_notification_sclass_level_up")) - call("_notification_sclass_level_up", data, value); + if (has_method("_notification_slevel_up")) + call("_notification_slevel_up", data, value); } -void Aura::notification_scharacter_level_up(Ref data, int value) { - ERR_FAIL_COND(!data.is_valid()); - - if (has_method("_notification_scharacter_level_up")) - call("_notification_scharacter_level_up", data, value); -} void Aura::notification_sentity_resource_added(Ref data, Ref resource) { ERR_FAIL_COND(!data.is_valid()); ERR_FAIL_COND(!resource.is_valid()); @@ -784,18 +778,11 @@ void Aura::notification_cxp_gained(Ref data, int value) { call("_notification_cxp_gained", data, value); } -void Aura::notification_cclass_level_up(Ref data, int value) { +void Aura::notification_clevel_up(Ref data, int value) { ERR_FAIL_COND(!data.is_valid()); - if (has_method("_notification_cclass_level_up")) - call("_notification_cclass_level_up", data, value); -} - -void Aura::notification_ccharacter_level_up(Ref data, int value) { - ERR_FAIL_COND(!data.is_valid()); - - if (has_method("_notification_ccharacter_level_up")) - call("_notification_ccharacter_level_up", data, value); + if (has_method("_notification_clevel_up")) + call("_notification_clevel_up", data, value); } void Aura::notification_centity_resource_added(Ref data, Ref resource) { @@ -1352,8 +1339,7 @@ void Aura::_bind_methods() { ClassDB::bind_method(D_METHOD("son_physics_process", "data"), &Aura::son_physics_process); ClassDB::bind_method(D_METHOD("notification_sxp_gained", "data", "value"), &Aura::notification_sxp_gained); - ClassDB::bind_method(D_METHOD("notification_sclass_level_up", "data", "value"), &Aura::notification_sclass_level_up); - ClassDB::bind_method(D_METHOD("notification_scharacter_level_up", "data", "value"), &Aura::notification_scharacter_level_up); + ClassDB::bind_method(D_METHOD("notification_slevel_up", "data", "value"), &Aura::notification_slevel_up); ClassDB::bind_method(D_METHOD("notification_sentity_resource_added", "data", "value"), &Aura::notification_sentity_resource_added); ClassDB::bind_method(D_METHOD("notification_sentity_resource_removed", "data", "value"), &Aura::notification_sentity_resource_removed); @@ -1375,8 +1361,7 @@ void Aura::_bind_methods() { BIND_VMETHOD(MethodInfo("_son_physics_process", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"))); BIND_VMETHOD(MethodInfo("_notification_sxp_gained", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::INT, "value"))); - BIND_VMETHOD(MethodInfo("_notification_sclass_level_up", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::INT, "value"))); - BIND_VMETHOD(MethodInfo("_notification_scharacter_level_up", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::INT, "value"))); + BIND_VMETHOD(MethodInfo("_notification_slevel_up", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::INT, "value"))); BIND_VMETHOD(MethodInfo("_notification_sentity_resource_added", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::INT, "value"))); BIND_VMETHOD(MethodInfo("_notification_sentity_resource_removed", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::INT, "value"))); @@ -1403,8 +1388,7 @@ void Aura::_bind_methods() { ClassDB::bind_method(D_METHOD("notification_cgcd_finished", "data"), &Aura::notification_cgcd_finished); ClassDB::bind_method(D_METHOD("notification_cxp_gained", "data", "value"), &Aura::notification_cxp_gained); - ClassDB::bind_method(D_METHOD("notification_cclass_level_up", "data", "value"), &Aura::notification_cclass_level_up); - ClassDB::bind_method(D_METHOD("notification_ccharacter_level_up", "data", "value"), &Aura::notification_ccharacter_level_up); + ClassDB::bind_method(D_METHOD("notification_clevel_up", "data", "value"), &Aura::notification_clevel_up); ClassDB::bind_method(D_METHOD("notification_centity_resource_added", "data", "value"), &Aura::notification_centity_resource_added); ClassDB::bind_method(D_METHOD("notification_centity_resource_removed", "data", "value"), &Aura::notification_centity_resource_removed); @@ -1435,8 +1419,7 @@ void Aura::_bind_methods() { BIND_VMETHOD(MethodInfo("_notification_cgcd_finished", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"))); BIND_VMETHOD(MethodInfo("_notification_cxp_gained", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::INT, "value"))); - BIND_VMETHOD(MethodInfo("_notification_cclass_level_up", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::INT, "value"))); - BIND_VMETHOD(MethodInfo("_notification_ccharacter_level_up", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::INT, "value"))); + BIND_VMETHOD(MethodInfo("_notification_clevel_up", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::INT, "value"))); BIND_VMETHOD(MethodInfo("_notification_centity_resource_added", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::INT, "value"))); BIND_VMETHOD(MethodInfo("_notification_centity_resource_removed", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "AuraData"), PropertyInfo(Variant::INT, "value"))); diff --git a/data/auras/aura.h b/data/auras/aura.h index 5b30360..7d8099f 100644 --- a/data/auras/aura.h +++ b/data/auras/aura.h @@ -276,8 +276,7 @@ public: void son_physics_process(Ref data); void notification_sxp_gained(Ref data, int value); - void notification_sclass_level_up(Ref data, int value); - void notification_scharacter_level_up(Ref data, int value); + void notification_slevel_up(Ref data, int value); void notification_sentity_resource_added(Ref data, Ref resource); void notification_sentity_resource_removed(Ref data, Ref resource); @@ -299,8 +298,7 @@ public: void notification_cgcd_finished(Ref data); void notification_cxp_gained(Ref data, int value); - void notification_cclass_level_up(Ref data, int value); - void notification_ccharacter_level_up(Ref data, int value); + void notification_clevel_up(Ref data, int value); void notification_centity_resource_added(Ref data, Ref resource); void notification_centity_resource_removed(Ref data, Ref resource); diff --git a/entities/ai/entity_ai.cpp b/entities/ai/entity_ai.cpp index 64e8d23..b3de96a 100644 --- a/entities/ai/entity_ai.cpp +++ b/entities/ai/entity_ai.cpp @@ -241,32 +241,18 @@ void EntityAI::notification_sxp_gained_bind(Node *entity, int value) { notification_sxp_gained(e, value); } -void EntityAI::notification_sclass_level_up(Entity *entity, int value) { - if (has_method("_notification_sclass_level_up")) - call("_notification_sclass_level_up", entity); +void EntityAI::notification_slevel_up(Entity *entity, int value) { + if (has_method("_notification_slevel_up")) + call("_notification_slevel_up", entity); } -void EntityAI::notification_sclass_level_up_bind(Node *entity, int value) { +void EntityAI::notification_slevel_up_bind(Node *entity, int value) { ERR_FAIL_COND(!INSTANCE_VALIDATE(entity)); Entity *e = Object::cast_to(entity); ERR_FAIL_COND(e == NULL); - notification_sclass_level_up(e, value); -} - -void EntityAI::notification_scharacter_level_up(Entity *entity, int value) { - if (has_method("_notification_scharacter_level_up")) - call("_notification_scharacter_level_up", entity); -} -void EntityAI::notification_scharacter_level_up_bind(Node *entity, int value) { - ERR_FAIL_COND(!INSTANCE_VALIDATE(entity)); - - Entity *e = Object::cast_to(entity); - - ERR_FAIL_COND(e == NULL); - - notification_scharacter_level_up(e, value); + notification_slevel_up(e, value); } void EntityAI::notification_sentity_resource_added(Ref resource) { @@ -436,8 +422,7 @@ void EntityAI::_bind_methods() { ClassDB::bind_method(D_METHOD("notification_sgcd_finished", "entity"), &EntityAI::notification_sgcd_finished_bind); ClassDB::bind_method(D_METHOD("notification_sxp_gained", "entity", "value"), &EntityAI::notification_sxp_gained_bind); - ClassDB::bind_method(D_METHOD("notification_sclass_level_up", "entity", "value"), &EntityAI::notification_sclass_level_up_bind); - ClassDB::bind_method(D_METHOD("notification_scharacter_level_up", "entity", "value"), &EntityAI::notification_scharacter_level_up_bind); + ClassDB::bind_method(D_METHOD("notification_slevel_up", "entity", "value"), &EntityAI::notification_slevel_up_bind); ClassDB::bind_method(D_METHOD("notification_sentity_resource_added", "resource"), &EntityAI::notification_sentity_resource_added); ClassDB::bind_method(D_METHOD("notification_sentity_resource_removed", "resource"), &EntityAI::notification_sentity_resource_removed); @@ -454,8 +439,7 @@ void EntityAI::_bind_methods() { BIND_VMETHOD(MethodInfo("_notification_sgcd_finished", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"))); BIND_VMETHOD(MethodInfo("_notification_sxp_gained", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::INT, "value"))); - BIND_VMETHOD(MethodInfo("_notification_sclass_level_up", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::INT, "value"))); - BIND_VMETHOD(MethodInfo("_notification_scharacter_level_up", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::INT, "value"))); + BIND_VMETHOD(MethodInfo("_notification_slevel_up", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::INT, "value"))); BIND_VMETHOD(MethodInfo("_notification_sentity_resource_added", PropertyInfo(Variant::OBJECT, "resource", PROPERTY_HINT_RESOURCE_TYPE, "EntityResource"))); BIND_VMETHOD(MethodInfo("_notification_sentity_resource_removed", PropertyInfo(Variant::OBJECT, "resource", PROPERTY_HINT_RESOURCE_TYPE, "EntityResource"))); diff --git a/entities/ai/entity_ai.h b/entities/ai/entity_ai.h index 1614ba0..912d488 100644 --- a/entities/ai/entity_ai.h +++ b/entities/ai/entity_ai.h @@ -95,10 +95,8 @@ public: void notification_sxp_gained(Entity *entity, int value); void notification_sxp_gained_bind(Node *entity, int value); - void notification_sclass_level_up(Entity *entity, int value); - void notification_sclass_level_up_bind(Node *entity, int value); - void notification_scharacter_level_up(Entity *entity, int value); - void notification_scharacter_level_up_bind(Node *entity, int value); + void notification_slevel_up(Entity *entity, int value); + void notification_slevel_up_bind(Node *entity, int value); void notification_sentity_resource_added(Ref resource); void notification_sentity_resource_removed(Ref resource); diff --git a/entities/entity.cpp b/entities/entity.cpp index 5556f27..5b6de89 100644 --- a/entities/entity.cpp +++ b/entities/entity.cpp @@ -424,72 +424,38 @@ void Entity::setc_model_index(int value) { } } -int Entity::gets_class_level() { - return _s_class_level; +int Entity::gets_level() { + return _s_level; } -void Entity::sets_class_level(int value) { - _s_class_level = value; +void Entity::sets_level(int value) { + _s_level = value; - emit_signal("son_character_level_changed", this, value); + emit_signal("son_level_changed", this, value); - VRPC(setc_class_level, value); + VRPC(setc_level, value); } -int Entity::getc_class_level() { - return _c_class_level; +int Entity::getc_level() { + return _c_level; } -void Entity::setc_class_level(int value) { - _c_class_level = value; +void Entity::setc_level(int value) { + _c_level = value; - emit_signal("con_character_level_changed", this, value); + emit_signal("con_level_changed", this, value); } -int Entity::gets_character_level() { - return _s_character_level; +int Entity::gets_xp() { + return _s_xp; } -void Entity::sets_character_level(int value) { - _s_character_level = value; +void Entity::sets_xp(int value) { + _s_xp = value; - emit_signal("son_character_level_changed", this, value); - - VRPC(setc_character_level, value); + ORPC(setc_xp, value); } -int Entity::getc_character_level() { - return _c_character_level; +int Entity::getc_xp() { + return _c_xp; } -void Entity::setc_character_level(int value) { - _c_character_level = value; - - emit_signal("con_character_level_changed", this, value); -} - -int Entity::gets_class_xp() { - return _s_class_xp; -} -void Entity::sets_class_xp(int value) { - _s_class_xp = value; - - ORPC(setc_class_xp, value); -} -int Entity::getc_class_xp() { - return _c_class_xp; -} -void Entity::setc_class_xp(int value) { - _c_class_xp = value; -} - -int Entity::gets_character_xp() { - return _s_character_xp; -} -void Entity::sets_character_xp(int value) { - _s_character_xp = value; - - ORPC(setc_character_xp, value); -} -int Entity::getc_character_xp() { - return _c_character_xp; -} -void Entity::setc_character_xp(int value) { - _c_character_xp = value; +void Entity::setc_xp(int value) { + _c_xp = value; } int Entity::gets_money() { @@ -637,11 +603,9 @@ void Entity::setup(Ref info) { sets_original_entity_controller(info->get_entity_controller()); sets_entity_controller(info->get_entity_controller()); - _s_character_level = info->get_character_level(); - _s_class_level = info->get_class_level(); + _s_level = info->get_level(); - _s_class_xp = info->get_class_xp(); - _s_character_xp = info->get_character_xp(); + _s_xp = info->get_xp(); sets_entity_name(info->get_entity_name()); @@ -676,11 +640,12 @@ void Entity::_setup() { } if (gets_entity_player_type() == EntityEnums::ENTITY_PLAYER_TYPE_PLAYER || gets_entity_player_type() == EntityEnums::ENTITY_PLAYER_TYPE_DISPLAY) { + /* if (ESS::get_singleton()->get_use_global_class_level()) { Ref cp = ProfileManager::get_singleton()->getc_player_profile()->get_class_profile(gets_entity_data()->get_path()); if (cp.is_valid()) { - int leveldiff = cp->get_level() - _s_class_level; + int leveldiff = cp->get_level() - _s_level; sets_class_level(cp->get_level()); @@ -691,7 +656,7 @@ void Entity::_setup() { sets_class_xp(cp->get_xp()); } } - +*/ setup_actionbars(); } @@ -778,19 +743,13 @@ void Entity::_setup() { sets_entity_name(_s_entity_data->get_name()); } - int chl = _s_character_level; - int cl = _s_class_level; - int chxp = _s_character_xp; - int clxp = _s_class_xp; + int chl = _s_level; + int chxp = _s_xp; - _s_character_level = 1; - _s_class_level = 1; + _s_level = 1; - levelup_scharacter(chl - 1); - levelup_sclass(cl - 1); - - sets_class_xp(clxp); - sets_character_xp(chxp); + levelups(chl - 1); + sets_xp(chxp); if (ESS::get_singleton()->get_allow_class_spell_learning()) { Ref class_profile = ProfileManager::get_singleton()->getc_player_profile()->get_class_profile(_s_entity_data->get_path()); @@ -1119,11 +1078,9 @@ Dictionary Entity::_to_dict() { dict["type"] = _s_type; dict["model_index"] = _s_model_index; - dict["class_level"] = gets_class_level(); - dict["character_level"] = _s_character_level; + dict["level"] = _s_level; - dict["class_xp"] = gets_class_xp(); - dict["character_xp"] = _s_character_xp; + dict["xp"] = gets_xp(); dict["money"] = _s_money; @@ -1340,16 +1297,18 @@ void Entity::_from_dict(const Dictionary &dict) { sets_model_index(static_cast(static_cast(dict.get("model_index", 0)))); + /* if (ESS::get_singleton()->get_use_global_class_level()) { - _s_class_level = (dict.get("class_level", 0)); - _s_class_xp = (dict.get("class_xp", 0)); + _s_level = (dict.get("class_level", 0)); + _s_xp = (dict.get("class_xp", 0)); } else { sets_class_level(dict.get("class_level", 0)); - sets_class_xp(dict.get("class_xp", 0)); + sets_xp(dict.get("xp", 0)); } +*/ - sets_character_level(dict.get("character_level", 0)); - sets_character_xp(dict.get("character_xp", 0)); + sets_level(dict.get("level", 0)); + sets_xp(dict.get("xp", 0)); sets_money(dict.get("money", 0)); @@ -2873,56 +2832,35 @@ void Entity::copen_window(int window_id) { //XP Operations void Entity::xp_adds(int value) { - _s_class_xp += value; - _s_character_xp += value; + _s_xp += value; notification_sxp_gained(value); ORPC(xp_addc, value); } void Entity::xp_addc(int value) { - _c_class_xp += value; - _c_character_xp += value; + _c_xp += value; notification_cxp_gained(value); } -void Entity::levelup_sclass(int value) { +void Entity::levelups(int value) { if (value <= 0) return; - if (_s_class_level == ESS::get_singleton()->get_max_class_level()) + if (_s_level == ESS::get_singleton()->get_max_character_level()) return; - _s_class_level += value; + _s_level += value; - notification_sclass_level_up(value); + notification_slevel_up(value); - VRPC(levelup_cclass, value); + VRPC(levelupc, value); } -void Entity::levelup_cclass(int value) { - _c_class_level += value; +void Entity::levelupc(int value) { + _c_level += value; - notification_cclass_level_up(value); -} - -void Entity::levelup_scharacter(int value) { - if (value <= 0) - return; - - if (_s_character_level == ESS::get_singleton()->get_max_character_level()) - return; - - _s_character_level += value; - - notification_scharacter_level_up(value); - - VRPC(levelup_ccharacter, value); -} -void Entity::levelup_ccharacter(int value) { - _c_character_level += value; - - notification_ccharacter_level_up(value); + notification_clevel_up(value); } //// Spell System //// @@ -3180,12 +3118,8 @@ void Entity::notification_sxp_gained(int value) { NOTIFICATION_IMPLS(notification_sxp_gained, "notification_sxp_gained", value); } -void Entity::notification_sclass_level_up(int value) { - NOTIFICATION_IMPLS(notification_sclass_level_up, "notification_sclass_level_up", value); -} - -void Entity::notification_scharacter_level_up(int value) { - NOTIFICATION_IMPLS(notification_scharacter_level_up, "notification_scharacter_level_up", value); +void Entity::notification_slevel_up(int value) { + NOTIFICATION_IMPLS(notification_slevel_up, "notification_slevel_up", value); } void Entity::notification_sentity_resource_added(Ref resource) { @@ -3645,12 +3579,8 @@ void Entity::notification_cxp_gained(int value) { NOTIFICATION_IMPLC(notification_cxp_gained, "notification_cxp_gained", value) } -void Entity::notification_cclass_level_up(int value) { - NOTIFICATION_IMPLC(notification_cclass_level_up, "notification_cclass_level_up", value) -} - -void Entity::notification_ccharacter_level_up(int value) { - NOTIFICATION_IMPLC(notification_ccharacter_level_up, "notification_ccharacter_level_up", value) +void Entity::notification_clevel_up(int value) { + NOTIFICATION_IMPLC(notification_clevel_up, "notification_clevel_up", value) } void Entity::notification_centity_resource_added(Ref resource) { @@ -5803,17 +5733,13 @@ Entity::Entity() { _s_model_index = 0; _c_model_index = 0; - _s_class_level = 1; - _c_class_level = 1; + _s_level = 1; + _c_level = 1; - _s_character_level = 1; - _c_character_level = 1; + _s_level = 1; + _c_level = 1; - _s_class_xp = 0; - _c_class_xp = 0; - - _s_character_xp = 0; - _c_character_xp = 0; + _s_xp = 0; _s_send_flag = 0; @@ -5897,7 +5823,7 @@ Entity::Entity() { SET_RPC_REMOTE("setc_entity_name"); SET_RPC_REMOTE("setc_model_index"); SET_RPC_REMOTE("setc_class_level"); - SET_RPC_REMOTE("setc_character_level"); + SET_RPC_REMOTE("setc_level"); SET_RPC_REMOTE("setc_class_xp"); SET_RPC_REMOTE("setc_character_xp"); SET_RPC_REMOTE("setc_seed"); @@ -6175,6 +6101,7 @@ void Entity::_crafts(int id) { } void Entity::_notification_sxp_gained(int value) { + /* if (ESS::get_singleton()->get_use_class_xp() && ESS::get_singleton()->get_automatic_class_levelups()) { if (ESS::get_singleton()->get_resource_db()->get_xp_data()->can_class_level_up(gets_class_level())) { @@ -6185,19 +6112,19 @@ void Entity::_notification_sxp_gained(int value) { sets_class_xp(0); } } - } + }*/ - if (ESS::get_singleton()->get_resource_db()->get_xp_data()->can_character_level_up(gets_character_level())) { - int xpr = ESS::get_singleton()->get_resource_db()->get_xp_data()->get_character_xp(gets_character_level()); + if (ESS::get_singleton()->get_resource_db()->get_xp_data()->can_character_level_up(gets_level())) { + int xpr = ESS::get_singleton()->get_resource_db()->get_xp_data()->get_character_xp(gets_level()); - if (xpr <= gets_character_xp()) { - levelup_scharacter(1); - sets_character_xp(0); + if (xpr <= gets_xp()) { + levelups(1); + sets_xp(0); } } } -void Entity::_notification_scharacter_level_up(int level) { +void Entity::_notification_slevel_up(int level) { if (!gets_entity_data().is_valid()) return; @@ -6207,7 +6134,7 @@ void Entity::_notification_scharacter_level_up(int level) { return; for (int i = 0; i < ESS::get_singleton()->stat_get_main_stat_count(); ++i) { - int st = gets_entity_data()->get_stat_data()->get_level_stat_data()->get_stat_diff(i, gets_character_level() - level, gets_character_level()); + int st = gets_entity_data()->get_stat_data()->get_level_stat_data()->get_stat_diff(i, gets_level() - level, gets_level()); stat_mod_base(i, st); } @@ -6218,16 +6145,6 @@ void Entity::_notification_scharacter_level_up(int level) { sets_free_character_talent_points(gets_free_character_talent_points() + level); } -} - -void Entity::_notification_sclass_level_up(int level) { - if (!gets_entity_data().is_valid()) - return; - - Ref ecd = gets_entity_data()->get_entity_class_data(); - - if (!ecd.is_valid()) - return; if (ESS::get_singleton()->get_use_spell_points()) sets_free_spell_points(gets_free_spell_points() + ecd->get_spell_points_per_level() * level); @@ -6241,7 +6158,7 @@ void Entity::_notification_sclass_level_up(int level) { if (!sp.is_valid()) continue; - if (sp->get_level() <= gets_class_level() && !spell_hass(sp)) { + if (sp->get_level() <= gets_level() && !spell_hass(sp)) { Ref rs = sp->get_training_required_spell(); if (rs.is_valid() && !spell_hass(rs)) { @@ -6620,8 +6537,7 @@ void Entity::_bind_methods() { BIND_VMETHOD(MethodInfo("_notification_sgcd_finished")); BIND_VMETHOD(MethodInfo("_notification_sxp_gained", PropertyInfo(Variant::INT, "value"))); - BIND_VMETHOD(MethodInfo("_notification_sclass_level_up", PropertyInfo(Variant::INT, "value"))); - BIND_VMETHOD(MethodInfo("_notification_scharacter_level_up", PropertyInfo(Variant::INT, "value"))); + BIND_VMETHOD(MethodInfo("_notification_slevel_up", PropertyInfo(Variant::INT, "value"))); BIND_VMETHOD(MethodInfo("_notification_sentity_resource_added", PropertyInfo(Variant::OBJECT, "resource", PROPERTY_HINT_RESOURCE_TYPE, "EntityResource"))); BIND_VMETHOD(MethodInfo("_notification_sentity_resource_removed", PropertyInfo(Variant::OBJECT, "resource", PROPERTY_HINT_RESOURCE_TYPE, "EntityResource"))); @@ -6805,8 +6721,7 @@ void Entity::_bind_methods() { BIND_VMETHOD(MethodInfo("_notification_cgcd_finished")); BIND_VMETHOD(MethodInfo("_notification_cxp_gained", PropertyInfo(Variant::INT, "value"))); - BIND_VMETHOD(MethodInfo("_notification_cclass_level_up", PropertyInfo(Variant::INT, "value"))); - BIND_VMETHOD(MethodInfo("_notification_ccharacter_level_up", PropertyInfo(Variant::INT, "value"))); + BIND_VMETHOD(MethodInfo("_notification_clevel_up", PropertyInfo(Variant::INT, "value"))); BIND_VMETHOD(MethodInfo("_notification_centity_resource_added", PropertyInfo(Variant::OBJECT, "resource", PROPERTY_HINT_RESOURCE_TYPE, "EntityResource"))); BIND_VMETHOD(MethodInfo("_notification_centity_resource_removed", PropertyInfo(Variant::OBJECT, "resource", PROPERTY_HINT_RESOURCE_TYPE, "EntityResource"))); @@ -6824,8 +6739,7 @@ void Entity::_bind_methods() { ClassDB::bind_method(D_METHOD("notification_cgcd_finished"), &Entity::notification_cgcd_finished); ClassDB::bind_method(D_METHOD("notification_cxp_gained", "value"), &Entity::notification_cxp_gained); - ClassDB::bind_method(D_METHOD("notification_cclass_level_up", "value"), &Entity::notification_cclass_level_up); - ClassDB::bind_method(D_METHOD("notification_ccharacter_level_up", "value"), &Entity::notification_ccharacter_level_up); + ClassDB::bind_method(D_METHOD("notification_clevel_up", "value"), &Entity::notification_clevel_up); ClassDB::bind_method(D_METHOD("notification_centity_resource_added", "resource"), &Entity::notification_centity_resource_added); ClassDB::bind_method(D_METHOD("notification_centity_resource_removed", "resource"), &Entity::notification_centity_resource_removed); @@ -6872,30 +6786,20 @@ void Entity::_bind_methods() { ADD_SIGNAL(MethodInfo("notification_sxp_gained", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::INT, "value"))); ADD_SIGNAL(MethodInfo("notification_cxp_gained", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::INT, "value"))); - ADD_SIGNAL(MethodInfo("notification_cclass_level_up", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::INT, "value"))); - ADD_SIGNAL(MethodInfo("notification_sclass_level_up", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::INT, "value"))); + ADD_SIGNAL(MethodInfo("notification_clevel_up", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::INT, "value"))); + ADD_SIGNAL(MethodInfo("notification_slevel_up", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::INT, "value"))); - ADD_SIGNAL(MethodInfo("notification_ccharacter_level_up", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::INT, "value"))); - ADD_SIGNAL(MethodInfo("notification_scharacter_level_up", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::INT, "value"))); - - ADD_SIGNAL(MethodInfo("son_class_level_changed", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::INT, "level"))); - ADD_SIGNAL(MethodInfo("con_class_level_changed", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::INT, "level"))); - - ADD_SIGNAL(MethodInfo("son_character_level_changed", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::INT, "level"))); - ADD_SIGNAL(MethodInfo("con_character_level_changed", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::INT, "level"))); + ADD_SIGNAL(MethodInfo("son_level_changed", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::INT, "level"))); + ADD_SIGNAL(MethodInfo("con_level_changed", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::INT, "level"))); ClassDB::bind_method(D_METHOD("xp_adds", "value"), &Entity::xp_adds); ClassDB::bind_method(D_METHOD("xp_addc", "value"), &Entity::xp_addc); - ClassDB::bind_method(D_METHOD("levelup_sclass", "value"), &Entity::levelup_sclass); - ClassDB::bind_method(D_METHOD("levelup_cclass", "value"), &Entity::levelup_cclass); - - ClassDB::bind_method(D_METHOD("levelup_scharacter", "value"), &Entity::levelup_scharacter); - ClassDB::bind_method(D_METHOD("levelup_ccharacter", "value"), &Entity::levelup_ccharacter); + ClassDB::bind_method(D_METHOD("levelups", "value"), &Entity::levelups); + ClassDB::bind_method(D_METHOD("levelupc", "value"), &Entity::levelupc); ClassDB::bind_method(D_METHOD("notification_sxp_gained", "value"), &Entity::notification_sxp_gained); - ClassDB::bind_method(D_METHOD("notification_sclass_level_up", "value"), &Entity::notification_sclass_level_up); - ClassDB::bind_method(D_METHOD("notification_scharacter_level_up", "value"), &Entity::notification_scharacter_level_up); + ClassDB::bind_method(D_METHOD("notification_slevel_up", "value"), &Entity::notification_slevel_up); //Aura Manipulation ClassDB::bind_method(D_METHOD("aura_adds", "aura"), &Entity::aura_adds); @@ -7053,37 +6957,21 @@ void Entity::_bind_methods() { ClassDB::bind_method(D_METHOD("setc_model_index", "value"), &Entity::setc_model_index); ADD_PROPERTY(PropertyInfo(Variant::INT, "cmodel_index", PROPERTY_HINT_NONE, "", 0), "setc_model_index", "getc_model_index"); - ClassDB::bind_method(D_METHOD("gets_class_level"), &Entity::gets_class_level); - ClassDB::bind_method(D_METHOD("sets_class_level", "value"), &Entity::sets_class_level); - ADD_PROPERTY(PropertyInfo(Variant::INT, "sclass_level"), "sets_class_level", "gets_class_level"); + ClassDB::bind_method(D_METHOD("gets_level"), &Entity::gets_level); + ClassDB::bind_method(D_METHOD("sets_level", "value"), &Entity::sets_level); + ADD_PROPERTY(PropertyInfo(Variant::INT, "slevel"), "sets_level", "gets_level"); - ClassDB::bind_method(D_METHOD("getc_class_level"), &Entity::getc_class_level); - ClassDB::bind_method(D_METHOD("setc_class_level", "value"), &Entity::setc_class_level); - ADD_PROPERTY(PropertyInfo(Variant::INT, "cclass_level", PROPERTY_HINT_NONE, "", 0), "setc_class_level", "getc_class_level"); + ClassDB::bind_method(D_METHOD("getc_level"), &Entity::getc_level); + ClassDB::bind_method(D_METHOD("setc_level", "value"), &Entity::setc_level); + ADD_PROPERTY(PropertyInfo(Variant::INT, "clevel", PROPERTY_HINT_NONE, "", 0), "setc_level", "getc_level"); - ClassDB::bind_method(D_METHOD("gets_character_level"), &Entity::gets_character_level); - ClassDB::bind_method(D_METHOD("sets_character_level", "value"), &Entity::sets_character_level); - ADD_PROPERTY(PropertyInfo(Variant::INT, "scharacter_level"), "sets_character_level", "gets_character_level"); + ClassDB::bind_method(D_METHOD("gets_xp"), &Entity::gets_xp); + ClassDB::bind_method(D_METHOD("sets_xp", "value"), &Entity::sets_xp); + ADD_PROPERTY(PropertyInfo(Variant::INT, "sxp", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_ENTITY_HIDDEN), "sets_xp", "gets_xp"); - ClassDB::bind_method(D_METHOD("getc_character_level"), &Entity::getc_character_level); - ClassDB::bind_method(D_METHOD("setc_character_level", "value"), &Entity::setc_character_level); - ADD_PROPERTY(PropertyInfo(Variant::INT, "ccharacter_level", PROPERTY_HINT_NONE, "", 0), "setc_character_level", "getc_character_level"); - - ClassDB::bind_method(D_METHOD("gets_class_xp"), &Entity::gets_class_xp); - ClassDB::bind_method(D_METHOD("sets_class_xp", "value"), &Entity::sets_class_xp); - ADD_PROPERTY(PropertyInfo(Variant::INT, "sclass_xp", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_ENTITY_HIDDEN), "sets_class_xp", "gets_class_xp"); - - ClassDB::bind_method(D_METHOD("getc_class_xp"), &Entity::getc_class_xp); - ClassDB::bind_method(D_METHOD("setc_class_xp", "value"), &Entity::setc_class_xp); - ADD_PROPERTY(PropertyInfo(Variant::INT, "cclass_xp", PROPERTY_HINT_NONE, "", 0), "setc_class_xp", "getc_class_xp"); - - ClassDB::bind_method(D_METHOD("gets_character_xp"), &Entity::gets_character_xp); - ClassDB::bind_method(D_METHOD("sets_character_xp", "value"), &Entity::sets_character_xp); - ADD_PROPERTY(PropertyInfo(Variant::INT, "scharacter_xp", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_ENTITY_HIDDEN), "sets_character_xp", "gets_character_xp"); - - ClassDB::bind_method(D_METHOD("getc_character_xp"), &Entity::getc_character_xp); - ClassDB::bind_method(D_METHOD("setc_character_xp", "value"), &Entity::setc_character_xp); - ADD_PROPERTY(PropertyInfo(Variant::INT, "ccharacter_xp", PROPERTY_HINT_NONE, "", 0), "setc_character_xp", "getc_character_xp"); + ClassDB::bind_method(D_METHOD("getc_xp"), &Entity::getc_xp); + ClassDB::bind_method(D_METHOD("setc_xp", "value"), &Entity::setc_xp); + ADD_PROPERTY(PropertyInfo(Variant::INT, "cxp", PROPERTY_HINT_NONE, "", 0), "setc_xp", "getc_xp"); ClassDB::bind_method(D_METHOD("gets_money"), &Entity::gets_money); ClassDB::bind_method(D_METHOD("sets_money", "value"), &Entity::sets_money); @@ -7640,8 +7528,7 @@ void Entity::_bind_methods() { ClassDB::bind_method(D_METHOD("_crafts", "id"), &Entity::_crafts); ClassDB::bind_method(D_METHOD("_notification_sxp_gained", "value"), &Entity::_notification_sxp_gained); - ClassDB::bind_method(D_METHOD("_notification_scharacter_level_up", "level"), &Entity::_notification_scharacter_level_up); - ClassDB::bind_method(D_METHOD("_notification_sclass_level_up", "level"), &Entity::_notification_sclass_level_up); + ClassDB::bind_method(D_METHOD("_notification_slevel_up", "level"), &Entity::_notification_slevel_up); ClassDB::bind_method(D_METHOD("_moved"), &Entity::_moved); ClassDB::bind_method(D_METHOD("_con_target_changed", "entity", "old_target"), &Entity::_con_target_changed); ClassDB::bind_method(D_METHOD("_notification_sdeath"), &Entity::_notification_sdeath); diff --git a/entities/entity.h b/entities/entity.h index a77a8e0..ff93a06 100644 --- a/entities/entity.h +++ b/entities/entity.h @@ -309,25 +309,15 @@ public: int getc_model_index(); void setc_model_index(int value); - int gets_class_level(); - void sets_class_level(int value); - int getc_class_level(); - void setc_class_level(int value); + int gets_level(); + void sets_level(int value); + int getc_level(); + void setc_level(int value); - int gets_character_level(); - void sets_character_level(int value); - int getc_character_level(); - void setc_character_level(int value); - - int gets_class_xp(); - void sets_class_xp(int value); - int getc_class_xp(); - void setc_class_xp(int value); - - int gets_character_xp(); - void sets_character_xp(int value); - int getc_character_xp(); - void setc_character_xp(int value); + int gets_xp(); + void sets_xp(int value); + int getc_xp(); + void setc_xp(int value); int gets_money(); void sets_money(int value); @@ -549,8 +539,7 @@ public: void notification_sentity_resource_removed(Ref resource); void notification_sxp_gained(int value); - void notification_sclass_level_up(int value); - void notification_scharacter_level_up(int value); + void notification_slevel_up(int value); void notification_sdeath(); @@ -572,8 +561,7 @@ public: void notification_centity_resource_removed(Ref resource); void notification_cxp_gained(int value); - void notification_cclass_level_up(int value); - void notification_ccharacter_level_up(int value); + void notification_clevel_up(int value); void notification_cdeath(); @@ -625,10 +613,8 @@ public: //XP Operations void xp_adds(int value); void xp_addc(int value); - void levelup_sclass(int value); - void levelup_cclass(int value); - void levelup_scharacter(int value); - void levelup_ccharacter(int value); + void levelups(int value); + void levelupc(int value); //Aura Manipulation void aura_adds(Ref aura); @@ -1095,8 +1081,7 @@ public: protected: void _crafts(int id); void _notification_sxp_gained(int value); - void _notification_scharacter_level_up(int level); - void _notification_sclass_level_up(int level); + void _notification_slevel_up(int level); void _moved(); void _con_target_changed(Node *p_entity, Node *p_old_target); void _notification_sdeath(); @@ -1161,17 +1146,11 @@ private: int _s_model_index; int _c_model_index; - int _s_class_level; - int _c_class_level; + int _s_level; + int _c_level; - int _s_character_level; - int _c_character_level; - - int _s_class_xp; - int _c_class_xp; - - int _s_character_xp; - int _c_character_xp; + int _s_xp; + int _c_xp; int _s_money; int _c_money; diff --git a/utility/entity_create_info.cpp b/utility/entity_create_info.cpp index 5a6f52b..6d358e3 100644 --- a/utility/entity_create_info.cpp +++ b/utility/entity_create_info.cpp @@ -75,32 +75,18 @@ void EntityCreateInfo::set_entity_name(const String &value) { _entity_name = value; } -int EntityCreateInfo::get_class_level() const { - return _class_level; +int EntityCreateInfo::get_level() const { + return _level; } -void EntityCreateInfo::set_class_level(const int value) { - _class_level = value; +void EntityCreateInfo::set_level(const int value) { + _level = value; } -int EntityCreateInfo::get_character_level() const { - return _character_level; +int EntityCreateInfo::get_xp() const { + return _xp; } -void EntityCreateInfo::set_character_level(const int value) { - _character_level = value; -} - -int EntityCreateInfo::get_class_xp() const { - return _class_xp; -} -void EntityCreateInfo::set_class_xp(const int value) { - _class_xp = value; -} - -int EntityCreateInfo::get_character_xp() const { - return _character_xp; -} -void EntityCreateInfo::set_character_xp(const int value) { - _character_xp = value; +void EntityCreateInfo::set_xp(const int value) { + _xp = value; } Transform EntityCreateInfo::get_transform() const { @@ -180,10 +166,8 @@ Dictionary EntityCreateInfo::_to_dict() { dict["network_owner"] = _network_owner; dict["entity_controller"] = _entity_controller; dict["entity_name"] = _entity_name; - dict["class_level"] = _class_level; - dict["character_level"] = _character_level; - dict["class_xp"] = _class_xp; - dict["character_xp"] = _character_xp; + dict["level"] = _level; + dict["xp"] = _xp; dict["transform"] = _transform; dict["transform2d"] = _transform2d; @@ -206,10 +190,8 @@ void EntityCreateInfo::_from_dict(const Dictionary &dict) { _network_owner = dict.get("network_owner", 0); _entity_controller = static_cast(static_cast(dict.get("entity_controller", 0))); _entity_name = dict.get("entity_name", ""); - _class_level = dict.get("class_level", 0); - _character_level = dict.get("character_level", 0); - _class_xp = dict.get("class_xp", 0); - _character_xp = dict.get("character_xp", 0); + _level = dict.get("level", 0); + _xp = dict.get("xp", 0); _transform = dict.get("transform", Transform()); _transform2d = dict.get("transform2d", Transform2D()); _species_instance = dict.get("species_instance", Ref()); @@ -224,10 +206,8 @@ EntityCreateInfo::EntityCreateInfo() { _entity_player_type = 0; _network_owner = 0; _entity_controller = EntityEnums::ENITIY_CONTROLLER_NONE; - _class_level = 0; - _character_level = 0; - _class_xp = 0; - _character_xp = 0; + _level = 0; + _xp = 0; _created_entity = NULL; } @@ -265,21 +245,13 @@ void EntityCreateInfo::_bind_methods() { ClassDB::bind_method(D_METHOD("set_entity_name", "value"), &EntityCreateInfo::set_entity_name); ADD_PROPERTY(PropertyInfo(Variant::STRING, "player_name"), "set_entity_name", "get_entity_name"); - ClassDB::bind_method(D_METHOD("get_class_level"), &EntityCreateInfo::get_class_level); - ClassDB::bind_method(D_METHOD("set_class_level", "value"), &EntityCreateInfo::set_class_level); - ADD_PROPERTY(PropertyInfo(Variant::INT, "class_level"), "set_class_level", "get_class_level"); + ClassDB::bind_method(D_METHOD("get_level"), &EntityCreateInfo::get_level); + ClassDB::bind_method(D_METHOD("set_level", "value"), &EntityCreateInfo::set_level); + ADD_PROPERTY(PropertyInfo(Variant::INT, "level"), "set_level", "get_level"); - ClassDB::bind_method(D_METHOD("get_character_level"), &EntityCreateInfo::get_character_level); - ClassDB::bind_method(D_METHOD("set_character_level", "value"), &EntityCreateInfo::set_character_level); - ADD_PROPERTY(PropertyInfo(Variant::INT, "character_level"), "set_character_level", "get_character_level"); - - ClassDB::bind_method(D_METHOD("get_class_xp"), &EntityCreateInfo::get_class_xp); - ClassDB::bind_method(D_METHOD("set_class_xp", "value"), &EntityCreateInfo::set_class_xp); - ADD_PROPERTY(PropertyInfo(Variant::INT, "class_xp"), "set_class_xp", "get_class_xp"); - - ClassDB::bind_method(D_METHOD("get_character_xp"), &EntityCreateInfo::get_character_xp); - ClassDB::bind_method(D_METHOD("set_character_xp", "value"), &EntityCreateInfo::set_character_xp); - ADD_PROPERTY(PropertyInfo(Variant::INT, "character_xp"), "set_character_xp", "get_character_xp"); + ClassDB::bind_method(D_METHOD("get_xp"), &EntityCreateInfo::get_xp); + ClassDB::bind_method(D_METHOD("set_xp", "value"), &EntityCreateInfo::set_xp); + ADD_PROPERTY(PropertyInfo(Variant::INT, "xp"), "set_xp", "get_xp"); ClassDB::bind_method(D_METHOD("get_transform"), &EntityCreateInfo::get_transform); ClassDB::bind_method(D_METHOD("set_transform", "value"), &EntityCreateInfo::set_transform); diff --git a/utility/entity_create_info.h b/utility/entity_create_info.h index 7e0a674..f00cbf0 100644 --- a/utility/entity_create_info.h +++ b/utility/entity_create_info.h @@ -56,17 +56,11 @@ public: String get_entity_name() const; void set_entity_name(const String &value); - int get_class_level() const; - void set_class_level(const int value); + int get_level() const; + void set_level(const int value); - int get_character_level() const; - void set_character_level(const int value); - - int get_class_xp() const; - void set_class_xp(const int value); - - int get_character_xp() const; - void set_character_xp(const int value); + int get_xp() const; + void set_xp(const int value); Transform get_transform() const; void set_transform(const Transform &value); @@ -109,10 +103,8 @@ private: int _network_owner; EntityEnums::EntityController _entity_controller; String _entity_name; - int _class_level; - int _character_level; - int _class_xp; - int _character_xp; + int _level; + int _xp; Transform _transform; Transform2D _transform2d;